xref: /AOO41X/main/wizards/source/schedule/DlgControl.xba (revision 83137a03adbb58b5b3bdafefefa1e93de35e0011)
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<!--***********************************************************
4 *
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements.  See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership.  The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License.  You may obtain a copy of the License at
12 *
13 *   http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied.  See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
21 *
22 ***********************************************************-->
23<script:module xmlns:script="http://openoffice.org/2000/script" script:name="DlgControl" script:language="StarBasic">Option Explicit
24
25Dim CalBitmap As Object
26Public bSelectByMouseMove as Boolean
27Public fHeightCorrFactor as Double
28Public fWidthCorrFactor as Double
29
30
31
32Sub Main()
33    Call CalAutopilotTable()
34End Sub
35
36
37Sub CalcmdDeleteSelect()
38Dim MsgBoxResult as Integer
39Dim bDoEnable as Boolean
40Dim iSel as Integer
41Dim MaxIndex as Integer
42    If Ubound(DlgCalModel.lstOwnData.SelectedItems()) &gt; -1 Then
43        MsgBoxResult = MsgBox(cCalSubcmdDeleteSelect_DeleteSelEntry$, 4+32, cCalSubcmdDeleteSelect_DeleteSelEntryTitle$)
44        If MsgBoxResult = 6 Then
45            iSel = DlgCalModel.lstOwnData.SelectedItems(0)
46            DlgCalModel.lstOwnData.StringItemList() = RemoveSelected(DlgCalModel.lstOwnData)
47            &apos; Flag to store the new data
48            bCalOwnDataChanged = True
49            bDoEnable = Ubound(DlgCalModel.lstOwnData.StringItemList()) &gt; -1
50            DlgCalModel.cmdDelete.Enabled = bDoEnable
51            If bDoEnable Then
52                MaxIndex = Ubound(DlgCalModel.lstOwnData.StringItemList())
53                If iSel &gt; MaxIndex Then
54                    iSel = MaxIndex
55                End If
56                DlgCalendar.GetControl(&quot;lstOwnData&quot;).SelectItemPos(iSel, True)
57                CalUpdateNewEventFrame()
58            Else
59                Call CalClearInputMask()
60            End If
61        End If
62    End If
63End Sub
64
65
66Sub CalSaveOwnEventControls()
67    With DlgCalModel
68        .txtOwnEventDay.Tag = .txtOwnEventDay.Value
69        .txtOwnEventMonth.Tag = .txtOwnEventMonth.Text
70    End With
71End Sub
72
73
74Sub CalMouseMoved(aEvent as object)
75Dim ListIndex as Integer
76    Select Case sCurLangLocale
77        Case  cLANGUAGE_GERMAN
78            If bSelectByMouseMove Then
79&apos;              oStatusLine.SetText(&quot;Position: &quot; &amp; aEvent.X &amp; &quot; ; &quot; &amp; aEvent.Y)
80                ListIndex = CalGetGermanLandAtMousePos(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor))
81                DlgCalendar.GetControl(&quot;lstHolidays&quot;).SelectItemPos(ListIndex, True)
82            End If
83    End Select
84End Sub
85
86
87Sub SelectState(aEvent as Object)
88Dim ListIndex as Integer
89    Select Case sCurLangLocale
90        Case  cLANGUAGE_GERMAN
91            If aEvent.ClickCount &gt;= 1 Then
92                ListIndex = CalGetGermanLandAtMousePos(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor))
93            DlgCalendar.GetControl(&quot;lstHolidays&quot;).SelectItemPos(ListIndex, True)
94            bSelectByMouseMove = False
95        End If
96    End Select
97End Sub
98
99
100Sub MouseLeavesImage
101    bSelectbyMouseMove = True
102End Sub
103
104
105Sub CalClearInputMask()
106Dim NullList() as String
107    With DlgCalModel
108        .txtEvent.Text = &quot;&quot;
109        .txtOwnEventDay.SetPropertyToDefault(&quot;Value&quot;)
110        .cmdInsert.Enabled = False
111    End With
112    If Ubound(DlgCalModel.lstOwnData.StringItemList()) &gt; -1 Then
113        If Ubound(DlgCalModel.lstOwnData.SelectedItems()) = -1 Then
114            DlgCalendar.GetControl(&quot;lstOwnData&quot;).SelectItemPos(0,True)
115            CalUpdateNewEventFrame()
116        End If
117    End If
118End Sub
119
120
121Sub CalmdSwitchOwnDataOrGeneral()
122    If DlgCalModel.Step = 1 Then
123        DlgCalModel.Step = 2
124        DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_Back$
125        DlgCalModel.cmdInsert.Enabled = DlgCalModel.txtEvent.Text &lt;&gt; &quot;&quot;
126&apos;      ToggleYearBox()
127    Else
128        dim bla as boolean
129        DlgCalModel.Step = 1
130        DlgCalendar.GetControl(&quot;lblHolidays&quot;).Visible = sCurLangLocale  = cLANGUAGE_GERMAN
131        DlgCalendar.GetControl(&quot;lstHolidays&quot;).Visible = sCurLangLocale  = cLANGUAGE_GERMAN
132        DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_OwnData$
133    End If
134End Sub
135
136
137Sub ToggleInsertButton()
138    DlgCalModel.cmdInsert.Enabled = LTrim(DlgCalModel.txtEvent.Text) &lt;&gt; &quot;&quot;
139End Sub
140
141
142Sub CalUpdateNewEventFrame()
143Dim bDoEnable as Boolean
144Dim sSelectedItem
145Dim ListIndex as Integer
146Dim MaxSelIndex as Integer
147Dim CurEvMonth as Integer
148Dim CurEvDay as Integer
149Dim DateStr as String
150    bDoEnable = False
151    With DlgCalModel
152        MaxSelIndex = Ubound(DlgCalModel.lstOwnData.SelectedItems())
153        If MaxSelIndex &gt; -1 Then
154            ListIndex = .lstOwnData.SelectedItems(MaxSelIndex)
155            .txtEvent.Text = CalGetNameofEvent(ListIndex)
156            If GetSelectedDateUnits(CurEvDay, CurEvMonth, ListIndex) &lt;&gt; SBDATEUNDEFINED Then
157                .txtOwnEventDay.Value = CurEvDay
158                DlgCalendar.GetControl(&quot;lstOwnEventMonth&quot;).SelectItemPos(CurEvMonth-1, True)
159                .cmdDelete.Enabled = True
160                .cmdInsert.Enabled = True
161            Else
162                Call CalClearInputMask()
163                .cmdDelete.Enabled = True
164            End If
165        End If
166    End With
167End Sub
168</script:module>
169