[Libreoffice-commits] core.git: sd/source

Jan Holesovsky kendy at collabora.com
Fri May 9 08:55:37 PDT 2014


 sd/source/ui/unoidl/unohelp.hxx  |   17 -----------------
 sd/source/ui/unoidl/unolayer.cxx |   16 ++++------------
 2 files changed, 4 insertions(+), 29 deletions(-)

New commits:
commit e47fef4b5e46f35d18e36223b21403d624a951d3
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri May 9 17:32:25 2014 +0200

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

diff --git a/sd/source/ui/unoidl/unohelp.hxx b/sd/source/ui/unoidl/unohelp.hxx
index 5afa24d..130fd0f 100644
--- a/sd/source/ui/unoidl/unohelp.hxx
+++ b/sd/source/ui/unoidl/unohelp.hxx
@@ -19,23 +19,6 @@
 
 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 )
 {
     rAny.setValue( &bBool, ::getCppuBooleanType() );
diff --git a/sd/source/ui/unoidl/unolayer.cxx b/sd/source/ui/unoidl/unolayer.cxx
index 118ec3f..f674bf0 100644
--- a/sd/source/ui/unoidl/unolayer.cxx
+++ b/sd/source/ui/unoidl/unolayer.cxx
@@ -22,6 +22,7 @@
 #include "unolayer.hxx"
 #include <osl/mutex.hxx>
 
+#include <comphelper/extract.hxx>
 #include <svx/svdpagv.hxx>
 #include <svx/unoshape.hxx>
 #include <svx/svdobj.hxx>
@@ -192,26 +193,17 @@ void SAL_CALL SdLayer::setPropertyValue( const OUString& aPropertyName, const un
     {
     case WID_LAYER_LOCKED:
     {
-        bool bValue = false;
-        if(!sd::any2bool( aValue, bValue ))
-            throw lang::IllegalArgumentException();
-        set( LOCKED, bValue );
+        set(LOCKED, cppu::any2bool(aValue));
         break;
     }
     case WID_LAYER_PRINTABLE:
     {
-        bool bValue = false;
-        if(!sd::any2bool( aValue, bValue ))
-            throw lang::IllegalArgumentException();
-        set( PRINTABLE, bValue );
+        set(PRINTABLE, cppu::any2bool(aValue));
         break;
     }
     case WID_LAYER_VISIBLE:
     {
-        bool bValue = false;
-        if(!sd::any2bool( aValue, bValue ))
-            throw lang::IllegalArgumentException();
-        set( VISIBLE, bValue );
+        set(VISIBLE, cppu::any2bool(aValue));
         break;
     }
     case WID_LAYER_NAME:


More information about the Libreoffice-commits mailing list