tdf#150762 RTF import: fix missing left margin on numbered paragraph
commita974bccd06ac6c7081256d32d2372ea05b253fbb
authorMiklos Vajna <vmiklos@collabora.com>
Mon, 26 Sep 2022 06:14:21 +0000 (26 08:14 +0200)
committerMiklos Vajna <vmiklos@collabora.com>
Mon, 26 Sep 2022 07:05:50 +0000 (26 09:05 +0200)
treef525837cbfd60eecff593b52f03b524e6c963622
parent6de6231fa9266b64aac87ee3415e4855bbaeec4e
tdf#150762 RTF import: fix missing left margin on numbered paragraph

The bugdoc has a numbered paragraph with a custom left margin, but this
left margin is missing in Writer.

This went wrong in commit 61b7034824dead1635f9e9c6ec996297e10f6910
(tdf#104016 RTF import: deduplicate before text indent from numbering,
2017-12-05), and now it's broken because the numbering properties are
applied before paragraph properties in the DOCX case, but the RTF
tokenizer didn't do this ordering.

This behavior of sw core somewhat makes sense, users expect the margins
from direct formatting to go away if you apply a new numbering. So fix
the problem by tweaking the RTF tokenizer to emit the numbering tokens
first and only then the paragraph tokens, which is an order that's
closer to the working DOCX tokenizer.

This only affects the old (WW6-style) paragraph numbering markup, not
the newer (WW8-style) numbering markup.

Change-Id: I39698f57684d47c03ea4848fc8eb6b2e855c4fbc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140584
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
writerfilter/qa/cppunittests/rtftok/data/old-para-num-left-margin.rtf [new file with mode: 0644]
writerfilter/qa/cppunittests/rtftok/rtfdocumentimpl.cxx
writerfilter/source/rtftok/rtfdocumentimpl.cxx