Bug 91083 - Emulate non-splitting tables (because they are keep-with-next) with .DOC is broken
Summary: Emulate non-splitting tables (because they are keep-with-next) with .DOC is b...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.3.0 release
Hardware: Other All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:5.2.0 target:7.3.0
Keywords:
: 97229 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-05-04 16:09 UTC by Justin L
Modified: 2023-05-17 15:51 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Justin L 2015-05-04 16:09:01 UTC
Code to mimic LibreOffice's ability to have a table "keep with next" was introduced in Jun 2007.  On 19-Nov-2008 it was broken by this major reworking:  CWS-TOOLING: integrate CWS hb11 

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f4e5153daa7859cc5a5aec44ee578bf81195ca93

The code is still all there, but is just deactivated by an abandoned variable (bOutTable in wrtw8nds.cxx).  Replacing this with IsInTable() may be appropriate.
Comment 1 Justin L 2015-06-06 16:58:12 UTC
A proposed fix was pushed to https://gerrit.libreoffice.org/#/c/16123.

It re-enables "keep with next" emulation, and produces similar layout between ODT and DOC (except in certain instances where .doc follows MS Word layout instead).
Comment 2 Justin L 2015-06-09 05:19:24 UTC
see bug 34957 for a suite of testcases.
Comment 3 Buovjaga 2015-06-26 07:09:07 UTC Comment hidden (no-value)
Comment 4 Justin L 2015-11-12 07:27:38 UTC
The only time the variable (now m_bOutTable) is currently set to true is in WW8AttributeOutput::OutputFlyFrame_Impl.  Emulating "keep with next" for fly frame tables doesn't seem valid since flies currently cannot span pages anyway, so the rows will always be kept together on the same page.  Additionally, a Fly Frame can't have a following paragraph "kept" to it, right?

The meaning of m_bOutTable appears to have changed considerably since it was first introduced.  2008's commit f4e5153daa7859cc5a5aec44ee578bf81195ca93 shows the removal of instances when it set to true under totally different circumstances (and no NEW instances of setting it were added at that time).

Using IsInTable() [introduced in May 2011 with commit ea45be76b6475d2a400db56535fd0d9baf117713] does give the desired results.  Previous versions of LO can also open these documents without any stability problems.

The purpose of this fix is to have a .doc file emulate what the original .odt looks like.  It is an export setting.  It doesn't affect importing MSWord originating files, since MSWord doesn't have this setting anyway.

I'll be breaking down my earlier patch into smaller chunks, and resubmitting for the 5.2 branch in a couple of weeks.
Comment 5 Commit Notification 2015-12-14 04:42:52 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4ec0cc0781312d908a46dca382fae8e416753756

tdf#91083 - .doc: emulate table kept-with-next not splitting

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2016-01-18 04:32:28 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0d127baed75929e744d5b6249f510012cfbc0e88

tdf#91083 - .doc: emulate table keep-with-next paragraph

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Miklos Vajna 2016-08-04 21:57:14 UTC
*** Bug 98396 has been marked as a duplicate of this bug. ***
Comment 8 Justin L 2016-08-23 13:19:21 UTC
*** Bug 97229 has been marked as a duplicate of this bug. ***
Comment 9 Commit Notification 2016-08-30 11:29:58 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=129f93e46c29b388d38e9097869fd3e72dc40a5e

tdf#91083 ww8import: set table keep/split properties if emulated

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Justin L 2016-12-02 14:11:21 UTC
(In reply to Commit Notification from comment #9)
> http://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=129f93e46c29b388d38e9097869fd3e72dc40a5e
> 
> tdf#91083 ww8import: set table keep/split properties if emulated

This part is being reverted because it caused a bad regression (bug 104333).
proposed reversion:  https://gerrit.libreoffice.org/31551
Comment 11 Justin L 2020-05-21 04:45:28 UTC
bug 132642 is a regression, so the patch was tweaked in 7.0 a bit to ensure that it only affected MS Formats, as well as not trying so hard to not split.
Comment 12 Commit Notification 2021-07-29 06:25:28 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/fb0628b5ffe2571af3fb811c5c5109698b1bf773

tdf#91083 sw layout: don't emulate table keep when already set

It will be available in 7.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.