writerfilter/source/dmapper/DomainMapper_Impl.cxx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
New commits: commit 55a7b13b542bba70f459b60d58f1616dbeb838ac Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue Feb 8 19:27:14 2022 +0100 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Wed Feb 9 22:44:19 2022 +0100 (related: tdf#147206) writerfilter: fix another end in... ...DomainMapper_Impl::PopFieldContext() that probably should use the m_aTextAppendStack insert position. Change-Id: I718d4b745258ca88e8ffec0bff5e5ea95037a312 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129686 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit d794c377e503aa7d00dbc6daad0aa32efad9e682) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129626 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index c7385a2f4103..6080f2a70ae1 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -6964,13 +6964,23 @@ void DomainMapper_Impl::PopFieldContext() // End of index is the first item on a new paragraph - this paragraph // should not be part of index auto xCursor - = xTextAppend->createTextCursorByRange(xTextAppend->getEnd()); - xCursor->gotoEnd(false); + = xTextAppend->createTextCursorByRange( + m_aTextAppendStack.top().xInsertPosition.is() + ? m_aTextAppendStack.top().xInsertPosition + : xTextAppend->getEnd()); xCursor->goLeft(1, true); // delete xCursor->setString(OUString()); // But a new paragraph should be started after the index instead - xTextAppend->finishParagraph(css::beans::PropertyValues()); + if (m_bIsNewDoc) // this check - see testTdf129402 + { // where finishParagraph inserts between 2 EndNode + xTextAppend->finishParagraph(css::beans::PropertyValues()); + } + else + { + xTextAppend->finishParagraphInsert(css::beans::PropertyValues(), + m_aTextAppendStack.top().xInsertPosition); + } } m_bStartedTOC = false; m_aTextAppendStack.pop();