Kaydet (Commit) dbdc31fc authored tarafından Miklos Vajna's avatar Miklos Vajna

oox: initial ShapeExport::WriteGroupShape

For now, enable it only for DOCX.

Change-Id: I424d8fb3f1c1e7c9a03e7103c91473c3ff85bc77
üst 10c3c9ec
...@@ -93,6 +93,8 @@ public: ...@@ -93,6 +93,8 @@ public:
WriteEllipseShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); WriteEllipseShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
virtual ShapeExport& virtual ShapeExport&
WriteGraphicObjectShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); 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& virtual ShapeExport&
WriteLineShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); WriteLineShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
virtual ShapeExport& virtual ShapeExport&
......
...@@ -243,6 +243,25 @@ ShapeExport& ShapeExport::WriteOpenBezierShape( Reference< XShape > xShape ) ...@@ -243,6 +243,25 @@ ShapeExport& ShapeExport::WriteOpenBezierShape( Reference< XShape > xShape )
return WriteBezierShape( xShape, sal_False ); 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 ) ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape )
{ {
DBG(printf("write custom shape\n")); DBG(printf("write custom shape\n"));
...@@ -679,7 +698,7 @@ ShapeExport& ShapeExport::WriteRectangleShape( Reference< XShape > xShape ) ...@@ -679,7 +698,7 @@ ShapeExport& ShapeExport::WriteRectangleShape( Reference< XShape > xShape )
typedef ShapeExport& (ShapeExport::*ShapeConverter)( Reference< XShape > ); typedef ShapeExport& (ShapeExport::*ShapeConverter)( Reference< XShape > );
typedef boost::unordered_map< const char*, ShapeConverter, rtl::CStringHash, rtl::CStringEqual> NameToConvertMapType; 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 bool shape_map_inited = false;
static NameToConvertMapType shape_converters; static NameToConvertMapType shape_converters;
...@@ -712,6 +731,8 @@ static const NameToConvertMapType& lcl_GetConverters() ...@@ -712,6 +731,8 @@ static const NameToConvertMapType& lcl_GetConverters()
shape_converters[ "com.sun.star.presentation.OutlinerShape" ] = &ShapeExport::WriteTextShape; shape_converters[ "com.sun.star.presentation.OutlinerShape" ] = &ShapeExport::WriteTextShape;
shape_converters[ "com.sun.star.presentation.SlideNumberShape" ] = &ShapeExport::WriteTextShape; shape_converters[ "com.sun.star.presentation.SlideNumberShape" ] = &ShapeExport::WriteTextShape;
shape_converters[ "com.sun.star.presentation.TitleTextShape" ] = &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; shape_map_inited = true;
return shape_converters; return shape_converters;
...@@ -721,8 +742,8 @@ ShapeExport& ShapeExport::WriteShape( Reference< XShape > xShape ) ...@@ -721,8 +742,8 @@ ShapeExport& ShapeExport::WriteShape( Reference< XShape > xShape )
{ {
OUString sShapeType = xShape->getShapeType(); OUString sShapeType = xShape->getShapeType();
DBG( printf( "write shape: %s\n", USS( sShapeType ) ) ); DBG( printf( "write shape: %s\n", USS( sShapeType ) ) );
NameToConvertMapType::const_iterator aConverter = lcl_GetConverters().find( USS( sShapeType ) ); NameToConvertMapType::const_iterator aConverter = lcl_GetConverters(GetDocumentType()).find( USS( sShapeType ) );
if( aConverter == lcl_GetConverters().end() ) if( aConverter == lcl_GetConverters(GetDocumentType()).end() )
{ {
DBG( printf( "unknown shape\n" ) ); DBG( printf( "unknown shape\n" ) );
return WriteUnknownShape( xShape ); return WriteUnknownShape( xShape );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment