diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-10-29 13:30:10 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2017-11-01 11:15:02 +0100 |
commit | 2d928a87788644f7c6d46b70ab03bc13a8bf89d3 (patch) | |
tree | 9652bb800ff00a11773ff6d58b920f4d7bc2a1b2 /include/sfx2 | |
parent | f0306eee4d3ef8322c511a0bc642f0d907a2e83d (diff) |
TSCP: simplify key creation and detection
Change-Id: I5f87e77cf529d1c4d37ea55b8858c374a66ea9e4
Reviewed-on: https://gerrit.libreoffice.org/44018
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include/sfx2')
-rw-r--r-- | include/sfx2/classificationhelper.hxx | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/include/sfx2/classificationhelper.hxx b/include/sfx2/classificationhelper.hxx index 2672c51c167e..a389ec7e4ac0 100644 --- a/include/sfx2/classificationhelper.hxx +++ b/include/sfx2/classificationhelper.hxx @@ -106,6 +106,74 @@ public: static SfxClassificationPolicyType getPolicyType(); }; +namespace sfx +{ +class ClassificationKeyCreator +{ +private: + SfxClassificationPolicyType m_ePolicyType; + sal_Int32 m_nTextNumber; + + OUString getPolicyKey() const + { + return SfxClassificationHelper::policyTypeToString(m_ePolicyType); + } +public: + ClassificationKeyCreator(SfxClassificationPolicyType ePolicyType) + : m_ePolicyType(ePolicyType) + , m_nTextNumber(1) + {} + + OUString makeMarkingTextKey() const + { + return getPolicyKey() + "Marking:Text"; + } + + OUString makeNumberedMarkingTextKey() + { + OUString sKey = makeMarkingTextKey() + ":" + OUString::number(m_nTextNumber); + m_nTextNumber++; + return sKey; + } + + bool isMarkingTextKey(OUString const & aKey) const + { + return aKey.startsWith(makeMarkingTextKey()); + } + + OUString makeCategoryKey() const + { + return getPolicyKey() + "BusinessAuthorizationCategory:Name"; + } + + bool isCategoryKey(OUString const & aKey) const + { + return aKey.startsWith(makeCategoryKey()); + } + + OUString makeMarkingKey() const + { + return getPolicyKey() + "Extension:Marking"; + } + + bool isMarkingKey(OUString const & aKey) const + { + return aKey.startsWith(makeMarkingKey()); + } + + OUString makeIntellectualPropertyPartKey() const + { + return getPolicyKey() + "Extension:IntellectualPropertyPart"; + } + + bool isIntellectualPropertyPartKey(OUString const & aKey) const + { + return aKey.startsWith(makeIntellectualPropertyPartKey()); + } +}; + +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |