diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-10-13 15:08:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-10-14 08:17:50 +0200 |
commit | 2a504a24e4af5eb79bbd15773d27baedd30bdd8e (patch) | |
tree | 484f595cc280e40e483ad562e6ab000038d90c5a /sc/source/ui/miscdlgs/warnbox.cxx | |
parent | 0f67b8626b326caa8c43fd7ac57be4dd59b2f281 (diff) |
loplugin:mergeclasse merge ScCbWarningBox with ScReplaceWarnBo
Change-Id: I7b55b036c1992b88b01b51053a3560e9f97986c9
Diffstat (limited to 'sc/source/ui/miscdlgs/warnbox.cxx')
-rw-r--r-- | sc/source/ui/miscdlgs/warnbox.cxx | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/sc/source/ui/miscdlgs/warnbox.cxx b/sc/source/ui/miscdlgs/warnbox.cxx index 8d500490f13c..da64e32dbd68 100644 --- a/sc/source/ui/miscdlgs/warnbox.cxx +++ b/sc/source/ui/miscdlgs/warnbox.cxx @@ -24,53 +24,31 @@ #include "scresid.hxx" #include "sc.hrc" -ScCbWarningBox::ScCbWarningBox( vcl::Window* pParent, const OUString& rMsgStr ) : - WarningBox( pParent, WB_YES_NO | WB_DEF_YES, rMsgStr ) +ScReplaceWarnBox::ScReplaceWarnBox( vcl::Window* pParent ) : + WarningBox( pParent, WB_YES_NO | WB_DEF_YES, OUString( ScResId( STR_REPLCELLSWARN ) ) ) { // By default, the check box is ON, and the user needs to un-check it to // disable all future warnings. SetCheckBoxState(true); SetCheckBoxText(ScResId(SCSTR_WARN_ME_IN_FUTURE_CHECK)); + SetHelpId( HID_SC_REPLCELLSWARN ); } -sal_Int16 ScCbWarningBox::Execute() +sal_Int16 ScReplaceWarnBox::Execute() { - sal_Int16 nRet = (GetStyle() & WB_DEF_YES) ? RET_YES : RET_NO; - if( IsDialogEnabled() ) + sal_Int16 nRet = RET_YES; + if( (bool) SC_MOD()->GetInputOptions().GetReplaceCellsWarn() ) { nRet = WarningBox::Execute(); if (!GetCheckBoxState()) - DisableDialog(); + { + ScModule* pScMod = SC_MOD(); + ScInputOptions aInputOpt( pScMod->GetInputOptions() ); + aInputOpt.SetReplaceCellsWarn( false ); + pScMod->SetInputOptions( aInputOpt ); + } } return nRet; } -bool ScCbWarningBox::IsDialogEnabled() -{ - return true; -} - -void ScCbWarningBox::DisableDialog() -{ -} - -ScReplaceWarnBox::ScReplaceWarnBox( vcl::Window* pParent ) : - ScCbWarningBox( pParent, OUString( ScResId( STR_REPLCELLSWARN ) ) ) -{ - SetHelpId( HID_SC_REPLCELLSWARN ); -} - -bool ScReplaceWarnBox::IsDialogEnabled() -{ - return (bool) SC_MOD()->GetInputOptions().GetReplaceCellsWarn(); -} - -void ScReplaceWarnBox::DisableDialog() -{ - ScModule* pScMod = SC_MOD(); - ScInputOptions aInputOpt( pScMod->GetInputOptions() ); - aInputOpt.SetReplaceCellsWarn( false ); - pScMod->SetInputOptions( aInputOpt ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |