diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-07-11 08:21:20 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-07-11 10:27:44 +0200 |
commit | 663db89378aa1f0425e795ef5d471f134e658dc4 (patch) | |
tree | c956c820aaee8f06814c2298e1c6ad031eca18d4 /sw/source | |
parent | 9ae63fc4a4ca683a58744f5333301e1606229069 (diff) |
sw floattable: make sure floattable after floattable gets own anch pos from DOC
The bugdoc has 2 floating tables next to each other, which overlap in
Writer, but not in Word.
This looks quite similar to the DOCX case, which was solved in commit
01ad8ec4bb5425446e95dbada81de435646824b4 (sw floattable: fix lost tables
around a floating table from DOCX, 2023-06-05).
Fix the problem by improving SwWW8ImplReader::StartApo() so it inserts a
fake paragraph when a floating table is immediately followed by a
floating table. A similar case, floating table followed immediately by
an inline table was already handled like this in
WW8TabDesc::CreateSwTable().
Creating a reproducer document from scratch is quite tricky, as Word
will also insert a fake paragraph on the first save of the DOC test file
(so the doc model will be floattable-para-floattable-para) and manual
edit of binary DOC files is also not easy. So the compromise is that the
testcase file has 2 floating tables anchored to the same paragraph, but
they don't overlap visually, while they do overlap in the original,
internal bugdoc. With this, finally the bnc#816603 DOC bugdoc renders
without overlaps, which was the case before my multi-page floating table
changes.
Change-Id: Ib1b4c7c80833db5a7bde38092c8c3ed6fd1d2462
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154290
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 6619d775bdb8..6c0314cf7995 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -2517,6 +2517,23 @@ bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo, const WW8_TablePos *p if (pTabPos) { + if (m_xFormatOfJustInsertedApo) + { + // We just inserted a floating table and we'll insert a next one. + SwFrameFormat* pFormat = m_xFormatOfJustInsertedApo->GetFormat(); + if (pFormat) + { + const SwNode* pAnchorNode = pFormat->GetAnchor().GetAnchorNode(); + SwPosition* pPoint = m_pPaM->GetPoint(); + if (pAnchorNode && *pAnchorNode == pPoint->GetNode()) + { + // The two fly frames would have the same anchor position, leading to + // potentially overlapping text, prevent that. + AppendTextNode(*pPoint); + } + } + } + // Map a positioned table to a split fly. aFlySet.Put(SwFormatFlySplit(true)); } |