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=
"Functions" script:
language=
"StarBasic">REM ***** BASIC *****
4 Dim DialogVisible As Boolean
5 Dim TutorStep As Integer
6 Dim TutorLastStep As Integer
8 Dim myTutorial As Object
9 Public TutorText() As String
10 Dim documentTitle As String
11 Dim exampleUse As Object
12 Dim properties() As Object
14 'public myWidth As Long
16 Dim oTextField As Object
17 Dim stepTitle As String
19 Dim imageStatus As String
21 Sub LoadTutorialDialog(exampleToUse, documentTYP)
23 exampleUse = exampleToUse
24 TutorText() = exampleUse.LoadText()
25 properties() = exampleUse.GetProperties()
26 If properties(
3).Value =
"True
" Then
27 Dim localisation(
0) As new com.sun.star.beans.NamedValue
28 localisation(
0).Name =
"Localisation
"
29 localisation(
0).Value = properties()
30 myTutorial.execute(localisation())
38 myDialog = LoadDialog(
"Tutorials
",
"TutorialsDialog
")
40 SetTutorialDocumentPosSize()
42 documentProps = ThisComponent.getDocumentProperties()
43 myDialog.Title =
"Tutorials -
" & documentProps.Title
44 oTextField = myDialog.GetControl(
"myTextField
")
45 oTextField.setVisible(False)
47 imageStatus =
"MIN
"
48 setMaxMinImage(imageStatus)
50 'myWidth = myDialog.Size.Width
51 myHeight = myDialog.Size.Height
53 CheckForStepShowButtonStatus()
54 CheckForStepNextButtonStatus()
57 myDialog.model.myTextField.Label = stepTitle
58 myDialog.model.myText.Label = GetStepText()
'TutorText(TutorStep)
63 Loop Until DialogVisible = False
64 If( oOpenDialogFlag = True) Then
66 TutorialOpen.TutorialOpenMain()
73 Sub setMaxMinImage(param As String)
74 On Local Error Goto NOIMAGE
75 oCommandButton = myDialog.GetControl(
"CommandButton
")
76 templatePath = GetPathSettings(
"Template
",false,
0)
77 Dim bitmapPath As String
78 iPos = InStr(templatePath,
"/
")
80 If(param =
"MAX
") Then
81 bitmapPath = templatePath
& "../wizard/bitmap/maximize.bmp
"
82 ElseIf(param =
"MIN
") Then
83 bitmapPath = templatePath
& "../wizard/bitmap/minimize.bmp
"
86 If(param =
"MAX
") Then
87 bitmapPath = templatePath
& "..\wizard\bitmap\maximize.bmp
"
88 ElseIf(param =
"MIN
") Then
89 bitmapPath = templatePath
& "..\wizard\bitmap\minimize.bmp
"
92 'printdbgInfo oCommandButton.Model
93 oCommandButton.Model.ImageUrl = bitmapPath
98 Sub SetTutorialDocumentPosSize()
99 activDesktopWindow = StarDesktop.activeFrame.ContainerWindow
100 If(activDesktopWindow.posSize.Height
< 550) Then
101 activDesktopWindow.setPosSize(
0,
0,
0,
550,
8)
103 If (activDesktopWindow.posSize.Width
< 750 ) Then
104 activDesktopWindow.setPosSize(
0,
0,
750,
0,
4)
109 RoadMapMain(Functions, myDialog)
110 SetControlModelPosSize(
0,
0,
85,
176)
111 SetControlModelText(
"Steps
")
113 StepSize = Ubound(TutorText())
114 Dim ItemsArray(StepSize) as String
115 For i =
0 To StepSize
116 stepcontent = TutorText(i)
117 iPos = InStr(stepcontent,CHR(
13))
118 ItemName = Left(stepcontent, iPos)
119 ItemsArray(i) = ItemName
121 InsertItemsLabels( ItemsArray())
123 For i =
1 To StepSize
124 SetItemEnabled( i, False)
126 SetItemEnabled(
0, True)
130 'myDialog.dispose
132 ShowInfoDialog.DisposeIDialog()
134 ' HIER WIRD DAS DOCUMENT GESCHLOSSEN!!!!!!!! GPF
135 thisComponent.CurrentController.Frame.close(True)
140 GlobalScope.BasicLibraries.LoadLibrary(
"Tools
")
141 myTutorial = createUNOService(
"com.sun.star.wizards.tutorial.executer.CallTutorialFramework
")
142 documentTitle = ThisComponent.getCurrentController.getFrame.Title
146 udProps = ThisComponent.DocumentProperties.UserDefinedProperties
147 If udProps.PropertySetInfo.hasPropertyByName(
"CurrentStep
") Then
148 TutorStep = udProps.CurrentStep
150 udProps.addProperty(
"CurrentStep
",
0, TutorStep)
155 ThisComponent.DocumentProperties.UserDefinedProperties.CurrentStep = TutorStep
161 Dim property(
6) As new com.sun.star.beans.PropertyValue
162 property(
0).Name =
"DocumentTYP
"
163 property(
0).Value = docTYP
164 property(
1).Name =
"MethodName
"
165 property(
1).Value =
"setDelay
"
166 property(
2).Name =
"Param
"
167 property(
2).Value =
0 'key insert speed (Millis)
168 property(
3).Name =
"Param
"
169 property(
3).Value =
4 'mouse animate speed (Millis)
170 property(
4).Name =
"Param
"
171 property(
4).Value =
2000 'after mouse animate sleep (Millis)
172 property(
5).Name =
"Param
"
173 property(
5).Value =
10 'mouse scroll speed (Millis)
174 property(
6).Name =
"Param
"
175 property(
6).Value = -
1 'mouse speed (step)
176 myTutorial.setPropertyValues(property())
180 oOpenDialogFlag = False
181 If (myDialog.model.done.Label =
"Close
") Then
184 DialogVisible = False
189 GotoStep(TutorStep +
1)
192 Sub GotoStep(StepIndex)
193 If(StepIndex
<= Ubound(TutorText())) Then
194 TutorStep = StepIndex
195 If TutorStep
> TutorLastStep Then
196 TutorLastStep = TutorStep
198 If(TutorStep = Ubound(TutorText())) Then
199 myDialog.model.next.enabled = False
200 myDialog.model.done.Label =
"Done
"
201 myDialog.model.show.Label =
"Tutorials
"
203 myDialog.model.next.enabled = True
206 myDialog.model.myText.Label = GetStepText()
207 CheckForStepShowButtonStatus()
208 SetItemEnabled( TutorStep, True)
213 Function GetStepText()
214 Dim tempText As String
215 tempText = TutorText(TutorStep)
216 iPos = InStr(tempText,CHR(
13))
217 ResultString = Right(tempText, Len(tempText) - iPos -
1)
218 GetStepText() = ResultString
221 Sub ItemChange(CurrentItemID, SelectitemID)
222 GotoStep(SelectitemID)
225 Sub SetDisableShowMeButton()
226 myDialog.model.show.enabled = False
227 TutorLastStep = TutorLastStep +
1
231 ActionItemsTextField = myDialog.GetControl(
"ActionItemsLabel
")
232 FixedLineVertikal = myDialog.GetControl(
"FixedLineVertikal
")
234 If myDialog.Size.Height =
35 Then
235 myDialog.setPosSize(
0,
0,
0,myHeight,
8)
236 oTextField.setVisible(False)
237 ActionItemsTextField.setVisible(True)
238 FixedLineVertikal.setVisible(True)
239 RoadMap.SetVisibleRoadMap(True)
241 myDialog.setPosSize(
0,
0,
0,
35,
8)
242 rmSelectedIndex = RoadMap.GetSelectedIndex() +
1
243 gsTitle = GetStepTitle()
244 oTextField.setText(rmSelectedIndex
& ".
" & gsTitle)
245 oTextField.setVisible(True)
246 ActionItemsTextField.setVisible(False)
247 FixedLineVertikal.setVisible(False)
248 RoadMap.SetVisibleRoadMap(False)
250 If(imageStatus =
"MAX
") Then
251 imageStatus =
"MIN
"
252 ElseIf(imageStatus =
"MIN
") Then
253 imageStatus =
"MAX
"
255 setMaxMinImage(imageStatus)
260 stepcontent = TutorText(TutorStep)
261 iPos = InStr(stepcontent,CHR(
13))
262 stepTitle = Left(stepcontent, iPos)
263 SetStepTitle() = stepTitle
266 Function GetStepTitle()
267 GetStepTitle() = stepTitle
270 Sub CheckForStepShowButtonStatus()
271 If ((exampleUse.ContainsStepAction() = True And TutorStep = TutorLastStep) Or myDialog.model.show.Label =
"Tutorials
") Then
272 myDialog.model.show.enabled = True
274 myDialog.model.show.enabled = False
278 Sub CheckForStepNextButtonStatus()
279 If(TutorStep = Ubound(TutorText())) Then
280 myDialog.model.next.enabled = False
281 myDialog.model.done.Label =
"Done
"
287 If( myDialog.model.show.Label =
"Tutorials
") Then
288 oOpenDialogFlag = True
289 DialogVisible = False
291 SetMousePosition(aEvent)
296 Sub SetMousePosition(aEvent)
297 MyPoints() = MousePoints(aEvent)
299 Dim mousePosition(
3) as new com.sun.star.beans.PropertyValue
300 mousePosition(
0).Name =
"DocumentTYP
"
301 mousePosition(
0).Value = docTYP
302 mousePosition(
1).Name =
"MethodName
"
303 mousePosition(
1).Value =
"setMousePosition
"
304 mousePosition(
2).Name =
"Param
"
305 mousePosition(
2).Value = MyPoints(
0)
306 mousePosition(
3).Name =
"Param
"
307 mousePosition(
3).Value = MyPoints(
1)
309 myTutorial.setPropertyValues(mousePosition())
312 Function MousePoints(aEvent)
313 Dim position(
1) As Integer
314 position(
0) = myDialog.getControl(
"show
").AccessibleContext.LocationOnScreen.X + aEvent.Source.Model.PositionX
315 position(
1) = myDialog.getControl(
"show
").AccessibleContext.LocationOnScreen.Y + aEvent.Source.Model.PositionY
316 MousePoints = position()
319 Function CheckPath(path() As String)
320 'documentTitle = ThisComponent.getCurrentController.getFrame.Title
322 ResultString = Right(sTitle,
3)
323 iPos = InStr(ResultString,
"#
")
324 ResultString = Right(ResultString, Len(ResultString) - iPos)
325 ResultFrameString = InStr (sTitle,
"{D}FRAME#
")
326 If ResultFrameString
<> 0 Then
327 If Not (sTitle = (
"{D}FRAME#
" & documentTitle
& "#
" & ResultString)) Then
328 'path(
0) =
"{D}FRAME#
" & documentTitle
& "#
" & ResultString
329 path(
0) =
"FRAME#
" & documentTitle
& "#
" & ResultString
331 ResultString = Right(sTitle,
3)
332 iPos = InStr(ResultString,
"#
")
333 ResultString = Right(ResultString, Len(ResultString) - iPos)
334 path(
1) =
"ROOT_PANE#
" & documentTitle
& "#
" & ResultString
336 'path(
0) =
"{D}FRAME#
" & documentTitle
& "#
" & ResultString
337 path(
0) =
"FRAME#
" & documentTitle
& "#
" & ResultString
342 Sub SetVisibleTutorialsDialog(param)
343 myDialog.setVisible(param)
347 myDialog.setVisible(True)
350 Sub SetVisibleFalse()
351 myDialog.setVisible(False)
355 Dim aUrl As new com.sun.star.util.URL
357 urlTransformer = createUNOService(
"com.sun.star.util.URLTransformer
")
358 aUrl.Complete =
"slot:
5621"
359 urlTransformer.parseStrict(aUrl)
360 xController = oDoc.getCurrentController()
361 xDispatcher = xController.queryDispatch(aUrl,
"",
0)
362 if NOT isNull(xDispatcher) then
363 xDispatcher.dispatch(aUrl, DimArray())
365 msgBox
"Error! Cannot close document.
"