RoadMap.xba 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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.
  5. *
  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/.
  9. *
  10. * This file incorporates work covered by the following license notice:
  11. *
  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
  29. Sub RoadMapMain(ModulNameforItemChange, dialogtoUse)
  30. GlobalScope.BasicLibraries.LoadLibrary(&quot;Tools&quot;)
  31. oUseDialog = dialogtoUse
  32. oModulName = ModulNameforItemChange
  33. oDialogModel = oUseDialog.Model
  34. oControlModel = oUseDialog.Model.CreateInstance(&quot;com.sun.star.awt.UnoControlRoadmapModel&quot;)
  35. oDialogModel.insertByName(&quot;RoadMap&quot;, oControlModel)
  36. oControl = oUseDialog.getControl(&quot;RoadMap&quot;)
  37. oEvent = createUnoListener( &quot;CallBack_&quot;, &quot;com.sun.star.awt.XItemListener&quot; )
  38. oControl.addItemListener(oEvent)
  39. oControlModel.CurrentItemID = 0
  40. oControlModel.Complete = True
  41. oControlModel.Activated = True
  42. End Sub
  43. Sub SetVisibleRoadMap(param)
  44. oControl.SetVisible(param)
  45. End Sub
  46. Sub SetDialogModelSize(Width, Height)
  47. oDialogModel.Width = Width
  48. oDialogModel.Height = Height
  49. End Sub
  50. Sub SetControlModelPosSize(X, Y, Width, Height)
  51. oControlModel.PositionX = X
  52. oControlModel.PositionY = Y
  53. oControlModel.Width = Width
  54. oControlModel.Height = Height
  55. End Sub
  56. Sub SetControlModelText( ModelText As String)
  57. oControlModel.Text = ModelText
  58. End Sub
  59. Sub InsertItemsLabels( ItemLabelsArray() As String)
  60. For i = 0 To Ubound(ItemLabelsArray())
  61. oRoadmapItem = oControlModel.createInstance()
  62. oRoadmapItem.Label = ItemLabelsArray(i)
  63. oRoadmapItem.ID = i
  64. oControlModel.insertbyIndex(i, oRoadmapItem)
  65. Next i
  66. End Sub
  67. Sub SetItemEnabled( ItemIndex, param)
  68. oControlModel.getByIndex(ItemIndex).Enabled = param
  69. oControlModel.CurrentItemID = ItemIndex
  70. End Sub
  71. Sub AddImagetoControlModel( Url As String)
  72. oControlModel.ImageUrl = ConvertToUrl(Url)
  73. End Sub
  74. Function GetSelectedIndex()
  75. GetSelectedIndex() = oControlModel.CurrentItemID
  76. End Function
  77. Function GetControlModel()
  78. GetControlModel = oControlModel
  79. End Function
  80. Function GetDialogModel()
  81. GetDialogModel = oDialogModel
  82. End Function
  83. Sub Callback_itemStateChanged(aEvent)
  84. oModulName.ItemChange(oControlModel.CurrentItemID, aEvent.itemID)
  85. End Sub
  86. Sub SetComplete(param)
  87. oControlModel.Complete = param
  88. End Sub
  89. Sub SetActivated(param)
  90. oControlModel.Activated = param
  91. End Sub
  92. Sub RemoveItem(ItemIndex)
  93. If ItemIndex &gt; -1 Then
  94. oControlModel.removeByIndex(ItemIndex)
  95. End If
  96. End Sub
  97. Sub InsertItem(ItemLabel As String)
  98. oRoadmapItem = oControlModel.createInstance()
  99. oRoadmapItem.Label = ItemLabel
  100. oControlModel.insertbyIndex(oControlModel.CurrentItemID, oRoadmapItem)
  101. End Sub
  102. Sub ReplaceItem(ItemLabel As String)
  103. oRoadmapItem = oControlModel.createInstance()
  104. oRoadmapItem.Label = ItemLabel
  105. oControlModel.replacebyIndex(oControlModel.CurrentItemID, oRoadmapItem)
  106. End Sub
  107. Sub Callback_disposing(aEvent)
  108. End Sub
  109. Sub Property_propertyChange(aEvent)
  110. End Sub
  111. Sub Property_disposing(aEvent)
  112. End Sub
  113. </script:module>