[Libreoffice-commits] core.git: include/sfx2 sfx2/source sw/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Mon Oct 16 13:32:56 UTC 2017


 include/sfx2/classificationhelper.hxx         |    2 ++
 sfx2/source/view/classificationcontroller.cxx |   15 +++------------
 sfx2/source/view/classificationhelper.cxx     |   10 ++++++++++
 sw/source/core/edit/edfcol.cxx                |   14 +++-----------
 4 files changed, 18 insertions(+), 23 deletions(-)

New commits:
commit 0716aca251bbb64fab6c8697ee0a2215461f1019
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon Oct 9 11:21:08 2017 +0200

    tscp: move getting the current policy type to class. helper
    
    Change-Id: I54afcca1c1fc1a27458c75ab9fd3405d6f7e9239
    Reviewed-on: https://gerrit.libreoffice.org/43360
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/sfx2/classificationhelper.hxx b/include/sfx2/classificationhelper.hxx
index 7c39415c3315..e83eadfd05e9 100644
--- a/include/sfx2/classificationhelper.hxx
+++ b/include/sfx2/classificationhelper.hxx
@@ -96,6 +96,8 @@ public:
     static const OUString& PROP_DOCWATERMARK();
     /// Get the property prefix for the IntellectualProperty policy type.
     static const OUString& PROP_PREFIX_INTELLECTUALPROPERTY();
+
+    static SfxClassificationPolicyType getPolicyType();
 };
 
 #endif
diff --git a/sfx2/source/view/classificationcontroller.cxx b/sfx2/source/view/classificationcontroller.cxx
index 328466f908cc..1efdb2fd523f 100644
--- a/sfx2/source/view/classificationcontroller.cxx
+++ b/sfx2/source/view/classificationcontroller.cxx
@@ -29,8 +29,6 @@
 #include <comphelper/dispatchcommand.hxx>
 #include <comphelper/configurationlistener.hxx>
 
-#include <officecfg/Office/Common.hxx>
-
 using namespace com::sun::star;
 
 namespace sfx2
@@ -104,16 +102,9 @@ public:
 namespace
 {
 
-SfxClassificationPolicyType getPolicyType()
-{
-    sal_Int32 nPolicyTypeNumber = officecfg::Office::Common::Classification::Policy::get();
-    auto eType = static_cast<SfxClassificationPolicyType>(nPolicyTypeNumber);
-    return eType;
-}
-
 OUString getCategoryType()
 {
-    return SfxClassificationHelper::policyTypeToString(getPolicyType());
+    return SfxClassificationHelper::policyTypeToString(SfxClassificationHelper::getPolicyType());
 }
 
 } // end anonymous namespace
@@ -211,7 +202,7 @@ void ClassificationCategoriesController::statusChanged(const frame::FeatureState
     }
 
     // Restore state based on the doc. model.
-    const OUString& rCategoryName = aHelper.GetBACName(getPolicyType());
+    const OUString& rCategoryName = aHelper.GetBACName(SfxClassificationHelper::getPolicyType());
     if (!rCategoryName.isEmpty())
     {
         m_pClassification->getCategory()->SelectEntry(rCategoryName);
@@ -232,7 +223,7 @@ ClassificationControl::ClassificationControl(vcl::Window* pParent)
     m_pCategory = VclPtr<ListBox>::Create(this, WB_CLIPCHILDREN|WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_DROPDOWN|WB_SIMPLEMODE);
 
     OUString aText;
-    switch (getPolicyType())
+    switch (SfxClassificationHelper::getPolicyType())
     {
     case SfxClassificationPolicyType::IntellectualProperty:
         aText = SfxResId(STR_CLASSIFIED_INTELLECTUAL_PROPERTY);
diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx
index aa61839c06e6..3378ed0df239 100644
--- a/sfx2/source/view/classificationhelper.cxx
+++ b/sfx2/source/view/classificationhelper.cxx
@@ -37,6 +37,8 @@
 #include <svl/fstathelper.hxx>
 #include <config_folders.h>
 
+#include <officecfg/Office/Common.hxx>
+
 using namespace com::sun::star;
 
 namespace
@@ -847,4 +849,12 @@ const OUString& SfxClassificationHelper::PROP_PREFIX_INTELLECTUALPROPERTY()
     return sProp;
 }
 
+SfxClassificationPolicyType SfxClassificationHelper::getPolicyType()
+{
+    sal_Int32 nPolicyTypeNumber = officecfg::Office::Common::Classification::Policy::get();
+    auto eType = static_cast<SfxClassificationPolicyType>(nPolicyTypeNumber);
+    return eType;
+
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 6b90dbde76ca..37b774264aec 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -465,14 +465,6 @@ static void lcl_removeAllProperties(uno::Reference<beans::XPropertyContainer> co
     }
 }
 
-// from classification helper
-SfxClassificationPolicyType getPolicyType()
-{
-    sal_Int32 nPolicyTypeNumber = officecfg::Office::Common::Classification::Policy::get();
-    auto eType = static_cast<SfxClassificationPolicyType>(nPolicyTypeNumber);
-    return eType;
-}
-
 bool addOrInsertDocumentProperty(uno::Reference<beans::XPropertyContainer> const & rxPropertyContainer, OUString const & rsKey, OUString const & rsValue)
 {
     uno::Reference<beans::XPropertySet> xPropertySet(rxPropertyContainer, uno::UNO_QUERY);
@@ -528,11 +520,11 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes
     {
         if (rResult.meType == svx::ClassificationType::CATEGORY)
         {
-            aHelper.SetBACName(rResult.msString, getPolicyType());
+            aHelper.SetBACName(rResult.msString, SfxClassificationHelper::getPolicyType());
         }
     }
 
-    OUString sPolicy = SfxClassificationHelper::policyTypeToString(getPolicyType());
+    OUString sPolicy = SfxClassificationHelper::policyTypeToString(SfxClassificationHelper::getPolicyType());
 
     std::vector<OUString> aUsedPageStyles = lcl_getUsedPageStyles(this);
     for (const OUString& rPageStyleName : aUsedPageStyles)
@@ -637,7 +629,7 @@ std::vector<svx::ClassificationResult> SwEditShell::CollectAdvancedClassificatio
     uno::Reference<document::XDocumentProperties> xDocumentProperties = SfxObjectShell::Current()->getDocProperties();
     uno::Reference<beans::XPropertyContainer> xPropertyContainer = xDocumentProperties->getUserDefinedProperties();
 
-    OUString sPolicy = SfxClassificationHelper::policyTypeToString(getPolicyType());
+    OUString sPolicy = SfxClassificationHelper::policyTypeToString(SfxClassificationHelper::getPolicyType());
     sal_Int32 nParagraph = 1;
 
     while (xParagraphs->hasMoreElements())


More information about the Libreoffice-commits mailing list