summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-10-13 15:08:52 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-10-14 08:17:50 +0200
commit2a504a24e4af5eb79bbd15773d27baedd30bdd8e (patch)
tree484f595cc280e40e483ad562e6ab000038d90c5a
parent0f67b8626b326caa8c43fd7ac57be4dd59b2f281 (diff)
loplugin:mergeclasse merge ScCbWarningBox with ScReplaceWarnBo
Change-Id: I7b55b036c1992b88b01b51053a3560e9f97986c9
-rw-r--r--compilerplugins/clang/mergeclasses.results1
-rw-r--r--sc/source/ui/inc/warnbox.hxx25
-rw-r--r--sc/source/ui/miscdlgs/warnbox.cxx46
3 files changed, 16 insertions, 56 deletions
diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results
index 428bd40f2baa..75c033bb3785 100644
--- a/compilerplugins/clang/mergeclasses.results
+++ b/compilerplugins/clang/mergeclasses.results
@@ -92,7 +92,6 @@ merge SalPrinter with PspSalPrinter
merge SalSession with (anonymous namespace)::IceSalSession
merge SalSystem with SalGenericSystem
merge ScBiffReader with ScQProReader
-merge ScCbWarningBox with ScReplaceWarnBox
merge ScDBFunc with ScTabViewShell
merge ScDPCache::DBConnector with (anonymous namespace)::DBConnector
merge ScDocFunc with ScDocFuncDirect
diff --git a/sc/source/ui/inc/warnbox.hxx b/sc/source/ui/inc/warnbox.hxx
index d8a49cf021c8..c211a466665c 100644
--- a/sc/source/ui/inc/warnbox.hxx
+++ b/sc/source/ui/inc/warnbox.hxx
@@ -22,34 +22,17 @@
#include <vcl/msgbox.hxx>
-/** Message box with warning image and "Do not show again" checkbox. */
-class ScCbWarningBox : public WarningBox
+/** Warning box for "Replace cell contents?".
+ With warning image and "Do not show again" checkbox. */
+class ScReplaceWarnBox : public WarningBox
{
public:
- /** @param rMsgStr Resource ID for the message text. */
- ScCbWarningBox( vcl::Window* pParent, const OUString& rMsgStr );
+ ScReplaceWarnBox( vcl::Window* pParent );
/** Opens dialog if IsDialogEnabled() returns true.
@descr If after executing the dialog the checkbox "Do not show again" is set,
the method DisableDialog() will be called. */
virtual sal_Int16 Execute() override;
-
- /** Called before executing the dialog. If this method returns false, the dialog will not be opened. */
- virtual bool IsDialogEnabled();
- /** Called, when dialog is exited and the option "Do not show again" is set. */
- virtual void DisableDialog();
-};
-
-/** Warning box for "Replace cell contents?". */
-class ScReplaceWarnBox : public ScCbWarningBox
-{
-public:
- ScReplaceWarnBox( vcl::Window* pParent );
-
- /** Reads the configuration key "ReplaceCellsWarning". */
- virtual bool IsDialogEnabled() override;
- /** Sets the configuration key "ReplaceCellsWarning" to false. */
- virtual void DisableDialog() override;
};
#endif
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: */