1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Functions" script:language="StarBasic">REM ***** BASIC *****
Dim DialogVisible As Boolean
Dim TutorStep As Integer
Dim TutorLastStep As Integer
Dim myDialog As Object
Dim myTutorial As Object
Public TutorText() As String
Dim documentTitle As String
Dim exampleUse As Object
Dim properties() As Object
Dim docTYP As String
'public myWidth As Long
Dim myHeight As Long
Dim oTextField As Object
Dim stepTitle As String
Dim oOpenDialogFlag
Dim imageStatus As String
Sub LoadTutorialDialog(exampleToUse, documentTYP)
Init()
exampleUse = exampleToUse
TutorText() = exampleUse.LoadText()
properties() = exampleUse.GetProperties()
If properties(3).Value = "True" Then
Dim localisation(0) As new com.sun.star.beans.NamedValue
localisation(0).Name = "Localisation"
localisation(0).Value = properties()
myTutorial.execute(localisation())
Else
TutorStep = 0
TutorLastStep = 0
docTYP = documentTYP
InitAction()
ShowInfoMain()
DialogVisible = True
myDialog = LoadDialog("Tutorials","TutorialsDialog")
SetTutorialDocumentPosSize()
documentProps = ThisComponent.getDocumentProperties()
myDialog.Title = "Tutorials - " & documentProps.Title
oTextField = myDialog.GetControl("myTextField")
oTextField.setVisible(False)
imageStatus = "MIN"
setMaxMinImage(imageStatus)
'myWidth = myDialog.Size.Width
myHeight = myDialog.Size.Height
CheckForStepShowButtonStatus()
CheckForStepNextButtonStatus()
InitRoadMap()
SetVisibleTrue()
myDialog.model.myTextField.Label = stepTitle
myDialog.model.myText.Label = GetStepText()'TutorText(TutorStep)
Do
wait 1000
Loop Until DialogVisible = False
If( oOpenDialogFlag = True) Then
Destroy()
TutorialOpen.TutorialOpenMain()
Else
Destroy()
End If
End If
End Sub
Sub setMaxMinImage(param As String)
On Local Error Goto NOIMAGE
oCommandButton = myDialog.GetControl("CommandButton")
templatePath = GetPathSettings("Template",false, 0)
Dim bitmapPath As String
iPos = InStr(templatePath,"/")
If(iPos > 0) Then
If(param = "MAX") Then
bitmapPath = templatePath & "../wizard/bitmap/maximize.bmp"
ElseIf(param = "MIN") Then
bitmapPath = templatePath & "../wizard/bitmap/minimize.bmp"
End If
Else
If(param = "MAX") Then
bitmapPath = templatePath & "..\wizard\bitmap\maximize.bmp"
ElseIf(param = "MIN") Then
bitmapPath = templatePath & "..\wizard\bitmap\minimize.bmp"
End If
End If
'printdbgInfo oCommandButton.Model
oCommandButton.Model.ImageUrl = bitmapPath
Exit Sub
NOIMAGE:
End Sub
Sub SetTutorialDocumentPosSize()
activDesktopWindow = StarDesktop.activeFrame.ContainerWindow
If(activDesktopWindow.posSize.Height < 550) Then
activDesktopWindow.setPosSize(0,0,0,550,8)
End If
If (activDesktopWindow.posSize.Width < 750 ) Then
activDesktopWindow.setPosSize(0,0,750,0,4)
EndIf
End Sub
Sub InitRoadMap()
RoadMapMain(Functions, myDialog)
SetControlModelPosSize(0, 0, 85, 176)
SetControlModelText("Steps")
StepSize = Ubound(TutorText())
Dim ItemsArray(StepSize) as String
For i = 0 To StepSize
stepcontent = TutorText(i)
iPos = InStr(stepcontent,CHR(13))
ItemName = Left(stepcontent, iPos)
ItemsArray(i) = ItemName
Next i
InsertItemsLabels( ItemsArray())
For i = 1 To StepSize
SetItemEnabled( i, False)
Next i
SetItemEnabled( 0, True)
End Sub
Sub Destroy()
'myDialog.dispose
wait 1000
ShowInfoDialog.DisposeIDialog()
' HIER WIRD DAS DOCUMENT GESCHLOSSEN!!!!!!!! GPF
thisComponent.CurrentController.Frame.close(True)
End Sub
Sub Init
GlobalScope.BasicLibraries.LoadLibrary("Tools")
myTutorial = createUNOService("com.sun.star.wizards.tutorial.executer.CallTutorialFramework")
documentTitle = ThisComponent.getCurrentController.getFrame.Title
End Sub
Sub InitStep
udProps = ThisComponent.DocumentProperties.UserDefinedProperties
If udProps.PropertySetInfo.hasPropertyByName("CurrentStep") Then
TutorStep = udProps.CurrentStep
Else
udProps.addProperty("CurrentStep", 0, TutorStep)
End If
End Sub
Sub setStep
ThisComponent.DocumentProperties.UserDefinedProperties.CurrentStep = TutorStep
End Sub
Sub InitAction()
SetStepTitle()
Dim property(6) As new com.sun.star.beans.PropertyValue
property(0).Name = "DocumentTYP"
property(0).Value = docTYP
property(1).Name = "MethodName"
property(1).Value = "setDelay"
property(2).Name = "Param"
property(2).Value = 0 'key insert speed (Millis)
property(3).Name = "Param"
property(3).Value = 4 'mouse animate speed (Millis)
property(4).Name = "Param"
property(4).Value = 2000 'after mouse animate sleep (Millis)
property(5).Name = "Param"
property(5).Value = 10 'mouse scroll speed (Millis)
property(6).Name = "Param"
property(6).Value = -1 'mouse speed (step)
myTutorial.setPropertyValues(property())
End Sub
Sub EndDialog
oOpenDialogFlag = False
If (myDialog.model.done.Label = "Close") Then
TutorialCloseMain()
Else
DialogVisible = False
End If
End Sub
Sub NextStep
GotoStep(TutorStep + 1)
End Sub
Sub GotoStep(StepIndex)
If(StepIndex <= Ubound(TutorText())) Then
TutorStep = StepIndex
If TutorStep > TutorLastStep Then
TutorLastStep = TutorStep
End If
If(TutorStep = Ubound(TutorText())) Then
myDialog.model.next.enabled = False
myDialog.model.done.Label = "Done"
myDialog.model.show.Label = "Tutorials"
Else
myDialog.model.next.enabled = True
End If
SetStepTitle()
myDialog.model.myText.Label = GetStepText()
CheckForStepShowButtonStatus()
SetItemEnabled( TutorStep, True)
'setStep()
End If
End Sub
Function GetStepText()
Dim tempText As String
tempText = TutorText(TutorStep)
iPos = InStr(tempText,CHR(13))
ResultString = Right(tempText, Len(tempText) - iPos - 1)
GetStepText() = ResultString
End Function
Sub ItemChange(CurrentItemID, SelectitemID)
GotoStep(SelectitemID)
End Sub
Sub SetDisableShowMeButton()
myDialog.model.show.enabled = False
TutorLastStep = TutorLastStep + 1
End Sub
Sub Minimize(aEvent)
ActionItemsTextField = myDialog.GetControl("ActionItemsLabel")
FixedLineVertikal = myDialog.GetControl("FixedLineVertikal")
If myDialog.Size.Height = 35 Then
myDialog.setPosSize(0,0,0,myHeight,8)
oTextField.setVisible(False)
ActionItemsTextField.setVisible(True)
FixedLineVertikal.setVisible(True)
RoadMap.SetVisibleRoadMap(True)
Else
myDialog.setPosSize(0,0,0,35,8)
rmSelectedIndex = RoadMap.GetSelectedIndex() + 1
gsTitle = GetStepTitle()
oTextField.setText(rmSelectedIndex & ". " & gsTitle)
oTextField.setVisible(True)
ActionItemsTextField.setVisible(False)
FixedLineVertikal.setVisible(False)
RoadMap.SetVisibleRoadMap(False)
End If
If(imageStatus = "MAX") Then
imageStatus = "MIN"
ElseIf(imageStatus = "MIN") Then
imageStatus = "MAX"
End If
setMaxMinImage(imageStatus)
End Sub
Sub SetStepTitle()
stepcontent = TutorText(TutorStep)
iPos = InStr(stepcontent,CHR(13))
stepTitle = Left(stepcontent, iPos)
SetStepTitle() = stepTitle
End Sub
Function GetStepTitle()
GetStepTitle() = stepTitle
End Function
Sub CheckForStepShowButtonStatus()
If ((exampleUse.ContainsStepAction() = True And TutorStep = TutorLastStep) Or myDialog.model.show.Label = "Tutorials") Then
myDialog.model.show.enabled = True
Else
myDialog.model.show.enabled = False
End If
End Sub
Sub CheckForStepNextButtonStatus()
If(TutorStep = Ubound(TutorText())) Then
myDialog.model.next.enabled = False
myDialog.model.done.Label = "Done"
End If
End Sub
Sub Show(aEvent)
'ShowInfoMain()
If( myDialog.model.show.Label = "Tutorials") Then
oOpenDialogFlag = True
DialogVisible = False
Else
SetMousePosition(aEvent)
exampleUse.Action()
End If
End Sub
Sub SetMousePosition(aEvent)
MyPoints() = MousePoints(aEvent)
Dim mousePosition(3) as new com.sun.star.beans.PropertyValue
mousePosition(0).Name = "DocumentTYP"
mousePosition(0).Value = docTYP
mousePosition(1).Name = "MethodName"
mousePosition(1).Value = "setMousePosition"
mousePosition(2).Name = "Param"
mousePosition(2).Value = MyPoints(0)
mousePosition(3).Name = "Param"
mousePosition(3).Value = MyPoints(1)
myTutorial.setPropertyValues(mousePosition())
End Sub
Function MousePoints(aEvent)
Dim position(1) As Integer
position(0) = myDialog.getControl("show").AccessibleContext.LocationOnScreen.X + aEvent.Source.Model.PositionX
position(1) = myDialog.getControl("show").AccessibleContext.LocationOnScreen.Y + aEvent.Source.Model.PositionY
MousePoints = position()
End Function
Function CheckPath(path() As String)
'documentTitle = ThisComponent.getCurrentController.getFrame.Title
sTitle = path(0)
ResultString = Right(sTitle, 3)
iPos = InStr(ResultString,"#")
ResultString = Right(ResultString, Len(ResultString) - iPos)
ResultFrameString = InStr (sTitle, "{D}FRAME#")
If ResultFrameString <> 0 Then
If Not (sTitle = ("{D}FRAME#" & documentTitle & "#" & ResultString)) Then
'path(0) = "{D}FRAME#" & documentTitle & "#" & ResultString
path(0) = "FRAME#" & documentTitle & "#" & ResultString
sTitle = path(1)
ResultString = Right(sTitle, 3)
iPos = InStr(ResultString,"#")
ResultString = Right(ResultString, Len(ResultString) - iPos)
path(1) = "ROOT_PANE#" & documentTitle & "#" & ResultString
Else
'path(0) = "{D}FRAME#" & documentTitle & "#" & ResultString
path(0) = "FRAME#" & documentTitle & "#" & ResultString
End If
End If
End Function
Sub SetVisibleTutorialsDialog(param)
myDialog.setVisible(param)
End Sub
Sub SetVisibleTrue()
myDialog.setVisible(True)
End Sub
Sub SetVisibleFalse()
myDialog.setVisible(False)
End Sub
Sub ExitTutorial()
Dim aUrl As new com.sun.star.util.URL
oDoc = ThisComponent
urlTransformer = createUNOService("com.sun.star.util.URLTransformer")
aUrl.Complete = "slot:5621"
urlTransformer.parseStrict(aUrl)
xController = oDoc.getCurrentController()
xDispatcher = xController.queryDispatch(aUrl, "", 0)
if NOT isNull(xDispatcher) then
xDispatcher.dispatch(aUrl, DimArray())
else
msgBox "Error! Cannot close document."
End If
End Sub
</script:module>
|