1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<script:module xmlns:script="http://openoffice.org/2000/script" script:name="toolkit_AccessibleEdit" script:language="StarBasic">
4
5
6'*************************************************************************
7'
8' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9'
10' Copyright 2000, 2010 Oracle and/or its affiliates.
11'
12' OpenOffice.org - a multi-platform office productivity suite
13'
14' This file is part of OpenOffice.org.
15'
16' OpenOffice.org is free software: you can redistribute it and/or modify
17' it under the terms of the GNU Lesser General Public License version 3
18' only, as published by the Free Software Foundation.
19'
20' OpenOffice.org is distributed in the hope that it will be useful,
21' but WITHOUT ANY WARRANTY; without even the implied warranty of
22' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23' GNU Lesser General Public License version 3 for more details
24' (a copy is included in the LICENSE file that accompanied this code).
25'
26' You should have received a copy of the GNU Lesser General Public License
27' version 3 along with OpenOffice.org.  If not, see
28' <http://www.openoffice.org/license.html>
29' for a copy of the LGPLv3 License.
30'
31'*************************************************************************
32*****
33'*************************************************************************
34
35
36
37' Be sure that all variables are dimensioned:
38option explicit
39
40
41' REQUIRED VARIABLES for interface/service tests:
42Global accText As String
43Global accButton As Object
44Global readOnly as Boolean
45Global hasChangeableAttrs As Boolean
46
47
48Sub CreateObj()
49
50'*************************************************************************
51' COMPONENT:
52' toolkit.AccessibleEdit
53'*************************************************************************
54On Error Goto ErrHndl
55    Dim xController As Object, oWin As Object
56    Dim xDispatcher As Object, xRoot As Object
57    Dim tk As Object, urlTransformer As Object
58    Dim url As New com.sun.star.util.URL
59    Dim noProps()
60
61    oDoc = utils.createDocument("swriter", cObjectName)
62    tk = createUNOService("com.sun.star.awt.Toolkit")
63    wait(500)
64
65    xController = oDoc.getCurrentController()
66    urlTransformer = createUNOService("com.sun.star.util.URLTransformer")
67    url.Complete = ".uno:HyperlinkDialog"
68    urlTransformer.parseStrict(url)
69    xDispatcher = xController.queryDispatch(url,"",0)
70
71    if (NOT isNull(xDispatcher)) then
72        xDispatcher.dispatch(url, noProps())
73        wait(500)
74        oWin = tk.getActiveTopWindow
75        xRoot = utils.at_getAccessibleObject(oWin)
76        oObj = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.TEXT)
77        accButton = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PUSH_BUTTON,"Close")
78        Out.Log("Implementation name: "+oObj.getImplementationName())
79
80        ' because of auto adding http:// in edit field when focus lost
81        oObj.setText("AccessibleEdit")
82        wait(500)
83        accButton.grabFocus()
84        wait(500)
85        oObj.grabFocus()
86        accText = oObj.getText()
87
88        hasChangeableAttrs = false
89        readOnly = false
90    else
91        Out.Log("QueryDispatch FAILED. Cannot open Hyperlink dialog...")
92    End If
93
94Exit Sub
95ErrHndl:
96    Test.Exception()
97End Sub
98
99Sub DisposeObj()
100    if NOT isNull(accButton) then
101        accButton.doAccessibleAction(0)
102        wait(1000)
103    End If
104    utils.closeObject(oDoc)
105End Sub
106
107Sub fireEvent()
108    oObj.grabFocus()
109    accButton.grabFocus()
110End Sub
111
112</script:module>
113