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