summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-02-25 14:15:38 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-02-25 17:21:53 +0100
commitcf33f6b494b53fde5f410893b7071aa829c4ecca (patch)
treec6b955b9b133e2102b9176a55136fc9dfc1c723c
parent0c4a0a53d9fb697a83c8292b2dd50ac25014fe9f (diff)
sfx2 classification: expose category names as parsed from the policy
Change-Id: I53b958dff2f43d4762445c4b474f2b00ae6dc9d0
-rw-r--r--include/sfx2/classificationhelper.hxx3
-rw-r--r--sfx2/source/view/classificationhelper.cxx14
2 files changed, 17 insertions, 0 deletions
diff --git a/include/sfx2/classificationhelper.hxx b/include/sfx2/classificationhelper.hxx
index c84f7ce22aba..cad0eaf6350e 100644
--- a/include/sfx2/classificationhelper.hxx
+++ b/include/sfx2/classificationhelper.hxx
@@ -11,6 +11,7 @@
#define INCLUDED_SFX2_CLASSIFICATIONHELPER_HXX
#include <memory>
+#include <vector>
#include <rtl/ustring.hxx>
#include <sfx2/dllapi.h>
@@ -35,6 +36,8 @@ public:
SfxClassificationHelper(SfxObjectShell& rObjectShell);
~SfxClassificationHelper();
OUString GetBACName();
+ /// Return all possible valid category names, based on the policy.
+ std::vector<OUString> GetBACNames();
/// Setting this sets all the other properties, based on the policy.
void SetBACName(const OUString& rName);
/// If GetImpactLevelColor() will return something meaningful.
diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx
index 3ff9047db16a..f6bb6da7eb4c 100644
--- a/sfx2/source/view/classificationhelper.cxx
+++ b/sfx2/source/view/classificationhelper.cxx
@@ -10,6 +10,7 @@
#include <sfx2/classificationhelper.hxx>
#include <map>
+#include <algorithm>
#include <com/sun/star/beans/XPropertyContainer.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
@@ -493,6 +494,19 @@ OUString SfxClassificationHelper::GetDocumentWatermark()
return OUString();
}
+std::vector<OUString> SfxClassificationHelper::GetBACNames()
+{
+ if (m_pImpl->m_aCategories.empty())
+ m_pImpl->parsePolicy();
+
+ std::vector<OUString> aRet;
+ std::transform(m_pImpl->m_aCategories.begin(), m_pImpl->m_aCategories.end(), std::back_inserter(aRet), [](const std::pair<OUString, SfxClassificationCategory>& rPair)
+ {
+ return rPair.first;
+ });
+ return aRet;
+}
+
void SfxClassificationHelper::SetBACName(const OUString& rName)
{
if (m_pImpl->m_aCategories.empty())