xref: /aoo41x/main/sc/source/ui/miscdlgs/inscldlg.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sc.hxx"
30 
31 #undef SC_DLLIMPLEMENTATION
32 
33 
34 
35 //------------------------------------------------------------------
36 
37 #include "inscldlg.hxx"
38 #include "scresid.hxx"
39 #include "miscdlgs.hrc"
40 
41 
42 static sal_uInt8 nInsItemChecked=0;
43 
44 //==================================================================
45 
46 ScInsertCellDlg::ScInsertCellDlg( Window* pParent,sal_Bool bDisallowCellMove) :
47 	ModalDialog     ( pParent, ScResId( RID_SCDLG_INSCELL ) ),
48 	//
49     aFlFrame        ( this, ScResId( FL_FRAME ) ),
50 	aBtnCellsDown   ( this, ScResId( BTN_CELLSDOWN ) ),
51 	aBtnCellsRight  ( this, ScResId( BTN_CELLSRIGHT ) ),
52 	aBtnInsRows     ( this, ScResId( BTN_INSROWS ) ),
53 	aBtnInsCols     ( this, ScResId( BTN_INSCOLS ) ),
54 	aBtnOk          ( this, ScResId( BTN_OK ) ),
55 	aBtnCancel      ( this, ScResId( BTN_CANCEL ) ),
56 	aBtnHelp        ( this, ScResId( BTN_HELP ) )
57 {
58 	if (bDisallowCellMove)
59 	{
60 		aBtnCellsDown.Disable();
61 		aBtnCellsRight.Disable();
62 		aBtnInsRows.Check();
63 
64 		switch(nInsItemChecked)
65 		{
66 			case 2: aBtnInsRows   .Check();break;
67 			case 3: aBtnInsCols   .Check();break;
68 			default:aBtnInsRows   .Check();break;
69 		}
70 	}
71 	else
72 	{
73 		switch(nInsItemChecked)
74 		{
75 			case 0: aBtnCellsDown .Check();break;
76 			case 1: aBtnCellsRight.Check();break;
77 			case 2: aBtnInsRows   .Check();break;
78 			case 3: aBtnInsCols   .Check();break;
79 		}
80 	}
81 	//-------------
82 	FreeResource();
83 }
84 
85 //------------------------------------------------------------------------
86 
87 InsCellCmd ScInsertCellDlg::GetInsCellCmd() const
88 {
89 	InsCellCmd nReturn = INS_NONE;
90 
91 	if ( aBtnCellsDown.IsChecked() )
92 	{
93 		nInsItemChecked=0;
94 		nReturn = INS_CELLSDOWN;
95 	}
96 	else if ( aBtnCellsRight.IsChecked())
97 	{
98 		nInsItemChecked=1;
99 		nReturn = INS_CELLSRIGHT;
100 	}
101 	else if ( aBtnInsRows.IsChecked()   )
102 	{
103 		nInsItemChecked=2;
104 		nReturn = INS_INSROWS;
105 	}
106 	else if ( aBtnInsCols.IsChecked()   )
107 	{
108 		nInsItemChecked=3;
109 		nReturn = INS_INSCOLS;
110 	}
111 
112 	return nReturn;
113 }
114 
115 __EXPORT ScInsertCellDlg::~ScInsertCellDlg()
116 {
117 }
118 
119 
120 
121