xref: /trunk/main/wizards/source/tutorials/RoadMap.xba (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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="RoadMap" script:language="StarBasic">REM  *****  BASIC  *****
4Dim oControlModel
5Dim oDialogModel
6Dim CurrentItem
7Dim bLongString
8Dim oControl
9Dim oEvent
10Dim oUseDialog As Object
11Dim oModulName As Object
12
13Sub RoadMapMain(ModulNameforItemChange, dialogtoUse)
14    GlobalScope.BasicLibraries.LoadLibrary(&quot;Tools&quot;)
15    oUseDialog = dialogtoUse
16    oModulName = ModulNameforItemChange
17    oDialogModel = oUseDialog.Model
18    oControlModel = oUseDialog.Model.CreateInstance(&quot;com.sun.star.awt.UnoControlRoadmapModel&quot;)
19
20    oDialogModel.insertByName(&quot;RoadMap&quot;, oControlModel)
21    oControl = oUseDialog.getControl(&quot;RoadMap&quot;)
22    oEvent = createUnoListener( &quot;CallBack_&quot;, &quot;com.sun.star.awt.XItemListener&quot; )
23    oControl.addItemListener(oEvent)
24    oControlModel.CurrentItemID = 0
25    oControlModel.Complete = True
26    oControlModel.Activated = True
27End Sub
28
29Sub SetVisibleRoadMap(param)
30    oControl.SetVisible(param)
31End Sub
32
33Sub SetDialogModelSize(Width, Height)
34    oDialogModel.Width = Width
35    oDialogModel.Height = Height
36End Sub
37
38Sub SetControlModelPosSize(X, Y, Width, Height)
39    oControlModel.PositionX = X
40    oControlModel.PositionY = Y
41    oControlModel.Width = Width
42    oControlModel.Height = Height
43End Sub
44
45Sub SetControlModelText( ModelText As String)
46    oControlModel.Text = ModelText
47End Sub
48
49Sub InsertItemsLabels( ItemLabelsArray() As String)
50    For i = 0 To Ubound(ItemLabelsArray())
51        oRoadmapItem = oControlModel.createInstance()
52        oRoadmapItem.Label = ItemLabelsArray(i)
53        oRoadmapItem.ID = i
54        oControlModel.insertbyIndex(i, oRoadmapItem)
55    Next i
56End Sub
57
58Sub SetItemEnabled( ItemIndex, param)
59    oControlModel.getByIndex(ItemIndex).Enabled = param
60    oControlModel.CurrentItemID = ItemIndex
61End Sub
62
63Sub AddImagetoControlModel( Url As String)
64    oControlModel.ImageUrl = ConvertToUrl(Url)
65End Sub
66
67Function GetSelectedIndex()
68    GetSelectedIndex() = oControlModel.CurrentItemID
69End Function
70
71Function GetControlModel()
72    GetControlModel = oControlModel
73End Function
74
75Function GetDialogModel()
76    GetDialogModel = oDialogModel
77End Function
78
79Sub Callback_itemStateChanged(aEvent)
80    oModulName.ItemChange(oControlModel.CurrentItemID, aEvent.itemID)
81End Sub
82
83Sub SetComplete(param)
84    oControlModel.Complete = param
85End Sub
86
87Sub SetActivated(param)
88    oControlModel.Activated = param
89End Sub
90
91Sub RemoveItem(ItemIndex)
92    If ItemIndex &gt; -1 Then
93        oControlModel.removeByIndex(ItemIndex)
94    End If
95End Sub
96
97Sub InsertItem(ItemLabel As String)
98    oRoadmapItem = oControlModel.createInstance()
99    oRoadmapItem.Label = ItemLabel
100    oControlModel.insertbyIndex(oControlModel.CurrentItemID, oRoadmapItem)
101End Sub
102
103Sub ReplaceItem(ItemLabel As String)
104    oRoadmapItem = oControlModel.createInstance()
105    oRoadmapItem.Label = ItemLabel
106    oControlModel.replacebyIndex(oControlModel.CurrentItemID, oRoadmapItem)
107End Sub
108
109Sub Callback_disposing(aEvent)
110End Sub
111
112Sub Property_propertyChange(aEvent)
113End Sub
114
115Sub Property_disposing(aEvent)
116End Sub
117</script:module>