Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / wizards / source / tutorials / RoadMap.xba
blobefcfc03a4003722fa6566c7e4e054663153eea41
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3 <!--
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 .
19 -->
20 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="RoadMap" script:language="StarBasic">REM ***** BASIC *****
21 Dim oControlModel
22 Dim oDialogModel
23 Dim CurrentItem
24 Dim bLongString
25 Dim oControl
26 Dim oEvent
27 Dim oUseDialog As Object
28 Dim oModulName As Object
30 Sub RoadMapMain(ModulNameforItemChange, dialogtoUse)
31 GlobalScope.BasicLibraries.LoadLibrary(&quot;Tools&quot;)
32 oUseDialog = dialogtoUse
33 oModulName = ModulNameforItemChange
34 oDialogModel = oUseDialog.Model
35 oControlModel = oUseDialog.Model.CreateInstance(&quot;com.sun.star.awt.UnoControlRoadmapModel&quot;)
37 oDialogModel.insertByName(&quot;RoadMap&quot;, oControlModel)
38 oControl = oUseDialog.getControl(&quot;RoadMap&quot;)
39 oEvent = createUnoListener( &quot;CallBack_&quot;, &quot;com.sun.star.awt.XItemListener&quot; )
40 oControl.addItemListener(oEvent)
41 oControlModel.CurrentItemID = 0
42 oControlModel.Complete = True
43 oControlModel.Activated = True
44 End Sub
46 Sub SetVisibleRoadMap(param)
47 oControl.SetVisible(param)
48 End Sub
50 Sub SetDialogModelSize(Width, Height)
51 oDialogModel.Width = Width
52 oDialogModel.Height = Height
53 End Sub
55 Sub SetControlModelPosSize(X, Y, Width, Height)
56 oControlModel.PositionX = X
57 oControlModel.PositionY = Y
58 oControlModel.Width = Width
59 oControlModel.Height = Height
60 End Sub
62 Sub SetControlModelText( ModelText As String)
63 oControlModel.Text = ModelText
64 End Sub
66 Sub InsertItemsLabels( ItemLabelsArray() As String)
67 For i = 0 To Ubound(ItemLabelsArray())
68 oRoadmapItem = oControlModel.createInstance()
69 oRoadmapItem.Label = ItemLabelsArray(i)
70 oRoadmapItem.ID = i
71 oControlModel.insertbyIndex(i, oRoadmapItem)
72 Next i
73 End Sub
75 Sub SetItemEnabled( ItemIndex, param)
76 oControlModel.getByIndex(ItemIndex).Enabled = param
77 oControlModel.CurrentItemID = ItemIndex
78 End Sub
80 Sub AddImagetoControlModel( Url As String)
81 oControlModel.ImageUrl = ConvertToUrl(Url)
82 End Sub
84 Function GetSelectedIndex()
85 GetSelectedIndex() = oControlModel.CurrentItemID
86 End Function
88 Function GetControlModel()
89 GetControlModel = oControlModel
90 End Function
92 Function GetDialogModel()
93 GetDialogModel = oDialogModel
94 End Function
96 Sub Callback_itemStateChanged(aEvent)
97 oModulName.ItemChange(oControlModel.CurrentItemID, aEvent.itemID)
98 End Sub
100 Sub SetComplete(param)
101 oControlModel.Complete = param
102 End Sub
104 Sub SetActivated(param)
105 oControlModel.Activated = param
106 End Sub
108 Sub RemoveItem(ItemIndex)
109 If ItemIndex &gt; -1 Then
110 oControlModel.removeByIndex(ItemIndex)
111 End If
112 End Sub
114 Sub InsertItem(ItemLabel As String)
115 oRoadmapItem = oControlModel.createInstance()
116 oRoadmapItem.Label = ItemLabel
117 oControlModel.insertbyIndex(oControlModel.CurrentItemID, oRoadmapItem)
118 End Sub
120 Sub ReplaceItem(ItemLabel As String)
121 oRoadmapItem = oControlModel.createInstance()
122 oRoadmapItem.Label = ItemLabel
123 oControlModel.replacebyIndex(oControlModel.CurrentItemID, oRoadmapItem)
124 End Sub
126 Sub Callback_disposing(aEvent)
127 End Sub
129 Sub Property_propertyChange(aEvent)
130 End Sub
132 Sub Property_disposing(aEvent)
133 End Sub
134 </script:module>