Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "warnbox.hxx"
30 : :
31 : : #include "scmod.hxx"
32 : : #include "inputopt.hxx"
33 : : #include "scresid.hxx"
34 : : #include "sc.hrc"
35 : :
36 : :
37 : : // ============================================================================
38 : :
39 : 0 : ScCbWarningBox::ScCbWarningBox( Window* pParent, const String& rMsgStr, bool bDefYes ) :
40 [ # # ]: 0 : WarningBox( pParent, WB_YES_NO | (bDefYes ? WB_DEF_YES : WB_DEF_NO), rMsgStr )
41 : : {
42 : : // By default, the check box is ON, and the user needs to un-check it to
43 : : // disable all future warnings.
44 [ # # ]: 0 : SetCheckBoxState(true);
45 [ # # ][ # # ]: 0 : SetCheckBoxText(String(ScResId(SCSTR_WARN_ME_IN_FUTURE_CHECK)));
[ # # ][ # # ]
46 : 0 : }
47 : :
48 : 0 : sal_Int16 ScCbWarningBox::Execute()
49 : : {
50 [ # # ]: 0 : sal_Int16 nRet = (GetStyle() & WB_DEF_YES) ? RET_YES : RET_NO;
51 [ # # ]: 0 : if( IsDialogEnabled() )
52 : : {
53 : 0 : nRet = WarningBox::Execute();
54 [ # # ]: 0 : if (!GetCheckBoxState())
55 : 0 : DisableDialog();
56 : : }
57 : 0 : return nRet;
58 : : }
59 : :
60 : 0 : bool ScCbWarningBox::IsDialogEnabled()
61 : : {
62 : 0 : return true;
63 : : }
64 : :
65 : 0 : void ScCbWarningBox::DisableDialog()
66 : : {
67 : 0 : }
68 : :
69 : :
70 : : // ----------------------------------------------------------------------------
71 : :
72 : 0 : ScReplaceWarnBox::ScReplaceWarnBox( Window* pParent ) :
73 [ # # ][ # # ]: 0 : ScCbWarningBox( pParent, String( ScResId( STR_REPLCELLSWARN ) ), true )
[ # # ]
74 : : {
75 [ # # ]: 0 : SetHelpId( HID_SC_REPLCELLSWARN );
76 : 0 : }
77 : :
78 : 0 : bool ScReplaceWarnBox::IsDialogEnabled()
79 : : {
80 [ # # ]: 0 : return ((bool) SC_MOD()->GetInputOptions().GetReplaceCellsWarn()) == true;
81 : : }
82 : :
83 : 0 : void ScReplaceWarnBox::DisableDialog()
84 : : {
85 [ # # ]: 0 : ScModule* pScMod = SC_MOD();
86 [ # # ][ # # ]: 0 : ScInputOptions aInputOpt( pScMod->GetInputOptions() );
87 : 0 : aInputOpt.SetReplaceCellsWarn( false );
88 [ # # ][ # # ]: 0 : pScMod->SetInputOptions( aInputOpt );
89 : 0 : }
90 : :
91 : :
92 : : // ============================================================================
93 : :
94 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|