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

New commits:
commit 12434a33c1c153c375d2e02e0ae26f471ff15b68
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
Date:   Fri Nov 10 14:47:24 2017 +0900

    TSCP: simplify setting the highest classification
    
    No need to check the document header for the current document
    classification category. It is right there in the document
    properties.
    
    Change-Id: I46d31fe2ead034b591ea10b478e7cc9e3ef410ef
    Reviewed-on: https://gerrit.libreoffice.org/44575
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index b57f64590536..955a2479df29 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -2040,32 +2040,22 @@ void SwEditShell::ClassifyDocPerHighestParagraphClass()
     if (!SwRDFHelper::hasMetadataGraph(pDocShell->GetBaseModel(), MetaNS))
         return;
 
-    SfxClassificationHelper aHelper(pDocShell->getDocProperties());
+    uno::Reference<document::XDocumentProperties> xDocumentProperties = 
pDocShell->getDocProperties();
+    uno::Reference<beans::XPropertyContainer> xPropertyContainer = 
xDocumentProperties->getUserDefinedProperties();
 
-    const OUString sHighestParaClass = 
lcl_GetHighestClassificationParagraphClass(GetCursor());
+    sfx::ClassificationKeyCreator 
aKeyCreator(SfxClassificationHelper::getPolicyType());
+    SfxClassificationHelper aHelper(xDocumentProperties);
 
-    std::vector<svx::ClassificationResult> results = 
CollectAdvancedClassification();
-    for (const svx::ClassificationResult& rResult : results)
-    {
-        switch (rResult.meType)
-        {
-        case svx::ClassificationType::CATEGORY:
-        {
-            const OUString sHighestClass = 
aHelper.GetHigherClass(sHighestParaClass, rResult.msName);
-            const auto eType = 
SfxClassificationHelper::stringToPolicyType(sHighestClass);
-            SetClassification(sHighestClass, eType);
-        }
-        break;
-        default:
-        break;
-        }
-    }
+    OUString sHighestClass = 
lcl_GetHighestClassificationParagraphClass(GetCursor());
+
+    const OUString aClassificationCategory = 
svx::classification::getProperty(xPropertyContainer, 
aKeyCreator.makeCategoryNameKey());
 
-    if (results.empty())
+    if (!aClassificationCategory.isEmpty())
     {
-        const auto eType = 
SfxClassificationHelper::stringToPolicyType(sHighestParaClass);
-        SetClassification(sHighestParaClass, eType);
+        sHighestClass = aHelper.GetHigherClass(sHighestClass, 
aClassificationCategory);
     }
+    const SfxClassificationPolicyType eType = 
SfxClassificationHelper::stringToPolicyType(sHighestClass);
+    SetClassification(sHighestClass, eType);
 }
 
 // #i62675#
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to