[Libreoffice-commits] core.git: sfx2/source
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Sun Oct 22 06:26:43 UTC 2017
sfx2/source/view/classificationhelper.cxx | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
New commits:
commit f3476b7b02cc976856e549281f02a2d948e1f4d2
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Thu Oct 19 11:12:17 2017 +0400
TSCP: classification abbreviation and sensitivity support
Change-Id: I4d165be565193857c3c7839102d72371b4c5ad44
Reviewed-on: https://gerrit.libreoffice.org/43628
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx
index 77932f4fb260..68f6fddf8d27 100644
--- a/sfx2/source/view/classificationhelper.cxx
+++ b/sfx2/source/view/classificationhelper.cxx
@@ -93,6 +93,7 @@ public:
/// PROP_BACNAME() is stored separately for easier lookup.
OUString m_aName;
OUString m_aAbbreviatedName;
+ size_t m_nSensitivity; //< 0 is the highest (most-sensitive).
std::map<OUString, OUString> m_aLabels;
};
@@ -183,6 +184,7 @@ void SAL_CALL SfxClassificationParser::startElement(const OUString& rName, const
rCategory.m_aName = aName;
// Set the abbreviated name, if any, otherwise fallback on the full name.
rCategory.m_aAbbreviatedName = !aAbbreviatedName.isEmpty() ? aAbbreviatedName : aName;
+ rCategory.m_nSensitivity = m_aCategories.size() - 1; // 0-based class sensitivity; first is highest.
rCategory.m_aLabels["PolicyAuthority:Name"] = m_aPolicyAuthorityName;
rCategory.m_aLabels["Policy:Name"] = m_aPolicyName;
rCategory.m_aLabels["BusinessAuthorization:Identifier"] = m_aProgramID;
@@ -444,7 +446,8 @@ void SfxClassificationHelper::Impl::pushToDocumentProperties()
SfxClassificationPolicyType eType = rPair.first;
SfxClassificationCategory& rCategory = rPair.second;
std::map<OUString, OUString> aLabels = rCategory.m_aLabels;
- aLabels[policyTypeToString(eType) + PROP_BACNAME()] = rCategory.m_aName;
+ const OUString abbreviation = (rCategory.m_aName != rCategory.m_aAbbreviatedName ? " (" + rCategory.m_aAbbreviatedName + ")" : OUString());
+ aLabels[policyTypeToString(eType) + PROP_BACNAME()] = rCategory.m_aName + abbreviation;
for (const auto& rLabel : aLabels)
{
try
@@ -561,6 +564,7 @@ SfxClassificationHelper::SfxClassificationHelper(const uno::Reference<document::
// It's a prefix we did not recognize, ignore.
continue;
+ //TODO: Support abbreviated names(?)
if (rProperty.Name == (aPrefix + PROP_BACNAME()))
m_pImpl->m_aCategory[eType].m_aName = aValue;
else
@@ -792,6 +796,8 @@ void SfxClassificationHelper::SetBACName(const OUString& rName, SfxClassificatio
}
m_pImpl->m_aCategory[eType].m_aName = it->m_aName;
+ m_pImpl->m_aCategory[eType].m_aAbbreviatedName = it->m_aAbbreviatedName;
+ m_pImpl->m_aCategory[eType].m_nSensitivity = it->m_nSensitivity;
m_pImpl->m_aCategory[eType].m_aLabels.clear();
const OUString& rPrefix = policyTypeToString(eType);
for (const auto& rLabel : it->m_aLabels)
More information about the Libreoffice-commits
mailing list