Kaydet (Commit) ed01e23a authored tarafından Ashod Nakashian's avatar Ashod Nakashian Kaydeden (comit) Ashod Nakashian

TSCP: remove classification fields before editing

Change-Id: If6f66a03c5c97ec87931944147d64b3f6de1ef03
Reviewed-on: https://gerrit.libreoffice.org/43021Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarAshod Nakashian <ashnakash@gmail.com>
üst 217dd153
...@@ -789,6 +789,15 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe ...@@ -789,6 +789,15 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
SetParagraphSignatureValidation(bOldValidationFlag); SetParagraphSignatureValidation(bOldValidationFlag);
}); });
// Remove all paragraph classification fields.
for (;;)
{
uno::Reference<text::XTextField> xTextField = lcl_FindParagraphClassificationField(xModel, xParent);
if (!xTextField.is())
break;
lcl_RemoveParagraphMetadataField(xTextField);
}
// Since we always insert at the start of the paragraph, // Since we always insert at the start of the paragraph,
// need to insert in reverse order. // need to insert in reverse order.
std::reverse(aResults.begin(), aResults.end()); std::reverse(aResults.begin(), aResults.end());
...@@ -800,11 +809,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe ...@@ -800,11 +809,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
case svx::ClassificationType::TEXT: case svx::ClassificationType::TEXT:
{ {
const OUString sKey = sPolicy + "Marking:Text:" + OUString::number(nTextNumber++); const OUString sKey = sPolicy + "Marking:Text:" + OUString::number(nTextNumber++);
uno::Reference<text::XTextField> xTextField = lcl_InsertParagraphClassification(xModel, xParent);
uno::Reference<text::XTextField> xTextField = lcl_FindParagraphClassificationField(xModel, xParent, sKey);
if (!xTextField.is())
xTextField = lcl_InsertParagraphClassification(xModel, xParent);
lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString); lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString);
} }
break; break;
...@@ -812,11 +817,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe ...@@ -812,11 +817,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
case svx::ClassificationType::CATEGORY: case svx::ClassificationType::CATEGORY:
{ {
const OUString sKey = sPolicy + "BusinessAuthorizationCategory:Name"; const OUString sKey = sPolicy + "BusinessAuthorizationCategory:Name";
uno::Reference<text::XTextField> xTextField = lcl_InsertParagraphClassification(xModel, xParent);
uno::Reference<text::XTextField> xTextField = lcl_FindParagraphClassificationField(xModel, xParent, sKey);
if (!xTextField.is())
xTextField = lcl_InsertParagraphClassification(xModel, xParent);
lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString); lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString);
} }
break; break;
...@@ -824,11 +825,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe ...@@ -824,11 +825,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
case svx::ClassificationType::MARKING: case svx::ClassificationType::MARKING:
{ {
const OUString sKey = sPolicy + "Extension:Marking"; const OUString sKey = sPolicy + "Extension:Marking";
uno::Reference<text::XTextField> xTextField = lcl_InsertParagraphClassification(xModel, xParent);
uno::Reference<text::XTextField> xTextField = lcl_FindParagraphClassificationField(xModel, xParent, sKey);
if (!xTextField.is())
xTextField = lcl_InsertParagraphClassification(xModel, xParent);
lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString); lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString);
} }
break; break;
...@@ -836,11 +833,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe ...@@ -836,11 +833,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART: case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART:
{ {
const OUString sKey = sPolicy + "Extension:IntellectualPropertyPart"; const OUString sKey = sPolicy + "Extension:IntellectualPropertyPart";
uno::Reference<text::XTextField> xTextField = lcl_InsertParagraphClassification(xModel, xParent);
uno::Reference<text::XTextField> xTextField = lcl_FindParagraphClassificationField(xModel, xParent, sKey);
if (!xTextField.is())
xTextField = lcl_InsertParagraphClassification(xModel, xParent);
lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString); lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString);
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment