summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2017-10-17 04:16:46 -0400
committerAshod Nakashian <ashnakash@gmail.com>2017-10-22 07:12:39 +0200
commite4c912f6b0855d3f0cf713cb4e4ecdb00a28e263 (patch)
treed295dbec0c179ae767efd135f68dbefd2c444f2b
parentdc2d133e7953f08f73ef9cd0b40786764b0e2035 (diff)
TSCP: wrap paragraph classification in parens
Change-Id: Ieb0236d7cde2dfde8758040605c7d83d1b905e7b Reviewed-on: https://gerrit.libreoffice.org/43626 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
-rw-r--r--sw/source/core/edit/edfcol.cxx26
1 files changed, 13 insertions, 13 deletions
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 5cd5dd70a77c..ca5252cddf81 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -888,45 +888,45 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
// need to insert in reverse order.
std::reverse(aResults.begin(), aResults.end());
sal_Int32 nTextNumber = 1;
- for (svx::ClassificationResult const & rResult : aResults)
+ for (size_t nIndex = 0; nIndex < aResults.size(); ++nIndex)
{
+ const svx::ClassificationResult& rResult = aResults[nIndex];
+ const bool isLast = nIndex == 0;
+ const bool isFirst = nIndex == aResults.size() - 1;
+ OUString sKey;
switch(rResult.meType)
{
case svx::ClassificationType::TEXT:
{
- const OUString sKey = sPolicy + "Marking:Text:" + OUString::number(nTextNumber++);
- uno::Reference<text::XTextField> xTextField = lcl_InsertParagraphClassification(xModel, xParent);
- lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString);
+ sKey = sPolicy + "Marking:Text:" + OUString::number(nTextNumber++);
}
break;
case svx::ClassificationType::CATEGORY:
{
- const OUString sKey = sPolicy + "BusinessAuthorizationCategory:Name";
- uno::Reference<text::XTextField> xTextField = lcl_InsertParagraphClassification(xModel, xParent);
- lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString);
+ sKey = sPolicy + "BusinessAuthorizationCategory:Name";
}
break;
case svx::ClassificationType::MARKING:
{
- const OUString sKey = sPolicy + "Extension:Marking";
- uno::Reference<text::XTextField> xTextField = lcl_InsertParagraphClassification(xModel, xParent);
- lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString);
+ sKey = sPolicy + "Extension:Marking";
}
break;
case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART:
{
- const OUString sKey = sPolicy + "Extension:IntellectualPropertyPart";
- uno::Reference<text::XTextField> xTextField = lcl_InsertParagraphClassification(xModel, xParent);
- lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString);
+ sKey = sPolicy + "Extension:IntellectualPropertyPart";
}
break;
default:
break;
}
+
+ uno::Reference<text::XTextField> xTextField = lcl_InsertParagraphClassification(xModel, xParent);
+ const OUString text = (isFirst ? ("(" + rResult.msString) : isLast ? (rResult.msString + ")") : rResult.msString);
+ lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, text);
}
}