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 2000, 2010 Oracle and/or its affiliates.
7 ' OpenOffice.org - a multi-platform office productivity suite
9 ' This file is part of OpenOffice.org.
11 ' OpenOffice.org is free software: you can redistribute it and/or modify
12 ' it under the terms of the GNU Lesser General Public License version 3
13 ' only, as published by the Free Software Foundation.
15 ' OpenOffice.org is distributed in the hope that it will be useful,
16 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ' GNU Lesser General Public License version 3 for more details
19 ' (a copy is included in the LICENSE file that accompanied this code).
21 ' You should have received a copy of the GNU Lesser General Public License
22 ' version 3 along with OpenOffice.org. If not, see
23 ' <http://www.openoffice.org/license.html>
24 ' for a copy of the LGPLv3 License.
26 '/************************************************************************
28 '* owner : thorsten.bosbach@oracle.com
30 '* short description : global-level-1-test -> insert all OLE-Objects out of OLE-dialog into all doc-types
32 '\******************************************************************************
35 'Only for bughandling if closing an OLE object fails
36 Warnlog "Cannot release Chart Object -> #107005#?"
38 'if Active.Exists ( 1 ) then Active.TypeKeys "<RIGHT><ENTER>"
42 '*******************************************************************************
44 sub hOleSelektieren ( xStart%, yStart%, xEnde%, yEnde% )
46 select case gApplication
47 case "CALC" :Kontext "DocumentCalc"
48 DocumentCalc.MouseDown xStart%, yStart%
49 DocumentCalc.MouseMove xEnde%, yEnde%
50 DocumentCalc.MouseUp xEnde%, yEnde%
52 case "DRAW" :Kontext "DocumentDraw"
53 DocumentDraw.MouseDown xStart%, yStart%
54 DocumentDraw.MouseMove xEnde%, yEnde%
55 DocumentDraw.MouseUp xEnde%, yEnde%
56 case "WRITER" :Kontext "DocumentWriter"
57 DocumentWriter.MouseDown xStart%, yStart%
58 DocumentWriter.MouseMove xEnde%, yEnde%
59 DocumentWriter.MouseUp xEnde%, yEnde%
60 case "IMPRESS" :Kontext "DocumentImpress"
61 DocumentImpress.MouseDown xStart%, yStart%
62 DocumentImpress.MouseMove xEnde%, yEnde%
63 DocumentImpress.MouseUp xEnde%, yEnde%
64 case "MATH" :Kontext "DocumentMath"
65 DocumentMath.MouseDown xStart%, yStart%
66 DocumentMath.MouseMove xEnde%, yEnde%
67 DocumentMath.MouseUp xEnde%, yEnde%
68 case "MASTERDOCUMENT":Kontext "DocumentMasterDoc"
69 DocumentMasterDoc.MouseDown xStart%, yStart%
70 DocumentMasterDoc.MouseMove xEnde%, yEnde%
71 DocumentMasterDoc.MouseUp xEnde%, yEnde%
75 '*******************************************************************************
77 function hSetToStandardView ( cApplication as string ) as boolean
79 const MAX_WAIT_FOR_DIALOG = 2
81 select case ( cApplication )
83 gApplication = cApplication
85 Kontext "DocumentWriter"
87 gApplication = cApplication
89 Kontext "DocumentMasterDoc"
91 printlog( "Application not supported by this function: " & cApplication )
92 hSetToStandardView() = false
96 hUseAsyncSlot( "ViewZoom" )
99 if ( Massstab.exists( MAX_WAIT_FOR_DIALOG ) ) then
101 hCloseDialog( Massstab, "ok" )
103 warnlog( "Zoom-Dialog did not open" )
107 hSetToStandardView() = true
111 '*******************************************************************************
113 sub SendEscape(optional iTimes as Integer)
115 const ICWAIT as Integer = 1
117 if IsMissing( iTimes ) then
120 printlog( " - send <ESCAPE> keystroke to document" )
121 select case gApplication
123 Kontext "DocumentWriter"
126 DocumentWriter.TypeKeys( "<ESCAPE>" , 1 , TRUE )
129 Kontext "DocumentCalc"
132 DocumentCalc.TypeKeys( "<ESCAPE>" , 1 , TRUE )
134 case "MASTERDOCUMENT"
135 Kontext "DocumentMasterDoc"
138 DocumentMasterDoc.TypeKeys( "<ESCAPE>" , 1 , TRUE )
141 Kontext "DocumentDraw"
144 DocumentDraw.TypeKeys( "<ESCAPE>" , 1 , TRUE )
147 Kontext "DocumentImpress"
150 DocumentImpress.TypeKeys( "<ESCAPE>" , 1 , TRUE )
153 warnlog( "Invalid gApplication: " & gApplication )
157 '*******************************************************************************
159 sub UncheckAutoFileExtension()
160 Kontext "SpeichernDlg"
161 if SpeichernDlg.exists(5) then
162 if AutomatischeDateinamenserweiterung.Exists() then
163 printlog("l1_ole_tools::UncheckAutoFileExtension - unchecking automatic file extension" )
164 If AutomatischeDateinamenserweiterung.IsChecked() then
165 AutomatischeDateinamenserweiterung.Uncheck()
168 QAErrorLog ( "OBSOLETE: l1_ole_tools::UncheckAutoFileExtension Checkbox 'Automatic Filename Extension' unavailable" )
171 warnlog( "l1_ole_tools::UncheckAutoFileExtension SaveAs Dialog not open." )
175 '*******************************************************************************
177 function getExtension( optional sExtension as string ) as string
178 qaerrorlog( "getExtension is outdated. Use hGetSuffix( ... ) instead" )
179 printlog("l1_ole_ttols::getExtension:: - define the expected file extension" )
180 select case gApplication
191 case "MASTERDOCUMENT"
194 warnlog( "Invalid gApplication: " & gApplication )
196 getExtension = sExtension
199 '*******************************************************************************
202 const ICWAIT as Integer = 10
203 PrintLog " - set focus to OLE object (edit mode)"
204 select case gApplication
206 printlog " Select and deselect " + gApplication
207 Kontext "DocumentWriter"
208 DocumentWriter.TypeKeys("<F6>" , 4 , TRUE )
209 DocumentWriter.TypeKeys("<DOWN>" , 3 , TRUE )
210 DocumentWriter.TypeKeys("<RIGHT>" , 1 , TRUE )
211 DocumentWriter.TypeKeys("<MOD1 RETURN>" , 1 , TRUE )
212 DocumentWriter.TypeKeys("<TAB>" , 1 , TRUE )
213 DocumentWriter.TypeKeys("<RETURN>" , 1 , TRUE )
214 'DocumentWriter.MouseDoubleClick ( 50, 50 )
216 call SendEscape( 3 ) '(to close the float as well)
218 printlog " Select and deselect " + gApplication
219 Kontext "DocumentImpress"
220 DocumentImpress.MouseDoubleClick ( 50, 50 )
223 printlog " Select and deselect " + gApplication
224 Kontext "DocumentCalc"
225 DocumentCalc.TypeKeys( "<F6>" , 5 , TRUE )
226 DocumentCalc.TypeKeys( "<DOWN>" , 3 , TRUE )
227 DocumentCalc.TypeKeys( "<MOD1 RETURN>" , 1 , TRUE )
228 DocumentCalc.TypeKeys( "<RETURN>" , 1 , TRUE )
229 'gMouseClick ( 20, 20 )
230 'DocumentCalc.MouseDoubleClick ( 20, 20 )
232 call SendEscape( 3 ) '(to close the float as well)
233 case "MASTERDOCUMENT"
234 printlog " Select and deselect " + gApplication
235 Kontext "DocumentMasterDoc"
236 DocumentMasterDoc.MouseDown( 50 , 50 , 1 )
237 DocumentMasterDoc.MouseUp( 50 , 50 , 1 )
238 hUseAsyncSlot( "EditObjectEdit" )
241 warnlog( "Invalid gApplication: " & gApplication )
246 '*******************************************************************************
250 const ICWAIT as Integer = 1
251 PrintLog " - set focus to OLE object (edit mode)"
252 select case gApplication
254 Kontext "DocumentWriter"
257 Kontext ' This is by intention, do not change!
258 active.SetPage TabType
261 hUseAsyncSlot( "EditObjectEdit" )
263 warnlog "Can't activate object"
266 gMouseClick ( 5 , 5 ) 'out of edit mode
267 gMouseClick ( 5 , 5 ) 'remove focus
269 Kontext "DocumentDraw"
270 if OLEApp = "MATH" then
271 DocumentDraw.MouseDoubleClick ( 45, 46 )
273 DocumentDraw.MouseDoubleClick ( 50, 45 )
276 gMouseClick ( 1 , 1 )
278 Kontext "DocumentImpress"
279 printlog( " - using accessibility shortcuts for objecthandling" )
280 printlog( " (select, activate and release object)" )
281 DocumentImpress.TypeKeys( "<F6>" , 5 , TRUE )
282 DocumentImpress.TypeKeys( "<TAB><RETURN>" )
286 Kontext "DocumentCalc"
287 printlog( " - using accessibility shortcuts for objecthandling" )
288 printlog( " (select, activate and release object)" )
289 DocumentCalc.TypeKeys( "<F6>" , 5 , TRUE )
290 DocumentCalc.TypeKeys( "<DOWN>" , 3 , TRUE )
291 DocumentCalc.TypeKeys( "<RIGHT>" , 1 , TRUE )
292 DocumentCalc.TypeKeys( "<MOD1 RETURN>" , 1 , TRUE )
293 DocumentCalc.TypeKeys( "<RETURN>" , 1 , TRUE )
296 case "MASTERDOCUMENT"
297 Kontext "DocumentMasterDoc"
301 Kontext ' This is by intention, do not change!
302 Active.SetPage TabType
305 hUseAsyncSlot( "EditObjectEdit" )
307 qaerrorlog( "The object is not selected after reload." )
310 Kontext "DocumentMasterDoc"
311 DocumentMasterDoc.MouseDoubleClick ( 1 , 1 )
313 warnlog( "Invalid gApplication: " & gApplication )
318 '*******************************************************************************
321 'TODO: Get rid of as many mousemovements as possible
323 const ICWAIT as Integer = 1
324 printlog( " - set focus to OLE object (edit mode)" )
325 select case gApplication
327 Kontext "DocumentWriter"
331 Kontext ' This is by intention, do not change!
332 active.SetPage TabType
335 hUseAsyncSlot( "EditObjectEdit" )
337 warnlog "Can't activate object"
342 Kontext "DocumentDraw"
343 DocumentDraw.TypeKeys ("<Tab>")
344 DocumentDraw.MouseDoubleClick ( 50, 50 )
348 Kontext "DocumentImpress"
349 printlog( " - Using accessibility-shortcuts to manipulate object")
350 DocumentImpress.TypeKeys( "<TAB>" )
352 DocumentImpress.TypeKeys( "<SHIFT RETURN>" )
354 case "MASTERDOCUMENT"
355 Kontext "DocumentMasterDoc"
359 Kontext ' This is by intention, do not change!
360 active.SetPage( TabType )
363 hUseAsyncSlot( "EditObjectEdit" )
365 qaerrorlog( "The object is not selected after reload." )
370 warnlog( "Invalid gApplication: " & gApplication )
375 '*******************************************************************************
378 printlog( "Remove focus from OLE object for " & gApplication )
379 select case gApplication
380 case "WRITER" : call SendEscape( 2 )
381 case "MASTERDOCUMENT" : Kontext "DocumentMasterDoc"
382 DocumentMasterDoc.MouseDoubleClick ( 1, 1 )
383 case "IMPRESS" : gMouseClick ( 5, 99 )
384 case "CALC" : Kontext "DocumentCalc"
389 '*******************************************************************************
391 sub ClosePresentationFloat()
392 gApplication = "IMPRESS"
393 printlog( "Open a new document" )
395 'use the tiny little hammer to kill the presentation float
396 printlog( "Reset the application (which closes the presentation toolbar)" )
398 printlog( "Open a new document" )
400 Kontext "CommonTaskbar"
402 printlog( "Try to click a button on the presentation toolbar" )
403 Seiteduplizieren.click()
404 warnlog( "The presentation toolbar is open" )
406 printlog( "Button is unavailable. Good" )
408 printlog( "Close the document" )
410 gApplication = "WRITER" ' reset, just in case...
414 '*******************************************************************************
416 function hStepThroughChartWizard() as boolean
423 const CFN = "hStepThroughChartWizard::"
424 printlog( CFN & "Enter" )
425 dim brc as boolean 'a multi purpose boolean returnvalue
427 Kontext "ChartWizard"
428 if ( not chartWizard.exists( 1 ) ) then
430 warnlog( CFN & "Chart Wizard not open within reasonable time" )
431 hStepThroughChartWizard() = false
435 Kontext "ChartWizard"
438 Kontext "ChartWizard"
441 Kontext "ChartWizard"
444 Kontext "ChartWizard"
450 kontext "ChartWizard"
451 if ( ChartWizard.exists( 1 ) ) then
452 warnlog( CFN & "Chart Wizard is still open" )
456 printlog( CFN & "Exit" )
458 hStepThroughChartWizard() = true