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

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Fri Nov 17 09:14:43 UTC 2017


 sw/source/core/edit/edfcol.cxx |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

New commits:
commit 18bc47d6e0eedd4b2e4dc977ae445d60b41eb122
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Fri Nov 17 12:06:13 2017 +0900

    TSCP: convert the class. ID to name, fix class. change on save
    
    Change-Id: Ic829ebeb488f41f3189170e6fdeebd80b28ae8c5
    Reviewed-on: https://gerrit.libreoffice.org/44855
    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 59f9183340a4..cccf2ab539a2 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -2028,16 +2028,21 @@ bool SwEditShell::RemoveParagraphMetadataFieldAtCursor(const bool bBackspaceNotD
     return false;
 }
 
-OUString lcl_GetParagraphClassification(sfx::ClassificationKeyCreator const & rKeyCreator, const uno::Reference<frame::XModel>& xModel, const uno::Reference<text::XTextContent>& xParagraph)
+OUString lcl_GetParagraphClassification(SfxClassificationHelper & rHelper, sfx::ClassificationKeyCreator const & rKeyCreator,
+                                        const uno::Reference<frame::XModel>& xModel, const uno::Reference<text::XTextContent>& xParagraph)
 {
-
-    uno::Reference<text::XTextField> xTextField = lcl_FindParagraphClassificationField(xModel, xParagraph, rKeyCreator.makeCategoryNameKey());
-    if (!xTextField.is())
-        xTextField = lcl_FindParagraphClassificationField(xModel, xParagraph, rKeyCreator.makeCategoryIdentifierKey());
-
+    uno::Reference<text::XTextField> xTextField;
+    xTextField = lcl_FindParagraphClassificationField(xModel, xParagraph, rKeyCreator.makeCategoryIdentifierKey());
     if (xTextField.is())
     {
         const std::pair<OUString, OUString> rdfValuePair = lcl_getRDF(xModel, xTextField, ParagraphClassificationValueRDFName);
+        return rHelper.GetBACNameForIdentifier(rdfValuePair.second);
+    }
+
+    xTextField = lcl_FindParagraphClassificationField(xModel, xParagraph, rKeyCreator.makeCategoryNameKey());
+    if (xTextField.is())
+    {
+        const std::pair<OUString, OUString> rdfValuePair = lcl_getRDF(xModel, xTextField, ParagraphClassificationNameRDFName);
         return rdfValuePair.second;
     }
 
@@ -2068,7 +2073,8 @@ OUString lcl_GetHighestClassificationParagraphClass(SwPaM* pCursor)
     while (xParagraphs->hasMoreElements())
     {
         uno::Reference<text::XTextContent> xParagraph(xParagraphs->nextElement(), uno::UNO_QUERY);
-        sHighestClass = aHelper.GetHigherClass(sHighestClass, lcl_GetParagraphClassification(aKeyCreator, xModel, xParagraph));
+        OUString sCurrentClass = lcl_GetParagraphClassification(aHelper, aKeyCreator, xModel, xParagraph);
+        sHighestClass = aHelper.GetHigherClass(sHighestClass, sCurrentClass);
     }
 
     return sHighestClass;
@@ -2106,6 +2112,7 @@ void SwEditShell::ClassifyDocPerHighestParagraphClass()
     if (sfx::getCreationOriginProperty(xPropertyContainer, aKeyCreator) == sfx::ClassificationCreationOrigin::MANUAL)
     {
         aHelper.SetBACName(sHighestClass, eHighestClassType);
+        ApplyAdvancedClassification(CollectAdvancedClassification());
     }
     else
     {


More information about the Libreoffice-commits mailing list