From 806e323271982c8975ec2904219c6f136aa20eea Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 18 Oct 2016 09:19:50 +0200 Subject: tdf#95031 DOCX import: auto spacing inside numbering means no spacing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The WW8 import has code for this in SwWW8ImplReader::AppendTextNode(), with lots of corner-cases. Not all of that is implemented here yet, but the bullet list in the bugdoc already looks correct now. (cherry picked from commit c486e875de7c8e845594f5043a37ee8800865782) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport9.cxx Change-Id: I9499bfa4d8d7fcc425d7b95e64987258c099f7f2 Reviewed-on: https://gerrit.libreoffice.org/30291 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sw/qa/extras/ooxmlexport/data/tdf95031.docx | Bin 0 -> 14024 bytes sw/qa/extras/ooxmlexport/ooxmlexport7.cxx | 7 +++++++ writerfilter/source/dmapper/DomainMapper.cxx | 6 ++++++ 3 files changed, 13 insertions(+) create mode 100644 sw/qa/extras/ooxmlexport/data/tdf95031.docx diff --git a/sw/qa/extras/ooxmlexport/data/tdf95031.docx b/sw/qa/extras/ooxmlexport/data/tdf95031.docx new file mode 100644 index 000000000000..ef082f752038 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf95031.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index 42f647430f74..0e81597c0cd3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -1137,6 +1137,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103389, "tdf103389.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wpg:wgp/wps:wsp/wps:spPr/a:prstGeom", "prst", "rect"); } +DECLARE_OOXMLEXPORT_TEST(testTdf95031, "tdf95031.docx") +{ + // This was 494, in-numbering paragraph's automating spacing was handled as visible spacing, while it should not. + CPPUNIT_ASSERT_EQUAL(static_cast(0), getProperty(getParagraph(2), "ParaBottomMargin")); + CPPUNIT_ASSERT_EQUAL(static_cast(0), getProperty(getParagraph(3), "ParaTopMargin")); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index af0ae0af3235..c39208b7c619 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -613,6 +613,9 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) } if (nIntValue) // If auto spacing is set, then only store set value in InteropGrabBag { + if (m_pImpl->GetTopContext()->isSet(PROP_NUMBERING_RULES)) + // Numbering is set -> auto space is 0. + default_spacing = 0; m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) ); } else @@ -635,6 +638,9 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) } if (nIntValue) // If auto spacing is set, then only store set value in InteropGrabBag { + if (m_pImpl->GetTopContext()->isSet(PROP_NUMBERING_RULES)) + // Numbering is set -> auto space is 0. + default_spacing = 0; m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) ); } else -- cgit v1.2.3