summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2017-10-28 20:49:22 -0400
committerAshod Nakashian <ashnakash@gmail.com>2017-10-29 13:12:28 +0100
commitdc55f0618cae0e0ec7877eda065cc4b387e16bfb (patch)
treeb6612b87cb760e94db244fc9896bd3e4cff78791 /svx
parent1f78846481385fed5e65c982e771a5bc72421399 (diff)
TSCP: skip empty classification sections
When the user inserts some classification text into the editbox in the classifcation dialog then deletes, EditEng is giving us an empty section. This is to skip it, since it's completely superfluous. Change-Id: I522f05d0a270cd2bd9892235ad3cb40a88b295ac Reviewed-on: https://gerrit.libreoffice.org/43888 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/ClassificationDialog.cxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/svx/source/dialog/ClassificationDialog.cxx b/svx/source/dialog/ClassificationDialog.cxx
index dbbd8dc6be6f..d9b2ec868235 100644
--- a/svx/source/dialog/ClassificationDialog.cxx
+++ b/svx/source/dialog/ClassificationDialog.cxx
@@ -166,17 +166,21 @@ std::vector<ClassificationResult> ClassificationDialog::getResult()
ESelection aSelection(rSection.mnParagraph, rSection.mnStart, rSection.mnParagraph, rSection.mnEnd);
const OUString sDisplayString = m_pEditWindow->pEdEngine->GetText(aSelection);
- const ClassificationField* pClassificationField = pFieldItem ? dynamic_cast<const ClassificationField*>(pFieldItem->GetField()) : nullptr;
-
- if (pClassificationField)
- {
- aClassificationResults.push_back({ pClassificationField->meType, pClassificationField->msFullClassName, sDisplayString, rSection.mnParagraph });
- }
- else
+ if (!sDisplayString.isEmpty())
{
- aClassificationResults.push_back({ ClassificationType::TEXT, pClassificationField->msFullClassName, sDisplayString, rSection.mnParagraph });
+ const ClassificationField* pClassificationField = pFieldItem ? dynamic_cast<const ClassificationField*>(pFieldItem->GetField()) : nullptr;
+
+ if (pClassificationField)
+ {
+ aClassificationResults.push_back({ pClassificationField->meType, pClassificationField->msFullClassName, sDisplayString, rSection.mnParagraph });
+ }
+ else
+ {
+ aClassificationResults.push_back({ ClassificationType::TEXT, sDisplayString, sDisplayString, rSection.mnParagraph });
+ }
}
}
+
return aClassificationResults;
}