summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/schedule/BankHoliday.xba58
-rw-r--r--wizards/source/schedule/CalendarMain.xba116
-rw-r--r--wizards/source/schedule/CreateTable.xba8
-rw-r--r--wizards/source/schedule/DlgControl.xba358
-rw-r--r--wizards/source/schedule/Language.xba169
-rw-r--r--wizards/source/schedule/OwnEvents.xba434
6 files changed, 461 insertions, 682 deletions
diff --git a/wizards/source/schedule/BankHoliday.xba b/wizards/source/schedule/BankHoliday.xba
index efaf77180516..70417ee507fd 100644
--- a/wizards/source/schedule/BankHoliday.xba
+++ b/wizards/source/schedule/BankHoliday.xba
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="BankHoliday" script:language="StarBasic">Option Explicit
Sub Main()
@@ -32,11 +32,11 @@ End Function
Sub CalInitGlobalVariablesDate()
- Dim Count%
+Dim i as Integer
- For Count% = 1 To 374
- CalBankholidayName$(Count%) = &quot;&quot;
- CalTypeOfBankHoliday%(Count%) = cHolidayType_None
+ For i = 1 To 374
+ CalBankholidayName$(i) = &quot;&quot;
+ CalTypeOfBankHoliday%(i) = cHolidayType_None
Next
End Sub
@@ -93,21 +93,21 @@ End Function
Function CalGetIntOfShortMonthName%(byval MonthName$)
-
- Dim nCount%, nMonth%
+Dim i as Integer
+Dim nMonth as Integer
- nMonth% = Val(MonthName$)
+ nMonth = Val(MonthName$)
- If (1 &lt;= nMonth% And 12 &gt;= nMonth%) Then
- CalGetIntOfShortMonthName% = nMonth%
+ If (1 &lt;= nMonth And 12 &gt;= nMonth) Then
+ CalGetIntOfShortMonthName% = nMonth
Exit Function
End If
MonthName$ = UCase(Trim(Left(MonthName, 3)))
- For nCount% = 1 To 12
- If (UCase(cCalShortMonthNames$(nCount%)) = MonthName$) Then
- CalGetIntOfShortMonthName% = nCount%
+ For i = 1 To 12
+ If (UCase(cCalShortMonthNames$(i)) = MonthName$) Then
+ CalGetIntOfShortMonthName% = i
Exit Function
End If
Next
@@ -120,15 +120,20 @@ End Function
Sub CalInsertOwnDataInTables(byval YearToInsert%)
&apos; Fügt die eigenen Individuellen Daten aus der Tabelle in die
&apos; bereits erstellte unsortierte Tabelle ein.
- Dim i%, actYear%, actMonth%, actDay%, theEvent$
-
- For i = 0 To lbOwnData.ListCount() - 1
- actYear% = Val(Mid$(lbOwnData.List(i%), 10, 4))
- If (actYear%=YearToInsert%) Or (actYear%=0) Then
- actMonth% = CalGetIntOfShortMonthname%(Mid$(lbOwnData.List(i%), 5, 3))
- actDay% = Val(Left$(lbOwnData.List(i%), 2))
- theEvent$ = Trim(Mid$(lbOwnData.List(i%), 16))
- CalInsertBankholiday(DateSerial(actYear%, actMonth%, actDay%), theEvent$, cHolidayType_Own)
+Dim CurEventName as String
+Dim CurYear as Integer
+Dim CurMonth as Integer
+Dim CurDay as Integer
+Dim LastIndex as Integer
+Dim i as Integer
+ LastIndex = Ubound(DlgCalModel.lstOwnData.StringItemList())
+ For i = 0 To LastIndex
+ CurYear = CalGetYearOfEvent(i)
+ If (CurYear = YearToInsert) Or (CurYear = 0) Then
+ CurMonth = CalGetMonthofEvent(i)
+ CurDay = CalGetDayofEvent(i)
+ CurEventName = CalGetNameOfEvent(i)
+ CalInsertBankholiday(DateSerial(CurYear, CurMonth, CurDay), CurEventName, cHolidayType_Own)
End If
Next
End Sub
@@ -138,14 +143,15 @@ End Sub
&apos; Note: in This Function the week starts with the Sunday
Function GetMonthDate(iWeekDay, iMonth, iCount as Integer)
Dim bFound as Boolean
-Dim nCount%,lDate as Integer
+Dim i as Integer
+Dim lDate as Integer
&apos; 1st Tue in Nov : Election Day, Half
bFound = False
- nCount% = 0
+ i = 0
lDate = DateSerial(YearInt%, iMonth, 1)
While Not bFound
- If (iWeekDay = WeekDay(lDate)) Then nCount% = nCount% + 1
- If (nCount &lt; iCount) Then
+ If (iWeekDay = WeekDay(lDate)) Then i = i + 1
+ If (i &lt; iCount) Then
lDate = lDate + 1
Else
bFound = True
diff --git a/wizards/source/schedule/CalendarMain.xba b/wizards/source/schedule/CalendarMain.xba
index fa0ab32b65e8..1e03bd877fe8 100644
--- a/wizards/source/schedule/CalendarMain.xba
+++ b/wizards/source/schedule/CalendarMain.xba
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="CalendarMain" script:language="StarBasic">Option Explicit
Const _DEBUG = 0
@@ -8,7 +8,7 @@ Const _DEBUG = 0
Public sCurLangLocale as String
&apos; Dieses Flag dient zur Abfrage ob die individuellen Daten abgespeichert werden sollen.
-Public CalOwnDataChanged%
+Public bCalOwnDataChanged as Boolean
&apos;BankHolidayFunctions
Public CalBankholidayName$ (1 To 374)
@@ -24,8 +24,8 @@ Public CalTWIPSPicHeight%, CalTWIPSPicWidth%, CalStartX%, CalStartY%
Public CalPicWidth%, CalPicHeight%
-Public cCalSubCmdDeleteSelect_DeleteSelEntry$
-Public cCalSubCmdDeleteSelect_DeleteSelEntryTitle$
+Public cCalSubcmdDeleteSelect_DeleteSelEntry$
+Public cCalSubcmdDeleteSelect_DeleteSelEntryTitle$
Public cCalSubcmdSwitchOwnDataOrGeneral_Back$
Public cCalSubcmdSwitchOwnDataOrGeneral_OwnData$
@@ -45,7 +45,6 @@ Public LastMousePosX, LastMousePosY As Single
Public oDocument as Object
Public oSheets as Object
Public oSheet as Object
-Public DlgBuffer as Object
Public oStatusLine as Object
&apos; BL* bedeutet BundesLand*
@@ -66,44 +65,49 @@ Public CONST CalBLSachsenAnhalt = 14
Public CONST CalBLSchlHolstein = 15
Public CONST CalBLThueringen = 16
+Public DlgCalendar as Object
+Public DlgCalModel as Object
Sub CalAutopilotTable()
+Dim BitmapDir as String
&apos; On Error Goto ErrorHandler
- BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
&apos; HauptRoutine zur Erstellung des Kalenders
- Set DlgBuffer = DlgCalendar
+ oDocument = StarDesktop.ActiveFrame.Controller.Model
+ oStatusline = oDocument.GetCurrentController.GetFrame.CreateStatusIndicator
- DlgBuffer.Load()
- sCurLangLocale = StarDesktop.ISOLocale.Language
+ sCurLangLocale = oDocument.CharLocale.Language
+ DlgCalendar = LoadDialog(&quot;Schedule&quot;, &quot;Dialog1&quot;)
+ DlgCalModel = DlgCalendar.Model
LoadLanguage(sCurLangLocale)
&apos; Da modulübergreifende Variablen unsicher sind,
&apos; wird ihre Initialisierung noch einmal explizit
&apos; angegeben.
CalInitGlobalVariablesDate()
- CalCalcPictureData()
- CalChoosenLand% = -2
+ BitmapDir = GetOfficeSubPath(&quot;Template&quot;,&quot;wizard/bitmap&quot;)
+ DlgCalModel.imgCountry.ImageURL = BitmapDir &amp; sBitmapFilename
+ CalChoosenLand = -2
MouseClicked% = False
&apos; Die Daten für die eigenen Ereignisdaten werden geladen.
CalLoadOwnData()
- DlgBuffer.lbOwnData.FontName = &quot;Courier&quot;
- DlgBuffer.cmdDelete.Enabled = False
- DlgBuffer.txtMonth.Text = cCalShortMonthNames$(Month(Now()))
- DlgBuffer.txtMonth.Tag = DlgBuffer.txtMonth.Text
- DlgBuffer.OptYear.SetFocus()
- DlgBuffer.OptYear.Value = True
+ DlgCalendar.GetControl(&quot;lstMonth&quot;).SelectItem(cCalShortMonthNames$(Month(Now())), True)
+
+ With DlgCalModel
+&apos; .lbOwnData.FontName = &quot;Courier&quot;
+ .cmdDelete.Enabled = False
+&apos; .lstMonth.Tag = DlgCalModel.txtMonth.Text
+ .lstMonth.StringItemList() = cCalShortMonthNames$()
+ .lstOwnEventMonth.StringItemList() = cCalShortMonthNames$()
+ .optYear.State = 1
+ .txtYear.Text = Year(Now())
+ .txtYear.Tag = DlgCalModel.txtYear.Text
+ .Step = 1
+ End With
CalChooseCalendar() &apos; month
-
- &apos; Jahr und Monat werden ermittelt
- DlgBuffer.txtYear.Text = Year(Now())
- DlgBuffer.txtYear.Tag = DlgBuffer.txtYear.Text
-
- DlgBuffer.cmbState.ListIndex = 0
-
- DlgBuffer.CurrentStep = 1
-
- DlgBuffer.Show()
+ DlgCalendar.GetControl(&quot;lstHolidays&quot;).SelectItemPos(0,True)
+ DlgCalendar.Visible = True
Exit Sub
ErrorHandler:
@@ -112,44 +116,38 @@ End Sub
Sub CalChooseCalendar()
- DlgBuffer.lblYear.Enabled = True
- DlgBuffer.txtYear.Enabled = True
- DlgBuffer.spinButton1.Enabled = True
- DlgBuffer.cmbState.Enabled = True
-
- DlgBuffer.txtMonth.Enabled = DlgBuffer.optMonth.Value
- DlgBuffer.lblMonth.Enabled = DlgBuffer.optMonth.Value
- DlgBuffer.spinButton3.Enabled = DlgBuffer.optMonth.Value
+ With DlgCalModel
+ .lstMonth.Enabled = .optMonth.State = 1
+ .lblMonth.Enabled = .optMonth.State = 1
+ End With
End Sub
-Sub CalCmdCancel()
- If CalOwnDataChanged% Then
+Sub CalcmdCancel()
+ If bCalOwnDataChanged Then
Call CalSaveOwnData()
End If
- DlgBuffer.Unload()
+ DlgCalendar.Visible = False
End Sub
-Sub CalCmdOk()
+Sub CalcmdOk()
&apos; cmdOk is called when the Button &apos;Read&apos; is clicked on
&apos; It is either given out a month or a year
- Dim i, iSelYear as Integer
- Dim SelYear as String
- DlgBuffer.Hide()
+Dim i, iSelYear as Integer
+Dim SelYear as String
+ DlgCalendar.Visible = False
If cLANGUAGE_GERMAN = sCurLangLocale Then
- If MouseClicked% Then
- CalChoosenLand%=LandWhenClick%
+ If Ubound(DlgCalModel.lstHolidays.SelectedItems()) &gt; -1 Then
+ CalChoosenLand = DlgCalModel.lstHolidays.SelectedItems(0)
Else
- CalChoosenLand% = 0
+ CalChoosenLand = 0
End If
End If
-
- oDocument = StarDesktop.ActiveFrame.Controller.Model
oSheets = oDocument.sheets
- If CalOwnDataChanged% Then
+ If bCalOwnDataChanged Then
Call CalSaveOwnData()
End If
@@ -159,10 +157,10 @@ Sub CalCmdOk()
Next
oSheets.RemovebyName(oSheets.GetbyIndex(0).Name)
- iSelYear = Val(txtYear.Text)
+ iSelYear = Val(DlgCalModel.txtYear.Text)
Select Case sCurLangLocale
Case cLANGUAGE_GERMAN
- Call CalFindWholeYearHolidays_GERMANY(iSelYear, CalChoosenLand%)
+ Call CalFindWholeYearHolidays_GERMANY(iSelYear, CalChoosenLand)
Case cLANGUAGE_ENGLISH
Call FindWholeYearHolidays_US(iSelYear)
Case cLANGUAGE_FRENCH
@@ -187,26 +185,26 @@ Sub CalCmdOk()
Call CalInsertOwnDataInTables(iSelYear)
- oStatusline = oDocument.GetCurrentController.GetFrame.GetStatusIndicator
-
- If optYear.Value Then
+ If DlgCalModel.optYear.State = 1 Then
oSheets.RemovebyName(oSheets.GetbyIndex(0).Name)
oSheet = oSheets.GetbyIndex(0)
- oSheet.Name = sCalendarTitle$ + &quot; &quot; + txtYear.Text
+ oSheet.Name = sCalendarTitle$ + &quot; &quot; + iSelYear
oDocument.AddActionLock
Call CalCreateYearTable(iSelYear)
- ElseIf optMonth.Value Then
+ ElseIf DlgCalModel.optMonth.State = 1 Then
+ Dim iMonth
+ iMonth = DlgCalModel.lstMonth.SelectedItem(0)
oSheets.RemovebyName(oSheets.GetbyIndex(1).Name)
oSheet = oSheets.GetbyIndex(0)
- oSheet.Name = sMonthTitle$ + &quot; &quot; + cCalLongMonthNames$(CalGetIntOfShortMonthName%(txtMonth.Text))
+ oSheet.Name = sMonthTitle$ + &quot; &quot; + cCalLongMonthNames$(iMonth)
oDocument.AddActionLock
- Call CalCreateMonthTable(iSelYear, CalGetIntOfShortMonthName%(txtMonth.Text))
+ Call CalCreateMonthTable(iSelYear, iMonth)
End If
oDocument.RemoveActionLock
&apos; Protect the remaining sheet
oSheet.protect(&quot;&quot;)
oStatusLine.End
- DlgBuffer.Unload()
+ DlgCalendar.Visible = False
End Sub
-</script:module>
+</script:module> \ No newline at end of file
diff --git a/wizards/source/schedule/CreateTable.xba b/wizards/source/schedule/CreateTable.xba
index 5ef472639989..ef9ffc68c43e 100644
--- a/wizards/source/schedule/CreateTable.xba
+++ b/wizards/source/schedule/CreateTable.xba
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="CreateTable" script:language="StarBasic">Option Explicit
Public Const FirstDayRow = 5 &apos; Row on month sheet for first day of month
@@ -27,11 +27,11 @@ Dim sBlankStyle as String
On Error Goto ErrorHandling
oStatusLine.Start(GetResText(sProgress),140)
- iDate = DateSerial(Val(DlgBuffer.txtYear.Text),1,1)
+ iDate = DateSerial(Val(DlgCalModel.txtYear.Text),1,1)
&apos; Insert year
oYearCell = oSheet.GetCellRangeByName(&quot;Year&quot;)
- oYearCell.Value = Val(DlgBuffer.txtYear.Text)
+ oYearCell.Value = Val(DlgCalModel.txtYear.Text)
&apos; Insert holidays
CalMonth% = 1
CalDay% = 0
@@ -83,7 +83,7 @@ On Error Goto ErrorHandling
TargetMonth% = CalGetIntOfShortMonthName%(txtMonth.Text)
oMonthCell = oSheet.GetCellRangeByName(&quot;Month&quot;)
- iDate = DateSerial(Val(DlgBuffer.txtYear.Text),TargetMonth%,1)
+ iDate = DateSerial(Val(DlgCalModel.txtYear.Text),TargetMonth%,1)
oMonthCell.Value = iDate
&apos; Inserting holidays
StartDay% = (TargetMonth% - 1) * 31 + 1
diff --git a/wizards/source/schedule/DlgControl.xba b/wizards/source/schedule/DlgControl.xba
index 659f8c02fd2c..deee7546ae4f 100644
--- a/wizards/source/schedule/DlgControl.xba
+++ b/wizards/source/schedule/DlgControl.xba
@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
-
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="DlgControl" script:language="StarBasic">Option Explicit
Dim CalBitmap As Object
+Public bDoSelect as Boolean
+&apos; Todo: Adjustmentlistener an der Scrollbar anmelden
Sub Main()
Call CalAutopilotTable()
@@ -40,110 +42,27 @@ End Sub
-Sub CalCalcPictureData()
- Dim bFittingX%, bFittingY%, DlgWidth%, DlgHeight%, nXMove%, nYMove%, Width%, Height%
- Dim x#, y#
-
- Width% = 152
- Height% = 189
- BitmapDir = GetBitmapDir()
-
- Set CalBitmap = LoadPicture(BitmapDir &amp; GetPathSeparator() &amp; sBitmapFilename$ &apos;(sCurLangLocale))
- If 1 = GetGUIType() Then
- DlgHeight% = CInt(DlgBuffer.Preview1.Height * GetDialogZoomFactorY(DlgBuffer.Preview1.Height))
- DlgWidth% = CInt(DlgBuffer.Preview1.Width * GetDialogZoomFactorX(DlgBuffer.Preview1.Width))
- nXMove% = TwipsPerPixelX() * 3
- nYMove% = TwipsPerPixelX() * 3
- Else
- DlgHeight% = CInt((DlgBuffer.Preview1.Height - TwipsPerPixelY() * 3) * GetDialogZoomFactorY(DlgBuffer.Preview1.Height))
- DlgWidth% = CInt((DlgBuffer.Preview1.Width - TwipsPerPixelX() * 3) * GetDialogZoomFactorX(DlgBuffer.Preview1.Width))
- nXMove% = 0
- nYMove% = 0
- End If
-
- CalTWIPSPicWidth% = TwipsPerPixelX() * Width%
- CalTWIPSPicHeight% = TwipsPerPixelY() * Height%
-
- &apos; Beste Möglichkeit: Bild in Orignalgroesse zentrieren
- &apos; Alternative : Nach schlchechter passenden Faktor skalieren
- If (Not ((CalTWIPSPicWidth% &lt;= DlgWidth%) And (CalTWIPSPicHeight% &lt;= DlgHeight%))) Then
- x# = (CalTWIPSPicWidth% / DlgWidth%)
- y# = (CalTWIPSPicHeight% / DlgHeight%)
- If (x# &gt; y#) Then
- CalTWIPSPicWidth% = CInt(DlgWidth%)
- CalTWIPSPicHeight% = CInt(CalTWIPSPicHeight% / x#)
- Else
- CalTWIPSPicHeight% = CInt(DlgHeight%)
- CalTWIPSPicWidth% = CInt(CalTWIPSPicWidth% / y#)
- End If
- End If
-
- CalStartX% = CInt((DlgWidth% / 2) - (CalTWIPSPicWidth% / 2)) - nXMove%
- CalStartY% = CInt((DlgHeight% / 2) - (CalTWIPSPicHeight% / 2)) - nYMove%
-End Sub
-
-
-
-Sub CalPreviewPaint()
- Preview1.Cls()
- Preview1.DrawPicture(CalBitmap, CalStartX%, CalStartY%, CalStartX% + CalTWIPSPicWidth%, CalStartY% + CalTWIPSPicHeight%)
- Preview1.DrawBox(CalStartX%, CalStartY%, CalStartX% + CalTWIPSPicWidth%, CalStartY% + CalTWIPSPicHeight%)
-End Sub
-
-
-
Sub CalcmdDeleteSelect()
-
- Dim Count%, CountMarked%, MsgBoxResult%, AllSelected%
-
- AllSelected = False
- CountMarked% = 0
- For Count% = 0 To lbOwnData.ListCount-1
- If (DlgBuffer.lbOwnData.Selected(Count%) = True) Then CountMarked% = CountMarked% + 1
- Next
-
- If (CountMarked% &gt; 0) Then
- MsgBoxResult% = MsgBox(cCalSubCmdDeleteSelect_DeleteSelEntry$, 4+32, cCalSubCmdDeleteSelect_DeleteSelEntryTitle$)
-
- If MsgBoxResult% = 6 Then
- If Not AllSelected% Then
- Call CalDeleteAllSelected()
- Else
- DlgBuffer.lbOwnData.Clear()
- End If
- &apos; Flag zum Speichern der neuen Daten.
- CalOwnDataChanged% = True
-
- cmdDelete.Enabled = False
+Dim MsgBoxResult as Integer
+ If Ubound(DlgCalModel.lstOwnData.SelectedItems()) &gt; -1 Then
+ MsgBoxResult = MsgBox(cCalSubcmdDeleteSelect_DeleteSelEntry$, 4+32, cCalSubcmdDeleteSelect_DeleteSelEntryTitle$)
+ If MsgBoxResult = 6 Then
+ DlgCalModel.lstOwnData.StringItemList() = RemoveSelected(DlgCalModel.lstOwnData)
+ &apos; Flag zum Speichern der neuen Daten.
+ bCalOwnDataChanged = True
+ DlgCalModel.cmdDelete.Enabled = Ubound(DlgCalModel.lstOwnData.StringItemList()) &gt; -1
Call CalClearInputMask()
End If
End If
End Sub
-
-Sub CalDeleteAllSelected()
-
- Dim Count%, LastSelPos%
-
- While LastSelPos% &lt;&gt; -1
- LastSelPos% = -1
- For Count%=0 To lbOwnData.ListCount()-1
- If DlgBuffer.lbOwnData.Selected(Count%) Then LastSelPos% = Count%
- Next
- If LastSelPos% &lt;&gt; - 1 Then
- DlgBuffer.lbOwnData.RemoveItem(LastSelPos%)
- End If
- Wend
- DlgBuffer.lbOwnData.Refresh()
-End Sub
-
-
-
Sub CalSaveOwnEventControls()
- DlgBuffer.txtOwnEventDay.Tag = DlgBuffer.txtOwnEventDay.Text
- DlgBuffer.txtOwnEventMonth.Tag = DlgBuffer.txtOwnEventMonth.Text
- DlgBuffer.txtOwnEventYear.Tag = DlgBuffer.txtOwnEventYear.Text
+ With DlgCalModel
+ .txtOwnEventDay.Tag = .txtOwnEventDay.Text
+ .txtOwnEventMonth.Tag = .txtOwnEventMonth.Text
+ .DlgCalModel.txtOwnEventYear.Tag = .DlgCalModel.txtOwnEventYear.Text
+ End With
End Sub
@@ -174,105 +93,47 @@ Sub ModIntTextBox (txtYear As Object, ByVal nMax%, ByVal nMin%, ByVal sDefault$,
End Sub
-Sub CalSpinOwnEventDayUp()
- Call ModIntTextBox(txtOwnEventDay, 31, 1, &quot;1&quot;, 1)
-End Sub
-
-
-Sub CalSpinOwnEventDayDown()
- Call ModIntTextBox(txtOwnEventDay, 31, 1, &quot;1&quot;, -1)
-End Sub
-
-
-Sub CalSpinGeneralYearUp()
- Call ModIntTextBox(txtYear, 9956, 1583, Trim(Str(Year(Now()))),1)
-End Sub
-
-
-Sub CalSpinGeneralYearDown()
- Call ModIntTextBox(txtYear, 9956, 1583, Trim(Str(Year(Now()))), -1 )
-End Sub
-
-
-Sub CalSpinOwnEventYearDown()
- Call ModIntTextBox(txtOwnEventYear, 9956, 1583, Trim(Str(Year(Now()))), -1 )
-End Sub
-
-
-Sub CalSpinOwnEventYearUp()
- Call ModIntTextBox(txtOwnEventYear, 9956, 1583, Trim(Str(Year(Now()))) , 1)
-End Sub
-
-Sub CalModMonthTextBox(txtMonth As Object,IncFactor as Integer)
- Dim nActVal&amp;
- nActVal&amp; = Val(txtMonth.Text)
- If (1 &lt;= nActVal&amp; And 12 &gt;= nActVal) Then
- txtMonth.Text = cCalShortMonthNames$(nActVal&amp;)
- End If
- nActVal&amp; = CalGetIntOfShortMonthName%(txtMonth.Text)
- If 0 = nActVal&amp; Then
- Beep
- txtMonth.Text = cCalShortMonthNames$(1)
- ElseIf (1 &lt; nActVal&amp;) AND (IncFactor = -1) Then
- txtMonth.Text = cCalShortMonthNames$(nActVal&amp; + IncFactor)
- ElseIf (12 &gt; nActVal&amp;)AND (IncFactor = 1) Then
- txtMonth.Text = cCalShortMonthNames$(nActVal&amp; + IncFactor)
- End If
-End Sub
-
-
-Sub CalSpinGeneralMonthUp()
- CalModMonthTextBox(txtMonth, 1)
-End Sub
-
-
-Sub CalSpinGeneralMonthDown()
- CalModMonthTextBox(txtMonth,-1)
-End Sub
-
-
-Sub CalSpinOwnEventMonthDown()
- Call CalModMonthTextBox(txtOwnEventMonth, -1)
-End Sub
-
-
-Sub CalSpinOwnEventMonthUp()
- Call CalModMonthTextBox(txtOwnEventMonth, 1)
-End Sub
-
-
-Sub CalChkYearEnDisabled()
- &apos; Falls der RadioButton für einen Jahreskalender angeklickt
- &apos; worden ist, müssen die Controls für den Monat Disabled
- &apos; werden, da ihre Werte in einer Jahrestabelle aufgehen.
- lblEventYear.Enabled = Not lblEventYear.Enabled
- txtownEventYear.Enabled = Not txtownEventYear.Enabled
- SpinOwnEventYear.Enabled = Not SpinOwnEventYear.Enabled
- If (txtOwnEventYear.Text = &quot;&quot;) And (lblEventYear.Enabled = True) Then
- txtOwnEventYear.Text = Trim$(Str$(Year(Now())))
- End If
+Sub ToggleYearBox()
+&apos; Falls der RadioButton für einen Jahreskalender angeklickt
+&apos; worden ist, müssen die Controls für den Monat Disabled
+&apos; werden, da ihre Werte in einer Jahrestabelle aufgehen.
+ With DlgCalModel
+ .txtOwnEventYear.Enabled = .chkEventOnce.State = 1
+ .lblEventYear.Enabled = .chkEventOnce.State = 1
+ If .txtOwnEventYear.Text = &quot;&quot; And .lblEventYear.Enabled Then
+ .txtOwnEventYear.Text = Trim$(Str$(Year(Now())))
+ End If
+ End With
End Sub
-Sub CalMouseMoved(Button as integer, Shift as integer, X as single, Y as single)
-
+Sub CalMouseMoved(aEvent as object)
+Dim ListIndex as Integer
+ oStatusline.SetText(aEvent.ClickCount)
+&apos; If aEvent.ClickCount = 2 Then
+&apos; oStatusLine.SetText(&quot;Click&quot;)
+&apos; bDoSelect = False
+&apos; Else
+&apos; oStatusLine.SetText(&quot;&quot;)
+&apos; End If
&apos; Nimmt Mousemoves ueber dem Bitmap entgegen, und wertet sie je nach
&apos; Land aus.
-
Select Case sCurLangLocale
- Case &quot;de&quot; &apos;cLANGUAGE_GERMAN
- &apos; Ermittelt das Land auf dem sich der MausCursor befindet, und
- &apos; aktualisiert die Textbox mit der Bundeslandbezeichnung, falls
- &apos; ein Mausklick stattfandt.
- Dim Land$
- If (Button = 1) Or (MouseClicked% = False)Then
- cmbState.ListIndex = CalGetGermanLandAtMousePos(X, Y, Land$)
- End If
+ Case cLANGUAGE_GERMAN
+ &apos; Ermittelt das Land auf dem sich der MausCursor befindet, und aktualisiert
+ &apos; die Textbox mit der Bundeslandbezeichnung, falls ein Mausklick stattfandt.
+&apos; If bDoSelect Then
+ ListIndex = CalGetGermanLandAtMousePos(aEvent.X, aEvent.Y, Land$)
+ DlgCalendar.GetControl(&quot;lstHolidays&quot;).SelectItemPos(ListIndex, True)
+ If aEvent.ClickCount = 2 Then
+ bDoSelect = False
+ End If
+&apos; End If
End Select
- LastMousePosX = X
- LastMousePosY = Y
+ LastMousePosX = aEvent.X
+ LastMousePosY = aEvent.Y
End Sub
@@ -281,19 +142,19 @@ Sub CalChangeGeneralMonth()
Dim MonthToCheck$
Dim ValMonthToCheck%
- MonthToCheck$ = DlgBuffer.txtMonth.Text
+ MonthToCheck$ = DlgCalModel.txtMonth.Text
ValMonthToCheck% = Val(MonthToCheck$)
If (ValMonthToCheck% &gt;= 1) And (ValMonthToCheck% &lt;=12) Then
- DlgBuffer.txtMonth.Text = cCalShortMonthNames$(ValMonthToCheck%)
+ DlgCalModel.txtMonth.Text = cCalShortMonthNames$(ValMonthToCheck%)
Exit Sub
End If
If CalGetIntOfShortMonthName%(Trim(Left(MonthToCheck$, 3))) = 0 Then
Beep
- DlgBuffer.txtMonth.Text = DlgBuffer.txtMonth.Tag
+ DlgCalModel.txtMonth.Text = DlgCalModel.txtMonth.Tag
Else
- DlgBuffer.txtMonth.Text = Trim(Left(MonthToCheck, 3))
+ DlgCalModel.txtMonth.Text = Trim(Left(MonthToCheck, 3))
End If
End Sub
@@ -301,69 +162,94 @@ End Sub
Sub CalChkForChangeInsertAccept
- &apos; Aktualisiert die Caption des Insert/Accept Buttons
- If (DataSelectedFromList=True) And (ButtonCaptionIsInsert) Then
- DlgBuffer.cmdInsert.Caption = cSubChkForChangeInsertAccept_Accpet$
+ &apos; Aktualisiert die Label des Insert/Accept Buttons
+ If (DataSelectedFromList=True) And (ButtonLabelIsInsert) Then
+ DlgCalModel.cmdInsert.Label = cSubChkForChangeInsertAccept_Accpet$
End If
End Sub
Sub CalClearInputMask()
- &apos; Löscht die Werte der Eingabe Controls für ein
- &apos; neues Ereignis.
- chkEventOnce.Value = False
- lblEventYear.Enabled = False
- txtownEventYear.Enabled = False
- SpinOwnEventYear.Enabled = False
- txtOwnEventYear.Text = &quot;&quot;
- txtEvent.Text = &quot;&quot;
- txtOwnEventDay.Text = &quot;&quot;
- txtOwnEventMonth.Text = &quot;&quot;
-
- txtEvent.SetFocus()
+Dim NullList() as String
+&apos; Löscht die Werte der Eingabe Controls für ein neues Ereignis.
+ With DlgCalModel
+ .chkEventOnce.State = 0
+ .lblEventYear.Enabled = False
+ .txtOwnEventYear.Enabled = False
+&apos; SpinOwnEventYear.Enabled = False
+ .txtOwnEventYear.Text = &quot;&quot;
+ .txtEvent.Text = &quot;&quot;
+ .txtOwnEventDay.Text = &quot;&quot;
+&apos; Todo: Wie kriegt man den Focus auf dieses verdammte Control?
+&apos; .txtEvent.DefaultButton = True
+ End With
+ DlgCalModel.lstOwnEventMonth.SelectedItems() = Nulllist()
End Sub
-
-Function CalCountSelected%(ByVal listBox as Object, PosSelect%)
- &apos; Zählt die selekierten Einträge im Control listBox.
- &apos; PosSelect liefert den Index des selektierten Eintrags
- &apos; zurück. Dieser Wert ist natürlich nur zu gebrachen,
- &apos; wenn nur ein Eintrag selektiert ist.
- Dim Count%, Result%
-
- Result% = 0
- For Count% = 0 To listBox.ListCount-1
- If ListBox.Selected(Count%) Then
- Result% = Result% + 1
- PosSelect% = Count%
- End If
- Next
- CalCountSelected% = Result%
-End Function
-
-
-
Sub CalmdSwitchOwnDataOrGeneral()
-
&apos;Ändert den Titel der Dialogbox beim Seitenwechsel und die
&apos;Beschriftungen der Knöpfe
- If DlgBuffer.CurrentStep = 1 Then
- DlgBuffer.CurrentStep = 2
- DlgBuffer.DlgCmdOwnData.Caption = cCalSubcmdSwitchOwnDataOrGeneral_Back$
+ If DlgCalModel.Step = 1 Then
+ DlgCalModel.Step = 2
+ DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_Back$
+ DlgCalModel.cmdInsert.Enabled = DlgCalModel.txtEvent.Text &lt;&gt; &quot;&quot;
+ ToggleYearBox()
Else
- DlgBuffer.CurrentStep = 1
- DlgBuffer.DlgCmdOwnData.Caption = cCalSubcmdSwitchOwnDataOrGeneral_OwnData$
+ DlgCalModel.Step = 1
+ DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_OwnData$
End If
End Sub
-Sub LoadDialog()
- DlgBuffer.load
+Sub ToggleInsertButton()
+ DlgCalModel.cmdInsert.Enabled = LTrim(DlgCalModel.txtEvent.Text) &lt;&gt; &quot;&quot;
End Sub
-Sub ShowDialog()
- DlgBuffer.Show
+
+Sub CalModMonthTextBox(txtMonth As Object,IncFactor as Integer)
+ Dim nActVal&amp;
+ nActVal&amp; = Val(txtMonth.Text)
+ If (1 &lt;= nActVal&amp; And 12 &gt;= nActVal) Then
+ txtMonth.Text = cCalShortMonthNames$(nActVal&amp;)
+ End If
+ nActVal&amp; = CalGetIntOfShortMonthName%(txtMonth.Text)
+ If 0 = nActVal&amp; Then
+ Beep
+ txtMonth.Text = cCalShortMonthNames$(1)
+ ElseIf (1 &lt; nActVal&amp;) AND (IncFactor = -1) Then
+ txtMonth.Text = cCalShortMonthNames$(nActVal&amp; + IncFactor)
+ ElseIf (12 &gt; nActVal&amp;)AND (IncFactor = 1) Then
+ txtMonth.Text = cCalShortMonthNames$(nActVal&amp; + IncFactor)
+ End If
End Sub
+
+
+Sub CalUpdateNewEventFrame()
+Dim bDoEnable as Boolean
+Dim sSelectedItem
+Dim ListIndex as Integer
+Dim MaxSelIndex as Integer
+ bDoEnable = False
+ With DlgCalModel
+ MaxSelIndex = Ubound(DlgCalModel.lstOwnData.SelectedItems())
+ If MaxSelIndex &gt; -1 Then
+ ListIndex = .lstOwnData.SelectedItems(MaxSelIndex)
+ .txtEvent.Text = CalGetNameofEvent(ListIndex)
+ .txtOwnEventDay.Text = CalGetDayOfEvent(ListIndex)
+ DlgCalendar.GetControl(&quot;lstOwnEventMonth&quot;).SelectItem(CalGetMonthOfEvent(ListIndex), True)
+ .txtOwnEventYear.Text = CalGetYearofEvent(ListIndex)
+ bDoEnable = DlgCalModel.txtOwnEventYear.Text = &quot;&quot;
+ .chkEventOnce.State = Abs(bDoEnable)
+ .lblEventYear.Enabled = bDoEnable
+ .txtOwnEventYear.Enabled = bDoEnable
+ .cmdDelete.Enabled = True
+ Else
+ Call CalClearInputMask()
+ .cmdDelete.Enabled = False
+ End If
+ End With
+End Sub
+
</script:module> \ No newline at end of file
diff --git a/wizards/source/schedule/Language.xba b/wizards/source/schedule/Language.xba
index 2289db2c17a0..d502fdcf5c7f 100644
--- a/wizards/source/schedule/Language.xba
+++ b/wizards/source/schedule/Language.xba
@@ -1,10 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Language" script:language="StarBasic">Option Explicit
-&apos; L a n g u a g e c o n s t a n t s
-&apos; -----------------------------------
Public Const cLANGUAGE_SYSTEM = &quot;&quot;, cLANGUAGE_CHINESE = &quot;zh&quot;, cLANGUAGE_DANISH = &quot;da&quot;
Public Const cLANGUAGE_DUTCH = &quot;nl&quot;, cLANGUAGE_ENGLISH = &quot;en&quot;, cLANGUAGE_FINNISH = &quot;fi&quot;
Public Const cLANGUAGE_FRENCH = &quot;fr&quot;, cLANGUAGE_GERMAN = &quot;de&quot;, cLANGUAGE_GREEK = &quot;el&quot;
@@ -12,72 +10,27 @@ Public Const cLANGUAGE_ITALIAN = &quot;it&quot;, cLANGUAGE_JAPANESE = &quot;ja&q
Public Const cLANGUAGE_POLISH = &quot;pl&quot;, cLANGUAGE_PORTUGUESE = &quot;pt&quot;, cLANGUAGE_RUSSIAN = &quot;ru&quot;
Public Const cLANGUAGE_SPANISH = &quot;es&quot;, cLANGUAGE_SWEDISH = &quot;sv&quot;, cLANGUAGE_TURKISH = &quot;tr&quot;
-Public BLNameList(1 To 16) as String
+Public BLNameList(0 To 16) as String
&apos; R e s o u r c e s t r i n g c o n s t a n t s
&apos; -------------------------------------------------
&apos; Dialog labels start at 1000
-Const dlgCalTitle = 1000
-Const dlgCalTitleBack = 1001
-Const dlgCalTitleOwnData = 1002
-Const dlgSchdlTitle = 1003
-Const dlgOK = 1004
-Const dlgCancel = 1005
-Const dlgCalFrameOption = 1006
-Const dlgCalOptionYear = 1007
-Const dlgCalOptionMonth = 1008
-Const dlgSchdlDescription = 1009
-Const dlgSchdlCountry = 1010
-Const dlgTime = 1011
-Const dlgYear = 1012
-Const dlgCalMonth = 1013
-Const dlgSpecificBankholidays = 1014
-Const dlgCalOwnData = 1015
-Const dlgCalInsert = 1016
-Const dlgCalDelete = 1017
-Const dlgCalNewEvent = 1018
-Const dlgCalEvent = 1019
-Const dlgCalEventOnce = 1020
-Const dlgCalEventDay = 1021
-Const dlgCalEventMonth = 1022
-Const dlgCalEventYear = 1023
-&apos; Bitmap file is 1099
-Const dlgBitmapFile = 1099
-&apos; Names of states start at 1100
-Const dlgState = 1100
-&apos; Months start at 1200
+
+Sub LoadLanguage%(ByVal LangLocale)
+Dim Dummy$
+Dim i as Integer
Const dlgMonth = 1200
&apos; Abreviated months start 1225
Const dlgShortMonth = 1225
-&apos; Messages start at 1300
-Const msgCalErrorTitle = 1300
-Const msgCalError = 1301
-Const msgCalRemoveTitle = 1302
-Const msgCalRemove = 1303
-&apos; Styles start at 1400
-Const stlWorkday = 1400
-Const stlWeekend = 1401
-&apos; Sheet names start at 1410
-Const nameCalYear = 1410
-Const nameCalMonth = 1411
-&apos; Misc. schedule data starts at 1500
-Const sProgess = 1500
-
-
-
-Sub LoadLanguage%(ByVal LangLocale)
-Dim Dummy$, i, Count%
If InitResources(&quot;Calendar-template&quot;, &quot;cal&quot;) Then
-
- &apos; C o u n t r y s p p e c i f i c s e t t i n g s
- &apos; ---------------------------------------------------
If LangLocale = cLANGUAGE_GERMAN Then
- DlgBuffer.lblSpecBankholidays.Visible = True
- DlgBuffer.cmbState.Visible = True
+ DlgCalendar.GetControl(&quot;lblHolidays&quot;).Visible = True
+ DlgCalendar.GetControl(&quot;lstHolidays&quot;).Visible = True
&apos; Load all states
+ BLNameList(0) = GetResText(1100)
BLNameList(1) = &quot;Bayern&quot;
BLNameList(2) = &quot;Baden-Württemberg&quot;
BLNameList(3) = &quot;Berlin&quot;
@@ -94,62 +47,60 @@ Dim Dummy$, i, Count%
BLNameList(14) = &quot;Sachsen-Anhalt&quot;
BLNameList(15) = &quot;Schleswig Holstein&quot;
BLNameList(16) = &quot;Thüringen&quot;
- Dim FirstItem as String
- FirstItem = GetResText(dlgState)
- DlgBuffer.cmbState.AddItem(FirstItem)
- For i = 1 To Ubound(BLNameList())
- DlgBuffer.cmbState.AddItem(BLNameList(i))
- Next i
+ DlgCalModel.lstHolidays.StringItemList() = BLNameList()
+&apos; Dim FirstItem as String
+&apos;
+&apos; FirstItem = GetResText(1100)
+&apos; DlgCalModel.lstSpecBankholidays.AddItem(FirstItem)
+&apos; For i = 1 To Ubound(BLNameList())
+&apos; DlgCalModel.cmbState.AddItem(BLNameList(i))
+&apos; Next i
Else
- DlgBuffer.lblSpecBankholidays.Visible = False
- DlgBuffer.cmbState.Visible = False
+&apos; printdbgInfo DlgCalendar.GetControl(&quot;lblSpecBankholidays&quot;)
+&apos; DlgCalendar.GetControl(&quot;lblSpecBankholidays&quot;).Visible = False
+&apos; DlgCalendar.GetControl(&quot;lstSpecBankholidays&quot;).Visible = False
End If
-
- &apos; L o a d r e s o u r c e s t r i n g s
- &apos; -----------------------------------------
- &apos; Load dialog captions
- sWizardTitle$ = GetResText(msgCalErrorTitle)
- sError$ = GetResText(msgCalError)
- cCalSubCmdDeleteSelect_DeleteSelEntryTitle$ = GetResText(msgCalRemoveTitle)
- cCalSubCmdDeleteSelect_DeleteSelEntry$ = GetResText(msgCalRemove)
- cCalSubcmdSwitchOwnDataOrGeneral_OwnData$ = GetResText(dlgCalTitleOwnData)
- cCalSubcmdSwitchOwnDataOrGeneral_Back$ = GetResText(dlgCalTitleBack)
- DlgBuffer.frmTime.Caption = GetResText(dlgTime)
- DlgBuffer.lblYear.Caption = GetResText(dlgYear)
- DlgBuffer.DlgCmdCancel.Caption = GetResText(dlgCancel)
- DlgBuffer.DlgCmdOk.Caption = GetResText(dlgOK)
- DlgBuffer.lblSpecBankholidays.Caption = GetResText(dlgSpecificBankholidays)
-
- &apos; Load bitmap file
- sBitmapFilename$ = GetResText(dlgBitmapFile)
-
- &apos; Load calendar specific strings
- DlgBuffer.Caption = GetResText(dlgCalTitle)
- DlgBuffer.frmCalender.Caption = GetResText(dlgCalFrameOption)
- DlgBuffer.optYear.Caption = GetResText(dlgCalOptionYear)
- DlgBuffer.optMonth.Caption = GetResText(dlgCalOptionMonth)
- DlgBuffer.lblMonth.Caption = GetResText(dlgCalMonth)
- DlgBuffer.DlgCmdOwnData.Caption = GetResText(dlgCalOwnData)
- DlgBuffer.frmNewEvent.Caption = GetResText(dlgCalNewEvent)
- DlgBuffer.lblEvent.Caption = GetResText(dlgCalEvent)
- DlgBuffer.lblEventDay.Caption = GetResText(dlgCalEventDay)
- DlgBuffer.lblEventMonth.Caption = GetResText(dlgCalEventMonth)
- DlgBuffer.lblEventYear.Caption = GetResText(dlgCalEventYear)
- DlgBuffer.chkEventOnce.Caption = GetResText(dlgCalEventOnce)
- DlgBuffer.cmdInsert.Caption = GetResText(dlgCalInsert)
- DlgBuffer.cmdDelete.Caption = GetResText(dlgCalDelete)
- &apos; Load long month names
- For Count% = 0 To 11
- cCalLongMonthNames$(Count%+1) = GetResText(dlgMonth+Count%)
- cCalShortMonthNames$(Count%+1)= Left$(cCalLongMonthNames$(Count%+1), 3)
- Next
- &apos; Load sheet names
- sCalendarTitle$ = GetResText(nameCalYear)
- sMonthTitle$ = GetResText(nameCalMonth)
- &apos; Load names of styles
- cCalStyleWorkday$ = GetResText(stlWorkday)
- cCalStyleWeekend$ = GetResText(stlWeekend)
+ sWizardTitle$ = GetResText(1300)
+ sError$ = GetResText(1301)
+ cCalSubcmdDeleteSelect_DeleteSelEntryTitle$ = GetResText(1302)
+ cCalSubcmdDeleteSelect_DeleteSelEntry$ = GetResText(1303)
+ DlgCalendar.Title = GetResText(1000)
+
+ With DlgCalModel
+ cCalSubcmdSwitchOwnDataOrGeneral_OwnData$ = GetResText(1002)
+ cCalSubcmdSwitchOwnDataOrGeneral_Back$ = GetResText(1001)
+ .hlnTime.Label = GetResText(1011)
+ .lblYear.Label = GetResText(1012)
+ .cmdCancel.Label = GetResText(1005)
+ .cmdGoOn.Label = GetResText(1004)
+ .lblHolidays.Label = GetResText(1014)
+ sBitmapFilename$ = GetResText(1099)
+ DlgCalModel.hlnCalendar.Label = GetResText(1006)
+ .optYear.Label = GetResText(1007)
+ .optMonth.Label = GetResText(1008)
+ .lblMonth.Label = GetResText(1013)
+ .cmdOwnData.Label = GetResText(1015)
+ .hlnNewEvent.Label = GetResText(1019)
+ .lblEvent.Label = GetResText(1019)
+ .lblEventDay.Label = GetResText(1021)
+ .lblEventMonth.Label = GetResText(1022)
+ .lblEventYear.Label = GetResText(1023)
+ .chkEventOnce.Label = GetResText(1020)
+ .cmdInsert.Label = GetResText(1016)
+ .cmdDelete.Label = GetResText(1017)
+ &apos; Load long month names
+ For i = 0 To 11
+ cCalLongMonthNames(i+1) = GetResText(dlgMonth+i)
+ cCalShortMonthNames(i+1)= Left$(cCalLongMonthNames(i+1), 3)
+ Next
+ &apos; Load sheet names
+ sCalendarTitle$ = GetResText(1410)
+ sMonthTitle$ = GetResText(1411)
+ &apos; Load names of styles
+ cCalStyleWorkday$ = GetResText(1400)
+ cCalStyleWeekend$ = GetResText(1401)
+ End With
End If
End Sub
</script:module> \ No newline at end of file
diff --git a/wizards/source/schedule/OwnEvents.xba b/wizards/source/schedule/OwnEvents.xba
index e05a3cd5cd6d..583afddcef44 100644
--- a/wizards/source/schedule/OwnEvents.xba
+++ b/wizards/source/schedule/OwnEvents.xba
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="OwnEvents" script:language="StarBasic">Option Explicit
Sub Main
@@ -10,9 +10,9 @@ Sub CalSaveOwnData()
&apos; Sichert die Daten, die im lbOwnData Control eingegeben wurden.
&apos; Die Datei heißt Date.Dat und wird ins Unterverzeichnis Konfiguration
&apos; des Office3 Verzeichnis geschrieben.
-
- Dim FileName$
- Dim FileChannel%, Count%
+Dim FileName$
+Dim FileChannel%
+ Dim i as Integer
FileName$ = GetPathSettings(&quot;Config&quot;, False)+ GetPathSeparator() + &quot;DATE.DAT&quot;
&apos; Falls die Datei neu geschrieben wird, muß sie vorher gelöscht werden
If Dir$(FileName$) = &quot;DATE.DAT&quot; Then
@@ -29,20 +29,20 @@ Sub CalSaveOwnData()
Write #FileChannel%, &quot;It is not allowed to edit this file! Don&apos;t edit this file!&quot;
Write #FileChannel%, &quot;==========================================================&quot;
- For Count%=0 To DlgBuffer.lbOwnData.ListCount()-1
- Write #FileChannel%, DlgBuffer.lbOwnData.List(Count%)
+ For i = 0 To Ubound(DlgCalModel.lstOwnData.StringItemList())
+ Write #FileChannel%, DlgCalModel.lstOwnData.StringItemList(i)
Next
Close #FileChannel%
End Sub
+&apos; Lädt die Daten der persönlichen Ereignisse und
+&apos; schreibt diese dann in das Control lbOwnData.
Sub CalLoadOwnData()
- &apos; Lädt die Daten der persönlichen Ereignisse und
- &apos; schreibt diese dann in das Control lbOwnData.
-
- Dim FileName$, tempStr$
- Dim FileChannel%, Count%
+Dim FileName$, tempStr$
+Dim FileChannel%, Count%
+Dim i as Integer
FileName$ = GetPathSettings(&quot;Config&quot;, False)+ GetPathSeparator() + &quot;DATE.DAT&quot;
If Dir(FileName$) = &quot;DATE.DAT&quot; Then
@@ -53,11 +53,12 @@ Sub CalLoadOwnData()
For Count% = 1 To 6
Line Input #FileChannel%, tempStr$
Next
-
+ i = 0
&apos; Einfügen nach Reihenfolge sortiert.
While (not eof(#FileChannel%))
Input #FileChannel%, tempStr$
- DlgBuffer.lbOwnData.AddItem(tempStr$)
+ DlgCalModel.lstOwnData.AddItem(tempStr$, i)
+ i = i + 1
Wend
Close #FileChannel%
@@ -65,284 +66,221 @@ Sub CalLoadOwnData()
End Sub
-Function CalIsDataCorrect%()
- &apos; Verifiziert die Eingaben der persönlichen Ereignisseite
- &apos; und setzt, wenn ein Feld mit unsinnigen, oder fehlerhaften,
- Dim sEvent$, sEvMonth$, sEvDay$, sEvYear$
- Dim nEvMonth%
- sEvent$ = txtEvent.Text
- sEvMonth$ = txtOwnEventMonth.Text
- sEvDay$ = txtOwnEventDay.Text
- sEvYear$ = txtOwnEventYear.Text
-
- CalIsDataCorrect% = True
-
- If &quot;&quot; = sEvent$ Then
- CalIsDataCorrect% = SetFocusToControl(txtEvent)
- Exit Function
- End If
-
- If &quot;&quot; = sEvMonth$ Then
- CalIsDataCorrect% = SetFocusToControl(txtOwnEventMonth)
- Exit Function
- End If
-
- If &quot;&quot; = sEvDay$ Then
- CalIsDataCorrect% = SetFocusToControl(txtOwnEventDay)
- Exit Function
- End If
-
- nEvMonth% = Val(sEvMonth$)
-
- If 0 = nEvMonth% Then
- nEvMonth% = CalGetIntOfShortMonthName%(sEvMonth$)
- End If
-
- If (nEvMonth% &lt; 1) Or (nEvMonth% &gt; 12) Then
- CalIsDataCorrect% = SetFocusToControl(txtOwnEventMonth)
- Exit Function
- End If
-
- If chkEventOnce.Value And (sEvYear$ &lt;&gt; &quot;&quot;) Then
- If (Val(sEvYear$) &lt;= 1582) Or (Val(sEvYear$) &gt;= 9957) Then
- CalIsDataCorrect% = SetFocusToControl(txtOwnEventMonth)
- Exit Function
- End If
- End If
-
- If (Val (sEvDay$) &lt; 1) Or (Val (sEvDay$) &gt; CalMaxDayInMonth%(Val(sEvYear$), nEvMonth%)) Then
- CalIsDataCorrect% = SetFocusToControl(txtOwnEventDay)
- Exit Function
+Function SetFocusToControl(oTextControl as Object)
+ If oTextControl.Text = &quot;&quot; Then
+ Beep
+ oTextControl.DefaultButton = True
+ SetFocusToControl = True
+ Else
+ SetFocusToControl = False
End If
End Function
-Function SetFocusToControl(oControl as Object)
- Beep
- oControl.SetFocus
- SetFocusToControl = False
-End Function
-
-
-Function CalCreateDateFromInput&amp;()
- &apos; Generiert aus den Eingabedaten der Ereignisseite
- &apos; ein Datum im Dateserial Format,
- Dim newDate&amp;, nMonth%
-
- nMonth% = Val (txtOwnEventMonth.Text)
- If 0 = nMonth% Then
- nMonth% = CalGetIntOfShortMonthName% (txtOwnEventMonth.Text)
- End If
-
- newDate&amp; = DateSerial(0, nMonth%, Val(txtOwnEventDay.Text))
-
- If chkEventOnce.Value Then
- newDate&amp; = DateSerial(Val(txtOwnEventYear.Text), Month(newDate&amp;), Day(newDate&amp;))
+Function CalCreateDateFromInput() as Date
+&apos; Generiert aus den Eingabedaten der Ereignisseite
+&apos; ein Datum im Dateserial Format,
+Dim newDate as Date
+Dim EvMonth as Integer
+Dim EvDay as Integer
+Dim EvYear as Integer
+ EvMonth = DlgCalModel.lstOwnEventMonth.SelectedItems(0)
+ EvDay = Val(DlgCalModel.txtOwnEventDay.Text)
+ If DlgCalModel.chkEventOnce.State = 1 Then
+ EvYear = Val(DlgCalModel.txtOwnEventYear.Text)
+ newDate = DateSerial(EvYear, EvMonth, EvDay)
+ Else
+ newDate = DateSerial(0, EvMonth, EvDay)
End If
- CalCreateDateFromInput&amp; = newDate&amp;
+ CalCreateDateFromInput = newDate
End Function
-Function CalCreateDateStrOfInput$()
-Dim DateStr$
-Dim nMonth%
-
- If Not CalIsDataCorrect%() Then
- CalCreateDateStrOfInput$ = &quot;&quot;
- Exit Function
- End If
-
- If Val(txtOwnEventDay.Text) &lt; 10 Then
- DateStr$ = &quot; &quot;
+Function CalCreateDateStrOfInput() as String
+Dim DateStr as String
+Dim EvMonth as Integer
+Dim EvDay as Integer
+ EvDay = Val(Trim(DlgCalModel.txtOwnEventDay.Text))
+ If EvDay &lt; 10 Then
+ DateStr = &quot;0&quot; &amp; EvDay &amp; &quot;. &quot;
+ Else
+ DateStr = Cstr(EvDay) &amp; &quot;. &quot;
End If
+ DateStr = DateStr &amp; DlgCalendar.GetControl(&quot;lstOwnEventMonth&quot;).GetSelectedItem()
- DateStr$ = DateStr$ + Trim(txtOwnEventDay.Text) + &quot;. &quot;
- nMonth% = CalGetIntOfShortMonthName% (Trim(txtOwnEventMonth.Text))
- DateStr$ = DateStr$ + cCalShortMonthNames$ (nMonth%)
-
- If chkEventOnce.Value And txtOwnEventYear.Text &lt;&gt; &quot;&quot; Then
- DateStr$ = DateStr$ + &quot; &quot; + Trim(txtOwnEventYear.Text)
+ If DlgCalModel.chkEventOnce.State = 1 And DlgCalModel.txtOwnEventYear.Text &lt;&gt; &quot;&quot; Then
+ DateStr = DateStr &amp; &quot; &quot; + Trim(DlgCalModel.txtOwnEventYear.Text)
Else
- DateStr$ = DateStr$ + &quot; &quot;
+ DateStr = DateStr + &quot; &quot;
End If
- DateStr$ = DateStr$ + &quot; &quot; + Trim(txtEvent.Text)
- CalCreateDateStrOfInput$ = DateStr$
+ DateStr = DateStr + &quot; &quot; + Trim(DlgCalModel.txtEvent.Text)
+ CalCreateDateStrOfInput = DateStr
End Function
-Function CalGetDateWithoutYear&amp;(byval Pos%)
- CalGetDateWithoutYear&amp; = DateSerial(0, CalGetMonthOfEvent(Pos%), CalGetDayOfEvent(Pos%))
+Function CalGetDateWithoutYear&amp;(ByVal i as Integer)
+ CalGetDateWithoutYear&amp; = DateSerial(0, CalGetMonthOfEvent(i), CalGetDayOfEvent(i))
End Function
-Function CalExistDateInList%(byval newDate&amp;)
-
- Dim Count%, lbActDate&amp;, lbActEvent$, Result%
- Dim nEvYear%, nEvMonth%, nEvDay%
-
- Result% = False
- For Count%=0 To lbOwnData.ListCount()-1
- nEvYear% = CalGetYearOfEvent(Count%)
- nEvMonth% = CalGetMonthOfEvent(Count%)
- nEvDay% = CalGetDayOfEvent(Count%)
- lbActDate&amp; = DateSerial(nEvYear%, nEvMonth%, nEvDay%)
- Result% = (lbactDate&amp; = newDate&amp;)
- Next
- CalExistDateInList% = Result%
-End Function
-
-
-Sub CalCmdInsertData()
-Dim DateStr$, newDate&amp;, Count%, Inserted%, Found%
+Sub CalcmdInsertData()
+Dim DateStr as String
+Dim LastIndex as Integer
+Dim bGetYear as Boolean
+Dim NewDate as Date
+Dim bInserted as Boolean
+Dim bDateDoubled as Boolean
+Dim EvYear as Integer
+Dim i as Integer
+Dim CurEvYear as Integer
+Dim CurEvMonth as Integer
+Dim CurEvDay as Integer
+
+ bGetYear = DlgCalModel.chkEventOnce.State = 1
+ LastIndex = Ubound(DlgCalModel.lstOwnData.StringItemList())
+ If bGetYear Then
+ EvYear = Val(DlgCalModel.txtOwnEventYear.Text)
+ If (EvYear &lt;= 1582) OR (EvYear &gt;= 9957) Then
+ SetFocusToControl(txtOwnEventMonth)
+ Exit Sub
+ End If
+ End If
- Inserted% = False
- DateStr$ = CalCreateDateStrOfInput$()
- If DateStr$ = &quot;&quot; Then Exit Sub
+ If DlgCalModel.chkEventOnce.State = 1 Then
+ EvYear = Val(DlgCalModel.txtOwnEventYear.Text)
+ End If
+ newDate = CalCreateDateFromInput()
+ DateStr = CalCreateDateStrOfInput()
+ If DateStr = &quot;&quot; Then Exit Sub
&apos; Es ist noch garnichts vorhanden
- If Not Inserted% And lbOwnData.ListCount()=0 Then
- lbOwnData.AddItem(DateStr$)
- Inserted% = True
- End If
-
- &apos; Doppeltes Datum
- newDate&amp; = CalCreateDateFromInput&amp;()
- If ((False = Inserted%) And (True = CalExistDateInList (newDate))) Then
+ If Ubound(DlgCalModel.lstOwnData.StringItemList()) = -1 Then
+ DlgCalendar.GetControl(&quot;lstOwnData&quot;).AddItem(DateStr, 0 + 1)
+ bInserted = True
+ Else
&apos; gleiche jahre(auch keine Jahre sind gleiche jahre)-&gt;alt löschen neu rein
- Count% = 0
- While (DateSerial(CalGetYearOfEvent(Count%), CalGetMonthOfEvent(Count%), CalGetDayOfEvent(Count%))&lt;&gt;DateSerial(Year(newDate&amp;), Month(newDate&amp;), Day(newDate&amp;)))
- Count% = Count + 1
- Wend
- &apos; beide Jahre gleich (auch: kein datum gesetzt) -&gt; alt löschen neu rein
- If ((CalGetYearOfEvent(Count%)=0 And Not chkEventOnce.Value) Or (chkEventOnce.Value And Val(txtOwnEventYear.Text)=CalGetYearOfEvent%(Count%))) Then
- lbOwnData.RemoveItem(Count%)
- lbOwnData.AddItem(DateStr$, Count%)
- Inserted% = True
- End If
- End If
-
- &apos; Es existiert ein Datum mit Jahreszahl. Es wird dasselbe Datum
- &apos; ohne Angabe der Jahreszahl angegeben.
- newDate&amp; = CalCreateDateFromInput&amp;()
- newDate&amp; = Dateserial(0, Month(newDate&amp;), Day(newDate&amp;))
- If Not Inserted% And Not chkEventOnce.Value Then
- Dim temp&amp;
- Count% = 0
- While (Not Found%) And (Count% &lt; lbOwnData.ListCount())
- temp&amp; = CalGetDateWithoutYear%(Count%)
- If (temp&amp; = newDate&amp;) Then
- Found% = True
- Else
- Count% = Count% + 1
+ i = 0
+ Do
+ CurEvYear = CalGetYearOfEvent(i)
+ CurEvMonth = CalGetMonthOfEvent(i)
+ CurEvDay = CalGetDayOfEvent(i)
+ If DateSerial(CurEvYear, CurEvMonth, CurEvDay) = NewDate Then
+ &apos; Todo: Abchecken wie das ist mit &apos;Ereignis einmalig&apos; oder nicht
+ DlgCalModel.GetControl(&quot;lstOwnData&quot;).RemoveItem(DateStr, i)
+ DlgCalModel.GetControl(&quot;lstOwnData&quot;).AddItem(DateStr, i)
+ bInserted = True
End If
- Wend
- If Found% Then
- If (CalGetYearOfEvent%(Count%)&lt;&gt;0) Then
- lbOwnData.AddItem(DateStr$, Count%)
- Inserted% = True
- End If
- End If
- End If
+ i = i + 1
+ Loop Until bInserted Or i &gt; LastIndex
+
+ &apos; Es existiert ein Datum mit Jahreszahl. Es wird dasselbe Datum
+ &apos; ohne Angabe der Jahreszahl angegeben.
+ If Not bInserted And Not bGetYear Then
+ i = 0
+ Do
+ bInserted = CalGetDateWithoutYear(i) = newDate
+ i = i + 1
+ If bInserted Then
+ If CalGetYearOfEvent(i) &lt;&gt; 0 Then
+ DlgCalModel.GetControl(&quot;lstOwnData&quot;).AddItem(DateStr, i)
+ End If
+ End If
+ Loop Until bInserted Or i &gt; LastIndex
+ End If
- &apos; Das einzufügende Datum besitzt eine Jahreszahl, es gibt bereits
- &apos; das Datum in der Liste, jedoch ohne Datum.
- newDate&amp; = CalCreateDateFromInput&amp;()
- newDate&amp; = Dateserial(0, Month(newDate&amp;), Day(newDate&amp;))
- If Not Inserted% And chkEventOnce.Value Then
- Found% = False
- Count% = 0
- While (Not Found%) And (Count% &lt; lbOwnData.ListCount)
- If (CalGetDateWithoutYear(Count%) = newDate&amp;) Then
- Found% = True
- Else
- Count% = Count% + 1
- End If
- Wend
- If Found% Then
- Count% = Count% + 1
- lbOwnData.AddItem(DateStr$, Count%)
- Inserted% = True
+ &apos; Das einzufügende Datum besitzt eine Jahreszahl, es gibt bereits
+ &apos; das Datum in der Liste, jedoch ohne Datum.
+ If Not bInserted And bGetYear Then
+ i = 0
+ Do
+ bInserted = CalGetDateWithoutYear(i) = newDate
+ i = i + 1
+ If bInserted Then
+ DlgCalModel.GetControl(&quot;lstOwnData&quot;).AddItem(DateStr, i)
+ End If
+ Loop Until bInserted Or i &gt; LastIndex
End If
- End If
- &apos; Das Datum ist noch nicht vorhanden.
- newDate&amp; = CalCreateDateFromInput&amp;()
- newDate&amp; = Dateserial(0, Month(newDate&amp;), Day(newDate&amp;))
- &apos; newDate&amp; = Dateserial(0, Month(newDate&amp;), Day(newDate&amp;))
- If (Inserted%=False And CalExistDateInList(newDate)=False) Then
- Found% = False
- Count% = 0
- While (Count% &lt; lbOwnData.ListCount() And Found% = False)
- If (newDate&amp; &gt; CalGetDateWithoutYear&amp;(Count%)) Then
- Count% = Count% + 1
- Else
- Found% = True
- End If
- Wend
- lbOwnData.AddItem(DateStr$, Count%)
- Inserted% = True
+ &apos; Das Datum ist noch nicht vorhanden und wir richtig einsortiert
+ If Not bInserted And Not bDateDoubled Then
+ i = 0
+ Do
+ bInserted = newDate &gt; CalGetDateWithoutYear(i)
+ i = i + 1
+ If bInserted Then
+ DlgCalendar.GetControl(&quot;lstOwnData&quot;).AddItem(DateStr, i)
+ End If
+ Loop Until bInserted Or i &gt; LastIndex
+ End If
End If
&apos; Flag zum Speichern der neuen Daten.
- If Inserted% = True Then
- CalOwnDataChanged% = True
+ If bInserted = True Then
+ bCalOwnDataChanged = True
End If
- &apos; Nachdem die Daten übernommen worden sind, werden sie aus
- &apos; der Eingabe gelöscht
Call CalClearInputMask()
End Sub
-Sub CalUpdateNewEventFrame()
- Dim bEnable as Boolean
- Dim Result%, actPos%, Count%
- Dim sSelData$
-
- Result% = CalCountSelected%(DlgBuffer.lbOwnData, actPos%)
- If Result% = 1 Then
- &apos; Daten unten anzeigen
- sSelData$ = lbOwnData.List (actPos%)
- txtEvent.Text = Trim (Mid$ (sSelData$, 16))
- txtOwnEventDay.Text = Trim (Left$ (sSelData$, 2))
- txtOwnEventMonth.Text = Str$ (Mid$ (sSelData$, 5, 3))
-
- bEnable = Val (Trim (Mid$ (sSelData$, 10, 4))) &gt; 0
- If bEnable Then
- txtOwnEventYear.Text = Trim (Mid$ (sSelData$, 10, 4))
- Else
- txtOwnEventYear.Text = &quot;&quot;
- End If
- chkEventOnce.Value = bEnable
- lblEventYear.Enabled = bEnable
- txtownEventYear.Enabled = bEnable
- SpinOwnEventYear.Enabled = bEnable
- Else
- Call CalClearInputMask()
- End If
-
- cmdDelete.Enabled = (1 &lt;= Result%)
-End Sub
+Function CalGetYearOfEvent(ByVal ListIndex as Integer) as Integer
+Dim YearStr as String
+ YearStr = DlgCalModel.lstOwnData.StringItemList(ListIndex)
+ CalGetYearOfEvent% = Val(Mid(YearStr, 10, 4))
+End Function
-Function CalGetYearOfEvent%(byval Pos%)
- CalGetYearOfEvent% = Val(Mid$(lbOwnData.List(Pos%), 10, 4))
+Function CalGetDayOfEvent(ByVal ListIndex as Integer) as Integer
+Dim DayStr as String
+ DayStr = DlgCalModel.lstOwnData.StringItemList(ListIndex)
+ CalGetDayOfEvent = Val(Left(DayStr,2)) &apos;Mid(DayStr, 1, 2))
End Function
-Function CalGetDayOfEvent%(byval Pos%)
- CalGetDayOfEvent% = Val(Mid$(lbOwnData.List(Pos%), 1, 2))
+Function CalGetNameOfEvent(ByVal ListIndex as Integer) as Integer
+Dim NameStr as String
+ NameStr = DlgCalModel.lstOwnData.StringItemList(ListIndex)
+ NameStr = Trim (Mid(NameStr, 16))
+&apos; If Val(NameStr) = 0 Then
+&apos; NameStr = &quot;&quot;
+&apos; End If
+ CalGetNameOfEvent = NameStr
End Function
-Function CalGetMonthOfEvent%(byval Pos%)
- &apos; Liefert den Monat eines Ereignisses aus dem
- &apos; Control lbOwnData als Zahl.
- Dim sMonth$
-
- sMonth$ = Mid$ (lbOwnData.List(Pos%), 5, 3)
- CalGetMonthOfEvent% = CalGetIntOfShortMonthName% (sMonth$)
+Function CalGetMonthOfEvent(ByVal ListIndex as Integer) as Integer
+Dim MonthStr as String
+ MonthStr = DlgCalModel.lstOwnData.StringItemList(ListIndex)
+ MonthStr = Mid(MonthStr, 5, 3)
+ CalGetMonthOfEvent = CalGetIntOfShortMonthName(MonthStr)
End Function
-
+
+Sub CheckInsertedDates()
+Dim EvYear as Long
+Dim EvMonth as Long
+Dim EvDay as Long
+Dim sEvMonth as String
+Dim bDoEnable as Boolean
+ bDoEnable = True
+ If DlgCalModel.chkEventOnce.State = 1 Then
+ EvYear = Val(DlgCalModel.txtOwnEventYear.Text)
+ &apos;(EvYear &gt;= 1582) AND (EvYear &lt;= 9957)
+ bDoEnable = EvYear &lt;&gt; 0
+ Else
+ EvYear = Year(Now())
+ End If
+ If bDoEnable Then
+ EvDay = Val(DlgCalModel.txtOwnEventDay.Text)
+ bDoEnable = Ubound(DlgCalModel.lstOwnEventMonth.SelectedItems()) &gt; -1
+ If bDoEnable Then
+ EvMonth = DlgCalModel.lstOwnEventMonth.SelectedItems(0)
+ bDoEnable = (EvDay &gt; 1) AND (EvDay &lt; CalMaxDayInMonth(EvYear, EvMonth))
+ If bDoEnable Then
+ bDoEnable = LTrim(DlgCalModel.txtEvent.Text) &lt;&gt; &quot;&quot;
+ End If
+ End If
+ End If
+ DlgCalModel.cmdInsert.Enabled = bDoEnable
+End Sub
</script:module> \ No newline at end of file