1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: delcodlg.cxx,v $
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"
34 #undef SC_DLLIMPLEMENTATION
38 //------------------------------------------------------------------
40 #include "delcodlg.hxx"
41 #include "scresid.hxx"
42 #include "miscdlgs.hrc"
45 //==================================================================
47 BOOL
ScDeleteContentsDlg::bPreviousAllCheck
= FALSE
;
48 USHORT
ScDeleteContentsDlg::nPreviousChecks
= (IDF_DATETIME
| IDF_STRING
|
49 IDF_NOTE
| IDF_FORMULA
|
52 //-----------------------------------------------------------------------
54 ScDeleteContentsDlg::ScDeleteContentsDlg( Window
* pParent
,
55 USHORT nCheckDefaults
) :
56 ModalDialog ( pParent
, ScResId( RID_SCDLG_DELCONT
) ),
58 aFlFrame ( this, ScResId( FL_FRAME
) ),
59 aBtnDelAll ( this, ScResId( BTN_DELALL
) ),
60 aBtnDelStrings ( this, ScResId( BTN_DELSTRINGS
) ),
61 aBtnDelNumbers ( this, ScResId( BTN_DELNUMBERS
) ),
62 aBtnDelDateTime ( this, ScResId( BTN_DELDATETIME
) ),
63 aBtnDelFormulas ( this, ScResId( BTN_DELFORMULAS
) ),
64 aBtnDelNotes ( this, ScResId( BTN_DELNOTES
) ),
65 aBtnDelAttrs ( this, ScResId( BTN_DELATTRS
) ),
66 aBtnDelObjects ( this, ScResId( BTN_DELOBJECTS
) ),
67 aBtnOk ( this, ScResId( BTN_OK
) ),
68 aBtnCancel ( this, ScResId( BTN_CANCEL
) ),
69 aBtnHelp ( this, ScResId( BTN_HELP
) ),
70 bObjectsDisabled( FALSE
)
72 if ( nCheckDefaults
!= 0 )
74 ScDeleteContentsDlg::nPreviousChecks
= nCheckDefaults
;
75 ScDeleteContentsDlg::bPreviousAllCheck
= FALSE
;
78 aBtnDelAll
.Check ( ScDeleteContentsDlg::bPreviousAllCheck
);
79 aBtnDelStrings
.Check ( IS_SET( IDF_STRING
,
80 ScDeleteContentsDlg::nPreviousChecks
) );
81 aBtnDelNumbers
.Check ( IS_SET( IDF_VALUE
,
82 ScDeleteContentsDlg::nPreviousChecks
) );
83 aBtnDelDateTime
.Check( IS_SET( IDF_DATETIME
,
84 ScDeleteContentsDlg::nPreviousChecks
) );
85 aBtnDelFormulas
.Check( IS_SET( IDF_FORMULA
,
86 ScDeleteContentsDlg::nPreviousChecks
) );
87 aBtnDelNotes
.Check ( IS_SET( IDF_NOTE
,
88 ScDeleteContentsDlg::nPreviousChecks
) );
89 aBtnDelAttrs
.Check ( IS_SET( IDF_ATTRIB
,
90 ScDeleteContentsDlg::nPreviousChecks
) );
91 aBtnDelObjects
.Check ( IS_SET( IDF_OBJECTS
,
92 ScDeleteContentsDlg::nPreviousChecks
) );
94 DisableChecks( aBtnDelAll
.IsChecked() );
96 aBtnDelAll
.SetClickHdl( LINK( this, ScDeleteContentsDlg
, DelAllHdl
) );
102 //------------------------------------------------------------------------
104 USHORT
ScDeleteContentsDlg::GetDelContentsCmdBits() const
106 ScDeleteContentsDlg::nPreviousChecks
= 0;
108 if ( aBtnDelStrings
.IsChecked() )
109 ScDeleteContentsDlg::nPreviousChecks
= IDF_STRING
;
110 if ( aBtnDelNumbers
.IsChecked() )
111 ScDeleteContentsDlg::nPreviousChecks
|= IDF_VALUE
;
112 if ( aBtnDelDateTime
.IsChecked())
113 ScDeleteContentsDlg::nPreviousChecks
|= IDF_DATETIME
;
114 if ( aBtnDelFormulas
.IsChecked())
115 ScDeleteContentsDlg::nPreviousChecks
|= IDF_FORMULA
;
116 if ( aBtnDelNotes
.IsChecked() )
117 ScDeleteContentsDlg::nPreviousChecks
|= IDF_NOTE
;
118 if ( aBtnDelAttrs
.IsChecked() )
119 ScDeleteContentsDlg::nPreviousChecks
|= IDF_ATTRIB
;
120 if ( aBtnDelObjects
.IsChecked() )
121 ScDeleteContentsDlg::nPreviousChecks
|= IDF_OBJECTS
;
123 ScDeleteContentsDlg::bPreviousAllCheck
= aBtnDelAll
.IsChecked();
125 return ( (ScDeleteContentsDlg::bPreviousAllCheck
)
127 : ScDeleteContentsDlg::nPreviousChecks
);
130 //------------------------------------------------------------------------
132 void ScDeleteContentsDlg::DisableChecks( BOOL bDelAllChecked
)
134 if ( bDelAllChecked
)
136 aBtnDelStrings
.Disable();
137 aBtnDelNumbers
.Disable();
138 aBtnDelDateTime
.Disable();
139 aBtnDelFormulas
.Disable();
140 aBtnDelNotes
.Disable();
141 aBtnDelAttrs
.Disable();
142 aBtnDelObjects
.Disable();
146 aBtnDelStrings
.Enable();
147 aBtnDelNumbers
.Enable();
148 aBtnDelDateTime
.Enable();
149 aBtnDelFormulas
.Enable();
150 aBtnDelNotes
.Enable();
151 aBtnDelAttrs
.Enable();
152 if (bObjectsDisabled
)
153 aBtnDelObjects
.Disable();
155 aBtnDelObjects
.Enable();
159 //------------------------------------------------------------------------
161 void ScDeleteContentsDlg::DisableObjects()
163 bObjectsDisabled
= TRUE
;
164 aBtnDelObjects
.Check(FALSE
);
165 aBtnDelObjects
.Disable();
168 //------------------------------------------------------------------------
170 IMPL_LINK_INLINE_START( ScDeleteContentsDlg
, DelAllHdl
, void *, EMPTYARG
)
172 DisableChecks( aBtnDelAll
.IsChecked() );
176 IMPL_LINK_INLINE_END( ScDeleteContentsDlg
, DelAllHdl
, void *, EMPTYARG
)
178 __EXPORT
ScDeleteContentsDlg::~ScDeleteContentsDlg()