summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuthu Subramanian <sumuthu@collabora.com>2014-03-07 13:30:43 +0530
committerMuthu Subramanian <sumuthu@collabora.com>2014-03-07 13:30:43 +0530
commitfe69621b0005a3399c278971806940a09958848a (patch)
tree6c6d57355580401bd9d3a2ba24147fc068f0f72e
parent404689ba178d4282b5b685dced393fdd3f0e3ff8 (diff)
n#821567: Import PPTX background images with table-name.
-rw-r--r--oox/inc/oox/drawingml/shapepropertymap.hxx3
-rw-r--r--oox/source/drawingml/fillproperties.cxx4
-rw-r--r--oox/source/drawingml/shapepropertymap.cxx16
3 files changed, 21 insertions, 2 deletions
diff --git a/oox/inc/oox/drawingml/shapepropertymap.hxx b/oox/inc/oox/drawingml/shapepropertymap.hxx
index 00f8c4da44e1..8b5e4d7cf5b5 100644
--- a/oox/inc/oox/drawingml/shapepropertymap.hxx
+++ b/oox/inc/oox/drawingml/shapepropertymap.hxx
@@ -63,6 +63,7 @@ enum ShapePropertyId
SHAPEPROP_FillBitmapRectanglePoint,
SHAPEPROP_FillHatch,
SHAPEPROP_ShadowXDistance,
+ SHAPEPROP_FillBitmapNameFromUrl,
SHAPEPROP_END
};
@@ -128,6 +129,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 c4f58a884acc..50519325be65 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -393,7 +393,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 c945a538a890..eb8a5b4b44fe 100644
--- a/oox/source/drawingml/shapepropertymap.cxx
+++ b/oox/source/drawingml/shapepropertymap.cxx
@@ -49,7 +49,8 @@ static const sal_Int32 spnDefaultShapeIds[ SHAPEPROP_END ] =
PROP_FillBitmapURL, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY,
PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint,
PROP_FillHatch,
- PROP_ShadowXDistance
+ PROP_ShadowXDistance,
+ PROP_FillBitmapName
};
} // namespace
@@ -110,6 +111,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
}
@@ -197,6 +201,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