Kaydet (Commit) 70bb74f2 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Michael Stahl

merge duplicated TriStateEnabled class

Change-Id: I1c10010eb7fd33a03f477af0cba03ae74859b174
Reviewed-on: https://gerrit.libreoffice.org/71999
Tested-by: Jenkins
Reviewed-by: 's avatarMichael Stahl <Michael.Stahl@cib.de>
üst 1b2aaed5
......@@ -184,18 +184,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]
......@@ -235,14 +223,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;
......
......@@ -2063,26 +2063,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);
......
......@@ -627,6 +627,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:
......
......@@ -144,26 +144,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);
......
......@@ -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;
......
......@@ -3836,6 +3836,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: */
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