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=
"Functions" script:
language=
"StarBasic">REM ***** BASIC *****
21 Dim DialogVisible As Boolean
22 Dim TutorStep As Integer
23 Dim TutorLastStep As Integer
24 Dim myDialog As Object
25 Dim myTutorial As Object
26 Public TutorText() As String
27 Dim documentTitle As String
28 Dim exampleUse As Object
29 Dim properties() As Object
31 'public myWidth As Long
33 Dim oTextField As Object
34 Dim stepTitle As String
36 Dim imageStatus As String
38 Sub LoadTutorialDialog(exampleToUse, documentTYP)
40 exampleUse = exampleToUse
41 TutorText() = exampleUse.LoadText()
42 properties() = exampleUse.GetProperties()
43 If properties(
3).Value =
"True
" Then
44 Dim localisation(
0) As new com.sun.star.beans.NamedValue
45 localisation(
0).Name =
"Localisation
"
46 localisation(
0).Value = properties()
47 myTutorial.execute(localisation())
55 myDialog = LoadDialog(
"Tutorials
",
"TutorialsDialog
")
57 SetTutorialDocumentPosSize()
59 documentProps = ThisComponent.getDocumentProperties()
60 myDialog.Title =
"Tutorials -
" & documentProps.Title
61 oTextField = myDialog.GetControl(
"myTextField
")
62 oTextField.setVisible(False)
64 imageStatus =
"MIN
"
65 setMaxMinImage(imageStatus)
67 'myWidth = myDialog.Size.Width
68 myHeight = myDialog.Size.Height
70 CheckForStepShowButtonStatus()
71 CheckForStepNextButtonStatus()
74 myDialog.model.myTextField.Label = stepTitle
75 myDialog.model.myText.Label = GetStepText()
'TutorText(TutorStep)
80 Loop Until DialogVisible = False
81 If( oOpenDialogFlag = True) Then
83 TutorialOpen.TutorialOpenMain()
90 Sub setMaxMinImage(param As String)
91 On Local Error Goto NOIMAGE
92 oCommandButton = myDialog.GetControl(
"CommandButton
")
93 templatePath = GetPathSettings(
"Template
",false,
0)
94 Dim bitmapPath As String
95 iPos = InStr(templatePath,
"/
")
97 If(param =
"MAX
") Then
98 bitmapPath = templatePath
& "../wizard/bitmap/maximize.bmp
"
99 ElseIf(param =
"MIN
") Then
100 bitmapPath = templatePath
& "../wizard/bitmap/minimize.bmp
"
103 If(param =
"MAX
") Then
104 bitmapPath = templatePath
& "..\wizard\bitmap\maximize.bmp
"
105 ElseIf(param =
"MIN
") Then
106 bitmapPath = templatePath
& "..\wizard\bitmap\minimize.bmp
"
109 'printdbgInfo oCommandButton.Model
110 oCommandButton.Model.ImageUrl = bitmapPath
115 Sub SetTutorialDocumentPosSize()
116 activDesktopWindow = StarDesktop.activeFrame.ContainerWindow
117 If(activDesktopWindow.posSize.Height
< 550) Then
118 activDesktopWindow.setPosSize(
0,
0,
0,
550,
8)
120 If (activDesktopWindow.posSize.Width
< 750 ) Then
121 activDesktopWindow.setPosSize(
0,
0,
750,
0,
4)
126 RoadMapMain(Functions, myDialog)
127 SetControlModelPosSize(
0,
0,
85,
176)
128 SetControlModelText(
"Steps
")
130 StepSize = Ubound(TutorText())
131 Dim ItemsArray(StepSize) as String
132 For i =
0 To StepSize
133 stepcontent = TutorText(i)
134 iPos = InStr(stepcontent,CHR(
13))
135 ItemName = Left(stepcontent, iPos)
136 ItemsArray(i) = ItemName
138 InsertItemsLabels( ItemsArray())
140 For i =
1 To StepSize
141 SetItemEnabled( i, False)
143 SetItemEnabled(
0, True)
147 'myDialog.dispose
149 ShowInfoDialog.DisposeIDialog()
151 ' HIER WIRD DAS DOCUMENT GESCHLOSSEN!!!!!!!! GPF
152 thisComponent.CurrentController.Frame.close(True)
157 GlobalScope.BasicLibraries.LoadLibrary(
"Tools
")
158 myTutorial = createUNOService(
"com.sun.star.wizards.tutorial.executer.CallTutorialFramework
")
159 documentTitle = ThisComponent.getCurrentController.getFrame.Title
163 udProps = ThisComponent.DocumentProperties.UserDefinedProperties
164 If udProps.PropertySetInfo.hasPropertyByName(
"CurrentStep
") Then
165 TutorStep = udProps.CurrentStep
167 udProps.addProperty(
"CurrentStep
",
0, TutorStep)
172 ThisComponent.DocumentProperties.UserDefinedProperties.CurrentStep = TutorStep
178 Dim property(
6) As new com.sun.star.beans.PropertyValue
179 property(
0).Name =
"DocumentTYP
"
180 property(
0).Value = docTYP
181 property(
1).Name =
"MethodName
"
182 property(
1).Value =
"setDelay
"
183 property(
2).Name =
"Param
"
184 property(
2).Value =
0 'key insert speed (Millis)
185 property(
3).Name =
"Param
"
186 property(
3).Value =
4 'mouse animate speed (Millis)
187 property(
4).Name =
"Param
"
188 property(
4).Value =
2000 'after mouse animate sleep (Millis)
189 property(
5).Name =
"Param
"
190 property(
5).Value =
10 'mouse scroll speed (Millis)
191 property(
6).Name =
"Param
"
192 property(
6).Value = -
1 'mouse speed (step)
193 myTutorial.setPropertyValues(property())
197 oOpenDialogFlag = False
198 If (myDialog.model.done.Label =
"Close
") Then
201 DialogVisible = False
206 GotoStep(TutorStep +
1)
209 Sub GotoStep(StepIndex)
210 If(StepIndex
<= Ubound(TutorText())) Then
211 TutorStep = StepIndex
212 If TutorStep
> TutorLastStep Then
213 TutorLastStep = TutorStep
215 If(TutorStep = Ubound(TutorText())) Then
216 myDialog.model.next.enabled = False
217 myDialog.model.done.Label =
"Done
"
218 myDialog.model.show.Label =
"Tutorials
"
220 myDialog.model.next.enabled = True
223 myDialog.model.myText.Label = GetStepText()
224 CheckForStepShowButtonStatus()
225 SetItemEnabled( TutorStep, True)
230 Function GetStepText()
231 Dim tempText As String
232 tempText = TutorText(TutorStep)
233 iPos = InStr(tempText,CHR(
13))
234 ResultString = Right(tempText, Len(tempText) - iPos -
1)
235 GetStepText() = ResultString
238 Sub ItemChange(CurrentItemID, SelectitemID)
239 GotoStep(SelectitemID)
242 Sub SetDisableShowMeButton()
243 myDialog.model.show.enabled = False
244 TutorLastStep = TutorLastStep +
1
248 ActionItemsTextField = myDialog.GetControl(
"ActionItemsLabel
")
249 FixedLineVertikal = myDialog.GetControl(
"FixedLineVertikal
")
251 If myDialog.Size.Height =
35 Then
252 myDialog.setPosSize(
0,
0,
0,myHeight,
8)
253 oTextField.setVisible(False)
254 ActionItemsTextField.setVisible(True)
255 FixedLineVertikal.setVisible(True)
256 RoadMap.SetVisibleRoadMap(True)
258 myDialog.setPosSize(
0,
0,
0,
35,
8)
259 rmSelectedIndex = RoadMap.GetSelectedIndex() +
1
260 gsTitle = GetStepTitle()
261 oTextField.setText(rmSelectedIndex
& ".
" & gsTitle)
262 oTextField.setVisible(True)
263 ActionItemsTextField.setVisible(False)
264 FixedLineVertikal.setVisible(False)
265 RoadMap.SetVisibleRoadMap(False)
267 If(imageStatus =
"MAX
") Then
268 imageStatus =
"MIN
"
269 ElseIf(imageStatus =
"MIN
") Then
270 imageStatus =
"MAX
"
272 setMaxMinImage(imageStatus)
277 stepcontent = TutorText(TutorStep)
278 iPos = InStr(stepcontent,CHR(
13))
279 stepTitle = Left(stepcontent, iPos)
280 SetStepTitle() = stepTitle
283 Function GetStepTitle()
284 GetStepTitle() = stepTitle
287 Sub CheckForStepShowButtonStatus()
288 If ((exampleUse.ContainsStepAction() = True And TutorStep = TutorLastStep) Or myDialog.model.show.Label =
"Tutorials
") Then
289 myDialog.model.show.enabled = True
291 myDialog.model.show.enabled = False
295 Sub CheckForStepNextButtonStatus()
296 If(TutorStep = Ubound(TutorText())) Then
297 myDialog.model.next.enabled = False
298 myDialog.model.done.Label =
"Done
"
304 If( myDialog.model.show.Label =
"Tutorials
") Then
305 oOpenDialogFlag = True
306 DialogVisible = False
308 SetMousePosition(aEvent)
313 Sub SetMousePosition(aEvent)
314 MyPoints() = MousePoints(aEvent)
316 Dim mousePosition(
3) as new com.sun.star.beans.PropertyValue
317 mousePosition(
0).Name =
"DocumentTYP
"
318 mousePosition(
0).Value = docTYP
319 mousePosition(
1).Name =
"MethodName
"
320 mousePosition(
1).Value =
"setMousePosition
"
321 mousePosition(
2).Name =
"Param
"
322 mousePosition(
2).Value = MyPoints(
0)
323 mousePosition(
3).Name =
"Param
"
324 mousePosition(
3).Value = MyPoints(
1)
326 myTutorial.setPropertyValues(mousePosition())
329 Function MousePoints(aEvent)
330 Dim position(
1) As Integer
331 position(
0) = myDialog.getControl(
"show
").AccessibleContext.LocationOnScreen.X + aEvent.Source.Model.PositionX
332 position(
1) = myDialog.getControl(
"show
").AccessibleContext.LocationOnScreen.Y + aEvent.Source.Model.PositionY
333 MousePoints = position()
336 Function CheckPath(path() As String)
337 'documentTitle = ThisComponent.getCurrentController.getFrame.Title
339 ResultString = Right(sTitle,
3)
340 iPos = InStr(ResultString,
"#
")
341 ResultString = Right(ResultString, Len(ResultString) - iPos)
342 ResultFrameString = InStr (sTitle,
"{D}FRAME#
")
343 If ResultFrameString
<> 0 Then
344 If Not (sTitle = (
"{D}FRAME#
" & documentTitle
& "#
" & ResultString)) Then
345 'path(
0) =
"{D}FRAME#
" & documentTitle
& "#
" & ResultString
346 path(
0) =
"FRAME#
" & documentTitle
& "#
" & ResultString
348 ResultString = Right(sTitle,
3)
349 iPos = InStr(ResultString,
"#
")
350 ResultString = Right(ResultString, Len(ResultString) - iPos)
351 path(
1) =
"ROOT_PANE#
" & documentTitle
& "#
" & ResultString
353 'path(
0) =
"{D}FRAME#
" & documentTitle
& "#
" & ResultString
354 path(
0) =
"FRAME#
" & documentTitle
& "#
" & ResultString
359 Sub SetVisibleTutorialsDialog(param)
360 myDialog.setVisible(param)
364 myDialog.setVisible(True)
367 Sub SetVisibleFalse()
368 myDialog.setVisible(False)
372 Dim aUrl As new com.sun.star.util.URL
374 urlTransformer = createUNOService(
"com.sun.star.util.URLTransformer
")
375 aUrl.Complete =
"slot:
5621"
376 urlTransformer.parseStrict(aUrl)
377 xController = oDoc.getCurrentController()
378 xDispatcher = xController.queryDispatch(aUrl,
"",
0)
379 if NOT isNull(xDispatcher) then
380 xDispatcher.dispatch(aUrl, DimArray())
382 msgBox
"Error! Cannot close document.
"