summaryrefslogtreecommitdiff
path: root/wizards/source/schedule
diff options
context:
space:
mode:
authorTom Verbeek <tv@openoffice.org>2001-04-23 09:46:42 +0000
committerTom Verbeek <tv@openoffice.org>2001-04-23 09:46:42 +0000
commit191835bec9bafbe76567363e2e5a1fdd7b232671 (patch)
treef3b6f68a56b2ba9575fee6f77a5966af45804e47 /wizards/source/schedule
parenta2255c1e77bee1071b372efd33d3b4adfeb0907b (diff)
initial revision
Diffstat (limited to 'wizards/source/schedule')
-rw-r--r--wizards/source/schedule/BankHoliday.xba156
-rw-r--r--wizards/source/schedule/CalendarMain.xba212
-rw-r--r--wizards/source/schedule/CreateTable.xba137
-rw-r--r--wizards/source/schedule/DlgCalendar.xdl7
-rw-r--r--wizards/source/schedule/DlgControl.xba369
-rw-r--r--wizards/source/schedule/Language.xba155
-rw-r--r--wizards/source/schedule/OwnEvents.xba348
7 files changed, 1384 insertions, 0 deletions
diff --git a/wizards/source/schedule/BankHoliday.xba b/wizards/source/schedule/BankHoliday.xba
new file mode 100644
index 000000000000..efaf77180516
--- /dev/null
+++ b/wizards/source/schedule/BankHoliday.xba
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="BankHoliday" script:language="StarBasic">Option Explicit
+
+Sub Main()
+ Call CalAutopilotTable()
+End Sub
+
+
+Function CalEasterTable&amp;(byval Year%)
+
+ Dim B,C,D,E,F,G,H,I,K,L,M,N,O, nMonth, nDay As Integer
+
+ N = Year% mod 19
+ B = int(Year% / 100)
+ C = Year% mod 100
+ D = int(B / 4)
+ E = B mod 4
+ F = int((B + 8) / 25)
+ G = int((B - F + 1) / 3)
+ H =(19 * N + B - D - G + 15) mod 30
+ I = int(C / 4)
+ K = C mod 4
+ L =(32 + 2 * E + 2 * I - H - K) mod 7
+ M = int((N + 11 * H + 22 * L) / 451)
+ O = H + L - 7 * M + 114
+ nDay = O mod 31 + 1
+ nMonth = int(O / 31)
+ CalEasterTable&amp; = DateSerial(Year%, nMonth,nDay)
+End Function
+
+
+
+Sub CalInitGlobalVariablesDate()
+ Dim Count%
+
+ For Count% = 1 To 374
+ CalBankholidayName$(Count%) = &quot;&quot;
+ CalTypeOfBankHoliday%(Count%) = cHolidayType_None
+ Next
+End Sub
+
+
+
+Sub CalInsertBankholiday(byval actDate&amp;, byval Event$, ByVal nBankholidayLevel%)
+ Dim DayInYear%
+ &apos; Fuegt ein Ereignis in das globale EventArray ein.
+ &apos; Der Sonderfall der eintreten kann, ist der, dass das Datum
+ &apos; an dem eingefuegt werden soll, bereits ein Ereignis enthaelt.
+ &apos; Dann werden beide Ereignisse mit einem Schraegstrich verbunden.
+ DayInYear% =(Month(actDate&amp;)-1)*31 +Day(actDate&amp;)
+
+ &apos; Hoehere Prioritaet des Feiertagtyps
+ If (0 &lt;&gt; CalTypeOfBankHoliday%(DayInYear%)) Then
+ If (nBankholidayLevel% &lt; CalTypeOfBankHoliday%(DayInYear%)) Then
+ CalTypeOfBankHoliday%(DayInYear%) = nBankholidayLevel%
+ End If
+ Else
+ CalTypeOfBankHoliday%(DayInYear%) = nBankholidayLevel%
+ End If
+
+ If (CalBankHolidayName$(DayInYear%) = &quot;&quot;) Then
+ CalBankHolidayName$(DayInYear%) = Event$
+ Else
+ CalBankHolidayName$(DayInYear%) = CalBankHolidayName$(DayInYear%) + &quot; / &quot; + Event$
+ End If
+End Sub
+
+
+
+Function CalIsLeapYear%(ByVal TheYear%)
+ CalIsLeapYear% = TheYear Mod 4 = 0
+End Function
+
+
+Function CalMaxDayInMonth%(byval YearVal%, byval MonthVal%)
+ &apos; Liefert den maximalen Tag eines Monats in einem
+ &apos; bestimmten Jahr.
+
+ Dim tmpDate&amp;
+ Dim MaxDay%
+
+ MaxDay = 28
+ tmpDate&amp; = DateSerial(YearVal%, MonthVal%, MaxDay)
+
+ While Month(tmpDate&amp;) = MonthVal%
+ MaxDay% = MaxDay% + 1
+ tmpDate&amp; = tmpDate&amp; + 1
+ Wend
+ Maxday% = MaxDay% - 1
+ CalMaxDayInMonth% = MaxDay%
+End Function
+
+
+Function CalGetIntOfShortMonthName%(byval MonthName$)
+
+ Dim nCount%, nMonth%
+
+ nMonth% = Val(MonthName$)
+
+ 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%
+ Exit Function
+ End If
+ Next
+
+ &apos; Not Found
+ CalGetIntOfShortMonthName% = 0
+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)
+ End If
+ Next
+End Sub
+
+
+&apos; Finds eg the first,second Monday in a month
+&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
+ &apos; 1st Tue in Nov : Election Day, Half
+ bFound = False
+ nCount% = 0
+ lDate = DateSerial(YearInt%, iMonth, 1)
+ While Not bFound
+ If (iWeekDay = WeekDay(lDate)) Then nCount% = nCount% + 1
+ If (nCount &lt; iCount) Then
+ lDate = lDate + 1
+ Else
+ bFound = True
+ End If
+ Wend
+ GetMonthDate = lDate
+End Function
+</script:module> \ No newline at end of file
diff --git a/wizards/source/schedule/CalendarMain.xba b/wizards/source/schedule/CalendarMain.xba
new file mode 100644
index 000000000000..8454163718f8
--- /dev/null
+++ b/wizards/source/schedule/CalendarMain.xba
@@ -0,0 +1,212 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="CalendarMain" script:language="StarBasic">Option Explicit
+
+Const _DEBUG = 0
+
+&apos; CalenderMain
+Public sCurLangLocale as String
+
+&apos; Dieses Flag dient zur Abfrage ob die individuellen Daten abgespeichert werden sollen.
+Public CalOwnDataChanged%
+
+&apos;BankHolidayFunctions
+Public CalBankholidayName$ (1 To 374)
+Public CalTypeOfBankHoliday% (1 To 374)
+
+Public Const cHolidayType_None = 0
+Public Const cHolidayType_Full = 1
+Public Const cHolidayType_Half = 2
+Public Const cHolidayType_Own = 4
+
+&apos;Dlg_Control
+Public CalTWIPSPicHeight%, CalTWIPSPicWidth%, CalStartX%, CalStartY%
+
+Public CalPicWidth%, CalPicHeight%
+
+Public cCalSubCmdDeleteSelect_DeleteSelEntry$
+Public cCalSubCmdDeleteSelect_DeleteSelEntryTitle$
+Public cCalSubcmdSwitchOwnDataOrGeneral_Back$
+Public cCalSubcmdSwitchOwnDataOrGeneral_OwnData$
+
+&apos;Language
+Public cCalLongMonthNames$(12)
+Public cCalShortMonthNames$(12)
+
+Public sBitmapFilename$
+Public sCalendarTitle$, sMonthTitle$, sWizardTitle$, sError$
+Public cCalStyleWorkday$, cCalStyleWeekend$
+
+&apos; German only
+&apos; Variablen, die zur Verwaltung der Eingabe der Bundesländer dienen
+Public CalChoosenLand%, MouseClicked%, LandWhenClick%
+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*
+Public CONST CalBLBayern = 1
+Public CONST CalBLBadenWuert = 2
+Public CONST CalBLBerlin = 3
+Public CONST CalBLBremen = 4
+Public CONST CalBLBrandenburg = 5
+Public CONST CalBLHamburg = 6
+Public CONST CalBLHessen = 7
+Public CONST CalBLMeckPomm = 8
+Public CONST CalBLNiedersachsen = 9
+Public CONST CalBLNordrheinWest = 10
+Public CONST CalBLRheinlandPfalz = 11
+Public CONST CalBLSaarland = 12
+Public CONST CalBLSachsen = 13
+Public CONST CalBLSachsenAnhalt = 14
+Public CONST CalBLSchlHolstein = 15
+Public CONST CalBLThueringen = 16
+
+
+Sub CalAutopilotTable()
+
+&apos; On Error Goto ErrorHandler
+ Application.LoadLibrary(&quot;tools&quot;)
+ &apos; HauptRoutine zur Erstellung des Kalenders
+ Set DlgBuffer = DlgCalendar
+
+ DlgBuffer.Load()
+ sCurLangLocale = StarDesktop.ISOLocale.Language
+ LoadLanguage(sCurLangLocale)
+ &apos; Da modulübergreifende Variablen unsicher sind,
+ &apos; wird ihre Initialisierung noch einmal explizit
+ &apos; angegeben.
+ CalInitGlobalVariablesDate()
+ CalCalcPictureData()
+ 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
+ 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()
+ Exit Sub
+
+ErrorHandler:
+ MsgBox(sError$, 16, sWizardTitle$)
+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
+End Sub
+
+
+Sub CalCmdCancel()
+ If CalOwnDataChanged% Then
+ Call CalSaveOwnData()
+ End If
+ DlgBuffer.Unload()
+End Sub
+
+
+
+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()
+
+ If cLANGUAGE_GERMAN = sCurLangLocale Then
+ If MouseClicked% Then
+ CalChoosenLand%=LandWhenClick%
+ Else
+ CalChoosenLand% = 0
+ End If
+ End If
+
+ oDocument = StarDesktop.ActiveFrame.Controller.Model
+ oSheets = oDocument.sheets
+ If CalOwnDataChanged% Then
+ Call CalSaveOwnData()
+ End If
+
+ &apos; Unprotect all tables so they can be deleted or modified
+ For i = 0 To oSheets.Count - 1
+ oSheets.GetbyIndex(i).unprotect(&quot;&quot;)
+ Next
+ oSheets.RemovebyName(oSheets.GetbyIndex(0).Name)
+
+ iSelYear = Val(txtYear.Text)
+ Select Case sCurLangLocale
+ Case cLANGUAGE_GERMAN
+ Call CalFindWholeYearHolidays_GERMANY(iSelYear, CalChoosenLand%)
+ Case cLANGUAGE_ENGLISH
+ Call FindWholeYearHolidays_US(iSelYear)
+ Case cLANGUAGE_FRENCH
+ Call FindWholeYearHolidays_FRANCE(iSelYear)
+ Case cLANGUAGE_ITALIAN
+ Call FindWholeYearHolidays_ITA(iSelYear)
+ Case cLANGUAGE_SPANISH
+ Call FindWholeYearHolidays_SPAIN(iSelYear)
+ Case cLANGUAGE_PORTUGUESE
+ Call FindWholeYearHolidays_PORT(iSelYear)
+ Case cLANGUAGE_DUTCH
+ Call FindWholeYearHolidays_NL(iSelYear)
+ Case cLANGUAGE_SWEDISH
+ Call FindWholeYearHolidays_SWED(iSelYear)
+ Case cLANGUAGE_DANISH
+ Call FindWholeYearHolidays_DK(iSelYear)
+ Case cLANGUAGE_POLISH
+ Call FindWholeYearHolidays_PL(iSelYear)
+ Case cLANGUAGE_RUSSIAN
+ Call FindWholeYearHolidays_RU(iSelYear)
+ End Select
+
+ Call CalInsertOwnDataInTables(iSelYear)
+
+ oStatusline = oDocument.GetCurrentController.GetFrame.GetStatusIndicator
+
+ If optYear.Value Then
+ oSheets.RemovebyName(oSheets.GetbyIndex(0).Name)
+ oSheet = oSheets.GetbyIndex(0)
+ oSheet.Name = sCalendarTitle$ + &quot; &quot; + txtYear.Text
+ oDocument.AddActionLock
+ Call CalCreateYearTable(iSelYear)
+ ElseIf optMonth.Value Then
+ oSheets.RemovebyName(oSheets.GetbyIndex(1).Name)
+ oSheet = oSheets.GetbyIndex(0)
+ oSheet.Name = sMonthTitle$ + &quot; &quot; + cCalLongMonthNames$(CalGetIntOfShortMonthName%(txtMonth.Text))
+ oDocument.AddActionLock
+ Call CalCreateMonthTable(iSelYear, CalGetIntOfShortMonthName%(txtMonth.Text))
+ End If
+
+ oDocument.RemoveActionLock
+ &apos; Protect the remaining sheet
+ oSheet.protect(&quot;&quot;)
+ oStatusLine.End
+ DlgBuffer.Unload()
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/schedule/CreateTable.xba b/wizards/source/schedule/CreateTable.xba
new file mode 100644
index 000000000000..5ef472639989
--- /dev/null
+++ b/wizards/source/schedule/CreateTable.xba
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<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
+Public Const DateColumn% = 3 &apos; Column on month sheet with days
+Public Const NewYearRow = 4 &apos; Row on year sheet for January 1st
+Public Const NewYearColumn = 2 &apos; Column on year sheet for January 1st
+
+
+Sub CalCreateYearTable(ByVal YearInt%)
+&apos; Completes the overview for whole year
+
+&apos; Needed by StarOffice Calc and StarOffice Schedule
+Dim CalDay%, CalMonth%, Count%, nCount%
+
+&apos; Only needed by StarOffice Schedule
+Dim oYearCell as object
+Dim iDate
+Dim i, s as Integer
+Dim ColPos, RowPos as Integer
+Dim oNameCell, oDateCell as Object
+Dim iCellValue as Long
+Dim oRangeFebCell, oCellAddress, oFebcell as Object
+Dim oRangeBlank as Object
+Dim sBlankStyle as String
+ On Error Goto ErrorHandling
+ oStatusLine.Start(GetResText(sProgress),140)
+
+ iDate = DateSerial(Val(DlgBuffer.txtYear.Text),1,1)
+
+ &apos; Insert year
+ oYearCell = oSheet.GetCellRangeByName(&quot;Year&quot;)
+ oYearCell.Value = Val(DlgBuffer.txtYear.Text)
+ &apos; Insert holidays
+ CalMonth% = 1
+ CalDay% = 0
+ s = 10
+ oStatusLine.SetValue(s)
+ For i = 1 To 374
+ CalDay = CalDay+1
+ If CalDay = 32 Then
+ CalDay = 1
+ CalMonth = CalMonth+1
+ s = s + 10
+ oStatusLine.SetValue(s)
+ End If
+ ColPos = NewYearColumn+(2*CalMonth)
+ RowPos = NewYearRow + CalDay
+ FormatCalCells(ColPos,RowPos,i)
+ Next
+ If NOT CalIsLeapYear(Val(txtYear.Text)) Then
+ &apos; Delete 29th February if necessary
+ oRangeFebCell = oSheet.GetCellRangeByName(&quot;Feb29&quot;)
+ oCellAddress = oRangeFebCell.RangeAddress
+ oFebCell = oSheet.GetCellByPosition(oCellAddress.StartColumn,oCellAddress.StartRow)
+ oFebCell.String = &quot;&quot;
+ &apos; Change the CellStyle according to the Range &quot;Blank&quot;
+ oRangeBlank = oSheet.GetCellRangebyName(&quot;Blank&quot;)
+ sBlankStyle = oRangeBlank.CellStyle
+ oRangeFebCell.CellStyle = sBlankStyle
+ End If
+ oStatusLine.SetValue(150)
+ ErrorHandling:
+ If Err &lt;&gt; 0 Then
+ MsgBox sError$, 16, sWizardTitle$
+ End If
+End Sub
+
+
+
+Sub CalCreateMonthTable(ByVal YearInt%, ByVal MonthInt%)
+Dim oMonthCell, oDateCell as Object
+Dim iDate as Date
+Dim oAddress
+Dim i, s as Integer
+Dim StartDay%, TargetMonth%
+
+&apos; Completes the monthly calendar
+On Error Goto ErrorHandling
+ oStatusLine.Start(GetResText(sProgess),40)
+ &apos; Set month
+ TargetMonth% = CalGetIntOfShortMonthName%(txtMonth.Text)
+ oMonthCell = oSheet.GetCellRangeByName(&quot;Month&quot;)
+
+ iDate = DateSerial(Val(DlgBuffer.txtYear.Text),TargetMonth%,1)
+ oMonthCell.Value = iDate
+ &apos; Inserting holidays
+ StartDay% = (TargetMonth% - 1) * 31 + 1
+ s = 5
+ For i = StartDay% To StartDay%+30
+ oStatusLine.SetValue(s)
+ s = s + 1
+ FormatCalCells(DateColumn+1,FirstDayRow+i-StartDay,i)
+ Next
+ oDateCell = oSheet.GetCellbyPosition(DateColumn,FirstDayRow+i-StartDay - 1)
+ oAddress = oDateCell.RangeAddress
+
+ Select Case TargetMonth
+ Case 2,4,6,9,11
+ oSheet.RemoveRange(oAddress, com.sun.star.sheet.CellDeleteMode.ROWS)
+ If TargetMonth = 2 Then
+ oAddress.StartRow = oAddress.StartRow - 1
+ oAddress.EndRow = oAddress.StartRow
+ oSheet.RemoveRange(oAddress, com.sun.star.sheet.CellDeleteMode.ROWS)
+ If Not CalIsLeapYear(Val(txtYear.Text)) Then
+ oAddress.StartRow = oAddress.StartRow - 1
+ oAddress.EndRow = oAddress.StartRow
+ oSheet.RemoveRange(oAddress, com.sun.star.sheet.CellDeleteMode.ROWS)
+ End If
+ End If
+ End Select
+ oStatusLine.SetValue(45)
+ErrorHandling:
+ If Err &lt;&gt; 0 Then
+ MsgBox sError$, 16, sWizardTitle$
+ End If
+End Sub
+
+
+
+Sub FormatCalCells(ColPos,RowPos,i as Integer)
+Dim oNameCell, oDateCell as Object
+Dim iCellValue as Long
+ oDateCell = oSheet.GetCellbyPosition(ColPos-1,RowPos)
+ If oDateCell.Value &lt;&gt; 0 Then
+ iCellValue = oDateCell.Value
+ oDateCell.Value = iCellValue
+ If CalBankHolidayName$(i) &lt;&gt; &quot;&quot; Then
+ oNameCell = oSheet.GetCellbyPosition(ColPos,RowPos)
+ oNameCell.String = CalBankHolidayName$(i)
+ If CalTypeOfBankHoliday%(i) = cHolidayType_Full Then
+ oDateCell.CellStyle = cCalStyleWeekend$
+ End If
+ End If
+ End If
+End Sub</script:module> \ No newline at end of file
diff --git a/wizards/source/schedule/DlgCalendar.xdl b/wizards/source/schedule/DlgCalendar.xdl
new file mode 100644
index 000000000000..b3874d002615
--- /dev/null
+++ b/wizards/source/schedule/DlgCalendar.xdl
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" dlg:id="DlgCalendar" dlg:style-id="0">
+ <dlg:styles>
+ <dlg:style dlg:style-id="0"/>
+ </dlg:styles>
+</dlg:window> \ No newline at end of file
diff --git a/wizards/source/schedule/DlgControl.xba b/wizards/source/schedule/DlgControl.xba
new file mode 100644
index 000000000000..659f8c02fd2c
--- /dev/null
+++ b/wizards/source/schedule/DlgControl.xba
@@ -0,0 +1,369 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="DlgControl" script:language="StarBasic">Option Explicit
+
+Dim CalBitmap As Object
+
+
+Sub Main()
+ Call CalAutopilotTable()
+End Sub
+
+
+Sub CalSaveTextValues()
+ txtYear.Tag = txtYear.Text
+ txtMonth.Tag = txtMonth.Text
+End Sub
+
+
+Sub CalRestoreOldValues()
+ Beep
+ &apos; Start of the Gregorian Calendar
+ If int(Val(txtyear.Text)) &lt; 1583 then
+ txtYear.Text = &quot;1583&quot;
+ Else
+ &apos; last year where the easter Routin works
+ txtYear.Text = &quot;9956&quot;
+ End If
+ txtMonth.Text = txtMonth.Tag
+End Sub
+
+
+
+Sub CalChangeYear()
+ Dim ValNewYear&amp;
+ ValNewYear&amp; = Val(txtYear.Text)
+ If ((1583 &gt; ValNewYear&amp;) Or (9956 &lt; ValNewYear&amp;)) Then
+ Call CalRestoreOldValues()
+ End If
+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
+ 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
+End Sub
+
+
+
+Sub ModIntTextBox (txtYear As Object, ByVal nMax%, ByVal nMin%, ByVal sDefault$, IncFactor as Integer)
+ Dim nActVal&amp;
+ nActVal&amp; = Val(txtYear.Text)
+ If ((0 = nActVal&amp;) Or (nMax% &lt; nActVal&amp;) Or (nMin% &gt; nActVal&amp;)) Then
+ Beep
+ txtYear.Text = sDefault$
+ Exit Sub
+ End If
+ If IncFactor = 1 Then
+ If nMax% &gt; nActVal&amp; Then
+ txtYear.Text = Trim(Str(nActVal&amp; + 1))
+ Else
+ Beep
+ txtYear.Text = nMax%
+ End if
+ ElseIf IncFactor = -1 Then
+ If nMin% &lt; nActVal&amp; Then
+ txtYear.Text = Trim(Str(nActVal&amp; - 1))
+ Else
+ Beep
+ txtYear.Text = nMin%
+ End if
+ End If
+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
+End Sub
+
+
+Sub CalMouseMoved(Button as integer, Shift as integer, X as single, Y as single)
+
+ &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
+ End Select
+
+ LastMousePosX = X
+ LastMousePosY = Y
+End Sub
+
+
+Sub CalChangeGeneralMonth()
+
+ Dim MonthToCheck$
+ Dim ValMonthToCheck%
+
+ MonthToCheck$ = DlgBuffer.txtMonth.Text
+ ValMonthToCheck% = Val(MonthToCheck$)
+
+ If (ValMonthToCheck% &gt;= 1) And (ValMonthToCheck% &lt;=12) Then
+ DlgBuffer.txtMonth.Text = cCalShortMonthNames$(ValMonthToCheck%)
+ Exit Sub
+ End If
+
+ If CalGetIntOfShortMonthName%(Trim(Left(MonthToCheck$, 3))) = 0 Then
+ Beep
+ DlgBuffer.txtMonth.Text = DlgBuffer.txtMonth.Tag
+ Else
+ DlgBuffer.txtMonth.Text = Trim(Left(MonthToCheck, 3))
+ End If
+
+End Sub
+
+
+
+Sub CalChkForChangeInsertAccept
+ &apos; Aktualisiert die Caption des Insert/Accept Buttons
+ If (DataSelectedFromList=True) And (ButtonCaptionIsInsert) Then
+ DlgBuffer.cmdInsert.Caption = 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()
+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$
+ Else
+ DlgBuffer.CurrentStep = 1
+ DlgBuffer.DlgCmdOwnData.Caption = cCalSubcmdSwitchOwnDataOrGeneral_OwnData$
+ End If
+End Sub
+
+
+Sub LoadDialog()
+ DlgBuffer.load
+End Sub
+
+Sub ShowDialog()
+ DlgBuffer.Show
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/schedule/Language.xba b/wizards/source/schedule/Language.xba
new file mode 100644
index 000000000000..2289db2c17a0
--- /dev/null
+++ b/wizards/source/schedule/Language.xba
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<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;
+Public Const cLANGUAGE_ITALIAN = &quot;it&quot;, cLANGUAGE_JAPANESE = &quot;ja&quot;, cLANGUAGE_NORWEGIAN = &quot;no&quot;
+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
+
+
+&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
+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
+
+ &apos; Load all states
+ BLNameList(1) = &quot;Bayern&quot;
+ BLNameList(2) = &quot;Baden-Württemberg&quot;
+ BLNameList(3) = &quot;Berlin&quot;
+ BLNameList(4) = &quot;Bremen&quot;
+ BLNameList(5) = &quot;Brandenburg&quot;
+ BLNameList(6) = &quot;Hamburg&quot;
+ BLNameList(7) = &quot;Hessen&quot;
+ BLNameList(8) = &quot;Mecklenburg-Vorpommern&quot;
+ BLNameList(9) = &quot;Niedersachsen&quot;
+ BLNameList(10) = &quot;Nordrhein-Westfalen&quot;
+ BLNameList(11) = &quot;Rheinland-Pfalz&quot;
+ BLNameList(12) = &quot;Saarland&quot;
+ BLNameList(13) = &quot;Sachsen&quot;
+ 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
+ Else
+ DlgBuffer.lblSpecBankholidays.Visible = False
+ DlgBuffer.cmbState.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)
+ 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
new file mode 100644
index 000000000000..e05a3cd5cd6d
--- /dev/null
+++ b/wizards/source/schedule/OwnEvents.xba
@@ -0,0 +1,348 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="OwnEvents" script:language="StarBasic">Option Explicit
+
+Sub Main
+ Call CalAutopilotTable()
+End Sub
+
+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%
+ 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
+ kill(FileName$)
+ End If
+
+ FileChannel% = FreeFile()
+ Open FileName$ For OUTPUT Access WRITE LOCK WRITE As FileChannel%
+
+ Write #FileChannel%, &quot;==========================================================&quot;
+ Write #FileChannel%, &quot;Don&apos;t edit this file,&quot;
+ Write #FileChannel%, &quot;Don&apos;t edit this file!&quot;
+ Write #FileChannel%, &quot;----------------------------------------------------------&quot;
+ 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%)
+ Next
+
+ Close #FileChannel%
+End Sub
+
+
+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%
+ FileName$ = GetPathSettings(&quot;Config&quot;, False)+ GetPathSeparator() + &quot;DATE.DAT&quot;
+
+ If Dir(FileName$) = &quot;DATE.DAT&quot; Then
+ FileChannel% = FreeFile()
+ Open FileName$ For INPUT Access READ LOCK READ As FileChannel%
+
+ &apos; Kommentare werden eingelesen
+ For Count% = 1 To 6
+ Line Input #FileChannel%, tempStr$
+ Next
+
+ &apos; Einfügen nach Reihenfolge sortiert.
+ While (not eof(#FileChannel%))
+ Input #FileChannel%, tempStr$
+ DlgBuffer.lbOwnData.AddItem(tempStr$)
+ Wend
+
+ Close #FileChannel%
+ End If
+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
+ 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;))
+ End If
+ CalCreateDateFromInput&amp; = newDate&amp;
+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;
+ End If
+
+ 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)
+ Else
+ DateStr$ = DateStr$ + &quot; &quot;
+ End If
+ DateStr$ = DateStr$ + &quot; &quot; + Trim(txtEvent.Text)
+ CalCreateDateStrOfInput$ = DateStr$
+End Function
+
+
+Function CalGetDateWithoutYear&amp;(byval Pos%)
+ CalGetDateWithoutYear&amp; = DateSerial(0, CalGetMonthOfEvent(Pos%), CalGetDayOfEvent(Pos%))
+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%
+
+ Inserted% = False
+ 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
+ &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
+ 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
+
+ &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
+ 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
+ End If
+
+ &apos; Flag zum Speichern der neuen Daten.
+ If Inserted% = True Then
+ CalOwnDataChanged% = 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 Pos%)
+ CalGetYearOfEvent% = Val(Mid$(lbOwnData.List(Pos%), 10, 4))
+End Function
+
+
+Function CalGetDayOfEvent%(byval Pos%)
+ CalGetDayOfEvent% = Val(Mid$(lbOwnData.List(Pos%), 1, 2))
+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$)
+End Function
+
+
+</script:module> \ No newline at end of file