Kaydet (Commit) 8bc7a392 authored tarafından Caolán McNamara's avatar Caolán McNamara

merge duplicated TriStateEnabled class

Change-Id: I1c10010eb7fd33a03f477af0cba03ae74859b174
Reviewed-on: https://gerrit.libreoffice.org/71959
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 922f3d2f
...@@ -182,18 +182,6 @@ public: ...@@ -182,18 +182,6 @@ public:
virtual void PageCreated(const SfxAllItemSet& aSet) override; 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 ------------------------------------------ // class SvxExtParagraphTabPage ------------------------------------------
/* /*
[Description] [Description]
...@@ -233,14 +221,14 @@ protected: ...@@ -233,14 +221,14 @@ protected:
private: private:
SvxExtParagraphTabPage(TabPageParent pParent, const SfxItemSet& rSet); SvxExtParagraphTabPage(TabPageParent pParent, const SfxItemSet& rSet);
TriStateEnabled aHyphenState; weld::TriStateEnabled aHyphenState;
TriStateEnabled aPageBreakState; weld::TriStateEnabled aPageBreakState;
TriStateEnabled aApplyCollState; weld::TriStateEnabled aApplyCollState;
TriStateEnabled aPageNumState; weld::TriStateEnabled aPageNumState;
TriStateEnabled aKeepTogetherState; weld::TriStateEnabled aKeepTogetherState;
TriStateEnabled aKeepParaState; weld::TriStateEnabled aKeepParaState;
TriStateEnabled aOrphanState; weld::TriStateEnabled aOrphanState;
TriStateEnabled aWidowState; weld::TriStateEnabled aWidowState;
bool bPageBreak; bool bPageBreak;
bool bHtmlMode; bool bHtmlMode;
......
...@@ -2065,26 +2065,6 @@ IMPL_LINK(SvxExtParagraphTabPage, WidowHdl_Impl, weld::ToggleButton&, rToggle, v ...@@ -2065,26 +2065,6 @@ IMPL_LINK(SvxExtParagraphTabPage, WidowHdl_Impl, weld::ToggleButton&, rToggle, v
WidowHdl(); 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) IMPL_LINK(SvxExtParagraphTabPage, OrphanHdl_Impl, weld::ToggleButton&, rToggle, void)
{ {
aOrphanState.ButtonToggled(rToggle); aOrphanState.ButtonToggled(rToggle);
......
...@@ -896,6 +896,18 @@ public: ...@@ -896,6 +896,18 @@ public:
virtual void connect_toggled(const Link<ToggleButton&, void>& rLink) { m_aToggleHdl = rLink; } 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 class VCL_DLLPUBLIC MenuButton : virtual public ToggleButton
{ {
protected: protected:
......
...@@ -142,26 +142,6 @@ DeactivateRC ScTabPageProtection::DeactivatePage( SfxItemSet* pSetP ) ...@@ -142,26 +142,6 @@ DeactivateRC ScTabPageProtection::DeactivatePage( SfxItemSet* pSetP )
return DeactivateRC::LeavePage; 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) IMPL_LINK(ScTabPageProtection, ProtectClickHdl, weld::ToggleButton&, rBox, void)
{ {
aProtectState.ButtonToggled(rBox); aProtectState.ButtonToggled(rBox);
......
...@@ -22,18 +22,6 @@ ...@@ -22,18 +22,6 @@
#include <sfx2/tabdlg.hxx> #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 class ScTabPageProtection : public SfxTabPage
{ {
friend class VclPtr<ScTabPageProtection>; friend class VclPtr<ScTabPageProtection>;
...@@ -62,10 +50,10 @@ private: ...@@ -62,10 +50,10 @@ private:
bool bHideCell; bool bHideCell;
bool bHidePrint; bool bHidePrint;
TriStateEnabled aHideCellState; weld::TriStateEnabled aHideCellState;
TriStateEnabled aProtectState; weld::TriStateEnabled aProtectState;
TriStateEnabled aHideFormulaState; weld::TriStateEnabled aHideFormulaState;
TriStateEnabled aHidePrintState; weld::TriStateEnabled aHidePrintState;
std::unique_ptr<weld::CheckButton> m_xBtnHideCell; std::unique_ptr<weld::CheckButton> m_xBtnHideCell;
std::unique_ptr<weld::CheckButton> m_xBtnProtect; std::unique_ptr<weld::CheckButton> m_xBtnProtect;
......
...@@ -5177,6 +5177,26 @@ namespace weld ...@@ -5177,6 +5177,26 @@ namespace weld
m_xContentArea->move(m_xRelocate.get(), m_xOrigParent.get()); 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment