1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: declare.inc,v $
13 '* last change: $Author: vg $ $Date: 2008-08-19 12:49:25 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : thorsten.bosbach@sun.com
36 '* short description : starting routines for declare.bas
38 '*****************************************************************
49 '\****************************************************************
51 ' *****************************************************************
52 ' ruft alle wichtigen Startroutinen auf
56 Use "global\system\includes\sysinfo.inc"
57 Use "global\system\includes\inivalue.inc"
58 Use "global\system\includes\iniinfo.inc"
60 ' Use "global\tools\includes\optional\t_xml1.inc"
61 Use "global\tools\includes\required\t_tools1.inc"
62 Use "global\tools\includes\required\t_tools2.inc"
63 Use "global\tools\includes\required\t_lists.inc"
65 Call LoadDeclaration ' Deklarationen einlesen ( master.inc )
66 Call GetToolPlatform ' Plattform und Pfade des Testtools bestimmen ( sysinfo.inc )
67 Call GetOfficePlatform ' Plattform und Pfade des Office bestimmen ( sysinfo.inc )
68 Call GetIniInformation ' alle wichtigen Daten aus der Testtool.ini ziehen und auf glob. Variable setzen ( iniinfo.inc )
69 Call GetOfficeInformation ' set 'sAppExe' for startup
70 Call hOfficeStarten ' try to start the office for first time ( master.inc )
71 Call GetLanguageInformation ' die Sprache des Office ermitteln und ggf. einstellen ( iniinfo.inc )
72 Call hDisableQuickstarterAPI
75 ' **********************************************************
76 ' Einbinden der Deklarationen
79 '///load all sid-files
80 use "global\sid\all.sid" ' all menu items ( german )
81 use "global\sid\bars.sid" ' all bars as slots
82 use "global\sid\context.sid" ' slots only used in context menus
83 use "global\sid\e_all.sid" ' all menu items ( english )
84 use "global\sid\others.sid" ' general slots ( german )
86 '///load all win-files
87 use "global\win\tab_a_d.win" ' Tabpages TabA ...TabZ
88 use "global\win\tab_e_g.win"
89 use "global\win\tab_h_o.win"
90 use "global\win\tab_p_s.win"
91 use "global\win\tab_t_z.win"
93 use "global\win\dial_a_c.win" ' Dialogs A ... Z
94 use "global\win\dial_d_h.win"
95 use "global\win\dial_i_o.win"
96 use "global\win\dial_p_s.win"
97 use "global\win\dial_t_z.win"
99 use "global\win\sys_dial.win" ' Systemdialogs
100 use "global\win\dokument.win" '
101 use "global\win\mathop.win" ' Mathoperators
103 use "global\win\piloten.win" ' Draw-Autopilot
104 use "global\win\w_autop.win" ' Writer-Autopilots
106 use "global\win\bars.win" ' bars with buttons ( englisch )
108 use "global\win\e_mathop.win"
109 use "global\win\edia_a_c.win"
110 use "global\win\edia_d_h.win"
111 use "global\win\edia_i_o.win"
112 use "global\win\edia_p_s.win"
113 use "global\win\edia_t_z.win"
114 use "global\win\etab_a_d.win"
115 use "global\win\etab_e_g.win"
116 use "global\win\etab_h_o.win"
117 use "global\win\etab_p_s.win"
118 use "global\win\etab_t_z.win"
120 use "global\win\etoolbox.win"
122 use "global\win\spadmin.win"
123 use "global\win\reportdesigner.win"
127 '-------------------------------------------------------------------------------
130 '///special TestEnter : without recovering at starting a testcase
132 Dim sFehler as String
133 Dim Unterbrechnung as Boolean
135 Unterbrechnung = FALSE
138 sFehler = ResetApplication
139 if sFehler <> "" then
140 WarnLog " ** Fehler in der TestEnter-Routine **"
142 if InStr ( 1, sFehler, "nicht schliessen", 1 ) <> 0 then
144 Unterbrechnung = TRUE
150 WarnLog " ** Fehler in der TestEnter-Routine **"
151 printLog "!!! Konnte nicht auf Grundzustand kommen !!!"
152 Unterbrechnung = TRUE
156 AppAbort ' Alle noch anstehenden Befehle loeschen
160 if Unterbrechnung = TRUE then
161 if ( MsgBox ("Konnte nicht in den Grundzustand kommen." + Chr(10) + "Bitte die Applikation selbst in den Basiszustand setzten und OK druecken", 1, "TestEnter-Routine" )) = 2 then end
163 Kontext "Standardbar"
164 if Standardbar.Exists = FALSE then
166 if Standardbar.Exists (3) then
167 Warnlog "Ansicht/Ganzerbildschirm war noch eingeschaltet"
169 ViewToolbarsFunctionbar
170 if Standardbar.Exists (3) then Warnlog "Standardbar was turned off"
176 AppAbort ' Alle noch anstehenden Befehle loeschen
183 '-------------------------------------------------------------------------------
186 '///special TestEnter : without recovering at ending a testcase
187 Dim sFehler as String
188 Dim Unterbrechnung as Boolean
190 Unterbrechnung = FALSE
193 sFehler = ResetApplication
194 if sFehler <> "" then
195 Warnlog " ** Fehler in der TestExit-Routine **"
197 if InStr ( 1, sFehler, "nicht schliessen", 1 ) <> 0 then
199 Unterbrechnung = TRUE
205 WarnLog " ** Fehler in der TestExit-Routine **"
206 printLog "!!! Konnte nicht auf Grundzustand kommen, es wurde vielleicht von Hand recovert. !!!"
207 Unterbrechnung = TRUE
211 AppAbort ' Alle noch anstehenden Befehle loeschen
215 if Unterbrechnung = TRUE then
216 if ( MsgBox ("Konnte nicht in den Grundzustand kommen." + Chr(10) + "Bitte die Applikation selbst in den Basiszustand setzten und OK druecken", 1, "TestExit-Routine" )) = 2 then End
218 Kontext "Standardbar"
219 if Standardbar.Exists = FALSE then
221 if Standardbar.Exists (3) then
222 Warnlog "Ansicht/Ganzerbildschirm war noch eingeschaltet"
224 ViewToolbarsFunctionbar
225 if Standardbar.Exists (3) then Warnlog "Standardbar was turned off"
231 AppAbort ' Alle noch anstehenden Befehle loeschen
238 '-------------------------------------------------------------------------------
241 dim sUnoPort as string
242 dim sPlatformProgramPath as string
243 dim sPlatformBinExt as string
245 ' Set a valid URE_BOOTSTRAP path for soffice, else the invalid one from this testtool instance
246 ' will get used i86718 - would result in a message about vcl stuff and a not starting soffice
247 if gPlatform = lcase("osx") then
248 sPlatformProgramPath = "MacOS"
249 sPlatformBinExt = "rc"
251 sPlatformProgramPath = "program"
252 if gPlatGroup <> "unx" then
253 sPlatformBinExt = ".ini"
255 sPlatformBinExt = "rc"
258 setChildEnv("URE_BOOTSTRAP",convertToURL(convertPath(gNetzOfficePath + sPlatformProgramPath + "/fundamental" + sPlatformBinExt)))
261 if gClient = TRUE then
263 start sAppExe, sAppParameter
264 ' hiermit kann der Client nicht gestartet werden, aber wenn er schon aktiv ist, darf der Shell-befehl nicht ausgeführt werden
266 shell ( sAppExe & sAppParameter, 1 )
271 hGetUNOService(true, sUnoPort)
273 start sAppExe, "-enableautomation -norestore -nolockcheck -accept=socket,host=localhost,port=" + sUnoPort + ";urp "
275 if gSamePC = FALSE then
277 if MsgBox ("Ein Office auf einem anderen Rechner/Plattform kann nicht automatisch gestartet werden." + Chr(10) + "Bitte das Office selber starten und Test weiterlaufen lassen.", 1, "Starten des Office" ) = 2 then end
280 if gClient = TRUE then
281 if MsgBox ( "Beim Start des Office-Client gab es Probleme. Bitte den Client von Hand starten und den Test weiterlaufen lassen!", 1, "Starten des Office" ) = 2 then end
283 if gNetzInst = TRUE then
284 Warnlog "Beim Start des Workstation-Office gab es Probleme, es wird ein 2. Start versucht!"
286 Warnlog "Beim Starten des Office gab es Probleme, es wird ein 2. Start versucht!"
293 if gClient = TRUE then
294 start sAppExe, sAppParameter
296 start sAppExe, "-enableautomation -norestore -nolockcheck "
301 '-------------------------------------------------------------------------------
303 function TrimTab ( sTrimmer as String ) as String
304 Dim sInterim as String
307 sInterim = lTrimTab ( sInterim )
308 TrimTab = rTrimTab ( sInterim )
312 '-------------------------------------------------------------------------------
314 function lTrimTab ( slTrimmer as String ) as String
315 Dim i, iLen as Integer
316 Dim sInterim as String
318 iLen = len ( slTrimmer )
322 if Asc ( left ( sInterim, 1 ) ) = 9 then
323 sInterim = Right ( sInterim, len ( sInterim ) - 1 )
331 '-------------------------------------------------------------------------------
333 function rTrimTab ( srTrimmer as String ) as String
334 Dim i, iLen as Integer
335 Dim sInterim as String
337 iLen = len ( srTrimmer )
341 if Asc ( right ( sInterim, 1 ) ) = 9 then
342 sInterim = left ( sInterim, len ( sInterim ) - 1 )
350 '-------------------------------------------------------------------------------
353 '/// this routine is not intended to be called from within a testscript.
354 '/// this routine will get called by the VCL TestTool application, in case it recognizes there is no soffice.bin running anymore or not responding anymore
355 '/// this happens usually after OpenOffice.org crashed
356 'keep it as short as possible!
357 warnlog "OpenOffice.org application crashed or can not be started. Double click the above error message if exists for the culprint."
363 hDisableQuickstarterAPI()
364 ' set global variable for backwards compatibility
365 gStartTheOffice = TRUE