OOO330
[LibreOffice.git] / soldep / source / soldlg.cxx
blob96ad469f8284adf8e5e655ce1f99cf284d418a2c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 #include <tools/geninfo.hxx>
29 //#include "depapp.hxx"
30 #include <soldep/soldep.hxx>
31 #include <soldep/soldlg.hxx>
32 #include <soldep/soldlg.hrc>
34 #ifndef SOLARIS
35 #define SIZE( nX, nY) \
36 LogicToLogic(Size(nX,nY),&MapMode(MAP_APPFONT),&GetMapMode())
37 #define POS(nX, nY) \
38 LogicToLogic(Point(nX,nY),&MapMode(MAP_APPFONT),&GetMapMode())
39 #else
40 #define SIZE( nX, nY) \
41 LogicToLogic(Size(nX,nY),MapMode(MAP_APPFONT),GetMapMode())
42 #define POS(nX, nY) \
43 LogicToLogic(Point(nX,nY),MapMode(MAP_APPFONT),GetMapMode())
44 #endif
48 // class SolNewProjectDlg
51 /*****************************************************************************/
52 SolNewProjectDlg::SolNewProjectDlg( Window* pParent, const ResId& rResId )
53 /*****************************************************************************/
54 : ModalDialog( pParent, rResId ),
55 maOkButton( this, DtSodResId( BTN_OK )),
56 maCancelButton( this, DtSodResId( BTN_CANCEL )),
57 maFTName( this, DtSodResId( FT_PRJNAME )),
58 maEName( this, DtSodResId( EDIT_PRJNAME )),
59 maFTShort( this, DtSodResId( FT_PRJSHORT )),
60 maEShort( this, DtSodResId( EDIT_PRJSHORT )),
61 maFTDeps( this, DtSodResId( FT_PRJDEPS )),
62 maEDeps( this, DtSodResId( EDIT_PRJDEPS ))
64 FreeResource();
65 maOkButton.SetClickHdl( LINK( this, SolNewProjectDlg, OkHdl ));
66 maCancelButton.SetClickHdl( LINK( this, SolNewProjectDlg, CancelHdl ));
69 /*****************************************************************************/
70 IMPL_LINK( SolNewProjectDlg, OkHdl, Button*, pOkBtn )
71 /*****************************************************************************/
73 EndDialog( 1 );
74 return 0;
77 /*****************************************************************************/
78 IMPL_LINK( SolNewProjectDlg, CancelHdl, Button*, pCancelBtn )
79 /*****************************************************************************/
81 EndDialog( 0 );
82 return 0;
86 // class SolNewDirectoryDlg
89 /*****************************************************************************/
90 SolNewDirectoryDlg::SolNewDirectoryDlg( Window* pParent, const ResId& rResId )
91 /*****************************************************************************/
92 : ModalDialog( pParent, rResId ),
93 maOkButton( this, DtSodResId( BTN_OK )),
94 maCancelButton( this, DtSodResId( BTN_CANCEL )),
95 maFTName( this, DtSodResId( FT_DIRNAME )),
96 maEName( this, DtSodResId( EDIT_DIRNAME )),
97 maFTFlag( this, DtSodResId( FT_DIRFLAG )),
98 maEFlag( this, DtSodResId( EDIT_DIRFLAG )),
99 maFTDeps( this, DtSodResId( FT_DIRDEPS )),
100 maEDeps( this, DtSodResId( EDIT_DIRDEPS )),
101 maFTAction( this, DtSodResId( FT_DIRACTION )),
102 maEAction( this, DtSodResId( EDIT_DIRACTION )),
103 maFTEnv( this, DtSodResId( FT_DIRENV )),
104 maEEnv( this, DtSodResId( EDIT_DIRENV ))
106 FreeResource();
107 maOkButton.SetClickHdl( LINK( this, SolNewDirectoryDlg, OkHdl ));
108 maCancelButton.SetClickHdl( LINK( this, SolNewDirectoryDlg, CancelHdl ));
111 /*****************************************************************************/
112 IMPL_LINK( SolNewDirectoryDlg, OkHdl, Button*, pOkBtn )
113 /*****************************************************************************/
115 EndDialog( 1 );
116 return 0;
119 /*****************************************************************************/
120 IMPL_LINK( SolNewDirectoryDlg, CancelHdl, Button*, pCancelBtn )
121 /*****************************************************************************/
123 EndDialog( 0 );
124 return 0;
128 // class SolHelpDlg
131 /*****************************************************************************/
132 SolHelpDlg::SolHelpDlg( Window* pParent, const ResId& rResId )
133 /*****************************************************************************/
134 : ModalDialog( pParent, rResId ),
135 maOkButton( this, DtSodResId( BTN_OK )),
136 maMLEHelp( this, DtSodResId( EDIT_HELP ))
138 FreeResource();
139 maOkButton.SetClickHdl( LINK( this, SolHelpDlg, OkHdl ));
142 /*****************************************************************************/
143 IMPL_LINK( SolHelpDlg, OkHdl, Button*, pOkBtn )
144 /*****************************************************************************/
146 EndDialog( 1 );
147 return 0;
151 // class SolSelectVersionDlg
154 /*****************************************************************************/
155 SolSelectVersionDlg::SolSelectVersionDlg(
156 Window *pParent, GenericInformationList *pStandLst )
157 /*****************************************************************************/
158 : ModalDialog( pParent, DtSodResId( DLG_VERSIONSELECT )),
159 maVersionListBox( this, DtSodResId( DLG_VERSIONSELECT_LISTBOX )),
160 maVersionGroupBox( this, DtSodResId( DLG_VERSIONSELECT_GROUP )),
161 maMinorEditBox( this, DtSodResId( DLG_MINORSELECT_EDIT )),
162 maMinorGroupBox( this, DtSodResId( DLG_MINORSELECT_GROUP )),
163 maOKButton( this, DtSodResId( DLG_VERSIONSELECT_OK )),
164 maCancelButton( this, DtSodResId( DLG_VERSIONSELECT_CANCEL ))
166 FreeResource();
167 //Fill the ListBox with MWS versions (e.g. SRC680) from "stand.lst"
168 for ( ULONG i = 0; i < pStandLst->Count(); i++ ) {
169 String sVersion( *pStandLst->GetObject( i ), RTL_TEXTENCODING_ASCII_US );
170 maVersionListBox.InsertEntry( sVersion );
173 if ( pStandLst->Count())
174 maVersionListBox.SelectEntryPos( 0 );
176 maVersionListBox.SetDoubleClickHdl(
177 LINK( this, SolSelectVersionDlg, DoubleClickHdl ));
181 /*****************************************************************************/
182 ByteString SolSelectVersionDlg::GetVersionMajor()
183 /*****************************************************************************/
185 //Returns the selected version
186 return ByteString(maVersionListBox.GetSelectEntry(), RTL_TEXTENCODING_ASCII_US );
189 /*****************************************************************************/
190 ByteString SolSelectVersionDlg::GetVersionMinor()
191 /*****************************************************************************/
193 //Returns the minor
194 ByteString minor = ByteString(maMinorEditBox.GetText(), RTL_TEXTENCODING_ASCII_US );
195 //check for correctness (format: "m1234")
196 //"m123s8" is unsupported because 'steps' aren't used anymore
197 minor.EraseLeadingAndTrailingChars();
198 int check = minor.SearchChar("m");
199 if (check == 0)
201 ByteString check2 = minor.Copy(1,(minor.Len()-1));
202 if (check2.IsNumericAscii()) return minor;
204 return ByteString("");
207 /*****************************************************************************/
208 IMPL_LINK( SolSelectVersionDlg, DoubleClickHdl, ListBox *, pBox )
209 /*****************************************************************************/
211 EndDialog( RET_OK );
212 return 0;
216 // class SolAutoarrangeDlg
219 /*****************************************************************************/
220 SolAutoarrangeDlg::SolAutoarrangeDlg( Window *pParent )
221 /*****************************************************************************/
222 : ModelessDialog( pParent, DtSodResId( DLG_AUTOARRANGE )),
223 maGroupBox( this, DtSodResId( DLG_AUTOARRANGE_GROUP )),
224 maModuleText( this, DtSodResId( DLG_AUTOARRANGE_TEXT_MODULE )),
225 maOverallText( this, DtSodResId( DLG_AUTOARRANGE_TEXT_OVERALL )),
226 maModuleBar( this ),
227 maOverallBar( this )
229 FreeResource();
230 /* Mac Porting..... taking address of temporary (warning)
231 maModuleBar.SetPosPixel( POS( 8, 28 ));
232 maOverallBar.SetPosPixel( POS( 8, 60 ));
233 maModuleBar.SetSizePixel( SIZE( 208,12 ));
234 maOverallBar.SetSizePixel( SIZE( 208,12 ));
236 maModuleBar.Show();
237 maOverallBar.Show();
239 maModuleText.Show();
240 maOverallText.Show();
243 /**********************************************************************************/
245 SolFindProjectDlg::SolFindProjectDlg( Window *pParent, ObjWinList* pObjList )
246 : ModalDialog( pParent, DtSodResId( DLG_FIND_PROJECT )),
247 maCombobox( this, DtSodResId( DLG_FIND_PROJECT_COMBOBOX )),
248 maOKButton( this, DtSodResId( DLG_FIND_PROJECT_OK )),
249 maCancelButton( this, DtSodResId( DLG_FIND_PROJECT_CANCEL ))
251 FreeResource();
252 maCombobox.SetDropDownLineCount(15);
253 // SolDep* pSolDep = ((MyApp*)GetpApp())->GetSolDep();
254 // ObjWinList* pObjList = pSolDep->GetObjectList();
255 ULONG n = pObjList->Count();
256 //Fill combobox
257 for (ULONG i=0; i<n; i++) {
258 ByteString prjname = pObjList->GetObject( i )->GetBodyText();
259 if (prjname != ByteString("null")) //null_project
260 maCombobox.InsertEntry( String(prjname,RTL_TEXTENCODING_UTF8) );
264 ByteString SolFindProjectDlg::GetProject()
266 return ByteString(maCombobox.GetText(),RTL_TEXTENCODING_UTF8);