drawingML import: ignore zero relative size

Zero means ignore me, use absolute size in this context.

Change-Id: I872810a9abf9e25c576f483a77494e1b87f3510a
This commit is contained in:
Miklos Vajna
2014-02-10 12:41:39 +01:00
parent c1dd14ba87
commit d6ee755e35
3 changed files with 10 additions and 4 deletions

View File

@@ -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")

View File

@@ -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: