merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / basic / mod / sc / AccessibleEditableTextPara_PreviewCell / sc_AccessibleEditableTextPara_PreviewCell.xba
blobc701f9b54faa490fcfabfeb71e8db94647c5c544
1 <?xml version="1.0" encoding="UTF-8"?>
2 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="sc_AccessibleEditableTextPara_PreviewCell" script:language="StarBasic">
4 '*************************************************************************
6 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 '
8 ' Copyright 2008 by Sun Microsystems, Inc.
10 ' OpenOffice.org - a multi-platform office productivity suite
12 ' $RCSfile: sc_AccessibleEditableTextPara_PreviewCell.xba,v $
14 ' $Revision: 1.4 $
16 ' This file is part of OpenOffice.org.
18 ' OpenOffice.org is free software: you can redistribute it and/or modify
19 ' it under the terms of the GNU Lesser General Public License version 3
20 ' only, as published by the Free Software Foundation.
22 ' OpenOffice.org is distributed in the hope that it will be useful,
23 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
24 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ' GNU Lesser General Public License version 3 for more details
26 ' (a copy is included in the LICENSE file that accompanied this code).
28 ' You should have received a copy of the GNU Lesser General Public License
29 ' version 3 along with OpenOffice.org. If not, see
30 ' <http://www.openoffice.org/license.html>
31 ' for a copy of the LGPLv3 License.
33 '*************************************************************************
34 '*************************************************************************
36 ' Be sure that all variables are dimensioned:
37 option explicit
40 ' REQUIRED VARIABLES for interface/service tests:
42 ' "com::sun::star::accessibility::XAccessibleEventBroadcaster"
43 ' needs the following Global variables:
45 ' "com::sun::star::accessibility::XAccessibleEditableText#optional"
46 ' needs the following Global variables:
47 ' global hasChangeableAttrs as boolean
49 ' "com::sun::star::accessibility::XAccessibleSelection#optional"
50 ' needs the following Global variables:
51 ' Global multiSelection As Boolean
53 ' "com::sun::star::accessibility::XAccessibleText"
54 ' needs the following Global variables:
55 Global accText as String
56 Global readOnly as Boolean
58 Sub CreateObj()
60 '*************************************************************************
61 ' COMPONENT:
62 ' com.sun.star.sc.AccessibleEditableTextPara_PreviewCell
63 '*************************************************************************
64 On Error Goto ErrHndl
65 Dim xRoot As Object, xDispatcher As Object
66 Dim xController As Object, xCell As Object
67 Dim url As New com.sun.star.util.URL
68 Dim urlTransformer As Object, oWin As Object
69 Dim noProps()
71 accText = "ScAccessibleEditableTextPara_PreviewCell"
72 oDoc = utils.createDocument("scalc",cObjectName)
73 xCell = oDoc.getSheets().getByIndex(0).getCellByPosition(0,0)
74 xCell.setFormula(accText)
76 xController = oDoc.getCurrentController()
77 urlTransformer = createUNOService("com.sun.star.util.URLTransformer")
78 url.Complete = ".uno:PrintPreview"
79 urlTransformer.parseStrict(url)
80 xDispatcher = xController.queryDispatch(url,"",0)
81 if (NOT isNull(xDispatcher)) then
82 xDispatcher.dispatch(url, noProps())
83 wait(500)
84 oWin = utils.at_getCurrentWindow(oDoc)
85 xRoot = utils.at_getAccessibleObject(oWin)
86 ' get the first cell
87 xRoot = utils.at_getAccessibleObjectForRole(xRoot, _
88 com.sun.star.accessibility.AccessibleRole.TABLE_CELL,"Cell A1")
89 ' the the Paragraph
90 oObj = utils.at_getAccessibleObjectForRole(xRoot, _
91 com.sun.star.accessibility.AccessibleRole.PARAGRAPH,"Paragraph 0")
92 utils.at_printAccessibleTree(xRoot)
93 readOnly = true
94 else
95 Out.Log("QueryDispatch FAILED. Cannot switch to Preview mode...")
96 Exit Sub
97 End If
99 Exit Sub
100 ErrHndl:
101 Test.Exception()
102 End Sub
103 Sub fireEvent()
104 Dim dispatcher as Object
105 dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
107 rem ----------------------------------------------------------------------
108 dispatcher.executeDispatch(oDoc.CurrentController.Frame, ".uno:ZoomIn", "", 0, Array())
109 wait(500)
110 rem ----------------------------------------------------------------------
111 dispatcher.executeDispatch(oDoc.CurrentController.Frame, ".uno:ZoomOut", "", 0, Array())
112 end Sub
113 </script:module>