26#include <osl/diagnose.h>
34 using ::com::sun::star::uno::Any;
39 template <
class ITEMTYPE,
class UNOTYPE >
43 static bool trySet(
SfxItemSet& _rSet, sal_uInt16 _nItemId,
const Any& _rValue )
46 const ITEMTYPE* pTypedItem =
dynamic_cast< const ITEMTYPE*
>( &rItem );
50 UNOTYPE aValue( pTypedItem->GetValue() );
51 OSL_VERIFY( _rValue >>= aValue );
55 ITEMTYPE* pCloneItem =
dynamic_cast< ITEMTYPE*
>( pTypedItem->Clone() );
60 std::unique_ptr< ITEMTYPE > pClone( pCloneItem);
62 pClone->SetValue( aValue );
63 _rSet.
Put( std::move(pClone) );
67 static bool tryGet(
const SfxPoolItem& _rItem, Any& _out_rValue )
69 const ITEMTYPE* pTypedItem =
dynamic_cast< const ITEMTYPE*
>( &_rItem );
73 _out_rValue <<= UNOTYPE( pTypedItem->GetValue() );
85 if ( ItemAdapter< SfxBoolItem, bool >::tryGet( rItem, _out_rValue )
86 || ItemAdapter< SfxStringItem, OUString >::tryGet( rItem, _out_rValue )
90 OSL_FAIL(
"SetItemPropertyStorage::getPropertyValue: unsupported item type!" );
101 OSL_FAIL(
"SetItemPropertyStorage::setPropertyValue: unsupported item type!" );
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void getPropertyValue(css::uno::Any &_out_rValue) const
const sal_uInt16 m_nItemID
void setPropertyValue(const css::uno::Any &_rValue)