xref: /aoo4110/main/soldep/source/soldlg.cxx (revision b1cdbd2c)
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 #include <tools/geninfo.hxx>
25 //#include "depapp.hxx"
26 #include <soldep/soldep.hxx>
27 #include <soldep/soldlg.hxx>
28 #include <soldep/soldlg.hrc>
29 
30 #ifndef SOLARIS
31 #define SIZE( nX, nY) 	\
32 	LogicToLogic(Size(nX,nY),&MapMode(MAP_APPFONT),&GetMapMode())
33 #define POS(nX, nY)	\
34 	LogicToLogic(Point(nX,nY),&MapMode(MAP_APPFONT),&GetMapMode())
35 #else
36 #define SIZE( nX, nY) 	\
37         LogicToLogic(Size(nX,nY),MapMode(MAP_APPFONT),GetMapMode())
38 #define POS(nX, nY)	\
39         LogicToLogic(Point(nX,nY),MapMode(MAP_APPFONT),GetMapMode())
40 #endif
41 
42 
43 //
44 // class SolNewProjectDlg
45 //
46 
47 /*****************************************************************************/
SolNewProjectDlg(Window * pParent,const ResId & rResId)48 SolNewProjectDlg::SolNewProjectDlg( Window* pParent, const ResId& rResId )
49 /*****************************************************************************/
50 				: ModalDialog( pParent, rResId ),
51 				maOkButton( this, DtSodResId( BTN_OK )),
52 				maCancelButton( this, DtSodResId( BTN_CANCEL )),
53 				maFTName( this, DtSodResId( FT_PRJNAME )),
54 				maEName( this, DtSodResId( EDIT_PRJNAME )),
55 				maFTShort( this, DtSodResId( FT_PRJSHORT )),
56 				maEShort( this, DtSodResId( EDIT_PRJSHORT )),
57 				maFTDeps( this, DtSodResId( FT_PRJDEPS )),
58 				maEDeps( this, DtSodResId( EDIT_PRJDEPS ))
59 {
60 	FreeResource();
61 	maOkButton.SetClickHdl( LINK( this, SolNewProjectDlg, OkHdl ));
62 	maCancelButton.SetClickHdl( LINK( this, SolNewProjectDlg, CancelHdl ));
63 }
64 
65 /*****************************************************************************/
IMPL_LINK(SolNewProjectDlg,OkHdl,Button *,pOkBtn)66 IMPL_LINK( SolNewProjectDlg, OkHdl, Button*, pOkBtn )
67 /*****************************************************************************/
68 {
69 	EndDialog( 1 );
70 	return 0;
71 }
72 
73 /*****************************************************************************/
IMPL_LINK(SolNewProjectDlg,CancelHdl,Button *,pCancelBtn)74 IMPL_LINK( SolNewProjectDlg, CancelHdl, Button*,  pCancelBtn )
75 /*****************************************************************************/
76 {
77 	EndDialog( 0 );
78 	return 0;
79 }
80 
81 //
82 // class SolNewDirectoryDlg
83 //
84 
85 /*****************************************************************************/
SolNewDirectoryDlg(Window * pParent,const ResId & rResId)86 SolNewDirectoryDlg::SolNewDirectoryDlg( Window* pParent, const ResId& rResId )
87 /*****************************************************************************/
88 				: ModalDialog( pParent, rResId ),
89 				maOkButton( this, DtSodResId( BTN_OK )),
90 				maCancelButton( this, DtSodResId( BTN_CANCEL )),
91 				maFTName( this, DtSodResId( FT_DIRNAME )),
92 				maEName( this, DtSodResId( EDIT_DIRNAME )),
93 				maFTFlag( this, DtSodResId( FT_DIRFLAG )),
94 				maEFlag( this, DtSodResId( EDIT_DIRFLAG )),
95 				maFTDeps( this, DtSodResId( FT_DIRDEPS )),
96 				maEDeps( this, DtSodResId( EDIT_DIRDEPS )),
97 				maFTAction( this, DtSodResId( FT_DIRACTION )),
98 				maEAction( this, DtSodResId( EDIT_DIRACTION )),
99 				maFTEnv( this, DtSodResId( FT_DIRENV )),
100 				maEEnv( this, DtSodResId( EDIT_DIRENV ))
101 {
102 	FreeResource();
103 	maOkButton.SetClickHdl( LINK( this, SolNewDirectoryDlg, OkHdl ));
104 	maCancelButton.SetClickHdl( LINK( this, SolNewDirectoryDlg, CancelHdl ));
105 }
106 
107 /*****************************************************************************/
IMPL_LINK(SolNewDirectoryDlg,OkHdl,Button *,pOkBtn)108 IMPL_LINK( SolNewDirectoryDlg, OkHdl, Button*, pOkBtn )
109 /*****************************************************************************/
110 {
111 	EndDialog( 1 );
112 	return 0;
113 }
114 
115 /*****************************************************************************/
IMPL_LINK(SolNewDirectoryDlg,CancelHdl,Button *,pCancelBtn)116 IMPL_LINK( SolNewDirectoryDlg, CancelHdl, Button*,  pCancelBtn )
117 /*****************************************************************************/
118 {
119 	EndDialog( 0 );
120 	return 0;
121 }
122 
123 //
124 // class SolHelpDlg
125 //
126 
127 /*****************************************************************************/
SolHelpDlg(Window * pParent,const ResId & rResId)128 SolHelpDlg::SolHelpDlg( Window* pParent, const ResId& rResId )
129 /*****************************************************************************/
130 				: ModalDialog( pParent, rResId ),
131 				maOkButton( this, DtSodResId( BTN_OK )),
132 				maMLEHelp( this, DtSodResId( EDIT_HELP ))
133 {
134 	FreeResource();
135 	maOkButton.SetClickHdl( LINK( this, SolHelpDlg, OkHdl ));
136 }
137 
138 /*****************************************************************************/
IMPL_LINK(SolHelpDlg,OkHdl,Button *,pOkBtn)139 IMPL_LINK( SolHelpDlg, OkHdl, Button*, pOkBtn )
140 /*****************************************************************************/
141 {
142 	EndDialog( 1 );
143 	return 0;
144 }
145 
146 //
147 // class SolSelectVersionDlg
148 //
149 
150 /*****************************************************************************/
SolSelectVersionDlg(Window * pParent,GenericInformationList * pStandLst)151 SolSelectVersionDlg::SolSelectVersionDlg(
152 	Window *pParent, GenericInformationList *pStandLst )
153 /*****************************************************************************/
154 				: ModalDialog( pParent, DtSodResId( DLG_VERSIONSELECT )),
155 				maVersionListBox( this, DtSodResId( DLG_VERSIONSELECT_LISTBOX )),
156 				maVersionGroupBox( this, DtSodResId( DLG_VERSIONSELECT_GROUP )),
157 				maMinorEditBox( this, DtSodResId( DLG_MINORSELECT_EDIT )),
158 				maMinorGroupBox( this, DtSodResId( DLG_MINORSELECT_GROUP )),
159 				maOKButton( this, DtSodResId( DLG_VERSIONSELECT_OK	)),
160 				maCancelButton( this, DtSodResId( DLG_VERSIONSELECT_CANCEL ))
161 {
162 	FreeResource();
163 	//Fill the ListBox with MWS versions (e.g. SRC680) from "stand.lst"
164 	for ( sal_uIntPtr i = 0; i < pStandLst->Count(); i++ ) {
165 		String sVersion( *pStandLst->GetObject( i ), RTL_TEXTENCODING_ASCII_US );
166 		maVersionListBox.InsertEntry( sVersion );
167 	}
168 
169 	if ( pStandLst->Count())
170 		maVersionListBox.SelectEntryPos( 0 );
171 
172 	maVersionListBox.SetDoubleClickHdl(
173 		LINK( this, SolSelectVersionDlg, DoubleClickHdl ));
174 
175 }
176 
177 /*****************************************************************************/
GetVersionMajor()178 ByteString SolSelectVersionDlg::GetVersionMajor()
179 /*****************************************************************************/
180 {
181 	//Returns the selected version
182 	return ByteString(maVersionListBox.GetSelectEntry(), RTL_TEXTENCODING_ASCII_US );
183 }
184 
185 /*****************************************************************************/
GetVersionMinor()186 ByteString SolSelectVersionDlg::GetVersionMinor()
187 /*****************************************************************************/
188 {
189 	//Returns the minor
190 	ByteString minor = ByteString(maMinorEditBox.GetText(), RTL_TEXTENCODING_ASCII_US );
191 	//check for correctness (format: "m1234")
192 	//"m123s8" is unsupported because 'steps' aren't used anymore
193 	minor.EraseLeadingAndTrailingChars();
194 	int check = minor.SearchChar("m");
195 	if (check == 0)
196 	{
197 		ByteString check2 = minor.Copy(1,(minor.Len()-1));
198 		if (check2.IsNumericAscii()) return minor;
199 	}
200 	return ByteString("");
201 }
202 
203 /*****************************************************************************/
IMPL_LINK(SolSelectVersionDlg,DoubleClickHdl,ListBox *,pBox)204 IMPL_LINK( SolSelectVersionDlg, DoubleClickHdl, ListBox *, pBox )
205 /*****************************************************************************/
206 {
207 	EndDialog( RET_OK );
208 	return 0;
209 }
210 
211 //
212 // class SolAutoarrangeDlg
213 //
214 
215 /*****************************************************************************/
SolAutoarrangeDlg(Window * pParent)216 SolAutoarrangeDlg::SolAutoarrangeDlg( Window *pParent )
217 /*****************************************************************************/
218 				: ModelessDialog( pParent, DtSodResId( DLG_AUTOARRANGE )),
219 				maGroupBox( this, DtSodResId( DLG_AUTOARRANGE_GROUP )),
220 				maModuleText( this, DtSodResId( DLG_AUTOARRANGE_TEXT_MODULE )),
221 				maOverallText( this, DtSodResId( DLG_AUTOARRANGE_TEXT_OVERALL )),
222 				maModuleBar( this ),
223 				maOverallBar( this )
224 {
225 	FreeResource();
226 /* Mac Porting..... taking address of temporary (warning)
227 	maModuleBar.SetPosPixel( POS( 8, 28 ));
228 	maOverallBar.SetPosPixel( POS( 8, 60 ));
229 	maModuleBar.SetSizePixel( SIZE( 208,12 ));
230 	maOverallBar.SetSizePixel( SIZE( 208,12 ));
231 */
232 	maModuleBar.Show();
233 	maOverallBar.Show();
234 
235    	maModuleText.Show();
236 	maOverallText.Show();
237 }
238 
239 /**********************************************************************************/
240 
SolFindProjectDlg(Window * pParent,ObjWinList * pObjList)241 SolFindProjectDlg::SolFindProjectDlg( Window *pParent, ObjWinList* pObjList )
242                 : ModalDialog( pParent, DtSodResId( DLG_FIND_PROJECT )),
243                 maCombobox( this, DtSodResId( DLG_FIND_PROJECT_COMBOBOX )),
244                 maOKButton( this, DtSodResId( DLG_FIND_PROJECT_OK )),
245 				maCancelButton( this, DtSodResId( DLG_FIND_PROJECT_CANCEL ))
246 {
247     FreeResource();
248     maCombobox.SetDropDownLineCount(15);
249 //    SolDep* pSolDep = ((MyApp*)GetpApp())->GetSolDep();
250 //    ObjWinList* pObjList = pSolDep->GetObjectList();
251     sal_uIntPtr n = pObjList->Count();
252     //Fill combobox
253     for (sal_uIntPtr i=0; i<n; i++) {
254         ByteString prjname = pObjList->GetObject( i )->GetBodyText();
255         if (prjname != ByteString("null"))                                 //null_project
256             maCombobox.InsertEntry( String(prjname,RTL_TEXTENCODING_UTF8) );
257         }
258 }
259 
GetProject()260 ByteString SolFindProjectDlg::GetProject()
261 {
262     return ByteString(maCombobox.GetText(),RTL_TEXTENCODING_UTF8);
263 }
264