1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
|
'encoding UTF-8 Do not remove or change this line!
'**************************************************************************
' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
'
' Copyright 2000, 2010 Oracle and/or its affiliates.
'
' OpenOffice.org - a multi-platform office productivity suite
'
' This file is part of OpenOffice.org.
'
' OpenOffice.org is free software: you can redistribute it and/or modify
' it under the terms of the GNU Lesser General Public License version 3
' only, as published by the Free Software Foundation.
'
' OpenOffice.org is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU Lesser General Public License version 3 for more details
' (a copy is included in the LICENSE file that accompanied this code).
'
' You should have received a copy of the GNU Lesser General Public License
' version 3 along with OpenOffice.org. If not, see
' <http://www.openoffice.org/license.html>
' for a copy of the LGPLv3 License.
'
'/************************************************************************
'*
'* owner : thorsten.bosbach@oracle.com
'*
'* short description : global-level-1-test -> insert all OLE-Objects out of OLE-dialog into all doc-types
'*
'\******************************************************************************
sub hReopenDoc
'Only for bughandling if closing an OLE object fails
Warnlog "Cannot release Chart Object -> #107005#?"
hCloseDocument()
'if Active.Exists ( 1 ) then Active.TypeKeys "<RIGHT><ENTER>"
hNewDocument()
end sub
'*******************************************************************************
sub hOleSelektieren ( xStart%, yStart%, xEnde%, yEnde% )
WL_TB_ZF_Auswahl
select case gApplication
case "CALC" :Kontext "DocumentCalc"
DocumentCalc.MouseDown xStart%, yStart%
DocumentCalc.MouseMove xEnde%, yEnde%
DocumentCalc.MouseUp xEnde%, yEnde%
wait 200
case "DRAW" :Kontext "DocumentDraw"
DocumentDraw.MouseDown xStart%, yStart%
DocumentDraw.MouseMove xEnde%, yEnde%
DocumentDraw.MouseUp xEnde%, yEnde%
case "WRITER" :Kontext "DocumentWriter"
DocumentWriter.MouseDown xStart%, yStart%
DocumentWriter.MouseMove xEnde%, yEnde%
DocumentWriter.MouseUp xEnde%, yEnde%
case "IMPRESS" :Kontext "DocumentImpress"
DocumentImpress.MouseDown xStart%, yStart%
DocumentImpress.MouseMove xEnde%, yEnde%
DocumentImpress.MouseUp xEnde%, yEnde%
case "MATH" :Kontext "DocumentMath"
DocumentMath.MouseDown xStart%, yStart%
DocumentMath.MouseMove xEnde%, yEnde%
DocumentMath.MouseUp xEnde%, yEnde%
case "MASTERDOCUMENT":Kontext "DocumentMasterDoc"
DocumentMasterDoc.MouseDown xStart%, yStart%
DocumentMasterDoc.MouseMove xEnde%, yEnde%
DocumentMasterDoc.MouseUp xEnde%, yEnde%
end select
end sub
'*******************************************************************************
function hSetToStandardView ( cApplication as string ) as boolean
const MAX_WAIT_FOR_DIALOG = 2
select case ( cApplication )
case "WRITER"
gApplication = cApplication
Call hNewDocument
Kontext "DocumentWriter"
case "MASTERDOCUMENT"
gApplication = cApplication
Call hNewDocument
Kontext "DocumentMasterDoc"
case else
printlog( "Application not supported by this function: " & cApplication )
hSetToStandardView() = false
exit function
end select
hUseAsyncSlot( "ViewZoom" )
Kontext "Massstab"
if ( Massstab.exists( MAX_WAIT_FOR_DIALOG ) ) then
Optimal.Check()
hCloseDialog( Massstab, "ok" )
else
warnlog( "Zoom-Dialog did not open" )
endif
Call hCloseDocument
hSetToStandardView() = true
end sub
'*******************************************************************************
sub SendEscape(optional iTimes as Integer)
dim i as Integer
const ICWAIT as Integer = 1
if IsMissing( iTimes ) then
iTimes = 1
endif
printlog( " - send <ESCAPE> keystroke to document" )
select case gApplication
case "WRITER"
Kontext "DocumentWriter"
for i = 1 to iTimes
sleep( ICWAIT )
DocumentWriter.TypeKeys( "<ESCAPE>" , 1 , TRUE )
next i
case "CALC"
Kontext "DocumentCalc"
for i = 1 to iTimes
sleep( ICWAIT )
DocumentCalc.TypeKeys( "<ESCAPE>" , 1 , TRUE )
next i
case "MASTERDOCUMENT"
Kontext "DocumentMasterDoc"
for i = 1 to iTimes
sleep( ICWAIT )
DocumentMasterDoc.TypeKeys( "<ESCAPE>" , 1 , TRUE )
next i
case "DRAW"
Kontext "DocumentDraw"
for i = 1 to iTimes
sleep( ICWAIT )
DocumentDraw.TypeKeys( "<ESCAPE>" , 1 , TRUE )
next i
case "IMPRESS"
Kontext "DocumentImpress"
for i = 1 to iTimes
sleep( ICWAIT )
DocumentImpress.TypeKeys( "<ESCAPE>" , 1 , TRUE )
next i
case else
warnlog( "Invalid gApplication: " & gApplication )
end select
end sub
'*******************************************************************************
sub UncheckAutoFileExtension()
Kontext "SpeichernDlg"
if SpeichernDlg.exists(5) then
if AutomatischeDateinamenserweiterung.Exists() then
printlog("l1_ole_tools::UncheckAutoFileExtension - unchecking automatic file extension" )
If AutomatischeDateinamenserweiterung.IsChecked() then
AutomatischeDateinamenserweiterung.Uncheck()
endif
else
QAErrorLog ( "OBSOLETE: l1_ole_tools::UncheckAutoFileExtension Checkbox 'Automatic Filename Extension' unavailable" )
endif
else
warnlog( "l1_ole_tools::UncheckAutoFileExtension SaveAs Dialog not open." )
endif
end sub
'*******************************************************************************
function getExtension( optional sExtension as string ) as string
qaerrorlog( "getExtension is outdated. Use hGetSuffix( ... ) instead" )
printlog("l1_ole_ttols::getExtension:: - define the expected file extension" )
select case gApplication
case "WRITER"
sExtension = ".sxw"
case "DRAW"
sExtension = ".sxd"
case "IMPRESS"
sExtension = ".sxi"
case "CALC"
sExtension = ".sxc"
case "MATH"
sExtension = ".sxm"
case "MASTERDOCUMENT"
sExtension = ".sgl"
case else
warnlog( "Invalid gApplication: " & gApplication )
end select
getExtension = sExtension
end function
'*******************************************************************************
sub OLESetFocus()
const ICWAIT as Integer = 10
PrintLog " - set focus to OLE object (edit mode)"
select case gApplication
case "WRITER"
printlog " Select and deselect " + gApplication
Kontext "DocumentWriter"
DocumentWriter.TypeKeys("<F6>" , 4 , TRUE )
DocumentWriter.TypeKeys("<DOWN>" , 3 , TRUE )
DocumentWriter.TypeKeys("<RIGHT>" , 1 , TRUE )
DocumentWriter.TypeKeys("<MOD1 RETURN>" , 1 , TRUE )
DocumentWriter.TypeKeys("<TAB>" , 1 , TRUE )
DocumentWriter.TypeKeys("<RETURN>" , 1 , TRUE )
'DocumentWriter.MouseDoubleClick ( 50, 50 )
sleep( ICWAIT )
call SendEscape( 3 ) '(to close the float as well)
case "IMPRESS"
printlog " Select and deselect " + gApplication
Kontext "DocumentImpress"
DocumentImpress.MouseDoubleClick ( 50, 50 )
sleep( ICWAIT )
case "CALC"
printlog " Select and deselect " + gApplication
Kontext "DocumentCalc"
DocumentCalc.TypeKeys( "<F6>" , 5 , TRUE )
DocumentCalc.TypeKeys( "<DOWN>" , 3 , TRUE )
DocumentCalc.TypeKeys( "<MOD1 RETURN>" , 1 , TRUE )
DocumentCalc.TypeKeys( "<RETURN>" , 1 , TRUE )
'gMouseClick ( 20, 20 )
'DocumentCalc.MouseDoubleClick ( 20, 20 )
sleep( ICWAIT )
call SendEscape( 3 ) '(to close the float as well)
case "MASTERDOCUMENT"
printlog " Select and deselect " + gApplication
Kontext "DocumentMasterDoc"
DocumentMasterDoc.MouseDown( 50 , 50 , 1 )
DocumentMasterDoc.MouseUp( 50 , 50 , 1 )
hUseAsyncSlot( "EditObjectEdit" )
sleep( ICWAIT )
case else
warnlog( "Invalid gApplication: " & gApplication )
end select
end sub
'*******************************************************************************
sub OLESetFocus2()
'default waitstate
const ICWAIT as Integer = 1
PrintLog " - set focus to OLE object (edit mode)"
select case gApplication
case "WRITER"
Kontext "DocumentWriter"
try
FormatObject
Kontext ' This is by intention, do not change!
active.SetPage TabType
Kontext "TabType"
TabType.Cancel()
hUseAsyncSlot( "EditObjectEdit" )
catch
warnlog "Can't activate object"
endcatch
sleep( ICWAIT * 2 )
gMouseClick ( 5 , 5 ) 'out of edit mode
gMouseClick ( 5 , 5 ) 'remove focus
case "DRAW"
Kontext "DocumentDraw"
if OLEApp = "MATH" then
DocumentDraw.MouseDoubleClick ( 45, 46 )
else
DocumentDraw.MouseDoubleClick ( 50, 45 )
end if
sleep( ICWAIT * 5 )
gMouseClick ( 1 , 1 )
case "IMPRESS"
Kontext "DocumentImpress"
printlog( " - using accessibility shortcuts for objecthandling" )
printlog( " (select, activate and release object)" )
DocumentImpress.TypeKeys( "<F6>" , 5 , TRUE )
DocumentImpress.TypeKeys( "<TAB><RETURN>" )
sleep( ICWAIT * 2 )
call SendEscape()
case "CALC"
Kontext "DocumentCalc"
printlog( " - using accessibility shortcuts for objecthandling" )
printlog( " (select, activate and release object)" )
DocumentCalc.TypeKeys( "<F6>" , 5 , TRUE )
DocumentCalc.TypeKeys( "<DOWN>" , 3 , TRUE )
DocumentCalc.TypeKeys( "<RIGHT>" , 1 , TRUE )
DocumentCalc.TypeKeys( "<MOD1 RETURN>" , 1 , TRUE )
DocumentCalc.TypeKeys( "<RETURN>" , 1 , TRUE )
sleep( ICWAIT * 2 )
call sendEscape()
case "MASTERDOCUMENT"
Kontext "DocumentMasterDoc"
try
FormatObject
sleep( ICWAIT )
Kontext ' This is by intention, do not change!
Active.SetPage TabType
Kontext "TabType"
TabType.Cancel
hUseAsyncSlot( "EditObjectEdit" )
catch
qaerrorlog( "The object is not selected after reload." )
endcatch
Sleep( ICWAIT )
Kontext "DocumentMasterDoc"
DocumentMasterDoc.MouseDoubleClick ( 1 , 1 )
case else
warnlog( "Invalid gApplication: " & gApplication )
end select
end sub
'*******************************************************************************
sub OLESetFocus3()
'TODO: Get rid of as many mousemovements as possible
'default waitstate
const ICWAIT as Integer = 1
printlog( " - set focus to OLE object (edit mode)" )
select case gApplication
case "WRITER"
Kontext "DocumentWriter"
try
FormatObject
sleep( ICWAIT )
Kontext ' This is by intention, do not change!
active.SetPage TabType
Kontext "TabType"
TabType.Cancel
hUseAsyncSlot( "EditObjectEdit" )
catch
warnlog "Can't activate object"
endcatch
sleep( ICWAIT * 5 )
gMouseClick ( 1, 1 )
case "DRAW"
Kontext "DocumentDraw"
DocumentDraw.TypeKeys ("<Tab>")
DocumentDraw.MouseDoubleClick ( 50, 50 )
sleep( ICWAIT * 5 )
gMouseClick ( 1, 1 )
case "IMPRESS"
Kontext "DocumentImpress"
printlog( " - Using accessibility-shortcuts to manipulate object")
DocumentImpress.TypeKeys( "<TAB>" )
sleep( ICWAIT )
DocumentImpress.TypeKeys( "<SHIFT RETURN>" )
call SendEscape( 3 )
case "MASTERDOCUMENT"
Kontext "DocumentMasterDoc"
try
FormatObject
sleep( ICWAIT )
Kontext ' This is by intention, do not change!
active.SetPage( TabType )
Kontext "TabType"
TabType.Cancel()
hUseAsyncSlot( "EditObjectEdit" )
catch
qaerrorlog( "The object is not selected after reload." )
endcatch
sleep( ICWAIT * 5 )
call SendEscape( 2 )
case else
warnlog( "Invalid gApplication: " & gApplication )
end select
end sub
'*******************************************************************************
sub OLERemoveFocus
printlog( "Remove focus from OLE object for " & gApplication )
select case gApplication
case "WRITER" : call SendEscape( 2 )
case "MASTERDOCUMENT" : Kontext "DocumentMasterDoc"
DocumentMasterDoc.MouseDoubleClick ( 1, 1 )
case "IMPRESS" : gMouseClick ( 5, 99 )
case "CALC" : Kontext "DocumentCalc"
call SendEscape()
end select
end sub
'*******************************************************************************
sub ClosePresentationFloat()
gApplication = "IMPRESS"
printlog( "Open a new document" )
hNewDocument
'use the tiny little hammer to kill the presentation float
printlog( "Reset the application (which closes the presentation toolbar)" )
resetapplication
printlog( "Open a new document" )
hNewDocument
Kontext "CommonTaskbar"
try
printlog( "Try to click a button on the presentation toolbar" )
Seiteduplizieren.click()
warnlog( "The presentation toolbar is open" )
catch
printlog( "Button is unavailable. Good" )
endcatch
printlog( "Close the document" )
hCloseDocument
gApplication = "WRITER" ' reset, just in case...
end sub
'*******************************************************************************
function hStepThroughChartWizard() as boolean
const CFN = "hStepThroughChartWizard::"
printlog( CFN & "Enter" )
dim brc as boolean 'a multi purpose boolean returnvalue
Kontext "ChartWizard"
if ( not chartWizard.exists( 1 ) ) then
warnlog( CFN & "Chart Wizard not open within reasonable time" )
hStepThroughChartWizard() = false
else
Kontext "ChartWizard"
GoNext.Click()
Kontext "ChartWizard"
GoNext.Click()
Kontext "ChartWizard"
GoNext.Click()
Kontext "ChartWizard"
ChartWizard.ok()
Sleep( 3 )
endif
kontext "ChartWizard"
if ( ChartWizard.exists( 1 ) ) then
warnlog( CFN & "Chart Wizard is still open" )
endif
printlog( CFN & "Exit" )
hStepThroughChartWizard() = true
end function
|