Kaydet (Commit) e4c912f6 authored tarafından Ashod Nakashian's avatar Ashod Nakashian Kaydeden (comit) Ashod Nakashian

TSCP: wrap paragraph classification in parens

Change-Id: Ieb0236d7cde2dfde8758040605c7d83d1b905e7b
Reviewed-on: https://gerrit.libreoffice.org/43626Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarAshod Nakashian <ashnakash@gmail.com>
üst dc2d133e
...@@ -888,45 +888,45 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe ...@@ -888,45 +888,45 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
// need to insert in reverse order. // need to insert in reverse order.
std::reverse(aResults.begin(), aResults.end()); std::reverse(aResults.begin(), aResults.end());
sal_Int32 nTextNumber = 1; 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) switch(rResult.meType)
{ {
case svx::ClassificationType::TEXT: case svx::ClassificationType::TEXT:
{ {
const OUString sKey = sPolicy + "Marking:Text:" + OUString::number(nTextNumber++); sKey = sPolicy + "Marking:Text:" + OUString::number(nTextNumber++);
uno::Reference<text::XTextField> xTextField = lcl_InsertParagraphClassification(xModel, xParent);
lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString);
} }
break; break;
case svx::ClassificationType::CATEGORY: case svx::ClassificationType::CATEGORY:
{ {
const OUString sKey = sPolicy + "BusinessAuthorizationCategory:Name"; sKey = sPolicy + "BusinessAuthorizationCategory:Name";
uno::Reference<text::XTextField> xTextField = lcl_InsertParagraphClassification(xModel, xParent);
lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString);
} }
break; break;
case svx::ClassificationType::MARKING: case svx::ClassificationType::MARKING:
{ {
const OUString sKey = sPolicy + "Extension:Marking"; sKey = sPolicy + "Extension:Marking";
uno::Reference<text::XTextField> xTextField = lcl_InsertParagraphClassification(xModel, xParent);
lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString);
} }
break; break;
case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART: case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART:
{ {
const OUString sKey = sPolicy + "Extension:IntellectualPropertyPart"; sKey = sPolicy + "Extension:IntellectualPropertyPart";
uno::Reference<text::XTextField> xTextField = lcl_InsertParagraphClassification(xModel, xParent);
lcl_UpdateParagraphClassificationField(GetDoc(), xModel, xTextField, sKey, rResult.msString);
} }
break; break;
default: default:
break; 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);
} }
} }
......
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