From 8e911fe7e14d20ea5abe2991ed93ced62385462d Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 28 Sep 2015 14:03:25 +0200 Subject: bnc#939996 tdf#93919 DOCX import: fix left-from-style and first-from-direct With this, as direct paragraph formatting and as a numbering level formatting is properly merged, i.e. w:left is not lost, defaulting to 0. (cherry picked from commit 56341e5d496f576dc45fe8e6c44831d780fecb73) Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: If5534fbd9ee6d41139b0ed3a3df9d0cc5aad3239 Reviewed-on: https://gerrit.libreoffice.org/18906 Reviewed-by: Andras Timar Tested-by: Andras Timar --- sw/qa/extras/ooxmlimport/data/tdf93919.docx | Bin 0 -> 15336 bytes sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 6 ++++++ writerfilter/source/dmapper/DomainMapper.cxx | 5 +++++ 3 files changed, 11 insertions(+) create mode 100644 sw/qa/extras/ooxmlimport/data/tdf93919.docx diff --git a/sw/qa/extras/ooxmlimport/data/tdf93919.docx b/sw/qa/extras/ooxmlimport/data/tdf93919.docx new file mode 100644 index 000000000000..c7454690c844 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf93919.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 98ce91a1802d..5066625da201 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -2767,6 +2767,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf87924, "tdf87924.docx") CPPUNIT_ASSERT_EQUAL(static_cast(0), aGeometry["TextPreRotateAngle"].get()); } +DECLARE_OOXMLIMPORT_TEST(testTdf93919, "tdf93919.docx") +{ + // This was 0, left margin was not inherited from the list style. + CPPUNIT_ASSERT_EQUAL(static_cast(1270), getProperty(getParagraph(1), "ParaLeftMargin")); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 8f13b5bfd435..f7ef2266ea0b 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -482,6 +482,11 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) sal_Int32 nValue = ConversionHelper::convertTwipToMM100( nIntValue ); m_pImpl->GetTopContext()->Insert( PROP_PARA_FIRST_LINE_INDENT, uno::makeAny( - nValue )); + + // See above, need to inherit left margin from list style when first is set. + sal_Int32 nParaLeftMargin = m_pImpl->getCurrentNumberingProperty("IndentAt"); + if (nParaLeftMargin != 0) + m_pImpl->GetTopContext()->Insert(PROP_PARA_LEFT_MARGIN, uno::makeAny(nParaLeftMargin), /*bOverwrite=*/false); } break; case NS_ooxml::LN_CT_Ind_firstLine: -- cgit v1.2.3