xref: /trunk/main/sc/source/ui/miscdlgs/delcldlg.cxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
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_scui.hxx"
26 
27 
28 
29 
30 //------------------------------------------------------------------
31 
32 #include "delcldlg.hxx"
33 #include "scresid.hxx"
34 #include "miscdlgs.hrc"
35 
36 
37 static sal_uInt8 nDelItemChecked=0;
38 
39 //==================================================================
40 
41 ScDeleteCellDlg::ScDeleteCellDlg( Window* pParent, sal_Bool bDisallowCellMove ) :
42     ModalDialog     ( pParent, ScResId( RID_SCDLG_DELCELL ) ),
43     //
44     aFlFrame        ( this, ScResId( FL_FRAME ) ),
45     aBtnCellsUp     ( this, ScResId( BTN_CELLSUP ) ),
46     aBtnCellsLeft   ( this, ScResId( BTN_CELLSLEFT ) ),
47     aBtnDelRows     ( this, ScResId( BTN_DELROWS ) ),
48     aBtnDelCols     ( this, ScResId( BTN_DELCOLS ) ),
49     aBtnOk          ( this, ScResId( BTN_OK ) ),
50     aBtnCancel      ( this, ScResId( BTN_CANCEL ) ),
51     aBtnHelp        ( this, ScResId( BTN_HELP ) )
52 {
53 
54     if (bDisallowCellMove)
55     {
56         aBtnCellsUp.Disable();
57         aBtnCellsLeft.Disable();
58 
59         switch(nDelItemChecked)
60         {
61             case 2: aBtnDelRows.Check();break;
62             case 3: aBtnDelCols.Check();break;
63             default:aBtnDelRows.Check();break;
64         }
65     }
66     else
67     {
68         switch(nDelItemChecked)
69         {
70             case 0: aBtnCellsUp.Check();break;
71             case 1: aBtnCellsLeft.Check();break;
72             case 2: aBtnDelRows.Check();break;
73             case 3: aBtnDelCols.Check();break;
74         }
75     }
76 
77     FreeResource();
78 }
79 
80 //------------------------------------------------------------------------
81 
82 DelCellCmd ScDeleteCellDlg::GetDelCellCmd() const
83 {
84     DelCellCmd nReturn = DEL_NONE;
85 
86     if ( aBtnCellsUp.IsChecked()   )
87     {
88         nDelItemChecked=0;
89         nReturn = DEL_CELLSUP;
90     }
91     else if ( aBtnCellsLeft.IsChecked() )
92     {
93         nDelItemChecked=1;
94         nReturn = DEL_CELLSLEFT;
95     }
96     else if ( aBtnDelRows.IsChecked()   )
97     {
98         nDelItemChecked=2;
99         nReturn = DEL_DELROWS;
100     }
101     else if ( aBtnDelCols.IsChecked()   )
102     {
103         nDelItemChecked=3;
104         nReturn = DEL_DELCOLS;
105     }
106 
107     return nReturn;
108 }
109 
110 __EXPORT ScDeleteCellDlg::~ScDeleteCellDlg()
111 {
112 }
113