include/oox/export/shapes.hxx | 2 ++ oox/source/export/shapes.cxx | 27 ++++++++++++++++++++++++--- sw/source/filter/ww8/docxexport.cxx | 4 +++- 3 files changed, 29 insertions(+), 4 deletions(-)
New commits: commit dbdc31fc0a09181d80909819d93a2dacde3eac79 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Thu Dec 12 14:32:39 2013 +0100 oox: initial ShapeExport::WriteGroupShape For now, enable it only for DOCX. Change-Id: I424d8fb3f1c1e7c9a03e7103c91473c3ff85bc77 diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx index 65fafc9..bfcaaf7 100644 --- a/include/oox/export/shapes.hxx +++ b/include/oox/export/shapes.hxx @@ -94,6 +94,8 @@ public: virtual ShapeExport& WriteGraphicObjectShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); virtual ShapeExport& + WriteGroupShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); + virtual ShapeExport& WriteLineShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); virtual ShapeExport& WriteNonVisualDrawingProperties( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape, const char* sName ); diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 5689215..e2e7a13 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -243,6 +243,25 @@ ShapeExport& ShapeExport::WriteOpenBezierShape( Reference< XShape > xShape ) return WriteBezierShape( xShape, sal_False ); } +ShapeExport& ShapeExport::WriteGroupShape(uno::Reference<drawing::XShape> xShape) +{ + FSHelperPtr pFS = GetFS(); + pFS->startElementNS(mnXmlNamespace, XML_wgp, FSEND); + + // non visual properties + pFS->singleElementNS(mnXmlNamespace, XML_cNvGrpSpPr, FSEND); + + // visual properties + pFS->startElementNS(mnXmlNamespace, XML_grpSpPr, FSEND); + WriteShapeTransformation(xShape, XML_a); + pFS->endElementNS(mnXmlNamespace, XML_grpSpPr); + + // TODO: children + + pFS->endElementNS(mnXmlNamespace, XML_wgp); + return *this; +} + ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape ) { DBG(printf("write custom shape\n")); @@ -679,7 +698,7 @@ ShapeExport& ShapeExport::WriteRectangleShape( Reference< XShape > xShape ) typedef ShapeExport& (ShapeExport::*ShapeConverter)( Reference< XShape > ); typedef boost::unordered_map< const char*, ShapeConverter, rtl::CStringHash, rtl::CStringEqual> NameToConvertMapType; -static const NameToConvertMapType& lcl_GetConverters() +static const NameToConvertMapType& lcl_GetConverters(DrawingML::DocumentType eDocumentType) { static bool shape_map_inited = false; static NameToConvertMapType shape_converters; @@ -712,6 +731,8 @@ static const NameToConvertMapType& lcl_GetConverters() shape_converters[ "com.sun.star.presentation.OutlinerShape" ] = &ShapeExport::WriteTextShape; shape_converters[ "com.sun.star.presentation.SlideNumberShape" ] = &ShapeExport::WriteTextShape; shape_converters[ "com.sun.star.presentation.TitleTextShape" ] = &ShapeExport::WriteTextShape; + if (eDocumentType == DrawingML::DOCUMENT_DOCX) + shape_converters[ "com.sun.star.drawing.GroupShape" ] = &ShapeExport::WriteGroupShape; shape_map_inited = true; return shape_converters; @@ -721,8 +742,8 @@ ShapeExport& ShapeExport::WriteShape( Reference< XShape > xShape ) { OUString sShapeType = xShape->getShapeType(); DBG( printf( "write shape: %s\n", USS( sShapeType ) ) ); - NameToConvertMapType::const_iterator aConverter = lcl_GetConverters().find( USS( sShapeType ) ); - if( aConverter == lcl_GetConverters().end() ) + NameToConvertMapType::const_iterator aConverter = lcl_GetConverters(GetDocumentType()).find( USS( sShapeType ) ); + if( aConverter == lcl_GetConverters(GetDocumentType()).end() ) { DBG( printf( "unknown shape\n" ) ); return WriteUnknownShape( xShape ); commit 10c3c9ec9b6af1b4124ff2cd458d22f13f4ebc39 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Thu Dec 12 14:26:45 2013 +0100 DocxExport::OutputDML: use the right namespace for groupshapes Change-Id: Idd270e5519587440fe96e73f5cf51851f7680d59 diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 35383d4..6c7a66b 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -331,7 +331,9 @@ OString DocxExport::OutputChart( uno::Reference< frame::XModel >& xModel, sal_In void DocxExport::OutputDML(uno::Reference<drawing::XShape>& xShape) { - oox::drawingml::ShapeExport aExport(XML_wps, m_pDocumentFS, 0, m_pFilter, oox::drawingml::DrawingML::DOCUMENT_DOCX, m_pAttrOutput); + uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY_THROW); + bool bGroupShape = xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"); + oox::drawingml::ShapeExport aExport((bGroupShape ? XML_wpg : XML_wps), m_pDocumentFS, 0, m_pFilter, oox::drawingml::DrawingML::DOCUMENT_DOCX, m_pAttrOutput); aExport.WriteShape(xShape); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits