Kaydet (Commit) fe2e279c authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Tomaž Vajngerl

TSCP: need to enumerate the marker and IPPart properties too

Change-Id: Ibc8643667c3ae352107a93dcce2be02b1a9af06f
Reviewed-on: https://gerrit.libreoffice.org/44344Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst a2577767
...@@ -116,6 +116,8 @@ private: ...@@ -116,6 +116,8 @@ private:
const SfxClassificationPolicyType m_ePolicyType; const SfxClassificationPolicyType m_ePolicyType;
const OUString m_sPolicy; const OUString m_sPolicy;
sal_Int32 m_nTextNumber; sal_Int32 m_nTextNumber;
sal_Int32 m_nIPPartNumber;
sal_Int32 m_nMarkingNumber;
OUString getPolicyKey() const OUString getPolicyKey() const
{ {
...@@ -126,21 +128,23 @@ public: ...@@ -126,21 +128,23 @@ public:
: m_ePolicyType(ePolicyType) : m_ePolicyType(ePolicyType)
, m_sPolicy(SfxClassificationHelper::policyTypeToString(m_ePolicyType)) , m_sPolicy(SfxClassificationHelper::policyTypeToString(m_ePolicyType))
, m_nTextNumber(1) , m_nTextNumber(1)
, m_nIPPartNumber(1)
, m_nMarkingNumber(1)
{} {}
OUString makeMarkingTextKey() const OUString makeTextKey() const
{ {
return getPolicyKey() + "Marking:Text"; return getPolicyKey() + "Marking:Text";
} }
OUString makeNumberedMarkingTextKey() OUString makeNumberedTextKey()
{ {
return makeMarkingTextKey() + ":" + OUString::number(m_nTextNumber++); return makeTextKey() + ":" + OUString::number(m_nTextNumber++);
} }
bool isMarkingTextKey(OUString const & aKey) const bool isMarkingTextKey(OUString const & aKey) const
{ {
return aKey.startsWith(makeMarkingTextKey()); return aKey.startsWith(makeTextKey());
} }
OUString makeCategoryNameKey() const OUString makeCategoryNameKey() const
...@@ -168,6 +172,11 @@ public: ...@@ -168,6 +172,11 @@ public:
return getPolicyKey() + "Extension:Marking"; return getPolicyKey() + "Extension:Marking";
} }
OUString makeNumberedMarkingKey()
{
return makeMarkingKey() + ":" + OUString::number(m_nMarkingNumber++);
}
bool isMarkingKey(OUString const & aKey) const bool isMarkingKey(OUString const & aKey) const
{ {
return aKey.startsWith(makeMarkingKey()); return aKey.startsWith(makeMarkingKey());
...@@ -178,6 +187,11 @@ public: ...@@ -178,6 +187,11 @@ public:
return getPolicyKey() + "Extension:IntellectualPropertyPart"; return getPolicyKey() + "Extension:IntellectualPropertyPart";
} }
OUString makeNumberedIntellectualPropertyPartKey()
{
return makeIntellectualPropertyPartKey() + ":" + OUString::number(m_nIPPartNumber++);
}
bool isIntellectualPropertyPartKey(OUString const & aKey) const bool isIntellectualPropertyPartKey(OUString const & aKey) const
{ {
return aKey.startsWith(makeIntellectualPropertyPartKey()); return aKey.startsWith(makeIntellectualPropertyPartKey());
......
...@@ -405,7 +405,7 @@ private: ...@@ -405,7 +405,7 @@ private:
{ {
case svx::ClassificationType::TEXT: case svx::ClassificationType::TEXT:
{ {
OUString sKey = m_aKeyCreator.makeNumberedMarkingTextKey(); OUString sKey = m_aKeyCreator.makeNumberedTextKey();
svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer, sKey, rResult.msName); svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer, sKey, rResult.msName);
pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition); pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition);
} }
...@@ -420,7 +420,7 @@ private: ...@@ -420,7 +420,7 @@ private:
case svx::ClassificationType::MARKING: case svx::ClassificationType::MARKING:
{ {
OUString sKey = m_aKeyCreator.makeMarkingKey(); OUString sKey = m_aKeyCreator.makeNumberedMarkingKey();
svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer, sKey, rResult.msName); svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer, sKey, rResult.msName);
pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition); pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition);
} }
...@@ -428,7 +428,7 @@ private: ...@@ -428,7 +428,7 @@ private:
case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART: case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART:
{ {
OUString sKey = m_aKeyCreator.makeIntellectualPropertyPartKey(); OUString sKey = m_aKeyCreator.makeNumberedIntellectualPropertyPartKey();
svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer, sKey, rResult.msName); svx::classification::addOrInsertDocumentProperty(m_xPropertyContainer, sKey, rResult.msName);
pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition); pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition);
} }
......
...@@ -789,7 +789,7 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes ...@@ -789,7 +789,7 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes
{ {
case svx::ClassificationType::TEXT: case svx::ClassificationType::TEXT:
{ {
OUString sKey = aCreator.makeNumberedMarkingTextKey(); OUString sKey = aCreator.makeNumberedTextKey();
svx::classification::addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msName); svx::classification::addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msName);
insertFieldToDocument(xMultiServiceFactory, xHeaderText, xHeaderParagraphCursor, sKey); insertFieldToDocument(xMultiServiceFactory, xHeaderText, xHeaderParagraphCursor, sKey);
...@@ -807,7 +807,7 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes ...@@ -807,7 +807,7 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes
case svx::ClassificationType::MARKING: case svx::ClassificationType::MARKING:
{ {
OUString sKey = aCreator.makeMarkingKey(); OUString sKey = aCreator.makeNumberedMarkingKey();
svx::classification::addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msName); svx::classification::addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msName);
insertFieldToDocument(xMultiServiceFactory, xHeaderText, xHeaderParagraphCursor, sKey); insertFieldToDocument(xMultiServiceFactory, xHeaderText, xHeaderParagraphCursor, sKey);
insertFieldToDocument(xMultiServiceFactory, xFooterText, xFooterParagraphCursor, sKey); insertFieldToDocument(xMultiServiceFactory, xFooterText, xFooterParagraphCursor, sKey);
...@@ -816,7 +816,7 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes ...@@ -816,7 +816,7 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes
case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART: case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART:
{ {
OUString sKey = aCreator.makeIntellectualPropertyPartKey(); OUString sKey = aCreator.makeNumberedIntellectualPropertyPartKey();
svx::classification::addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msName); svx::classification::addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msName);
insertFieldToDocument(xMultiServiceFactory, xHeaderText, xHeaderParagraphCursor, sKey); insertFieldToDocument(xMultiServiceFactory, xHeaderText, xHeaderParagraphCursor, sKey);
insertFieldToDocument(xMultiServiceFactory, xFooterText, xFooterParagraphCursor, sKey); insertFieldToDocument(xMultiServiceFactory, xFooterText, xFooterParagraphCursor, sKey);
...@@ -1094,7 +1094,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe ...@@ -1094,7 +1094,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
{ {
case svx::ClassificationType::TEXT: case svx::ClassificationType::TEXT:
{ {
sKey = aKeyCreator.makeNumberedMarkingTextKey(); sKey = aKeyCreator.makeNumberedTextKey();
} }
break; break;
...@@ -1109,13 +1109,13 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe ...@@ -1109,13 +1109,13 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
case svx::ClassificationType::MARKING: case svx::ClassificationType::MARKING:
{ {
sKey = aKeyCreator.makeMarkingKey(); sKey = aKeyCreator.makeNumberedMarkingKey();
} }
break; break;
case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART: case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART:
{ {
sKey = aKeyCreator.makeIntellectualPropertyPartKey(); sKey = aKeyCreator.makeNumberedIntellectualPropertyPartKey();
} }
break; break;
......
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