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