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