diff options
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 70 |
1 files changed, 32 insertions, 38 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 5c8e728e55f2..a32030b0fe23 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -447,6 +447,36 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes return xShape; } +Reference< XShape > SimpleShape::createPictureObject( const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect, OUString& rGraphicPath ) const +{ + Reference< XShape > xShape = mrDrawing.createAndInsertXShape( "com.sun.star.drawing.GraphicObjectShape", rxShapes, rShapeRect ); + if( xShape.is() ) + { + XmlFilterBase& rFilter = mrDrawing.getFilter(); + OUString aGraphicUrl = rFilter.getGraphicHelper().importEmbeddedGraphicObject( rGraphicPath ); + PropertySet aPropSet( xShape ); + if( !aGraphicUrl.isEmpty() ) + { + aPropSet.setProperty( PROP_GraphicURL, aGraphicUrl ); + } + // If the shape has an absolute position, set the properties accordingly. + if ( maTypeModel.maPosition == "absolute" ) + { + aPropSet.setProperty(PROP_HoriOrientPosition, rShapeRect.X); + aPropSet.setProperty(PROP_VertOrientPosition, rShapeRect.Y); + aPropSet.setProperty(PROP_Opaque, sal_False); + } + + lcl_SetAnchorType(aPropSet, maTypeModel); + + if ( maTypeModel.maPositionVerticalRelative == "page" ) + { + aPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_FRAME); + } + } + return xShape; +} + // ============================================================================ RectangleShape::RectangleShape( Drawing& rDrawing ) : @@ -456,21 +486,11 @@ RectangleShape::RectangleShape( Drawing& rDrawing ) : Reference<XShape> RectangleShape::implConvertAndInsert(const Reference<XShapes>& rxShapes, const Rectangle& rShapeRect) const { - XmlFilterBase& rFilter = mrDrawing.getFilter(); OUString aGraphicPath = getGraphicPath(); // try to create a picture object if(!aGraphicPath.isEmpty()) - { - Reference<XShape> xShape = mrDrawing.createAndInsertXShape("com.sun.star.drawing.GraphicObjectShape", rxShapes, rShapeRect); - if (xShape.is()) - { - OUString aGraphicUrl = rFilter.getGraphicHelper().importEmbeddedGraphicObject(aGraphicPath); - PropertySet aPropSet(xShape); - aPropSet.setProperty(PROP_GraphicURL, aGraphicUrl); - } - return xShape; - } + return SimpleShape::createPictureObject(rxShapes, rShapeRect, aGraphicPath); // default: try to create a rectangle shape return SimpleShape::implConvertAndInsert(rxShapes, rShapeRect); @@ -632,33 +652,7 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes // try to create a picture object if( !aGraphicPath.isEmpty() ) - { - Reference< XShape > xShape = mrDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.GraphicObjectShape" ), rxShapes, rShapeRect ); - if( xShape.is() ) - { - OUString aGraphicUrl = rFilter.getGraphicHelper().importEmbeddedGraphicObject( aGraphicPath ); - PropertySet aPropSet( xShape ); - if( !aGraphicUrl.isEmpty() ) - { - aPropSet.setProperty( PROP_GraphicURL, aGraphicUrl ); - } - // If the shape has an absolute position, set the properties accordingly. - if ( maTypeModel.maPosition == "absolute" ) - { - aPropSet.setProperty(PROP_HoriOrientPosition, rShapeRect.X); - aPropSet.setProperty(PROP_VertOrientPosition, rShapeRect.Y); - aPropSet.setProperty(PROP_Opaque, sal_False); - } - - lcl_SetAnchorType(aPropSet, maTypeModel); - - if ( maTypeModel.maPositionVerticalRelative == "page" ) - { - aPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_FRAME); - } - } - return xShape; - } + return SimpleShape::createPictureObject(rxShapes, rShapeRect, aGraphicPath); // default: try to create a custom shape return CustomShape::implConvertAndInsert( rxShapes, rShapeRect ); |