xref: /trunk/main/sc/source/ui/miscdlgs/inscldlg.cxx (revision d2992cc17a5536db9d9cad92e33116a6ace952cf)
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 "inscldlg.hxx"
33 #include "scresid.hxx"
34 #include "miscdlgs.hrc"
35 
36 
37 static sal_uInt8 nInsItemChecked=0;
38 
39 //==================================================================
40 
41 ScInsertCellDlg::ScInsertCellDlg( Window* pParent,sal_Bool bDisallowCellMove) :
42     ModalDialog     ( pParent, ScResId( RID_SCDLG_INSCELL ) ),
43     //
44     aFlFrame        ( this, ScResId( FL_FRAME ) ),
45     aBtnCellsDown   ( this, ScResId( BTN_CELLSDOWN ) ),
46     aBtnCellsRight  ( this, ScResId( BTN_CELLSRIGHT ) ),
47     aBtnInsRows     ( this, ScResId( BTN_INSROWS ) ),
48     aBtnInsCols     ( this, ScResId( BTN_INSCOLS ) ),
49     aBtnOk          ( this, ScResId( BTN_OK ) ),
50     aBtnCancel      ( this, ScResId( BTN_CANCEL ) ),
51     aBtnHelp        ( this, ScResId( BTN_HELP ) )
52 {
53     if (bDisallowCellMove)
54     {
55         aBtnCellsDown.Disable();
56         aBtnCellsRight.Disable();
57         aBtnInsRows.Check();
58 
59         switch(nInsItemChecked)
60         {
61             case 2: aBtnInsRows   .Check();break;
62             case 3: aBtnInsCols   .Check();break;
63             default:aBtnInsRows   .Check();break;
64         }
65     }
66     else
67     {
68         switch(nInsItemChecked)
69         {
70             case 0: aBtnCellsDown .Check();break;
71             case 1: aBtnCellsRight.Check();break;
72             case 2: aBtnInsRows   .Check();break;
73             case 3: aBtnInsCols   .Check();break;
74         }
75     }
76     //-------------
77     FreeResource();
78 }
79 
80 //------------------------------------------------------------------------
81 
82 InsCellCmd ScInsertCellDlg::GetInsCellCmd() const
83 {
84     InsCellCmd nReturn = INS_NONE;
85 
86     if ( aBtnCellsDown.IsChecked() )
87     {
88         nInsItemChecked=0;
89         nReturn = INS_CELLSDOWN;
90     }
91     else if ( aBtnCellsRight.IsChecked())
92     {
93         nInsItemChecked=1;
94         nReturn = INS_CELLSRIGHT;
95     }
96     else if ( aBtnInsRows.IsChecked()   )
97     {
98         nInsItemChecked=2;
99         nReturn = INS_INSROWS;
100     }
101     else if ( aBtnInsCols.IsChecked()   )
102     {
103         nInsItemChecked=3;
104         nReturn = INS_INSCOLS;
105     }
106 
107     return nReturn;
108 }
109 
110 __EXPORT ScInsertCellDlg::~ScInsertCellDlg()
111 {
112 }
113 
114 
115 
116