sw/qa/extras/ooxmlexport/data/tdf146851_1.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 11 +++++++++++ writerfilter/source/dmapper/NumberingManager.cxx | 9 ++++++--- 3 files changed, 17 insertions(+), 3 deletions(-)
New commits: commit f50a8f1d8852bfc143809dc5d45ef662d3557a61 Author: Vasily Melenchuk <vasily.melenc...@cib.de> AuthorDate: Thu Mar 10 12:04:20 2022 +0300 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Wed Mar 16 04:42:59 2022 +0100 tdf#146851: writerfilter: do not recreate list levels on override AddLevel() can be called on w:lvl and on w:lvlOverride. But if we have level override and some extra level definition level is recreated and override information is lost. Change-Id: I6f1b9b50bdd3410b4ae2d403e760e4d6df5677d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131304 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/sw/qa/extras/ooxmlexport/data/tdf146851_1.docx b/sw/qa/extras/ooxmlexport/data/tdf146851_1.docx new file mode 100644 index 000000000000..b4456bf40074 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf146851_1.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 8b70d879f4b4..c6a795c0ab01 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -270,6 +270,17 @@ DECLARE_OOXMLEXPORT_TEST(testWPGBodyPr, "WPGbodyPr.docx") xInnerShape->getPropertyValue("TextRightDistance").get<sal_Int32>()); } +DECLARE_OOXMLEXPORT_TEST(testTdf146851_1, "tdf146851_1.docx") +{ + uno::Reference<beans::XPropertySet> xPara; + + xPara.set(getParagraph(1, "qwerty"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty<OUString>(xPara, "ListLabelString")); + + xPara.set(getParagraph(2, "asdfg"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("1/"), getProperty<OUString>(xPara, "ListLabelString")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf81507, "tdf81507.docx") { xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 8829aa52697f..1c79e0eece99 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -371,9 +371,12 @@ void AbstractListDef::AddLevel( sal_uInt16 nLvl ) if ( nLvl >= m_aLevels.size() ) m_aLevels.resize( nLvl+1 ); - ListLevel::Pointer pLevel( new ListLevel ); - m_pCurrentLevel = pLevel; - m_aLevels[nLvl] = pLevel; + if (!m_aLevels[nLvl]) + { + m_aLevels[nLvl] = new ListLevel; + } + + m_pCurrentLevel = m_aLevels[nLvl]; } uno::Sequence<uno::Sequence<beans::PropertyValue>> AbstractListDef::GetPropertyValues(bool bDefaults)