1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE script:module PUBLIC
"-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
4 * This file is part of the LibreOffice project.
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 * This file incorporates work covered by the following license notice:
12 * Licensed to the Apache Software Foundation (ASF) under one or more
13 * contributor license agreements. See the NOTICE file distributed
14 * with this work for additional information regarding copyright
15 * ownership. The ASF licenses this file to you under the Apache
16 * License, Version 2.0 (the "License"); you may not use this file
17 * except in compliance with the License. You may obtain a copy of
18 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 <script:module xmlns:
script=
"http://openoffice.org/2000/script" script:
name=
"ShowInfoDialog" script:
language=
"StarBasic">REM ***** BASIC *****
27 prop() = GetShowInfoPropeties()
28 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)
31 Sub Init(tFieldText As String, windowX, windowY, windowWidth, windowHeight, tFieldX, tFieldY, tFieldWidth, tFieldHeight)
32 toolkit = createUnoService(
"com.sun.star.awt.Toolkit
")
33 Dim oWndDescr As new com.sun.star.awt.WindowDescriptor
34 Dim oBounds As new com.sun.star.awt.Rectangle
35 oWndDescr.Type = com.sun.star.awt.WindowClass.TOP
36 oWndDescr.WindowServiceName =
""
37 oWndDescr.ParentIndex =
0
39 'officeX = StarDesktop.ActiveFrame.getContainerWindow().AccessibleContext.LocationOnScreen.X
40 'officeY = StarDesktop.ActiveFrame.getContainerWindow().AccessibleContext.LocationOnScreen.Y
41 'officeWidth = StarDesktop.ActiveFrame.getContainerWindow().getPosSize().Width
42 'officeHeight = StarDesktop.ActiveFrame.getContainerWindow().getPosSize().Height
43 officeWidth = thisComponent.CurrentController.Frame.getContainerWindow().getPosSize().Width
44 officeHeight = thisComponent.CurrentController.Frame.getContainerWindow().getPosSize().Height
46 'dialogWidth = myTutoShowDialog.getPosSize().Width
47 'dialogHeight = myTutoShowDialog.getPosSize().Height
48 X = officeWidth - windowWidth - windowX
49 Y = officeHeight - windowHeight - windowY
51 oBounds.X = X : oBounds.Y = Y
52 oBounds.Width = windowWidth : oBounds.Height = windowHeight
53 oWndDescr.Bounds = oBounds
54 oWndDescr.Parent = thisComponent.CurrentController.Frame.ContainerWindow
55 with com.sun.star.awt.WindowAttribute
56 oWndDescr.WindowAttributes = .CLOSEABLE AND .MOVEABLE AND .SIZEABLE AND .BORDER AND .SHOW
59 oWnd = toolkit.createWindow(oWndDescr)
61 Dim oWndDescr3 As new com.sun.star.awt.WindowDescriptor
62 Dim oBounds3 As new com.sun.star.awt.Rectangle
63 oWndDescr3.Type = com.sun.star.awt.WindowClass.TOP
64 oWndDescr3.WindowServiceName =
"fixedimage
" '"fixedtext
"
65 oWndDescr3.ParentIndex =
0
66 oBounds3.X =
0 : oBounds3.Y =
0
67 oBounds3.Width = tFieldWidth : oBounds3.Height = tFieldHeight
68 oWndDescr3.Bounds = oBounds3
69 oWndDescr3.Parent = oWnd
70 with com.sun.star.awt.WindowAttribute
71 oWndDescr3.WindowAttributes = .CLOSEABLE AND .MOVEABLE AND .SIZEABLE AND .BORDER AND .SHOW
74 oWnd3= toolkit.createWindow(oWndDescr3)
75 'oWnd2.Text = tFieldText
76 'printdbgInfo(oWnd3)
78 'oWnd3.Background =
16777215
79 ' oWnd2.SetBackGround(
16776960)
80 oWnd.SetBackGround(
16776960)
81 ' oWnd.FontDescriptors(
0).Name =
"Albany
"
82 ' oWnd.FontDescriptors(
0).StyleName =
"BOLD
"
84 Dim oWndDescr2 As new com.sun.star.awt.WindowDescriptor
85 Dim oBounds2 As new com.sun.star.awt.Rectangle
86 oWndDescr2.Type = com.sun.star.awt.WindowClass.TOP
87 oWndDescr2.WindowServiceName =
"fixedtext
"
88 oWndDescr2.ParentIndex =
0
89 oBounds2.X = tFieldX : oBounds2.Y = tFieldY
90 oBounds2.Width = tFieldWidth : oBounds2.Height = tFieldHeight
91 oWndDescr2.Bounds = oBounds2
92 oWndDescr2.Parent = oWnd3
93 with com.sun.star.awt.WindowAttribute
94 oWndDescr2.WindowAttributes = .CLOSEABLE AND .MOVEABLE AND .SIZEABLE AND .BORDER AND .SHOW
97 oWnd2= toolkit.createWindow(oWndDescr2)
98 oWnd2.Text = tFieldText
99 oWnd2.Background =
268435455
100 'printdbgInfo(oWnd2)
102 'printdbgInfo oWnd.getPosSize()
106 Function GetShowInfoPropeties()
107 stepText = GetStepTitle()
108 Dim Properties(
8) As new com.sun.star.beans.NamedValue
109 Properties(
0).Name =
"ShowInfoDialogText
"
110 Properties(
0).Value = stepText
& "Press [Esc] to abort.
"
111 Properties(
1).Name =
"WindowX
"
112 Properties(
1).Value =
20
113 Properties(
2).Name =
"WindowY
"
114 Properties(
2).Value =
40
115 Properties(
3).Name =
"WindowWidth
"
116 Properties(
3).Value =
190
117 Properties(
4).Name =
"WindowHeight
"
118 Properties(
4).Value =
50
119 Properties(
5).Name =
"TFieldX
"
120 Properties(
5).Value =
7
121 Properties(
6).Name =
"TFieldY
"
122 Properties(
6).Value =
8
123 Properties(
7).Name =
"TFieldWidth
"
124 Properties(
7).Value =
190
125 Properties(
8).Name =
"TFieldHeight
"
126 Properties(
8).Value =
50
127 GetShowInfoPropeties = Properties()
130 Sub setShowInfoText()
131 stepText = GetStepTitle()
132 oWnd2.Text = stepText
& "Press [Esc] to abort.
"
137 oWnd.setVisible(True)
138 oWnd3.setVisible(True)
139 oWnd2.setVisible(True)
143 'On Local Error Goto NOPROPERTYSETINFO:
144 oWnd.setVisible(False)
145 oWnd2.setVisible(False)
146 oWnd3.setVisible(False)
149 'NOPROPERTYSETINFO:
153 'On Local Error Goto NOPROPERTYSETINFO:
159 'NOPROPERTYSETINFO:
162 sub setImage(whatever as Object)
164 templatePath = GetPathSettings(
"Template
",false,
0)
165 Dim bitmapPath As String
166 iPos = InStr(templatePath,
"/
")
168 bitmapPath = templatePath
& "../wizard/bitmap/tutorial_background.gif
"
170 bitmapPath = templatePath
& "..\wizard\bitmap\tutorial_background.gif
"
173 dim props(
0) as new com.sun.star.beans.PropertyValue
174 props(
0).Name =
"Hidden
"
175 props(
0).Value = true
176 oDoc = StarDesktop.loadComponentFromUrl(
"private:factory/swriter
",
"_blank
",
0,props())
177 oShape = addControlToDefaultForm(
"ImageButton
",
1000,
1000,
2000,
1000)
178 imgControl = oShape.getControl()
179 'imgControl.ImageUrl=
"file:///D:/Program%
20Files/src680_m11_qwizards1_49_TEST/share/gallery/tutoItem.gif
"
180 imgControl.ImageUrl = bitmapPath
181 imgControl.addConsumer(whatever)
182 imgControl.startProduction()
185 Function createControlShape(cKind As String) As Object
187 Dim oControlShape As Object
188 Dim oControl As Object
191 oControlShape = oDoc.createInstance(
"com.sun.star.drawing.ControlShape
")
192 oControl = oDoc.createInstance(
"com.sun.star.form.component.
" & cKind)
193 oControl.setPropertyValue(
"DefaultControl
",
"com.sun.star.form.control.
" & cKind)
194 oControlShape.setControl(oControl)
197 createControlShape() = oControlShape
201 Function createControlShapeWithDefaultControl(cKind As String) As Object
203 Dim oControlShape As Object
204 Dim oControl As Object
207 oControlShape = oDoc.createInstance(
"com.sun.star.drawing.ControlShape
")
208 oControl = oDoc.createInstance(
"com.sun.star.form.component.
" & cKind)
209 oControlShape.setControl(oControl)
212 createControlShapeWithDefaultControl() = oControlShape
216 Function createUNOControlShape(cKind As String, defControl As String) As Object
218 Dim oControlShape As Object
219 Dim oControl As Object
222 oControlShape = oDoc.createInstance(
"com.sun.star.drawing.ControlShape
")
223 oControl = oDoc.createInstance(
"com.sun.star.form.component.
" & cKind)
224 oControl.setPropertyValue(
"DefaultControl
",
"com.sun.star.awt.
" & defControl)
225 oControlShape.setControl(oControl)
228 createUNOControlShape() = oControlShape
232 Function addShape(oShape As Object) As Boolean
234 Dim vSize As New com.sun.star.awt.Size
235 Dim oDrawPage As Object
239 oDrawPage = oDoc.getDrawPage()
240 oForms = oDrawPage.getForms()
242 if oForms.Count =
0 then
243 oForm = oDoc.createInstance(
"com.sun.star.form.component.Form
")
244 oForms.insertByIndex(
0, oForm)
247 vSize.Height =
2000 : vSize.Width =
2000
249 oDrawPage.add(oShape)
255 sub addControl(cKind as String)
257 Dim oDrawPage As Object
258 Dim oForm As Object, oForms As Object
259 Dim oControl As Object, oControlShape As Object
263 oDrawPage = oDoc.DrawPage
264 oControlShape = oDoc.createInstance(
"com.sun.star.drawing.ControlShape
")
265 oControl = oDoc.createInstance(
"com.sun.star.form.component.
" + cKind)
266 oForm = oDoc.createInstance(
"com.sun.star.form.component.Form
")
267 oforms = oDrawPage.Forms
268 if oforms.count =
0 then
269 oforms.insertbyindex(
0,oForm)
271 oControlShape.Control = oControl
272 oDrawPage.add(oControlShape)
276 Function addControlToDefaultForm(cKind as String, x As Integer, y As Integer, width As Integer, height As Integer) As Object
278 Dim oDrawPage As Object
279 Dim oControl As Object, oControlShape As Object
280 Dim pos As New com.sun.star.awt.Point
281 Dim size As New com.sun.star.awt.Size
288 oDrawPage = oDoc.DrawPage
289 oControlShape = oDoc.createInstance(
"com.sun.star.drawing.ControlShape
")
290 oControl = oDoc.createInstance(
"com.sun.star.form.component.
" + cKind)
291 oControlShape.Control = oControl
292 oControlShape.Position = pos
293 oControlShape.Size = size
294 oDrawPage.add(oControlShape)
296 addControlToDefaultForm() = oControlShape
300 Function addShapeToDrawDoc(oPage as Object, nPosX, nPosY as Integer, oType As String) As Object
301 Dim aPoint As New com.sun.star.awt.Point
302 Dim aSize As New com.sun.star.awt.Size
304 Dim servNames As Variant
310 oShape = oDoc.createInstance(
"com.sun.star.drawing.
"+oType+
"Shape
")
312 oShape.Position = aPoint
314 if oShape.getPropertySetInfo().hasPropertyByName(
"FillColor
") then
315 oShape.FillColor = RGB(
128,
255,
0)
320 addShapeToDrawDoc() = oShape