sw: ODT import/export of DOCX's paragraph marker formatting
commitf4bc4cbefb551e06b6e5df27bd03cee247faf6f3
authorMiklos Vajna <vmiklos@collabora.com>
Mon, 19 Dec 2022 07:47:18 +0000 (19 08:47 +0100)
committerXisco Fauli <xiscofauli@libreoffice.org>
Tue, 20 Dec 2022 13:06:09 +0000 (20 13:06 +0000)
treed24be2f248d7054ba12c4bed4c1efb8ff5cf4dc3
parent1a12438faeeb74fcb1151e0fd34fcc4c70340c8e
sw: ODT import/export of DOCX's paragraph marker formatting

The bugdoc had a numbering, where the paragraph marker was explicitly
formatted to a custom sans font, and this font is also used for the numbering
portion's font. This was imported from DOCX correctly, but once you save
to ODT and reload, the font used in the numbering portion changed from
sans to serif, which is incorrect.

The reason for this seems to be that earlier
5ba30f588d6e41a13d68b1461345fca7a7ca61ac (tdf#64222 sw: better DOCX
import/export of paragraph marker formatting, 2019-09-06) introduced
support for storing this paragraph marker formatting in
RES_PARATR_LIST_AUTOFMT, but this was lost on ODT export / import.

Fix the problem by 1) adding the autostyle to the autostyle pool, so the
font gets written when writing automatic char styles 2) extending
SwXTextPortion to have a mode where it exposes the
RES_PARATR_LIST_AUTOFMT of the current text node and 3) improving
lcl_CreatePortions() to expose a trailing empty text portion that works
with these properties.

This also required adjusting CppunitTest_sw_ooxmlexport2's
testFdo64238_b, which explicitly asserted that the format of the
paragraph marker is not exposed in the UNO API text portion enumeration.
An additional improvement would be to go with a more explicit markup in
the ODT output for RES_PARATR_LIST_AUTOFMT, but we would need to decide
what name to use there, since currently we call this paragraph marker
formatting RES_PARATR_LIST_AUTOFMT / ListAutoFormat, and somewhat
confusingly this is primarily about paragraph marker formatting, not
lists / numberings (that is just a consequence).

Change-Id: I19c7eed19c6fc85c251ef87a5181c0719a0a382c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144447
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
(cherry picked from commit 6249858a8972aef077e0249bd93cfe8f01bce4d6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144491
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
sw/qa/core/unocore/data/paragraph-marker.docx [new file with mode: 0644]
sw/qa/core/unocore/unocore.cxx
sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
sw/source/core/inc/unoport.hxx
sw/source/core/unocore/unoobj.cxx
sw/source/core/unocore/unoport.cxx
sw/source/core/unocore/unoportenum.cxx