summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-05-17 15:56:05 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-05-18 07:03:14 +0000
commit11f27739ffb0f069a145e411b2ae6b6fb5e16f7a (patch)
tree8be031a02dd55ade1558fbe46efd37fd37869d61 /sfx2
parent45ec74a080e17fc1b521d009d9a5a630a6434bab (diff)
sfx2 classification: specify policy type when setting a category
This will allow specifying multiple categories for multiple policy types. Separate storage and .uno: command support is still missing, though. Change-Id: I47f6ac2e2b0ba2632b32349e4e004ffade05784a Reviewed-on: https://gerrit.libreoffice.org/25064 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/classificationhelper.cxx35
1 files changed, 33 insertions, 2 deletions
diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx
index f1e721283c4b..bb6febe015c9 100644
--- a/sfx2/source/view/classificationhelper.cxx
+++ b/sfx2/source/view/classificationhelper.cxx
@@ -70,6 +70,36 @@ const OUString& PROP_IMPACTLEVEL()
return sProp;
}
+const OUString& PROP_PREFIX_EXPORTCONTROL()
+{
+ static OUString sProp("urn:bails:ExportControl:");
+ return sProp;
+}
+
+const OUString& PROP_PREFIX_NATIONALSECURITY()
+{
+ static OUString sProp("urn:bails:NationalSecurity:");
+ return sProp;
+}
+
+/// Converts a SfxClassificationPolicyType to a TSCP_BAILSv1 string value.
+const OUString& policyTypeToString(SfxClassificationPolicyType eType)
+{
+ switch (eType)
+ {
+ case SfxClassificationPolicyType::ExportControl:
+ return PROP_PREFIX_EXPORTCONTROL();
+ break;
+ case SfxClassificationPolicyType::NationalSecurity:
+ return PROP_PREFIX_NATIONALSECURITY();
+ break;
+ default:
+ break;
+ }
+
+ return SfxClassificationHelper::PROP_PREFIX_INTELLECTUALPROPERTY();
+}
+
/// Represents one category of a classification policy.
class SfxClassificationCategory
{
@@ -669,7 +699,7 @@ std::vector<OUString> SfxClassificationHelper::GetBACNames()
return aRet;
}
-void SfxClassificationHelper::SetBACName(const OUString& rName)
+void SfxClassificationHelper::SetBACName(const OUString& rName, SfxClassificationPolicyType eType)
{
if (m_pImpl->m_aCategories.empty())
m_pImpl->parsePolicy();
@@ -686,8 +716,9 @@ void SfxClassificationHelper::SetBACName(const OUString& rName)
m_pImpl->m_aCategory.m_aName = it->m_aName;
m_pImpl->m_aCategory.m_aLabels.clear();
+ const OUString& rPrefix = policyTypeToString(eType);
for (const auto& rLabel : it->m_aLabels)
- m_pImpl->m_aCategory.m_aLabels[PROP_PREFIX_INTELLECTUALPROPERTY() + rLabel.first] = rLabel.second;
+ m_pImpl->m_aCategory.m_aLabels[rPrefix + rLabel.first] = rLabel.second;
m_pImpl->setStartValidity();
m_pImpl->pushToDocumentProperties();