From 3772f18266c3347e8fd60eb8f058d65328c400b4 Mon Sep 17 00:00:00 2001 From: Andreas Heinisch Date: Wed, 7 Dec 2022 14:30:59 +0100 Subject: tdf#53023 - Remove last empty paragraph from auto text Remove the last empty paragraph before inserting an auto text. The carriage return at the end of it is appended in SwXMLTextBlockParContext::~SwXMLTextBlockParContext() which can't be removed without introducing side effects. In order to compensate for the change, a paragraph has been added to the existing only text auto texts. Patch was reverted due to a hang of the ui test. It seems that selecting an entire text using mkPropertyValues({"KEYCODE":"CTRL+A"})) does not work anymore. Change-Id: I08f612d50f496c8d7f891c773ddedf27c3d80864 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143781 Tested-by: Jenkins Reviewed-by: Andreas Heinisch --- sw/source/core/doc/docglos.cxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sw/source/core/doc') diff --git a/sw/source/core/doc/docglos.cxx b/sw/source/core/doc/docglos.cxx index 306564c2a1f5..2993a774ad25 100644 --- a/sw/source/core/doc/docglos.cxx +++ b/sw/source/core/doc/docglos.cxx @@ -142,6 +142,13 @@ bool SwDoc::InsertGlossary( SwTextBlocks& rBlock, const OUString& rEntry, { SwDoc* pGDoc = rBlock.GetDoc(); + // tdf#53023 - remove the last empty paragraph (check SwXMLTextBlockParContext dtor) + if (mbInsOnlyTextGlssry) + { + SwPaM aPaM(*pGDoc->GetNodes()[pGDoc->GetNodes().GetEndOfContent().GetIndex() - 1]); + pGDoc->getIDocumentContentOperations().DelFullPara(aPaM); + } + // Update all fixed fields, with the right DocInfo. // FIXME: UGLY: Because we cannot limit the range in which to do // field updates, we must update the fixed fields at the glossary -- cgit v1.2.3