diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2019-09-03 13:49:57 +0200 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2019-09-04 10:40:26 +0200 |
commit | 7992bd73a2307edce96a145e954f8e4c3ab9f57d (patch) | |
tree | 0a32009be41014940f66fca0f4f6e899f6fcbbd1 /sw/qa | |
parent | a9e098aa4e66c771642b26527e3e48c48c428574 (diff) |
tdf#95848 writerfilter: DOCX import: fix mapping of w:abstractNum
The problem is that the bugdoc has multiple w:num numbering definitions
that refer to the same w:abstractNum abstract numbering definition.
Apparently (and i can't find this documented anywhere) w:abstractNum
corresponds to a SwList in Writer, i.e. all w:num that refer to the same
w:abstractNum share the same numbering tree, but they may have different
numbering properties via w:lvlOverride.
So i think this should be imported as a single SwList per w:abstractNum,
and every use of w:lvlOverride should create a new SwNumRule, but still
share the same SwList; the previous situation was a SwNumRule + SwList
per w:num element.
This implements simply a SwNumRule per w:num (regardless of
w:lvlOverride) because that was easy; the AbstractListDef class gets a
member to store the ListId of the created SwList when any of its
associated w:num / ListDef is used first, and the non-first ones get
this ListId set to force them into the same SwList.
Unfortunately it turns out the export has the same
SwNumRule->w:abstractNum problem, which remains to be fixed.
Change-Id: I92ce989afd15f24e36b6be6ccaf67ba3e0128963
Reviewed-on: https://gerrit.libreoffice.org/78556
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf95848.docx | bin | 0 -> 34087 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 34 |
2 files changed, 34 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf95848.docx b/sw/qa/extras/ooxmlexport/data/tdf95848.docx Binary files differnew file mode 100644 index 000000000000..3bf17f6928c1 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf95848.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 804ec41a4bed..295177486228 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -66,6 +66,40 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121374_sectionHF2, "tdf121374_sectionHF2.doc") CPPUNIT_ASSERT( xHeaderText->getString().startsWith("virkamatka-anomus") ); } +// TODO export has the same wrong assumption that abstractNum = SwNumRule +DECLARE_SW_EXPORT_TEST(testTdf95848, "tdf95848.docx", nullptr, Test) +{ + OUString listId; + OUString listStyle; + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2), getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT(xPara->getPropertyValue("NumberingStyleName") >>= listStyle); + CPPUNIT_ASSERT(listStyle.startsWith("WWNum")); + CPPUNIT_ASSERT(xPara->getPropertyValue("ListId") >>= listId); + CPPUNIT_ASSERT_EQUAL(OUString("1.1.1"), getProperty<OUString>(xPara, "ListLabelString")); + } + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(2), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2), getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT_EQUAL(listStyle, getProperty<OUString>(xPara, "NumberingStyleName")); + CPPUNIT_ASSERT_EQUAL(listId, getProperty<OUString>(xPara, "ListId")); + CPPUNIT_ASSERT_EQUAL(OUString("1.1.2"), getProperty<OUString>(xPara, "ListLabelString")); + } + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(3), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2), getProperty<sal_Int16>(xPara, "NumberingLevel")); + // different numbering style + OUString listStyle3; + CPPUNIT_ASSERT(xPara->getPropertyValue("NumberingStyleName") >>= listStyle3); + CPPUNIT_ASSERT(listStyle3.startsWith("WWNum")); + CPPUNIT_ASSERT(listStyle3 != listStyle); + // but same list + CPPUNIT_ASSERT_EQUAL(OUString("1.1.3"), getProperty<OUString>(xPara, "ListLabelString")); + CPPUNIT_ASSERT_EQUAL(listId, getProperty<OUString>(xPara, "ListId")); + } +} + DECLARE_OOXMLEXPORT_TEST(testTdf126723, "tdf126723.docx") { CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraph(2), "ParaLeftMargin")); |