sw/qa/extras/ooxmlexport/data/tdf136617.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 12 ++++++++++++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 12 ++++-------- writerfilter/source/dmapper/DomainMapper_Impl.cxx | 2 +- writerfilter/source/dmapper/PropertyMap.hxx | 1 - 5 files changed, 17 insertions(+), 10 deletions(-)
New commits: commit 2a3e528bb9df4a1a2564ca5236be62dfdaba77e6 Author: László Németh <nem...@numbertext.org> AuthorDate: Fri Oct 7 12:37:53 2022 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Fri Oct 7 16:59:44 2022 +0200 tdf#136617 DOCX import: fix empty table paragraphs with direct formatting Table paragraph styles applied on paragraphs without runs, i.e. on empty paragraphs, despite their direct formatting, resulting e.g. different font size, and after that different paragraph i.e. cell height, breaking the original table layout. Regression from commit bf3124cdf61b40c94ba117a76f1b63dabdfd528e "tdf#135187 DOCX import: fix table style at character formatting". Also clean-up commit 498d2b82187ec3ff58f076e0d15741e64c0505ba "tdf#131546 DOCX import: fix performance regression at tables". Change-Id: I41f8da61d49902c8c1683bd01632cce6d58aebd9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141052 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/ooxmlexport/data/tdf136617.docx b/sw/qa/extras/ooxmlexport/data/tdf136617.docx new file mode 100644 index 000000000000..e7b35aa295cb Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf136617.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index 586f36ed0c82..7bead3a2bb1f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -1874,6 +1874,18 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf135187) "false"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf136617) +{ + loadAndSave("tdf136617.docx"); + + // This was 2 + CPPUNIT_ASSERT_EQUAL(1, getPages()); + + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:p[2]/w:pPr/w:rPr/w:sz", "val", + "16"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf121597TrackedDeletionOfMultipleParagraphs) { loadAndSave("tdf121597.odt"); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index cc9f9ada017b..2e962260c79c 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -1112,14 +1112,6 @@ void DomainMapperTableHandler::ApplyParagraphPropertiesFromTableStyle(TableParag OUString sPropertyName = getPropertyName(eId); - if ( bIsParaLevel && ( rParaProp.m_aParaOverrideApplied.find(sPropertyName) != rParaProp.m_aParaOverrideApplied.end() || - sPropertyName.startsWith("CharFontName") ) ) - { - // don't apply table style, if this character property was applied on paragraph level - // (or in the case of paragraph level font name settings to avoid regressions) - continue; - } - auto pCellProp = std::find_if(rCellProperties.begin(), rCellProperties.end(), [&](const beans::PropertyValue& rProp) { return rProp.Name == sPropertyName; }); // this cell applies the table style property @@ -1179,6 +1171,10 @@ void DomainMapperTableHandler::ApplyParagraphPropertiesFromTableStyle(TableParag uno::Reference< beans::XPropertyState > xParaProperties( xParagraph, uno::UNO_QUERY_THROW ); if ( xParaProperties->getPropertyState(sPropertyName) == css::beans::PropertyState_DEFAULT_VALUE ) { + // don't overwrite empty paragraph with table style, if it has a direct paragraph formatting + if ( bIsParaLevel && xParagraph->getString().getLength() == 0 ) + continue; + if ( eId != PROP_FILL_COLOR ) { // apply style setting when the paragraph doesn't modify it diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 191b7fec353c..dc42f0198cdf 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2462,7 +2462,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con xParaCursor->gotoStartOfParagraph(false); if (m_nTableDepth > 0) { - TableParagraph aPending{xParaCursor, xCur, pParaContext, xParaProps, std::set<OUString>()}; + TableParagraph aPending{xParaCursor, xCur, pParaContext, xParaProps}; getTableManager().getCurrentParagraphs()->push_back(aPending); } diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx index 0678440810b0..701546e2fb93 100644 --- a/writerfilter/source/dmapper/PropertyMap.hxx +++ b/writerfilter/source/dmapper/PropertyMap.hxx @@ -606,7 +606,6 @@ struct TableParagraph css::uno::Reference<css::text::XTextRange> m_rEndParagraph; PropertyMapPtr m_pPropertyMap; css::uno::Reference<css::beans::XPropertySet> m_rPropertySet; - std::set<OUString> m_aParaOverrideApplied; }; typedef std::shared_ptr< std::vector<TableParagraph> > TableParagraphVectorPtr;