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