[Libreoffice-commits] core.git: sw/source
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Oct 2 12:16:00 UTC 2017
sw/source/core/edit/edfcol.cxx | 33 +++++++++++++--------------------
1 file changed, 13 insertions(+), 20 deletions(-)
New commits:
commit ed01e23aeb08addc9ac7d74014483b5af57b15d9
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Oct 1 20:10:44 2017 -0400
TSCP: remove classification fields before editing
Change-Id: If6f66a03c5c97ec87931944147d64b3f6de1ef03
Reviewed-on: https://gerrit.libreoffice.org/43021
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index e1bd4cbcb144..0d7523252d75 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -789,6 +789,15 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
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,
// need to insert in reverse order.
std::reverse(aResults.begin(), aResults.end());
@@ -800,11 +809,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
case svx::ClassificationType::TEXT:
{
const OUString sKey = sPolicy + "Marking:Text:" + OUString::number(nTextNumber++);
-
- uno::Reference<text::XTextField> xTextField = lcl_FindParagraphClassificationField(xModel, xParent, sKey);
- if (!xTextField.is())
- xTextField = lcl_InsertParagraphClassification(xModel, xParent);
-
+ uno::Reference<text::XTextField> xTextField = lcl_InsertParagraphClassification(xModel, xParent);
lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString);
}
break;
@@ -812,11 +817,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
case svx::ClassificationType::CATEGORY:
{
const OUString sKey = sPolicy + "BusinessAuthorizationCategory:Name";
-
- uno::Reference<text::XTextField> xTextField = lcl_FindParagraphClassificationField(xModel, xParent, sKey);
- if (!xTextField.is())
- xTextField = lcl_InsertParagraphClassification(xModel, xParent);
-
+ uno::Reference<text::XTextField> xTextField = lcl_InsertParagraphClassification(xModel, xParent);
lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString);
}
break;
@@ -824,11 +825,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
case svx::ClassificationType::MARKING:
{
const OUString sKey = sPolicy + "Extension:Marking";
-
- uno::Reference<text::XTextField> xTextField = lcl_FindParagraphClassificationField(xModel, xParent, sKey);
- if (!xTextField.is())
- xTextField = lcl_InsertParagraphClassification(xModel, xParent);
-
+ uno::Reference<text::XTextField> xTextField = lcl_InsertParagraphClassification(xModel, xParent);
lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString);
}
break;
@@ -836,11 +833,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART:
{
const OUString sKey = sPolicy + "Extension:IntellectualPropertyPart";
-
- uno::Reference<text::XTextField> xTextField = lcl_FindParagraphClassificationField(xModel, xParent, sKey);
- if (!xTextField.is())
- xTextField = lcl_InsertParagraphClassification(xModel, xParent);
-
+ uno::Reference<text::XTextField> xTextField = lcl_InsertParagraphClassification(xModel, xParent);
lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString);
}
break;
More information about the Libreoffice-commits
mailing list