sw export: restore ww8 FormatBreak() to pre-2014 logic

Desktop / LibreOffice - Justin Luth [sil.org] - 14 December 2018 13:08 EST

In LO 4.3, Feb 2014 commit a31fbb53dba76736b37213b98b64937f05929a67 totally changed the logic of the FormatBreak function, affecting doc and rtf even though the focus was only on docx. This was quickly patched for some specific cases, but the careless changes weren't fully reversed. Doing that now, because reading the code it just seems all wrong.

As I understand it, there seems to typically be two passes - a valid pass for bBreakBefore and then a separate PageAfter pass. When DOC changed to prefer a breakBefore sprm, it removed the bBefore flag, did nothing on the bBreakBefore pass, and on the after pass, nC wasn't defined, so it did nothing extra. Dropping the bBefore flag probably broke the docx case.

Docx commit a31fbb53dba76736b37213b98b64937f05929a67 just blew that all away, and swapped when SectionBreak was called.

Another 2014 patch restored the DOC PageBefore behaviour (nC not defined, so nothing happens), but didn't restore the PageAfter behaviour so SectionBreak was still swapped.

So what logically seems to be needed is to restore the bBefore flag (prior to DOC's preference for breakBefore sprm), restore writing PageBreak_After in after pass, and ignore the FollowPageDesc (because it didn't seem to be included purposefully).

PageAfter only seems to be UI possible in a table's text flow. So it is
VERY uncommon (no instance at all in existing unit tests.) And, not surprisingly, it doesn't export a page break after the table in doc or docx format anyway. At least now it won't put the break BEFORE the table in docx.

This will restore these previous behaviours:-doc/rtf: PageAfter no longer written in bBreakBefore stage-docx: -PageAfter no longer written in bBreakBefore stage
-PageBefore not affected by FollowPageDesc.

PageBefore is generally unaffected by this change, and now the test for page/column break matches again, as would be expected.

Change-Id: I265541a04be49e6b60bfbd84c33ab5783b454058 Reviewed-on: https://gerrit.libreoffice.org/64983

5f0cfbbe1840 sw export: restore ww8 FormatBreak() to pre-2014 logic
sw/qa/extras/ooxmlexport/data/pageBreak_after.odt | Bin 0 -> 10162 bytes
sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 9 +++++++++
sw/source/filter/ww8/ww8atr.cxx | 13 ++++++++-----
3 files changed, 17 insertions(+), 5 deletions(-)

Upstream: cgit.freedesktop.org

  • Share