diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-05-08 12:26:39 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-05-08 17:31:12 +0200 |
commit | 8bc7a39223ba55efa6453d540b1d5e6ff52e51ee (patch) | |
tree | dd5cf9c2a969f81d1f04f6df1dd33c0bdfd24792 | |
parent | 922f3d2f10746ab25deeb5ea4ae78795524e6744 (diff) |
merge duplicated TriStateEnabled class
Change-Id: I1c10010eb7fd33a03f477af0cba03ae74859b174
Reviewed-on: https://gerrit.libreoffice.org/71959
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | cui/source/inc/paragrph.hxx | 28 | ||||
-rw-r--r-- | cui/source/tabpages/paragrph.cxx | 20 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 12 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/tabpages.cxx | 20 | ||||
-rw-r--r-- | sc/source/ui/inc/tabpages.hxx | 20 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 20 |
6 files changed, 44 insertions, 76 deletions
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx index e9de90c4131e..572a8af058b6 100644 --- a/cui/source/inc/paragrph.hxx +++ b/cui/source/inc/paragrph.hxx @@ -182,18 +182,6 @@ public: virtual void PageCreated(const SfxAllItemSet& aSet) override; }; -struct TriStateEnabled -{ - TriState eState; - bool bTriStateEnabled; - TriStateEnabled() - : eState(TRISTATE_INDET) - , bTriStateEnabled(true) - { - } - void ButtonToggled(weld::ToggleButton& rToggle); -}; - // class SvxExtParagraphTabPage ------------------------------------------ /* [Description] @@ -233,14 +221,14 @@ protected: private: SvxExtParagraphTabPage(TabPageParent pParent, const SfxItemSet& rSet); - TriStateEnabled aHyphenState; - TriStateEnabled aPageBreakState; - TriStateEnabled aApplyCollState; - TriStateEnabled aPageNumState; - TriStateEnabled aKeepTogetherState; - TriStateEnabled aKeepParaState; - TriStateEnabled aOrphanState; - TriStateEnabled aWidowState; + weld::TriStateEnabled aHyphenState; + weld::TriStateEnabled aPageBreakState; + weld::TriStateEnabled aApplyCollState; + weld::TriStateEnabled aPageNumState; + weld::TriStateEnabled aKeepTogetherState; + weld::TriStateEnabled aKeepParaState; + weld::TriStateEnabled aOrphanState; + weld::TriStateEnabled aWidowState; bool bPageBreak; bool bHtmlMode; diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index caa7a97b33c3..6c8cf7293f26 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -2065,26 +2065,6 @@ IMPL_LINK(SvxExtParagraphTabPage, WidowHdl_Impl, weld::ToggleButton&, rToggle, v WidowHdl(); } -void TriStateEnabled::ButtonToggled(weld::ToggleButton& rToggle) -{ - if (bTriStateEnabled) - { - switch (eState) - { - case TRISTATE_INDET: - rToggle.set_state(TRISTATE_FALSE); - break; - case TRISTATE_TRUE: - rToggle.set_state(TRISTATE_INDET); - break; - case TRISTATE_FALSE: - rToggle.set_state(TRISTATE_TRUE); - break; - } - } - eState = rToggle.get_state(); -} - IMPL_LINK(SvxExtParagraphTabPage, OrphanHdl_Impl, weld::ToggleButton&, rToggle, void) { aOrphanState.ButtonToggled(rToggle); diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index c24810f4ebec..15d5b609d1b8 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -896,6 +896,18 @@ public: virtual void connect_toggled(const Link<ToggleButton&, void>& rLink) { m_aToggleHdl = rLink; } }; +struct VCL_DLLPUBLIC TriStateEnabled +{ + TriState eState; + bool bTriStateEnabled; + TriStateEnabled() + : eState(TRISTATE_INDET) + , bTriStateEnabled(true) + { + } + void ButtonToggled(ToggleButton& rToggle); +}; + class VCL_DLLPUBLIC MenuButton : virtual public ToggleButton { protected: diff --git a/sc/source/ui/attrdlg/tabpages.cxx b/sc/source/ui/attrdlg/tabpages.cxx index c0c2ff5ddabc..6f6fb3928ed7 100644 --- a/sc/source/ui/attrdlg/tabpages.cxx +++ b/sc/source/ui/attrdlg/tabpages.cxx @@ -142,26 +142,6 @@ DeactivateRC ScTabPageProtection::DeactivatePage( SfxItemSet* pSetP ) return DeactivateRC::LeavePage; } -void TriStateEnabled::ButtonToggled(weld::ToggleButton& rToggle) -{ - if (bTriStateEnabled) - { - switch (eState) - { - case TRISTATE_INDET: - rToggle.set_state(TRISTATE_FALSE); - break; - case TRISTATE_TRUE: - rToggle.set_state(TRISTATE_INDET); - break; - case TRISTATE_FALSE: - rToggle.set_state(TRISTATE_TRUE); - break; - } - } - eState = rToggle.get_state(); -} - IMPL_LINK(ScTabPageProtection, ProtectClickHdl, weld::ToggleButton&, rBox, void) { aProtectState.ButtonToggled(rBox); diff --git a/sc/source/ui/inc/tabpages.hxx b/sc/source/ui/inc/tabpages.hxx index 5d195bb3cde2..16046ab4f6bc 100644 --- a/sc/source/ui/inc/tabpages.hxx +++ b/sc/source/ui/inc/tabpages.hxx @@ -22,18 +22,6 @@ #include <sfx2/tabdlg.hxx> -struct TriStateEnabled -{ - TriState eState; - bool bTriStateEnabled; - TriStateEnabled() - : eState(TRISTATE_INDET) - , bTriStateEnabled(true) - { - } - void ButtonToggled(weld::ToggleButton& rToggle); -}; - class ScTabPageProtection : public SfxTabPage { friend class VclPtr<ScTabPageProtection>; @@ -62,10 +50,10 @@ private: bool bHideCell; bool bHidePrint; - TriStateEnabled aHideCellState; - TriStateEnabled aProtectState; - TriStateEnabled aHideFormulaState; - TriStateEnabled aHidePrintState; + weld::TriStateEnabled aHideCellState; + weld::TriStateEnabled aProtectState; + weld::TriStateEnabled aHideFormulaState; + weld::TriStateEnabled aHidePrintState; std::unique_ptr<weld::CheckButton> m_xBtnHideCell; std::unique_ptr<weld::CheckButton> m_xBtnProtect; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index c1ad54838e2f..390305ad0b60 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -5177,6 +5177,26 @@ namespace weld m_xContentArea->move(m_xRelocate.get(), m_xOrigParent.get()); } } + + void TriStateEnabled::ButtonToggled(weld::ToggleButton& rToggle) + { + if (bTriStateEnabled) + { + switch (eState) + { + case TRISTATE_INDET: + rToggle.set_state(TRISTATE_FALSE); + break; + case TRISTATE_TRUE: + rToggle.set_state(TRISTATE_INDET); + break; + case TRISTATE_FALSE: + rToggle.set_state(TRISTATE_TRUE); + break; + } + } + eState = rToggle.get_state(); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |