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="DlgControl" script:language="StarBasic">Option Explicit 4 5Dim CalBitmap As Object 6Public bSelectByMouseMove as Boolean 7Public fHeightCorrFactor as Double 8Public fWidthCorrFactor as Double 9 10 11 12Sub Main() 13 Call CalAutopilotTable() 14End Sub 15 16 17Sub CalcmdDeleteSelect() 18Dim MsgBoxResult as Integer 19Dim bDoEnable as Boolean 20Dim iSel as Integer 21Dim MaxIndex as Integer 22 If Ubound(DlgCalModel.lstOwnData.SelectedItems()) > -1 Then 23 MsgBoxResult = MsgBox(cCalSubcmdDeleteSelect_DeleteSelEntry$, 4+32, cCalSubcmdDeleteSelect_DeleteSelEntryTitle$) 24 If MsgBoxResult = 6 Then 25 iSel = DlgCalModel.lstOwnData.SelectedItems(0) 26 DlgCalModel.lstOwnData.StringItemList() = RemoveSelected(DlgCalModel.lstOwnData) 27 ' Flag to store the new data 28 bCalOwnDataChanged = True 29 bDoEnable = Ubound(DlgCalModel.lstOwnData.StringItemList()) > -1 30 DlgCalModel.cmdDelete.Enabled = bDoEnable 31 If bDoEnable Then 32 MaxIndex = Ubound(DlgCalModel.lstOwnData.StringItemList()) 33 If iSel > MaxIndex Then 34 iSel = MaxIndex 35 End If 36 DlgCalendar.GetControl("lstOwnData").SelectItemPos(iSel, True) 37 CalUpdateNewEventFrame() 38 Else 39 Call CalClearInputMask() 40 End If 41 End If 42 End If 43End Sub 44 45 46Sub CalSaveOwnEventControls() 47 With DlgCalModel 48 .txtOwnEventDay.Tag = .txtOwnEventDay.Value 49 .txtOwnEventMonth.Tag = .txtOwnEventMonth.Text 50 End With 51End Sub 52 53 54Sub CalMouseMoved(aEvent as object) 55Dim ListIndex as Integer 56 Select Case sCurLangLocale 57 Case cLANGUAGE_GERMAN 58 If bSelectByMouseMove Then 59' oStatusLine.SetText("Position: " & aEvent.X & " ; " & aEvent.Y) 60 ListIndex = CalGetGermanLandAtMousePos(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor)) 61 DlgCalendar.GetControl("lstHolidays").SelectItemPos(ListIndex, True) 62 End If 63 End Select 64End Sub 65 66 67Sub SelectState(aEvent as Object) 68Dim ListIndex as Integer 69 Select Case sCurLangLocale 70 Case cLANGUAGE_GERMAN 71 If aEvent.ClickCount >= 1 Then 72 ListIndex = CalGetGermanLandAtMousePos(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor)) 73 DlgCalendar.GetControl("lstHolidays").SelectItemPos(ListIndex, True) 74 bSelectByMouseMove = False 75 End If 76 End Select 77End Sub 78 79 80Sub MouseLeavesImage 81 bSelectbyMouseMove = True 82End Sub 83 84 85Sub CalClearInputMask() 86Dim NullList() as String 87 With DlgCalModel 88 .txtEvent.Text = "" 89 .txtOwnEventDay.SetPropertyToDefault("Value") 90 .cmdInsert.Enabled = False 91 End With 92 If Ubound(DlgCalModel.lstOwnData.StringItemList()) > -1 Then 93 If Ubound(DlgCalModel.lstOwnData.SelectedItems()) = -1 Then 94 DlgCalendar.GetControl("lstOwnData").SelectItemPos(0,True) 95 CalUpdateNewEventFrame() 96 End If 97 End If 98End Sub 99 100 101Sub CalmdSwitchOwnDataOrGeneral() 102 If DlgCalModel.Step = 1 Then 103 DlgCalModel.Step = 2 104 DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_Back$ 105 DlgCalModel.cmdInsert.Enabled = DlgCalModel.txtEvent.Text <> "" 106' ToggleYearBox() 107 Else 108 dim bla as boolean 109 DlgCalModel.Step = 1 110 DlgCalendar.GetControl("lblHolidays").Visible = sCurLangLocale = cLANGUAGE_GERMAN 111 DlgCalendar.GetControl("lstHolidays").Visible = sCurLangLocale = cLANGUAGE_GERMAN 112 DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_OwnData$ 113 End If 114End Sub 115 116 117Sub ToggleInsertButton() 118 DlgCalModel.cmdInsert.Enabled = LTrim(DlgCalModel.txtEvent.Text) <> "" 119End Sub 120 121 122Sub CalUpdateNewEventFrame() 123Dim bDoEnable as Boolean 124Dim sSelectedItem 125Dim ListIndex as Integer 126Dim MaxSelIndex as Integer 127Dim CurEvMonth as Integer 128Dim CurEvDay as Integer 129Dim DateStr as String 130 bDoEnable = False 131 With DlgCalModel 132 MaxSelIndex = Ubound(DlgCalModel.lstOwnData.SelectedItems()) 133 If MaxSelIndex > -1 Then 134 ListIndex = .lstOwnData.SelectedItems(MaxSelIndex) 135 .txtEvent.Text = CalGetNameofEvent(ListIndex) 136 If GetSelectedDateUnits(CurEvDay, CurEvMonth, ListIndex) <> SBDATEUNDEFINED Then 137 .txtOwnEventDay.Value = CurEvDay 138 DlgCalendar.GetControl("lstOwnEventMonth").SelectItemPos(CurEvMonth-1, True) 139 .cmdDelete.Enabled = True 140 .cmdInsert.Enabled = True 141 Else 142 Call CalClearInputMask() 143 .cmdDelete.Enabled = True 144 End If 145 End If 146 End With 147End Sub 148</script:module>