summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuthu Subramanian <sumuthu@collabora.com>2014-03-07 13:30:43 +0530
committerAndras Timar <andras.timar@collabora.com>2014-04-03 05:28:36 -0700
commit610277bb162227a4481e007323b0e430dfb448fb (patch)
tree73f2e3fcc3900df4bc9e1829ba3e8b6d3db695ee
parent5e6fc9b1ffa55f8d1d1db38caeb411d15f168b2d (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