loplugin:mergeclasse merge ScCbWarningBox with ScReplaceWarnBo
Change-Id: I7b55b036c1992b88b01b51053a3560e9f97986c9
This commit is contained in:
parent
0f67b8626b
commit
2a504a24e4
@ -92,7 +92,6 @@ merge SalPrinter with PspSalPrinter
|
|||||||
merge SalSession with (anonymous namespace)::IceSalSession
|
merge SalSession with (anonymous namespace)::IceSalSession
|
||||||
merge SalSystem with SalGenericSystem
|
merge SalSystem with SalGenericSystem
|
||||||
merge ScBiffReader with ScQProReader
|
merge ScBiffReader with ScQProReader
|
||||||
merge ScCbWarningBox with ScReplaceWarnBox
|
|
||||||
merge ScDBFunc with ScTabViewShell
|
merge ScDBFunc with ScTabViewShell
|
||||||
merge ScDPCache::DBConnector with (anonymous namespace)::DBConnector
|
merge ScDPCache::DBConnector with (anonymous namespace)::DBConnector
|
||||||
merge ScDocFunc with ScDocFuncDirect
|
merge ScDocFunc with ScDocFuncDirect
|
||||||
|
@ -22,34 +22,17 @@
|
|||||||
|
|
||||||
#include <vcl/msgbox.hxx>
|
#include <vcl/msgbox.hxx>
|
||||||
|
|
||||||
/** Message box with warning image and "Do not show again" checkbox. */
|
/** Warning box for "Replace cell contents?".
|
||||||
class ScCbWarningBox : public WarningBox
|
With warning image and "Do not show again" checkbox. */
|
||||||
|
class ScReplaceWarnBox : public WarningBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** @param rMsgStr Resource ID for the message text. */
|
ScReplaceWarnBox( vcl::Window* pParent );
|
||||||
ScCbWarningBox( vcl::Window* pParent, const OUString& rMsgStr );
|
|
||||||
|
|
||||||
/** Opens dialog if IsDialogEnabled() returns true.
|
/** Opens dialog if IsDialogEnabled() returns true.
|
||||||
@descr If after executing the dialog the checkbox "Do not show again" is set,
|
@descr If after executing the dialog the checkbox "Do not show again" is set,
|
||||||
the method DisableDialog() will be called. */
|
the method DisableDialog() will be called. */
|
||||||
virtual sal_Int16 Execute() override;
|
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
|
#endif
|
||||||
|
@ -24,53 +24,31 @@
|
|||||||
#include "scresid.hxx"
|
#include "scresid.hxx"
|
||||||
#include "sc.hrc"
|
#include "sc.hrc"
|
||||||
|
|
||||||
ScCbWarningBox::ScCbWarningBox( vcl::Window* pParent, const OUString& rMsgStr ) :
|
ScReplaceWarnBox::ScReplaceWarnBox( vcl::Window* pParent ) :
|
||||||
WarningBox( pParent, WB_YES_NO | WB_DEF_YES, rMsgStr )
|
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
|
// By default, the check box is ON, and the user needs to un-check it to
|
||||||
// disable all future warnings.
|
// disable all future warnings.
|
||||||
SetCheckBoxState(true);
|
SetCheckBoxState(true);
|
||||||
SetCheckBoxText(ScResId(SCSTR_WARN_ME_IN_FUTURE_CHECK));
|
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;
|
sal_Int16 nRet = RET_YES;
|
||||||
if( IsDialogEnabled() )
|
if( (bool) SC_MOD()->GetInputOptions().GetReplaceCellsWarn() )
|
||||||
{
|
{
|
||||||
nRet = WarningBox::Execute();
|
nRet = WarningBox::Execute();
|
||||||
if (!GetCheckBoxState())
|
if (!GetCheckBoxState())
|
||||||
DisableDialog();
|
{
|
||||||
|
ScModule* pScMod = SC_MOD();
|
||||||
|
ScInputOptions aInputOpt( pScMod->GetInputOptions() );
|
||||||
|
aInputOpt.SetReplaceCellsWarn( false );
|
||||||
|
pScMod->SetInputOptions( aInputOpt );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nRet;
|
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: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user