diff options
author | Noel Grandin <noel@peralex.com> | 2014-10-11 16:01:26 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-10-11 15:14:52 +0000 |
commit | 8044acf2db9d125d5ed58ed25df5df4a90f37ac6 (patch) | |
tree | 67af1fff3f9bc0d144b80d5ecbe5a078cd08dbd3 /include | |
parent | cb7ede2d9970a4d162dc71922f578922c0d6235a (diff) |
convert SFX_CALLMODE constants to SfxCallMode enum class
and fix a couple of bugs in SC and SW where the call mode was
being passed to the hints parameter by accident
Change-Id: Ief805410b3f7035e012e229e77f92d5832430f58
Reviewed-on: https://gerrit.libreoffice.org/11916
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/sfx2/bindings.hxx | 42 | ||||
-rw-r--r-- | include/sfx2/dispatch.hxx | 4 | ||||
-rw-r--r-- | include/sfx2/request.hxx | 11 | ||||
-rw-r--r-- | include/vbahelper/vbahelper.hxx | 2 |
4 files changed, 42 insertions, 17 deletions
diff --git a/include/sfx2/bindings.hxx b/include/sfx2/bindings.hxx index 0bccd70bb78b..2fbe66d23369 100644 --- a/include/sfx2/bindings.hxx +++ b/include/sfx2/bindings.hxx @@ -56,15 +56,39 @@ class SfxUnoControllerItem; typedef std::vector<SfxUnoControllerItem*> SfxUnoControllerArr_Impl; -#define SFX_CALLMODE_SLOT 0x00 // sync/async from Slot -#define SFX_CALLMODE_SYNCHRON 0x01 // synchronously in the same Stackframe -#define SFX_CALLMODE_ASYNCHRON 0x02 // asynchronously via AppEvent -#define SFX_CALLMODE_RECORD 0x04 // take into account while recording -#define SFX_CALLMODE_API 0x08 // API call (silent) -#define SFX_CALLMODE_MODAL 0x10 // despite ModalMode +enum class SfxCallMode : sal_uInt16 +{ + SLOT = 0x00, // sync/async from Slot + SYNCHRON = 0x01, // synchronously in the same Stackframe + ASYNCHRON = 0x02, // asynchronously via AppEvent + RECORD = 0x04, // take into account while recording + API = 0x08, // API call (silent) + MODAL = 0x10 // despite ModalMode +}; +// make combining these type-safe +inline SfxCallMode operator| (SfxCallMode lhs, SfxCallMode rhs) +{ + return static_cast<SfxCallMode>(static_cast<sal_uInt16>(lhs) | static_cast<sal_uInt16>(rhs)); +} +inline SfxCallMode operator& (SfxCallMode lhs, SfxCallMode rhs) +{ + return static_cast<SfxCallMode>(static_cast<sal_uInt16>(lhs) & static_cast<sal_uInt16>(rhs)); +} +inline SfxCallMode operator~ (SfxCallMode rhs) +{ + return static_cast<SfxCallMode>(0x1f & ~(static_cast<sal_uInt16>(rhs))); +} +inline SfxCallMode& operator|= (SfxCallMode& lhs, SfxCallMode rhs) +{ + lhs = static_cast<SfxCallMode>(static_cast<sal_uInt16>(lhs) | static_cast<sal_uInt16>(rhs)); + return lhs; +} +inline SfxCallMode& operator&= (SfxCallMode& lhs, SfxCallMode rhs) +{ + lhs = static_cast<SfxCallMode>(static_cast<sal_uInt16>(lhs) & static_cast<sal_uInt16>(rhs)); + return lhs; +} -#define SFX_CALLMODE_STANDARD SFX_CALLMODE_RECORD -typedef sal_uInt16 SfxCallMode; enum SfxPopupAction { @@ -177,7 +201,7 @@ public: bool Execute( sal_uInt16 nSlot, const SfxPoolItem **pArgs = 0, sal_uInt16 nModi = 0, - SfxCallMode nCall = SFX_CALLMODE_SLOT, + SfxCallMode nCall = SfxCallMode::SLOT, const SfxPoolItem **pInternalArgs = 0); SAL_DLLPRIVATE void SetDispatchProvider_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > & rFrame ); diff --git a/include/sfx2/dispatch.hxx b/include/sfx2/dispatch.hxx index eac691e0ad05..3b1476c3a0e2 100644 --- a/include/sfx2/dispatch.hxx +++ b/include/sfx2/dispatch.hxx @@ -101,7 +101,7 @@ friend class SfxHelp; SfxItemSet &rState, const SfxSlot *pRealSlot ); void _Execute( SfxShell &rShell, const SfxSlot &rSlot, SfxRequest &rReq, - SfxCallMode eCall = SFX_CALLMODE_STANDARD); + SfxCallMode eCall = SfxCallMode::RECORD); protected: void FlushImpl(); @@ -115,7 +115,7 @@ public: virtual ~SfxDispatcher(); const SfxPoolItem* Execute( sal_uInt16 nSlot, - SfxCallMode nCall = SFX_CALLMODE_SLOT, + SfxCallMode nCall = SfxCallMode::SLOT, const SfxPoolItem **pArgs = 0, sal_uInt16 nModi = 0, const SfxPoolItem **pInternalArgs = 0); diff --git a/include/sfx2/request.hxx b/include/sfx2/request.hxx index a47f96292624..f862cb0f279a 100644 --- a/include/sfx2/request.hxx +++ b/include/sfx2/request.hxx @@ -37,6 +37,7 @@ class SfxShell; class SfxSlot; class SfxViewFrame; struct SfxRequest_Impl; +enum class SfxCallMode : sal_uInt16; @@ -44,7 +45,7 @@ class SFX2_DLLPUBLIC SfxRequest: public SfxHint { friend struct SfxRequest_Impl; - sal_uInt16 nSlot; + sal_uInt16 nSlot; SfxAllItemSet* pArgs; SfxRequest_Impl* pImp; @@ -60,10 +61,10 @@ private: public: SfxRequest( SfxViewFrame*, sal_uInt16 nSlotId ); - SfxRequest( sal_uInt16 nSlot, sal_uInt16 nCallMode, SfxItemPool &rPool ); + SfxRequest( sal_uInt16 nSlot, SfxCallMode nCallMode, SfxItemPool &rPool ); SfxRequest( const SfxSlot* pSlot, const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& rArgs, - sal_uInt16 nCallMode, SfxItemPool &rPool ); - SfxRequest( sal_uInt16 nSlot, sal_uInt16 nCallMode, const SfxAllItemSet& rSfxArgs ); + SfxCallMode nCallMode, SfxItemPool &rPool ); + SfxRequest( sal_uInt16 nSlot, SfxCallMode nCallMode, const SfxAllItemSet& rSfxArgs ); SfxRequest( const SfxRequest& rOrig ); virtual ~SfxRequest(); @@ -89,7 +90,7 @@ public: static com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > GetMacroRecorder( SfxViewFrame* pFrame=NULL ); static bool HasMacroRecorder( SfxViewFrame* pFrame=NULL ); - sal_uInt16 GetCallMode() const; + SfxCallMode GetCallMode() const; void AllowRecording( bool ); bool AllowsRecording() const; bool IsAPI() const; diff --git a/include/vbahelper/vbahelper.hxx b/include/vbahelper/vbahelper.hxx index a5d119b3ac78..0d272005787f 100644 --- a/include/vbahelper/vbahelper.hxx +++ b/include/vbahelper/vbahelper.hxx @@ -73,7 +73,7 @@ namespace ooo VBAHELPER_DLLPUBLIC void dispatchRequests( const css::uno::Reference< css::frame::XModel>& xModel, const OUString& aUrl ); VBAHELPER_DLLPUBLIC void dispatchRequests (const css::uno::Reference< css::frame::XModel>& xModel, const OUString & aUrl, const css::uno::Sequence< css::beans::PropertyValue >& sProps ); - VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, sal_uInt16 nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON ); + VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, sal_uInt16 nSlot, SfxCallMode nCall = SfxCallMode::SYNCHRON ); VBAHELPER_DLLPUBLIC sal_Int32 OORGBToXLRGB( sal_Int32 ); VBAHELPER_DLLPUBLIC sal_Int32 XLRGBToOORGB( sal_Int32 ); VBAHELPER_DLLPUBLIC css::uno::Any OORGBToXLRGB( const css::uno::Any& ); |