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="svtools_AccessibleBrowseBox" script:language="StarBasic">
4
5
6'*************************************************************************
7'
8'  Licensed to the Apache Software Foundation (ASF) under one
9'  or more contributor license agreements.  See the NOTICE file
10'  distributed with this work for additional information
11'  regarding copyright ownership.  The ASF licenses this file
12'  to you under the Apache License, Version 2.0 (the
13'  "License"); you may not use this file except in compliance
14'  with the License.  You may obtain a copy of the License at
15'
16'    http://www.apache.org/licenses/LICENSE-2.0
17'
18'  Unless required by applicable law or agreed to in writing,
19'  software distributed under the License is distributed on an
20'  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21'  KIND, either express or implied.  See the License for the
22'  specific language governing permissions and limitations
23'  under the License.
24'
25'*************************************************************************
26
27
28
29
30
31' Be sure that all variables are dimensioned:
32option explicit
33
34
35' REQUIRED VARIABLES for interface/service tests:
36Global controller As Object
37
38Sub CreateObj()
39
40'*************************************************************************
41' COMPONENT:
42' svtools.AccessibleBrowseBox
43'*************************************************************************
44On Error Goto ErrHndl
45    Dim bOK As Boolean
46    Dim oWin As Object, xRoot As Object
47    Dim xController As Object
48
49    oDoc = utils.createDocument("swriter", cObjectName)
50
51    'opening DatasourceBrowser
52    Dim urlTransformer As Object
53    urlTransformer = createUNOService("com.sun.star.util.URLTransformer")
54    Dim aUrl As new com.sun.star.util.URL
55    aUrl.Complete = ".component:DB/DataSourceBrowser"
56    urlTransformer.parseStrict(aUrl)
57    Dim xDispatcher As Object
58    xController = oDoc.getCurrentController()
59    xDispatcher = xController.queryDispatch(aUrl, "_beamer", 12)
60    Dim no_args()
61    xDispatcher.dispatch(aUrl, no_args)
62    wait(1000)
63
64    oWin = createUnoService("com.sun.star.awt.Toolkit").getActiveTopWindow()
65
66    xRoot = utils.at_getAccessibleObject(oWin)
67    oObj = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PANEL)
68    Out.log(oObj.getImplementationName)
69
70    Dim frame1 As Object, frame2 As Object
71    frame1 = StarDesktop.getCurrentFrame()
72    frame2 = frame1.findFrame("_beamer", 4)
73    frame2.setName("DatasourceBrowser")
74    controller = frame2.getController()
75
76Exit Sub
77ErrHndl:
78    Test.Exception()
79End Sub
80
81Sub DisposeObj()
82    utils.closeObject(oDoc)
83End Sub
84
85Sub fireEvent()
86    Out.log("fireEvent() called")
87
88    Dim dbContext As Object
89    dbContext = createUnoService("com.sun.star.sdb.DatabaseContext")
90    if (dbContext.hasByName("Bibliography")) then
91        dbContext.revokeObject("Bibliography")
92    endif
93
94    Dim dbSource As Object
95    dbSource = createUnoService("com.sun.star.sdb.DataSource")
96    dbSource.URL = "sdbc:dbase:" + utils.Path2URL("file:///" + utils.getUserPath + "/database/biblio")
97	dbContext.registerObject("Bibliography", dbSource)
98
99    Dim params(2) As new com.sun.star.beans.PropertyValue
100    params(0).Name = "DataSourceName"
101    params(0).Value = "Bibliography"
102    params(1).Name = "CommandType"
103    params(1).Value = com.sun.star.sdb.CommandType.TABLE
104    params(2).Name = "Command"
105    params(2).Value = "biblio"
106
107    controller.initialize(params())
108    wait(2000)
109End Sub
110</script:module>
111