diff options
Diffstat (limited to 'oox/source/drawingml')
-rw-r--r-- | oox/source/drawingml/fillproperties.cxx | 19 | ||||
-rw-r--r-- | oox/source/drawingml/shapepropertymap.cxx | 11 |
2 files changed, 22 insertions, 8 deletions
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index d2d2775a3e3d..acb0b25e7526 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/awt/Gradient.hpp> #include <com/sun/star/text/GraphicCrop.hpp> #include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/awt/XBitmap.hpp> #include <com/sun/star/drawing/BitmapMode.hpp> #include <com/sun/star/drawing/ColorMode.hpp> #include <com/sun/star/drawing/FillStyle.hpp> @@ -600,14 +601,24 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, if( maBlipProps.mxGraphic.is() && rPropMap.supportsProperty( ShapeProperty::FillBitmapUrl ) ) { Reference< XGraphic > xGraphic = lclCheckAndApplyDuotoneTransform( maBlipProps, maBlipProps.mxGraphic, rGraphicHelper, nPhClr ); + uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY); // TODO: "rotate with shape" is not possible with our current core OUString aGraphicUrl = rGraphicHelper.createGraphicObject( xGraphic ); // push bitmap or named bitmap to property map - if( !aGraphicUrl.isEmpty() && rPropMap.supportsProperty( ShapeProperty::FillBitmapNameFromUrl ) && rPropMap.setProperty( ShapeProperty::FillBitmapNameFromUrl, aGraphicUrl ) ) - eFillStyle = FillStyle_BITMAP; - else if( !aGraphicUrl.isEmpty() && rPropMap.setProperty( ShapeProperty::FillBitmapUrl, aGraphicUrl ) ) - eFillStyle = FillStyle_BITMAP; + + if (!aGraphicUrl.isEmpty()) + { + if (rPropMap.supportsProperty(ShapeProperty::FillBitmapNameFromUrl) && + rPropMap.setProperty(ShapeProperty::FillBitmapNameFromUrl, xGraphic)) + { + eFillStyle = FillStyle_BITMAP; + } + else if (rPropMap.setProperty(ShapeProperty::FillBitmapUrl, aGraphicUrl)) + { + eFillStyle = FillStyle_BITMAP; + } + } // set other bitmap properties, if bitmap has been inserted into the map if( eFillStyle == FillStyle_BITMAP ) diff --git a/oox/source/drawingml/shapepropertymap.cxx b/oox/source/drawingml/shapepropertymap.cxx index b1cf0239237e..53226434dfb1 100644 --- a/oox/source/drawingml/shapepropertymap.cxx +++ b/oox/source/drawingml/shapepropertymap.cxx @@ -23,6 +23,8 @@ #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/drawing/LineDash.hpp> #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> + #include <oox/helper/modelobjecthelper.hxx> #include <oox/token/properties.hxx> @@ -194,12 +196,13 @@ bool ShapePropertyMap::setFillBitmapUrl( sal_Int32 nPropId, const Any& rValue ) return false; } -bool ShapePropertyMap::setFillBitmapNameFromUrl( const Any& rValue ) +bool ShapePropertyMap::setFillBitmapNameFromUrl(const Any& rValue) { - if( rValue.has< OUString >() ) + if (rValue.has<uno::Reference<graphic::XGraphic>>()) { - OUString aBitmapUrlName = mrModelObjHelper.insertFillBitmapUrl( rValue.get< OUString >() ); - return !aBitmapUrlName.isEmpty() && setProperty( PROP_FillBitmapName, aBitmapUrlName ); + auto xGraphic = rValue.get<uno::Reference<graphic::XGraphic>>(); + OUString aBitmapUrlName = mrModelObjHelper.insertFillBitmapXGraphic(xGraphic); + return !aBitmapUrlName.isEmpty() && setProperty(PROP_FillBitmapName, aBitmapUrlName); } return false; } |