summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-02-08 19:27:14 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2022-02-09 14:11:30 +0100
commitd794c377e503aa7d00dbc6daad0aa32efad9e682 (patch)
treed3998dab2de455df5088de17ad98349c08245add /writerfilter
parenta10a031199b36914ba14705e417efd76dbb0383a (diff)
(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.stahl@allotropia.de>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx16
1 files changed, 13 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index e9f53d461deb..f1efe6614047 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -7033,13 +7033,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();