summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2017-10-01 19:33:21 -0400
committerAshod Nakashian <ashnakash@gmail.com>2017-10-02 14:13:47 +0200
commit1ef8bb7c9d90766629d8c769cc05b9944637f68d (patch)
tree0444e5c829e3f7911fe73ff2ebecb6ff0252b198
parent807bf0680dfe32d62cf251c7eef63e8f1fc4a828 (diff)
TSCP: simplify ApplyParagraphClassification
Change-Id: I67f9d173526d785bfbb2c09526f915aa7c6216eb Reviewed-on: https://gerrit.libreoffice.org/43019 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
-rw-r--r--sw/source/core/edit/edfcol.cxx15
1 files changed, 6 insertions, 9 deletions
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index d41fbf5522ec..fb13fedac53b 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -773,10 +773,15 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
if (!pDocShell)
return;
+ SwTextNode* pNode = GetCursor()->Start()->nNode.GetNode().GetTextNode();
+ if (pNode == nullptr)
+ return;
+
+ uno::Reference<text::XTextContent> xParent = SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode);
uno::Reference<frame::XModel> xModel = pDocShell->GetBaseModel();
uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(xModel, uno::UNO_QUERY);
- OUString sPolicy = SfxClassificationHelper::policyTypeToString(getPolicyType());
+ const OUString sPolicy = SfxClassificationHelper::policyTypeToString(getPolicyType());
// Prevent recursive validation since this is triggered on node updates, which we do below.
const bool bOldValidationFlag = SetParagraphSignatureValidation(false);
@@ -784,10 +789,6 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
SetParagraphSignatureValidation(bOldValidationFlag);
});
- SwTextNode* pNode = GetCursor()->Start()->nNode.GetNode().GetTextNode();
- if (pNode == nullptr)
- return;
-
// Since we always insert at the start of the paragraph,
// need to insert in reverse order.
std::reverse(aResults.begin(), aResults.end());
@@ -800,7 +801,6 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
{
const OUString sKey = sPolicy + "Marking:Text:" + OUString::number(nTextNumber++);
- const uno::Reference<text::XTextContent> xParent = SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode);
uno::Reference<text::XTextField> xTextField = lcl_FindParagraphClassificationField(xModel, xParent, sKey);
if (!xTextField.is())
xTextField = lcl_InsertParagraphClassification(xModel, xParent);
@@ -813,7 +813,6 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
{
const OUString sKey = sPolicy + "BusinessAuthorizationCategory:Name";
- const uno::Reference<text::XTextContent> xParent = SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode);
uno::Reference<text::XTextField> xTextField = lcl_FindParagraphClassificationField(xModel, xParent, sKey);
if (!xTextField.is())
xTextField = lcl_InsertParagraphClassification(xModel, xParent);
@@ -826,7 +825,6 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
{
const OUString sKey = sPolicy + "Extension:Marking";
- const uno::Reference<text::XTextContent> xParent = SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode);
uno::Reference<text::XTextField> xTextField = lcl_FindParagraphClassificationField(xModel, xParent, sKey);
if (!xTextField.is())
xTextField = lcl_InsertParagraphClassification(xModel, xParent);
@@ -839,7 +837,6 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
{
const OUString sKey = sPolicy + "Extension:IntellectualPropertyPart";
- const uno::Reference<text::XTextContent> xParent = SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode);
uno::Reference<text::XTextField> xTextField = lcl_FindParagraphClassificationField(xModel, xParent, sKey);
if (!xTextField.is())
xTextField = lcl_InsertParagraphClassification(xModel, xParent);