diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2024-01-30 17:46:12 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2024-01-31 18:34:44 +0100 |
commit | 57abad5cf990111fd7de011809d4421dc0550193 (patch) | |
tree | 78b11d25b83d4ea58064197f328106a06c86a8ed /writerfilter/source/rtftok/rtfdispatchsymbol.cxx | |
parent | 1195df679859b2ebfafb60bd456dcba90ff6bfae (diff) |
tdf#158586 writerfilter: RTF import: fix \page \sect \skbnone
The problem is that \page is actually completely ignored in the bugdoc
testTdf158586_1.
If you delete the \sbknone then there is a page break but it's caused by
\sect; the \page is still ignored.
It is ignored because, first, the \page results in a deferred break in
DomainMapper, then for \sect, the synthetic \par is dispatched and that
moves the break from deferred to the top paragraph properties context,
then sectBreak() calls endParagraphGroup() which just removes the top
paragraph properties context.
Remove the dispatchSymbol(RTFKeyword::PAR) for \sect, instead set a flag
so that RTFDocumentImpl::sectBreak() does it.
Add a new flag m_bParAtEndOfSection so that RTFDocumentImpl::parBreak()
can suppress the startParagraphGroup(), so the deferred break remains
present.
This also fixes testTdf158586_lostFrame.
(regression from commit 15b886f460919ea3dce425a621dc017c2992a96b)
Change-Id: I82a00899a9448069832a0b2f98a96df00da75518
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162770
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'writerfilter/source/rtftok/rtfdispatchsymbol.cxx')
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchsymbol.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx index aa1360f6dc55..9347174b6da2 100644 --- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx +++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx @@ -131,9 +131,6 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) break; case RTFKeyword::SECT: { - if (m_bNeedCr) - dispatchSymbol(RTFKeyword::PAR); - m_bHadSect = true; if (m_bIgnoreNextContSectBreak) { @@ -143,6 +140,10 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) } else { + if (m_bNeedCr) + { // tdf#158586 don't dispatch \par here, it eats deferred page breaks + setNeedPar(true); + } sectBreak(); if (m_nResetBreakOnSectBreak != RTFKeyword::invalid) { @@ -405,8 +406,6 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) } sal_uInt8 const sBreak[] = { 0xc }; Mapper().text(sBreak, 1); - // testFdo81892 don't do another \par break directly; because of - // GetSplitPgBreakAndParaMark() it does finishParagraph *twice* m_bNeedCr = true; } } |