diff options
author | Noel Grandin <noel@peralex.com> | 2016-08-29 14:25:07 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-08-30 08:40:03 +0200 |
commit | e9a2d9e7be22b455c1597277c152379f732ce447 (patch) | |
tree | b456ac5d6bb38d01c42598c7e6d1a07521c7d3f8 /include/svx | |
parent | 15b084f2034dc892ef456f8c65f162c760c69fe8 (diff) |
convert DbGridControl::NavigationBar::State to scoped enum
and remove a nasty hack where we were passing around an extra constant
(SID_FM_RECORD_UNDO) without actually adding it to the enum
Change-Id: Ib79d0a4e2d1418797b01067529d500728e95bf7e
Diffstat (limited to 'include/svx')
-rw-r--r-- | include/svx/fmgridif.hxx | 7 | ||||
-rw-r--r-- | include/svx/gridctrl.hxx | 45 |
2 files changed, 27 insertions, 25 deletions
diff --git a/include/svx/fmgridif.hxx b/include/svx/fmgridif.hxx index fceab28fb4bf..53a219884f47 100644 --- a/include/svx/fmgridif.hxx +++ b/include/svx/fmgridif.hxx @@ -50,6 +50,7 @@ #include <cppuhelper/implbase10.hxx> class DbGridColumn; +enum class DbGridControlNavigationBarState; class SAL_WARN_UNUSED OWeakSubObject : public ::cppu::OWeakObject { @@ -503,7 +504,7 @@ protected: virtual VclPtr<FmGridControl> imp_CreateControl(vcl::Window* pParent, WinBits nStyle); static css::uno::Sequence< css::util::URL>& getSupportedURLs(); - static css::uno::Sequence<sal_uInt16>& getSupportedGridSlots(); + static const std::vector<DbGridControlNavigationBarState>& getSupportedGridSlots(); void ConnectToDispatcher(); void DisConnectFromDispatcher(); void UpdateDispatches(); // will connect if not already connected and just update else @@ -519,8 +520,8 @@ protected: void selectionChanged(); void columnChanged(); - DECL_LINK_TYPED(OnQueryGridSlotState, sal_uInt16, int); - DECL_LINK_TYPED(OnExecuteGridSlot, sal_uInt16, bool); + DECL_LINK_TYPED(OnQueryGridSlotState, DbGridControlNavigationBarState, int); + DECL_LINK_TYPED(OnExecuteGridSlot, DbGridControlNavigationBarState, bool); }; diff --git a/include/svx/gridctrl.hxx b/include/svx/gridctrl.hxx index 3637c5fd7f40..23cc34350df6 100644 --- a/include/svx/gridctrl.hxx +++ b/include/svx/gridctrl.hxx @@ -143,6 +143,22 @@ namespace o3tl template<> struct typed_flags<DbGridControlOptions> : is_typed_flags<DbGridControlOptions, 0x07> {}; } +// StatusIds for Controls of the Bar +// important for invalidation +enum class DbGridControlNavigationBarState +{ + NONE, + Text, + Absolute, + Of, + Count, + First, + Next, + Prev, + Last, + New, + Undo // related to SID_FM_RECORD_UNDO +}; class FmXGridSourcePropListener; class DisposeListenerGridBridge; @@ -186,30 +202,15 @@ public: bool m_bPositioning; // protect PositionDataSource against recursion public: - // StatusIds for Controls of the Bar - // important for invalidation - enum State - { - RECORD_TEXT = 1, - RECORD_ABSOLUTE, - RECORD_OF, - RECORD_COUNT, - RECORD_FIRST, - RECORD_NEXT, - RECORD_PREV, - RECORD_LAST, - RECORD_NEW - }; - NavigationBar(vcl::Window* pParent); virtual ~NavigationBar(); virtual void dispose() override; // Status methods for Controls void InvalidateAll(sal_Int32 nCurrentPos = -1, bool bAll = false); - void InvalidateState(sal_uInt16 nWhich) {SetState(nWhich);} - void SetState(sal_uInt16 nWhich); - bool GetState(sal_uInt16 nWhich) const; + void InvalidateState(DbGridControlNavigationBarState nWhich) {SetState(nWhich);} + void SetState(DbGridControlNavigationBarState nWhich); + bool GetState(DbGridControlNavigationBarState nWhich) const; sal_uInt16 ArrangeControls(); protected: @@ -226,8 +227,8 @@ public: friend class DbGridControl::NavigationBar; private: - Link<sal_uInt16,int> m_aMasterStateProvider; - Link<sal_uInt16,bool> m_aMasterSlotExecutor; + Link<DbGridControlNavigationBarState,int> m_aMasterStateProvider; + Link<DbGridControlNavigationBarState,bool> m_aMasterSlotExecutor; css::uno::Reference< css::util::XNumberFormatter > m_xFormatter; css::uno::Reference< css::uno::XComponentContext > m_xContext; @@ -480,13 +481,13 @@ public: const DbGridRowRef& GetCurrentRow() const {return m_xCurrentRow;} - void SetStateProvider(const Link<sal_uInt16,int>& rProvider) { m_aMasterStateProvider = rProvider; } + void SetStateProvider(const Link<DbGridControlNavigationBarState,int>& rProvider) { m_aMasterStateProvider = rProvider; } // if this link is set the given provider will be asked for the state of my items. // the return values are interpreted as follows : // <0 -> not specified (use default mechanism to determine the state) // ==0 -> the item is disabled // >0 -> the item is enabled - void SetSlotExecutor(const Link<sal_uInt16,bool>& rExecutor) { m_aMasterSlotExecutor = rExecutor; } + void SetSlotExecutor(const Link<DbGridControlNavigationBarState,bool>& rExecutor) { m_aMasterSlotExecutor = rExecutor; } // analogous : if this link is set, all nav-bar slots will be routed through it when executed // if the handler returns nonzero, no further handling of the slot occurs |