sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 5 ++++ writerfilter/source/dmapper/StyleSheetTable.cxx | 29 +++++++++++++++--------- 2 files changed, 24 insertions(+), 10 deletions(-)
New commits: commit db9d42f8ac4cb4669b79cf5f718f4013a1e81c31 Author: Justin Luth <[email protected]> AuthorDate: Thu Jun 1 22:13:12 2023 -0400 Commit: Miklos Vajna <[email protected]> CommitDate: Mon Jun 12 11:27:56 2023 +0200 tdf#154371 writerfilter outineNumbering: copy inherited listId LO has a unique heading numbering/chapter numbering/outline numbering that has no counterpart in DOCX world. One big gotcha is that styles do not inherit numbering that is defined by the chapter numbering. So any DOCX paragraph styles that inherit outlineLvl, listLvl, listId from a style that is assigned to chapter numbering needs to explicitly assign the value. One thing I am puzzled about is how the listLvl is being set. (Perhaps that is one setting that Chapter Numbering allows to inherit? But really hard to test because changing ANYTHING triggers all the code that ensures that no inheritance occurs/resets listLvl.) make CppunitTest_sw_ooxmlexport4 CPPUNIT_TEST_NAME=test_ClosingBrace Change-Id: Ia744b076a86291b06af474934b2f4f705744b8b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152515 Tested-by: Jenkins Reviewed-by: Justin Luth <[email protected]> diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 04e438d64dfb..aa1433f07ac0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -892,6 +892,11 @@ CPPUNIT_TEST_FIXTURE(Test, test_ClosingBrace) xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); // Checking for ClosingBrace tag assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/m:oMath[1]/m:d[2]/m:dPr[1]/m:endChr[1]","val",""); + + // tdf#154371 paragraph style Подзаголовок ур3 inherits from Heading 3 (includes list level and list id) + uno::Reference<beans::XPropertySet> xParaStyle(getStyles("ParagraphStyles")->getByName(u"Подзаголовок ур3"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2), getProperty<sal_Int16>(xParaStyle, "NumberingLevel")); + CPPUNIT_ASSERT(!getProperty<OUString>(xParaStyle, "NumberingStyleName").isEmpty()); } CPPUNIT_TEST_FIXTURE(Test, testlvlPicBulletId) diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index a78ac4fda2db..b0282e981374 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -969,26 +969,35 @@ void StyleSheetTable::ReApplyInheritedOutlineLevelFromChapterNumbering() if (pEntry->m_nStyleTypeCode != STYLE_TYPE_PARA || pEntry->m_sBaseStyleIdentifier.isEmpty()) continue; - sal_Int16 nOutlineLevel = pEntry->m_pProperties->GetOutlineLevel(); - if (nOutlineLevel != -1) - continue; - StyleSheetEntryPtr pParent = FindStyleSheetByISTD(pEntry->m_sBaseStyleIdentifier); if (!pParent || !pParent->m_bAssignedAsChapterNumbering) continue; + uno::Reference< style::XStyle > xStyle; + xParaStyles->getByName(pEntry->m_sConvertedStyleName) >>= xStyle; + if (!xStyle.is()) + continue; + + uno::Reference<beans::XPropertySet> xPropertySet(xStyle, uno::UNO_QUERY_THROW); + const sal_Int16 nListId = pEntry->m_pProperties->props().GetListId(); + const OUString& sParentNumberingStyleName + = m_pImpl->m_rDMapper.GetListStyleName(pParent->m_pProperties->props().GetListId()); + if (nListId == -1 && !sParentNumberingStyleName.isEmpty()) + { + xPropertySet->setPropertyValue(getPropertyName(PROP_NUMBERING_STYLE_NAME), + uno::Any(sParentNumberingStyleName)); + } + + sal_Int16 nOutlineLevel = pEntry->m_pProperties->GetOutlineLevel(); + if (nOutlineLevel != -1) + continue; + nOutlineLevel = pParent->m_pProperties->GetOutlineLevel(); assert(nOutlineLevel >= WW_OUTLINE_MIN && nOutlineLevel < WW_OUTLINE_MAX); // convert MS level to LO equivalent outline level ++nOutlineLevel; - uno::Reference< style::XStyle > xStyle; - xParaStyles->getByName(pEntry->m_sConvertedStyleName) >>= xStyle; - if ( !xStyle.is() ) - break; - - uno::Reference<beans::XPropertySet> xPropertySet( xStyle, uno::UNO_QUERY_THROW ); xPropertySet->setPropertyValue(getPropertyName(PROP_OUTLINE_LEVEL), uno::Any(nOutlineLevel)); } }
