summaryrefslogtreecommitdiff
path: root/sw/source/core/edit/edfcol.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2017-11-16 18:40:19 +0900
committerTomaž Vajngerl <quikee@gmail.com>2017-11-17 04:53:21 +0100
commit195bd0f8ca8451eb340beafa4072f37782509d33 (patch)
tree0834db4471c79556f2f4b94d0552cb01fe37e722 /sw/source/core/edit/edfcol.cxx
parent5fd90dcf5b12af4bf8ca21866b23209aa4d3d531 (diff)
TSCP: consistently use identifier for category
When identifier is used for category, it is written into the metadata under a different key. When loading it back, it should fill the corresponding properties (identifier if identifier key was used or name if name key was used), otherwise this can lead to inconsistent behaviour when loading the classification data back from the file. Change-Id: Idbd9bde866d117bd7f60bcc224069f00a27fb9e2 Reviewed-on: https://gerrit.libreoffice.org/44846 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw/source/core/edit/edfcol.cxx')
-rw-r--r--sw/source/core/edit/edfcol.cxx17
1 files changed, 13 insertions, 4 deletions
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 37c8f1f0d7e7..35a470a5bcad 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1144,7 +1144,8 @@ void lcl_ApplyParagraphClassification(SwDoc* pDoc,
const bool isLast = nIndex == 0;
const bool isFirst = nIndex == aResults.size() - 1;
OUString sKey;
- switch(rResult.meType)
+ OUString sValue = rResult.msName;
+ switch (rResult.meType)
{
case svx::ClassificationType::TEXT:
{
@@ -1155,10 +1156,14 @@ void lcl_ApplyParagraphClassification(SwDoc* pDoc,
case svx::ClassificationType::CATEGORY:
{
if (rResult.msIdentifier.isEmpty())
+ {
sKey = aKeyCreator.makeCategoryNameKey();
+ }
else
+ {
+ sValue = rResult.msIdentifier;
sKey = aKeyCreator.makeCategoryIdentifierKey();
-
+ }
SwRDFHelper::addStatement(xModel, MetaNS, MetaFilename, xNodeSubject, ParagraphClassificationAbbrRDFName, rResult.msAbbreviatedName);
}
break;
@@ -1182,7 +1187,7 @@ void lcl_ApplyParagraphClassification(SwDoc* pDoc,
OUString sDisplayText = (isFirst ? ("(" + rResult.msAbbreviatedName) : rResult.msAbbreviatedName);
if (isLast)
sDisplayText += ")";
- lcl_UpdateParagraphClassificationField(pDoc, xModel, xParent, sKey, rResult.msName, sDisplayText);
+ lcl_UpdateParagraphClassificationField(pDoc, xModel, xParent, sKey, sValue, sDisplayText);
aFieldNames.emplace_back(sKey);
}
@@ -1261,10 +1266,14 @@ std::vector<svx::ClassificationResult> lcl_CollectParagraphClassification(const
{
aResult.push_back({ svx::ClassificationType::TEXT, aValue, sBlank, sBlank });
}
- else if (aKeyCreator.isCategoryNameKey(aName) || aKeyCreator.isCategoryIdentifierKey(aName))
+ else if (aKeyCreator.isCategoryNameKey(aName))
{
aResult.push_back({ svx::ClassificationType::CATEGORY, aValue, sBlank, sBlank });
}
+ else if (aKeyCreator.isCategoryIdentifierKey(aName))
+ {
+ aResult.push_back({ svx::ClassificationType::CATEGORY, sBlank, sBlank, aValue });
+ }
else if (aKeyCreator.isMarkingKey(aName))
{
aResult.push_back({ svx::ClassificationType::MARKING, aValue, sBlank, sBlank });