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

Miklos Vajna vmiklos at collabora.co.uk
Mon Jan 6 01:16:53 PST 2014


 oox/source/export/shapes.cxx                          |    8 +++++++-
 oox/source/shape/WpgContext.cxx                       |    4 ++++
 sw/qa/extras/ooxmlexport/data/groupshape-picture.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx              |    8 ++++++++
 4 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 430246ef14e79643ff93a981d56086acd259d055
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jan 6 09:51:46 2014 +0100

    oox: handle pic:pic in WPG groupshape import
    
    Change-Id: I7de11251bc4e1b58f9cb308e8b698d4c8c1a58d3

diff --git a/oox/source/shape/WpgContext.cxx b/oox/source/shape/WpgContext.cxx
index 8e6c8ea..6e31612 100644
--- a/oox/source/shape/WpgContext.cxx
+++ b/oox/source/shape/WpgContext.cxx
@@ -10,6 +10,7 @@
 #include "WpgContext.hxx"
 #include <oox/drawingml/shapepropertiescontext.hxx>
 #include <oox/drawingml/shapegroupcontext.hxx>
+#include <oox/drawingml/graphicshapecontext.hxx>
 
 using namespace com::sun::star;
 
@@ -54,6 +55,9 @@ oox::core::ContextHandlerRef WpgContext::onCreateContext(sal_Int32 nElementToken
         return new oox::drawingml::ShapeContext(*this, mpShape, pShape);
     }
     break;
+    case XML_pic:
+        return new oox::drawingml::GraphicShapeContext(*this, mpShape, oox::drawingml::ShapePtr(new oox::drawingml::Shape("com.sun.star.drawing.GraphicObjectShape")));
+        break;
     case XML_grpSp:
     {
         oox::drawingml::ShapePtr pShape(new oox::drawingml::Shape("com.sun.star.drawing.GroupShape"));
diff --git a/sw/qa/extras/ooxmlexport/data/groupshape-picture.docx b/sw/qa/extras/ooxmlexport/data/groupshape-picture.docx
new file mode 100644
index 0000000..4ecce56
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/groupshape-picture.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index aab75ab..126516f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2217,6 +2217,14 @@ DECLARE_OOXMLEXPORT_TEST(testGroupshapeTextbox, "groupshape-textbox.docx")
     CPPUNIT_ASSERT_EQUAL(11.f, getProperty<float>(xShape, "CharHeight"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testGroupshapePicture, "groupshape-picture.docx")
+{
+    // Picture in the groupshape got lost, groupshape had only one child.
+    uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY);
+    uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xGroup->getByIndex(1), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GraphicObjectShape"), xShapeDescriptor->getShapeType());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedParagraphMark, "testTrackChangesDeletedParagraphMark.docx")
 {
     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
commit c6d1ccd8024c9a90bf8f5732ce1e2b957e8048e7
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jan 6 09:39:49 2014 +0100

    oox: fix XML namespace of drawing::GraphicObjectShape in DML export
    
    Change-Id: Ia7fb126f30ff1c4cd2f5fb8a5c71a87dd5e1d5c9

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 67cf3dc..76dd743 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -272,8 +272,14 @@ ShapeExport& ShapeExport::WriteGroupShape(uno::Reference<drawing::XShape> xShape
     {
         uno::Reference<drawing::XShape> xChild(xGroupShape->getByIndex(i), uno::UNO_QUERY_THROW);
         sal_Int32 nSavedNamespace = mnXmlNamespace;
-        mnXmlNamespace = XML_wps;
+
+        uno::Reference<lang::XServiceInfo> xServiceInfo(xChild, uno::UNO_QUERY_THROW);
+        if (xServiceInfo->supportsService("com.sun.star.drawing.GraphicObjectShape"))
+            mnXmlNamespace = XML_pic;
+        else
+            mnXmlNamespace = XML_wps;
         WriteShape(xChild);
+
         mnXmlNamespace = nSavedNamespace;
     }
     m_xParent = xParent;


More information about the Libreoffice-commits mailing list