diff options
author | Oliver Specht <oliver.specht@cib.de> | 2015-09-30 16:10:07 +0200 |
---|---|---|
committer | Oliver Specht <oliver.specht@cib.de> | 2015-10-06 07:29:37 +0000 |
commit | 89d39bc100aabf5dccbe77c0b5c0c85736e85b39 (patch) | |
tree | 871a91210913ecee91530c95392534bf18f80f3f /include/sfx2/request.hxx | |
parent | need <numeric> for std::accumulate (diff) | |
download | core-89d39bc100aabf5dccbe77c0b5c0c85736e85b39.tar.gz core-89d39bc100aabf5dccbe77c0b5c0c85736e85b39.zip |
tdf#94559: 4th step to remove rtti.hxx
replaced use of PTR_CAST, IS_TYPE, ISA in
idl, editeng, sc, sd, sw, sfx2, sot, starmath
Change-Id: I4a5bba4fdc4829099618c09b690c83f876a3d653
Reviewed-on: https://gerrit.libreoffice.org/19132
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Oliver Specht <oliver.specht@cib.de>
Diffstat (limited to 'include/sfx2/request.hxx')
-rwxr-xr-x[-rw-r--r--] | include/sfx2/request.hxx | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/include/sfx2/request.hxx b/include/sfx2/request.hxx index 5aafc55e357f..c796d0cd66dc 100644..100755 --- a/include/sfx2/request.hxx +++ b/include/sfx2/request.hxx @@ -24,6 +24,7 @@ #include <sal/types.h> #include <svl/itemset.hxx> #include <svl/hint.hxx> +#include <functional> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/PropertyValue.hpp> @@ -39,8 +40,6 @@ class SfxViewFrame; struct SfxRequest_Impl; enum class SfxCallMode : sal_uInt16; - - class SFX2_DLLPUBLIC SfxRequest: public SfxHint { friend struct SfxRequest_Impl; @@ -49,7 +48,6 @@ friend struct SfxRequest_Impl; SfxAllItemSet* pArgs; SfxRequest_Impl* pImp; - public: SAL_DLLPRIVATE void Record_Impl( SfxShell &rSh, const SfxSlot &rSlot, com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder, @@ -82,8 +80,9 @@ public: static const SfxPoolItem* GetItem( const SfxItemSet*, sal_uInt16 nSlotId, bool bDeep = false, - TypeId aType = 0 ); - const SfxPoolItem* GetArg( sal_uInt16 nSlotId, bool bDeep = false, TypeId aType = 0 ) const; + std::function<bool ( const SfxPoolItem* )> isItemType = nullptr ); + const SfxPoolItem* GetArg( sal_uInt16 nSlotId, bool bDeep = false, std::function<bool ( const SfxPoolItem* )> isItemType = nullptr ) const; + void ReleaseArgs(); void SetReturnValue(const SfxPoolItem &); const SfxPoolItem* GetReturnValue() const; @@ -111,14 +110,17 @@ private: const SfxRequest& operator=(const SfxRequest &) SAL_DELETED_FUNCTION; }; - +template<class T> bool checkSfxPoolItem(const SfxPoolItem* pItem) +{ + return dynamic_cast<const T*>(pItem) != nullptr; +} #define SFX_REQUEST_ARG(rReq, pItem, ItemType, nSlotId, bDeep) \ const ItemType *pItem = static_cast<const ItemType*>( \ - rReq.GetArg( nSlotId, bDeep, TYPE(ItemType) ) ) + rReq.GetArg( nSlotId, bDeep, checkSfxPoolItem<ItemType> ) ) #define SFX_ITEMSET_ARG(pArgs, pItem, ItemType, nSlotId, bDeep) \ const ItemType *pItem = static_cast<const ItemType*>( \ - SfxRequest::GetItem( pArgs, nSlotId, bDeep, TYPE(ItemType) ) ) + SfxRequest::GetItem( pArgs, nSlotId, bDeep, checkSfxPoolItem<ItemType> ) ) #endif |