Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #undef SC_DLLIMPLEMENTATION
22 :
23 :
24 :
25 : //------------------------------------------------------------------
26 :
27 : #include "delcodlg.hxx"
28 : #include "scresid.hxx"
29 : #include "miscdlgs.hrc"
30 :
31 :
32 : //==================================================================
33 :
34 : sal_Bool ScDeleteContentsDlg::bPreviousAllCheck = false;
35 : sal_uInt16 ScDeleteContentsDlg::nPreviousChecks = (IDF_DATETIME | IDF_STRING |
36 : IDF_NOTE | IDF_FORMULA |
37 : IDF_VALUE);
38 :
39 : //-----------------------------------------------------------------------
40 :
41 0 : ScDeleteContentsDlg::ScDeleteContentsDlg( Window* pParent,
42 : sal_uInt16 nCheckDefaults ) :
43 : ModalDialog ( pParent, ScResId( RID_SCDLG_DELCONT ) ),
44 : //
45 : aFlFrame ( this, ScResId( FL_FRAME ) ),
46 : aBtnDelAll ( this, ScResId( BTN_DELALL ) ),
47 : aBtnDelStrings ( this, ScResId( BTN_DELSTRINGS ) ),
48 : aBtnDelNumbers ( this, ScResId( BTN_DELNUMBERS ) ),
49 : aBtnDelDateTime ( this, ScResId( BTN_DELDATETIME ) ),
50 : aBtnDelFormulas ( this, ScResId( BTN_DELFORMULAS ) ),
51 : aBtnDelNotes ( this, ScResId( BTN_DELNOTES ) ),
52 : aBtnDelAttrs ( this, ScResId( BTN_DELATTRS ) ),
53 : aBtnDelObjects ( this, ScResId( BTN_DELOBJECTS ) ),
54 : aBtnOk ( this, ScResId( BTN_OK ) ),
55 : aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
56 : aBtnHelp ( this, ScResId( BTN_HELP ) ),
57 0 : bObjectsDisabled( false )
58 : {
59 0 : if ( nCheckDefaults != 0 )
60 : {
61 0 : ScDeleteContentsDlg::nPreviousChecks = nCheckDefaults;
62 0 : ScDeleteContentsDlg::bPreviousAllCheck = false;
63 : }
64 :
65 0 : aBtnDelAll.Check ( ScDeleteContentsDlg::bPreviousAllCheck );
66 : aBtnDelStrings.Check ( IS_SET( IDF_STRING,
67 0 : ScDeleteContentsDlg::nPreviousChecks ) );
68 : aBtnDelNumbers.Check ( IS_SET( IDF_VALUE,
69 0 : ScDeleteContentsDlg::nPreviousChecks ) );
70 : aBtnDelDateTime.Check( IS_SET( IDF_DATETIME,
71 0 : ScDeleteContentsDlg::nPreviousChecks ) );
72 : aBtnDelFormulas.Check( IS_SET( IDF_FORMULA,
73 0 : ScDeleteContentsDlg::nPreviousChecks ) );
74 : aBtnDelNotes.Check ( IS_SET( IDF_NOTE,
75 0 : ScDeleteContentsDlg::nPreviousChecks ) );
76 : aBtnDelAttrs.Check ( IS_SET( IDF_ATTRIB,
77 0 : ScDeleteContentsDlg::nPreviousChecks ) );
78 : aBtnDelObjects.Check ( IS_SET( IDF_OBJECTS,
79 0 : ScDeleteContentsDlg::nPreviousChecks ) );
80 :
81 0 : DisableChecks( aBtnDelAll.IsChecked() );
82 :
83 0 : aBtnDelAll.SetClickHdl( LINK( this, ScDeleteContentsDlg, DelAllHdl ) );
84 :
85 : //-------------
86 0 : FreeResource();
87 0 : }
88 :
89 : //------------------------------------------------------------------------
90 :
91 0 : sal_uInt16 ScDeleteContentsDlg::GetDelContentsCmdBits() const
92 : {
93 0 : ScDeleteContentsDlg::nPreviousChecks = 0;
94 :
95 0 : if ( aBtnDelStrings.IsChecked() )
96 0 : ScDeleteContentsDlg::nPreviousChecks = IDF_STRING;
97 0 : if ( aBtnDelNumbers.IsChecked() )
98 0 : ScDeleteContentsDlg::nPreviousChecks |= IDF_VALUE;
99 0 : if ( aBtnDelDateTime.IsChecked())
100 0 : ScDeleteContentsDlg::nPreviousChecks |= IDF_DATETIME;
101 0 : if ( aBtnDelFormulas.IsChecked())
102 0 : ScDeleteContentsDlg::nPreviousChecks |= IDF_FORMULA;
103 0 : if ( aBtnDelNotes.IsChecked() )
104 0 : ScDeleteContentsDlg::nPreviousChecks |= IDF_NOTE;
105 0 : if ( aBtnDelAttrs.IsChecked() )
106 0 : ScDeleteContentsDlg::nPreviousChecks |= IDF_ATTRIB;
107 0 : if ( aBtnDelObjects.IsChecked() )
108 0 : ScDeleteContentsDlg::nPreviousChecks |= IDF_OBJECTS;
109 :
110 0 : ScDeleteContentsDlg::bPreviousAllCheck = aBtnDelAll.IsChecked();
111 :
112 : return ( (ScDeleteContentsDlg::bPreviousAllCheck)
113 : ? IDF_ALL
114 0 : : ScDeleteContentsDlg::nPreviousChecks );
115 : }
116 :
117 : //------------------------------------------------------------------------
118 :
119 0 : void ScDeleteContentsDlg::DisableChecks( sal_Bool bDelAllChecked )
120 : {
121 0 : if ( bDelAllChecked )
122 : {
123 0 : aBtnDelStrings.Disable();
124 0 : aBtnDelNumbers.Disable();
125 0 : aBtnDelDateTime.Disable();
126 0 : aBtnDelFormulas.Disable();
127 0 : aBtnDelNotes.Disable();
128 0 : aBtnDelAttrs.Disable();
129 0 : aBtnDelObjects.Disable();
130 : }
131 : else
132 : {
133 0 : aBtnDelStrings.Enable();
134 0 : aBtnDelNumbers.Enable();
135 0 : aBtnDelDateTime.Enable();
136 0 : aBtnDelFormulas.Enable();
137 0 : aBtnDelNotes.Enable();
138 0 : aBtnDelAttrs.Enable();
139 0 : if (bObjectsDisabled)
140 0 : aBtnDelObjects.Disable();
141 : else
142 0 : aBtnDelObjects.Enable();
143 : }
144 0 : }
145 :
146 : //------------------------------------------------------------------------
147 :
148 0 : void ScDeleteContentsDlg::DisableObjects()
149 : {
150 0 : bObjectsDisabled = sal_True;
151 0 : aBtnDelObjects.Check(false);
152 0 : aBtnDelObjects.Disable();
153 0 : }
154 :
155 : //------------------------------------------------------------------------
156 :
157 0 : IMPL_LINK_NOARG_INLINE_START(ScDeleteContentsDlg, DelAllHdl)
158 : {
159 0 : DisableChecks( aBtnDelAll.IsChecked() );
160 :
161 0 : return 0;
162 : }
163 0 : IMPL_LINK_NOARG_INLINE_END(ScDeleteContentsDlg, DelAllHdl)
164 :
165 0 : ScDeleteContentsDlg::~ScDeleteContentsDlg()
166 : {
167 0 : }
168 :
169 :
170 :
171 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|