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

weld ScTabPageProtection

Change-Id: I85fa703ebe73987822f85ff722f02627751937ec
Reviewed-on: https://gerrit.libreoffice.org/60909
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 0314b3e2
...@@ -35,25 +35,23 @@ const sal_uInt16 ScTabPageProtection::pProtectionRanges[] = ...@@ -35,25 +35,23 @@ const sal_uInt16 ScTabPageProtection::pProtectionRanges[] =
// Zellschutz-Tabpage: // Zellschutz-Tabpage:
ScTabPageProtection::ScTabPageProtection(vcl::Window* pParent, const SfxItemSet& rCoreAttrs) ScTabPageProtection::ScTabPageProtection(TabPageParent pParent, const SfxItemSet& rCoreAttrs)
: SfxTabPage(pParent, "CellProtectionPage", : SfxTabPage(pParent, "modules/scalc/ui/cellprotectionpage.ui", "CellProtectionPage", &rCoreAttrs)
"modules/scalc/ui/cellprotectionpage.ui", &rCoreAttrs) , m_xBtnHideCell(m_xBuilder->weld_check_button("checkHideAll"))
, m_xBtnProtect(m_xBuilder->weld_check_button("checkProtected"))
, m_xBtnHideFormula(m_xBuilder->weld_check_button("checkHideFormula"))
, m_xBtnHidePrint(m_xBuilder->weld_check_button("checkHidePrinting"))
{ {
get(m_pBtnHideCell,"checkHideAll");
get(m_pBtnProtect,"checkProtected");
get(m_pBtnHideFormula,"checkHideFormula");
get(m_pBtnHidePrint,"checkHidePrinting");
// This Page need ExchangeSupport // This Page need ExchangeSupport
SetExchangeSupport(); SetExchangeSupport();
// States will be set in Reset // States will be set in Reset
bTriEnabled = bDontCare = bProtect = bHideForm = bHideCell = bHidePrint = false; bTriEnabled = bDontCare = bProtect = bHideForm = bHideCell = bHidePrint = false;
m_pBtnProtect->SetClickHdl( LINK( this, ScTabPageProtection, ButtonClickHdl ) ); m_xBtnProtect->connect_toggled(LINK(this, ScTabPageProtection, ButtonClickHdl));
m_pBtnHideCell->SetClickHdl( LINK( this, ScTabPageProtection, ButtonClickHdl ) ); m_xBtnHideCell->connect_toggled(LINK(this, ScTabPageProtection, ButtonClickHdl));
m_pBtnHideFormula->SetClickHdl( LINK( this, ScTabPageProtection, ButtonClickHdl ) ); m_xBtnHideFormula->connect_toggled(LINK(this, ScTabPageProtection, ButtonClickHdl));
m_pBtnHidePrint->SetClickHdl( LINK( this, ScTabPageProtection, ButtonClickHdl ) ); m_xBtnHidePrint->connect_toggled(LINK(this, ScTabPageProtection, ButtonClickHdl));
} }
ScTabPageProtection::~ScTabPageProtection() ScTabPageProtection::~ScTabPageProtection()
...@@ -61,18 +59,9 @@ ScTabPageProtection::~ScTabPageProtection() ...@@ -61,18 +59,9 @@ ScTabPageProtection::~ScTabPageProtection()
disposeOnce(); disposeOnce();
} }
void ScTabPageProtection::dispose() VclPtr<SfxTabPage> ScTabPageProtection::Create(TabPageParent pParent, const SfxItemSet* rAttrSet)
{
m_pBtnHideCell.clear();
m_pBtnProtect.clear();
m_pBtnHideFormula.clear();
m_pBtnHidePrint.clear();
SfxTabPage::dispose();
}
VclPtr<SfxTabPage> ScTabPageProtection::Create( TabPageParent pParent, const SfxItemSet* rAttrSet )
{ {
return VclPtr<ScTabPageProtection>::Create( pParent.pParent, *rAttrSet ); return VclPtr<ScTabPageProtection>::Create(pParent, *rAttrSet);
} }
void ScTabPageProtection::Reset( const SfxItemSet* rCoreAttrs ) void ScTabPageProtection::Reset( const SfxItemSet* rCoreAttrs )
...@@ -109,11 +98,13 @@ void ScTabPageProtection::Reset( const SfxItemSet* rCoreAttrs ) ...@@ -109,11 +98,13 @@ void ScTabPageProtection::Reset( const SfxItemSet* rCoreAttrs )
} }
// Start Controls // Start Controls
if (bTriEnabled)
m_pBtnProtect->EnableTriState( bTriEnabled ); {
m_pBtnHideCell->EnableTriState( bTriEnabled ); m_xBtnProtect->set_state(TRISTATE_INDET);
m_pBtnHideFormula->EnableTriState( bTriEnabled ); m_xBtnHideCell->set_state(TRISTATE_INDET);
m_pBtnHidePrint->EnableTriState( bTriEnabled ); m_xBtnHideFormula->set_state(TRISTATE_INDET);
m_xBtnHidePrint->set_state(TRISTATE_INDET);
}
UpdateButtons(); UpdateButtons();
} }
...@@ -156,23 +147,23 @@ DeactivateRC ScTabPageProtection::DeactivatePage( SfxItemSet* pSetP ) ...@@ -156,23 +147,23 @@ DeactivateRC ScTabPageProtection::DeactivatePage( SfxItemSet* pSetP )
return DeactivateRC::LeavePage; return DeactivateRC::LeavePage;
} }
IMPL_LINK( ScTabPageProtection, ButtonClickHdl, Button*, pBox, void ) IMPL_LINK(ScTabPageProtection, ButtonClickHdl, weld::ToggleButton&, rBox, void)
{ {
TriState eState = static_cast<TriStateBox*>(pBox)->GetState(); TriState eState = rBox.get_state();
if ( eState == TRISTATE_INDET ) if (eState == TRISTATE_INDET)
bDontCare = true; // everything combined at DontCare bDontCare = true; // everything combined at DontCare
else else
{ {
bDontCare = false; // DontCare from everywhere bDontCare = false; // DontCare from everywhere
bool bOn = ( eState == TRISTATE_TRUE ); // from a selected value bool bOn = eState == TRISTATE_TRUE; // from a selected value
if ( pBox == m_pBtnProtect ) if (&rBox == m_xBtnProtect.get())
bProtect = bOn; bProtect = bOn;
else if ( pBox == m_pBtnHideCell ) else if (&rBox == m_xBtnHideCell.get())
bHideCell = bOn; bHideCell = bOn;
else if ( pBox == m_pBtnHideFormula ) else if (&rBox == m_xBtnHideFormula.get())
bHideForm = bOn; bHideForm = bOn;
else if ( pBox == m_pBtnHidePrint ) else if (&rBox == m_xBtnHidePrint.get())
bHidePrint = bOn; bHidePrint = bOn;
else else
{ {
...@@ -185,25 +176,25 @@ IMPL_LINK( ScTabPageProtection, ButtonClickHdl, Button*, pBox, void ) ...@@ -185,25 +176,25 @@ IMPL_LINK( ScTabPageProtection, ButtonClickHdl, Button*, pBox, void )
void ScTabPageProtection::UpdateButtons() void ScTabPageProtection::UpdateButtons()
{ {
if ( bDontCare ) if (bDontCare)
{ {
m_pBtnProtect->SetState( TRISTATE_INDET ); m_xBtnProtect->set_state(TRISTATE_INDET);
m_pBtnHideCell->SetState( TRISTATE_INDET ); m_xBtnHideCell->set_state(TRISTATE_INDET);
m_pBtnHideFormula->SetState( TRISTATE_INDET ); m_xBtnHideFormula->set_state(TRISTATE_INDET);
m_pBtnHidePrint->SetState( TRISTATE_INDET ); m_xBtnHidePrint->set_state(TRISTATE_INDET);
} }
else else
{ {
m_pBtnProtect->SetState( bProtect ? TRISTATE_TRUE : TRISTATE_FALSE ); m_xBtnProtect->set_state(bProtect ? TRISTATE_TRUE : TRISTATE_FALSE);
m_pBtnHideCell->SetState( bHideCell ? TRISTATE_TRUE : TRISTATE_FALSE ); m_xBtnHideCell->set_state(bHideCell ? TRISTATE_TRUE : TRISTATE_FALSE);
m_pBtnHideFormula->SetState( bHideForm ? TRISTATE_TRUE : TRISTATE_FALSE ); m_xBtnHideFormula->set_state(bHideForm ? TRISTATE_TRUE : TRISTATE_FALSE);
m_pBtnHidePrint->SetState( bHidePrint ? TRISTATE_TRUE : TRISTATE_FALSE ); m_xBtnHidePrint->set_state(bHidePrint ? TRISTATE_TRUE : TRISTATE_FALSE);
} }
bool bEnable = ( m_pBtnHideCell->GetState() != TRISTATE_TRUE ); bool bEnable = (m_xBtnHideCell->get_state() != TRISTATE_TRUE);
{ {
m_pBtnProtect->Enable( bEnable ); m_xBtnProtect->set_sensitive(bEnable);
m_pBtnHideFormula->Enable( bEnable ); m_xBtnHideFormula->set_sensitive(bEnable);
} }
} }
......
...@@ -35,20 +35,14 @@ public: ...@@ -35,20 +35,14 @@ public:
virtual void Reset ( const SfxItemSet* ) override; virtual void Reset ( const SfxItemSet* ) override;
virtual ~ScTabPageProtection() override; virtual ~ScTabPageProtection() override;
virtual void dispose() override;
protected: protected:
using SfxTabPage::DeactivatePage; using SfxTabPage::DeactivatePage;
virtual DeactivateRC DeactivatePage ( SfxItemSet* pSet ) override; virtual DeactivateRC DeactivatePage ( SfxItemSet* pSet ) override;
private: private:
ScTabPageProtection( vcl::Window* pParent, ScTabPageProtection(TabPageParent pParent, const SfxItemSet& rCoreAttrs);
const SfxItemSet& rCoreAttrs );
private: private:
VclPtr<TriStateBox> m_pBtnHideCell;
VclPtr<TriStateBox> m_pBtnProtect;
VclPtr<TriStateBox> m_pBtnHideFormula;
VclPtr<TriStateBox> m_pBtnHidePrint;
// current status: // current status:
bool bTriEnabled; // if before - DontCare bool bTriEnabled; // if before - DontCare
bool bDontCare; // all in TriState bool bDontCare; // all in TriState
...@@ -57,8 +51,13 @@ private: ...@@ -57,8 +51,13 @@ private:
bool bHideCell; bool bHideCell;
bool bHidePrint; bool bHidePrint;
std::unique_ptr<weld::CheckButton> m_xBtnHideCell;
std::unique_ptr<weld::CheckButton> m_xBtnProtect;
std::unique_ptr<weld::CheckButton> m_xBtnHideFormula;
std::unique_ptr<weld::CheckButton> m_xBtnHidePrint;
// Handler: // Handler:
DECL_LINK( ButtonClickHdl, Button*, void ); DECL_LINK(ButtonClickHdl, weld::ToggleButton&, void);
void UpdateButtons(); void UpdateButtons();
}; };
......
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