Kaydet (Commit) cf33f6b4 authored tarafından Miklos Vajna's avatar Miklos Vajna

sfx2 classification: expose category names as parsed from the policy

Change-Id: I53b958dff2f43d4762445c4b474f2b00ae6dc9d0
üst 0c4a0a53
......@@ -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.
......
......@@ -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())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment