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