update dev300-m58
[ooovba.git] / sc / source / ui / miscdlgs / warnbox.cxx
blobc32c138b72eb4d50b4d01da1045a350070cf7eaa
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: warnbox.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
33 #include "warnbox.hxx"
35 #include "scmod.hxx"
36 #include "inputopt.hxx"
37 #include "scresid.hxx"
38 #include "sc.hrc"
41 // ============================================================================
43 ScCbWarningBox::ScCbWarningBox( Window* pParent, const String& rMsgStr, bool bDefYes ) :
44 WarningBox( pParent, WB_YES_NO | (bDefYes ? WB_DEF_YES : WB_DEF_NO), rMsgStr )
46 SetDefaultCheckBoxText();
49 sal_Int16 ScCbWarningBox::Execute()
51 sal_Int16 nRet = (GetStyle() & WB_DEF_YES) ? RET_YES : RET_NO;
52 if( IsDialogEnabled() )
54 nRet = WarningBox::Execute();
55 if( GetCheckBoxState() )
56 DisableDialog();
58 return nRet;
61 bool ScCbWarningBox::IsDialogEnabled()
63 return true;
66 void ScCbWarningBox::DisableDialog()
71 // ----------------------------------------------------------------------------
73 ScReplaceWarnBox::ScReplaceWarnBox( Window* pParent ) :
74 ScCbWarningBox( pParent, String( ScResId( STR_REPLCELLSWARN ) ), true )
76 SetHelpId( HID_SC_REPLCELLSWARN );
79 bool ScReplaceWarnBox::IsDialogEnabled()
81 return SC_MOD()->GetInputOptions().GetReplaceCellsWarn() == TRUE;
84 void ScReplaceWarnBox::DisableDialog()
86 ScModule* pScMod = SC_MOD();
87 ScInputOptions aInputOpt( pScMod->GetInputOptions() );
88 aInputOpt.SetReplaceCellsWarn( FALSE );
89 pScMod->SetInputOptions( aInputOpt );
93 // ============================================================================