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

Victor Mireyev victor at opennodecloud.com
Thu May 10 12:14:30 UTC 2018


 sw/qa/extras/ooxmlexport/data/effect-extent-inline.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                |   14 ++++++++++++++
 writerfilter/source/dmapper/GraphicImport.cxx           |    7 +++++++
 3 files changed, 21 insertions(+)

New commits:
commit 9992338fbbf46bf381501df6c7763bf117d2ee25
Author: Victor Mireyev <victor at opennodecloud.com>
Date:   Fri May 4 16:56:22 2018 +0300

    tdf#79315 Fix wp:effectExtent issue when exporting inline picture to DOCX.
    
    Change-Id: I250bb365593c6a06f1d99f28b36e8bde183b16e6
    Reviewed-on: https://gerrit.libreoffice.org/53679
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jacobo Aragunde PĂ©rez <jaragunde at igalia.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/data/effect-extent-inline.docx b/sw/qa/extras/ooxmlexport/data/effect-extent-inline.docx
new file mode 100644
index 000000000000..bb7db129aac9
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/effect-extent-inline.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index bc831c024ec1..0442456cd8c8 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -558,6 +558,20 @@ DECLARE_OOXMLEXPORT_TEST(testEffectExtent, "effect-extent.docx")
         assertXPath(pXmlDoc, "//wp:effectExtent", "l", "114300");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testEffectExtentInline, "effect-extent-inline.docx")
+{
+    // The problem was that in case there was inline rotated picture, we
+    // wrote a <wp:effectExtent> full or zeros.
+    if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
+    {
+        // E.g. this was 0.
+        assertXPath(pXmlDoc, "//wp:effectExtent", "l", "609600");
+        assertXPath(pXmlDoc, "//wp:effectExtent", "r", "590550");
+        assertXPath(pXmlDoc, "//wp:effectExtent", "t", "590550");
+        assertXPath(pXmlDoc, "//wp:effectExtent", "b", "571500");
+    }
+}
+
 DECLARE_OOXMLEXPORT_TEST(testEm, "em.docx")
 {
     // Test all possible <w:em> arguments.
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index fa91d74cfae4..45621b9c1686 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -838,6 +838,13 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
                         aInteropGrabBag.update(m_pImpl->getInteropGrabBag());
                         xShapeProps->setPropertyValue("InteropGrabBag", uno::makeAny(aInteropGrabBag.getAsConstPropertyValueList()));
                     }
+                    else if (bUseShape && m_pImpl->eGraphicImportType == IMPORT_AS_DETECTED_INLINE)
+                    {
+                        uno::Reference< beans::XPropertySet > xShapeProps(m_xShape, uno::UNO_QUERY_THROW);
+                        comphelper::SequenceAsHashMap aInteropGrabBag(xShapeProps->getPropertyValue("InteropGrabBag"));
+                        aInteropGrabBag.update(m_pImpl->getInteropGrabBag());
+                        xShapeProps->setPropertyValue("InteropGrabBag", uno::makeAny(aInteropGrabBag.getAsConstPropertyValueList()));
+                    }
                 }
             }
         break;


More information about the Libreoffice-commits mailing list