sw/qa/extras/ooxmlexport/data/tdf122342.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 11 +++++++++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 15 +++++++++++++++ 3 files changed, 26 insertions(+)
New commits: commit 03c1b327b7a504c304c9f95727f9d43310d08ec1 Author: László Németh <nem...@numbertext.org> AuthorDate: Wed May 6 18:41:46 2020 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Wed May 6 23:01:59 2020 +0200 tdf#122342 DOCX import: fix bottom auto margin in lists at paragraph style based numbering. See also commit 1bf7f6a1a50ee9f24a3687240fe6ae390b905a6b (tdf#106690 DOCX import: fix automatic spacing before/after numbered para block). Change-Id: I532181019ca97a86475c9bb0a1eea1c836705bab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93581 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/ooxmlexport/data/tdf122342.docx b/sw/qa/extras/ooxmlexport/data/tdf122342.docx new file mode 100644 index 000000000000..0c7ecd67a547 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf122342.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 37603bd407be..1baabd612269 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -180,6 +180,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf106690Cell, "tdf106690-cell.docx") CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(494), getProperty<sal_Int32>(getParagraphOfText(2, xCell->getText()), "ParaBottomMargin")); } +DECLARE_OOXMLEXPORT_TEST(testTdf122342, "tdf122342.docx") +{ + // These were 494, style based numbering rules with automatic spacing meant 0 + // before/autospacing for all text nodes, even for ones at the start/end of + // a numbered text node block. + // TODO fix for ParaTopMargin, too. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraph(2), "ParaBottomMargin")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraph(3), "ParaBottomMargin")); +} + 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 bbef06695434..b538ba19f872 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1699,6 +1699,21 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con { m_xPreviousParagraph->setPropertyValue("ListId", uno::makeAny(listId)); } + else if (isNumberingViaStyle) + { + uno::Sequence<beans::PropertyValue> aPrevPropertiesSeq; + m_xPreviousParagraph->getPropertyValue("ParaInteropGrabBag") >>= aPrevPropertiesSeq; + auto aPrevProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aPrevPropertiesSeq); + bool bPrevParaAutoAfter = std::any_of(aPrevProperties.begin(), aPrevProperties.end(), [](const beans::PropertyValue& rValue) + { + return rValue.Name == "ParaBottomMarginAfterAutoSpacing"; + }); + if (bPrevParaAutoAfter) + { + // Previous after spacing is set to auto, set previous after space to 0. + m_xPreviousParagraph->setPropertyValue("ParaBottomMargin", uno::makeAny(static_cast<sal_Int32>(0))); + } + } } if (pList->GetCurrentLevel()) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits