1*b1cdbd2cSJim Jagielski<?xml version="1.0" encoding="UTF-8"?>
2*b1cdbd2cSJim Jagielski<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3*b1cdbd2cSJim Jagielski<!--***********************************************************
4*b1cdbd2cSJim Jagielski *
5*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
6*b1cdbd2cSJim Jagielski * or more contributor license agreements.  See the NOTICE file
7*b1cdbd2cSJim Jagielski * distributed with this work for additional information
8*b1cdbd2cSJim Jagielski * regarding copyright ownership.  The ASF licenses this file
9*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
10*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
11*b1cdbd2cSJim Jagielski * with the License.  You may obtain a copy of the License at
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski *   http://www.apache.org/licenses/LICENSE-2.0
14*b1cdbd2cSJim Jagielski *
15*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
16*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
17*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18*b1cdbd2cSJim Jagielski * KIND, either express or implied.  See the License for the
19*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
20*b1cdbd2cSJim Jagielski * under the License.
21*b1cdbd2cSJim Jagielski *
22*b1cdbd2cSJim Jagielski ***********************************************************-->
23*b1cdbd2cSJim Jagielski<script:module xmlns:script="http://openoffice.org/2000/script" script:name="ShowInfoDialog" script:language="StarBasic">REM  *****  BASIC  *****
24*b1cdbd2cSJim JagielskiDim oWnd As Object
25*b1cdbd2cSJim JagielskiDim oWnd2 As Object
26*b1cdbd2cSJim JagielskiDim oWnd3 As Object
27*b1cdbd2cSJim JagielskiDim oDoc as Object
28*b1cdbd2cSJim Jagielski
29*b1cdbd2cSJim JagielskiSub ShowInfoMain
30*b1cdbd2cSJim Jagielski	prop() = GetShowInfoPropeties()
31*b1cdbd2cSJim Jagielski	Init(prop(0).Value, prop(1).Value, prop(2).Value, prop(3).Value, prop(4).Value, prop(5).Value, prop(6).Value, prop(7).Value, prop(8).Value)
32*b1cdbd2cSJim JagielskiEnd Sub
33*b1cdbd2cSJim Jagielski
34*b1cdbd2cSJim JagielskiSub Init(tFieldText As String, windowX, windowY, windowWidth, windowHeight, tFieldX, tFieldY, tFieldWidth, tFieldHeight)
35*b1cdbd2cSJim Jagielski	toolkit = createUnoService(&quot;com.sun.star.awt.Toolkit&quot;)
36*b1cdbd2cSJim Jagielski    Dim oWndDescr As new com.sun.star.awt.WindowDescriptor
37*b1cdbd2cSJim Jagielski    Dim oBounds As new com.sun.star.awt.Rectangle
38*b1cdbd2cSJim Jagielski    oWndDescr.Type = com.sun.star.awt.WindowClass.TOP
39*b1cdbd2cSJim Jagielski    oWndDescr.WindowServiceName = &quot;&quot;
40*b1cdbd2cSJim Jagielski    oWndDescr.ParentIndex = 0
41*b1cdbd2cSJim Jagielski
42*b1cdbd2cSJim Jagielski    &apos;officeX = StarDesktop.ActiveFrame.getContainerWindow().AccessibleContext.LocationOnScreen.X
43*b1cdbd2cSJim Jagielski	&apos;officeY = StarDesktop.ActiveFrame.getContainerWindow().AccessibleContext.LocationOnScreen.Y
44*b1cdbd2cSJim Jagielski	&apos;officeWidth  = StarDesktop.ActiveFrame.getContainerWindow().getPosSize().Width
45*b1cdbd2cSJim Jagielski	&apos;officeHeight = StarDesktop.ActiveFrame.getContainerWindow().getPosSize().Height
46*b1cdbd2cSJim Jagielski	officeWidth  = thisComponent.CurrentController.Frame.getContainerWindow().getPosSize().Width
47*b1cdbd2cSJim Jagielski	officeHeight = thisComponent.CurrentController.Frame.getContainerWindow().getPosSize().Height
48*b1cdbd2cSJim Jagielski
49*b1cdbd2cSJim Jagielski	&apos;dialogWidth  = myTutoShowDialog.getPosSize().Width
50*b1cdbd2cSJim Jagielski	&apos;dialogHeight = myTutoShowDialog.getPosSize().Height
51*b1cdbd2cSJim Jagielski	X = officeWidth - windowWidth - windowX
52*b1cdbd2cSJim Jagielski	Y = officeHeight - windowHeight - windowY
53*b1cdbd2cSJim Jagielski
54*b1cdbd2cSJim Jagielski    oBounds.X = X : oBounds.Y = Y
55*b1cdbd2cSJim Jagielski    oBounds.Width = windowWidth : oBounds.Height = windowHeight
56*b1cdbd2cSJim Jagielski    oWndDescr.Bounds = oBounds
57*b1cdbd2cSJim Jagielski    oWndDescr.Parent = thisComponent.CurrentController.Frame.ContainerWindow
58*b1cdbd2cSJim Jagielski    with com.sun.star.awt.WindowAttribute
59*b1cdbd2cSJim Jagielski        oWndDescr.WindowAttributes = .CLOSEABLE AND .MOVEABLE AND .SIZEABLE AND .BORDER AND .SHOW
60*b1cdbd2cSJim Jagielski    end with
61*b1cdbd2cSJim Jagielski
62*b1cdbd2cSJim Jagielski    oWnd = toolkit.createWindow(oWndDescr)
63*b1cdbd2cSJim Jagielski
64*b1cdbd2cSJim Jagielski	Dim oWndDescr3 As new com.sun.star.awt.WindowDescriptor
65*b1cdbd2cSJim Jagielski    Dim oBounds3 As new com.sun.star.awt.Rectangle
66*b1cdbd2cSJim Jagielski	oWndDescr3.Type = com.sun.star.awt.WindowClass.TOP
67*b1cdbd2cSJim Jagielski    oWndDescr3.WindowServiceName = &quot;fixedimage&quot; &apos;&quot;fixedtext&quot;
68*b1cdbd2cSJim Jagielski    oWndDescr3.ParentIndex = 0
69*b1cdbd2cSJim Jagielski    oBounds3.X = 0 : oBounds3.Y = 0
70*b1cdbd2cSJim Jagielski    oBounds3.Width = tFieldWidth : oBounds3.Height = tFieldHeight
71*b1cdbd2cSJim Jagielski    oWndDescr3.Bounds = oBounds3
72*b1cdbd2cSJim Jagielski    oWndDescr3.Parent = oWnd
73*b1cdbd2cSJim Jagielski    with com.sun.star.awt.WindowAttribute
74*b1cdbd2cSJim Jagielski        oWndDescr3.WindowAttributes = .CLOSEABLE AND .MOVEABLE AND .SIZEABLE AND .BORDER AND .SHOW
75*b1cdbd2cSJim Jagielski    end with
76*b1cdbd2cSJim Jagielski
77*b1cdbd2cSJim Jagielski    oWnd3= toolkit.createWindow(oWndDescr3)
78*b1cdbd2cSJim Jagielski    &apos;oWnd2.Text = tFieldText
79*b1cdbd2cSJim Jagielski	&apos;printdbgInfo(oWnd3)
80*b1cdbd2cSJim Jagielski	setImage(oWnd3)
81*b1cdbd2cSJim Jagielski	&apos;oWnd3.Background = 16777215
82*b1cdbd2cSJim Jagielski&apos;	oWnd2.SetBackGround(16776960)
83*b1cdbd2cSJim Jagielski	oWnd.SetBackGround(16776960)
84*b1cdbd2cSJim Jagielski&apos;	oWnd.FontDescriptors(0).Name = &quot;Albany&quot;
85*b1cdbd2cSJim Jagielski&apos;	oWnd.FontDescriptors(0).StyleName = &quot;BOLD&quot;
86*b1cdbd2cSJim Jagielski
87*b1cdbd2cSJim Jagielski	Dim oWndDescr2 As new com.sun.star.awt.WindowDescriptor
88*b1cdbd2cSJim Jagielski    Dim oBounds2 As new com.sun.star.awt.Rectangle
89*b1cdbd2cSJim Jagielski	oWndDescr2.Type = com.sun.star.awt.WindowClass.TOP
90*b1cdbd2cSJim Jagielski    oWndDescr2.WindowServiceName = &quot;fixedtext&quot;
91*b1cdbd2cSJim Jagielski    oWndDescr2.ParentIndex = 0
92*b1cdbd2cSJim Jagielski    oBounds2.X = tFieldX : oBounds2.Y = tFieldY
93*b1cdbd2cSJim Jagielski    oBounds2.Width = tFieldWidth : oBounds2.Height = tFieldHeight
94*b1cdbd2cSJim Jagielski    oWndDescr2.Bounds = oBounds2
95*b1cdbd2cSJim Jagielski    oWndDescr2.Parent = oWnd3
96*b1cdbd2cSJim Jagielski    with com.sun.star.awt.WindowAttribute
97*b1cdbd2cSJim Jagielski        oWndDescr2.WindowAttributes = .CLOSEABLE AND .MOVEABLE AND .SIZEABLE AND .BORDER AND .SHOW
98*b1cdbd2cSJim Jagielski    end with
99*b1cdbd2cSJim Jagielski
100*b1cdbd2cSJim Jagielski    oWnd2= toolkit.createWindow(oWndDescr2)
101*b1cdbd2cSJim Jagielski    oWnd2.Text = tFieldText
102*b1cdbd2cSJim Jagielski    oWnd2.Background = 268435455
103*b1cdbd2cSJim Jagielski    &apos;printdbgInfo(oWnd2)
104*b1cdbd2cSJim Jagielski
105*b1cdbd2cSJim Jagielski    &apos;printdbgInfo oWnd.getPosSize()
106*b1cdbd2cSJim Jagielski
107*b1cdbd2cSJim JagielskiEnd Sub
108*b1cdbd2cSJim Jagielski
109*b1cdbd2cSJim JagielskiFunction GetShowInfoPropeties()
110*b1cdbd2cSJim Jagielski	stepText = GetStepTitle()
111*b1cdbd2cSJim Jagielski	Dim Properties(8) As new com.sun.star.beans.NamedValue
112*b1cdbd2cSJim Jagielski	Properties(0).Name = &quot;ShowInfoDialogText&quot;
113*b1cdbd2cSJim Jagielski	Properties(0).Value = stepText &amp; &quot;Press [Esc] to abort.&quot;
114*b1cdbd2cSJim Jagielski	Properties(1).Name = &quot;WindowX&quot;
115*b1cdbd2cSJim Jagielski	Properties(1).Value = 20
116*b1cdbd2cSJim Jagielski	Properties(2).Name = &quot;WindowY&quot;
117*b1cdbd2cSJim Jagielski	Properties(2).Value = 40
118*b1cdbd2cSJim Jagielski	Properties(3).Name = &quot;WindowWidth&quot;
119*b1cdbd2cSJim Jagielski	Properties(3).Value = 190
120*b1cdbd2cSJim Jagielski	Properties(4).Name = &quot;WindowHeight&quot;
121*b1cdbd2cSJim Jagielski	Properties(4).Value = 50
122*b1cdbd2cSJim Jagielski	Properties(5).Name = &quot;TFieldX&quot;
123*b1cdbd2cSJim Jagielski	Properties(5).Value = 7
124*b1cdbd2cSJim Jagielski	Properties(6).Name = &quot;TFieldY&quot;
125*b1cdbd2cSJim Jagielski	Properties(6).Value = 8
126*b1cdbd2cSJim Jagielski	Properties(7).Name = &quot;TFieldWidth&quot;
127*b1cdbd2cSJim Jagielski	Properties(7).Value = 190
128*b1cdbd2cSJim Jagielski	Properties(8).Name = &quot;TFieldHeight&quot;
129*b1cdbd2cSJim Jagielski	Properties(8).Value = 50
130*b1cdbd2cSJim Jagielski	GetShowInfoPropeties = Properties()
131*b1cdbd2cSJim JagielskiEnd Function
132*b1cdbd2cSJim Jagielski
133*b1cdbd2cSJim JagielskiSub setShowInfoText()
134*b1cdbd2cSJim Jagielski	stepText = GetStepTitle()
135*b1cdbd2cSJim Jagielski	oWnd2.Text = stepText &amp; &quot;Press [Esc] to abort.&quot;
136*b1cdbd2cSJim JagielskiEnd Sub
137*b1cdbd2cSJim Jagielski
138*b1cdbd2cSJim JagielskiSub ShowON()
139*b1cdbd2cSJim Jagielski	setShowInfoText()
140*b1cdbd2cSJim Jagielski	oWnd.setVisible(True)
141*b1cdbd2cSJim Jagielski	oWnd3.setVisible(True)
142*b1cdbd2cSJim Jagielski	oWnd2.setVisible(True)
143*b1cdbd2cSJim JagielskiEnd Sub
144*b1cdbd2cSJim Jagielski
145*b1cdbd2cSJim JagielskiSub ShowOFF()
146*b1cdbd2cSJim Jagielski	&apos;On Local Error Goto NOPROPERTYSETINFO:
147*b1cdbd2cSJim Jagielski		oWnd.setVisible(False)
148*b1cdbd2cSJim Jagielski		oWnd2.setVisible(False)
149*b1cdbd2cSJim Jagielski		oWnd3.setVisible(False)
150*b1cdbd2cSJim Jagielski		&apos;oDoc.dispose()
151*b1cdbd2cSJim Jagielski	Exit Sub
152*b1cdbd2cSJim Jagielski	&apos;NOPROPERTYSETINFO:
153*b1cdbd2cSJim JagielskiEnd Sub
154*b1cdbd2cSJim Jagielski
155*b1cdbd2cSJim JagielskiSub DisposeIDialog()
156*b1cdbd2cSJim Jagielski    &apos;On Local Error Goto NOPROPERTYSETINFO:
157*b1cdbd2cSJim Jagielski		oWnd3.dispose
158*b1cdbd2cSJim Jagielski		oWnd2.dispose
159*b1cdbd2cSJim Jagielski		oWnd.dispose
160*b1cdbd2cSJim Jagielski		oDoc.dispose()
161*b1cdbd2cSJim Jagielski	Exit Sub
162*b1cdbd2cSJim Jagielski	&apos;NOPROPERTYSETINFO:
163*b1cdbd2cSJim JagielskiEnd Sub
164*b1cdbd2cSJim Jagielski
165*b1cdbd2cSJim Jagielskisub setImage(whatever as Object)
166*b1cdbd2cSJim Jagielski
167*b1cdbd2cSJim Jagielski	templatePath = GetPathSettings(&quot;Template&quot;,false, 0)
168*b1cdbd2cSJim Jagielski	Dim bitmapPath As String
169*b1cdbd2cSJim Jagielski	iPos = InStr(templatePath,&quot;/&quot;)
170*b1cdbd2cSJim Jagielski	if(iPos &gt; 0) Then
171*b1cdbd2cSJim Jagielski		bitmapPath = templatePath &amp; &quot;../wizard/bitmap/tutorial_background.gif&quot;
172*b1cdbd2cSJim Jagielski	Else
173*b1cdbd2cSJim Jagielski		bitmapPath = templatePath &amp; &quot;..\wizard\bitmap\tutorial_background.gif&quot;
174*b1cdbd2cSJim Jagielski	End If
175*b1cdbd2cSJim Jagielski
176*b1cdbd2cSJim Jagielski	dim props(0) as new com.sun.star.beans.PropertyValue
177*b1cdbd2cSJim Jagielski	props(0).Name = &quot;Hidden&quot;
178*b1cdbd2cSJim Jagielski	props(0).Value = true
179*b1cdbd2cSJim Jagielski    oDoc = StarDesktop.loadComponentFromUrl(&quot;private:factory/swriter&quot;,&quot;_blank&quot;,0,props())
180*b1cdbd2cSJim Jagielski    oShape = addControlToDefaultForm(&quot;ImageButton&quot;, 1000, 1000, 2000, 1000)
181*b1cdbd2cSJim Jagielski    imgControl = oShape.getControl()
182*b1cdbd2cSJim Jagielski    &apos;imgControl.ImageUrl=&quot;file:///D:/Program%20Files/src680_m11_qwizards1_49_TEST/share/gallery/tutoItem.gif&quot;
183*b1cdbd2cSJim Jagielski	imgControl.ImageUrl = bitmapPath
184*b1cdbd2cSJim Jagielski    imgControl.addConsumer(whatever)
185*b1cdbd2cSJim Jagielski    imgControl.startProduction()
186*b1cdbd2cSJim Jagielskiend sub
187*b1cdbd2cSJim Jagielski
188*b1cdbd2cSJim JagielskiFunction createControlShape(cKind As String) As Object
189*b1cdbd2cSJim Jagielski
190*b1cdbd2cSJim Jagielski    Dim oControlShape As Object
191*b1cdbd2cSJim Jagielski    Dim oControl As Object
192*b1cdbd2cSJim Jagielski
193*b1cdbd2cSJim Jagielski
194*b1cdbd2cSJim Jagielski    oControlShape = oDoc.createInstance(&quot;com.sun.star.drawing.ControlShape&quot;)
195*b1cdbd2cSJim Jagielski    oControl = oDoc.createInstance(&quot;com.sun.star.form.component.&quot; &amp; cKind)
196*b1cdbd2cSJim Jagielski    oControl.setPropertyValue(&quot;DefaultControl&quot;, &quot;com.sun.star.form.control.&quot; &amp; cKind)
197*b1cdbd2cSJim Jagielski    oControlShape.setControl(oControl)
198*b1cdbd2cSJim Jagielski
199*b1cdbd2cSJim Jagielski
200*b1cdbd2cSJim Jagielski    createControlShape() = oControlShape
201*b1cdbd2cSJim Jagielski
202*b1cdbd2cSJim JagielskiEnd Function
203*b1cdbd2cSJim Jagielski
204*b1cdbd2cSJim JagielskiFunction createControlShapeWithDefaultControl(cKind As String) As Object
205*b1cdbd2cSJim Jagielski
206*b1cdbd2cSJim Jagielski    Dim oControlShape As Object
207*b1cdbd2cSJim Jagielski    Dim oControl As Object
208*b1cdbd2cSJim Jagielski
209*b1cdbd2cSJim Jagielski
210*b1cdbd2cSJim Jagielski    oControlShape = oDoc.createInstance(&quot;com.sun.star.drawing.ControlShape&quot;)
211*b1cdbd2cSJim Jagielski    oControl = oDoc.createInstance(&quot;com.sun.star.form.component.&quot; &amp; cKind)
212*b1cdbd2cSJim Jagielski    oControlShape.setControl(oControl)
213*b1cdbd2cSJim Jagielski
214*b1cdbd2cSJim Jagielski
215*b1cdbd2cSJim Jagielski    createControlShapeWithDefaultControl() = oControlShape
216*b1cdbd2cSJim Jagielski
217*b1cdbd2cSJim JagielskiEnd Function
218*b1cdbd2cSJim Jagielski
219*b1cdbd2cSJim JagielskiFunction createUNOControlShape(cKind As String, defControl As String) As Object
220*b1cdbd2cSJim Jagielski
221*b1cdbd2cSJim Jagielski    Dim oControlShape As Object
222*b1cdbd2cSJim Jagielski    Dim oControl As Object
223*b1cdbd2cSJim Jagielski
224*b1cdbd2cSJim Jagielski
225*b1cdbd2cSJim Jagielski    oControlShape = oDoc.createInstance(&quot;com.sun.star.drawing.ControlShape&quot;)
226*b1cdbd2cSJim Jagielski    oControl = oDoc.createInstance(&quot;com.sun.star.form.component.&quot; &amp; cKind)
227*b1cdbd2cSJim Jagielski    oControl.setPropertyValue(&quot;DefaultControl&quot;, &quot;com.sun.star.awt.&quot; &amp; defControl)
228*b1cdbd2cSJim Jagielski    oControlShape.setControl(oControl)
229*b1cdbd2cSJim Jagielski
230*b1cdbd2cSJim Jagielski
231*b1cdbd2cSJim Jagielski    createUNOControlShape() = oControlShape
232*b1cdbd2cSJim Jagielski
233*b1cdbd2cSJim JagielskiEnd Function
234*b1cdbd2cSJim Jagielski
235*b1cdbd2cSJim JagielskiFunction addShape(oShape As Object) As Boolean
236*b1cdbd2cSJim Jagielski
237*b1cdbd2cSJim Jagielski	Dim vSize As New com.sun.star.awt.Size
238*b1cdbd2cSJim Jagielski	Dim oDrawPage As Object
239*b1cdbd2cSJim Jagielski	Dim oForms As Object
240*b1cdbd2cSJim Jagielski	Dim oForm As Object
241*b1cdbd2cSJim Jagielski
242*b1cdbd2cSJim Jagielski    oDrawPage = oDoc.getDrawPage()
243*b1cdbd2cSJim Jagielski    oForms = oDrawPage.getForms()
244*b1cdbd2cSJim Jagielski
245*b1cdbd2cSJim Jagielski    if oForms.Count = 0 then
246*b1cdbd2cSJim Jagielski        oForm = oDoc.createInstance(&quot;com.sun.star.form.component.Form&quot;)
247*b1cdbd2cSJim Jagielski        oForms.insertByIndex(0, oForm)
248*b1cdbd2cSJim Jagielski    end if
249*b1cdbd2cSJim Jagielski
250*b1cdbd2cSJim Jagielski    vSize.Height = 2000 : vSize.Width = 2000
251*b1cdbd2cSJim Jagielski    oShape.Size = vSize
252*b1cdbd2cSJim Jagielski    oDrawPage.add(oShape)
253*b1cdbd2cSJim Jagielski
254*b1cdbd2cSJim Jagielski    addShape() = true
255*b1cdbd2cSJim Jagielski
256*b1cdbd2cSJim JagielskiEnd Function
257*b1cdbd2cSJim Jagielski
258*b1cdbd2cSJim Jagielskisub addControl(cKind as String)
259*b1cdbd2cSJim Jagielski
260*b1cdbd2cSJim Jagielski    Dim oDrawPage As Object
261*b1cdbd2cSJim Jagielski    Dim oForm As Object, oForms As Object
262*b1cdbd2cSJim Jagielski    Dim oControl As Object, oControlShape As Object
263*b1cdbd2cSJim Jagielski    Dim aSz As Variant
264*b1cdbd2cSJim Jagielski    Dim oText As Object
265*b1cdbd2cSJim Jagielski
266*b1cdbd2cSJim Jagielski    oDrawPage = oDoc.DrawPage
267*b1cdbd2cSJim Jagielski    oControlShape = oDoc.createInstance(&quot;com.sun.star.drawing.ControlShape&quot;)
268*b1cdbd2cSJim Jagielski    oControl = oDoc.createInstance(&quot;com.sun.star.form.component.&quot; + cKind)
269*b1cdbd2cSJim Jagielski    oForm = oDoc.createInstance(&quot;com.sun.star.form.component.Form&quot;)
270*b1cdbd2cSJim Jagielski    oforms = oDrawPage.Forms
271*b1cdbd2cSJim Jagielski    if oforms.count = 0 then
272*b1cdbd2cSJim Jagielski            oforms.insertbyindex(0,oForm)
273*b1cdbd2cSJim Jagielski    end if
274*b1cdbd2cSJim Jagielski    oControlShape.Control = oControl
275*b1cdbd2cSJim Jagielski    oDrawPage.add(oControlShape)
276*b1cdbd2cSJim Jagielski
277*b1cdbd2cSJim JagielskiEnd sub
278*b1cdbd2cSJim Jagielski
279*b1cdbd2cSJim JagielskiFunction addControlToDefaultForm(cKind as String, x As Integer, y As Integer, width As Integer, height As Integer) As Object
280*b1cdbd2cSJim Jagielski
281*b1cdbd2cSJim Jagielski    Dim oDrawPage As Object
282*b1cdbd2cSJim Jagielski    Dim oControl As Object, oControlShape As Object
283*b1cdbd2cSJim Jagielski    Dim pos As New com.sun.star.awt.Point
284*b1cdbd2cSJim Jagielski    Dim size As New com.sun.star.awt.Size
285*b1cdbd2cSJim Jagielski
286*b1cdbd2cSJim Jagielski	pos.X = x
287*b1cdbd2cSJim Jagielski	pos.Y = y
288*b1cdbd2cSJim Jagielski	size.Width = width
289*b1cdbd2cSJim Jagielski	size.Height = height
290*b1cdbd2cSJim Jagielski
291*b1cdbd2cSJim Jagielski    oDrawPage = oDoc.DrawPage
292*b1cdbd2cSJim Jagielski    oControlShape = oDoc.createInstance(&quot;com.sun.star.drawing.ControlShape&quot;)
293*b1cdbd2cSJim Jagielski    oControl = oDoc.createInstance(&quot;com.sun.star.form.component.&quot; + cKind)
294*b1cdbd2cSJim Jagielski    oControlShape.Control = oControl
295*b1cdbd2cSJim Jagielski    oControlShape.Position = pos
296*b1cdbd2cSJim Jagielski    oControlShape.Size = size
297*b1cdbd2cSJim Jagielski    oDrawPage.add(oControlShape)
298*b1cdbd2cSJim Jagielski
299*b1cdbd2cSJim Jagielski	addControlToDefaultForm() = oControlShape
300*b1cdbd2cSJim Jagielski
301*b1cdbd2cSJim JagielskiEnd Function
302*b1cdbd2cSJim Jagielski
303*b1cdbd2cSJim JagielskiFunction addShapeToDrawDoc(oPage as Object, nPosX, nPosY as Integer, oType As String) As Object
304*b1cdbd2cSJim Jagielski    Dim aPoint As New com.sun.star.awt.Point
305*b1cdbd2cSJim Jagielski    Dim aSize As New com.sun.star.awt.Size
306*b1cdbd2cSJim Jagielski    Dim oShape As Object
307*b1cdbd2cSJim Jagielski    Dim servNames As Variant
308*b1cdbd2cSJim Jagielski
309*b1cdbd2cSJim Jagielski    aPoint.x = nPosX
310*b1cdbd2cSJim Jagielski    aPoint.y = nPosY
311*b1cdbd2cSJim Jagielski    aSize.Width = 2000
312*b1cdbd2cSJim Jagielski    aSize.Height = 1000
313*b1cdbd2cSJim Jagielski    oShape = oDoc.createInstance(&quot;com.sun.star.drawing.&quot;+oType+&quot;Shape&quot;)
314*b1cdbd2cSJim Jagielski    oShape.Size = aSize
315*b1cdbd2cSJim Jagielski    oShape.Position = aPoint
316*b1cdbd2cSJim Jagielski
317*b1cdbd2cSJim Jagielski    if oShape.getPropertySetInfo().hasPropertyByName(&quot;FillColor&quot;) then
318*b1cdbd2cSJim Jagielski    	oShape.FillColor = RGB(128, 255, 0)
319*b1cdbd2cSJim Jagielski    End If
320*b1cdbd2cSJim Jagielski
321*b1cdbd2cSJim Jagielski    oPage.add(oShape)
322*b1cdbd2cSJim Jagielski
323*b1cdbd2cSJim Jagielski    addShapeToDrawDoc() = oShape
324*b1cdbd2cSJim JagielskiEnd Function
325*b1cdbd2cSJim Jagielski</script:module>
326