[Libreoffice-commits] core.git: include/sfx2 sd/source sw/source
Ashod Nakashian
ashodnakashian at yahoo.com
Fri Nov 3 11:07:15 UTC 2017
include/sfx2/classificationhelper.hxx | 27 ++++++++++++++++++---------
sd/source/ui/view/drviews2.cxx | 6 +++---
sw/source/core/edit/edfcol.cxx | 32 +++++++++++++++++++-------------
3 files changed, 40 insertions(+), 25 deletions(-)
New commits:
commit 7bd8f9ed9559a745f3ed59161d282b199edd69a7
Author: Ashod Nakashian <ashodnakashian at yahoo.com>
Date: Tue Oct 31 21:42:24 2017 -0400
TSCP: Paragraph signature RDF namespace now urn:bails
And remove PARAGRAPH entries from ClassificationResults
to restore adding the parens correctly.
Change-Id: Id0f07758e4daad8d0736800e211e35e9c7e026cf
Reviewed-on: https://gerrit.libreoffice.org/44145
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/include/sfx2/classificationhelper.hxx b/include/sfx2/classificationhelper.hxx
index 11782247ca23..6467976c952b 100644
--- a/include/sfx2/classificationhelper.hxx
+++ b/include/sfx2/classificationhelper.hxx
@@ -113,16 +113,18 @@ namespace sfx
class ClassificationKeyCreator
{
private:
- SfxClassificationPolicyType m_ePolicyType;
+ const SfxClassificationPolicyType m_ePolicyType;
+ const OUString m_sPolicy;
sal_Int32 m_nTextNumber;
OUString getPolicyKey() const
{
- return SfxClassificationHelper::policyTypeToString(m_ePolicyType);
+ return m_sPolicy;
}
public:
ClassificationKeyCreator(SfxClassificationPolicyType ePolicyType)
: m_ePolicyType(ePolicyType)
+ , m_sPolicy(SfxClassificationHelper::policyTypeToString(m_ePolicyType))
, m_nTextNumber(1)
{}
@@ -133,9 +135,7 @@ public:
OUString makeNumberedMarkingTextKey()
{
- OUString sKey = makeMarkingTextKey() + ":" + OUString::number(m_nTextNumber);
- m_nTextNumber++;
- return sKey;
+ return makeMarkingTextKey() + ":" + OUString::number(m_nTextNumber++);
}
bool isMarkingTextKey(OUString const & aKey) const
@@ -143,15 +143,24 @@ public:
return aKey.startsWith(makeMarkingTextKey());
}
- OUString makeCategoryKey() const
+ OUString makeCategoryNameKey() const
{
return getPolicyKey() + "BusinessAuthorizationCategory:Name";
}
- bool isCategoryKey(OUString const & aKey) const
+ bool isCategoryNameKey(OUString const & aKey) const
{
- return aKey.startsWith(makeCategoryKey()) ||
- aKey.startsWith(getPolicyKey() + "BusinessAuthorizationCategory:Identifier");
+ return aKey.startsWith(makeCategoryNameKey());
+ }
+
+ OUString makeCategoryIdentifierKey() const
+ {
+ return getPolicyKey() + "BusinessAuthorizationCategory:Identifier";
+ }
+
+ bool isCategoryIdentifierKey(OUString const & aKey) const
+ {
+ return aKey.startsWith(makeCategoryIdentifierKey());
}
OUString makeMarkingKey() const
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 3ccbe562ccf8..d01957dcf10c 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -323,7 +323,7 @@ private:
OUString aValue = lcl_getProperty(xPropertyContainer, aKey);
m_aResults.push_back({ svx::ClassificationType::TEXT, aValue, sBlank, sBlank });
}
- else if (aKeyCreator.isCategoryKey(aKey))
+ else if (aKeyCreator.isCategoryNameKey(aKey) || aKeyCreator.isCategoryIdentifierKey(aKey))
{
OUString aValue = lcl_getProperty(xPropertyContainer, aKey);
m_aResults.push_back({ svx::ClassificationType::CATEGORY, aValue, sBlank, sBlank });
@@ -406,7 +406,7 @@ private:
void deleteExistingObjects()
{
sfx::ClassificationKeyCreator aKeyCreator(SfxClassificationHelper::getPolicyType());
- OUString sKey = aKeyCreator.makeCategoryKey();
+ OUString sKey = aKeyCreator.makeCategoryNameKey();
const sal_uInt16 nCount = m_rDrawViewShell.GetDoc()->GetMasterSdPageCount(PageKind::Standard);
@@ -498,7 +498,7 @@ public:
case svx::ClassificationType::CATEGORY:
{
- OUString sKey = aKeyCreator.makeCategoryKey();
+ OUString sKey = aKeyCreator.makeCategoryNameKey();
pOutliner->QuickInsertField(SvxFieldItem(editeng::CustomPropertyField(sKey, rResult.msName), EE_FEATURE_FIELD), aPosition);
}
break;
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 2e0fa19c32e7..fe2700004fe5 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -95,11 +95,11 @@ namespace
{
static const OUString MetaFilename("tscp/bails.rdf");
static const OUString MetaNS("urn:bails");
-static const OUString ParagraphSignatureRDFName = "loext:paragraph:signature";
-static const OUString ParagraphSignatureDateRDFName = "loext:paragraph:signature:date";
-static const OUString ParagraphSignatureUsageRDFName = "loext:paragraph:signature:usage";
-static const OUString ParagraphClassificationNameRDFName = "loext:paragraph:classification:name";
-static const OUString ParagraphClassificationValueRDFName = "loext:paragraph:classification:value";
+static const OUString ParagraphSignatureRDFName = "urn:bails:loext:paragraph:signature";
+static const OUString ParagraphSignatureDateRDFName = "urn:bails:loext:paragraph:signature:date";
+static const OUString ParagraphSignatureUsageRDFName = "urn:bails:loext:paragraph:signature:usage";
+static const OUString ParagraphClassificationNameRDFName = "urn:bails:loext:paragraph:classification:name";
+static const OUString ParagraphClassificationValueRDFName = "urn:bails:loext:paragraph:classification:value";
static const OUString MetadataFieldServiceName = "com.sun.star.text.textfield.MetadataField";
static const OUString DocInfoServiceName = "com.sun.star.text.TextField.DocInfo.Custom";
@@ -724,7 +724,7 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes
case svx::ClassificationType::CATEGORY:
{
- OUString sKey = aCreator.makeCategoryKey();
+ OUString sKey = aCreator.makeCategoryNameKey();
insertFieldToDocument(xMultiServiceFactory, xHeaderText, xHeaderParagraphCursor, sKey);
insertFieldToDocument(xMultiServiceFactory, xFooterText, xFooterParagraphCursor, sKey);
}
@@ -857,7 +857,7 @@ std::vector<svx::ClassificationResult> SwEditShell::CollectAdvancedClassificatio
if (!aValue.isEmpty())
aResult.push_back({ svx::ClassificationType::TEXT, aValue, sBlank, sBlank });
}
- else if (aCreator.isCategoryKey(aName))
+ else if (aCreator.isCategoryNameKey(aName) || aCreator.isCategoryIdentifierKey(aName))
{
const OUString aValue = lcl_getProperty(xPropertyContainer, aName);
if (!aValue.isEmpty())
@@ -1000,15 +1000,18 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
// Since we always insert at the start of the paragraph,
// need to insert in reverse order.
std::reverse(aResults.begin(), aResults.end());
+ // Ignore "PARAGRAPH" types
+ aResults.erase(std::remove_if(aResults.begin(),
+ aResults.end(),
+ [&](const svx::ClassificationResult& rResult)-> bool
+ { return rResult.meType == svx::ClassificationType::PARAGRAPH; }),
+ aResults.end());
+
for (size_t nIndex = 0; nIndex < aResults.size(); ++nIndex)
{
const svx::ClassificationResult& rResult = aResults[nIndex];
- // Ignore "PARAGRAPH" types
- if (rResult.meType == svx::ClassificationType::PARAGRAPH)
- continue;
-
const bool isLast = nIndex == 0;
const bool isFirst = nIndex == aResults.size() - 1;
OUString sKey;
@@ -1022,7 +1025,10 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
case svx::ClassificationType::CATEGORY:
{
- sKey = aKeyCreator.makeCategoryKey();
+ if (rResult.msIdentifier.isEmpty())
+ sKey = aKeyCreator.makeCategoryNameKey();
+ else
+ sKey = aKeyCreator.makeCategoryIdentifierKey();
}
break;
@@ -1098,7 +1104,7 @@ std::vector<svx::ClassificationResult> SwEditShell::CollectParagraphClassificati
{
aResult.push_back({ svx::ClassificationType::TEXT, aValue, sBlank, sBlank });
}
- else if (aKeyCreator.isCategoryKey(aName))
+ else if (aKeyCreator.isCategoryNameKey(aName) || aKeyCreator.isCategoryIdentifierKey(aName))
{
aResult.push_back({ svx::ClassificationType::CATEGORY, aValue, sBlank, sBlank });
}
More information about the Libreoffice-commits
mailing list