diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-05-10 20:39:12 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-05-11 18:06:02 +0200 |
commit | 1a88efa8e02a6d765dab13c7110443bb9e6acecf (patch) | |
tree | fcefc280189d41ff6b6277017232085bfe334743 /sw/qa/extras/odfexport | |
parent | abd630e81bc150d05e4129cc22752ecf461777c7 (diff) |
tdf#155238: Reimplement how ListAutoFormat is stored to ODF
This reimplements commits 6249858a8972aef077e0249bd93cfe8f01bce4d6
(sw: ODT import/export of DOCX's paragraph marker formatting,
2022-12-19) and 209dce614c43f63f63f5b42a746665c0ec1cbfe3 (sw: fix
ODT import of paragraph marker formatting, 2022-12-20).
Instead of using an empty trailing span for the ListAutoFormat data,
introduce a new loext:marker-style-name attribute for text:p element,
referencing a text autostyle.
The problems with the previous implementation were that (1) it was
impossible (or very difficult) to disambiguate several empty trailing
spans, in case it was needed; and (2) this was incompatible change,
with other ODF implementations treating the trailing span normally.
I couldn't manage to incorporate the attribute to paragraph autostyle,
because of problems referencing different autostyles one from another,
so put it directly to the paragraph attributes.
Change-Id: I33473147f1f774c24cbbc57bf0c4f3a1d83ce5bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151645
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/qa/extras/odfexport')
-rw-r--r-- | sw/qa/extras/odfexport/data/ParagraphMarkerMarkup.fodt | 22 | ||||
-rw-r--r-- | sw/qa/extras/odfexport/odfexport2.cxx | 10 |
2 files changed, 32 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/data/ParagraphMarkerMarkup.fodt b/sw/qa/extras/odfexport/data/ParagraphMarkerMarkup.fodt new file mode 100644 index 000000000000..c3a21261da26 --- /dev/null +++ b/sw/qa/extras/odfexport/data/ParagraphMarkerMarkup.fodt @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:styles> + <style:style style:name="Standard" style:family="paragraph" style:class="text"> + <style:text-properties fo:font-size="11pt"/> + </style:style> + </office:styles> + <office:automatic-styles> + <style:style style:name="T1" style:family="text"> + <style:text-properties fo:font-size="8pt"/> + </style:style> + <style:style style:name="T2" style:family="text"> + <style:text-properties fo:font-size="9pt" fo:color="#ff0000"/> + </style:style> + </office:automatic-styles> + <office:body> + <office:text> + <text:p text:style-name="Standard" loext:marker-style-name="T2"><text:span text:style-name="T1">text</text:span></text:p> + </office:text> + </office:body> +</office:document>
\ No newline at end of file diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index 269525a8756b..7c3d7fb9b841 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -1061,6 +1061,16 @@ DECLARE_ODFEXPORT_TEST(testTdf78510, "WordTest_edit.odt") #endif } +CPPUNIT_TEST_FIXTURE(Test, testParagraphMarkerMarkupRoundtrip) +{ + loadAndReload("ParagraphMarkerMarkup.fodt"); + // Test that the markup stays at save-and-reload + xmlDocUniquePtr pXmlDoc = parseExport("content.xml"); + assertXPath(pXmlDoc, "/office:document-content/office:body/office:text/text:p", "marker-style-name", "T2"); + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:name='T2']/style:text-properties", "font-size", "9pt"); + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:name='T2']/style:text-properties", "color", "#ff0000"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |