Kaydet (Commit) 6cf43679 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

More comphelper/extract.hxx clean up

Change-Id: I36c1ebea58bcd32b65a48d3447c106aeecdac230
üst 59dbfece
...@@ -53,11 +53,11 @@ inline css::uno::Any SAL_CALL int2enum( ...@@ -53,11 +53,11 @@ inline css::uno::Any SAL_CALL int2enum(
* @param rAny enum or int * @param rAny enum or int
* @param sal_True if enum or int value was set else sal_False. * @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) if (rAny.getValueTypeClass() == css::uno::TypeClass_ENUM)
{ {
rnEnum = * static_cast< const int * >( rAny.getValue() ); rnEnum = * static_cast< const sal_Int32 * >( rAny.getValue() );
return true; return true;
} }
...@@ -72,7 +72,7 @@ inline bool SAL_CALL enum2int( sal_Int32 & rnEnum, const css::uno::Any & rAny ) ...@@ -72,7 +72,7 @@ inline bool SAL_CALL enum2int( sal_Int32 & rnEnum, const css::uno::Any & rAny )
* a css::lang::IllegalArgumentException is thrown * a css::lang::IllegalArgumentException is thrown
*/ */
template< typename E > 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 ) throw( css::lang::IllegalArgumentException )
{ {
// check for typesafe enum // check for typesafe enum
...@@ -88,29 +88,18 @@ inline void SAL_CALL any2enum( E & eRet, const css::uno::Any & rAny ) ...@@ -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 * extracts a boolean either as a bool or an integer from
* * an any. If there is no bool or integer inside the any
* @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
* a css::lang::IllegalArgumentException is thrown * 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 ) 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 else
{ {
......
...@@ -765,7 +765,7 @@ css::uno::Any SAL_CALL SdXShape::getPropertyValue( const OUString& PropertyName ...@@ -765,7 +765,7 @@ css::uno::Any SAL_CALL SdXShape::getPropertyValue( const OUString& PropertyName
break; break;
} }
case WID_CLICKACTION: case WID_CLICKACTION:
aRet = ::cppu::enum2any< presentation::ClickAction >( pInfo?pInfo->meClickAction:presentation::ClickAction_NONE ); aRet <<= ( pInfo?pInfo->meClickAction:presentation::ClickAction_NONE );
break; break;
case WID_PLAYFULL: case WID_PLAYFULL:
aRet <<= ( pInfo && pInfo->mbPlayFull ); aRet <<= ( pInfo && pInfo->mbPlayFull );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment