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 f9d34f1498404f74310a81b2dcf322867fa28e9c
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: Mon Oct 10 11:01:30 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>
    (cherry picked from commit a1e31341f42a1b7f990928c0d95278bb18adaf89)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141060

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 a2103113c2ff..87b1824ed93d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -1862,6 +1862,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 d0c42576202e..0f0f3c5d1d1a 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1107,14 +1107,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
@@ -1174,6 +1166,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 3f765b272b81..990f854268a2 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2431,7 +2431,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 e9a0fdbd5df0..988c99b02150 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -605,7 +605,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;

Reply via email to