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

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 21 09:02:04 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf134648.docx      |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx         |   12 ++++++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   10 ++++++++++
 3 files changed, 22 insertions(+)

New commits:
commit 1c3eb7e329cd2eaeb83068907ba0c9a5b3ef7852
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Mon Jul 20 14:05:30 2020 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Tue Jul 21 11:01:12 2020 +0200

    tdf#134648 DOCX import: fix bottom auto margin of subitem
    
    If style based spacing was set to auto in the previous
    list item, style of the actual paragraph must be the same
    to guarantee the same auto setting.
    
    Regression from commit 9cca15204af9cc44a8a9528ccf2f36616fb70e69
    (tdf#133052: DOCX import: fix top auto margin of subitems).
    
    Change-Id: I39d2bad03a659a407b52550768b010cfa716d363
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99096
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf134648.docx b/sw/qa/extras/ooxmlexport/data/tdf134648.docx
new file mode 100644
index 000000000000..36e856ca055a
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf134648.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 6e1d88b91489..f9c51b3b24de 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -236,6 +236,18 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf133052, "tdf133052.docx")
     assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc/w:p[5]/w:pPr/w:spacing", "before", "0");
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf134648, "tdf134648.docx")
+{
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+
+    // list item with direct top auto spacing
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:spacing", "after", "240");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:spacing", "beforeAutospacing", "1");
+
+    // This was spacing w:after=200, but bottom auto spacing of first list subitem is zero
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:spacing", 0);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf129575_directBefore, "tdf129575-directBefore.docx")
 {
     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 25820d086c12..16f9e279a7fb 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1714,6 +1714,16 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
                             {
                                     return rValue.Name == "ParaTopMarginBeforeAutoSpacing";
                             });
+                            // if style based spacing was set to auto in the previous paragraph, style of the actual paragraph must be the same
+                            if (bParaAutoBefore && !m_bParaAutoBefore && m_xPreviousParagraph->getPropertySetInfo()->hasPropertyByName("ParaStyleName"))
+                            {
+                               auto itParaStyle = std::find_if(aProperties.begin(), aProperties.end(), [](const beans::PropertyValue& rValue)
+                               {
+                                   return rValue.Name == "ParaStyleName";
+                               });
+                               bParaAutoBefore = itParaStyle != aProperties.end() &&
+                                   m_xPreviousParagraph->getPropertyValue("ParaStyleName") == itParaStyle->Value;
+                            }
                             // There was a previous textnode and it had the same numbering.
                             if (bParaAutoBefore)
                             {


More information about the Libreoffice-commits mailing list