diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-05-17 12:01:57 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-05-17 11:16:41 +0000 |
commit | f935bf47d1928f3b4df9cde600ce365cd63e485d (patch) | |
tree | fa594346650a30d85758e8891dc09add200ce6b0 /sw | |
parent | 6e96587601e7f73869d09ac2e3296b606b290721 (diff) |
sfx2 classification: do not hardcode policy type in SfxClassificationParser
TSCP_BAILSv1 says:
"{type} designates the type of a policy. In BAILS 1.0, the recognized
string values are: ExportControl, NationalSecurity and
IntellectualProperty"
Previously {type} was always assumed to be IntellectualProperty. Change
the parser to not hardcode the policy type anymore; also change the
getter for the string constants to not contain this prefix.
SfxClassificationHelper::Impl still doesn't support multiple policy
types, though.
Change-Id: If52b40577f1c5751dacb83617fb28862d9d5bdb3
Reviewed-on: https://gerrit.libreoffice.org/25055
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/edit/edfcol.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index 86b288381be9..4ed3dbc8f0ec 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -218,11 +218,11 @@ void SwEditShell::SetClassification(const OUString& rName) if (bHeaderIsNeeded) { - if (!lcl_hasField(xHeaderText, aServiceName, SfxClassificationHelper::PROP_DOCHEADER())) + if (!lcl_hasField(xHeaderText, aServiceName, SfxClassificationHelper::PROP_PREFIX_INTELLECTUALPROPERTY() + SfxClassificationHelper::PROP_DOCHEADER())) { // Append a field to the end of the header text. uno::Reference<beans::XPropertySet> xField(xMultiServiceFactory->createInstance(aServiceName), uno::UNO_QUERY); - xField->setPropertyValue(UNO_NAME_NAME, uno::makeAny(SfxClassificationHelper::PROP_DOCHEADER())); + xField->setPropertyValue(UNO_NAME_NAME, uno::makeAny(SfxClassificationHelper::PROP_PREFIX_INTELLECTUALPROPERTY() + SfxClassificationHelper::PROP_DOCHEADER())); uno::Reference<text::XTextContent> xTextContent(xField, uno::UNO_QUERY); xHeaderText->insertTextContent(xHeaderText->getEnd(), xTextContent, /*bAbsorb=*/false); } @@ -231,7 +231,8 @@ void SwEditShell::SetClassification(const OUString& rName) if (bWatermarkIsNeeded || bHadWatermark) { OUString aShapeServiceName = "com.sun.star.drawing.CustomShape"; - uno::Reference<drawing::XShape> xWatermark = lcl_getWatermark(xHeaderText, aShapeServiceName, SfxClassificationHelper::PROP_DOCWATERMARK()); + static const OUString sWatermark = SfxClassificationHelper::PROP_PREFIX_INTELLECTUALPROPERTY() + SfxClassificationHelper::PROP_DOCWATERMARK(); + uno::Reference<drawing::XShape> xWatermark = lcl_getWatermark(xHeaderText, aShapeServiceName, sWatermark); bool bDeleteWatermark = bHadWatermark && !bWatermarkIsNeeded; if (xWatermark.is()) @@ -344,7 +345,7 @@ void SwEditShell::SetClassification(const OUString& rName) xPropertySet->setPropertyValue("CustomShapeGeometry", uno::makeAny(comphelper::containerToSequence(aGeomPropVec))); uno::Reference<container::XNamed> xNamed(xShape, uno::UNO_QUERY); - xNamed->setName(SfxClassificationHelper::PROP_DOCWATERMARK()); + xNamed->setName(SfxClassificationHelper::PROP_PREFIX_INTELLECTUALPROPERTY() + SfxClassificationHelper::PROP_DOCWATERMARK()); xLockable->removeActionLock(); } } @@ -361,11 +362,12 @@ void SwEditShell::SetClassification(const OUString& rName) // If the footer already contains a document header field, no need to do anything. uno::Reference<text::XText> xFooterText; xPageStyle->getPropertyValue(UNO_NAME_FOOTER_TEXT) >>= xFooterText; - if (!lcl_hasField(xFooterText, aServiceName, SfxClassificationHelper::PROP_DOCFOOTER())) + static OUString sFooter = SfxClassificationHelper::PROP_PREFIX_INTELLECTUALPROPERTY() + SfxClassificationHelper::PROP_DOCFOOTER(); + if (!lcl_hasField(xFooterText, aServiceName, sFooter)) { // Append a field to the end of the footer text. uno::Reference<beans::XPropertySet> xField(xMultiServiceFactory->createInstance(aServiceName), uno::UNO_QUERY); - xField->setPropertyValue(UNO_NAME_NAME, uno::makeAny(SfxClassificationHelper::PROP_DOCFOOTER())); + xField->setPropertyValue(UNO_NAME_NAME, uno::makeAny(sFooter)); uno::Reference<text::XTextContent> xTextContent(xField, uno::UNO_QUERY); xFooterText->insertTextContent(xFooterText->getEnd(), xTextContent, /*bAbsorb=*/false); } |