summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sfx2/classificationhelper.hxx17
-rw-r--r--include/svx/ClassificationCommon.hxx8
-rw-r--r--svx/source/dialog/ClassificationCommon.cxx25
-rw-r--r--sw/source/core/edit/edfcol.cxx24
4 files changed, 70 insertions, 4 deletions
diff --git a/include/sfx2/classificationhelper.hxx b/include/sfx2/classificationhelper.hxx
index c5c6294d603b..a3f32788c2d9 100644
--- a/include/sfx2/classificationhelper.hxx
+++ b/include/sfx2/classificationhelper.hxx
@@ -110,6 +110,15 @@ public:
namespace sfx
{
+
+/// Specifies the origin: either defined by the BAF policy or manual via. the advanced classification dialog
+enum class ClassificationCreationOrigin
+{
+ NONE,
+ BAF_POLICY,
+ MANUAL
+};
+
class ClassificationKeyCreator
{
private:
@@ -199,7 +208,13 @@ public:
OUString makeFullTextualRepresentationKey() const
{
- return getPolicyKey() + "FullTexturalRepresentation";
+ return getPolicyKey() + "Extension:FullTexturalRepresentation";
+ }
+
+ /// Classification creation origin key
+ OUString makeCreationOriginKey() const
+ {
+ return getPolicyKey() + "CreationOrigin";
}
};
diff --git a/include/svx/ClassificationCommon.hxx b/include/svx/ClassificationCommon.hxx
index eb8d864ff21b..c08ecd7293ad 100644
--- a/include/svx/ClassificationCommon.hxx
+++ b/include/svx/ClassificationCommon.hxx
@@ -43,6 +43,14 @@ SVX_DLLPUBLIC void insertFullTextualRepresentationAsDocumentProperty(
css::uno::Reference<css::beans::XPropertyContainer> const& rxPropertyContainer,
sfx::ClassificationKeyCreator const& rKeyCreator,
std::vector<svx::ClassificationResult> const& rResults);
+
+SVX_DLLPUBLIC void insertCreationOrigin(css::uno::Reference<css::beans::XPropertyContainer> const & rxPropertyContainer,
+ sfx::ClassificationKeyCreator const & rKeyCreator,
+ sfx::ClassificationCreationOrigin eOrigin);
+
+SVX_DLLPUBLIC sfx::ClassificationCreationOrigin getCreationOriginProperty(css::uno::Reference<css::beans::XPropertyContainer> const & rxPropertyContainer,
+ sfx::ClassificationKeyCreator const & rKeyCreator);
+
}
} // end svx::classification namespace
diff --git a/svx/source/dialog/ClassificationCommon.cxx b/svx/source/dialog/ClassificationCommon.cxx
index 15734d7adc11..53200046d3e5 100644
--- a/svx/source/dialog/ClassificationCommon.cxx
+++ b/svx/source/dialog/ClassificationCommon.cxx
@@ -105,6 +105,31 @@ void insertFullTextualRepresentationAsDocumentProperty(
addOrInsertDocumentProperty(rxPropertyContainer, rKeyCreator.makeFullTextualRepresentationKey(),
sString);
}
+
+void insertCreationOrigin(uno::Reference<beans::XPropertyContainer> const & rxPropertyContainer,
+ sfx::ClassificationKeyCreator const & rKeyCreator,
+ sfx::ClassificationCreationOrigin eOrigin)
+{
+ // Nothing to do if origin is "NONE"
+ if (eOrigin == sfx::ClassificationCreationOrigin::NONE)
+ return;
+
+ OUString sValue = (eOrigin == sfx::ClassificationCreationOrigin::BAF_POLICY) ? OUString("BAF_POLICY") : OUString("MANUAL");
+ addOrInsertDocumentProperty(rxPropertyContainer, rKeyCreator.makeCreationOriginKey(), sValue);
+}
+
+sfx::ClassificationCreationOrigin getCreationOriginProperty(uno::Reference<beans::XPropertyContainer> const & rxPropertyContainer,
+ sfx::ClassificationKeyCreator const & rKeyCreator)
+{
+ OUString sValue = getProperty(rxPropertyContainer, rKeyCreator.makeCreationOriginKey());
+ if (sValue.isEmpty())
+ return sfx::ClassificationCreationOrigin::NONE;
+
+ return (sValue == "BAF_POLICY")
+ ? sfx::ClassificationCreationOrigin::BAF_POLICY
+ : sfx::ClassificationCreationOrigin::MANUAL;
+}
+
}
} // end svx::classification namespace
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#