1<?xml version="1.0" encoding="UTF-8"?>
2<script:module xmlns:script="http://openoffice.org/2000/script" script:name="toolkit_AccessibleList" 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#optional"
34 ' needs the following Global variables:
35
36' "com::sun::star::accessibility::XAccessibleSelection"
37 ' needs the following Global variables:
38Global multiSelection As Boolean
39
40Global accButton As Object
41
42
43Sub CreateObj()
44
45'*************************************************************************
46' COMPONENT:
47' com.sun.star.toolkit.AccessibleList
48'*************************************************************************
49On Error Goto ErrHndl
50    Dim xController As Object, oWin As Object
51    Dim xDispatcher As Object, xRoot As Object
52    Dim tk As Object, urlTransformer As Object
53    Dim url As New com.sun.star.util.URL
54    Dim noProps()
55
56    oDoc = utils.createDocument("swriter", cObjectName)
57    tk = createUNOService("com.sun.star.awt.Toolkit")
58    wait(500)
59
60    xController = oDoc.getCurrentController()
61    urlTransformer = createUNOService("com.sun.star.util.URLTransformer")
62    url.Complete = ".uno:HyperlinkDialog"
63    urlTransformer.parseStrict(url)
64    xDispatcher = xController.queryDispatch(url,"",0)
65
66    if (NOT isNull(xDispatcher)) then
67        multiSelection = false
68        xDispatcher.dispatch(url, noProps())
69        wait(500)
70        oWin = tk.getActiveTopWindow
71        xRoot = utils.at_getAccessibleObject(oWin)
72        accButton = utils.at_getAccessibleObjectForRole(xRoot, _
73                  com.sun.star.accessibility.AccessibleRole.PUSH_BUTTON,"Close")
74
75        'Selecting 'New Document' tab
76        Dim oTree as Object
77        oTree = utils.at_getAccessibleObjectForRole(xRoot, _
78                                 com.sun.star.accessibility.AccessibleRole.TREE)
79
80        oTree.selectAccessibleChild(3)
81        wait(500)
82
83        Out.log("# Getting the ListBox")
84        Dim oParent as Object
85        oParent = utils.at_getAccessibleObjectForRole(xRoot, _
86                            com.sun.star.accessibility.AccessibleRole.PANEL,"",_
87                                  "com.sun.star.comp.toolkit.AccessibleListBox")
88
89        Out.log("# Getting the first child")
90
91        oObj = oParent.getAccessibleChild(0)
92
93        Out.Log("Implementation name: "+oObj.getImplementationName())
94
95    else
96        Out.Log("QueryDispatch FAILED. Cannot open Hyperlink dialog...")
97    End If
98
99
100Exit Sub
101ErrHndl:
102    Test.Exception()
103End Sub
104
105Sub DisposeObj()
106    if NOT isNull(accButton) then
107        accButton.doAccessibleAction(0)
108        wait(1000)
109    End If
110    utils.closeObject(oDoc)
111End Sub
112
113Sub fireEvent()
114    oObj.grabFocus()
115    accButton.grabFocus()
116end Sub
117</script:module>
118