[Libreoffice-commits] core.git: include/oox oox/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Dec 13 06:11:43 PST 2013


 include/oox/export/drawingml.hxx |    2 ++
 oox/source/export/drawingml.cxx  |    7 +++++++
 oox/source/export/shapes.cxx     |   13 ++++++++++++-
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 445d3d8484d6e480f461de305c9dc4def067cf20
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Dec 13 15:01:35 2013 +0100

    drawingml export: handle child shapes when exporting groupshapes
    
    Change-Id: I4ed800ad17750c87788108417c8a7b1817853115

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 67feca1..00ec32e 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -88,6 +88,8 @@ protected:
     ::com::sun::star::uno::Any mAny;
     ::sax_fastparser::FSHelperPtr mpFS;
     ::oox::core::XmlFilterBase* mpFB;
+    /// If set, this is the parent of the currently handled shape.
+    com::sun::star::uno::Reference<com::sun::star::drawing::XShape> m_xParent;
 
     bool GetProperty( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString aName );
     bool GetPropertyAndState( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 3ed8f02..0e8db87 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -670,6 +670,13 @@ void DrawingML::WriteShapeTransformation( Reference< XShape > rXShape, sal_Int32
     awt::Point aPos = rXShape->getPosition();
     awt::Size aSize = rXShape->getSize();
 
+    if (m_xParent.is())
+    {
+        awt::Point aParentPos = m_xParent->getPosition();
+        aPos.X -= aParentPos.X;
+        aPos.Y -= aParentPos.Y;
+    }
+
     if ( aSize.Width < 0 )
         aSize.Width = 1000;
     if ( aSize.Height < 0 )
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index e2e7a13..3e9a082 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -256,7 +256,18 @@ ShapeExport& ShapeExport::WriteGroupShape(uno::Reference<drawing::XShape> xShape
     WriteShapeTransformation(xShape, XML_a);
     pFS->endElementNS(mnXmlNamespace, XML_grpSpPr);
 
-    // TODO: children
+    uno::Reference<drawing::XShapes> xGroupShape(xShape, uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xParent = m_xParent;
+    m_xParent = xShape;
+    for (sal_Int32 i = 0; i < xGroupShape->getCount(); ++i)
+    {
+        uno::Reference<drawing::XShape> xChild(xGroupShape->getByIndex(i), uno::UNO_QUERY_THROW);
+        sal_Int32 nSavedNamespace = mnXmlNamespace;
+        mnXmlNamespace = XML_wps;
+        WriteShape(xChild);
+        mnXmlNamespace = nSavedNamespace;
+    }
+    m_xParent = xParent;
 
     pFS->endElementNS(mnXmlNamespace, XML_wgp);
     return *this;


More information about the Libreoffice-commits mailing list