summaryrefslogtreecommitdiff
path: root/sd/source
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2017-10-29 13:30:10 +0900
committerTomaž Vajngerl <quikee@gmail.com>2017-11-01 11:15:02 +0100
commit2d928a87788644f7c6d46b70ab03bc13a8bf89d3 (patch)
tree9652bb800ff00a11773ff6d58b920f4d7bc2a1b2 /sd/source
parentf0306eee4d3ef8322c511a0bc642f0d907a2e83d (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 'sd/source')
-rw-r--r--sd/source/ui/view/drviews2.cxx26
1 files changed, 12 insertions, 14 deletions
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 167ed9e56a6e..4d1eca41992b 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -292,7 +292,7 @@ private:
void iterateSectionsAndCollect(std::vector<editeng::Section> const & rSections, EditTextObject const & rEditText)
{
- OUString sPolicy = SfxClassificationHelper::policyTypeToString(SfxClassificationHelper::getPolicyType());
+ sfx::ClassificationKeyCreator aKeyCreator(SfxClassificationHelper::getPolicyType());
uno::Reference<document::XDocumentProperties> xDocumentProperties = SfxObjectShell::Current()->getDocProperties();
uno::Reference<beans::XPropertyContainer> xPropertyContainer = xDocumentProperties->getUserDefinedProperties();
@@ -316,22 +316,22 @@ private:
{
const auto* pCustomPropertyField = dynamic_cast<const editeng::CustomPropertyField*>(pFieldItem->GetField());
OUString aKey = pCustomPropertyField->GetKey();
- if (aKey.startsWith(sPolicy + "Marking:Text:"))
+ if (aKeyCreator.isMarkingTextKey(aKey))
{
OUString aValue = lcl_getProperty(xPropertyContainer, aKey);
m_aResults.push_back({ svx::ClassificationType::TEXT, aValue, sBlank });
}
- else if (aKey.startsWith(sPolicy + "BusinessAuthorizationCategory:Name"))
+ else if (aKeyCreator.isCategoryKey(aKey))
{
OUString aValue = lcl_getProperty(xPropertyContainer, aKey);
m_aResults.push_back({ svx::ClassificationType::CATEGORY, aValue, sBlank });
}
- else if (aKey.startsWith(sPolicy + "Extension:Marking"))
+ else if (aKeyCreator.isMarkingKey(aKey))
{
OUString aValue = lcl_getProperty(xPropertyContainer, aKey);
m_aResults.push_back({ svx::ClassificationType::MARKING, aValue, sBlank });
}
- else if (aKey.startsWith(sPolicy + "Extension:IntellectualPropertyPart"))
+ else if (aKeyCreator.isIntellectualPropertyPartKey(aKey))
{
OUString aValue = lcl_getProperty(xPropertyContainer, aKey);
m_aResults.push_back({ svx::ClassificationType::INTELLECTUAL_PROPERTY_PART, aValue, sBlank });
@@ -403,8 +403,8 @@ private:
/// Delete the previous existing classification object(s) - if they exists
void deleteExistingObjects()
{
- OUString sPolicy = SfxClassificationHelper::policyTypeToString(SfxClassificationHelper::getPolicyType());
- OUString sKey = sPolicy + "BusinessAuthorizationCategory:Name";
+ sfx::ClassificationKeyCreator aKeyCreator(SfxClassificationHelper::getPolicyType());
+ OUString sKey = aKeyCreator.makeCategoryKey();
const sal_uInt16 nCount = m_rDrawViewShell.GetDoc()->GetMasterSdPageCount(PageKind::Standard);
@@ -471,8 +471,7 @@ public:
aHelper.SetBACName(rResult.msString, SfxClassificationHelper::getPolicyType());
}
- OUString sPolicy = SfxClassificationHelper::policyTypeToString(SfxClassificationHelper::getPolicyType());
- sal_Int32 nTextNumber = 1;
+ sfx::ClassificationKeyCreator aKeyCreator(SfxClassificationHelper::getPolicyType());
Outliner* pOutliner = m_rDrawViewShell.GetDoc()->GetInternalOutliner();
OutlinerMode eOutlinerMode = pOutliner->GetMode();
@@ -489,8 +488,7 @@ public:
{
case svx::ClassificationType::TEXT:
{
- OUString sKey = sPolicy + "Marking:Text:" + OUString::number(nTextNumber);
- nTextNumber++;
+ OUString sKey = aKeyCreator.makeNumberedMarkingTextKey();
addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msString);
pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey), EE_FEATURE_FIELD), aPosition);
}
@@ -498,14 +496,14 @@ public:
case svx::ClassificationType::CATEGORY:
{
- OUString sKey = sPolicy + "BusinessAuthorizationCategory:Name";
+ OUString sKey = aKeyCreator.makeCategoryKey();
pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey), EE_FEATURE_FIELD), aPosition);
}
break;
case svx::ClassificationType::MARKING:
{
- OUString sKey = sPolicy + "Extension:Marking";
+ OUString sKey = aKeyCreator.makeMarkingKey();
addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msString);
pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey), EE_FEATURE_FIELD), aPosition);
}
@@ -513,7 +511,7 @@ public:
case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART:
{
- OUString sKey = sPolicy + "Extension:IntellectualPropertyPart";
+ OUString sKey = aKeyCreator.makeIntellectualPropertyPartKey();
addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msString);
pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey), EE_FEATURE_FIELD), aPosition);
}