sw content controls, checkbox: add DOCX import

Desktop / LibreOffice - Miklos Vajna [collabora.com] - 29 April 2022 07:03 UTC

My expectation was that would be mapped to a single SPRM where the int value is 0 or 1 depending on if this is a true or false boolean. But the w14 tokenizer rules actually created a NS_ooxml::LN_CT_SdtCheckbox_checked token with a NS_ooxml::LN_CT_OnOff_val token in it, which itself again didn't contain just a bool but dedicated NS_ooxml::LN_ST_OnOff_true, NS_ooxml::LN_ST_OnOff_1, etc values.

To make this more complicated, TextEffectsHandler even depends on this weird behavior.

Bring the w14 rules closer to the "main" wml rules by folding the NS_ooxml::LN_CT_OnOff_val token into the parent token (NS_ooxml::LN_CT_SdtCheckbox_checked in this case), but leave the NS_ooxml::LN_ST_OnOff_* values unchanged for now.

The rest of the changes are more straightforward: we now handle inline/run checkbox SDTs similar to rich text ones, i.e. map them to Writer content controls, rather than just doing a poor mapping to grab-bags.

The main benefit here is that the checkbox type of Writer content controls actually change their value on mouse click, so it's possible to fill in such forms.

Change-Id: Idbf49a8ff1843d5271f2836e5299c4387bb58e55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133588

c53d3a1f4b84 sw content controls, checkbox: add DOCX import
writerfilter/qa/cppunittests/dmapper/SdtHelper.cxx | 46 +++++++++++++++++
.../dmapper/data/sdt-run-checkbox.docx | Bin 0 -> 4244 bytes
writerfilter/source/dmapper/DomainMapper.cxx | 57 +++++++++++++++++++--
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 21 ++++++++
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 4 ++
writerfilter/source/dmapper/SdtHelper.cxx | 18 +++++++
writerfilter/source/dmapper/SdtHelper.hxx | 23 +++++++--
writerfilter/source/dmapper/TextEffectsHandler.cxx | 1 +
writerfilter/source/dmapper/TextEffectsHandler.hxx | 8 +--
writerfilter/source/ooxml/model.xml | 7 +--
10 files changed, 172 insertions(+), 13 deletions(-)

Upstream: cgit.freedesktop.org


  • Share