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">
3
4'*************************************************************************
5'
6'  Licensed to the Apache Software Foundation (ASF) under one
7'  or more contributor license agreements.  See the NOTICE file
8'  distributed with this work for additional information
9'  regarding copyright ownership.  The ASF licenses this file
10'  to you under the Apache License, Version 2.0 (the
11'  "License"); you may not use this file except in compliance
12'  with the License.  You may obtain a copy of the License at
13'
14'    http://www.apache.org/licenses/LICENSE-2.0
15'
16'  Unless required by applicable law or agreed to in writing,
17'  software distributed under the License is distributed on an
18'  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19'  KIND, either express or implied.  See the License for the
20'  specific language governing permissions and limitations
21'  under the License.
22'
23'*************************************************************************
24
25
26
27' Be sure that all variables are dimensioned:
28option explicit
29
30
31' REQUIRED VARIABLES for interface/service tests:
32
33' "com::sun::star::accessibility::XAccessibleEventBroadcaster"
34 ' needs the following Global variables:
35
36' "com::sun::star::accessibility::XAccessibleEditableText#optional"
37 ' needs the following Global variables:
38 ' global hasChangeableAttrs as boolean
39
40' "com::sun::star::accessibility::XAccessibleSelection#optional"
41 ' needs the following Global variables:
42 ' Global multiSelection As Boolean
43
44' "com::sun::star::accessibility::XAccessibleText"
45 ' needs the following Global variables:
46Global accText as String
47Global readOnly as Boolean
48
49Sub CreateObj()
50
51'*************************************************************************
52' COMPONENT:
53' com.sun.star.sc.AccessibleEditableTextPara_PreviewCell
54'*************************************************************************
55On Error Goto ErrHndl
56    Dim xRoot As Object, xDispatcher As Object
57    Dim xController As Object, xCell As Object
58    Dim url As New com.sun.star.util.URL
59    Dim urlTransformer As Object, oWin As Object
60    Dim noProps()
61
62    accText = "ScAccessibleEditableTextPara_PreviewCell"
63    oDoc = utils.createDocument("scalc",cObjectName)
64    xCell = oDoc.getSheets().getByIndex(0).getCellByPosition(0,0)
65    xCell.setFormula(accText)
66
67    xController = oDoc.getCurrentController()
68    urlTransformer = createUNOService("com.sun.star.util.URLTransformer")
69    url.Complete = ".uno:PrintPreview"
70    urlTransformer.parseStrict(url)
71    xDispatcher = xController.queryDispatch(url,"",0)
72    if (NOT isNull(xDispatcher)) then
73        xDispatcher.dispatch(url, noProps())
74        wait(500)
75        oWin = utils.at_getCurrentWindow(oDoc)
76        xRoot = utils.at_getAccessibleObject(oWin)
77        ' get the  first cell
78        xRoot = utils.at_getAccessibleObjectForRole(xRoot, _
79             com.sun.star.accessibility.AccessibleRole.TABLE_CELL,"Cell A1")
80        ' the the Paragraph
81        oObj = utils.at_getAccessibleObjectForRole(xRoot, _
82             com.sun.star.accessibility.AccessibleRole.PARAGRAPH,"Paragraph 0")
83        utils.at_printAccessibleTree(xRoot)
84        readOnly = true
85    else
86        Out.Log("QueryDispatch FAILED. Cannot switch to Preview mode...")
87        Exit Sub
88    End If
89
90Exit Sub
91ErrHndl:
92    Test.Exception()
93End Sub
94Sub fireEvent()
95    Dim dispatcher as Object
96    dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
97
98    rem ----------------------------------------------------------------------
99    dispatcher.executeDispatch(oDoc.CurrentController.Frame, ".uno:ZoomIn", "", 0, Array())
100    wait(500)
101    rem ----------------------------------------------------------------------
102    dispatcher.executeDispatch(oDoc.CurrentController.Frame, ".uno:ZoomOut", "", 0, Array())
103end Sub
104</script:module>
105