summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2017-11-10 14:47:24 +0900
committerTomaž Vajngerl <quikee@gmail.com>2017-11-11 00:48:53 +0100
commit12434a33c1c153c375d2e02e0ae26f471ff15b68 (patch)
tree60f4e33424937d7deda69a12a67c8f9db5b59f76
parente5bc780e92ecf4790869e365142e625b087c5057 (diff)
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 <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--sw/source/core/edit/edfcol.cxx32
1 files changed, 11 insertions, 21 deletions
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#