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

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Thu May 21 07:28:10 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf133052.docx      |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx         |   13 +++++++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   12 +++---------
 3 files changed, 16 insertions(+), 9 deletions(-)

New commits:
commit 9cca15204af9cc44a8a9528ccf2f36616fb70e69
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Wed May 20 16:24:38 2020 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Thu May 21 09:27:10 2020 +0200

    tdf#133052: DOCX import: fix top auto margin of subitems
    
    (nested lists) and other items of lists, when auto
    margin is defined by paragraph style, and list items
    have got w:numPr.
    
    Follow-up of commit 162d74ae7a53eb1cde738f0a7558f297b8162f7a
    (tdf#132807 DOCX import: fix top auto margin in lists).
    
    Change-Id: I4cf470173fa367ac07e15dc901b0e202178c9fc4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94588
    Tested-by: Jenkins
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf133052.docx b/sw/qa/extras/ooxmlexport/data/tdf133052.docx
new file mode 100644
index 000000000000..937554facde6
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133052.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 85376af95392..8847b6413a54 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -223,6 +223,19 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf132807, "tdf132807.docx")
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:pPr/w:spacing", "before", "280");
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf133052, "tdf133052.docx")
+{
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+    // These were 240 (top auto spacing of list subitems are zero)
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:pPr/w:spacing", "before", "0");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:pPr/w:spacing", "before", "0");
+    // in tables, too
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc/w:p[2]/w:pPr/w:spacing", "before", "0");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc/w:p[3]/w:pPr/w:spacing", "before", "0");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc/w:p[4]/w:pPr/w:spacing", "before", "0");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc/w:p[5]/w:pPr/w:spacing", "before", "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 c570562d5e12..4b7b3ccd45ef 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1656,18 +1656,12 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
                             uno::Sequence<beans::PropertyValue> aPrevPropertiesSeq;
                             m_xPreviousParagraph->getPropertyValue("ParaInteropGrabBag") >>= aPrevPropertiesSeq;
                             auto aPrevProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aPrevPropertiesSeq);
-                            bool bPrevParaAutoBefore;
-                            if (isNumberingViaRule)
-                                bPrevParaAutoBefore = false;
-                            else
+                            bool bParaAutoBefore = m_bParaAutoBefore || std::any_of(aPrevProperties.begin(), aPrevProperties.end(), [](const beans::PropertyValue& rValue)
                             {
-                                bPrevParaAutoBefore = std::any_of(aPrevProperties.begin(), aPrevProperties.end(), [](const beans::PropertyValue& rValue)
-                                {
                                     return rValue.Name == "ParaTopMarginBeforeAutoSpacing";
-                                });
-                            }
+                            });
                             // There was a previous textnode and it had the same numbering.
-                            if (m_bParaAutoBefore || bPrevParaAutoBefore)
+                            if (bParaAutoBefore)
                             {
                                 // This before spacing is set to auto, set before space to 0.
                                 auto itParaTopMargin = std::find_if(aProperties.begin(), aProperties.end(), [](const beans::PropertyValue& rValue)


More information about the Libreoffice-commits mailing list