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="dbaccess_ODatasourceBrowser" 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:
36
37' variable for XComponent
38Global oComponentInstance As Object
39
40' variable for XFormController
41Global otherWin As Object
42
43' variable for XDispatchProvider
44Global dispatchUrl As String
45
46' variable for frame.XController
47Global oFrameToAttach As Object
48Global oModelToAttach As Object
49Global bHasNoViewData As Boolean
50Global oObjToSuspend As Object
51Global bHasNoModel As Boolean
52
53' variables for awt.XTabController
54Global oXTabControllerModel as Object
55Global oXTabControllerContainer as Object
56
57' variable for lang.XInitialization
58Global aInitArgs As Variant
59
60
61Sub CreateObj()
62
63'*************************************************************************
64' COMPONENT:
65' dbaccess.ODatasourceBrowser
66'*************************************************************************
67On Error Goto ErrHndl
68    Dim cntrlr As Object
69    Dim frame1 As Object, frame2 As Object
70    Dim url As new com.sun.star.util.URL
71    Dim dispatcher As Object
72    Dim oShape As Object, oDrawPage As Object, oModel As Object
73    Dim oController As Object, oCtrll As Object
74    Dim params(2) as new com.sun.star.beans.PropertyValue
75    Dim list1 as object, ctrl as object
76
77'    oDoc = utils.createDocument("swriter", cObjectName)
78    oDoc = StarDesktop.loadComponentFromUrl("private:factory/swriter", "_blank",0 , args())
79
80    wait(500)
81
82    cntrlr = oDoc.getCurrentController()
83    frame1 = StarDesktop.getCurrentFrame()
84    url.Complete = ".component:DB/DataSourceBrowser"
85    dispatcher = frame1.queryDispatch(url, "_beamer", 12)
86    dispatcher.dispatch(url, DimArray())
87
88    frame2 = frame1.findFrame("_beamer", 4)
89    frame2.setName("ODatasourceBrowser")
90
91    oObj = frame2.getController()
92
93    ' now initialize the browser to make him displaying a table in its gtrid.
94    ' This is required for activating of this control
95    params(0).Name = "DataSourceName"
96    params(0).Value = "Bibliography"
97    params(1).Name = "CommandType"
98    params(1).Value = com.sun.star.sdb.CommandType.TABLE
99    params(2).Name = "Command"
100    params(2).Value = "biblio"
101
102    oObj.initialize(params())
103    ' waiting while data loading ...
104    wait(2000)
105
106'setting variable for XComponent
107    oComponentInstance = oObj
108
109'setting variable for XDispatchProvider
110    dispatchUrl = ".uno:DataSourceBrowser/FormLetter"
111
112'setting variable for XController
113    oFrameToAttach = frame1
114    oModelToAttach = oDoc
115    bHasNoViewData = true
116    oObjToSuspend = oObj
117    bHasNoModel = true
118
119'setting variables for awt.XTabController and for XFormController
120    oShape = toolkittools.createUNOControlShape("CommandButton", "UnoControlButton")
121    toolkittools.addShape(oShape)
122    oDrawPage = oDoc.getDrawPage()
123
124    oModel = oShape.getControl()
125    oController = oDoc.getCurrentController()
126    otherWin = oController.getControl(oModel)
127    oXTabControllerContainer = otherWin.getContext()
128    oXTabControllerModel = oDrawPage.getForms().getByIndex(0)
129
130' setting variable for lang.XInitialization
131    aInitArgs = params()
132
133Exit Sub
134ErrHndl:
135    Test.Exception()
136End Sub
137</script:module>
138