Bug 155118 - Second part of multi-page floating tables
Summary: Second part of multi-page floating tables
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard:
Keywords:
Depends on: 61594
Blocks: DOCX-Floatingtable
  Show dependency treegraph
 
Reported: 2023-05-02 06:58 UTC by Miklos Vajna
Modified: 2023-09-06 13:36 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Demo doc (13.81 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-05-17 06:51 UTC, Miklos Vajna
Details
Floating table with vertical offset + bottom paragraph margin. (19.61 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-06-07 06:26 UTC, Miklos Vajna
Details
Multi-page floating table with inner, non-split floating table. (16.18 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-06-09 07:42 UTC, Miklos Vajna
Details
Combined upper + lower spacing problem. (14.52 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-06-14 06:29 UTC, Miklos Vajna
Details
Layout loop with 2 paragraphs and a floating table. (9.03 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-06-16 09:39 UTC, Miklos Vajna
Details
Floating table with negative vertical offset, but empty anchor text (9.16 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-06-21 07:10 UTC, Miklos Vajna
Details
Demo document from SUSE (1.26 MB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-08-02 08:00 UTC, Miklos Vajna
Details
Nested floating table, ODT (11.36 KB, application/vnd.oasis.opendocument.text)
2023-09-05 06:31 UTC, Miklos Vajna
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Miklos Vajna 2023-05-02 06:58:36 UTC
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.
Comment 1 Miklos Vajna 2023-05-02 07:00:01 UTC
https://gerrit.libreoffice.org/c/core/+/151251 fixes the handling of forum-mso-en3-26783.docx from crashtesting.
Comment 2 Miklos Vajna 2023-05-03 06:26:19 UTC
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
Comment 3 Miklos Vajna 2023-05-04 06:27:44 UTC
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.
Comment 4 Miklos Vajna 2023-05-05 06:14:12 UTC
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.
Comment 5 Miklos Vajna 2023-05-15 06:52:33 UTC
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.
Comment 6 Miklos Vajna 2023-05-16 06:32:14 UTC
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).
Comment 7 Miklos Vajna 2023-05-17 06:51:35 UTC
Created attachment 187343 [details]
Demo doc

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.
Comment 8 Miklos Vajna 2023-05-18 12:00:12 UTC
https://gerrit.libreoffice.org/c/core/+/151956 fixes part of bug 155002 (crash), but it needs more work.
Comment 9 Miklos Vajna 2023-05-19 13:12:47 UTC
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).
Comment 10 Miklos Vajna 2023-05-22 13:16:40 UTC
https://gerrit.libreoffice.org/c/core/+/152116 fixes the crash for a subset of the bug 155002 document.
Comment 11 Miklos Vajna 2023-05-24 06:37:24 UTC
https://gerrit.libreoffice.org/c/core/+/152163 fixes the layout loop for the bug 155002 document.
Comment 12 Miklos Vajna 2023-05-24 09:55:52 UTC
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.
Comment 13 Miklos Vajna 2023-05-25 07:45:01 UTC
https://gerrit.libreoffice.org/c/core/+/152255 adds the DOCX filter for DoNotBreakWrappedTables
Comment 14 Miklos Vajna 2023-05-26 08:19:44 UTC
https://gerrit.libreoffice.org/c/core/+/152291 adds the DOC filter for DoNotBreakWrappedTables

In other news, bug 153832 is now fixed.
Comment 15 Miklos Vajna 2023-05-31 07:07:19 UTC
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
Comment 16 Miklos Vajna 2023-06-01 06:37:49 UTC
https://gerrit.libreoffice.org/c/core/+/152472 fixes a completely lost floating table from DOCX import
Comment 17 Miklos Vajna 2023-06-02 06:53:54 UTC
https://gerrit.libreoffice.org/c/core/+/152525 fixes how split flys interact with the keep-with-next paragraph property.
Comment 18 Miklos Vajna 2023-06-05 07:07:47 UTC
https://gerrit.libreoffice.org/c/core/+/152599 fixes one more lost table bug
Comment 19 Miklos Vajna 2023-06-06 06:27:05 UTC
https://gerrit.libreoffice.org/c/core/+/152638 cleans up the now duplicated anchor ensuring code
Comment 20 Miklos Vajna 2023-06-07 06:26:41 UTC
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.
Comment 21 Miklos Vajna 2023-06-08 06:27:18 UTC
https://gerrit.libreoffice.org/c/core/+/152726 solves the above bugdoc + a more complicated one where tables were overlapping.
Comment 22 Miklos Vajna 2023-06-09 07:42:01 UTC
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.
Comment 23 Miklos Vajna 2023-06-12 06:51:03 UTC
https://gerrit.libreoffice.org/c/core/+/152891 fixes the above bugdoc
Comment 24 Miklos Vajna 2023-06-13 06:16:10 UTC
https://gerrit.libreoffice.org/c/core/+/152950 fixes a remaining problem of the above bugdoc where the anchor was wrong
Comment 25 Miklos Vajna 2023-06-14 06:29:07 UTC
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.
Comment 26 Miklos Vajna 2023-06-15 06:36:57 UTC
https://gerrit.libreoffice.org/c/core/+/153101 fixes the above bugdoc.
Comment 27 Miklos Vajna 2023-06-16 09:39:00 UTC
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.
Comment 28 Miklos Vajna 2023-06-19 07:09:43 UTC
https://gerrit.libreoffice.org/c/core/+/153245 fixes the above layout loop.
Comment 29 Miklos Vajna 2023-06-20 06:52:51 UTC
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
Comment 30 Miklos Vajna 2023-06-21 07:10:00 UTC
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.
Comment 31 Miklos Vajna 2023-07-03 06:57:05 UTC
https://gerrit.libreoffice.org/c/core/+/153866 fixes the above bugdoc
Comment 32 Miklos Vajna 2023-07-05 07:01:29 UTC
https://gerrit.libreoffice.org/c/core/+/154017 fixes a lost DOC floating table
Comment 33 Miklos Vajna 2023-07-06 06:20:17 UTC
https://gerrit.libreoffice.org/c/core/+/154088 fixes a regression in the DOCX import
Comment 34 Miklos Vajna 2023-07-10 06:24:26 UTC
https://gerrit.libreoffice.org/c/core/+/154235 is one more case where DOC had overlapping tables, but DOCX was good already, now fixed
Comment 35 Miklos Vajna 2023-07-11 06:22:29 UTC
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
Comment 36 Miklos Vajna 2023-07-12 06:16:48 UTC
https://gerrit.libreoffice.org/c/core/+/154343 fixes a layout loop

Also bug 131735 is now fixed.
Comment 37 Miklos Vajna 2023-07-13 06:32:58 UTC
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.
Comment 38 Miklos Vajna 2023-07-14 06:29:11 UTC
https://gerrit.libreoffice.org/c/core/+/154409 starts fixing bug 120262
Comment 39 Miklos Vajna 2023-07-17 07:02:12 UTC
https://gerrit.libreoffice.org/c/core/+/154509 continues fixing bug 120262
Comment 40 Miklos Vajna 2023-07-18 06:30:52 UTC
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
Comment 41 Miklos Vajna 2023-07-19 06:48:22 UTC
https://gerrit.libreoffice.org/c/help/+/154635 adds initial help, https://gerrit.libreoffice.org/c/core/+/154633 is meant to finally fix bug 120262.
Comment 42 Miklos Vajna 2023-07-31 08:13:03 UTC
https://gerrit.libreoffice.org/c/core/+/155081 fixes an ODT export problem
Comment 43 Miklos Vajna 2023-08-01 07:07:14 UTC
https://gerrit.libreoffice.org/c/core/+/155122 starts fixing bug 156260
Comment 44 Miklos Vajna 2023-08-02 08:00:12 UTC
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
Comment 45 Miklos Vajna 2023-08-03 06:51:28 UTC
https://gerrit.libreoffice.org/c/core/+/155276 fixes how floating tables interact with table captions, see bug 156349
Comment 46 Miklos Vajna 2023-08-04 08:45:14 UTC
https://gerrit.libreoffice.org/c/core/+/155339 fixes a crash on exporting tdf73201-1.docx to PDF
Comment 47 Miklos Vajna 2023-08-07 07:16:52 UTC
Started on bug 156589, have a PoC fix, but I'm aware of unwanted side-effects, so that needs more work.
Comment 48 Miklos Vajna 2023-08-08 06:18:57 UTC
https://gerrit.libreoffice.org/c/core/+/155444 fixes bug 156589, a crash on page break insert.
Comment 49 Miklos Vajna 2023-08-09 06:29:27 UTC
https://gerrit.libreoffice.org/c/core/+/155499 adds DOCX import for <w:tblOverlap w:val="never">
Comment 50 Miklos Vajna 2023-08-10 07:05:57 UTC
https://gerrit.libreoffice.org/c/core/+/155536 adds layout for <w:tblOverlap w:val="never">
Comment 51 Miklos Vajna 2023-08-11 07:03:58 UTC
https://gerrit.libreoffice.org/c/core/+/155573 add <w:tblOverlap w:val="never"> DOCX export
Comment 52 Miklos Vajna 2023-08-14 06:26:19 UTC
https://gerrit.libreoffice.org/c/core/+/155650 adds the matching DOC filter
Comment 53 Miklos Vajna 2023-08-15 06:41:48 UTC
https://gerrit.libreoffice.org/c/core/+/155687 adds the matching RTF filter, which is probably the last <w:tblOverlap w:val="never"> bit
Comment 54 Miklos Vajna 2023-08-16 07:35:23 UTC
https://gerrit.libreoffice.org/c/core/+/155732 fixes bug 156682 (hang on edit)
Comment 55 Miklos Vajna 2023-08-17 06:28:03 UTC
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.
Comment 56 Miklos Vajna 2023-08-18 06:50:39 UTC
https://gerrit.libreoffice.org/c/core/+/155824 starts fixing bug 156351
Comment 57 Miklos Vajna 2023-08-21 06:39:43 UTC
https://gerrit.libreoffice.org/c/core/+/155884 finishes bug 156351

In other news, bug 141348 and bug 143806 are now fixed.
Comment 58 Miklos Vajna 2023-08-22 12:46:02 UTC
https://gerrit.libreoffice.org/c/core/+/155944 starts the footnote support for floating tables, first the doc model
Comment 59 Miklos Vajna 2023-08-23 06:34:33 UTC
https://gerrit.libreoffice.org/c/core/+/155961 adds layout for footnotes-in-floattables
Comment 60 Miklos Vajna 2023-08-24 06:35:23 UTC
https://gerrit.libreoffice.org/c/core/+/156024 adds DOCX import for footnotes-in-floattables
Comment 61 Miklos Vajna 2023-08-25 06:31:51 UTC
https://gerrit.libreoffice.org/c/core/+/156083 add DOC import, the rest of the filters now work, I think.
Comment 62 Miklos Vajna 2023-08-30 07:17:28 UTC
https://gerrit.libreoffice.org/c/core/+/156275 adds the UI for footnotes-in-floattables
Comment 63 Miklos Vajna 2023-08-31 06:17:56 UTC
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.
Comment 64 Miklos Vajna 2023-09-01 06:52:24 UTC
https://gerrit.libreoffice.org/c/core/+/156392 fixes the loop from bug 156318, but the result is not yet correct, needs more work.
Comment 65 Miklos Vajna 2023-09-04 06:47:02 UTC
https://gerrit.libreoffice.org/c/core/+/156506 finishes bug 156318
Comment 66 Miklos Vajna 2023-09-05 06:31:37 UTC
Created attachment 189356 [details]
Nested floating table, ODT

Attached bugdoc is a nested floating table, we currently crash when trying to load this.
Comment 67 Miklos Vajna 2023-09-06 06:32:17 UTC
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.
Comment 68 Miklos Vajna 2023-09-06 13:36:54 UTC
Let's continue in bug 157119.