include/comphelper/extract.hxx | 29 +++++++++-------------------- sd/source/ui/unoidl/unoobj.cxx | 2 +- 2 files changed, 10 insertions(+), 21 deletions(-)
New commits: commit 6cf436799cb145c61f8324c074541950ee1a23e8 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue May 31 08:47:05 2016 +0200 More comphelper/extract.hxx clean up Change-Id: I36c1ebea58bcd32b65a48d3447c106aeecdac230 diff --git a/include/comphelper/extract.hxx b/include/comphelper/extract.hxx index 2b5ae0a..36597f8 100644 --- a/include/comphelper/extract.hxx +++ b/include/comphelper/extract.hxx @@ -53,11 +53,11 @@ inline css::uno::Any SAL_CALL int2enum( * @param rAny enum or int * @param sal_True if enum or int value was set else sal_False. */ -inline bool SAL_CALL enum2int( sal_Int32 & rnEnum, const css::uno::Any & rAny ) +inline bool enum2int( sal_Int32 & rnEnum, const css::uno::Any & rAny ) { if (rAny.getValueTypeClass() == css::uno::TypeClass_ENUM) { - rnEnum = * static_cast< const int * >( rAny.getValue() ); + rnEnum = * static_cast< const sal_Int32 * >( rAny.getValue() ); return true; } @@ -72,7 +72,7 @@ inline bool SAL_CALL enum2int( sal_Int32 & rnEnum, const css::uno::Any & rAny ) * a css::lang::IllegalArgumentException is thrown */ template< typename E > -inline void SAL_CALL any2enum( E & eRet, const css::uno::Any & rAny ) +inline void any2enum( E & eRet, const css::uno::Any & rAny ) throw( css::lang::IllegalArgumentException ) { // check for typesafe enum @@ -88,29 +88,18 @@ inline void SAL_CALL any2enum( E & eRet, const css::uno::Any & rAny ) } /** - * Template function to create an uno::Any from an enum - * - * @DEPRECATED : use makeAny< E >() - * - */ -template< typename E > -inline css::uno::Any SAL_CALL enum2any( E eEnum ) -{ - return css::uno::Any( &eEnum, ::cppu::UnoType< E >::get() ); -} - -/** - * extracts a boolean either as a sal_Bool or an integer from - * an any. If there is no sal_Bool or integer inside the any + * extracts a boolean either as a bool or an integer from + * an any. If there is no bool or integer inside the any * a css::lang::IllegalArgumentException is thrown * */ -inline bool SAL_CALL any2bool( const css::uno::Any & rAny ) +inline bool any2bool( const css::uno::Any & rAny ) throw( css::lang::IllegalArgumentException ) { - if (rAny.getValueTypeClass() == css::uno::TypeClass_BOOLEAN) + bool b; + if (rAny >>= b) { - return *static_cast<sal_Bool const *>(rAny.getValue()); + return b; } else { diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index 21657ec..4051fa4 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -765,7 +765,7 @@ css::uno::Any SAL_CALL SdXShape::getPropertyValue( const OUString& PropertyName break; } case WID_CLICKACTION: - aRet = ::cppu::enum2any< presentation::ClickAction >( pInfo?pInfo->meClickAction:presentation::ClickAction_NONE ); + aRet <<= ( pInfo?pInfo->meClickAction:presentation::ClickAction_NONE ); break; case WID_PLAYFULL: aRet <<= ( pInfo && pInfo->mbPlayFull ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits