summaryrefslogtreecommitdiff
path: root/oox/source/helper
diff options
context:
space:
mode:
authorDaniel Rentz [dr] <daniel.rentz@oracle.com>2011-01-11 13:26:59 +0100
committerDaniel Rentz [dr] <daniel.rentz@oracle.com>2011-01-11 13:26:59 +0100
commitd4c7fa84b7856918328bee20a5387cb32442bec3 (patch)
tree1907f51856829aa9f40bdd94f02a89fe2fc9f036 /oox/source/helper
parentf9a2b2913692fa1d65200f53c90e77b0bd134445 (diff)
dr78: oox - encapsulate shape property handling in own class ShapePropertyMap
Diffstat (limited to 'oox/source/helper')
-rw-r--r--oox/source/helper/modelobjecthelper.cxx18
-rw-r--r--oox/source/helper/propertymap.cxx4
-rw-r--r--oox/source/helper/propertyset.cxx49
3 files changed, 26 insertions, 45 deletions
diff --git a/oox/source/helper/modelobjecthelper.cxx b/oox/source/helper/modelobjecthelper.cxx
index 6528fea5634d..21dbe9c3a2eb 100644
--- a/oox/source/helper/modelobjecthelper.cxx
+++ b/oox/source/helper/modelobjecthelper.cxx
@@ -45,13 +45,13 @@ namespace oox {
// ============================================================================
ModelObjectHelper::ModelObjectHelper( const Reference< XMultiServiceFactory >& rxModelFactory ) :
- maMarkerContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.MarkerTable" ) ),
- maDashContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.DashTable" ) ),
- maGradientContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.GradientTable" ) ),
- maBitmapContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.BitmapTable" ) ),
- maDashNameBase( CREATE_OUSTRING( "msLineDash " ) ),
- maGradientNameBase( CREATE_OUSTRING( "msFillGradient " ) ),
- maBitmapNameBase( CREATE_OUSTRING( "msFillBitmap " ) )
+ maMarkerContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.MarkerTable" ) ),
+ maDashContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.DashTable" ) ),
+ maGradientContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.GradientTable" ) ),
+ maBitmapUrlContainer( rxModelFactory, CREATE_OUSTRING( "com.sun.star.drawing.BitmapTable" ) ),
+ maDashNameBase( CREATE_OUSTRING( "msLineDash " ) ),
+ maGradientNameBase( CREATE_OUSTRING( "msFillGradient " ) ),
+ maBitmapUrlNameBase( CREATE_OUSTRING( "msFillBitmap " ) )
{
}
@@ -78,10 +78,10 @@ OUString ModelObjectHelper::insertFillGradient( const Gradient& rGradient )
return maGradientContainer.insertObject( maGradientNameBase, Any( rGradient ), true );
}
-OUString ModelObjectHelper::insertFillBitmap( const OUString& rGraphicUrl )
+OUString ModelObjectHelper::insertFillBitmapUrl( const OUString& rGraphicUrl )
{
if( rGraphicUrl.getLength() > 0 )
- return maBitmapContainer.insertObject( maBitmapNameBase, Any( rGraphicUrl ), true );
+ return maBitmapUrlContainer.insertObject( maBitmapUrlNameBase, Any( rGraphicUrl ), true );
return OUString();
}
diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx
index 31072fe449e5..155b2015dffa 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -186,10 +186,6 @@ PropertyMap::PropertyMap() :
{
}
-PropertyMap::~PropertyMap()
-{
-}
-
/*static*/ const OUString& PropertyMap::getPropertyName( sal_Int32 nPropId )
{
OSL_ENSURE( (0 <= nPropId) && (nPropId < PROP_COUNT), "PropertyMap::getPropertyName - invalid property identifier" );
diff --git a/oox/source/helper/propertyset.cxx b/oox/source/helper/propertyset.cxx
index e7071ba402a2..a46c189f9a2b 100644
--- a/oox/source/helper/propertyset.cxx
+++ b/oox/source/helper/propertyset.cxx
@@ -52,22 +52,10 @@ void PropertySet::set( const Reference< XPropertySet >& rxPropSet )
// Get properties -------------------------------------------------------------
-bool PropertySet::getAnyProperty( Any& orValue, sal_Int32 nPropId ) const
-{
- return getAnyProperty( orValue, PropertyMap::getPropertyName( nPropId ) );
-}
-
Any PropertySet::getAnyProperty( sal_Int32 nPropId ) const
{
Any aValue;
- return getAnyProperty( aValue, nPropId ) ? aValue : Any();
-}
-
-bool PropertySet::getBoolProperty( sal_Int32 nPropId ) const
-{
- Any aAny;
- bool bValue = false;
- return getAnyProperty( aAny, nPropId ) && (aAny >>= bValue) && bValue;
+ return implGetPropertyValue( aValue, PropertyMap::getPropertyName( nPropId ) ) ? aValue : Any();
}
void PropertySet::getProperties( Sequence< Any >& orValues, const Sequence< OUString >& rPropNames ) const
@@ -90,15 +78,15 @@ void PropertySet::getProperties( Sequence< Any >& orValues, const Sequence< OUSt
orValues.realloc( nLen );
Any* pValue = orValues.getArray();
for( ; pPropName != pPropNameEnd; ++pPropName, ++pValue )
- getAnyProperty( *pValue, *pPropName );
+ implGetPropertyValue( *pValue, *pPropName );
}
}
// Set properties -------------------------------------------------------------
-void PropertySet::setAnyProperty( sal_Int32 nPropId, const Any& rValue )
+bool PropertySet::setAnyProperty( sal_Int32 nPropId, const Any& rValue )
{
- setAnyProperty( PropertyMap::getPropertyName( nPropId ), rValue );
+ return implSetPropertyValue( PropertyMap::getPropertyName( nPropId ), rValue );
}
void PropertySet::setProperties( const Sequence< OUString >& rPropNames, const Sequence< Any >& rValues )
@@ -122,7 +110,7 @@ void PropertySet::setProperties( const Sequence< OUString >& rPropNames, const S
const OUString* pPropNameEnd = pPropName + rPropNames.getLength();
const Any* pValue = rValues.getConstArray();
for( ; pPropName != pPropNameEnd; ++pPropName, ++pValue )
- setAnyProperty( *pPropName, *pValue );
+ implSetPropertyValue( *pPropName, *pValue );
}
}
@@ -139,37 +127,34 @@ void PropertySet::setProperties( const PropertyMap& rPropertyMap )
// private --------------------------------------------------------------------
-bool PropertySet::getAnyProperty( Any& orValue, const OUString& rPropName ) const
+bool PropertySet::implGetPropertyValue( Any& orValue, const OUString& rPropName ) const
{
- bool bHasValue = false;
- try
+ if( mxPropSet.is() ) try
{
- if( mxPropSet.is() )
- {
- orValue = mxPropSet->getPropertyValue( rPropName );
- bHasValue = true;
- }
+ orValue = mxPropSet->getPropertyValue( rPropName );
+ return true;
}
catch( Exception& )
{
- OSL_ENSURE( false, OStringBuffer( "PropertySet::getAnyProperty - cannot get property \"" ).
+ OSL_ENSURE( false, OStringBuffer( "PropertySet::implGetPropertyValue - cannot get property \"" ).
append( OUStringToOString( rPropName, RTL_TEXTENCODING_ASCII_US ) ).append( '"' ).getStr() );
}
- return bHasValue;
+ return false;
}
-void PropertySet::setAnyProperty( const OUString& rPropName, const Any& rValue )
+bool PropertySet::implSetPropertyValue( const OUString& rPropName, const Any& rValue )
{
- try
+ if( mxPropSet.is() ) try
{
- if( mxPropSet.is() )
- mxPropSet->setPropertyValue( rPropName, rValue );
+ mxPropSet->setPropertyValue( rPropName, rValue );
+ return true;
}
catch( Exception& )
{
- OSL_ENSURE( false, OStringBuffer( "PropertySet::setAnyProperty - cannot set property \"" ).
+ OSL_ENSURE( false, OStringBuffer( "PropertySet::implSetPropertyValue - cannot set property \"" ).
append( OUStringToOString( rPropName, RTL_TEXTENCODING_ASCII_US ) ).append( '"' ).getStr() );
}
+ return false;
}
#if OSL_DEBUG_LEVEL > 0