xref: /AOO41X/main/sc/source/ui/miscdlgs/delcldlg.cxx (revision b3f79822e811ac3493b185030a72c3c5a51f32d8)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sc.hxx"
26 
27 #undef SC_DLLIMPLEMENTATION
28 
29 
30 
31 //------------------------------------------------------------------
32 
33 #include "delcldlg.hxx"
34 #include "scresid.hxx"
35 #include "miscdlgs.hrc"
36 
37 
38 static sal_uInt8 nDelItemChecked=0;
39 
40 //==================================================================
41 
ScDeleteCellDlg(Window * pParent,sal_Bool bDisallowCellMove)42 ScDeleteCellDlg::ScDeleteCellDlg( Window* pParent, sal_Bool bDisallowCellMove ) :
43     ModalDialog     ( pParent, ScResId( RID_SCDLG_DELCELL ) ),
44     //
45     aFlFrame        ( this, ScResId( FL_FRAME ) ),
46     aBtnCellsUp     ( this, ScResId( BTN_CELLSUP ) ),
47     aBtnCellsLeft   ( this, ScResId( BTN_CELLSLEFT ) ),
48     aBtnDelRows     ( this, ScResId( BTN_DELROWS ) ),
49     aBtnDelCols     ( this, ScResId( BTN_DELCOLS ) ),
50     aBtnOk          ( this, ScResId( BTN_OK ) ),
51     aBtnCancel      ( this, ScResId( BTN_CANCEL ) ),
52     aBtnHelp        ( this, ScResId( BTN_HELP ) )
53 {
54 
55     if (bDisallowCellMove)
56     {
57         aBtnCellsUp.Disable();
58         aBtnCellsLeft.Disable();
59 
60         switch(nDelItemChecked)
61         {
62             case 2: aBtnDelRows.Check();break;
63             case 3: aBtnDelCols.Check();break;
64             default:aBtnDelRows.Check();break;
65         }
66     }
67     else
68     {
69         switch(nDelItemChecked)
70         {
71             case 0: aBtnCellsUp.Check();break;
72             case 1: aBtnCellsLeft.Check();break;
73             case 2: aBtnDelRows.Check();break;
74             case 3: aBtnDelCols.Check();break;
75         }
76     }
77 
78     FreeResource();
79 }
80 
81 //------------------------------------------------------------------------
82 
GetDelCellCmd() const83 DelCellCmd ScDeleteCellDlg::GetDelCellCmd() const
84 {
85     DelCellCmd nReturn = DEL_NONE;
86 
87     if ( aBtnCellsUp.IsChecked()   )
88     {
89         nDelItemChecked=0;
90         nReturn = DEL_CELLSUP;
91     }
92     else if ( aBtnCellsLeft.IsChecked() )
93     {
94         nDelItemChecked=1;
95         nReturn = DEL_CELLSLEFT;
96     }
97     else if ( aBtnDelRows.IsChecked()   )
98     {
99         nDelItemChecked=2;
100         nReturn = DEL_DELROWS;
101     }
102     else if ( aBtnDelCols.IsChecked()   )
103     {
104         nDelItemChecked=3;
105         nReturn = DEL_DELCOLS;
106     }
107 
108     return nReturn;
109 }
110 
~ScDeleteCellDlg()111 __EXPORT ScDeleteCellDlg::~ScDeleteCellDlg()
112 {
113 }
114 
115 
116 
117