Kill sd::any2bool: cppu::bool2any does the same thing (extracts, or throws).

Change-Id: I477f2888fba585f41bb70309247a3e4fa9bf7517
This commit is contained in:
Jan Holesovsky
2014-05-09 17:32:25 +02:00
parent a45973a906
commit e47fef4b5e
2 changed files with 4 additions and 29 deletions

View File

@@ -19,23 +19,6 @@
namespace sd namespace sd
{ {
inline bool any2bool( const ::com::sun::star::uno::Any& rAny, bool& rBool )
{
if( rAny.getValueType() == ::getCppuBooleanType() )
{
rBool = *(sal_Bool*)rAny.getValue();
}
else
{
sal_Int32 nValue = 0;
if(!(rAny >>= nValue))
return false;
rBool = nValue != 0;
}
return true;
}
inline void bool2any( bool bBool, ::com::sun::star::uno::Any& rAny ) inline void bool2any( bool bBool, ::com::sun::star::uno::Any& rAny )
{ {
rAny.setValue( &bBool, ::getCppuBooleanType() ); rAny.setValue( &bBool, ::getCppuBooleanType() );

View File

@@ -22,6 +22,7 @@
#include "unolayer.hxx" #include "unolayer.hxx"
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <comphelper/extract.hxx>
#include <svx/svdpagv.hxx> #include <svx/svdpagv.hxx>
#include <svx/unoshape.hxx> #include <svx/unoshape.hxx>
#include <svx/svdobj.hxx> #include <svx/svdobj.hxx>
@@ -192,26 +193,17 @@ void SAL_CALL SdLayer::setPropertyValue( const OUString& aPropertyName, const un
{ {
case WID_LAYER_LOCKED: case WID_LAYER_LOCKED:
{ {
bool bValue = false; set(LOCKED, cppu::any2bool(aValue));
if(!sd::any2bool( aValue, bValue ))
throw lang::IllegalArgumentException();
set( LOCKED, bValue );
break; break;
} }
case WID_LAYER_PRINTABLE: case WID_LAYER_PRINTABLE:
{ {
bool bValue = false; set(PRINTABLE, cppu::any2bool(aValue));
if(!sd::any2bool( aValue, bValue ))
throw lang::IllegalArgumentException();
set( PRINTABLE, bValue );
break; break;
} }
case WID_LAYER_VISIBLE: case WID_LAYER_VISIBLE:
{ {
bool bValue = false; set(VISIBLE, cppu::any2bool(aValue));
if(!sd::any2bool( aValue, bValue ))
throw lang::IllegalArgumentException();
set( VISIBLE, bValue );
break; break;
} }
case WID_LAYER_NAME: case WID_LAYER_NAME: