diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2017-10-01 20:10:44 -0400 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2017-10-02 14:15:31 +0200 |
commit | ed01e23aeb08addc9ac7d74014483b5af57b15d9 (patch) | |
tree | 50ec56ad8b42c1947ce2896b744114826d4d8a33 | |
parent | 217dd15374a7020aa498817bcf4ea28157e7080f (diff) |
TSCP: remove classification fields before editing
Change-Id: If6f66a03c5c97ec87931944147d64b3f6de1ef03
Reviewed-on: https://gerrit.libreoffice.org/43021
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
-rw-r--r-- | sw/source/core/edit/edfcol.cxx | 33 |
1 files changed, 13 insertions, 20 deletions
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; |