update dev300-m58
[ooovba.git] / soldep / source / soldlg.cxx
blob03426cd5769167a1b1c8bed73eb4f1210e95a707
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: soldlg.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <tools/geninfo.hxx>
32 //#include "depapp.hxx"
33 #include <soldep/soldep.hxx>
34 #include <soldep/soldlg.hxx>
35 #include <soldep/soldlg.hrc>
37 #ifndef SOLARIS
38 #define SIZE( nX, nY) \
39 LogicToLogic(Size(nX,nY),&MapMode(MAP_APPFONT),&GetMapMode())
40 #define POS(nX, nY) \
41 LogicToLogic(Point(nX,nY),&MapMode(MAP_APPFONT),&GetMapMode())
42 #else
43 #define SIZE( nX, nY) \
44 LogicToLogic(Size(nX,nY),MapMode(MAP_APPFONT),GetMapMode())
45 #define POS(nX, nY) \
46 LogicToLogic(Point(nX,nY),MapMode(MAP_APPFONT),GetMapMode())
47 #endif
51 // class SolNewProjectDlg
54 /*****************************************************************************/
55 SolNewProjectDlg::SolNewProjectDlg( Window* pParent, const ResId& rResId )
56 /*****************************************************************************/
57 : ModalDialog( pParent, rResId ),
58 maOkButton( this, DtSodResId( BTN_OK )),
59 maCancelButton( this, DtSodResId( BTN_CANCEL )),
60 maFTName( this, DtSodResId( FT_PRJNAME )),
61 maEName( this, DtSodResId( EDIT_PRJNAME )),
62 maFTShort( this, DtSodResId( FT_PRJSHORT )),
63 maEShort( this, DtSodResId( EDIT_PRJSHORT )),
64 maFTDeps( this, DtSodResId( FT_PRJDEPS )),
65 maEDeps( this, DtSodResId( EDIT_PRJDEPS ))
67 FreeResource();
68 maOkButton.SetClickHdl( LINK( this, SolNewProjectDlg, OkHdl ));
69 maCancelButton.SetClickHdl( LINK( this, SolNewProjectDlg, CancelHdl ));
72 /*****************************************************************************/
73 IMPL_LINK( SolNewProjectDlg, OkHdl, Button*, pOkBtn )
74 /*****************************************************************************/
76 EndDialog( 1 );
77 return 0;
80 /*****************************************************************************/
81 IMPL_LINK( SolNewProjectDlg, CancelHdl, Button*, pCancelBtn )
82 /*****************************************************************************/
84 EndDialog( 0 );
85 return 0;
89 // class SolNewDirectoryDlg
92 /*****************************************************************************/
93 SolNewDirectoryDlg::SolNewDirectoryDlg( Window* pParent, const ResId& rResId )
94 /*****************************************************************************/
95 : ModalDialog( pParent, rResId ),
96 maOkButton( this, DtSodResId( BTN_OK )),
97 maCancelButton( this, DtSodResId( BTN_CANCEL )),
98 maFTName( this, DtSodResId( FT_DIRNAME )),
99 maEName( this, DtSodResId( EDIT_DIRNAME )),
100 maFTFlag( this, DtSodResId( FT_DIRFLAG )),
101 maEFlag( this, DtSodResId( EDIT_DIRFLAG )),
102 maFTDeps( this, DtSodResId( FT_DIRDEPS )),
103 maEDeps( this, DtSodResId( EDIT_DIRDEPS )),
104 maFTAction( this, DtSodResId( FT_DIRACTION )),
105 maEAction( this, DtSodResId( EDIT_DIRACTION )),
106 maFTEnv( this, DtSodResId( FT_DIRENV )),
107 maEEnv( this, DtSodResId( EDIT_DIRENV ))
109 FreeResource();
110 maOkButton.SetClickHdl( LINK( this, SolNewDirectoryDlg, OkHdl ));
111 maCancelButton.SetClickHdl( LINK( this, SolNewDirectoryDlg, CancelHdl ));
114 /*****************************************************************************/
115 IMPL_LINK( SolNewDirectoryDlg, OkHdl, Button*, pOkBtn )
116 /*****************************************************************************/
118 EndDialog( 1 );
119 return 0;
122 /*****************************************************************************/
123 IMPL_LINK( SolNewDirectoryDlg, CancelHdl, Button*, pCancelBtn )
124 /*****************************************************************************/
126 EndDialog( 0 );
127 return 0;
131 // class SolHelpDlg
134 /*****************************************************************************/
135 SolHelpDlg::SolHelpDlg( Window* pParent, const ResId& rResId )
136 /*****************************************************************************/
137 : ModalDialog( pParent, rResId ),
138 maOkButton( this, DtSodResId( BTN_OK )),
139 maMLEHelp( this, DtSodResId( EDIT_HELP ))
141 FreeResource();
142 maOkButton.SetClickHdl( LINK( this, SolHelpDlg, OkHdl ));
145 /*****************************************************************************/
146 IMPL_LINK( SolHelpDlg, OkHdl, Button*, pOkBtn )
147 /*****************************************************************************/
149 EndDialog( 1 );
150 return 0;
154 // class SolSelectVersionDlg
157 /*****************************************************************************/
158 SolSelectVersionDlg::SolSelectVersionDlg(
159 Window *pParent, GenericInformationList *pStandLst )
160 /*****************************************************************************/
161 : ModalDialog( pParent, DtSodResId( DLG_VERSIONSELECT )),
162 maVersionListBox( this, DtSodResId( DLG_VERSIONSELECT_LISTBOX )),
163 maVersionGroupBox( this, DtSodResId( DLG_VERSIONSELECT_GROUP )),
164 maMinorEditBox( this, DtSodResId( DLG_MINORSELECT_EDIT )),
165 maMinorGroupBox( this, DtSodResId( DLG_MINORSELECT_GROUP )),
166 maOKButton( this, DtSodResId( DLG_VERSIONSELECT_OK )),
167 maCancelButton( this, DtSodResId( DLG_VERSIONSELECT_CANCEL ))
169 FreeResource();
170 //Fill the ListBox with MWS versions (e.g. SRC680) from "stand.lst"
171 for ( ULONG i = 0; i < pStandLst->Count(); i++ ) {
172 String sVersion( *pStandLst->GetObject( i ), RTL_TEXTENCODING_ASCII_US );
173 maVersionListBox.InsertEntry( sVersion );
176 if ( pStandLst->Count())
177 maVersionListBox.SelectEntryPos( 0 );
179 maVersionListBox.SetDoubleClickHdl(
180 LINK( this, SolSelectVersionDlg, DoubleClickHdl ));
184 /*****************************************************************************/
185 ByteString SolSelectVersionDlg::GetVersionMajor()
186 /*****************************************************************************/
188 //Returns the selected version
189 return ByteString(maVersionListBox.GetSelectEntry(), RTL_TEXTENCODING_ASCII_US );
192 /*****************************************************************************/
193 ByteString SolSelectVersionDlg::GetVersionMinor()
194 /*****************************************************************************/
196 //Returns the minor
197 ByteString minor = ByteString(maMinorEditBox.GetText(), RTL_TEXTENCODING_ASCII_US );
198 //check for correctness (format: "m1234")
199 //"m123s8" is unsupported because 'steps' aren't used anymore
200 minor.EraseLeadingAndTrailingChars();
201 int check = minor.SearchChar("m");
202 if (check == 0)
204 ByteString check2 = minor.Copy(1,(minor.Len()-1));
205 if (check2.IsNumericAscii()) return minor;
207 return ByteString("");
210 /*****************************************************************************/
211 IMPL_LINK( SolSelectVersionDlg, DoubleClickHdl, ListBox *, pBox )
212 /*****************************************************************************/
214 EndDialog( RET_OK );
215 return 0;
219 // class SolAutoarrangeDlg
222 /*****************************************************************************/
223 SolAutoarrangeDlg::SolAutoarrangeDlg( Window *pParent )
224 /*****************************************************************************/
225 : ModelessDialog( pParent, DtSodResId( DLG_AUTOARRANGE )),
226 maGroupBox( this, DtSodResId( DLG_AUTOARRANGE_GROUP )),
227 maModuleText( this, DtSodResId( DLG_AUTOARRANGE_TEXT_MODULE )),
228 maOverallText( this, DtSodResId( DLG_AUTOARRANGE_TEXT_OVERALL )),
229 maModuleBar( this ),
230 maOverallBar( this )
232 FreeResource();
233 /* Mac Porting..... taking address of temporary (warning)
234 maModuleBar.SetPosPixel( POS( 8, 28 ));
235 maOverallBar.SetPosPixel( POS( 8, 60 ));
236 maModuleBar.SetSizePixel( SIZE( 208,12 ));
237 maOverallBar.SetSizePixel( SIZE( 208,12 ));
239 maModuleBar.Show();
240 maOverallBar.Show();
242 maModuleText.Show();
243 maOverallText.Show();
246 /**********************************************************************************/
248 SolFindProjectDlg::SolFindProjectDlg( Window *pParent, ObjWinList* pObjList )
249 : ModalDialog( pParent, DtSodResId( DLG_FIND_PROJECT )),
250 maCombobox( this, DtSodResId( DLG_FIND_PROJECT_COMBOBOX )),
251 maOKButton( this, DtSodResId( DLG_FIND_PROJECT_OK )),
252 maCancelButton( this, DtSodResId( DLG_FIND_PROJECT_CANCEL ))
254 FreeResource();
255 maCombobox.SetDropDownLineCount(15);
256 // SolDep* pSolDep = ((MyApp*)GetpApp())->GetSolDep();
257 // ObjWinList* pObjList = pSolDep->GetObjectList();
258 ULONG n = pObjList->Count();
259 //Fill combobox
260 for (ULONG i=0; i<n; i++) {
261 ByteString prjname = pObjList->GetObject( i )->GetBodyText();
262 if (prjname != ByteString("null")) //null_project
263 maCombobox.InsertEntry( String(prjname,RTL_TEXTENCODING_UTF8) );
267 ByteString SolFindProjectDlg::GetProject()
269 return ByteString(maCombobox.GetText(),RTL_TEXTENCODING_UTF8);