sw/qa/extras/odfexport/odfexport2.cxx | 3 +++ sw/qa/extras/ooxmlexport/data/Table-of-Figures.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 13 +++++++++++++ sw/source/filter/ww8/wrtw8sty.cxx | 2 +- writerfilter/source/dmapper/StyleSheetTable.cxx | 3 ++- 5 files changed, 19 insertions(+), 2 deletions(-)
New commits: commit 667f5f87dee072f6737ee6b6491ed53b7cf154a7 Author: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> AuthorDate: Tue Mar 21 20:12:13 2023 +0100 Commit: Gabor Kelemen <kelem...@ubuntu.com> CommitDate: Wed Mar 22 20:05:09 2023 +0000 tdf#153664 Export correct Table of Figures paragraph style Change-Id: I892a0185a94aadd902e55ee9b719f855edbdfc89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149258 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <kelem...@ubuntu.com> diff --git a/sw/qa/extras/ooxmlexport/data/Table-of-Figures.odt b/sw/qa/extras/ooxmlexport/data/Table-of-Figures.odt new file mode 100644 index 000000000000..cd1502cf866f Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/Table-of-Figures.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index b19c196016b2..20db0327ccef 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -632,6 +632,19 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148026) assertXPath(pXmlDoc, "//w:hyperlink", "tgtFrame", "_self"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf153664) +{ + loadAndReload("Table-of-Figures.odt"); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); + CPPUNIT_ASSERT(pXmlStyles); + // Without the fix this was styleId='FigureIndex1' and name was "Figure Index 1" + // This led to syle settings being reset when ToF was updated in Word + // TOF's paragraph style should be exported as "Table of Figures" as that's the default Word style name + assertXPath(pXmlStyles, "/w:styles/w:style[12]", "styleId", "TableofFigures"); + assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableofFigures']/w:name", "val", "Table of Figures"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 1d556fc312b8..8e0bcdde91a1 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -268,7 +268,7 @@ sal_uInt16 MSWordStyles::GetWWId( const SwFormat& rFormat ) case RES_POOLCOLL_FOOTER: nRet = ww::stiFooter; break; case RES_POOLCOLL_TOX_IDXH: nRet = ww::stiIndexHeading; break; case RES_POOLCOLL_LABEL: nRet = ww::stiCaption; break; - case RES_POOLCOLL_LABEL_DRAWING: nRet = ww::stiToCaption; break; + case RES_POOLCOLL_TOX_ILLUS1: nRet = ww::stiToCaption; break; case RES_POOLCOLL_ENVELOPE_ADDRESS: nRet = ww::stiEnvAddr; break; case RES_POOLCOLL_SEND_ADDRESS: nRet = ww::stiEnvRet; break; case RES_POOLCHR_FOOTNOTE_ANCHOR: nRet = ww::stiFootnoteRef; break; commit 9b89ce887836742bb84bf57afa3b536b6c3bb1c1 Author: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> AuthorDate: Tue Mar 21 09:21:18 2023 +0100 Commit: Gabor Kelemen <kelem...@ubuntu.com> CommitDate: Wed Mar 22 20:04:57 2023 +0000 tdf#153659 Import Table of Figures paragraph style correctly Change-Id: I5a995349c168bfbb5c8933dafa72e06eddb74ac6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149257 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <kelem...@ubuntu.com> diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index e4da067f5396..269525a8756b 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -606,6 +606,9 @@ DECLARE_ODFEXPORT_TEST(testTdf153090, "Custom-Style-TOC.docx") 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")); + // tdf#153659 this was imported as "table of figures" instead of "Figure Index 1" + // thus custom settings were not retained after ToF update + CPPUNIT_ASSERT_EQUAL(OUString("Figure Index 1"), getProperty<OUString>(getParagraph(1), "ParaStyleName")); xTOC->update(); OUString const tocContent(xTOC->getAnchor()->getString()); diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 1e10d4966dbf..a78ac4fda2db 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -1594,7 +1594,8 @@ OUString StyleSheetTable::ConvertStyleName( const OUString& rWWName, bool bExten { "footer", "Footer" }, // RES_POOLCOLL_FOOTER { "Index Heading", "Index Heading" }, // RES_POOLCOLL_TOX_IDXH { "Caption", "Caption" }, // RES_POOLCOLL_LABEL - { "Table of Figures", "Drawing" }, // RES_POOLCOLL_LABEL_DRAWING + { "table of figures", "Figure Index 1" }, // RES_POOLCOLL_TOX_ILLUS1 + { "Table of Figures", "Figure Index 1" }, // RES_POOLCOLL_TOX_ILLUS1 { "Envelope Address", "Addressee" }, // RES_POOLCOLL_ENVELOPE_ADDRESS { "Envelope Return", "Sender" }, // RES_POOLCOLL_SEND_ADDRESS { "footnote reference", "Footnote Symbol" }, // RES_POOLCHR_FOOTNOTE; tdf#82173