diff options
author | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2021-06-14 14:27:56 +0300 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2021-06-29 00:48:36 +0200 |
commit | aa5c6d127559912ad60a63fbd972b78fb8f9691b (patch) | |
tree | f58857a341fa8930ad173e82e5c11a5fedf294e0 /sw/qa/extras/odfexport/odfexport2.cxx | |
parent | 99ef46fdb2a975e074c66a02328b86edfc05307f (diff) |
new ODF numbered list parameter loext:num-list-format
Instead of style:num-prefix and style:num-suffix new list format
is much more flexible for storing list multilevel numberings.
Now it is possible to have not just prefix/suffix but any random
separators between levels, arbitrary levels order, etc.
Internal LO format for list format is changed: instead of placeholders
like %1, %2, etc we right now use %1%, %2%... Reason: for ODT documents,
having more than 9 levels there is ambiguity in "%10": it is "%1"
followed by "0" suffix, or "%10"?
Aux changes:
* removed zero width space hack: since format string is always defined
this hack is interfering with standard list numbers printing
(see changes in ooxmlexport14.cxx, ww8export3.cxx tests)
* changed cross-references values to lists: they are now including full
list label string: previously this was bit self-contradictory (see
changes in odfexport.cxx and check_cross_references.py tests)
Change-Id: I9696cc4846375c5f6222539aeaadbca5ae58ce27
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117156
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/qa/extras/odfexport/odfexport2.cxx')
-rw-r--r-- | sw/qa/extras/odfexport/odfexport2.cxx | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index b58e9e9a1d1a..bbe5d7f193e7 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -50,6 +50,72 @@ DECLARE_ODFEXPORT_TEST(testTdf137199, "tdf137199.docx") CPPUNIT_ASSERT_EQUAL(OUString("HELLO2WORLD!"), getProperty<OUString>(getParagraph(4), "ListLabelString")); } +DECLARE_ODFEXPORT_TEST(testListFormatDocx, "listformat.docx") +{ + // Ensure in resulting ODT we also have not just prefix/suffux, but custom delimiters + CPPUNIT_ASSERT_EQUAL(OUString(">1<"), getProperty<OUString>(getParagraph(1), "ListLabelString")); + CPPUNIT_ASSERT_EQUAL(OUString(">>1/1<<"), getProperty<OUString>(getParagraph(2), "ListLabelString")); + CPPUNIT_ASSERT_EQUAL(OUString(">>1/1/1<<"), getProperty<OUString>(getParagraph(3), "ListLabelString")); + CPPUNIT_ASSERT_EQUAL(OUString(">>1/1/2<<"), getProperty<OUString>(getParagraph(4), "ListLabelString")); + + // Check also that in numbering styles we have num-list-format defined + xmlDocUniquePtr pXmlDoc = parseExport("styles.xml"); + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='1']", "num-list-format", ">%1%<"); + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='2']", "num-list-format", ">>%1%/%2%<<"); + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='3']", "num-list-format", ">>%1%/%2%/%3%<<"); + + // But for compatibility there are still prefix/suffix + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='1']", "num-prefix", ">"); + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='1']", "num-suffix", "<"); + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='2']", "num-prefix", ">>"); + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='2']", "num-suffix", "<<"); + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='3']", "num-prefix", ">>"); + assertXPath(pXmlDoc, "/office:document-styles/office:styles/text:list-style[@style:name='WWNum1']/" + "text:list-level-style-number[@text:level='3']", "num-suffix", "<<"); +} + +DECLARE_ODFEXPORT_TEST(testListFormatOdt, "listformat.odt") +{ + // Ensure in resulting ODT we also have not just prefix/suffux, but custom delimiters + CPPUNIT_ASSERT_EQUAL(OUString(">1<"), getProperty<OUString>(getParagraph(1), "ListLabelString")); + CPPUNIT_ASSERT_EQUAL(OUString(">>1.1<<"), getProperty<OUString>(getParagraph(2), "ListLabelString")); + CPPUNIT_ASSERT_EQUAL(OUString(">>1.1.1<<"), getProperty<OUString>(getParagraph(3), "ListLabelString")); + CPPUNIT_ASSERT_EQUAL(OUString(">>1.1.2<<"), getProperty<OUString>(getParagraph(4), "ListLabelString")); + + if (xmlDocUniquePtr pXmlDoc = parseExport("content.xml")) + { + // Check how conversion from prefix/suffix to list format did work + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='1']", "num-list-format", ">%1%<"); + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='2']", "num-list-format", ">>%1%.%2%<<"); + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='3']", "num-list-format", ">>%1%.%2%.%3%<<"); + + // But for compatibility there are still prefix/suffix as they were before + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='1']", "num-prefix", ">"); + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='1']", "num-suffix", "<"); + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='2']", "num-prefix", ">>"); + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='2']", "num-suffix", "<<"); + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='3']", "num-prefix", ">>"); + assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/text:list-style[@style:name='L1']/" + "text:list-level-style-number[@text:level='3']", "num-suffix", "<<"); + } +} + // This test started in LO 7.2. Use the odfexport.cxx if you intend to backport to 7.1. CPPUNIT_PLUGIN_IMPLEMENT(); |