svx/source/dialog/ClassificationDialog.cxx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
New commits: commit dc55f0618cae0e0ec7877eda065cc4b387e16bfb Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Sat Oct 28 20:49:22 2017 -0400 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 <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> 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; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits