diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2023-01-23 16:38:03 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2023-01-24 13:39:23 +0000 |
commit | 90e1698dab3d286c10136719aa85fee2f56ad9fd (patch) | |
tree | 4e6e56ffacb7bbb45fd34aa67d6678d61a37e74c /sw/qa | |
parent | 668f55b65849012b359d7d6b9386113facbadc57 (diff) |
tdf#153090 xmloff: ODF import/export of source style on ToX
For Table of Figures/Objects/Tables.
Make this similar to DOCX: only one source style is possible, so omit
the intermediate text:index-source-styles element.
Also a boolean attribute like text:use-index-source-styles appears as
unnecessary complexity, so try to do without.
Change-Id: I7cb599c7ec1261ddedc196a25c3eafe35f35fbe9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146013
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/odfexport/data/Custom-Style-TOC.docx | bin | 0 -> 13994 bytes | |||
-rw-r--r-- | sw/qa/extras/odfexport/odfexport2.cxx | 16 |
2 files changed, 16 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/data/Custom-Style-TOC.docx b/sw/qa/extras/odfexport/data/Custom-Style-TOC.docx Binary files differnew file mode 100644 index 000000000000..2b4c57054f5a --- /dev/null +++ b/sw/qa/extras/odfexport/data/Custom-Style-TOC.docx diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index f065b28d5308..35e22a59f331 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -18,6 +18,8 @@ #include <com/sun/star/text/ColumnSeparatorStyle.hpp> #include <com/sun/star/text/XBookmarksSupplier.hpp> #include <com/sun/star/text/XChapterNumberingSupplier.hpp> +#include <com/sun/star/text/XDocumentIndex.hpp> +#include <com/sun/star/text/XDocumentIndexesSupplier.hpp> #include <com/sun/star/text/XTextColumns.hpp> #include <com/sun/star/text/XTextFieldsSupplier.hpp> #include <com/sun/star/text/XTextTable.hpp> @@ -597,6 +599,20 @@ DECLARE_ODFEXPORT_TEST(testTdf131025_noZerosInTable, "tdf131025_noZerosInTable.o CPPUNIT_ASSERT_EQUAL(OUString("5 gp"), xCell->getString()); } +DECLARE_ODFEXPORT_TEST(testTdf153090, "Custom-Style-TOC.docx") +{ + uno::Reference<text::XDocumentIndexesSupplier> xIndexSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexes(xIndexSupplier->getDocumentIndexes()); + uno::Reference<text::XDocumentIndex> xTOC(xIndexes->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("_CustomImageCaption"), getProperty<OUString>(xTOC, "CreateFromParagraphStyle")); + + xTOC->update(); + OUString const tocContent(xTOC->getAnchor()->getString()); + CPPUNIT_ASSERT(tocContent.indexOf("1. Abb. Ein Haus") != -1); + CPPUNIT_ASSERT(tocContent.indexOf("2. Abb.Ein Schiff!") != -1); + CPPUNIT_ASSERT(tocContent.indexOf(u"1. ábra Small house with Hungarian description category") != -1); +} + DECLARE_ODFEXPORT_TEST(testTdf143793_noBodyWrapping, "tdf143793_noBodyWrapping.odt") { CPPUNIT_ASSERT_EQUAL(2, getShapes()); |