From 1ed454c71db35d10287fb00a9ed23d4e184e704f Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Tue, 9 Sep 2014 22:16:31 +0200 Subject: Make GetProperty more clear Change-Id: I23ba7950364fa402f1337e8557c3cf8cd9c810cc --- oox/source/export/drawingml.cxx | 47 +++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index caf6d0402df9..02bfedd59d90 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -118,32 +118,37 @@ void DrawingML::ResetCounters() maWdpCache.clear(); } -bool DrawingML::GetProperty( Reference< XPropertySet > rXPropSet, const OUString& aName ) +bool DrawingML::GetProperty( Reference< XPropertySet > rXPropertySet, const OUString& aName ) { - bool bRetValue = false; - - try { - mAny = rXPropSet->getPropertyValue( aName ); - if ( mAny.hasValue() ) - bRetValue = true; - } catch( const Exception& ) { /* printf ("exception when trying to get value of property: %s\n", USS(aName)); */ } - - return bRetValue; + try + { + mAny = rXPropertySet->getPropertyValue(aName); + if (mAny.hasValue()) + return true; + } + catch( const Exception& ) + { + /* printf ("exception when trying to get value of property: %s\n", USS(aName)); */ + } + return false; } -bool DrawingML::GetPropertyAndState( Reference< XPropertySet > rXPropSet, Reference< XPropertyState > rXPropState, const OUString& aName, PropertyState& eState ) +bool DrawingML::GetPropertyAndState( Reference< XPropertySet > rXPropertySet, Reference< XPropertyState > rXPropertyState, const OUString& aName, PropertyState& eState ) { - bool bRetValue = false; - - try { - mAny = rXPropSet->getPropertyValue( aName ); - if ( mAny.hasValue() ) { - bRetValue = true; - eState = rXPropState->getPropertyState( aName ); + try + { + mAny = rXPropertySet->getPropertyValue(aName); + if (mAny.hasValue()) + { + eState = rXPropertyState->getPropertyState(aName); + return true; } - } catch( const Exception& ) { /* printf ("exception when trying to get value of property: %s\n", USS(aName)); */ } - - return bRetValue; + } + catch( const Exception& ) + { + /* printf ("exception when trying to get value of property: %s\n", USS(aName)); */ + } + return false; } void DrawingML::WriteColor( sal_uInt32 nColor, sal_Int32 nAlpha ) -- cgit