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

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Fri Nov 10 23:48:08 UTC 2017


 sw/source/core/edit/edfcol.cxx |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit e5bc780e92ecf4790869e365142e625b087c5057
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Fri Nov 10 13:23:48 2017 +0900

    TSCP: use classification key creator instead of strings
    
    Change-Id: I2bc224aa0e290b0fab1c989834e5d79a72de35aa
    Reviewed-on: https://gerrit.libreoffice.org/44574
    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 00fb5766c836..b57f64590536 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1984,12 +1984,12 @@ bool SwEditShell::RemoveParagraphMetadataFieldAtCursor(const bool bBackspaceNotD
     return false;
 }
 
-OUString lcl_GetParagraphClassification(const uno::Reference<frame::XModel>& xModel, const uno::Reference<text::XTextContent>& xParagraph)
+OUString lcl_GetParagraphClassification(sfx::ClassificationKeyCreator const & rKeyCreator, const uno::Reference<frame::XModel>& xModel, const uno::Reference<text::XTextContent>& xParagraph)
 {
-    const OUString sPolicy = SfxClassificationHelper::policyTypeToString(SfxClassificationHelper::getPolicyType());
-    uno::Reference<text::XTextField> xTextField = lcl_FindParagraphClassificationField(xModel, xParagraph, sPolicy + "BusinessAuthorizationCategory:Name");
+
+    uno::Reference<text::XTextField> xTextField = lcl_FindParagraphClassificationField(xModel, xParagraph, rKeyCreator.makeCategoryNameKey());
     if (!xTextField.is())
-        xTextField = lcl_FindParagraphClassificationField(xModel, xParagraph, sPolicy + "BusinessAuthorizationCategory:Identifier");
+        xTextField = lcl_FindParagraphClassificationField(xModel, xParagraph, rKeyCreator.makeCategoryIdentifierKey());
 
     if (xTextField.is())
     {
@@ -2013,6 +2013,7 @@ OUString lcl_GetHighestClassificationParagraphClass(SwPaM* pCursor)
         return sHighestClass;
 
     SfxClassificationHelper aHelper(pDocShell->getDocProperties());
+    sfx::ClassificationKeyCreator aKeyCreator(SfxClassificationHelper::getPolicyType());
 
     uno::Reference<frame::XModel> xModel = pDocShell->GetBaseModel();
     const uno::Reference< text::XTextDocument > xDoc(xModel, uno::UNO_QUERY);
@@ -2023,7 +2024,7 @@ OUString lcl_GetHighestClassificationParagraphClass(SwPaM* pCursor)
     while (xParagraphs->hasMoreElements())
     {
         uno::Reference<text::XTextContent> xParagraph(xParagraphs->nextElement(), uno::UNO_QUERY);
-        sHighestClass = aHelper.GetHigherClass(sHighestClass, lcl_GetParagraphClassification(xModel, xParagraph));
+        sHighestClass = aHelper.GetHigherClass(sHighestClass, lcl_GetParagraphClassification(aKeyCreator, xModel, xParagraph));
     }
 
     return sHighestClass;


More information about the Libreoffice-commits mailing list