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 | |
parent | 32b9901dae7403453d773f5904de15551a323595 (diff) |
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')
-rw-r--r-- | include/editeng/editeng.hxx | 7 | ||||
-rw-r--r-- | include/editeng/outliner.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/objsh.hxx | 9 | ||||
-rwxr-xr-x[-rw-r--r--] | include/sfx2/request.hxx | 18 | ||||
-rw-r--r-- | include/sfx2/viewsh.hxx | 11 | ||||
-rw-r--r-- | include/tools/pstm.hxx | 2 |
6 files changed, 34 insertions, 15 deletions
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index d9aee4bd5af6..a35a3424309d 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -39,6 +39,7 @@ #include <editeng/eedata.hxx> #include <o3tl/typed_flags_set.hxx> #include <svl/languageoptions.hxx> +#include <functional> namespace com { namespace sun { namespace star { namespace linguistic2 { @@ -136,6 +137,10 @@ namespace o3tl { template<> struct typed_flags<GetAttribsFlags> : is_typed_flags<GetAttribsFlags, 0x07> {}; } +template<class T> bool checkSvxFieldData(const SvxFieldData* pData) +{ + return dynamic_cast<const T*>(pData) != nullptr; +} class SdrObject; class EDITENG_DLLPUBLIC EditEngine @@ -452,7 +457,7 @@ public: bool UpdateFields(); bool UpdateFieldsOnly(); - void RemoveFields( bool bKeepFieldText, TypeId aType = NULL ); + void RemoveFields( bool bKeepFieldText, std::function<bool ( const SvxFieldData* )> isFieldData = [] (const SvxFieldData* ){return true;} ); sal_uInt16 GetFieldCount( sal_Int32 nPara ) const; EFieldInfo GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const; diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 77ae2e0dd41d..69ccb523fbe0 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -908,7 +908,7 @@ public: void QuickFormatDoc( bool bFull = false ); bool UpdateFields(); - void RemoveFields( bool bKeepFieldText, TypeId aType = NULL ); + void RemoveFields( bool bKeepFieldText, std::function<bool ( const SvxFieldData* )> isFieldData = [] (const SvxFieldData* ){return true;} ); void FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos ); virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rTxtColor, Color*& rFldColor ); diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index bf88c0fa6e99..f30c068ca780 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -52,6 +52,7 @@ #include <memory> #include <set> #include <o3tl/typed_flags_set.hxx> +#include <functional> #define LOK_USE_UNSTABLE_API #include <LibreOfficeKit/LibreOfficeKitTypes.h> @@ -193,6 +194,10 @@ enum class SfxObjectCreateMode class SfxToolBoxConfig; struct TransferableObjectDescriptor; +template<class T> bool checkSfxObjectShell(const SfxObjectShell* pShell) +{ + return dynamic_cast<const T*>(pShell) != nullptr; +} class SFX2_DLLPUBLIC SfxObjectShell : public SfxShell, virtual public SotObject, @@ -255,10 +260,10 @@ public: static OUString CreateShellID( const SfxObjectShell* pShell ); // Document-Shell Iterator - static SfxObjectShell* GetFirst( const TypeId* pType = 0, + static SfxObjectShell* GetFirst( std::function<bool ( const SfxObjectShell* )> isObjectShell = nullptr, bool bOnlyVisible = true ); static SfxObjectShell* GetNext( const SfxObjectShell& rPrev, - const TypeId* pType = 0, + std::function<bool ( const SfxObjectShell* )> isObjectShell = nullptr, bool bOnlyVisible = true ); static SfxObjectShell* Current(); static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > 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 diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index ca5090f4cce2..1928989aec85 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -41,6 +41,7 @@ #include <sfx2/tabdlg.hxx> #define LOK_USE_UNSTABLE_API #include <LibreOfficeKit/LibreOfficeKitTypes.h> +#include <functional> class SfxBaseController; class Size; @@ -137,6 +138,11 @@ public: \ #define SFX_VIEW_REGISTRATION(DocClass) \ DocClass::Factory().RegisterViewFactory( *Factory() ) +template<class T> bool checkSfxViewShell(const SfxViewShell* pShell) +{ + return dynamic_cast<const T*>(pShell) != nullptr; +} + class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener { #ifdef INCLUDED_SFX2_VIEWSH_HXX @@ -166,9 +172,10 @@ protected: public: // Iteration - static SfxViewShell* GetFirst( const TypeId* pType = 0, bool bOnlyVisible = true ); + static SfxViewShell* GetFirst( bool bOnlyVisible = true, std::function<bool ( const SfxViewShell* )> isViewShell = nullptr ); static SfxViewShell* GetNext( const SfxViewShell& rPrev, - const TypeId* pType = 0, bool bOnlyVisible = true ); + bool bOnlyVisible = true, + std::function<bool ( const SfxViewShell* )> isViewShell = nullptr ); static SfxViewShell* Current(); static SfxViewShell* Get( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController>& i_rController ); diff --git a/include/tools/pstm.hxx b/include/tools/pstm.hxx index 9d22c4234c39..577c301d0c8c 100644 --- a/include/tools/pstm.hxx +++ b/include/tools/pstm.hxx @@ -75,7 +75,7 @@ public: { \ SvPersistBase * pObj; \ rStm >> pObj; \ - rpObj = PTR_CAST( Class, pObj ); \ + rpObj = dynamic_cast< Class*>( pObj ); \ return rStm; \ } |