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

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Mon Nov 6 10:47:31 UTC 2017


 include/sfx2/classificationhelper.hxx |   22 ++++++++++++++++++----
 sd/source/ui/view/drviews2.cxx        |    6 +++---
 sw/source/core/edit/edfcol.cxx        |   12 ++++++------
 3 files changed, 27 insertions(+), 13 deletions(-)

New commits:
commit fe2e279c0817827ba61c37735dfd098bfe3337fe
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon Nov 6 16:55:15 2017 +0900

    TSCP: need to enumerate the marker and IPPart properties too
    
    Change-Id: Ibc8643667c3ae352107a93dcce2be02b1a9af06f
    Reviewed-on: https://gerrit.libreoffice.org/44344
    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 0ea432ffbe99..c5c6294d603b 100644
--- a/include/sfx2/classificationhelper.hxx
+++ b/include/sfx2/classificationhelper.hxx
@@ -116,6 +116,8 @@ private:
     const SfxClassificationPolicyType m_ePolicyType;
     const OUString m_sPolicy;
     sal_Int32 m_nTextNumber;
+    sal_Int32 m_nIPPartNumber;
+    sal_Int32 m_nMarkingNumber;
 
     OUString getPolicyKey() const
     {
@@ -126,21 +128,23 @@ public:
         : m_ePolicyType(ePolicyType)
         , m_sPolicy(SfxClassificationHelper::policyTypeToString(m_ePolicyType))
         , m_nTextNumber(1)
+        , m_nIPPartNumber(1)
+        , m_nMarkingNumber(1)
     {}
 
-    OUString makeMarkingTextKey() const
+    OUString makeTextKey() const
     {
         return getPolicyKey() + "Marking:Text";
     }
 
-    OUString makeNumberedMarkingTextKey()
+    OUString makeNumberedTextKey()
     {
-        return makeMarkingTextKey() + ":" + OUString::number(m_nTextNumber++);
+        return makeTextKey() + ":" + OUString::number(m_nTextNumber++);
     }
 
     bool isMarkingTextKey(OUString const & aKey) const
     {
-        return aKey.startsWith(makeMarkingTextKey());
+        return aKey.startsWith(makeTextKey());
     }
 
     OUString makeCategoryNameKey() const
@@ -168,6 +172,11 @@ public:
         return getPolicyKey() + "Extension:Marking";
     }
 
+    OUString makeNumberedMarkingKey()
+    {
+        return makeMarkingKey() + ":" + OUString::number(m_nMarkingNumber++);
+    }
+
     bool isMarkingKey(OUString const & aKey) const
     {
         return aKey.startsWith(makeMarkingKey());
@@ -178,6 +187,11 @@ public:
         return getPolicyKey() + "Extension:IntellectualPropertyPart";
     }
 
+    OUString makeNumberedIntellectualPropertyPartKey()
+    {
+        return makeIntellectualPropertyPartKey() + ":" + OUString::number(m_nIPPartNumber++);
+    }
+
     bool isIntellectualPropertyPartKey(OUString const & aKey) const
     {
         return aKey.startsWith(makeIntellectualPropertyPartKey());
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 02677ab4846d..6e327c690ae1 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -405,7 +405,7 @@ private:
             {
                 case svx::ClassificationType::TEXT:
                 {
-                    OUString sKey = m_aKeyCreator.makeNumberedMarkingTextKey();
+                    OUString sKey = m_aKeyCreator.makeNumberedTextKey();
                     svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer, sKey, rResult.msName);
                     pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition);
                 }
@@ -420,7 +420,7 @@ private:
 
                 case svx::ClassificationType::MARKING:
                 {
-                    OUString sKey = m_aKeyCreator.makeMarkingKey();
+                    OUString sKey = m_aKeyCreator.makeNumberedMarkingKey();
                     svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer, sKey, rResult.msName);
                     pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition);
                 }
@@ -428,7 +428,7 @@ private:
 
                 case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART:
                 {
-                    OUString sKey = m_aKeyCreator.makeIntellectualPropertyPartKey();
+                    OUString sKey = m_aKeyCreator.makeNumberedIntellectualPropertyPartKey();
                     svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer, sKey, rResult.msName);
                     pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition);
                 }
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index a388be593dc1..8124f7bdaa6e 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -789,7 +789,7 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes
             {
                 case svx::ClassificationType::TEXT:
                 {
-                    OUString sKey = aCreator.makeNumberedMarkingTextKey();
+                    OUString sKey = aCreator.makeNumberedTextKey();
 
                     svx::classification::addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msName);
                     insertFieldToDocument(xMultiServiceFactory, xHeaderText, xHeaderParagraphCursor, sKey);
@@ -807,7 +807,7 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes
 
                 case svx::ClassificationType::MARKING:
                 {
-                    OUString sKey = aCreator.makeMarkingKey();
+                    OUString sKey = aCreator.makeNumberedMarkingKey();
                     svx::classification::addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msName);
                     insertFieldToDocument(xMultiServiceFactory, xHeaderText, xHeaderParagraphCursor, sKey);
                     insertFieldToDocument(xMultiServiceFactory, xFooterText, xFooterParagraphCursor, sKey);
@@ -816,7 +816,7 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes
 
                 case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART:
                 {
-                    OUString sKey = aCreator.makeIntellectualPropertyPartKey();
+                    OUString sKey = aCreator.makeNumberedIntellectualPropertyPartKey();
                     svx::classification::addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msName);
                     insertFieldToDocument(xMultiServiceFactory, xHeaderText, xHeaderParagraphCursor, sKey);
                     insertFieldToDocument(xMultiServiceFactory, xFooterText, xFooterParagraphCursor, sKey);
@@ -1094,7 +1094,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
         {
             case svx::ClassificationType::TEXT:
             {
-                sKey = aKeyCreator.makeNumberedMarkingTextKey();
+                sKey = aKeyCreator.makeNumberedTextKey();
             }
             break;
 
@@ -1109,13 +1109,13 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
 
             case svx::ClassificationType::MARKING:
             {
-                sKey = aKeyCreator.makeMarkingKey();
+                sKey = aKeyCreator.makeNumberedMarkingKey();
             }
             break;
 
             case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART:
             {
-                sKey = aKeyCreator.makeIntellectualPropertyPartKey();
+                sKey = aKeyCreator.makeNumberedIntellectualPropertyPartKey();
             }
             break;
 


More information about the Libreoffice-commits mailing list