xref: /trunk/test/smoketestdoc/data/Global.xml (revision a622bb93)
1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?>
25111cb72SAndrew Rist<!--***********************************************************
35111cb72SAndrew Rist *
45111cb72SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
55111cb72SAndrew Rist * or more contributor license agreements.  See the NOTICE file
65111cb72SAndrew Rist * distributed with this work for additional information
75111cb72SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
85111cb72SAndrew Rist * to you under the Apache License, Version 2.0 (the
95111cb72SAndrew Rist * "License"); you may not use this file except in compliance
105111cb72SAndrew Rist * with the License.  You may obtain a copy of the License at
115111cb72SAndrew Rist *
125111cb72SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
135111cb72SAndrew Rist *
145111cb72SAndrew Rist * Unless required by applicable law or agreed to in writing,
155111cb72SAndrew Rist * software distributed under the License is distributed on an
165111cb72SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
175111cb72SAndrew Rist * KIND, either express or implied.  See the License for the
185111cb72SAndrew Rist * specific language governing permissions and limitations
195111cb72SAndrew Rist * under the License.
205111cb72SAndrew Rist *
215111cb72SAndrew Rist ***********************************************************-->
225111cb72SAndrew Rist
235111cb72SAndrew Rist
24cdf0e10cSrcweir<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
25cdf0e10cSrcweir<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Global" script:language="StarBasic">REM  *****  BASIC  *****
26cdf0e10cSrcweir
27cdf0e10cSrcweirconst cMaxErrorStates = 14
28cdf0e10cSrcweir
29cdf0e10cSrcweirconst cCoGreen = 4057917, cCoRed = 16711680, cCoGrey = 12632256
30cdf0e10cSrcweirconst cParagraphBreak = 0
31cdf0e10cSrcweir
32cdf0e10cSrcweirglobal const cExtensionFileName = &quot;TestExtension.oxt&quot;
33cdf0e10cSrcweir
34cdf0e10cSrcweirglobal const cDocNew = 0, cDocSaveOpen8 = 1, cDocSaveOpenXML = 2, cDocClose = 3
35cdf0e10cSrcweirglobal const cDBService = 0, cDBOpen = 1, cDBInsert = 2, cDBDelete = 3, cDBSeek = 4, cDBClose = 5
36cdf0e10cSrcweirglobal const cEXTService = 0, cEXTInstall = 1, cEXTUninstall = 2
37cdf0e10cSrcweirglobal const cTestClosureSetupDoc = 0, cTestClosureWriteStatus = 1
38cdf0e10cSrcweirglobal const cLogfileFailed = 255
39cdf0e10cSrcweir
40cdf0e10cSrcweirglobal const cStWriter = 0, cStCalc = 1, cStPraesentation = 2, cStZeichnen = 3
41cdf0e10cSrcweirglobal const cStHTML = 6, cStChart = 4, cStJava = 7
42cdf0e10cSrcweirglobal const cStMath = 5, cStDataBase = 9
43cdf0e10cSrcweirglobal const cStExtension = 11
44cdf0e10cSrcweirglobal const cStTestGlue = 12
45cdf0e10cSrcweirglobal const cStNone = -1
46cdf0e10cSrcweir
47cdf0e10cSrcweirglobal const cFlt8 = 0, cFlt50 = 32, cFltNewDoc = 64, cFltXML = 128
48cdf0e10cSrcweir
49cdf0e10cSrcweirglobal const frmWriter = 1, frmCalc = 2, frmImpress = 4
50cdf0e10cSrcweirglobal const frmMath = 5, frmChart = 7, frmHyperText = 8, frmDraw = 9
51cdf0e10cSrcweirglobal const frmDataBase = 10, frmJava = 13
52cdf0e10cSrcweirglobal const frmExtension = 14
53cdf0e10cSrcweirglobal const frmTestClosure = 15
54cdf0e10cSrcweir
55cdf0e10cSrcweirGlobal gCurrentDocTest As Integer
56cdf0e10cSrcweirGlobal gCurrentTestCase As Integer
57cdf0e10cSrcweir
58cdf0e10cSrcweirglobal const cLogUnknown = 0, cLogFalse = 1, cLogTrue = 2
59cdf0e10cSrcweir
60cdf0e10cSrcweir&apos;UserFieldKennungen
61cdf0e10cSrcweirGlobal const cYes = &quot;y&quot;, cNo = &quot;n&quot;
62cdf0e10cSrcweirGlobal const cStateNo = 0, cStateYes = 1
63cdf0e10cSrcweir
64cdf0e10cSrcweir&apos;Feldtypen
65cdf0e10cSrcweirGlobal const cFtExtUser = 21, cFtPageNum = 5, cFtStatistic = 8, cFtDateTime = 27, cFtDatabase = 31
66cdf0e10cSrcweir
67cdf0e10cSrcweir&apos;UnoStrings
68cdf0e10cSrcweirGlobal const cUnoSeparator = &quot;.&quot;
69cdf0e10cSrcweirGlobal const cUnoPrefix = &quot;com.sun.star.&quot;
70cdf0e10cSrcweirGlobal const cUnoUserField = cUnoPrefix + &quot;text.FieldMaster.User&quot;
71cdf0e10cSrcweirGlobal const cUnoExtUserField = cUnoPrefix + &quot;text.TextField.ExtendedUser&quot;
72cdf0e10cSrcweirGlobal const cUnoMasterDataBase = cUnoPrefix + &quot;text.FieldMaster.Database&quot;
73cdf0e10cSrcweirGlobal const cUnoDataBase = cUnoPrefix + &quot;text.TextField.Database&quot;
74cdf0e10cSrcweirGlobal const cUnoDateTime = cUnoPrefix + &quot;text.TextField.DateTime&quot;
75cdf0e10cSrcweirGlobal const cUnoTextGraphi2 = cUnoPrefix + &quot;text.Graphic&quot;
76cdf0e10cSrcweirGlobal const cUnoJavaLoader = cUnoPrefix + &quot;loader.Java&quot;
77cdf0e10cSrcweirGlobal const cUnoDatabaseContext = cUnoPrefix + &quot;sdb.DatabaseContext&quot;
78cdf0e10cSrcweirGlobal const cUnoRowSet = cUnoPrefix + &quot;sdb.RowSet&quot;
79cdf0e10cSrcweirGlobal const cUnoSmoketestTestExtension = cUnoPrefix + &quot;comp.smoketest.TestExtension&quot;
80cdf0e10cSrcweirGlobal const cUnoSmoketestCommandEnvironment = cUnoPrefix + &quot;deployment.test.SmoketestCommandEnvironment&quot;
81cdf0e10cSrcweirGlobal const cExtensionManager = cUnoPrefix + &quot;deployment.ExtensionManager&quot;
82cdf0e10cSrcweir
83cdf0e10cSrcweir&apos;UserFieldNames
84cdf0e10cSrcweirGlobal const cUserFieldTestWriter = &quot;Writer&quot;, cUserFieldTestCalc = &quot;Calc&quot;, cUserFieldTestImpress = &quot;Impress&quot;
85cdf0e10cSrcweirGlobal const cUserFieldTestDraw = &quot;Draw&quot;, cUserFieldTestMath = &quot;Math&quot;, cUserFieldTestChart = &quot;Chart&quot;
86cdf0e10cSrcweirGlobal const cUserFieldTestHTML = &quot;HTML&quot;, cUserFieldTestJava = &quot;Java&quot;, cUserFieldTestDatabase = &quot;Database&quot;
87cdf0e10cSrcweirGlobal const cUserFieldTestExtension = &quot;Extension&quot;
88cdf0e10cSrcweirGlobal const cUserFieldTestOpenSaveXML = &quot;SaveOpenXML&quot;
89cdf0e10cSrcweirGlobal const cUserFieldTestTerminateAfterTest = &quot;Terminate&quot;, cUserFieldTestOpenSave8 = &quot;SaveOpen8&quot;
90cdf0e10cSrcweir
91cdf0e10cSrcweirGlobal const cOptionsDialogName = &quot;OptionsDlg&quot;, cTest10Modul = &quot;Standard&quot;
92cdf0e10cSrcweir
93cdf0e10cSrcweirGlobal const cDlgCancel = 1, cDlgOk = 0, cDlgStartTest = 2
94cdf0e10cSrcweir
95cdf0e10cSrcweirglobal gErrorState (cMaxErrorStates, 5) as integer
96cdf0e10cSrcweirGlobal gTestCaseAnnotations( cMaxErrorStates, 5 ) As String
97cdf0e10cSrcweir
98cdf0e10cSrcweirglobal gOutputDoc as Object
99cdf0e10cSrcweirglobal gOutputDocNotUno as Object
100cdf0e10cSrcweirglobal gOptionsDialog as Object
101cdf0e10cSrcweir
102cdf0e10cSrcweirGlobal bMakeWriterTest as boolean, bMakeCalcTest as  boolean, bMakeImpressTest as boolean
103cdf0e10cSrcweirGlobal bMakeDrawTest as Boolean, bMakeMathTest as boolean, bMakeChartTest as boolean
104cdf0e10cSrcweirGlobal bMakeHTMLTest as boolean, bMakeJavaTest as boolean, bMakeDBTest as boolean
105cdf0e10cSrcweirGlobal bMakeExtensionTest as boolean
106cdf0e10cSrcweirGlobal bMakeSaveOpenXMLTest as boolean
107cdf0e10cSrcweirGlobal bMakeTerminateAfterTest as boolean, bShowTable as boolean
108cdf0e10cSrcweirGlobal bMakeSaveOpen8Test as boolean
109cdf0e10cSrcweir
110cdf0e10cSrcweirglobal sExtensionURL as string
111cdf0e10cSrcweir
112cdf0e10cSrcweirDim gDlgState as Integer
113cdf0e10cSrcweir
114cdf0e10cSrcweirSub SetGlobalDoc
115cdf0e10cSrcweir	gOutputDoc = ThisComponent
116cdf0e10cSrcweirend Sub
117cdf0e10cSrcweir
118cdf0e10cSrcweirSub ClearStatus
119cdf0e10cSrcweir	for j% = 0 to cMaxErrorStates
120cdf0e10cSrcweir		for i% = 0 to 5
121cdf0e10cSrcweir			gErrorState (j%, i%) = cLogUnknown
122cdf0e10cSrcweir			gTestCaseAnnotations( J%, i% ) = ""
123cdf0e10cSrcweir		next i%
124cdf0e10cSrcweir	next j%
125cdf0e10cSrcweirend Sub
126cdf0e10cSrcweir
127cdf0e10cSrcweirSub ClearAllText
128cdf0e10cSrcweir	call SetGlobalDoc
129cdf0e10cSrcweir	call ClearDoc (gOutputDoc)
130cdf0e10cSrcweir	call ClearStatus
131cdf0e10cSrcweirend Sub
132cdf0e10cSrcweir
133cdf0e10cSrcweirSub AssertionHandler( sMessage as String )
134cdf0e10cSrcweir	LogTestResult( &quot;assertion caught: &quot; + sMessage, FALSE )
135cdf0e10cSrcweirEnd Sub
136cdf0e10cSrcweir
137cdf0e10cSrcweirSub Main
138cdf0e10cSrcweir	On Local Error Goto MainError
139cdf0e10cSrcweir
140cdf0e10cSrcweir	gCurrentDocTest = frmTestClosure
141cdf0e10cSrcweir	gCurrentTestCase = cLogfileFailed
142cdf0e10cSrcweir
143cdf0e10cSrcweir	DeleteAllSavedFiles()
144cdf0e10cSrcweir	DeleteAllLogFiles()
145cdf0e10cSrcweir	SetupWorkPath()
146cdf0e10cSrcweir
147cdf0e10cSrcweir	if GetSystem (sWorkPath) = &quot;windows&quot; then
148cdf0e10cSrcweir		sWorkPath = ConvertPathToWin (sWorkPath)
149cdf0e10cSrcweir	end if
150cdf0e10cSrcweir
151cdf0e10cSrcweir	LocalTestLog% = OpenLogDat( GetLogFileName( gCurrentDocTest ) )
152cdf0e10cSrcweir
153cdf0e10cSrcweir	gCurrentTestCase = cTestClosureSetupDoc
154cdf0e10cSrcweir	CaptureAssertions( "AssertionHandler" )
155cdf0e10cSrcweir
156cdf0e10cSrcweir	call SetGlobalDoc
157cdf0e10cSrcweir
158cdf0e10cSrcweir	Dim bWasModified as Boolean
159cdf0e10cSrcweir	bWasModified = gOutputDoc.isModified()
160cdf0e10cSrcweir
161cdf0e10cSrcweir	if bShowTable then
162cdf0e10cSrcweir		call ClearDoc (gOutputDoc)
163cdf0e10cSrcweir	end If
164cdf0e10cSrcweir
165cdf0e10cSrcweir	call ClearStatus
166cdf0e10cSrcweir
167cdf0e10cSrcweir	LogTestResult( GetTestGlueDescription( gCurrentTestCase ), TRUE )
168cdf0e10cSrcweir
169cdf0e10cSrcweir	Dim nPreserveFileHandle%
170cdf0e10cSrcweir	nPreserveFileHandle% = LocalTestLog%
171cdf0e10cSrcweir	Call Test_10er.Main
172cdf0e10cSrcweir	LocalTestLog% = nPreserveFileHandle%
173cdf0e10cSrcweir
174cdf0e10cSrcweir	gCurrentDocTest = frmTestClosure
175cdf0e10cSrcweir	gCurrentTestCase = cTestClosureWriteStatus
176cdf0e10cSrcweir	if bShowTable then
177cdf0e10cSrcweir		call CreateStatusTable2
178cdf0e10cSrcweir		call CreateStatusTable
179cdf0e10cSrcweir		call CreateDocState
180cdf0e10cSrcweir		LogTestResult( GetTestGlueDescription( gCurrentTestCase ), TRUE )
181cdf0e10cSrcweir			&apos; do this LogTestResult call before CreateSecondState, since the latter accesses (and displays) the result
182cdf0e10cSrcweir		call CreateSecondState
183cdf0e10cSrcweir		gOutputDoc.CurrentController.ViewCursor.JumpToFirstPage
184cdf0e10cSrcweir	Else
185cdf0e10cSrcweir		LogTestResult( GetTestGlueDescription( gCurrentTestCase ), TRUE )
186cdf0e10cSrcweir	End If
187cdf0e10cSrcweir
188cdf0e10cSrcweir	&apos; print the &apos;test complete&apos; marker
189cdf0e10cSrcweir	Print #LocalTestLog%, &quot;---&quot;
190cdf0e10cSrcweir	LocalTestLog% = 0
191cdf0e10cSrcweir
192cdf0e10cSrcweir	gOutputDoc.setModified( bWasModified )
193cdf0e10cSrcweir
194cdf0e10cSrcweir	CaptureAssertions( &quot;&quot; )
195cdf0e10cSrcweir	Exit Sub
196cdf0e10cSrcweir
197cdf0e10cSrcweirMainError:
198cdf0e10cSrcweir	If ( gCurrentTestCase = cLogfileFailed ) then
199cdf0e10cSrcweir		LogTestResult( &quot;&quot;, False )
200cdf0e10cSrcweir		Exit Sub
201cdf0e10cSrcweir	else
202cdf0e10cSrcweir		LogTestResult( &quot;testclosure &quot; + GetTestGlueDescription( gCurrentTestCase ), FALSE )
203cdf0e10cSrcweir		Close #LocalTestLog%
204cdf0e10cSrcweir		LocalTestLog = 0
205cdf0e10cSrcweir	End If
206cdf0e10cSrcweirEnd Sub
207cdf0e10cSrcweir
208cdf0e10cSrcweirFunction GetTestGlueDescription( nTestCase as Integer )
209cdf0e10cSrcweir	Select Case ( nTestCase )
210cdf0e10cSrcweir		case cTestClosureSetupDoc
211cdf0e10cSrcweir			GetTestGlueDescription = &quot;setup&quot;
212cdf0e10cSrcweir		case cTestClosureWriteStatus
213cdf0e10cSrcweir			GetTestGlueDescription = &quot;write_status&quot;
214cdf0e10cSrcweir		case Else
215cdf0e10cSrcweir			GetTestGlueDescription = &quot;&quot;
216cdf0e10cSrcweir	End Select
217cdf0e10cSrcweirEnd Function
218cdf0e10cSrcweir
219cdf0e10cSrcweirSub CreateStatusTable
220cdf0e10cSrcweir	dim tableHeaders(7) as string
221cdf0e10cSrcweir	tableHeaders(cStWriter) = &quot;Writer&quot;
222cdf0e10cSrcweir	tableHeaders(cStCalc) = &quot;Calc&quot;
223cdf0e10cSrcweir	tableHeaders(cStPraesentation) = &quot;Präsen- tation&quot;
224cdf0e10cSrcweir	tableHeaders(cStZeichnen) = &quot;Zeichn.&quot;
225cdf0e10cSrcweir	tableHeaders(cStChart) = &quot;Diagr.&quot;
226cdf0e10cSrcweir	tableHeaders(cStMath) = &quot;Math&quot;
227cdf0e10cSrcweir	tableHeaders(cStHTML) = &quot;HTML&quot;
228cdf0e10cSrcweir	tableHeaders(cStJava) = &quot;Java&quot;
229cdf0e10cSrcweir
230cdf0e10cSrcweir	dim tableRows(3) as string
231cdf0e10cSrcweir	tableRows(cDocNew) = &quot;new&quot;
232cdf0e10cSrcweir	tableRows(cDocSaveOpen8) = &quot;V8.0&quot;
233cdf0e10cSrcweir	tableRows(cDocSaveOpenXML) = &quot;XML&quot;
234cdf0e10cSrcweir	tableRows(cDocClose) = &quot;close&quot;
235cdf0e10cSrcweir
236cdf0e10cSrcweir	aDoc = gOutputDoc
237cdf0e10cSrcweir
238cdf0e10cSrcweir	xText = aDoc.Text
239cdf0e10cSrcweir	xCursor = xText.createTextCursor()
240cdf0e10cSrcweir
241cdf0e10cSrcweir	xCursor.gotoStart(FALSE)
242cdf0e10cSrcweir	xCursor.GoRight (4, False)
243cdf0e10cSrcweir	SetParagraphBreak (xCursor)
244cdf0e10cSrcweir	xCursor.GoRight (1, False)
245cdf0e10cSrcweir	SetParagraphBreak (xCursor)
246cdf0e10cSrcweir	xCursor.GoRight (1, False)
247cdf0e10cSrcweir
248cdf0e10cSrcweir	table = aDoc.createInstance(&quot;com.sun.star.text.TextTable&quot;)
249cdf0e10cSrcweir	table.initialize(5,9)
250cdf0e10cSrcweir	table.Name = &quot;StTab1&quot;
251cdf0e10cSrcweir  table.BackColor = cCoGrey
252cdf0e10cSrcweir	xText.insertTextContent(xCursor, table, FALSE)
253cdf0e10cSrcweir
254cdf0e10cSrcweir	for i% = 0 to 7
255cdf0e10cSrcweir		tableCell = table.getCellByPosition( i% + 1, 0 )
256cdf0e10cSrcweir		tableCell.String = tableHeaders( i% )
257cdf0e10cSrcweir	next i%
258cdf0e10cSrcweir
259cdf0e10cSrcweir	for i% = LBound( tableRows ) to UBound( tableRows )
260cdf0e10cSrcweir		tableCell = table.getCellByPosition( 0, i% + 1 )
261cdf0e10cSrcweir	  tableCell.String=tableRows(i%)
262cdf0e10cSrcweir	next i%
263cdf0e10cSrcweirend Sub
264cdf0e10cSrcweir
265cdf0e10cSrcweirSub CreateStatusTable2
266cdf0e10cSrcweir	dim tableHeaders(4) as string
267cdf0e10cSrcweir	tableHeaders(0) = &quot;Database&quot;
268cdf0e10cSrcweir	tableHeaders(1) = &quot;&quot;
269cdf0e10cSrcweir	tableHeaders(2) = &quot;Extension&quot;
270cdf0e10cSrcweir	tableHeaders(3) = &quot;&quot;
271cdf0e10cSrcweir	tableHeaders(4) = &quot;Other&quot;
272cdf0e10cSrcweir
273cdf0e10cSrcweir	dim tableRows(5) as string
274cdf0e10cSrcweir	tableRows(cDBService ) = &quot;services&quot;
275cdf0e10cSrcweir	tableRows(cDBOpen ) = &quot;open&quot;
276cdf0e10cSrcweir	tableRows(cDBInsert ) = &quot;insert&quot;
277cdf0e10cSrcweir	tableRows(cDBDelete  ) = &quot;delete&quot;
278cdf0e10cSrcweir	tableRows(cDBSeek ) = &quot;seek&quot;
279cdf0e10cSrcweir	tableRows(cDBClose ) = &quot;close&quot;
280cdf0e10cSrcweir
281cdf0e10cSrcweir	dim tableRows2(2) as string
282cdf0e10cSrcweir	tableRows2(cEXTService ) = &quot;services&quot;
283cdf0e10cSrcweir	tableRows2(cEXTInstall ) = &quot;install&quot;
284cdf0e10cSrcweir	tableRows2(cEXTUninstall ) = &quot;uninstall&quot;
285cdf0e10cSrcweir
286cdf0e10cSrcweir	dim tableRows3(1) as string
287cdf0e10cSrcweir	tableRows3(cTestClosureSetupDoc ) = &quot;setup test&quot;
288cdf0e10cSrcweir	tableRows3(cTestClosureWriteStatus ) = &quot;write test result&quot;
289cdf0e10cSrcweir
290cdf0e10cSrcweir	aDoc = gOutputDoc
291cdf0e10cSrcweir
292cdf0e10cSrcweir	xText = aDoc.Text
293cdf0e10cSrcweir	xCursor = xText.createTextCursor()
294cdf0e10cSrcweir
295cdf0e10cSrcweir	xCursor.gotoStart(FALSE)
296cdf0e10cSrcweir	xCursor.GoRight (4, False)
297cdf0e10cSrcweir	SetParagraphBreak (xCursor)
298cdf0e10cSrcweir	SetParagraphBreak (xCursor)
299cdf0e10cSrcweir	xCursor.gotoEnd(FALSE)
300cdf0e10cSrcweir
301cdf0e10cSrcweir	table = aDoc.createInstance(&quot;com.sun.star.text.TextTable&quot;)
302cdf0e10cSrcweir	table.initialize(7,6)
303cdf0e10cSrcweir	table.Name = &quot;StTab2&quot;
304cdf0e10cSrcweir	table.BackColor = cCoGrey
305cdf0e10cSrcweir
306cdf0e10cSrcweir	xText.insertTextContent(xCursor, table, FALSE)
307cdf0e10cSrcweir
308cdf0e10cSrcweir	for i% = LBound( tableHeaders ) to UBound( tableHeaders )
309cdf0e10cSrcweir		tableCell = table.getCellByPosition( i% + 1, 0 )
310cdf0e10cSrcweir		tableCell.String = tableHeaders(i%)
311cdf0e10cSrcweir	next i%
312cdf0e10cSrcweir
313cdf0e10cSrcweir	for i% = LBound( tableRows ) to UBound( tableRows )
314cdf0e10cSrcweir		tableCell = table.getCellByPosition( 0, i% + 1 )
315cdf0e10cSrcweir	  tableCell.String=tableRows(i%)
316cdf0e10cSrcweir	next i%
317cdf0e10cSrcweir
318cdf0e10cSrcweir	for i% = LBound( tableRows2 ) to UBound( tableRows2 )
319cdf0e10cSrcweir		tableCell = table.getCellByPosition( 2, i% + 1 )
320cdf0e10cSrcweir	  tableCell.String=tableRows2(i%)
321cdf0e10cSrcweir	next i%
322cdf0e10cSrcweir
323cdf0e10cSrcweir	for i% = LBound( tableRows3 ) to UBound( tableRows3 )
324cdf0e10cSrcweir		tableCell = table.getCellByPosition( 4, i% + 1 )
325cdf0e10cSrcweir	  tableCell.String=tableRows3(i%)
326cdf0e10cSrcweir	next i%
327cdf0e10cSrcweirend Sub
328cdf0e10cSrcweir
329cdf0e10cSrcweir
330cdf0e10cSrcweirSub CreateDocState
331cdf0e10cSrcweir	aDoc = gOutputDoc
332cdf0e10cSrcweir	table = aDoc.TextTables.GetByIndex (1)
333cdf0e10cSrcweir
334cdf0e10cSrcweir	for j% = 0 to 7
335cdf0e10cSrcweir		for i% = 0 to 3
336cdf0e10cSrcweir			sRangeName = GetRangeName(j%, i%+1)
337cdf0e10cSrcweir
338cdf0e10cSrcweir			tableCursor = table.createCursorByCellName(sRangeName)
339cdf0e10cSrcweir
340cdf0e10cSrcweir			cName = tableCursor.getRangeName()
341cdf0e10cSrcweir			xCell = table.getCellByName(cName)
342cdf0e10cSrcweir
343cdf0e10cSrcweir			xCell.BackTransparent = False
344cdf0e10cSrcweir
345cdf0e10cSrcweir			If gErrorState (j%, i%) = cLogTrue Then
346cdf0e10cSrcweir				xCell.BackColor = cCoGreen
347cdf0e10cSrcweir			else
348cdf0e10cSrcweir				If gErrorState (j%, i%) = cLogFalse Then
349cdf0e10cSrcweir					xCell.BackColor = cCoRed
350cdf0e10cSrcweir					If ( gTestCaseAnnotations( j%, i% ) &lt;&gt; "" ) Then
351cdf0e10cSrcweir						Dim annotation as Object
352cdf0e10cSrcweir						annotation = aDoc.createInstance( &quot;com.sun.star.text.TextField.Annotation&quot; )
353cdf0e10cSrcweir						annotation.Author = &quot;smoketest&quot;
354cdf0e10cSrcweir						annotation.Content = gTestCaseAnnotations( j%, i% )
355cdf0e10cSrcweir						xCell.insertTextContent( xCell, annotation, false )
356cdf0e10cSrcweir					End If
357cdf0e10cSrcweir				else
358cdf0e10cSrcweir					xCell.BackColor = cCoGrey
359cdf0e10cSrcweir				end If
360cdf0e10cSrcweir			end If
361cdf0e10cSrcweir		next i%
362cdf0e10cSrcweir	next j%
363cdf0e10cSrcweirend Sub
364cdf0e10cSrcweir
365cdf0e10cSrcweirSub CreateSecondState
366cdf0e10cSrcweir	aDoc = gOutputDoc
367cdf0e10cSrcweir	table = aDoc.TextTables.GetByIndex (0)
368cdf0e10cSrcweir
369cdf0e10cSrcweir	Dim stateIndex(2) as Integer
370cdf0e10cSrcweir	stateIndex(0) = cStDataBase
371cdf0e10cSrcweir	stateIndex(1) = cStExtension
372cdf0e10cSrcweir	stateIndex(2) = cStTestGlue
373cdf0e10cSrcweir
374cdf0e10cSrcweir	Dim j as Integer
375cdf0e10cSrcweir	For j = LBound( stateIndex ) To UBound( stateIndex )
376cdf0e10cSrcweir		for i% = 1 to 6
377cdf0e10cSrcweir			tableCell = table.getCellByPosition( 2 * j + 1, i% )
378cdf0e10cSrcweir			tableCell.BackTransparent = False
379cdf0e10cSrcweir
380cdf0e10cSrcweir			if gErrorState( stateIndex(j), i% - 1 ) = cLogTrue then
381cdf0e10cSrcweir				tableCell.BackColor = cCoGreen
382cdf0e10cSrcweir			else
383cdf0e10cSrcweir				if gErrorState ( stateIndex(j), i% - 1 ) = cLogFalse then
384cdf0e10cSrcweir					tableCell.BackColor = cCoRed
385cdf0e10cSrcweir					If ( gTestCaseAnnotations( stateIndex(j), i% - 1 ) &lt;&gt; &quot;&quot; ) Then
386cdf0e10cSrcweir						Dim annotation as Object
387cdf0e10cSrcweir						annotation = aDoc.createInstance( &quot;com.sun.star.text.TextField.Annotation&quot; )
388cdf0e10cSrcweir						annotation.Author = &quot;smoketest&quot;
389cdf0e10cSrcweir						annotation.Content = gTestCaseAnnotations( stateIndex(j), i% - 1 )
390cdf0e10cSrcweir						tableCell.insertTextContent( tableCell, annotation, false )
391cdf0e10cSrcweir					End If
392cdf0e10cSrcweir				else
393cdf0e10cSrcweir					tableCell.BackColor = cCoGrey
394cdf0e10cSrcweir				end If
395cdf0e10cSrcweir  			end If
396cdf0e10cSrcweir		next i%
397cdf0e10cSrcweir	next j%
398cdf0e10cSrcweirend Sub
399cdf0e10cSrcweir
400cdf0e10cSrcweirFunction GetRangeName (nColumn as integer, nRow as integer) as string
401cdf0e10cSrcweir	GetRangeName = chr (nColumn+66) + Trim(Str(nRow+1))
402cdf0e10cSrcweirend Function
403cdf0e10cSrcweir
404cdf0e10cSrcweirSub LogTestResult( sTestCaseDescription as String, bSuccess as Boolean )
405cdf0e10cSrcweir	If ( gCurrentTestCase = cLogfileFailed ) Then
406cdf0e10cSrcweir		Dim sAnnotation as String
407cdf0e10cSrcweir		sAnnotation = &quot;creating logfile &apos;&quot; + GetLogFileName( gCurrentDocTest ) + &quot;&apos; failed&quot;
408cdf0e10cSrcweir		LogState( FALSE, sAnnotation, GlobalTestLog )
409cdf0e10cSrcweir		RecordTestCaseStatus( 0, FALSE, sAnnotation )
410cdf0e10cSrcweir	Else
411cdf0e10cSrcweir		bSuccess = RecordTestCaseStatus( gCurrentTestCase, bSuccess, sTestCaseDescription )
412cdf0e10cSrcweir		If ( LocalTestLog &lt;&gt; 0 ) Then
413cdf0e10cSrcweir			LogState( bSuccess, sTestCaseDescription, LocalTestLog )
414cdf0e10cSrcweir		EndIf
415cdf0e10cSrcweir		if ( GlobalTestLog &lt;&gt; 0 ) Then
416cdf0e10cSrcweir			LogState( bSuccess, sTestCaseDescription, GlobalTestLog )
417cdf0e10cSrcweir		EndIf
418cdf0e10cSrcweir	End If
419cdf0e10cSrcweirEnd Sub
420cdf0e10cSrcweir
421cdf0e10cSrcweirFunction RecordTestCaseStatus( nAction as Integer, bState as Boolean, sFailureAnnotation as String ) as Boolean
422cdf0e10cSrcweir	Dim nStatusType as Integer
423cdf0e10cSrcweir	Dim nState as integer
424cdf0e10cSrcweir	nStatusType = GetStatusType( gCurrentDocTest )
425cdf0e10cSrcweir	If nStatusType = cStNone then Exit Function
426cdf0e10cSrcweir
427cdf0e10cSrcweir  If ( gErrorState( nStatusType, nAction ) = cLogFalse ) Then
428cdf0e10cSrcweir    &apos; don't overwrite a previous &quot;failed&quot; state for this test
429cdf0e10cSrcweir    bState = FALSE
430cdf0e10cSrcweir  End If
431cdf0e10cSrcweir
432cdf0e10cSrcweir	if bState then
433cdf0e10cSrcweir		nState = cLogTrue
434cdf0e10cSrcweir	else
435cdf0e10cSrcweir		nState = cLogFalse
436cdf0e10cSrcweir	end If
437cdf0e10cSrcweir
438cdf0e10cSrcweir	gErrorState (nStatusType, nAction) = nState
439cdf0e10cSrcweir
440cdf0e10cSrcweir	If ( nState = cLogFalse ) And ( sFailureAnnotation &lt;&gt; &quot;&quot; ) Then
441cdf0e10cSrcweir		gTestCaseAnnotations( nStatusType, nAction ) = gTestCaseAnnotations( nStatusType, nAction ) + sFailureAnnotation + chr(13)
442cdf0e10cSrcweir	End If
443cdf0e10cSrcweir
444cdf0e10cSrcweir	RecordTestCaseStatus = bState
445cdf0e10cSrcweirEnd Function
446cdf0e10cSrcweir
447cdf0e10cSrcweirFunction GetStatusType (nDocType as Integer) as Integer
448cdf0e10cSrcweir	Select Case ( nDocType )
449cdf0e10cSrcweir		case frmWriter
450cdf0e10cSrcweir			GetStatusType = cStWriter &apos; text document
451cdf0e10cSrcweir		case frmCalc
452cdf0e10cSrcweir			GetStatusType = cStCalc &apos; spreadsheet document
453cdf0e10cSrcweir		case frmImpress
454cdf0e10cSrcweir			GetStatusType = cStPraesentation &apos; presentation
455cdf0e10cSrcweir		case frmDraw
456cdf0e10cSrcweir			GetStatusType = cStZeichnen &apos; drawing
457cdf0e10cSrcweir		case frmMath
458cdf0e10cSrcweir			GetStatusType = cStMath &apos; formula
459cdf0e10cSrcweir		case frmHyperText
460cdf0e10cSrcweir			GetStatusType = cStHTML &apos; HTML document
461cdf0e10cSrcweir		case frmChart
462cdf0e10cSrcweir			GetStatusType = cStChart &apos; chart
463cdf0e10cSrcweir		case frmJava
464cdf0e10cSrcweir			GetStatusType = cStJava &apos;Java
465cdf0e10cSrcweir		case frmTestClosure
466cdf0e10cSrcweir			GetStatusType = cStTestGlue &apos; test framework
467cdf0e10cSrcweir		case frmDataBase
468cdf0e10cSrcweir			GetStatusType = cStDataBase	&apos;DataBase
469cdf0e10cSrcweir		case frmExtension
470cdf0e10cSrcweir			GetStatusType = cStExtension &apos;Extension
471cdf0e10cSrcweir		case else
472cdf0e10cSrcweir			GetStatusType = cStNone
473cdf0e10cSrcweir	end Select
474cdf0e10cSrcweirend Function
475cdf0e10cSrcweir
476cdf0e10cSrcweirSub SetParagraphBreak (aCursor as Object)
477cdf0e10cSrcweir	aCursor.Text.InsertControlCharacter (aCursor, cParagraphBreak, True)
478cdf0e10cSrcweirend Sub
479cdf0e10cSrcweir
480cdf0e10cSrcweirSub ClearDoc (aDoc as Object)
481cdf0e10cSrcweir	Dim aText as Object
482cdf0e10cSrcweir	Dim i%
483cdf0e10cSrcweir	for i%=1 to aDoc.TextTables.count
484cdf0e10cSrcweir		aDoc.TextTables.GetByIndex(0).dispose
485cdf0e10cSrcweir	next
486cdf0e10cSrcweir
487cdf0e10cSrcweir	aText = aDoc.Text.CreateTextCursor
488cdf0e10cSrcweir	aText.GotoStart (False)
489cdf0e10cSrcweir	aText.GoRight (3, False)
490cdf0e10cSrcweir	SetParagraphBreak (aText)
491cdf0e10cSrcweir	aText.GotoEnd (True)
492cdf0e10cSrcweir	aText.String=&quot;&quot;
493cdf0e10cSrcweirend Sub
494cdf0e10cSrcweir
495cdf0e10cSrcweirSub ClearDocFull (aDoc as Object)
496cdf0e10cSrcweir	Dim aText as Object
497cdf0e10cSrcweir	Dim i%
498cdf0e10cSrcweir	for i%=1 to aDoc.TextTables.count
499cdf0e10cSrcweir		aDoc.TextTables.GetByIndex(0).dispose
500cdf0e10cSrcweir	next
501cdf0e10cSrcweir
502cdf0e10cSrcweir	aText = aDoc.Text.CreateTextCursor
503cdf0e10cSrcweir	aText.GotoStart (False)
504cdf0e10cSrcweir	aText.GotoEnd (True)
505cdf0e10cSrcweir	aText.String=&quot;&quot;
506cdf0e10cSrcweirend Sub
507cdf0e10cSrcweir
508cdf0e10cSrcweirSub SetGlobalOptionsDialog ()
509cdf0e10cSrcweir
510cdf0e10cSrcweir    Dim oLibContainer As Object, oLib As Object
511cdf0e10cSrcweir    Dim oInputStreamProvider As Object
512cdf0e10cSrcweir    Dim oDialog As Object
513cdf0e10cSrcweir
514cdf0e10cSrcweir    Const sLibName = cTest10Modul
515cdf0e10cSrcweir    Const sDialogName = cOptionsDialogName
516cdf0e10cSrcweir
517cdf0e10cSrcweir    REM get library and input stream provider
518cdf0e10cSrcweir    oLibContainer = DialogLibraries
519cdf0e10cSrcweir
520cdf0e10cSrcweir    REM load the library
521cdf0e10cSrcweir    oLibContainer.loadLibrary( sLibName )
522cdf0e10cSrcweir
523cdf0e10cSrcweir    oLib = oLibContainer.getByName( sLibName )
524cdf0e10cSrcweir    oInputStreamProvider = oLib.getByName( sDialogName )
525cdf0e10cSrcweir
526cdf0e10cSrcweir    REM create dialog control
527cdf0e10cSrcweir    gOptionsDialog = CreateUnoDialog( oInputStreamProvider )
528cdf0e10cSrcweir
529cdf0e10cSrcweirend Sub
530cdf0e10cSrcweir
531cdf0e10cSrcweirSub ShowOptionsDlg
532cdf0e10cSrcweir
533cdf0e10cSrcweir    call SetGlobalDoc
534cdf0e10cSrcweir    call SetGlobalOptionsDialog
535cdf0e10cSrcweir    call GetOptions
536cdf0e10cSrcweir
537cdf0e10cSrcweir    REM show the dialog
538cdf0e10cSrcweir    gOptionsDialog.execute()
539cdf0e10cSrcweir
540cdf0e10cSrcweir   	&apos; jetzt läuft der Dialog, bis ein Button gedrückt wird
541cdf0e10cSrcweir
542cdf0e10cSrcweir   	Select Case (gDlgState)
543cdf0e10cSrcweir   		case cDlgOk
544cdf0e10cSrcweir   			call SetOptions ()
545cdf0e10cSrcweir   		case cDlgStartTest
546cdf0e10cSrcweir   			call SetOptions ()
547cdf0e10cSrcweir   			call StartTestByOptions ()
548cdf0e10cSrcweir	end Select
549cdf0e10cSrcweir
550cdf0e10cSrcweir    gOptionsDialog.dispose()
551cdf0e10cSrcweir
552cdf0e10cSrcweirend Sub
553cdf0e10cSrcweir
554cdf0e10cSrcweirSub SetOptions
555cdf0e10cSrcweir	call SetGlobalDoc
556cdf0e10cSrcweir	SetUserFieldState (cUserFieldTestWriter, -(gOptionsDialog.getControl(&quot;cbWriterTest&quot;).getState), gOutputDoc)
557cdf0e10cSrcweir	SetUserFieldState (cUserFieldTestCalc, -(gOptionsDialog.getControl(&quot;cbCalcTest&quot;).getState), gOutputDoc)
558cdf0e10cSrcweir	SetUserFieldState (cUserFieldTestImpress, -(gOptionsDialog.getControl(&quot;cbImpressTest&quot;).getState), gOutputDoc)
559cdf0e10cSrcweir	SetUserFieldState (cUserFieldTestDraw, -(gOptionsDialog.getControl(&quot;cbDrawTest&quot;).getState), gOutputDoc)
560cdf0e10cSrcweir	SetUserFieldState (cUserFieldTestHTML, -(gOptionsDialog.getControl(&quot;cbHTMLTest&quot;).getState), gOutputDoc)
561cdf0e10cSrcweir	SetUserFieldState (cUserFieldTestMath, -(gOptionsDialog.getControl(&quot;cbMathTest&quot;).getState), gOutputDoc)
562cdf0e10cSrcweir	SetUserFieldState (cUserFieldTestChart, -(gOptionsDialog.getControl(&quot;cbChartTest&quot;).getState), gOutputDoc)
563cdf0e10cSrcweir	SetUserFieldState (cUserFieldTestJava, -(gOptionsDialog.getControl(&quot;cbJavaTest&quot;).getState), gOutputDoc)
564cdf0e10cSrcweir	SetUserFieldState (cUserFieldTestDatabase, -(gOptionsDialog.getControl(&quot;cbDatabaseTest&quot;).getState), gOutputDoc)
565cdf0e10cSrcweir	SetUserFieldState (cUserFieldTestExtension, -(gOptionsDialog.getControl(&quot;cbExtensionTest&quot;).getState), gOutputDoc)
566cdf0e10cSrcweir	SetUserFieldState (cUserFieldTestOpenSaveXML, -(gOptionsDialog.getControl(&quot;cbSaveOpenXMLTest&quot;).getState), gOutputDoc)
567cdf0e10cSrcweir	SetUserFieldState (cUserFieldTestOpenSave8, -(gOptionsDialog.getControl(&quot;cbSaveOpen8Test&quot;).getState), gOutputDoc)
568cdf0e10cSrcweir	SetUserFieldState (cUserFieldTestTerminateAfterTest, -(gOptionsDialog.getControl(&quot;cbTerminateAfterTest&quot;).getState), gOutputDoc)
569cdf0e10cSrcweirend Sub
570cdf0e10cSrcweir
571cdf0e10cSrcweirSub GetOptions
572cdf0e10cSrcweir	call SetGlobalDoc
573cdf0e10cSrcweir	gOptionsDialog.getControl(&quot;cbWriterTest&quot;).setState( -( GetUserFieldState (cUserFieldTestWriter, gOutputDoc)))
574cdf0e10cSrcweir	gOptionsDialog.getControl(&quot;cbCalcTest&quot;).setState ( -( GetUserFieldState (cUserFieldTestCalc, gOutputDoc)))
575cdf0e10cSrcweir	gOptionsDialog.getControl(&quot;cbImpressTest&quot;).setState( -( GetUserFieldState (cUserFieldTestImpress, gOutputDoc)))
576cdf0e10cSrcweir	gOptionsDialog.getControl(&quot;cbDrawTest&quot;).setState( -( GetUserFieldState (cUserFieldTestDraw, gOutputDoc)))
577cdf0e10cSrcweir	gOptionsDialog.getControl(&quot;cbHTMLTest&quot;).setState( -( GetUserFieldState (cUserFieldTestHTML, gOutputDoc)))
578cdf0e10cSrcweir	gOptionsDialog.getControl(&quot;cbMathTest&quot;).setState( -( GetUserFieldState (cUserFieldTestMath, gOutputDoc)))
579cdf0e10cSrcweir	gOptionsDialog.getControl(&quot;cbChartTest&quot;).setState( -( GetUserFieldState (cUserFieldTestChart, gOutputDoc)))
580cdf0e10cSrcweir	gOptionsDialog.getControl(&quot;cbJavaTest&quot;).setState( -( GetUserFieldState (cUserFieldTestJava, gOutputDoc)))
581cdf0e10cSrcweir	gOptionsDialog.getControl(&quot;cbDatabaseTest&quot;).setState( -( GetUserFieldState (cUserFieldTestDatabase, gOutputDoc)))
582cdf0e10cSrcweir	gOptionsDialog.getControl(&quot;cbExtensionTest&quot;).setState( -( GetUserFieldState (cUserFieldTestExtension, gOutputDoc)))
583cdf0e10cSrcweir	gOptionsDialog.getControl(&quot;cbSaveOpenXMLTest&quot;).setState( -( GetUserFieldState (cUserFieldTestOpenSaveXML, gOutputDoc)))
584cdf0e10cSrcweir	gOptionsDialog.getControl(&quot;cbSaveOpen8Test&quot;).setState( -( GetUserFieldState (cUserFieldTestOpenSave8, gOutputDoc)))
585cdf0e10cSrcweir	gOptionsDialog.getControl(&quot;cbTerminateAfterTest&quot;).setState( -( GetUserFieldState (cUserFieldTestTerminateAfterTest, gOutputDoc)))
586cdf0e10cSrcweirEnd Sub
587cdf0e10cSrcweir
588cdf0e10cSrcweirSub ReadOptions
589cdf0e10cSrcweir	call SetGlobalDoc
590cdf0e10cSrcweir	bMakeWriterTest = GetUserFieldState (cUserFieldTestWriter, gOutputDoc)
591cdf0e10cSrcweir	bMakeCalcTest = GetUserFieldState (cUserFieldTestCalc, gOutputDoc)
592cdf0e10cSrcweir	bMakeImpressTest = GetUserFieldState (cUserFieldTestImpress, gOutputDoc)
593cdf0e10cSrcweir	bMakeDrawTest = GetUserFieldState (cUserFieldTestDraw, gOutputDoc)
594cdf0e10cSrcweir	bMakeHTMLTest = GetUserFieldState (cUserFieldTestHTML, gOutputDoc)
595cdf0e10cSrcweir	bMakeMathTest = GetUserFieldState (cUserFieldTestMath, gOutputDoc)
596cdf0e10cSrcweir	bMakeChartTest = GetUserFieldState (cUserFieldTestChart, gOutputDoc)
597cdf0e10cSrcweir	bMakeJavaTest = GetUserFieldState (cUserFieldTestJava, gOutputDoc)
598cdf0e10cSrcweir	bMakeDBTest = GetUserFieldState (cUserFieldTestDatabase, gOutputDoc)
599cdf0e10cSrcweir	bMakeExtensionTest = GetUserFieldState (cUserFieldTestExtension, gOutputDoc)
600cdf0e10cSrcweir	bMakeSaveOpenXMLTest = GetUserFieldState (cUserFieldTestOpenSaveXML, gOutputDoc)
601cdf0e10cSrcweir	bMakeSaveOpen8Test = GetUserFieldState (cUserFieldTestOpenSave8, gOutputDoc)
602cdf0e10cSrcweir	bMakeTerminateAfterTest = GetUserFieldState (cUserFieldTestTerminateAfterTest, gOutputDoc)
603cdf0e10cSrcweirend Sub
604cdf0e10cSrcweir
605cdf0e10cSrcweirSub SetDefaultOptions
606cdf0e10cSrcweir	bMakeWriterTest = true
607cdf0e10cSrcweir	bMakeCalcTest = true
608cdf0e10cSrcweir	bMakeImpressTest = true
609cdf0e10cSrcweir	bMakeDrawTest = true
610cdf0e10cSrcweir	bMakeHTMLTest = true
611cdf0e10cSrcweir	bMakeMathTest = true
612cdf0e10cSrcweir	bMakeChartTest = true
613cdf0e10cSrcweir	if Environ(&quot;SOLAR_JAVA&quot;) = &quot;&quot; then
614cdf0e10cSrcweir		bMakeJavaTest = false
615cdf0e10cSrcweir		bMakeDBTest = false
616cdf0e10cSrcweir		bMakeExtensionTest = false
617cdf0e10cSrcweir	else
618cdf0e10cSrcweir		bMakeJavaTest = true
619cdf0e10cSrcweir		bMakeDBTest = true
620cdf0e10cSrcweir		bMakeExtensionTest = true
621cdf0e10cSrcweir	End If
622cdf0e10cSrcweir	bMakeSaveOpenXMLTest = true
623cdf0e10cSrcweir	REM Disable StarOffice 5.0 tests in case binfilter has not been included
624cdf0e10cSrcweir	bMakeSaveOpen8Test = true
625cdf0e10cSrcweir	bMakeTerminateAfterTest = false
626cdf0e10cSrcweirend Sub
627cdf0e10cSrcweir
628cdf0e10cSrcweirSub StartTestByOptions
629cdf0e10cSrcweir	bShowTable = true
630cdf0e10cSrcweir	call ReadOptions
631cdf0e10cSrcweir	call Main
632cdf0e10cSrcweir	if bMakeTerminateAfterTest then
633cdf0e10cSrcweir		ClearDocFull (gOutputDoc)
634cdf0e10cSrcweir		gOutputDoc.dispose
635cdf0e10cSrcweir		&apos;StarDesktop.Terminate
636cdf0e10cSrcweir
637cdf0e10cSrcweir		&apos;EnableReschedule( false )
638cdf0e10cSrcweir		&apos;DispatchSlot( 5300 )
639cdf0e10cSrcweir		stop
640cdf0e10cSrcweir	End If
641cdf0e10cSrcweirend Sub
642cdf0e10cSrcweir
643cdf0e10cSrcweirFunction StartTestWithDefaultOptions
644cdf0e10cSrcweir	bShowTable = false
645cdf0e10cSrcweir	call SetDefaultOptions
646cdf0e10cSrcweir	call Main
647cdf0e10cSrcweir	dim component(cMaxErrorStates) as string
648cdf0e10cSrcweir	component(cStWriter) = &quot;Writer&quot;
649cdf0e10cSrcweir	component(cStCalc) = &quot;Calc&quot;
650cdf0e10cSrcweir	component(cStPraesentation) = &quot;Impress&quot;
651cdf0e10cSrcweir	component(cStZeichnen) = &quot;Draw&quot;
652cdf0e10cSrcweir	component(cStChart) = &quot;Chart&quot;
653cdf0e10cSrcweir	component(cStMath) = &quot;Math&quot;
654cdf0e10cSrcweir	component(cStHTML) = &quot;HTML&quot;
655cdf0e10cSrcweir	component(cStJava) = &quot;Java&quot;
656cdf0e10cSrcweir	component(cStDataBase) = &quot;Base&quot;
657cdf0e10cSrcweir	component(cStExtension) = &quot;Extensions&quot;
658cdf0e10cSrcweir	dim action(3) as string
659cdf0e10cSrcweir	action(cDocNew) = &quot;new&quot;
660cdf0e10cSrcweir	action(cDocSaveOpen8) = &quot;V8.0&quot;
661cdf0e10cSrcweir	action(cDocSaveOpenXML) = &quot;XML&quot;
662cdf0e10cSrcweir	action(cDocClose) = &quot;close&quot;
663cdf0e10cSrcweir	dim baseAction(5) as string
664cdf0e10cSrcweir	baseAction(cDBService) = &quot;services&quot;
665cdf0e10cSrcweir	baseAction(cDBOpen) = &quot;open&quot;
666cdf0e10cSrcweir	baseAction(cDBInsert) = &quot;insert&quot;
667cdf0e10cSrcweir	baseAction(cDBDelete) = &quot;delete&quot;
668cdf0e10cSrcweir	baseAction(cDBSeek) = &quot;seek&quot;
669cdf0e10cSrcweir	baseAction(cDBClose) = &quot;close&quot;
670cdf0e10cSrcweir	dim extAction(2) as string
671cdf0e10cSrcweir	extAction(cEXTService) = &quot;services&quot;
672cdf0e10cSrcweir	extAction(cEXTInstall) = &quot;install&quot;
673cdf0e10cSrcweir	extAction(cEXTUninstall) = &quot;uninstall&quot;
674cdf0e10cSrcweir	dim result as string
675cdf0e10cSrcweir	for i = 0 to cMaxErrorStates
676cdf0e10cSrcweir		for j = 0 to 5
677cdf0e10cSrcweir			if gErrorState(i, j) = cLogFalse then
678cdf0e10cSrcweir				result = result &amp; &quot; &quot; &amp; component(i) &amp; &quot;:&quot;
679cdf0e10cSrcweir				if i = cStDataBase then
680cdf0e10cSrcweir					result = result &amp; baseAction(j)
681cdf0e10cSrcweir				else if i = cStExtension then
682cdf0e10cSrcweir					result = result &amp; extAction(j)
683cdf0e10cSrcweir				else
684cdf0e10cSrcweir					result = result &amp; action(j)
685cdf0e10cSrcweir				end if
686cdf0e10cSrcweir				end if
687cdf0e10cSrcweir			end if
688cdf0e10cSrcweir		next j
689cdf0e10cSrcweir	next i
690cdf0e10cSrcweir	StartTestWithDefaultOptions = result
691cdf0e10cSrcweirend Function
692cdf0e10cSrcweir
693cdf0e10cSrcweirSub DispatchSlot(SlotID as Integer)
694cdf0e10cSrcweir	Dim oArg() as new com.sun.star.beans.PropertyValue
695cdf0e10cSrcweir	Dim oUrl as new com.sun.star.util.URL
696cdf0e10cSrcweir	Dim oTrans as Object
697cdf0e10cSrcweir	Dim oDisp as Object
698cdf0e10cSrcweir
699cdf0e10cSrcweir	oTrans = createUNOService(&quot;com.sun.star.util.URLTransformer&quot;)
700cdf0e10cSrcweir	oUrl.Complete = &quot;slot:&quot; &amp; CStr(SlotID)
701cdf0e10cSrcweir	oTrans.parsestrict(oUrl)
702cdf0e10cSrcweir
703cdf0e10cSrcweir	oDisp = StarDesktop.queryDispatch(oUrl, &quot;_self&quot;, 0)
704cdf0e10cSrcweir	oDisp.dispatch(oUrl, oArg())
705cdf0e10cSrcweirEnd Sub
706cdf0e10cSrcweir
707cdf0e10cSrcweirSub LoadLibrary( LibName As String )
708cdf0e10cSrcweir
709cdf0e10cSrcweir	dim args(1)
710cdf0e10cSrcweir	dim arg as new com.sun.star.beans.PropertyValue
711cdf0e10cSrcweir	arg.Name = &quot;LibraryName&quot;
712cdf0e10cSrcweir	arg.Value = LibName
713cdf0e10cSrcweir	args(0) = arg
714cdf0e10cSrcweir
715cdf0e10cSrcweir	dim url as new com.sun.star.util.URL
716cdf0e10cSrcweir	dim trans as object
717cdf0e10cSrcweir	trans = createUnoService(&quot;com.sun.star.util.URLTransformer&quot; )
718cdf0e10cSrcweir	url.Complete = &quot;slot:6517&quot;
719cdf0e10cSrcweir	trans.parsestrict( url )
720cdf0e10cSrcweir
721cdf0e10cSrcweir	dim disp as object
722cdf0e10cSrcweir	disp = StarDesktop.currentFrame.queryDispatch( url, &quot;&quot;, 0 )
723cdf0e10cSrcweir	disp.dispatch( url, args() )
724cdf0e10cSrcweir
725cdf0e10cSrcweirEnd Sub
726cdf0e10cSrcweir
727cdf0e10cSrcweirSub ExecuteSlot( SlotNr As String, oDoc as Object )
728cdf0e10cSrcweir	dim args()
729cdf0e10cSrcweir	dim url as new com.sun.star.util.URL
730cdf0e10cSrcweir	dim trans as object
731cdf0e10cSrcweir	dim disp as object
732cdf0e10cSrcweir
733cdf0e10cSrcweir	trans = createUnoService(&quot;com.sun.star.util.URLTransformer&quot; )
734cdf0e10cSrcweir	url.Complete = &quot;slot:&quot; + SlotNr
735cdf0e10cSrcweir	trans.parsestrict( url )
736cdf0e10cSrcweir
737cdf0e10cSrcweir	disp = oDoc.CurrentController.Frame.queryDispatch( url, &quot;&quot;, 0 )
738cdf0e10cSrcweir	disp.dispatch( url, args() )
739cdf0e10cSrcweir
740cdf0e10cSrcweirEnd Sub
741cdf0e10cSrcweir
742cdf0e10cSrcweirSub DelAllUserFields (aDoc as Object)
743cdf0e10cSrcweir	Dim aFieldType as Object
744cdf0e10cSrcweir	Dim aElements as Variant
745cdf0e10cSrcweir	Dim i%
746cdf0e10cSrcweir	Dim aFieldMasters, aFieldMaster as Object
747cdf0e10cSrcweir	Dim sElement$
748cdf0e10cSrcweir	aFieldMasters = aDoc.TextFieldMasters
749cdf0e10cSrcweir	aElements = aFieldMasters.ElementNames
750cdf0e10cSrcweir	for i = 0 to UBound(aElements)
751cdf0e10cSrcweir		sElement$ = aElements(i)
752cdf0e10cSrcweir		if 0 &lt;&gt; instr(sElement$, cUnoUserField ) then
753cdf0e10cSrcweir			aFieldMaster = aFieldMasters.GetByName(sElement$)
754cdf0e10cSrcweir			aFieldMaster.Dispose
755cdf0e10cSrcweir		endif
756cdf0e10cSrcweir	next
757cdf0e10cSrcweirend Sub
758cdf0e10cSrcweir
759cdf0e10cSrcweirFunction GetUserFieldState (sName as String, aDoc as Object) as boolean
760cdf0e10cSrcweir	Dim sFieldText as String
761cdf0e10cSrcweir	Dim bState as boolean
762cdf0e10cSrcweir	sFieldText = ReadUserField (sName, aDoc)
763cdf0e10cSrcweir
764cdf0e10cSrcweir	if LCase(sFieldText) = cYes then
765cdf0e10cSrcweir		bState = true
766cdf0e10cSrcweir	else
767cdf0e10cSrcweir		bState = false
768cdf0e10cSrcweir	end IF
769cdf0e10cSrcweir
770cdf0e10cSrcweir	GetUserFieldState = bState
771cdf0e10cSrcweirend Function
772cdf0e10cSrcweir
773cdf0e10cSrcweirSub SetUserFieldState (sName as String, nState as boolean, aDoc as Object)
774cdf0e10cSrcweir	Dim sFieldText as String
775cdf0e10cSrcweir
776cdf0e10cSrcweir	sFieldText = cNo &apos;default
777cdf0e10cSrcweir
778cdf0e10cSrcweir	Select case nState
779cdf0e10cSrcweir		case true
780cdf0e10cSrcweir			sFieldText = cYes
781cdf0e10cSrcweir		case false
782cdf0e10cSrcweir			sFieldText = cNo
783cdf0e10cSrcweir	end Select
784cdf0e10cSrcweir
785cdf0e10cSrcweir	WriteUserField (sFieldText, sName, aDoc)
786cdf0e10cSrcweirend Sub
787cdf0e10cSrcweir
788cdf0e10cSrcweirFunction ReadUserField(sFieldName as String, aDoc as Object) as String
789cdf0e10cSrcweir	Dim aMasters as Object
790cdf0e10cSrcweir	aMasters = aDoc.TextFieldMasters
791cdf0e10cSrcweir	if aMasters.HasByName (cUnoUserField+cUnoSeparator+sFieldName) then
792cdf0e10cSrcweir		ReadUserField = aMasters.GetByName (cUnoUserField+cUnoSeparator+sFieldName).Content
793cdf0e10cSrcweir	else
794cdf0e10cSrcweir		ReadUserField = &quot;&quot;
795cdf0e10cSrcweir	end If
796cdf0e10cSrcweirEnd Function
797cdf0e10cSrcweir
798cdf0e10cSrcweirSub WriteUserField(sValue as String, sFieldName as String, aDoc as Object, optional aCursor as Object)
799cdf0e10cSrcweir	Dim aMasters, aUserField, aTxtCursor as Object
800cdf0e10cSrcweir	aMasters = aDoc.TextFieldMasters
801cdf0e10cSrcweir	if aMasters.HasByName (cUnoUserField+cUnoSeparator+sFieldName) then
802cdf0e10cSrcweir		aUserField = aMasters.GetByName (cUnoUserField+cUnoSeparator+sFieldName)
803cdf0e10cSrcweir	else
804cdf0e10cSrcweir		aUserField = aDoc.CreateInstance (cUnoUserField)
805cdf0e10cSrcweir		aUserField.Name = sFieldName
806cdf0e10cSrcweir	end if
807cdf0e10cSrcweir	aUserField.Content = sValue
808cdf0e10cSrcweirEnd Sub
809cdf0e10cSrcweir
810cdf0e10cSrcweirSub WriteExtUserField(nIndex as Integer, aCursor as Object, aDoc as Object)
811cdf0e10cSrcweir	Dim aUserField as Object
812cdf0e10cSrcweir	aUserField = aDoc.CreateInstance (cUnoExtUserField)
813cdf0e10cSrcweir	aUserField.UserDataType = nIndex
814cdf0e10cSrcweir	aCursor.Text.InsertTextContent (aCursor, aUserField, True)
815cdf0e10cSrcweir	aUserField.Fix = True
816cdf0e10cSrcweirEnd Sub
817cdf0e10cSrcweir</script:module>
818