diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-12-13 15:01:35 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-12-13 15:11:20 +0100 |
commit | 445d3d8484d6e480f461de305c9dc4def067cf20 (patch) | |
tree | 8000dfb2d21dc7b11d2982a66094a06649e7d90e | |
parent | d1e1cd128c83982f69331c92a8e319d3031a7685 (diff) |
drawingml export: handle child shapes when exporting groupshapes
Change-Id: I4ed800ad17750c87788108417c8a7b1817853115
-rw-r--r-- | include/oox/export/drawingml.hxx | 2 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 7 | ||||
-rw-r--r-- | oox/source/export/shapes.cxx | 13 |
3 files changed, 21 insertions, 1 deletions
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 67feca12db67..00ec32ed7028 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 3ed8f02afe74..0e8db872c7e3 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 e2e7a13e6d55..3e9a08242f48 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; |