xref: /AOO41X/main/wizards/source/tutorials/RoadMap.xba (revision ff0525f24f03981d56b7579b645949f111420994)
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<!--***********************************************************
4 *
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements.  See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership.  The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License.  You may obtain a copy of the License at
12 *
13 *   http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied.  See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
21 *
22 ***********************************************************-->
23<script:module xmlns:script="http://openoffice.org/2000/script" script:name="RoadMap" script:language="StarBasic">REM  *****  BASIC  *****
24Dim oControlModel
25Dim oDialogModel
26Dim CurrentItem
27Dim bLongString
28Dim oControl
29Dim oEvent
30Dim oUseDialog As Object
31Dim oModulName As Object
32
33Sub RoadMapMain(ModulNameforItemChange, dialogtoUse)
34    GlobalScope.BasicLibraries.LoadLibrary(&quot;Tools&quot;)
35    oUseDialog = dialogtoUse
36    oModulName = ModulNameforItemChange
37    oDialogModel = oUseDialog.Model
38    oControlModel = oUseDialog.Model.CreateInstance(&quot;com.sun.star.awt.UnoControlRoadmapModel&quot;)
39
40    oDialogModel.insertByName(&quot;RoadMap&quot;, oControlModel)
41    oControl = oUseDialog.getControl(&quot;RoadMap&quot;)
42    oEvent = createUnoListener( &quot;CallBack_&quot;, &quot;com.sun.star.awt.XItemListener&quot; )
43    oControl.addItemListener(oEvent)
44    oControlModel.CurrentItemID = 0
45    oControlModel.Complete = True
46    oControlModel.Activated = True
47End Sub
48
49Sub SetVisibleRoadMap(param)
50    oControl.SetVisible(param)
51End Sub
52
53Sub SetDialogModelSize(Width, Height)
54    oDialogModel.Width = Width
55    oDialogModel.Height = Height
56End Sub
57
58Sub SetControlModelPosSize(X, Y, Width, Height)
59    oControlModel.PositionX = X
60    oControlModel.PositionY = Y
61    oControlModel.Width = Width
62    oControlModel.Height = Height
63End Sub
64
65Sub SetControlModelText( ModelText As String)
66    oControlModel.Text = ModelText
67End Sub
68
69Sub InsertItemsLabels( ItemLabelsArray() As String)
70    For i = 0 To Ubound(ItemLabelsArray())
71        oRoadmapItem = oControlModel.createInstance()
72        oRoadmapItem.Label = ItemLabelsArray(i)
73        oRoadmapItem.ID = i
74        oControlModel.insertbyIndex(i, oRoadmapItem)
75    Next i
76End Sub
77
78Sub SetItemEnabled( ItemIndex, param)
79    oControlModel.getByIndex(ItemIndex).Enabled = param
80    oControlModel.CurrentItemID = ItemIndex
81End Sub
82
83Sub AddImagetoControlModel( Url As String)
84    oControlModel.ImageUrl = ConvertToUrl(Url)
85End Sub
86
87Function GetSelectedIndex()
88    GetSelectedIndex() = oControlModel.CurrentItemID
89End Function
90
91Function GetControlModel()
92    GetControlModel = oControlModel
93End Function
94
95Function GetDialogModel()
96    GetDialogModel = oDialogModel
97End Function
98
99Sub Callback_itemStateChanged(aEvent)
100    oModulName.ItemChange(oControlModel.CurrentItemID, aEvent.itemID)
101End Sub
102
103Sub SetComplete(param)
104    oControlModel.Complete = param
105End Sub
106
107Sub SetActivated(param)
108    oControlModel.Activated = param
109End Sub
110
111Sub RemoveItem(ItemIndex)
112    If ItemIndex &gt; -1 Then
113        oControlModel.removeByIndex(ItemIndex)
114    End If
115End Sub
116
117Sub InsertItem(ItemLabel As String)
118    oRoadmapItem = oControlModel.createInstance()
119    oRoadmapItem.Label = ItemLabel
120    oControlModel.insertbyIndex(oControlModel.CurrentItemID, oRoadmapItem)
121End Sub
122
123Sub ReplaceItem(ItemLabel As String)
124    oRoadmapItem = oControlModel.createInstance()
125    oRoadmapItem.Label = ItemLabel
126    oControlModel.replacebyIndex(oControlModel.CurrentItemID, oRoadmapItem)
127End Sub
128
129Sub Callback_disposing(aEvent)
130End Sub
131
132Sub Property_propertyChange(aEvent)
133End Sub
134
135Sub Property_disposing(aEvent)
136End Sub
137</script:module>
138