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

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Fri Nov 17 03:53:44 UTC 2017


 sw/source/core/edit/edfcol.cxx |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 195bd0f8ca8451eb340beafa4072f37782509d33
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Thu Nov 16 18:40:19 2017 +0900

    TSCP: consistently use identifier for category
    
    When identifier is used for category, it is written into the
    metadata under a different key. When loading it back, it should
    fill the corresponding properties (identifier if identifier key was
    used or name if name key was used), otherwise this can lead to
    inconsistent behaviour when loading the classification data back
    from the file.
    
    Change-Id: Idbd9bde866d117bd7f60bcc224069f00a27fb9e2
    Reviewed-on: https://gerrit.libreoffice.org/44846
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 37c8f1f0d7e7..35a470a5bcad 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1144,7 +1144,8 @@ void lcl_ApplyParagraphClassification(SwDoc* pDoc,
         const bool isLast = nIndex == 0;
         const bool isFirst = nIndex == aResults.size() - 1;
         OUString sKey;
-        switch(rResult.meType)
+        OUString sValue = rResult.msName;
+        switch (rResult.meType)
         {
             case svx::ClassificationType::TEXT:
             {
@@ -1155,10 +1156,14 @@ void lcl_ApplyParagraphClassification(SwDoc* pDoc,
             case svx::ClassificationType::CATEGORY:
             {
                 if (rResult.msIdentifier.isEmpty())
+                {
                     sKey = aKeyCreator.makeCategoryNameKey();
+                }
                 else
+                {
+                    sValue = rResult.msIdentifier;
                     sKey = aKeyCreator.makeCategoryIdentifierKey();
-
+                }
                 SwRDFHelper::addStatement(xModel, MetaNS, MetaFilename, xNodeSubject, ParagraphClassificationAbbrRDFName, rResult.msAbbreviatedName);
             }
             break;
@@ -1182,7 +1187,7 @@ void lcl_ApplyParagraphClassification(SwDoc* pDoc,
         OUString sDisplayText = (isFirst ? ("(" + rResult.msAbbreviatedName) : rResult.msAbbreviatedName);
         if (isLast)
             sDisplayText += ")";
-        lcl_UpdateParagraphClassificationField(pDoc, xModel, xParent, sKey, rResult.msName, sDisplayText);
+        lcl_UpdateParagraphClassificationField(pDoc, xModel, xParent, sKey, sValue, sDisplayText);
         aFieldNames.emplace_back(sKey);
     }
 
@@ -1261,10 +1266,14 @@ std::vector<svx::ClassificationResult> lcl_CollectParagraphClassification(const
         {
             aResult.push_back({ svx::ClassificationType::TEXT, aValue, sBlank, sBlank });
         }
-        else if (aKeyCreator.isCategoryNameKey(aName) || aKeyCreator.isCategoryIdentifierKey(aName))
+        else if (aKeyCreator.isCategoryNameKey(aName))
         {
             aResult.push_back({ svx::ClassificationType::CATEGORY, aValue, sBlank, sBlank });
         }
+        else if (aKeyCreator.isCategoryIdentifierKey(aName))
+        {
+            aResult.push_back({ svx::ClassificationType::CATEGORY, sBlank, sBlank, aValue });
+        }
         else if (aKeyCreator.isMarkingKey(aName))
         {
             aResult.push_back({ svx::ClassificationType::MARKING, aValue, sBlank, sBlank });


More information about the Libreoffice-commits mailing list