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 : #undef SC_DLLIMPLEMENTATION
21 :
22 : #include "delcodlg.hxx"
23 : #include "scresid.hxx"
24 : #include "miscdlgs.hrc"
25 :
26 :
27 : bool ScDeleteContentsDlg::bPreviousAllCheck = false;
28 : sal_uInt16 ScDeleteContentsDlg::nPreviousChecks = (IDF_DATETIME | IDF_STRING |
29 : IDF_NOTE | IDF_FORMULA |
30 : IDF_VALUE);
31 :
32 0 : ScDeleteContentsDlg::ScDeleteContentsDlg( Window* pParent,
33 : sal_uInt16 nCheckDefaults ) :
34 : ModalDialog ( pParent, "DeleteContentsDialog", "modules/scalc/ui/deletecontents.ui" ),
35 :
36 0 : bObjectsDisabled( false )
37 : {
38 0 : get( aBtnDelAll, "deleteall" );
39 0 : get( aBtnDelStrings, "text" );
40 0 : get( aBtnDelNumbers, "numbers" );
41 0 : get( aBtnDelDateTime, "datetime" );
42 0 : get( aBtnDelFormulas, "formulas" );
43 0 : get( aBtnDelNotes, "comments" );
44 0 : get( aBtnDelAttrs, "formats" );
45 0 : get( aBtnDelObjects, "objects" );
46 0 : get( aBtnOk, "ok" );
47 :
48 0 : if ( nCheckDefaults != 0 )
49 : {
50 0 : ScDeleteContentsDlg::nPreviousChecks = nCheckDefaults;
51 0 : ScDeleteContentsDlg::bPreviousAllCheck = false;
52 : }
53 :
54 0 : aBtnDelAll->Check ( ScDeleteContentsDlg::bPreviousAllCheck );
55 0 : aBtnDelStrings->Check ( IS_SET( IDF_STRING,
56 0 : ScDeleteContentsDlg::nPreviousChecks ) );
57 0 : aBtnDelNumbers->Check ( IS_SET( IDF_VALUE,
58 0 : ScDeleteContentsDlg::nPreviousChecks ) );
59 0 : aBtnDelDateTime->Check( IS_SET( IDF_DATETIME,
60 0 : ScDeleteContentsDlg::nPreviousChecks ) );
61 0 : aBtnDelFormulas->Check( IS_SET( IDF_FORMULA,
62 0 : ScDeleteContentsDlg::nPreviousChecks ) );
63 0 : aBtnDelNotes->Check ( IS_SET( IDF_NOTE,
64 0 : ScDeleteContentsDlg::nPreviousChecks ) );
65 0 : aBtnDelAttrs->Check ( IS_SET( IDF_ATTRIB,
66 0 : ScDeleteContentsDlg::nPreviousChecks ) );
67 0 : aBtnDelObjects->Check ( IS_SET( IDF_OBJECTS,
68 0 : ScDeleteContentsDlg::nPreviousChecks ) );
69 :
70 0 : DisableChecks( aBtnDelAll->IsChecked() );
71 :
72 0 : aBtnDelAll->SetClickHdl( LINK( this, ScDeleteContentsDlg, DelAllHdl ) );
73 0 : }
74 :
75 0 : sal_uInt16 ScDeleteContentsDlg::GetDelContentsCmdBits() const
76 : {
77 0 : ScDeleteContentsDlg::nPreviousChecks = 0;
78 :
79 0 : if ( aBtnDelStrings->IsChecked() )
80 0 : ScDeleteContentsDlg::nPreviousChecks = IDF_STRING;
81 0 : if ( aBtnDelNumbers->IsChecked() )
82 0 : ScDeleteContentsDlg::nPreviousChecks |= IDF_VALUE;
83 0 : if ( aBtnDelDateTime->IsChecked())
84 0 : ScDeleteContentsDlg::nPreviousChecks |= IDF_DATETIME;
85 0 : if ( aBtnDelFormulas->IsChecked())
86 0 : ScDeleteContentsDlg::nPreviousChecks |= IDF_FORMULA;
87 0 : if ( aBtnDelNotes->IsChecked() )
88 0 : ScDeleteContentsDlg::nPreviousChecks |= IDF_NOTE;
89 0 : if ( aBtnDelAttrs->IsChecked() )
90 0 : ScDeleteContentsDlg::nPreviousChecks |= IDF_ATTRIB;
91 0 : if ( aBtnDelObjects->IsChecked() )
92 0 : ScDeleteContentsDlg::nPreviousChecks |= IDF_OBJECTS;
93 :
94 0 : ScDeleteContentsDlg::bPreviousAllCheck = aBtnDelAll->IsChecked();
95 :
96 : return ( (ScDeleteContentsDlg::bPreviousAllCheck)
97 : ? IDF_ALL
98 0 : : ScDeleteContentsDlg::nPreviousChecks );
99 : }
100 :
101 0 : void ScDeleteContentsDlg::DisableChecks( bool bDelAllChecked )
102 : {
103 0 : if ( bDelAllChecked )
104 : {
105 0 : aBtnDelStrings->Disable();
106 0 : aBtnDelNumbers->Disable();
107 0 : aBtnDelDateTime->Disable();
108 0 : aBtnDelFormulas->Disable();
109 0 : aBtnDelNotes->Disable();
110 0 : aBtnDelAttrs->Disable();
111 0 : aBtnDelObjects->Disable();
112 : }
113 : else
114 : {
115 0 : aBtnDelStrings->Enable();
116 0 : aBtnDelNumbers->Enable();
117 0 : aBtnDelDateTime->Enable();
118 0 : aBtnDelFormulas->Enable();
119 0 : aBtnDelNotes->Enable();
120 0 : aBtnDelAttrs->Enable();
121 0 : if (bObjectsDisabled)
122 0 : aBtnDelObjects->Disable();
123 : else
124 0 : aBtnDelObjects->Enable();
125 : }
126 0 : }
127 :
128 0 : void ScDeleteContentsDlg::DisableObjects()
129 : {
130 0 : bObjectsDisabled = true;
131 0 : aBtnDelObjects->Check(false);
132 0 : aBtnDelObjects->Disable();
133 0 : }
134 :
135 0 : IMPL_LINK_NOARG_INLINE_START(ScDeleteContentsDlg, DelAllHdl)
136 : {
137 0 : DisableChecks( aBtnDelAll->IsChecked() );
138 :
139 0 : return 0;
140 : }
141 0 : IMPL_LINK_NOARG_INLINE_END(ScDeleteContentsDlg, DelAllHdl)
142 :
143 0 : ScDeleteContentsDlg::~ScDeleteContentsDlg()
144 : {
145 0 : }
146 :
147 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|