summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuthu Subramanian <sumuthu@collabora.com>2014-03-06 15:52:24 +0530
committerMuthu Subramanian <sumuthu@collabora.com>2014-03-06 16:00:47 +0530
commit2ec4d410de5bd98527336a9dc49abb76656373df (patch)
tree65f7a04cc7320b1d988a24b338e19ad60c4eb65c
parent291c3ae79c45bc470f8a903a2541b10e9784fac5 (diff)
n#821567: Import PPTX background images with table-name.
Seems like using the URL directly causes ODP export to ignore the background image. Probaby ODP Export requires updation as well?
-rw-r--r--include/oox/drawingml/shapepropertymap.hxx3
-rw-r--r--oox/source/drawingml/fillproperties.cxx4
-rw-r--r--oox/source/drawingml/shapepropertymap.cxx14
3 files changed, 20 insertions, 1 deletions
diff --git a/include/oox/drawingml/shapepropertymap.hxx b/include/oox/drawingml/shapepropertymap.hxx
index 29b0ba2979bf..f451cc0507e1 100644
--- a/include/oox/drawingml/shapepropertymap.hxx
+++ b/include/oox/drawingml/shapepropertymap.hxx
@@ -65,6 +65,7 @@ enum ShapePropertyId
SHAPEPROP_FillBitmapRectanglePoint,
SHAPEPROP_FillHatch,
SHAPEPROP_ShadowXDistance,
+ SHAPEPROP_FillBitmapNameFromUrl,
SHAPEPROP_END
};
@@ -129,6 +130,8 @@ private:
bool setGradientTrans( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
/** Sets an explicit fill bitmap URL, or creates a named fill bitmap URL. */
bool setFillBitmapUrl( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Sets an explicit fill bitmap URL and pushes the name to FillBitmapName */
+ bool setFillBitmapNameFromUrl( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
// not implemented, to prevent implicit conversion from enum to int
::com::sun::star::uno::Any& operator[]( ShapePropertyId ePropId );
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index c9ec7243ed82..4eedd35574fb 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -421,7 +421,9 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
OUString aGraphicUrl = rGraphicHelper.createGraphicObject( xGraphic );
// push bitmap or named bitmap to property map
- if( !aGraphicUrl.isEmpty() && rPropMap.setProperty( SHAPEPROP_FillBitmapUrl, aGraphicUrl ) )
+ if( !aGraphicUrl.isEmpty() && rPropMap.supportsProperty( SHAPEPROP_FillBitmapNameFromUrl ) && rPropMap.setProperty( SHAPEPROP_FillBitmapNameFromUrl, aGraphicUrl ) )
+ eFillStyle = FillStyle_BITMAP;
+ else if( !aGraphicUrl.isEmpty() && rPropMap.setProperty( SHAPEPROP_FillBitmapUrl, aGraphicUrl ) )
eFillStyle = FillStyle_BITMAP;
// set other bitmap properties, if bitmap has been inserted into the map
diff --git a/oox/source/drawingml/shapepropertymap.cxx b/oox/source/drawingml/shapepropertymap.cxx
index f14b653eb7f0..5a908750f6e1 100644
--- a/oox/source/drawingml/shapepropertymap.cxx
+++ b/oox/source/drawingml/shapepropertymap.cxx
@@ -48,6 +48,7 @@ static const sal_Int32 spnDefaultShapeIds[ SHAPEPROP_END + 1 ] = // one for the
PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint,
PROP_FillHatch,
PROP_ShadowXDistance,
+ PROP_FillBitmapName,
PROP_END_LIST
};
@@ -115,6 +116,9 @@ bool ShapePropertyMap::setAnyProperty( ShapePropertyId ePropId, const Any& rValu
case SHAPEPROP_FillBitmapUrl:
return setFillBitmapUrl( nPropId, rValue );
+ case SHAPEPROP_FillBitmapNameFromUrl:
+ return setFillBitmapNameFromUrl( nPropId, rValue );
+
default:; // suppress compiler warnings
}
@@ -202,6 +206,16 @@ bool ShapePropertyMap::setFillBitmapUrl( sal_Int32 nPropId, const Any& rValue )
return false;
}
+bool ShapePropertyMap::setFillBitmapNameFromUrl( sal_Int32 /*nPropId*/, const Any& rValue )
+{
+ if( rValue.has< OUString >() )
+ {
+ OUString aBitmapUrlName = mrModelObjHelper.insertFillBitmapUrl( rValue.get< OUString >() );
+ return !aBitmapUrlName.isEmpty() && setProperty( PROP_FillBitmapName, aBitmapUrlName );
+ }
+ return false;
+}
+
} // namespace drawingml