summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/oox/vml/vmlshape.hxx4
-rw-r--r--oox/source/vml/vmlshape.cxx70
2 files changed, 36 insertions, 38 deletions
diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx
index 728ca15e83b0..8fab5f7ec92d 100644
--- a/oox/inc/oox/vml/vmlshape.hxx
+++ b/oox/inc/oox/vml/vmlshape.hxx
@@ -272,6 +272,10 @@ protected:
implConvertAndInsert(
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+ /** Used by both RectangleShape and ComplexShape. */
+ com::sun::star::uno::Reference<com::sun::star::drawing::XShape>createPictureObject(
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rxShapes,
+ const com::sun::star::awt::Rectangle& rShapeRect, OUString& rGraphicPath ) const;
private:
::rtl::OUString maService; ///< Name of the UNO shape service.
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 );