[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 27 14:21:56 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 4c07b4e48f10349c5d1f3f7274b7cbbcbaa9d57b
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Mon Oct 26 15:31:30 2020 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Oct 27 15:21:21 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>
    (cherry picked from commit 41e230e81b50235b5b86f883ef424a8ba5b42288)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104828
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.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 7317dc751bb9..ae47d4f28a9c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -1524,6 +1524,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 dc45aabdb27d..12aa623de2b2 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2036,7 +2036,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