diff --git a/sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx b/sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx index 391d737bf124..265dcbb4ee77 100644 Binary files a/sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx and b/sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index cecb7fa19d95..ce4ff79af1a8 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2812,7 +2812,10 @@ DECLARE_OOXMLEXPORT_TEST(testDmlRectangleRelsize, "dml-rectangle-relsize.docx") { // This was around 19560, as we did not read wp14:pctHeight for // drawinglayer shapes and the fallback data was invalid. - CPPUNIT_ASSERT(21000 < getShape(1)->getSize().Height); + CPPUNIT_ASSERT(getShape(1)->getSize().Height > 21000); + + // This was around 0: relative size of 0% was imported as 0, not "fall back to absolute size". + CPPUNIT_ASSERT(getShape(2)->getSize().Height > 300); } DECLARE_OOXMLEXPORT_TEST(testGradientFillPreservation, "gradient-fill-preservation.docx") diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 9528cd543ef3..2009bf54c851 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -955,9 +955,12 @@ void GraphicImport::lcl_sprm(Sprm & rSprm) sal_Int16 nPositivePercentage = rtl::math::round(m_pImpl->m_rPositivePercentages.front().toDouble() / oox::drawingml::PER_PERCENT); m_pImpl->m_rPositivePercentages.pop(); - uno::Reference xPropertySet(m_xShape, uno::UNO_QUERY); - OUString aProperty = nSprmId == NS_ooxml::LN_CT_SizeRelH_pctWidth ? OUString("RelativeWidth") : OUString("RelativeHeight"); - xPropertySet->setPropertyValue(aProperty, uno::makeAny(nPositivePercentage)); + if (nPositivePercentage) + { + uno::Reference xPropertySet(m_xShape, uno::UNO_QUERY); + OUString aProperty = nSprmId == NS_ooxml::LN_CT_SizeRelH_pctWidth ? OUString("RelativeWidth") : OUString("RelativeHeight"); + xPropertySet->setPropertyValue(aProperty, uno::makeAny(nPositivePercentage)); + } } break; case 0x271b: