diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-10 12:41:39 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-10 13:52:23 +0100 |
commit | d6ee755e35fbe9017aea9c5c908b3cbd4076e056 (patch) | |
tree | 3c2ebf5ede3a6e50ca5f45fd9d2ba5a79d14cd0d | |
parent | c1dd14ba87c0223ae9ec14c381796cd859b4b713 (diff) |
drawingML import: ignore zero relative size
Zero means ignore me, use absolute size in this context.
Change-Id: I872810a9abf9e25c576f483a77494e1b87f3510a
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx | bin | 14807 -> 17858 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/dmapper/GraphicImport.cxx | 9 |
3 files changed, 10 insertions, 4 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx b/sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx Binary files differindex 391d737bf124..265dcbb4ee77 100644 --- a/sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx +++ b/sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx 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<beans::XPropertySet> 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<beans::XPropertySet> 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: |