1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #undef SC_DLLIMPLEMENTATION
22 //------------------------------------------------------------------
24 #include "delcodlg.hxx"
25 #include "scresid.hxx"
26 #include "miscdlgs.hrc"
29 //==================================================================
31 sal_Bool
ScDeleteContentsDlg::bPreviousAllCheck
= false;
32 sal_uInt16
ScDeleteContentsDlg::nPreviousChecks
= (IDF_DATETIME
| IDF_STRING
|
33 IDF_NOTE
| IDF_FORMULA
|
36 //-----------------------------------------------------------------------
38 ScDeleteContentsDlg::ScDeleteContentsDlg( Window
* pParent
,
39 sal_uInt16 nCheckDefaults
) :
40 ModalDialog ( pParent
, "DeleteContentsDialog", "modules/scalc/ui/deletecontents.ui" ),
42 bObjectsDisabled( false )
44 get( aBtnDelAll
, "deleteall" );
45 get( aBtnDelStrings
, "text" );
46 get( aBtnDelNumbers
, "numbers" );
47 get( aBtnDelDateTime
, "datetime" );
48 get( aBtnDelFormulas
, "formulas" );
49 get( aBtnDelNotes
, "comments" );
50 get( aBtnDelAttrs
, "formats" );
51 get( aBtnDelObjects
, "objects" );
54 if ( nCheckDefaults
!= 0 )
56 ScDeleteContentsDlg::nPreviousChecks
= nCheckDefaults
;
57 ScDeleteContentsDlg::bPreviousAllCheck
= false;
60 aBtnDelAll
->Check ( ScDeleteContentsDlg::bPreviousAllCheck
);
61 aBtnDelStrings
->Check ( IS_SET( IDF_STRING
,
62 ScDeleteContentsDlg::nPreviousChecks
) );
63 aBtnDelNumbers
->Check ( IS_SET( IDF_VALUE
,
64 ScDeleteContentsDlg::nPreviousChecks
) );
65 aBtnDelDateTime
->Check( IS_SET( IDF_DATETIME
,
66 ScDeleteContentsDlg::nPreviousChecks
) );
67 aBtnDelFormulas
->Check( IS_SET( IDF_FORMULA
,
68 ScDeleteContentsDlg::nPreviousChecks
) );
69 aBtnDelNotes
->Check ( IS_SET( IDF_NOTE
,
70 ScDeleteContentsDlg::nPreviousChecks
) );
71 aBtnDelAttrs
->Check ( IS_SET( IDF_ATTRIB
,
72 ScDeleteContentsDlg::nPreviousChecks
) );
73 aBtnDelObjects
->Check ( IS_SET( IDF_OBJECTS
,
74 ScDeleteContentsDlg::nPreviousChecks
) );
76 DisableChecks( aBtnDelAll
->IsChecked() );
78 aBtnDelAll
->SetClickHdl( LINK( this, ScDeleteContentsDlg
, DelAllHdl
) );
81 //------------------------------------------------------------------------
83 sal_uInt16
ScDeleteContentsDlg::GetDelContentsCmdBits() const
85 ScDeleteContentsDlg::nPreviousChecks
= 0;
87 if ( aBtnDelStrings
->IsChecked() )
88 ScDeleteContentsDlg::nPreviousChecks
= IDF_STRING
;
89 if ( aBtnDelNumbers
->IsChecked() )
90 ScDeleteContentsDlg::nPreviousChecks
|= IDF_VALUE
;
91 if ( aBtnDelDateTime
->IsChecked())
92 ScDeleteContentsDlg::nPreviousChecks
|= IDF_DATETIME
;
93 if ( aBtnDelFormulas
->IsChecked())
94 ScDeleteContentsDlg::nPreviousChecks
|= IDF_FORMULA
;
95 if ( aBtnDelNotes
->IsChecked() )
96 ScDeleteContentsDlg::nPreviousChecks
|= IDF_NOTE
;
97 if ( aBtnDelAttrs
->IsChecked() )
98 ScDeleteContentsDlg::nPreviousChecks
|= IDF_ATTRIB
;
99 if ( aBtnDelObjects
->IsChecked() )
100 ScDeleteContentsDlg::nPreviousChecks
|= IDF_OBJECTS
;
102 ScDeleteContentsDlg::bPreviousAllCheck
= aBtnDelAll
->IsChecked();
104 return ( (ScDeleteContentsDlg::bPreviousAllCheck
)
106 : ScDeleteContentsDlg::nPreviousChecks
);
109 //------------------------------------------------------------------------
111 void ScDeleteContentsDlg::DisableChecks( sal_Bool bDelAllChecked
)
113 if ( bDelAllChecked
)
115 aBtnDelStrings
->Disable();
116 aBtnDelNumbers
->Disable();
117 aBtnDelDateTime
->Disable();
118 aBtnDelFormulas
->Disable();
119 aBtnDelNotes
->Disable();
120 aBtnDelAttrs
->Disable();
121 aBtnDelObjects
->Disable();
125 aBtnDelStrings
->Enable();
126 aBtnDelNumbers
->Enable();
127 aBtnDelDateTime
->Enable();
128 aBtnDelFormulas
->Enable();
129 aBtnDelNotes
->Enable();
130 aBtnDelAttrs
->Enable();
131 if (bObjectsDisabled
)
132 aBtnDelObjects
->Disable();
134 aBtnDelObjects
->Enable();
138 //------------------------------------------------------------------------
140 void ScDeleteContentsDlg::DisableObjects()
142 bObjectsDisabled
= sal_True
;
143 aBtnDelObjects
->Check(false);
144 aBtnDelObjects
->Disable();
147 //------------------------------------------------------------------------
149 IMPL_LINK_NOARG_INLINE_START(ScDeleteContentsDlg
, DelAllHdl
)
151 DisableChecks( aBtnDelAll
->IsChecked() );
155 IMPL_LINK_NOARG_INLINE_END(ScDeleteContentsDlg
, DelAllHdl
)
157 ScDeleteContentsDlg::~ScDeleteContentsDlg()
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */