diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-11-10 16:26:56 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2017-11-11 12:11:03 +0100 |
commit | 5bd7cc788d0b0f4a2595f32f4897abe6e39ce6c8 (patch) | |
tree | 6c440a5a2ef879e7fbe2b4d6e9e8f77c9058c68b /sw | |
parent | f9333f9d47eb8906b4ef74cbb0a09cf1a9a5f2e6 (diff) |
TSCP: Remember the origin and on save, act accordingly
If we created the document classification via pop-up (BAF policy)
then the highest classification needs to apply the classification
from the BAF policy. In other case the classification was set via
the advanced classification dialog, we only need to reset the
document properties.
Change-Id: I0aa0c010e8de3c16920b64a97e5e4dd2e643c2cd
Reviewed-on: https://gerrit.libreoffice.org/44576
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/edit/edfcol.cxx | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index 955a2479df29..3ccc7616877b 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -778,7 +778,6 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes if (xHeaderText.is()) removeAllClassificationFields(sPolicy, xHeaderText); - // FOOTER bool bFooterIsOn = false; xPageStyle->getPropertyValue(UNO_NAME_FOOTER_IS_ON) >>= bFooterIsOn; @@ -806,6 +805,9 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes sfx::ClassificationKeyCreator aCreator(SfxClassificationHelper::getPolicyType()); + // Insert origin document property + svx::classification::insertCreationOrigin(xPropertyContainer, aCreator, sfx::ClassificationCreationOrigin::MANUAL); + // Insert full text as document property svx::classification::insertFullTextualRepresentationAsDocumentProperty(xPropertyContainer, aCreator, rResults); @@ -1022,6 +1024,11 @@ void SwEditShell::SetClassification(const OUString& rName, SfxClassificationPoli // This updates the infobar as well. aHelper.SetBACName(rName, eType); + // Insert origin document property + uno::Reference<beans::XPropertyContainer> xPropertyContainer = pDocShell->getDocProperties()->getUserDefinedProperties(); + sfx::ClassificationKeyCreator aCreator(SfxClassificationHelper::getPolicyType()); + svx::classification::insertCreationOrigin(xPropertyContainer, aCreator, sfx::ClassificationCreationOrigin::BAF_POLICY); + bool bHeaderIsNeeded = aHelper.HasDocumentHeader(); bool bFooterIsNeeded = aHelper.HasDocumentFooter(); OUString aWatermark = aHelper.GetDocumentWatermark(); @@ -2054,8 +2061,19 @@ void SwEditShell::ClassifyDocPerHighestParagraphClass() { sHighestClass = aHelper.GetHigherClass(sHighestClass, aClassificationCategory); } - const SfxClassificationPolicyType eType = SfxClassificationHelper::stringToPolicyType(sHighestClass); - SetClassification(sHighestClass, eType); + + const SfxClassificationPolicyType eHighestClassType = SfxClassificationHelper::stringToPolicyType(sHighestClass); + + // Check the origin, if "manual" (created via advanced classification dialog), + // then we just need to set the category name. + if (svx::classification::getCreationOriginProperty(xPropertyContainer, aKeyCreator) == sfx::ClassificationCreationOrigin::MANUAL) + { + aHelper.SetBACName(sHighestClass, eHighestClassType); + } + else + { + SetClassification(sHighestClass, eHighestClassType); + } } // #i62675# |