summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-05-20 16:24:38 +0200
committerLászló Németh <nemeth@numbertext.org>2020-05-21 09:27:10 +0200
commit9cca15204af9cc44a8a9528ccf2f36616fb70e69 (patch)
tree77da0c2ab6e2ed819bce42a8ce352ad7bb2e39cb
parentd618441188dddc3c35aae733aa003b48389c6af7 (diff)
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@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf133052.docxbin0 -> 13891 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport9.cxx13
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx12
3 files changed, 16 insertions, 9 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf133052.docx
Binary files 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)