[Libreoffice-commits] core.git: sw/qa writerfilter/source

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Mon Oct 26 17:18:25 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf137593.docx      |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx         |    9 +++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    3 ++-
 3 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 41e230e81b50235b5b86f883ef424a8ba5b42288
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Mon Oct 26 15:31:30 2020 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Mon Oct 26 18:17:45 2020 +0100

    tdf#137593 DOCX import: fix para top margin in cells with shapes
    
    and text boxes. Auto top margin value of the first table cell
    paragraph is zero. Paragraphs of shapes and text boxes
    anchored to this cell paragraph don't matter here, so keep
    m_bFirstParagraphInCell=true in shapes and text box paragraphs
    to avoid extra top margin of the anchoring point.
    
    Regression from commit 5c6bce38a01b21403a603acd3148cf3bbb4c685f
    (tdf#104354 DOCX import: fix paragraph auto spacing in tables).
    
    Change-Id: I22c4ae230bc0192f06d3d155217887c471c67b67
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104816
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf137593.docx b/sw/qa/extras/ooxmlexport/data/tdf137593.docx
new file mode 100644
index 000000000000..8b63fd39a8f2
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf137593.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index e5fd69650911..1ff3ccf8ec3e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -1543,6 +1543,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104354_2, "tdf104354-2.docx")
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraphOfText(1, xCell5->getText()), "ParaBottomMargin"));
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf137593, "tdf137593.docx")
+{
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+
+    // zero auto spacing, if the first paragraph contains text boxes
+    // This was 280.
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr/w:tc/w:p[1]/w:pPr/w:spacing", "before", "0");
+}
+
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf115557, "tdf115557.docx")
 {
     // A chart anchored to a footnote multiplied during import
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index fe1ab5c99b91..d37a6c68fb05 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2076,7 +2076,8 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
     m_bParaHadField = false;
 
     // don't overwrite m_bFirstParagraphInCell in table separator nodes
-    if (m_nTableDepth > 0 && m_nTableDepth == m_nTableCellDepth)
+    // and in text boxes anchored to the first paragraph of table cells
+    if (m_nTableDepth > 0 && m_nTableDepth == m_nTableCellDepth && !IsInShape())
         m_bFirstParagraphInCell = false;
 
     m_bParaAutoBefore = false;


More information about the Libreoffice-commits mailing list