This bug is meant to document the efforts around multi-page floating tables in Writer. The start of the work was to resolve bug 61594, but many related problems are still there.
https://gerrit.libreoffice.org/c/core/+/151251 fixes the handling of forum-mso-en3-26783.docx from crashtesting.
https://gerrit.libreoffice.org/c/core/+/151311 fixes a number of warnings which seem to be there for most floating tables with style from DOCX. The remaining warnings are more relevant, I hope
https://gerrit.libreoffice.org/c/core/+/151347 disables split flys in multi-col sections, like Word does. This fixes the last crashtest problem for now.
https://gerrit.libreoffice.org/c/core/+/151408 adds several fixes for the UI, so changing a multi-page floating table to a single-page floating table actually works.
In other news, bug 132264 and bug 102012 is fixed as part of this effort.
https://gerrit.libreoffice.org/c/core/+/151757 fixes an assert/crash on opening the shape properties dialog, for non-split floating tables.
In other news, bug 154275 and bug 148034 is now fixed with the split fly work.
https://gerrit.libreoffice.org/c/core/+/151822 disables the split fly UI when a frame is chained, since combining these two features makes little sense (floating table, chained shapes).
Created attachment 187343 [details]
Some demo document that shows colored text, cell backgrounds, floating table, split table and split cells in the same document.
Other than that, https://gerrit.libreoffice.org/c/core/+/151856 does the second half of the split fly vs chain UI.
https://gerrit.libreoffice.org/c/core/+/151956 fixes part of bug 155002 (crash), but it needs more work.
https://gerrit.libreoffice.org/c/core/+/152011 fixes a 2nd part of bug 155002 (crash), but it still needs more work.
In other news, the following buts are fixed as part of this effort: bug 113829 (DOC), bug 143729 (DOCX), bug 143743 (DOCX), bug 113829 (DOC) and bug 94955 (DOC).
https://gerrit.libreoffice.org/c/core/+/152116 fixes the crash for a subset of the bug 155002 document.
https://gerrit.libreoffice.org/c/core/+/152163 fixes the layout loop for the bug 155002 document.
https://gerrit.libreoffice.org/c/core/+/152190 starts adding a DoNotBreakWrappedTables, which is a compat flag for some DOCX/DOC/RTF files. This is just the layout side, no Word filters are updated yet.
https://gerrit.libreoffice.org/c/core/+/152255 adds the DOCX filter for DoNotBreakWrappedTables
https://gerrit.libreoffice.org/c/core/+/152291 adds the DOC filter for DoNotBreakWrappedTables
In other news, bug 153832 is now fixed.
https://gerrit.libreoffice.org/c/core/+/152377 adds the RTF filter for DoNotBreakWrappedTables
https://gerrit.libreoffice.org/c/core/+/152411 starts the area of overlapping tables, this one was a lost section break
https://gerrit.libreoffice.org/c/core/+/152472 fixes a completely lost floating table from DOCX import
https://gerrit.libreoffice.org/c/core/+/152525 fixes how split flys interact with the keep-with-next paragraph property.
https://gerrit.libreoffice.org/c/core/+/152599 fixes one more lost table bug
https://gerrit.libreoffice.org/c/core/+/152638 cleans up the now duplicated anchor ensuring code
Created attachment 187763 [details]
Floating table with vertical offset + bottom paragraph margin.
This is a demo of a case where the floating table is shifted down with a vertical offset, so there is space for body text. But then this anchor paragraph also has a bottom margin. The bugdoc uses the "Word <= 2010" compat mode, so the bottom margin is considered when Word decides that the anchor paragraph goes below the floating table. Writer can't handle this, ignores the bottom margin and puts the empty paragraph above the table. This leads to overlapping text in more complex documents. I don't have a fix for this yet.
https://gerrit.libreoffice.org/c/core/+/152726 solves the above bugdoc + a more complicated one where tables were overlapping.
Created attachment 187799 [details]
Multi-page floating table with inner, non-split floating table.
The bugdoc has a floating table at the end. If the inner table is floating, then this fits 1 page as in Word. If not floating, then it uses 2 pages in Writer.
Note that here the inner table is OK to not split, but it has to float at least.
https://gerrit.libreoffice.org/c/core/+/152891 fixes the above bugdoc
https://gerrit.libreoffice.org/c/core/+/152950 fixes a remaining problem of the above bugdoc where the anchor was wrong
Created attachment 187902 [details]
Combined upper + lower spacing problem.
Next problem is that when we shift down content because a fly intersect with paragraph text's upper margin, we also consider the previous paragraph's lower margin, which is not correct. The attached bugdoc demonstrates the problem.
Notice how the space between the shape and "second paragraph" is much larger in Writer than in Word.
https://gerrit.libreoffice.org/c/core/+/153101 fixes the above bugdoc.
Created attachment 187931 [details]
Layout loop with 2 paragraphs and a floating table.
Next reduced bug document, here the 2 paragraphs should be shifted down, below the floating table. Instead the 2nd paragraph overlaps with the floating table and there is a warning on the console that the loop control aborted a layout loop.
https://gerrit.libreoffice.org/c/core/+/153245 fixes the above layout loop.
https://gerrit.libreoffice.org/c/core/+/153309 fixes a bugdoc with 3 tables, where the last table moves to page 2, but not in Word
Created attachment 188031 [details]
Floating table with negative vertical offset, but empty anchor text
This bugdoc is similar to the above, but here the anchor paragraph has no text. This again leads to overlaps in Writer, but not in Word. I've started working on a fix for this.
https://gerrit.libreoffice.org/c/core/+/153866 fixes the above bugdoc
https://gerrit.libreoffice.org/c/core/+/154017 fixes a lost DOC floating table
https://gerrit.libreoffice.org/c/core/+/154088 fixes a regression in the DOCX import
https://gerrit.libreoffice.org/c/core/+/154235 is one more case where DOC had overlapping tables, but DOCX was good already, now fixed
https://gerrit.libreoffice.org/c/core/+/154290 fixes a case where DOCX ensured each floating table has its own anchor, but DOC did not, now fixed
https://gerrit.libreoffice.org/c/core/+/154343 fixes a layout loop
Also bug 131735 is now fixed.
https://gerrit.libreoffice.org/c/core/+/154376 fixes a DOCX bug where some floating tables were lost on import, a similar bug was already fixed for DOC in the past.
https://gerrit.libreoffice.org/c/core/+/154409 starts fixing bug 120262
https://gerrit.libreoffice.org/c/core/+/154509 continues fixing bug 120262
https://gerrit.libreoffice.org/c/core/+/154573 is more work on bug 120262, now there is no overlap, but part of the page 2 table is clipped and is on page 1
https://gerrit.libreoffice.org/c/help/+/154635 adds initial help, https://gerrit.libreoffice.org/c/core/+/154633 is meant to finally fix bug 120262.
https://gerrit.libreoffice.org/c/core/+/155081 fixes an ODT export problem
https://gerrit.libreoffice.org/c/core/+/155122 starts fixing bug 156260
Created attachment 188713 [details]
Demo document from SUSE
I attach a public/demo version of the monster bnc#816603 SUSE bugdoc. The original one is binary DOC, but still this shows the ~11 floating tables on 4 pages, none of the overlapping now.
Also, https://gerrit.libreoffice.org/c/core/+/155209 finishes bug 156260
https://gerrit.libreoffice.org/c/core/+/155276 fixes how floating tables interact with table captions, see bug 156349
https://gerrit.libreoffice.org/c/core/+/155339 fixes a crash on exporting tdf73201-1.docx to PDF
Started on bug 156589, have a PoC fix, but I'm aware of unwanted side-effects, so that needs more work.
https://gerrit.libreoffice.org/c/core/+/155444 fixes bug 156589, a crash on page break insert.
https://gerrit.libreoffice.org/c/core/+/155499 adds DOCX import for <w:tblOverlap w:val="never">
https://gerrit.libreoffice.org/c/core/+/155536 adds layout for <w:tblOverlap w:val="never">
https://gerrit.libreoffice.org/c/core/+/155573 add <w:tblOverlap w:val="never"> DOCX export
https://gerrit.libreoffice.org/c/core/+/155650 adds the matching DOC filter
https://gerrit.libreoffice.org/c/core/+/155687 adds the matching RTF filter, which is probably the last <w:tblOverlap w:val="never"> bit
https://gerrit.libreoffice.org/c/core/+/155732 fixes bug 156682 (hang on edit)
I started looking at bug 156351, which is some missing table border problem on split, floating tables. I see some missing border in SwTabFramePainter::Insert(), but it's not yet clear why it's missing there.
https://gerrit.libreoffice.org/c/core/+/155824 starts fixing bug 156351
https://gerrit.libreoffice.org/c/core/+/155884 finishes bug 156351
In other news, bug 141348 and bug 143806 are now fixed.
https://gerrit.libreoffice.org/c/core/+/155944 starts the footnote support for floating tables, first the doc model
https://gerrit.libreoffice.org/c/core/+/155961 adds layout for footnotes-in-floattables
https://gerrit.libreoffice.org/c/core/+/156024 adds DOCX import for footnotes-in-floattables
https://gerrit.libreoffice.org/c/core/+/156083 add DOC import, the rest of the filters now work, I think.
https://gerrit.libreoffice.org/c/core/+/156275 adds the UI for footnotes-in-floattables
I've started on bug 156318, it's not yet clear why we want to split that table more than once, which leads to a layout loop.
https://gerrit.libreoffice.org/c/core/+/156392 fixes the loop from bug 156318, but the result is not yet correct, needs more work.
https://gerrit.libreoffice.org/c/core/+/156506 finishes bug 156318
Created attachment 189356 [details]
Nested floating table, ODT
Attached bugdoc is a nested floating table, we currently crash when trying to load this.
https://gerrit.libreoffice.org/c/core/+/156587 fixes a crash when laying out that bugdoc, the position of the follow+inner table is not correct yet.
Let's continue in bug 157119.