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: iniinfo.inc,v $
13 '* last change: $Author: rt $ $Date: 2008-07-10 15:39:45 $
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 : helge.delfs@sun.com
36 '* short description : get information for startup a test out of important ini-files
38 '\***********************************************************************
41 '/// Set all important variables.
42 '/// Some of them are get only out of the </i>testtool.ini</i>.
43 '/// <b>gPathSigne</b>: Pathsign for the OfficePLatform Operating System
44 '/// <b>gPort</b>: Portnummer for communication between testtool and StarOffice
45 '/// <b>gSystemPath</b>: Systempath from where StarOffice executes.
46 '/// <b>gOfficePath</b>: Path where StarOffice is installed.
47 '/// <b>gTesttoolPath</b>: Root directory from the <i>TestTool environment</i>.
48 '/// <b>oTesttoolPath</b>: Root directory from the <i>TestTool environment</i> (<u>Windows styleed only!</u>)
49 '/// <b>gClient</b>: <b>1</b> when you run a Server/Client-Test (Sun™ ONE Webtop)
50 '/// <b>gClientLaden</b>: <b>0</b> if Load/Save on Client-side, otherwise on Server-side (<u>UNIX only!</u>)
51 '/// <b>gNetzInst</b>: <b>1</b> if you test a network- / workstation installaion.
52 dim sSoffice(3) as string ' array, because they might all get evaluated sometime
54 dim iSoffice(3) as integer
57 gPathSigne = hGetPathSigne(gPLatform)
59 gTTProfileName = hfGetTTProfileName()
60 gSystemPath = gtSystemPath
61 oTesttoolPath = GetIniValue ( gTesttoolIni, gTTProfileName, "BaseDir" )
62 if (right(oTesttoolPath,1) <> gPathSigne) then
63 oTesttoolPath = oTesttoolPath + gPathSigne
65 gTesttoolPath = oTesttoolPath
66 if gSamePC = FALSE then
67 gOfficePath = GetIniValue ( gTesttoolIni, "Office IniPath", "Current" ) + gPathSigne
68 gRemotePath = GetIniValue ( gTesttoolIni, "RemoteBaseDir", "Current" ) + gPathSigne
70 '/// The part of getting the location of the executable OOo is put into seperated functions.
71 '/// The first OOo executeable is being used.
72 '///+ <ol><li>Entry in TestTool control file (.testtoolrc on UNIX; testtool.ini on Win32)</li>
73 '///+ <li>or<ul><li><b>Win32</b>: Entry in registry</li><li><b>UNIX</b>: If link <pre>/usr/bin/soffice</pre> or <pre>$HOME/soffice</pre> exists</li></ul></li></ol>
74 sSoffice(0) = getSofficeTesttool() : bOOO(0) = gOOO
75 ' DEBUG: If you need more detailed information about the installation environment
76 ' enable the next line.
77 ' printlog "RESULT from TestTool: '" + sSoffice(0) + "' - OOo? " + bOOO(0)
78 if (sSoffice(0) = "") then
79 sSoffice(0) = getSofficeNative() : bOOO(0) = gOOO
80 if (sSoffice(0) <> "") then
81 gOfficePath = sSoffice(0)
82 gVersionsnummer = FindBuildID()
83 call hSetBuildVersionInformation(TRUE)
86 ' DEBUG: If you need more detailed information about the installation environment
87 ' enable the next line.
88 ' printlog "RESULT from Native : '" + sSoffice(0) + "' - OOo? " + bOOO(0) + " - BuildID: " + iSoffice(0)
89 if sSoffice(0) = "" then
90 warnlog "No OOo version found on this computer. - Please look into documentation, how to select an OOo version to test."
93 printlog "----------------------------------------------------------------------------------------------------"
94 printlog "** Using [OOoProgramDir] value : " & sSoffice(0)
95 printlog "----------------------------------------------------------------------------------------------------"
97 gOfficePath = sSoffice(0)
100 if ((gSamePC = TRUE) AND (gOfficePath = "")) then
101 MsgBox ("The test ends, because no OOo version was found on this computer. - Please look into documentation, how to select an OOo version to test.", 1, "No OOo program installed")
105 gtHidLstPath = GetIniValue ( gTesttoolIni, gTTProfileName, "HIDDir" ) + hGetPathSigne(gtPlatform)
106 gPort = GetIniValue ( gTesttoolIni, "Communication", "TTPort" )
108 gPCName = GetIniValue ( gTesttoolIni, "Others", "PCname" )
109 if (gPCName = "NOT_SET!" OR gPCName = "") then
110 gPCName = environ ( "HOSTNAME" )
111 if (gPCName = "") then
112 gPCName = environ ( "COMPUTERNAME" )
113 if (gPCName = "") then
114 gPCName = environ ( "hostname" )
115 ' If testtool.ini/rc is unmodified, the default value is NOT_SET!
117 qaErrorLog "Please insert the computername in section [Others] on the line 'PCname=' in the TestTool confguration file at: '" + gTesttoolIni + "'"
124 call GetTheInstallationType ' gNetzInst and gNetzOfficePath will be set if StarOffice is a Network-Installation
125 gOfficeBasisPath = getOfficeBasisPath()
126 gOOoStartupTimeOut = fgetOOoStartupTimeOut()
127 gOOoShutdownTimeOut = fgetOOoShutdownTimeOut()
128 call sCheckValgrindStatus()
129 gPrivateEnvironmentLocation = getIniValue(gTesttoolIni, "PrivateEnvironment", "Current")
130 sTemp = ConvertPath (gTestToolPath + gPrivateEnvironmentLocation + "inc/privateenvironment.inc")
131 if fileExists(sTemp) then
133 call getUseFilesPrivateEnvironment
135 gPrivateEnvironmentLocation = ""
139 '-------------------------------------------------------------------------
141 sub GetOfficeInformation
142 '/// Generates the path to the StarOffice executable.
143 '/// <u>Output</u>: <b>sAppExe</b> variable is the StarOffice executable or the client executable (StarOffice server, StarPortal™, Sun™ ONE Webtop, ...)
144 Dim sProgramNeu as String
145 Dim iClient as Integer
146 Dim sPlatformProgramPath as string
147 Dim sPlatformBinExt as string
149 if ( lcase( gPlatform ) = "osx" ) then
150 sPlatformProgramPath = "MacOS"
153 sPlatformProgramPath = "program"
154 if gPlatGroup <> "unx" then
155 sPlatformBinExt = ".exe"
161 'if it's a client on the same PC
162 if gClient = TRUE AND gClientUser <> "" then
163 if gtPlatform <> "w95" AND gtPlatform <> "wnt" AND gPlatform <> "w2k" AND gtPlatform <> "os2" AND gtPlatform <> "os4" then
164 sAppExe = gsClient + "/bin/sclient"
166 if right( lcase ( sAppExe ), 3 ) <> "exe" then sAppExe = gsClient + "\sclient.exe"
168 sAppParameter = " -remote -connect=portal,service=soffice,host=" + gHost + ",port=8208,user=" + gClientUser + ",password=" + gClientUserPWD + ",type=compressed_secure"
170 if gNetzInst = TRUE then ' wenn es sich um eine Netzwerkinstallation handelt
171 select case UCase(gApplication)
172 case "WRITER" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt
174 case "CALC" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt
176 case "IMPRESS" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt
177 sFactory = "private:factory/simpress"
178 case "DRAW" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt
180 case "MASTERDOCUMENT": sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt
182 case "MATH" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt
184 case "HTML" : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt
186 case else : sAppExe = gNetzOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt
188 'If it's a normal (FAT) office
190 'If it's a RVP-Office
191 if gClient = TRUE then
192 if gPlatgroup <> "unx" then
193 sAppExe = gOfficePath + "client\sclient.exe"
195 sAppExe = gOfficePath + "client/sclient"
198 select case UCase(gApplication)
199 case "WRITER" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt
201 case "CALC" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt
203 case "IMPRESS" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt
204 sFactory = "private:factory/simpress"
205 case "DRAW" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt
207 case "MASTERDOCUMENT": sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt
209 case "MATH" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt
211 case "HTML" : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt
213 case else : sAppExe = gOfficePath & sPlatformProgramPath & gPathSigne & "soffice" & sPlatformBinExt
220 '-------------------------------------------------------------------------
222 function hGetPathSigne(sPlatform as string) as string
223 '/// Seperators for the different platforms.
224 '/// <u>Input</u>: string of class gPlatform
225 '/// <u>Output</u>: string which can be used as seperator in directories
227 select case sPlatform
228 case "w95" : hGetPathSigne = "\"
229 case "w98" : hGetPathSigne = "\"
230 case "wnt" : hGetPathSigne = "\"
231 case "wme" : hGetPathSigne = "\"
232 case "wse" : hGetPathSigne = "\"
233 case "w2k" : hGetPathSigne = "\"
234 case "wxp" : hGetPathSigne = "\"
235 case "ecs" : hGetPathSigne = "\"
236 case "os4" : hGetPathSigne = "\"
237 case "os5" : hGetPathSigne = "\"
238 case "osx" : hGetPathSigne = "/"
239 case "ppc" : hGetPathSigne = "/"
240 case "sol" : hGetPathSigne = "/"
241 case "lin" : hGetPathSigne = "/"
242 case "x86" : hGetPathSigne = "/"
243 case "fbsd": hGetPathSigne = "/"
244 case "nbsd": hGetPathSigne = "/"
245 case "lin64": hGetPathSigne= "/"
246 case "linsparc": hGetPathSigne = "/"
247 case else : hGetPathSigne = ""
248 qaErrorLog " No pathseperator is defined for this platform : " + sPlatform
252 '-------------------------------------------------------------------------
254 function ConvertPath ( sDatei$, optional sPlatform as string ) as String
256 '/// <u>Input</u>: path as string; OPTIONAL: string of class gPlatform
257 '/// <u>Output</u>: converted path respected to gPlatform; if optional paramter: to that Platform
258 '/// Convert the <i>pathsigne</i> '\' to '/' when a test runs under UNIX
259 Dim iW32 as Integer : Dim iUNX as Integer
260 Dim i as Integer : Dim Ende as Integer
261 Dim s1$ : Dim s2$ : Dim s3$
262 dim sLocalPlatGroup as string
263 dim sLocalPathSigne as string
265 if (isMissing(sPlatform)) then
266 sLocalPlatGroup = gPlatGroup
267 sLocalPathSigne = gPathSigne
269 sLocalPlatGroup = hPlatformToGroup(sPlatform)
270 sLocalPathSigne = hGetPathSigne(sPlatform)
273 s3$ = "" : iW32 = 0 : iUNX = 0
277 ' convert all / to \ if WIN
278 if sLocalPlatGroup <> "unx" then
280 i = InStr( s1$, "/" )
281 if i = 0 then exit do
282 s2$ = Left( s1$ , i-1 )
283 s1$ = Mid( s1$ , i+1 )
284 s3$ = s3$ + s2$ + "\"
290 ' convert all \ to gPathSigne => WIN -> XXX
292 i = InStr( s1$, "\" )
293 if i = 0 then exit do
294 s2$ = Left( s1$ , i-1 )
295 s1$ = Mid( s1$ , i+1 )
296 s3$ = s3$ + s2$ + sLocalPathSigne
299 ConvertPath = s3$ + s1$
302 '-------------------------------------------------------------------------
304 sub GetLanguageInformation
305 '/// Extracts the language information from <i>Setup.xcu</i>.
306 '/// <u>note</u>: It uses the <b>fgetL10Nvalue</b>.
308 Dim iTimeOut as integer
309 Dim sLanOutIni as string
310 Dim SetupXML as String
311 Dim ChildsOfSetupNodes as integer
312 Dim ArtOfInst as string
313 Dim SetupXMLNet as string
314 Dim SetupXMLDefault as string
315 dim SetupXcuPath as string
317 SetupXcuPath = ConvertPath("share\registry\data\org\openoffice\Setup.xcu")
318 SetupXML = gOfficePath & ConvertPath("user\registry\data\org\openoffice\Setup.xcu")
320 if gNetzInst = TRUE then
321 SetupXMLNet = gNetzOfficePath & SetupXcuPath
322 ArtOfInst = "NET- / Workstation Inst."
324 SetupXMLDefault = gOfficePath & SetupXcuPath
325 ArtOfInst = "FAT Inst."
328 ' Issue #i97875 (JSK) experimental delay
329 ' If we're too fast we might encounter that the Setup.xcu is not created yet.
330 ' So we retry a couple of times
331 while( IsMissing( SetupXML ) )
332 iTimeOut = iTimeOut + 1
333 if ( iTimeOut = 10 ) then
334 warnlog "GetLanguageInformation(" & ArtOfInst & "): " & SetupXML & " not found => can't get the correct Office-Language! Default (01) will be used."
341 ' function 'fgetL10Nvalue' is also in this library
342 sLanOutIni = fgetL10Nvalue(SetupXML)
343 ' BugID 98315 -> looking in networkpath for the language until bug will be fixed.
344 if sLanOutIni = "" and gNetzInst = TRUE then
345 sLanOutIni = fgetL10Nvalue(SetupXMLNet)
347 ' It is an English FAT version 645m9s2 or higher.
348 if sLanOutIni = "" and gNetzInst = FALSE then
349 sLanOutIni = fgetL10Nvalue(SetupXMLDefault)
352 if sLanOutIni = "" then
353 warnlog "=> default is now 01 = en_US"
356 'language Code ISO 639 (and ISO 3166 for en language) is now gLangCode
357 'ISO 639 http://www.oasis-open.org/cover/iso639a.html
358 'ISO 3166: http://xml.coverpages.org/country3166.html
360 gISOLang = sLanOutIni
362 select case lcase ( sLanOutIni )
363 case "en_us", "en-us", "en" : iSprache = 01 ' English (USA)
364 case "pt_pt", "pt-pt", "pt" : iSprache = 03 ' Portuguese
365 case "ru_ru", "ru-ru", "ru" : iSprache = 07 ' Russian
366 case "el_gr", "el-gr", "el" : iSprache = 30 ' Greek
367 case "nl_nl", "nl-nl", "nl" : iSprache = 31 ' Dutch
368 case "fr_fr", "fr-fr", "fr" : iSprache = 33 ' French
369 case "es_es", "es-es", "es" : iSprache = 34 ' Spanish
370 case "fi_fi", "fi-fi", "fi" : iSprache = 35 ' Finnish
371 case "hu_hu", "hu-hu", "hu" : iSprache = 36 ' Hungaria
372 case "ca_ad", "ca-ad", "ca" : iSprache = 37 ' Catalan
373 case "it_it", "it-it", "it" : iSprache = 39 ' Italian
374 case "cs_cz", "cs-cz", "cs" : iSprache = 42 ' Czech
375 case "sk_sk", "sk-sk", "sk" : iSprache = 43 ' Slowak
376 case "en_gb", "en-gb" : iSprache = 44 ' English (GB)
377 case "da_dk", "da-dk", "da" : iSprache = 45 ' Danish
378 case "sv_se", "sv-se", "sv" : iSprache = 46 ' Swedish
379 case "no_no", "no-no", "no" : iSprache = 47 ' Norwegian
380 case "pl_pl", "pl-pl", "pl" : iSprache = 48 ' Polish
381 case "de_de", "de-de", "de" : iSprache = 49 ' German
382 case "sr_rs", "sr-rs", "sr" : iSprache = 51 ' Serbian (Cyrillic)
383 case "sh_rs", "sh-rs", "sh" : iSprache = 52 ' Serbian (Latin)
384 case "pt_br", "pt-br", "br" : iSprache = 55 ' Portuguese (Brazil)
385 case "th_th", "th-th", "th" : iSprache = 66 ' Thai
386 case "ja_jp", "ja-jp", "ja" : iSprache = 81 ' Japanese
387 case "ko_kr", "ko-kr", "ko" : iSprache = 82 ' Korean
388 case "vi_vi", "vi-vi", "vi" : iSprache = 84 ' Vietnamese
389 case "zh_cn", "zh-cn", "zh" : iSprache = 86 ' Chinese (simplified)
390 case "zh_tw", "zh-tw" : iSprache = 88 ' Chinese (traditional)
391 case "tr_tr", "tr-tr", "tr" : iSprache = 90 ' Turkish
392 case "hi_in", "hi-in", "hi" : iSprache = 91 ' Hindi
393 case "ar_ar", "ar-ar", "ar" : iSprache = 96 ' Arabic
394 case "he_he", "he-he", "he" : iSprache = 97 ' Hebrew
395 case "sl_si", "sl-si", "sl" : iSprache = 386 ' Slovenian
396 case "zz_zz", "zz-zz", "zz" : iSprache = 01 ' unknown
397 warnlog "iniinfo.inc::GetLanguageInformation()"
398 warnlog "- sLanOutIni = " & sLanOutIni & " (unknown language)"
399 warnlog "- iSprache has been set 01!"
400 case "" : iSprache = 01 ' empty
401 warnlog "iniinfo.inc::GetLanguageInformation()"
402 warnlog "- empty sLanOutIni = " & sLanOutIni
403 warnlog "- iSprache has been set 01!"
404 case else : iSprache = 01
405 warnlog "iniinfo.inc::GetLanguageInformation()"
406 warnlog "- sLanOutIni = " & sLanOutIni & " (fallback mode; unknown language)"
407 warnlog "- iSprache has been set 01!"
410 if iSprache = 81 OR iSprache = 82 OR iSprache = 86 OR iSprache = 88 then
415 if ((iSprache = 66) OR (iSprache = 91) OR (iSprache = 96) OR (iSprache = 97)) then
420 gLanguage = GetLanguageText ( iSprache )
423 '-------------------------------------------------------------------------
425 function ConvertLanguage ( Sprache as String ) as Integer
426 '/// Sets international language code for the whole language name.
428 select case lCase ( Sprache )
429 case "deutsch", "german" : ConvertLanguage = 49
430 case "englisch", "english" : ConvertLanguage = 01
431 case "portugisisch", "portugiesisch", "portuguese" : ConvertLanguage = 03
432 case "russisch", "russian" : ConvertLanguage = 07
433 case "czech", "tschechisch" : ConvertLanguage = 29
434 case "griechisch", "greek" : ConvertLanguage = 30
435 case "niederlaendisch", "hollaendisch", "netherlands" : ConvertLanguage = 31
436 case "franzoesisch", "french" : ConvertLanguage = 33
437 case "spanisch", "spanish" : ConvertLanguage = 34
438 case "finisch", "finnish" : ConvertLanguage = 35
439 case "hungaria", "ungarisch" : ConvertLanguage = 36
440 case "italienisch", "italian" : ConvertLanguage = 39
441 case "slowak", "slovakisch" : ConvertLanguage = 43
442 case "daenisch", "danish" : ConvertLanguage = 45
443 case "schwedisch", "swedish" : ConvertLanguage = 46
444 case "norwegian", "norwegisch" : ConvertLanguage = 47
445 case "polnisch", "polish" : ConvertLanguage = 48
446 case "serbisch kyrillisch", "serbian cyrillic" : ConvertLanguage = 51
447 case "serbisch latein", "serbian latin" : ConvertLanguage = 52
448 case "japanisch", "japanese" : ConvertLanguage = 81
449 case "koreanisch", "korean" : ConvertLanguage = 82
450 case "vietnamesisch", "vietnamese" : ConvertLanguage = 84
451 case "chinesisch", "chinese" : ConvertLanguage = 86
452 case "chinesisch trad.", "chinese trad." : ConvertLanguage = 88
453 case "tuerkisch", "turkish" : ConvertLanguage = 90
454 case "arabisch", "arab" : ConvertLanguage = 96
455 case "catalan", "katalanisch" : ConvertLanguage = 99
456 case "slovenian", "slovenisch" : ConvertLanguage = 386
460 '-------------------------------------------------------------------------
462 function GetLanguageText ( iLan ) as String
463 '/// Sets the language name for the international language-code.
465 case 01 : GetLanguageText = "English (USA)"
466 case 03 : GetLanguageText = "Portuguese"
467 case 07 : GetLanguageText = "Russian"
468 case 30 : GetLanguageText = "Greek"
469 case 31 : GetLanguageText = "Dutch"
470 case 33 : GetLanguageText = "French"
471 case 34 : GetLanguageText = "Spanish"
472 case 35 : GetLanguageText = "Finnish"
473 case 36 : GetLanguageText = "Hungarian"
474 case 37 : GetLanguageText = "Catalan"
475 case 39 : GetLanguageText = "Italian"
476 case 42 : GetLanguageText = "Czech"
477 case 43 : GetLanguageText = "Slowak"
478 case 44 : GetLanguageText = "English (GB)"
479 case 45 : GetLanguageText = "Danish"
480 case 46 : GetLanguageText = "Swedish"
481 case 47 : GetLanguageText = "Norwegian"
482 case 48 : GetLanguageText = "Polnish"
483 case 49 : GetLanguageText = "German"
484 case 51 : GetlanguageText = "Serbian (Cyrillic)"
485 case 52 : GetlanguageText = "Serbian (Latin)"
486 case 55 : GetLanguageText = "Portuguese (Brazil)"
487 case 66 : GetLanguageText = "Thai"
488 case 81 : GetLanguageText = "Japanese"
489 case 82 : GetLanguageText = "Korean"
490 case 84 : GetLanguageText = "Vietnamese"
491 case 86 : GetLanguageText = "Chinese (simplified)"
492 case 88 : GetLanguageText = "Chinese (traditional)"
493 case 90 : GetLanguageText = "Turkish"
494 case 91 : GetLanguageText = "Hindi"
495 case 96 : GetLanguageText = "Arabic"
496 case 97 : GetLanguageText = "Hebrew"
497 case 99 : GetLanguageText = "Unknown"
498 case 386 : GetlanguageText = "Slovenian"
499 case else : GetLanguageText = "detection failed"
503 '-------------------------------------------------------------------------
505 function ConvertLanguage2 ( sSprache as String, optional bExact ) as Integer
506 '/// Sets the international language code for the international language shortcut.
507 '/// <i>optional <b>bExact</i></b>: If language not available, 'shut up' and return '0'
508 select case lCase ( sSprache )
509 case "en_us", "en-us", "en" : ConvertLanguage2 = 01 ' English (USA)
510 case "pt_pt", "pt-pt", "pt" : ConvertLanguage2 = 03 ' Portuguese
511 case "ru_ru", "ru-ru", "ru" : ConvertLanguage2 = 07 ' Russian
512 case "el_gr", "el-gr", "el" : ConvertLanguage2 = 30 ' Greek
513 case "nl_nl", "nl-nl", "nl" : ConvertLanguage2 = 31 ' Dutch
514 case "fr_fr", "fr-fr", "fr" : ConvertLanguage2 = 33 ' French
515 case "es_es", "es-es", "es" : ConvertLanguage2 = 34 ' Spanish
516 case "fi_fi", "fi-fi", "fi" : ConvertLanguage2 = 35 ' Finnish
517 case "hu_hu", "hu-hu", "hu" : ConvertLanguage2 = 36 ' Hungaria
518 case "ca_ad", "ca-ad", "ca" : ConvertLanguage2 = 37 ' Catalan
519 case "it_it", "it-it", "it" : ConvertLanguage2 = 39 ' Italian
520 case "cs_cz", "cs-cz", "cs" : ConvertLanguage2 = 42 ' Czech
521 case "sk_sk", "sk-sk", "sk" : ConvertLanguage2 = 43 ' Slowak
522 case "en_gb", "en-gb" : ConvertLanguage2 = 44 ' English (GB)
523 case "da_dk", "da-dk", "da" : ConvertLanguage2 = 45 ' Danish
524 case "sv_se", "sv-se", "sv" : ConvertLanguage2 = 46 ' Swedish
525 case "no_no", "no-no", "no" : ConvertLanguage2 = 47 ' Norwegian
526 case "pl_pl", "pl-pl", "pl" : ConvertLanguage2 = 48 ' Polish
527 case "de_de", "de-de", "de" : ConvertLanguage2 = 49 ' German
528 case "sr_rs", "sr_rs", "sr" : ConvertLanguage2 = 51 ' Serbian (Cyrillic)
529 case "sh_rs", "sh_rs", "sh" : ConvertLanguage2 = 52 ' Serbian (Latin)
530 case "pt_br", "pt-br", "br" : ConvertLanguage2 = 55 ' Portuguese (Brazil)
531 case "th_th", "th-th", "th" : ConvertLanguage2 = 66 ' Thai
532 case "ja_jp", "ja-jp", "ja" : ConvertLanguage2 = 81 ' Japanese
533 case "ko_kr", "ko-kr", "ko" : ConvertLanguage2 = 82 ' Korean
534 case "vi_vi", "vi_vi", "vi" : ConvertLanguage2 = 84 ' Vietnamese
535 case "zh_cn", "zh-cn", "zh" : ConvertLanguage2 = 86 ' Chinese (simplified)
536 case "zh_tw", "zh-tw" : ConvertLanguage2 = 88 ' Chinese (traditional)
537 case "tr_tr", "tr-tr", "tr" : ConvertLanguage2 = 90 ' Turkish
538 case "hi_in", "hi-in", "hi" : ConvertLanguage2 = 91 ' Hindi
539 case "ar_ar", "ar-ar", "ar" : ConvertLanguage2 = 96 ' Arabic
540 case "he_he", "he-he", "he" : ConvertLanguage2 = 97 ' Hebrew
541 case "sl_si", "sl-si", "sl" : ConvertLanguage2 = 386
542 case "zz_zz", "zz-zz", "zz" : ConvertLanguage2 = 01 ' unknown
543 case else : if isMissing (bExact) then
544 printlog "iniinfo.inc::ConvertLanguage2(): Unknown systemlanguage '" & sSprache & "'!"
545 printlog "Default will be set to 01!"
546 ConvertLanguage2 = 01
548 printlog "iniinfo.inc::ConvertLanguage2(): Unknown systemlanguage '" & sSprache & "'!"
549 if bExact = TRUE then
550 printlog "Default will be set to 00!"
551 ConvertLanguage2 = 00
557 '-------------------------------------------------------------------------
559 function ConvertCodeToLanguage ( sSprache as String ) as Integer
560 '/// Converts the old language code to international language code
562 select case lCase ( sSprache )
563 case "1033" : ConvertCodeToLanguage = 01 ' English (USA)
564 case "2070" : ConvertCodeToLanguage = 03 ' Portuguese
565 case "1049" : ConvertCodeToLanguage = 07 ' Russian
566 case "1032" : ConvertCodeToLanguage = 30 ' Greek
567 case "1043" : ConvertCodeToLanguage = 31 ' Dutch
568 case "1036" : ConvertCodeToLanguage = 33 ' French
569 case "3082" : ConvertCodeToLanguage = 34 ' Spanish
570 case "1034" : ConvertCodeToLanguage = 34 ' Spanish
571 case "1035" : ConvertCodeToLanguage = 35 ' Finnish
572 case "1038" : ConvertCodeToLanguage = 36 ' Hungaria
573 case "2099" : ConvertCodeToLanguage = 37 ' Catalan
574 case "1040" : ConvertCodeToLanguage = 39 ' Italian
575 case "1029" : ConvertCodeToLanguage = 42 ' Czech
576 case "1051" : ConvertCodeToLanguage = 43 ' Slowak
577 case "2057" : ConvertCodeToLanguage = 44 ' English (GB)
578 case "1030" : ConvertCodeToLanguage = 45 ' Danish
579 case "1053" : ConvertCodeToLanguage = 46 ' Swedish
580 case "2047" : ConvertCodeToLanguage = 47 ' Norwegian
581 case "1045" : ConvertCodeToLanguage = 48 ' Polish
582 case "1031" : ConvertCodeToLanguage = 49 ' German
583 case " " : ConvertCodeToLanguage = 55 ' Portuguese (Brazil)
584 case "3098" : ConvertCodeToLanguage = 51 ' Serbian (Cyriliic)
585 case "2074" : ConvertCodeToLanguage = 52 ' Serbian (Latin)
586 case " " : ConvertCodeToLanguage = 66 ' Thai
587 case "1041" : ConvertCodeToLanguage = 81 ' Japanese
588 case "1042" : ConvertCodeToLanguage = 82 ' Korean
589 case "1066" : ConvertCodeToLanguage = 84 ' Vietnamese
590 case "2052" : ConvertCodeToLanguage = 86 ' Chinese (simplified)
591 case "1028" : ConvertCodeToLanguage = 88 ' Chinese (traditional)
592 case "1055" : ConvertCodeToLanguage = 90 ' Turkish
593 ' case " " : ConvertCodeToLanguage = 91 ' Hindi
594 case "1025" : ConvertCodeToLanguage = 96 ' Arabic
595 ' case " " : ConvertCodeToLanguage = 97 ' Hebrew
596 case "1060" : ConvertCodeToLanguage = 386 ' Slovenian
597 case else : printlog "iniinfo.inc::ConvertCodeToLanguage(): Num. Code could not be detect or is unknown and will be set to 01 (English (USA))!"
598 ConvertCodeToLanguage = 01
602 '-------------------------------------------------------------------------
604 sub GetTheInstallationType
605 '/// If StarOffice is installed as a network installation the global variable 'gNetzInst' and 'gNetzOfficePath' will be set here.
606 Dim sCommonXML as String, sDummy as String, sDestPath as String, sSourcePath as String, sMode as String
614 dim sPlatformProgramPath as string
616 if ( lcase( gPlatform ) = "osx" ) then
617 sPlatformProgramPath = "MacOS"
619 sPlatformProgramPath = "program"
622 if gSamePC = TRUE then
624 gNetzOfficePath = gOfficePath
625 if (gSamePC = TRUE) then
626 if gPlatgroup = "unx" then
627 sTemp = GetIniValue (gOfficePath & sPlatformProgramPath & "/bootstraprc", "Bootstrap", "UserInstallation")
629 sTemp = GetIniValue (gOfficePath & sPlatformProgramPath & "\bootstrap.ini", "Bootstrap", "UserInstallation")
632 sURL = convertFromURL(sTemp) ' to get the % encoded chars decoded! and to remove "file://" if somebody provides a URL
633 ' Formerly I had to fake the string with a starting "file://" to use the function; nowadays it works without it
634 if inStr(sURL,"$SYSUSERCONFIG") > 0 then
635 gOfficePath = gtSystemPath + right(sURL, len(sURL) - (inStr(sURL,"$SYSUSERCONFIG")+len("$SYSUSERCONFIG"))) + gPathSigne
637 if inStr(sURL,"$ORIGIN") > 0 then
638 gOfficePath = gOfficePath & sPlatformProgramPath & gPathSigne + right(sURL, len(sURL) - (inStr(sURL,"$ORIGIN")+len("$ORIGIN"))) + gPathSigne
640 if inStr(sTemp,"file://") > 0 then
641 ' file:// had to get removed on calling convertFromURL() sTemp -> sURL
642 gOfficePath = sURL + gPathSigne
644 if inStr(sURL,"$BRAND_BASE_DIR") > 0 then
645 gOfficePath = gOfficePath & right(sURL, len(sURL) - (inStr(sURL,"$BRAND_BASE_DIR")+len("$BRAND_BASE_DIR")))
647 qaErrorLog "ininfo.inc::GetTheInstallationType:: Unexpected entry in bootstrap file.(Entry UserInstallation not starting with: $SYSUSERCONFIG or $ORIGIN or file://; Using entry as absolute path!)"
648 printlog "ininfo.inc::GetTheInstallationType:: original UserInstallation entry from 'bootstrap' file: '" + sTemp + "'"
649 printlog "ininfo.inc::GetTheInstallationType:: using now converted from URL for 'gOfficePath': '" + sURL + "'"
650 gOfficePath = sURL + gPathSigne
655 ' make unique platform path seperators
656 gOfficePath = convertPath(gOfficePath)
657 ' to support some developer bootstraprc/ini's:
658 gOfficePath = fRelativeToAbsolutePath(gOfficePath)
659 gOfficePath = fRemoveDoubleCharacter(gOfficePath + gPathSigne, gPathSigne)
661 gNetzInst = GetIniValue ( gTesttoolIni, "Network", "Net" )
662 gNetzOfficePath = GetIniValue ( gTesttoolIni, "Network", "Current" )
663 if Right ( gNetzOfficePath,1 ) <> gPathSigne then gNetzOfficePath = gNetzOfficePath + gPathSigne
667 '-------------------------------------------------------------------------
669 function ReplaceCharacter(stringToChange$, charToReplace$, replaceWith$) As String
670 '/// Replaces a specified character in a string with another character that you specify
671 '///+ INPUT: <string> , <which characterto replace> , <which caracter the old one should be replaced>
673 Dim NextLetter As String
674 Dim FinalString As String
675 Dim txt, char, rep As String
677 txt = stringToChange$ 'store all arguments in
678 char = charToReplace$ 'new variables
682 for n = 1 To ln Step 1
683 NextLetter = Mid(txt, n, 1)
684 if NextLetter = char Then
687 FinalString = FinalString & NextLetter
689 ReplaceCharacter = FinalString
693 '-------------------------------------------------------------------------
695 function FileURLToNormalFile ( sFileURL as String ) as String
696 '/// Converts a file URL to a system specific URL.
697 FileURLToNormalFile = convertFromURL( sFileURL )
700 '-------------------------------------------------------------------------
702 function fgetL10Nvalue ( setupxcu as string) as string
703 '/// Gets the value of the child from
704 '///+ <ul><li>node: oor:name="L10N"<ul><li>node: oor:name = "ooLocale"</li><ul><li>element: value</li></ul></ul></li></ul>
705 '///+ in a file (normaly <b>Setup.xcu</b> in network path or installation path).
706 '/// <u>Note</u>: The structure is hard coded and specified. A change must be announced by feature mail!
707 '/// <u><i>Description</i></u>:
709 Dim ChildsOfSetupNodes as integer
713 '///<ul><li>Open the file given as parameter.</li>
714 SAXReadFile(setupxcu)
715 '///+<li>Go to the DOM (Document Object Model) root.</li>
717 '///+<li>Go <b>into</b> the first <b>node</b> of the tree.</li>
719 '///+<li>Get the <b>count of children</b> (nodes/elements) in that node.</li>
720 ChildsOfSetupNodes = SAXGetChildCount
721 for i = 1 to ChildsOfSetupNodes
722 '///+<li>Run in a for next loop of going <b>into</b> the next node and existing it until ...</li>
724 '///+<li>...the <i>oor:name</i> attribute value is identical to "L10N"</li>
725 if SaxGetAttributeValue("oor:name") = "L10N" then
726 '///+<li>Go <b>into</b> the next node ("prop")</li>
727 SAXSeekElement("prop")
728 '///+<li>If the attribute value of "oor:name" is identical to "ooLocale"...</li>
729 if SAXgetAttributeValue("oor:name") = "ooLocale" then
730 '///+<li>go <b>into</b> that node and also into the next one, named "value".</li>
731 SAXSeekElement("value")
732 '///+<li>Go <b>into</b> the next node - a <i>node type</i> <b>character</b>...</li>
734 if SAXGetNodeType = NodeTypeCharacter then
735 '///+<li>...and get the characters out in the string which will be returned from this function.</li>
736 fgetL10Nvalue = SAXGetChars
737 '///+<li><i>Release()</i> the DOM.</li>
739 '///+<li>Exit the function.</li></ul>
744 '/// If the result is empty exit the function without warning.</ul>
752 '-------------------------------------------------------------------------
754 function hPlatformToGroup(sPLatform as string) as string
755 '/// <u>Input</u>: string of class gPlatform
756 '/// <u>Output</u>: string of class gPlatGroup
757 select case sPLatform
758 case "w95":hPlatformToGroup = "w95"
759 case "w98":hPlatformToGroup = "w95"
760 case "wse":hPlatformToGroup = "w95"
761 case "wme":hPlatformToGroup = "w95"
762 case "wnt":hPlatformToGroup = "w95"
763 case "w2k":hPlatformToGroup = "w95"
764 case "wxp":hPlatformToGroup = "w95"
765 case "mac":hPlatformToGroup = "mac"
766 case "ppc":hPlatformToGroup = "unx"
767 case "sol":hPlatformToGroup = "unx"
768 case "x86":hPlatformToGroup = "unx"
769 case "lin":hPlatformToGroup = "unx"
770 case "fbsd":hPlatformToGroup= "unx"
771 case "nbsd":hPlatformToGroup= "unx"
772 case "lin64":hPlatformToGroup= "unx"
773 case "linsparc":hPlatformToGroup = "unx"
774 case "ecs":hPlatformToGroup = "ecs"
778 '-------------------------------------------------------------------------
780 sub sGetCrashreporterValues as boolean
781 '/// This routine reads the values of the [Crashreporter] section
782 '///+ in the TestTool control file (testtool.ini / .testtoolrc).
783 '///It returns FALSE if one of the required
784 '///+ information is missing in testtool.ini.
786 sGetCrashreporterValues = FALSE
787 '/// <i>gUseProxy</i> should be TRUE if you need a proxy or FALSE
788 '///+ if you have a direct connection to the (inter)net.
789 gUseProxy = GetIniValue ( gTesttoolIni, "Crashreporter" , "UseProxy" )
790 'If there's no value (=no entries at all...) exit the routine.
791 'sGetCrashreporterValues = FALSE so the routine in master.inc
793 if gUseProxy = "" then
796 'Making a boolean value from it.
797 gUseProxy = cBool(gUseProxy)
798 '/// <i>gConnectiontype</i> has the value DIRECT or MANUALPROXY in dependency
799 '///+ of <i>gUseProxy</i>. If <i>gUseProxy</i> = TRUE then the value of
800 '///+ <i>gConnectiontype</i> is MANUALPROXY otherwiese DIRECT.
801 if gUseProxy = FALSE then
802 gConnectionType = "DIRECT"
803 sGetCrashreporterValues = TRUE
805 gConnectionType = "MANUALPROXY"
809 '/// <i>gProxyServer</i> should be the proxy server which is needed to send
810 '///+ the crashreporter data via the net.
811 gProxyServer = GetIniValue ( gTesttoolIni, "Crashreporter" , "ProxyServer" )
812 'Verifying that a proxy server has been entered if
813 'gUseProxy has been set to TRUE.
814 if gUseProxy = TRUE AND gProxyServer = "" then
815 warnlog "qatesttool::global::system::inc::iniinfo.inc::sGetCrashReporterValue: " _
816 & "In the [Crashreporter]-section of TestTool control file 'UseProxy=true' but 'ProxyServer=' (empty). Please correct it!"
817 sGetCrashreporterValues = FALSE
819 sGetCrashreporterValues = TRUE
822 '/// <i>gProxyPort</i> should be the proxy server port which is needed to send
823 '///+ the crashreporter data via the net.
824 gProxyPort = GetIniValue ( gTesttoolIni, "Crashreporter" , "ProxyPort" )
825 'Verifying that a proxy server port has been entered if
826 'gUseProxy has been set to TRUE.
827 if gUseProxy = TRUE AND gProxyPort = "" then
828 sGetCrashreporterValues = FALSE
829 warnlog "qatesttool::global::system::inc::iniinfo.inc::sGetCrashReporterValue: " _
830 & "In the [Crashreporter]-section of TestTool control file 'UseProxy=true' but 'ProxyPort=' (empty). Please correct it!"
833 ' to workaround issue i94779 set server and port to empty in case of direkt access
838 '/// <i>gAllowContact</i> should be TRUE or FALSE
839 gAllowContact = GetIniValue ( gTesttoolIni, "Crashreporter" , "AllowContact" )
840 gAllowContact = cBool(gAllowContact)
842 '/// <i>gReturnAddress</i> should be the E-Mail address which can be used
843 '///+ to contact the user who has run the test scripts for additional information .
844 gReturnAddress = GetIniValue ( gTesttoolIni, "Crashreporter" , "ReturnAddress" )
845 'Verifying that a mail address has been entered if
846 'gAllowContact has been set to TRUE.
847 if gAllowContact = TRUE AND gReturnAddress = "" then
848 warnlog "qatesttool::global::system::inc::iniinfo.inc::sGetCrashReporterValue: " _
849 & "In the [Crashreporter]-section of TestTool control file 'AllowContact=true' but 'ReturnAddress=' (empty). Please correct it!"
850 sGetCrashreporterValues = FALSE
855 '-------------------------------------------------------------------------
857 function getSofficeNative() as string
858 '/// Entry in Win32-registry or either link exist: /usr/bin/soffice - $HOME/soffice (aka Native Installer (OOo > SRC680m49)) ///'
859 dim sVendor(50) as string
860 dim sOffice(50) as string
861 dim sVersion(50) as string
862 dim iVendorEntries as integer
863 dim iVersionEntries as integer
864 dim iOfficeEntries as integer
865 dim iOOoVersionBorder as integer
866 dim i,x,y,z,j as integer
867 dim iVendor(2) as integer
868 dim iVersion(2) as integer
869 dim iOffice(2) as integer
870 dim sOfficePath(2) as string
871 dim sTemp, sTemp2 as string
872 dim sSVersionIni(2) as string
873 dim iSversion as integer
874 dim sCandidates(2) as string
876 dim sPath(2) as string
877 dim iBuildId(2) as string
878 dim slVersion() as string
879 dim ilVersion as integer
880 dim sLastVersion as string
881 dim iPosA, iPosB as integer
882 dim bError as boolean
886 '/// separated handling between Linux/Unix and Win32 platforms ///'
887 if ("unx" = gPlatGroup) then
888 '/// on Linux/Unix systems we need to check/resolv 2 possible links which point to the directory with the 'soffice' executable ///'
890 '/// created by an installation from the root user: //usr//bin//soffice ///'
891 sCandidates(1) = getLinkDestination("/usr/bin/soffice") ' command fails, if link doesn't exist
892 if (left(sCandidates(1),2)="..") then
893 ' If the link is relative, make it absolute
894 sCandidates(1) = "/usr/bin/" + sCandidates(1)
895 sCandidates(1) = fRelativeToAbsolutePath(sCandidates(1))
896 sCandidates(1) = fRemoveDoubleCharacter(sCandidates(1), gPathSigne)
898 ' DEBUG: If you need more detailed information about the installation environment
899 ' enable the next line.
900 ' printlog "getSofficeNative() - : /usr/bin/soffice: '" + sCandidates(1) + "' destination exists?: " +fileExists(sCandidates(1))
902 ' DEBUG: If you need more detailed information about the installation environment
903 ' enable the next line.
904 ' printlog "getSofficeNative() - : /usr/bin/soffice: NOT AVAILABLE"
908 '/// HAS TO GET created by installation from NON root user: $HOME/soffice ///'
909 sTemp = Environ("HOME")
910 sCandidates(2) = getLinkDestination(sTemp+"/soffice")
911 if (left(sCandidates(2),1) <> "/") then
912 ' relative path in $HOME directory!
913 sCandidates(2) = sTemp + "/" + sCandidates(2)
915 ' DEBUG: If you need more detailed information about the installation environment
916 ' enable the next line.
917 ' printlog "getSofficeNative() - : $HOME/soffice : '" + sCandidates(2) + "' destination exists?: " +fileExists(sCandidates(2))
919 ' DEBUG: If you need more detailed information about the installation environment
920 ' enable the next line.
921 ' printlog "getSofficeNative() - : $HOME/soffice : NOT AVAILABLE"
925 if fileExists(sCandidates(i)) then
926 '/// cut off program//soffice from link destination ///'
927 y = instr(sCandidates(i), "program/soffice")
928 if ( lcase( gPlatform ) = "osx" AND y < 1 ) then
929 ' Accept also MacOS in link to soffice binary
930 y = instr(sCandidates(i), "MacOS/soffice")
933 sCandidates(i) = left(sCandidates(i), y-1)
935 qaErrorLog "master.inc::getSofficeNative():: expected 'program/soffice' at end of link destination: '" + sCandidates(i) + "'"
940 if (("" = sCandidates(1)) or ("" = sCandidates(2))) then
941 ' if one candidate doesn't exist
942 '/// If only one candidate exist, take him. ///'
943 gOfficePath = sCandidates(1) + sCandidates(2)
945 ' both candidates exist
946 '/// If both candidates exits... ///'
948 '/// - Check if link destination exists; No: drop candidate ///'
949 if fileExists(sCandidates(i)) then
952 ' link destination doesn't exist: drop candidate
957 ' DEBUG: If you need more detailed information about the installation environment
958 ' enable the next line.
959 ' printlog "getSofficeNative() - : BildId (1): " + iBuildId(1) + " (2): " + iBuildId(2)
960 '/// - Take the candidate which exists and comes from $HOME ///'
961 if (iBuildId(1) > iBuildId(2)) then
962 gOfficePath = sCandidates(1)
964 '/// - If BuildIds are equal, the candidate from $HOME wins ///'
965 gOfficePath = sCandidates(2)
968 if (not fileExists(gOfficePath)) then
969 '/// - check if resulting candidate exist; No: error ///'
973 '/// On win32 systems we need to check the registry for two paths with the key 'Path': ///'
975 ' "--K--\Software\--Vendor--\--Product--\--Version--"
976 '/// If User installs, the path 'HKEY_CURRENT_USER\\Software\\' got set.///'
977 sPath(1) = "HKEY_CURRENT_USER\Software\"
978 '/// If Administrator installs, the path 'HKEY_LOCAL_MACHINE\\Software\\' got set.///'
979 sPath(2) = "HKEY_LOCAL_MACHINE\Software\"
981 '/// An entry in the registry consists of 2 parts: 1st the Office, 2nd the version-number ///'
982 '/// There may be several entries, but only the newest version is used. ///'
983 '/// There may exist both Paths HKCU and HKLM///'
984 '/// Which version is used? ///'
985 '/// From both Paths the newest version is chosen: from the lowest sOffice() the lowest sVersion() ///'
986 '/// If in both paths the entries are equal, the HKCU wins. ///'
988 sVendor(iVendorEntries) = "Sun Microsystems": inc (iVendorEntries)
989 sVendor(iVendorEntries) = "OpenOffice.org" : inc (iVendorEntries)
992 sOffice(iOfficeEntries) = "StarOffice" : inc (iOfficeEntries)
993 sOffice(iOfficeEntries) = "StarSuite" : inc (iOfficeEntries)
994 sOffice(iOfficeEntries) = "OpenOffice.org": inc (iOfficeEntries)
997 sVersion(iVersionEntries) = "9" : inc (iVersionEntries)
998 sVersion(iVersionEntries) = "8" : inc (iVersionEntries)
999 iOOoVersionBorder = iVersionEntries
1000 sVersion(iVersionEntries) = "2.0.0" : inc (iVersionEntries)
1001 sVersion(iVersionEntries) = "680" : inc (iVersionEntries)
1002 sVersion(iVersionEntries) = "2.2" : inc (iVersionEntries)
1004 ' put new versions ABOVE THIS LINE! ^^^^^^^^^^^
1005 sVersion(iVersionEntries) ="NotFound": inc (iVersionEntries) ' HAS TO Stay at LAST
1007 ' I have to walk over both sPath(z),
1008 ' over all sOffice(y)-1
1009 ' over all sVersion(x)-2
1010 ' the first one found in each sPath(z) wins.
1013 for j =1 to iVendorEntries-1
1014 for y =1 to iOfficeEntries-1
1015 for x =1 to iVersionEntries-2
1016 'collect all entries != "" (empty string)
1017 if sOfficePath(z) = "" then ' if no version found right now, set it
1018 sTemp = sPath(z) + sVendor(j) + "\" + sOffice(y) + "\" + sVersion(x)
1019 sOfficePath(z) = getRegistryValue(sTemp, sKey)
1020 iOffice(z) = z*1000 + j*100 + y*10 + x
1021 if (sOfficePath(z) <> "") AND fileExists(sOfficePath(z)) then
1022 ' DEBUG: If you need more detailed information about the installation environment
1023 ' enable the next line.
1024 ' printlog "getSofficeNative() - : A " + z + ":" + j + ":" + y + ":" + x + " " + sTemp + " +++++++++++ " + sOfficePath(z)
1026 ' printlog "getSofficeNative() - : C " + z + ":" + j + ":" + y + ":" + x + " " + sTemp + " +++++++++++ " + sOfficePath(z)
1031 ' This is just for completeness. B has no effect, A counts.
1032 sTemp = sPath(z) + sVendor(j) + "\" + sOffice(y) + "\" + sVersion(x)
1034 sTemp2 = getRegistryValue(sTemp, sKey)
1035 if (sTemp2 <> "") then
1036 ' DEBUG: If you need more detailed information about the installation environment
1037 ' enable the next line.
1038 ' printlog "getSofficeNative() - : B " + z + ":" + j + ":" + y + ":" + x + " " + sTemp + " +++++++++++ "+sTemp2
1047 ' remove path, if destination doesn't exist
1048 if (NOT fileExists(sOfficePath(1))) then
1051 if (NOT fileExists(sOfficePath(2))) then
1054 ' compute version to be used
1055 if (sOfficePath(1) = "") or (sOfficePath(2) = "") then
1056 gOfficePath = sOfficePath(1) + sOfficePath(2)
1058 if (iOffice(1) > iOffice(2)) then
1059 gOfficePath = sOfficePath(2)
1061 gOfficePath = sOfficePath(1)
1065 if (gOfficePath = "" or not fileExists(gOfficePath)) then
1066 ' Error of no office is found
1069 ' cut of the executable name
1070 i = instr(gOfficePath, "program\soffice.exe")
1072 gOfficePath = left(gOfficePath, i-1)
1074 qaErrorLog "master.inc::getSofficeNative():: expected 'program/soffice.exe' at end of link destination: '" + gOfficePath + "'"
1078 ' now we have gOfficePath set.
1080 if (not bError) then
1081 ' needed input for function: fGetProductName()
1082 '/// Look, if we got an OpenOffice.org version ///'
1083 gNetzOfficePath = gOfficePath
1084 '/// Setting the global <i>gProductName</i> variable here.
1085 gProductName = fGetProductName
1086 ' A special build of OpenOffice.org is OOo-dev; #i56804#
1087 if (gProductName = "OOo-dev") then
1088 gProductName = "OpenOffice.org"
1089 PrintLog "This is a 'OOo-dev' product build."
1091 if (instr(gProductName, "OpenOffice.org") > 0) then
1096 getSofficeNative = gOfficePath ' set return value
1098 '/// If error occured, set returnvalue to "" - empty srting ///'
1099 getSofficeNative = "" ' set return value
1103 '-------------------------------------------------------------------------
1105 function getSofficeTesttool() as string
1109 '/// <ol><li>Look into the current profile section of the TestTool control file </li>
1110 '/// deprecated, just kept here for compatibility
1111 sTemp = GetIniValue ( gTesttoolIni, gTTProfileName, "OOoProgramDir" )
1112 if (sTemp = "") then
1113 '///+ <li>Look into the global section of the TestTool control file OOoProgramDir section</li></ol>
1114 sTemp = GetIniValue ( gTesttoolIni, "OOoProgramDir", "Current" )
1116 ' Throw error, if the default '.' from first startup is found
1117 if fileExists(sTemp) AND NOT (sTemp = "." )then
1118 ' make sure path ends with path seperator
1119 if (right(sTemp,1) <> gPathSigne) then
1120 sTemp = sTemp + gPathSigne
1122 ' be tolerant to the chosen path
1123 ' we just need the base directory, cut of possible "program" at end
1124 if ( lcase( gPlatform ) = "osx" ) then
1125 ' to get all possibile directories:
1126 ' path could be: ...app/Contents/MacOS
1127 if (right(sTemp,6) = "MacOS"+gPathSigne) then
1128 sTemp = left(sTemp,len(sTemp)-6)
1130 if (right(sTemp,5) = ".app"+gPathSigne) then
1131 sTemp = sTemp + "Contents/"
1134 if (right(sTemp,8) = "program"+gPathSigne) then
1135 sTemp = left(sTemp,len(sTemp)-8)
1138 getSofficeTesttool = sTemp
1140 gNetzOfficePath = gOfficePath
1141 '/// Setting the global <i>gProductName</i> variable here because GetSofficeNative()
1142 '///+ won't fill this global variable if [OOoProgramDir] is being used.
1143 gProductName = fGetProductName
1144 ' A special build of OpenOffice.org is OOo-dev; #i56804#
1145 if (gProductName = "OOo-dev") then
1146 gProductName = "OpenOffice.org"
1147 PrintLog "This is a 'OOo-dev' product build."
1149 if (instr(gProductName, "OpenOffice.org") > 0) then
1154 getSofficeTesttool = sTemp
1156 '/// No valid path will return an empty string.
1157 getSofficeTesttool = ""
1161 '-------------------------------------------------------------------------
1163 function sGetScreenshotValue as boolean
1164 '/// Read the entry [Screenshot] in the TestTool control file (testtool.ini / .testtoolrc).
1165 '///It returns FALSE if no screenshots are taken (default)
1166 '///+ TRUE if the entry in the file exists and is TRUE or 1 ///'
1167 dim sScreenshotValue as string
1168 dim bScreenshotValue as boolean
1170 sScreenshotValue = GetIniValue ( gTesttoolIni, "Screenshot" , "Current" )
1171 if sScreenshotValue <> "" then
1172 bScreenshotValue = cBool(sScreenshotValue)
1173 if bScreenshotValue then
1174 printlog "** There will be screenshots taken from every dialog"
1177 bScreenshotValue = FALSE
1179 sGetScreenshotValue = bScreenshotValue
1182 '-------------------------------------------------------------------------
1184 function fgetOOoStartupTimeOut as integer
1185 '/// Read the entry [OOoStartupTimeOut] in the TestTool control file (testtool.ini / .testtoolrc).
1186 '///It returns 0 if the entry doesn't exist (default)
1187 '///+ >0 if the entry in the file exists and is >0 ///'
1188 dim sOOoStartupTimeOut as string
1189 dim iOOoStartupTimeOut as integer
1191 sOOoStartupTimeOut = getIniValue ( gTesttoolIni, "OOoStartupTimeOut" , "Current" )
1192 if sOOoStartupTimeOut <> "" then
1193 iOOoStartupTimeOut = cInt(sOOoStartupTimeOut)
1194 if iOOoStartupTimeOut > 0 then
1195 printlog "** OOo will be given extra time for startup: '" + iOOoStartupTimeOut + "' seconds"
1198 iOOoStartupTimeOut = 0
1200 fgetOOoStartupTimeOut = iOOoStartupTimeOut
1203 '-------------------------------------------------------------------------
1205 function fgetOOoShutdownTimeOut as integer
1206 '/// Read the entry [OOoShutdownTimeOut] in the TestTool control file (testtool.ini / .testtoolrc).
1207 '///It returns 0 if the entry doesn't exist (default)
1208 '///+ >0 if the entry in the file exists and is >0 ///'
1209 dim sOOoShutdownTimeOut as string
1210 dim iOOoShutdownTimeOut as integer
1212 sOOoShutdownTimeOut = GetIniValue ( gTesttoolIni, "OOoShutdownTimeOut" , "Current" )
1213 if sOOoShutdownTimeOut <> "" then
1214 iOOoShutdownTimeOut = cInt(sOOoShutdownTimeOut)
1215 if iOOoShutdownTimeOut >0 then
1216 printlog "** OOo will be given extra time for shutdown: '" + iOOoShutdownTimeOut + "' seconds"
1219 iOOoShutdownTimeOut = FALSE
1221 fgetOOoShutdownTimeOut = iOOoShutdownTimeOut
1224 '-------------------------------------------------------------------------
1226 function getOfficeBasisPath as string
1228 const CFN = "global::system::iniinfo.inc:getOfficeBasisPath: "
1229 'get the basis directory from the information of basis-link
1230 dim ltemp(5) as string
1235 sTemp = gNetzOfficePath
1236 sFile = gNetzOfficePath & "basis-link"
1238 if FileExists( sFile ) then
1239 if ( lcase( gPlatform ) = "osx" ) then
1243 if ( gPlatGroup = "unx" ) then
1245 sPath = getLinkDestination( sFile )
1246 sTemp = fRelativeToAbsolutePath( gNetzOfficePath & sPath )
1247 if ( NOT FileExists( sTemp ) ) then
1248 sTemp = fRelativeToAbsolutePath( sPath )
1252 'all other platforms are Windows/DOS style
1253 ListRead( lTemp, sFile )
1254 if lTemp(1) <> "" then
1256 sTemp = fRelativeToAbsolutePath( gNetzOfficePath & sTemp )
1261 warnlog( CFN & "Basis-link could not be found" )
1264 if ( NOT FileExists( sTemp ) ) then
1265 warnlog( CFN & "Retrieved invalid path" )
1268 getOfficeBasisPath = sTemp & gPathSigne