[Libreoffice-commits] core.git: sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Feb 10 04:52:55 PST 2014


 sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                 |    5 ++++-
 writerfilter/source/dmapper/GraphicImport.cxx            |    9 ++++++---
 3 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit d6ee755e35fbe9017aea9c5c908b3cbd4076e056
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Feb 10 12:41:39 2014 +0100

    drawingML import: ignore zero relative size
    
    Zero means ignore me, use absolute size in this context.
    
    Change-Id: I872810a9abf9e25c576f483a77494e1b87f3510a

diff --git a/sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx b/sw/qa/extras/ooxmlexport/data/dml-rectangle-relsize.docx
index 391d737..265dcbb 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 cecb7fa..ce4ff79 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 9528cd5..2009bf5 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:


More information about the Libreoffice-commits mailing list