[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Apr 25 08:15:54 UTC 2018


 sw/qa/extras/ooxmlexport/data/tdf116976.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx    |    7 +++++++
 writerfilter/source/dmapper/GraphicImport.cxx |   10 ++++++++--
 3 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 65f4c7b8725e8fe086889fca8c7c9b7e32fdd4d5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Apr 12 18:39:36 2018 +0200

    tdf#116976 DOCX import: fix rel size of shape after bitmap
    
    We have a queue of these odd relative sizes (which are not XML
    attributes but text inside the XML element), if the bitmap doesn't pop
    the queue, the following shape won't get its size.
    
    Conflicts:
            sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
    
    Change-Id: I1602208c9509d8889bf0be254f3b25fb25fafca2
    Reviewed-on: https://gerrit.libreoffice.org/52970
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf116976.docx b/sw/qa/extras/ooxmlexport/data/tdf116976.docx
new file mode 100644
index 000000000000..70492a4af2f3
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf116976.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 922f2fcb7192..4dbf3c1bd83f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -201,6 +201,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf107035, "tdf107035.docx")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_AUTO), nPgNumColour);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf116976, "tdf116976.docx")
+{
+    // This was 0, reltive size of shape after bitmap was ignored.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(40),
+                         getProperty<sal_Int16>(getShape(1), "RelativeWidth"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index b6c11b58c603..6830e9db71b1 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1065,10 +1065,12 @@ void GraphicImport::lcl_sprm(Sprm& rSprm)
         break;
         case NS_ooxml::LN_CT_SizeRelH_pctWidth:
         case NS_ooxml::LN_CT_SizeRelV_pctHeight:
-            if (m_xShape.is() && !m_pImpl->m_rPositivePercentages.empty())
+            if (m_pImpl->m_rPositivePercentages.empty())
+                break;
+
+            if (m_xShape.is())
             {
                 sal_Int16 nPositivePercentage = rtl::math::round(m_pImpl->m_rPositivePercentages.front().toDouble() / oox::drawingml::PER_PERCENT);
-                m_pImpl->m_rPositivePercentages.pop();
 
                 if (nPositivePercentage)
                 {
@@ -1077,6 +1079,10 @@ void GraphicImport::lcl_sprm(Sprm& rSprm)
                     xPropertySet->setPropertyValue(aProperty, uno::makeAny(nPositivePercentage));
                 }
             }
+
+            // Make sure the token is consumed even if xShape is an empty
+            // reference.
+            m_pImpl->m_rPositivePercentages.pop();
             break;
         case NS_ooxml::LN_EG_WrapType_wrapNone: // 90944; - doesn't contain attributes
             //depending on the behindDoc attribute text wraps through behind or in front of the object


More information about the Libreoffice-commits mailing list