优化项目结构、优化 maven 结构

This commit is contained in:
chenkailing
2021-02-10 00:58:13 +08:00
parent 28d3e05ca9
commit 2542a24675
3610 changed files with 77 additions and 180 deletions

View File

@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<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%
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
&apos; Note: the following algorithm is valid only till the Year 2100.
&apos; but I have no Idea from which date in the paste it is valid
Function CalOrthodoxEasterTable(ByVal iYear as Integer) as Long
Dim R1%, R2%, R3%, RA%, R4%, RB%, R5%, RC%
Dim lDate as Long
R1 = iYear mod 19
R2 = iYear mod 4
R3 = iYear mod 7
RA =19 * R1 + 16
R4 = RA mod 30
RB = 2 * R2 + 4 * R3 + 6 * R4
R5 = RB mod 7
RC = R4 + R5
lDate = DateSerial(iYear, 4,4)
CalOrthodoxEasterTable() = lDate + RC
End Function
Sub CalInitGlobalVariablesDate()
Dim i as Integer
For i = 1 To 374
CalBankholidayName$(i) = &quot;&quot;
CalTypeOfBankHoliday%(i) = cHolidayType_None
Next
End Sub
Sub CalInsertBankholiday(byval CurDate as Long, byval EventName as String, ByVal iLevel as Integer)
Dim iDay
iDay =(Month(CurDate)-1)*31 +Day(CurDate)
If 0 &lt;&gt; CalTypeOfBankHoliday(iDay) Then
If iLevel &lt; CalTypeOfBankHoliday(iDay) Then
CalTypeOfBankHoliday(iDay) = iLevel
End If
Else
CalTypeOfBankHoliday(iDay) = iLevel
End If
If CalBankHolidayName(iDay) = &quot;&quot; Then
CalBankHolidayName(iDay) = EventName
Else
CalBankHolidayName(iDay) = CalBankHolidayName(iDay) &amp; &quot; / &quot; &amp; EventName
End If
End Sub
Function CalMaxDayInMonth(ByVal iYear as Integer, ByVal iMonth as Integer) as Integer
&apos; delivers the maximum Day of a month in a certain year
Dim TmpDate as Long
Dim MaxDay as Long
MaxDay = 28
TmpDate = DateSerial(iYear, iMonth, MaxDay)
While Month(TmpDate) = iMonth
MaxDay = MaxDay + 1
TmpDate = TmpDate + 1
Wend
Maxday = MaxDay - 1
CalMaxDayInMonth() = MaxDay
End Function
Function CalGetIntOfShortMonthName(ByVal MonthName as String) as Integer
Dim i as Integer
Dim nMonth as Integer
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 i = 0 To 11
If (UCase(cCalShortMonthNames(i)) = MonthName) Then
CalGetIntOfShortMonthName = i+1
Exit Function
End If
Next
&apos; Not Found
CalGetIntOfShortMonthName = 0
End Function
Sub CalInsertOwnDataInTables(ByVal iSelYear as Integer)
&apos; inserts the individual data from the table into the previously unsorted list
Dim CurEventName as String
Dim CurEvMonth as Integer
Dim CurEvDay as Integer
Dim LastIndex as Integer
Dim i as Integer
Dim DateStr as String
LastIndex = Ubound(DlgCalModel.lstOwnData.StringItemList())
For i = 0 To LastIndex
If GetSelectedDateUnits(CurEvDay, CurEvMonth, i) &lt;&gt; SBDATEUNDEFINED Then
CurEventName = CalGetNameOfEvent(i)
CalInsertBankholiday(DateSerial(iSelYear, CurEvMonth, CurEvDay), CurEventName, 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(YearInt as Integer, iMonth as Integer, iWeekDay as Integer, iOffset as Integer)
Dim bFound as Boolean
Dim lDate as Long
&apos; 1st Tue in Nov : Election Day, Half
bFound = False
lDate = DateSerial(YearInt, iMonth, 1)
Do
If iWeekDay = WeekDay(lDate) Then
bFound = True
Else
lDate = lDate + 1
End If
Loop Until bFound
GetMonthDate = lDate + iOffset
End Function
&apos; Finds the next weekday after a fixed date
&apos; e.g. Midsummerfeast in Sweden: next Saturday after 20th June
Function GetNextWeekDay(iYear as Integer, iMonth as Integer, iDay as Integer, iWeekDay as Integer)
Dim lDate as Long
Dim iCurWeekDay as Integer
lDate = DateSerial(iYear, iMonth, iDay)
iCurWeekDay = WeekDay(lDate)
While iCurWeekDay &lt;&gt; iWeekDay
lDate = lDate + 1
iCurWeekDay = WeekDay(lDate)
Wend
GetNextWeekDay() = lDate
End Function
Sub AddFollowUpHolidays(ByVal lStartDate as Long, iCount as Integer, HolidayName as String, iType as Integer)
Dim lDate as Long
For lDate = lStartDate + 1 To lStartDate + 4
CalInsertBankholiday(lDate, HolidayName, iType)
Next lDate
End Sub
</script:module>

View File

@@ -0,0 +1,322 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<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
Public sCurCountryLocale as String
&apos; This flag serves as a query if the individual Data should be saved
Public bCalOwnDataChanged as Boolean
&apos;BankHoliday Functions
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
Public cCalSubcmdDeleteSelect_DeleteSelEntry$
Public cCalSubcmdDeleteSelect_DeleteSelEntryTitle$
Public cCalSubcmdSwitchOwnDataOrGeneral_Back$
Public cCalSubcmdSwitchOwnDataOrGeneral_OwnData$
&apos;Language
Public cCalLongMonthNames(11) as String
Public cCalShortMonthNames(11) as String
Public sBitmapFilename$
Public sCalendarTitle$, sMonthTitle$, sWizardTitle$, sError$
Public cCalStyleWorkday$, cCalStyleWeekend$
Public CalChoosenLand as Integer
Public oDocument as Object
Public oSheets as Object
Public oSheet as Object
Public oStatusLine as Object
Public bCancelTask as Boolean
Public oNumberFormatter as Object
&apos; BL* means &quot;BundesLand&quot; (for german states only)
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
Public DlgCalendar as Object
Public DlgCalModel as Object
Public lDateFormat as Long
Public lDateStandardFormat as Long
Sub CalAutopilotTable()
Dim BitmapDir as String
Dim iThisMonth as Integer
&apos;On Error Goto ErrorHandler
BasicLibraries.LoadLibrary(&quot;Tools&quot;)
bSelectByMouseMove = True
oDocument = ThisComponent
oStatusline = oDocument.GetCurrentController.GetFrame.CreateStatusIndicator
ToggleWindow(False)
sCurLangLocale = oDocument.CharLocale.Language
sCurCountryLocale = oDocument.CharLocale.Country
DlgCalendar = LoadDialog(&quot;Schedule&quot;, &quot;DlgCalendar&quot;)
DlgCalModel = DlgCalendar.Model
LoadLanguage(sCurLangLocale)
CalInitGlobalVariablesDate()
BitmapDir = GetOfficeSubPath(&quot;Template&quot;,&quot;../wizard/bitmap&quot;)
DlgCalModel.imgCountry.ImageURL = BitmapDir &amp; sBitmapFilename
CalChoosenLand = -2
CalLoadOwnData()
With DlgCalModel
.cmdDelete.Enabled = False
.lstMonth.StringItemList() = cCalShortMonthNames()
Select Case sCurLangLocale
Case cLANGUAGE_JAPANESE
.lstOwnData.FontName = &quot;HG MinochoL&quot;
.txtEvent.FontName = &quot;HG MinchoL&quot;
Case cLANGUAGE_CHINESE
If oDocument.CharLocale.Country = &quot;CN&quot; Then
.lstOwnData.FontName = &quot;FZ Song Ti&quot;
.txtEvent.FontName = &quot;FZ Song Ti&quot;
Else
.lstOwnData.FontName = &quot;FZ Ming Ti&quot;
.txtEvent.FontName = &quot;FZ Ming Ti&quot;
End If
Case &quot;ko&quot;
.lstOwnData.FontName = &quot;Sun Gulim&quot;
.txtEvent.FontName = &quot;Sun Gulim&quot;
End Select
.lstOwnEventMonth.StringItemList() = cCalShortMonthNames()
.optYear.State = 1
.txtYear.Value = Year(Now())
.txtYear.Tag = .txtYear.Value
.Step = 1
End With
SetupNumberFormatter(sCurLangLocale, sCurCountryLocale)
CalChooseCalendar() &apos; month
iThisMonth = Month(Now)
DlgCalendar.GetControl(&quot;lstMonth&quot;).SelectItemPos(iThisMonth-1, True)
DlgCalendar.GetControl(&quot;lstHolidays&quot;).SelectItemPos(0,True)
DlgCalModel.cmdGoOn.DefaultButton = True
ToggleWindow(True)
DlgCalendar.GetControl(&quot;lblHolidays&quot;).Visible = sCurLangLocale = cLANGUAGE_GERMAN
DlgCalendar.GetControl(&quot;lstHolidays&quot;).Visible = sCurLangLocale = cLANGUAGE_GERMAN
fHeightCorrFactor = DlgCalendar.GetControl(&quot;imgCountry&quot;).Size.Height/198
fWidthCorrFactor = DlgCalendar.GetControl(&quot;imgCountry&quot;).Size.Width/166
DlgCalendar.Execute()
DlgCalendar.Dispose()
Exit Sub
ErrorHandler:
MsgBox(sError$, 16, sWizardTitle$)
End Sub
Sub SetupNumberFormatter(sCurLangLocale as String, sCurCountryLocale as String)
Dim oFormats as Object
Dim DateFormatString as String
oFormats = oDocument.getNumberFormats()
Select Case sCurLangLocale
Case cLANGUAGE_GERMAN
DateFormatString = &quot;TT.MMM&quot;
Case cLANGUAGE_ENGLISH
DateFormatString = &quot;MMM DD&quot;
Case cLANGUAGE_FRENCH
DateFormatString = &quot;JJ/MMM&quot;
Case cLANGUAGE_ITALIAN
DateFormatString = &quot;GG/MMM&quot;
Case cLANGUAGE_SPANISH
DateFormatString = &quot;DD/MMM&quot;
Case cLANGUAGE_PORTUGUESE
If sCurCountryLocale = &quot;BR&quot; Then
DateFormatString = &quot;DD/MMM&quot;
Else
DateFormatString = &quot;DD-MMM&quot;
End If
Case cLANGUAGE_DUTCH
DateFormatString = &quot;DD/MMM&quot;
Case cLANGUAGE_SWEDISH
DateFormatString = &quot;MMM DD&quot;
Case cLANGUAGE_DANISH
DateFormatString = &quot;DD-MMM&quot;
Case cLANGUAGE_POLISH
DateFormatString = &quot;MMM DD&quot;
Case cLANGUAGE_RUSSIAN
DateFormatString = &quot;MMM DD&quot;
Case cLANGUAGE_JAPANESE
DateFormatString = &quot;M月D日&quot;
Case cLANGUAGE_CHINESE
If sCurCountryLocale = &quot;TW&quot; Then
DateFormatString = &quot;MMMMD&quot; &amp;&quot;&quot;&quot;&quot; &amp; &quot;&quot; &amp; &quot;&quot;&quot;&quot;
Else
DateFormatString = &quot;M&quot; &amp; &quot;&quot;&quot;&quot; &amp; &quot;&quot; &amp; &quot;&quot;&quot;&quot; &amp; &quot;D&quot; &amp;&quot;&quot;&quot;&quot; &amp; &quot;&quot; &amp; &quot;&quot;&quot;&quot;
End If
Case cLANGUAGE_GREEK
DateFormatString = &quot;DD/MMM&quot;
Case cLANGUAGE_TURKISH
DateFormatString = &quot;DD/MMM&quot;
Case cLANGUAGE_POLISH
DateFormatString = &quot;MMM DD&quot;
Case cLANGUAGE_FINNISH
DateFormatString = &quot;PP.KKK&quot;
End Select
lDateFormat = AddNumberFormat(oFormats, DateFormatString, oDocument.CharLocale)
lDateStandardFormat = oFormats.getStandardFormat(com.sun.star.util.NumberFormat.DATE, oDocument.CharLocale)
&apos; lDateStandardFormat = AddNumberFormat(oFormats, StandardDateFormatString, oDocument.CharLocale)
oNumberFormatter = createUNOService(&quot;com.sun.star.util.NumberFormatter&quot;)
oNumberFormatter.attachNumberFormatsSupplier(oDocument)
End Sub
Function AddNumberFormat(oNumberFormats as Object, FormatString as String, oLocale as Object) as Long
Dim lLocDateFormat as Long
lLocDateFormat = oNumberFormats.QueryKey(FormatString, oLocale, True)
If lLocDateFormat = -1 Then
lLocDateFormat = oNumberFormats.addNew(FormatString, oLocale)
End If
AddNumberFormat() = lLocDateFormat
End Function
Sub CalChooseCalendar()
With DlgCalModel
.lstMonth.Enabled = .optMonth.State = 1
.lblMonth.Enabled = .optMonth.State = 1
End With
End Sub
Sub CalcmdCancel()
Call CalSaveOwnData()
DlgCalendar.EndExecute
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
&apos; DlgCalendar.Visible = False
oSheets = oDocument.sheets
Call CalSaveOwnData()
UnprotectSheets(oSheets)
oSheets.RemovebyName(oSheets.GetbyIndex(0).Name)
iSelYear = DlgCalModel.txtYear.Value
Select Case sCurLangLocale
Case cLANGUAGE_GERMAN
If Ubound(DlgCalModel.lstHolidays.SelectedItems()) &gt; -1 Then
CalChoosenLand = DlgCalModel.lstHolidays.SelectedItems(0)
Else
CalChoosenLand = 0
End If
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)
Case cLANGUAGE_JAPANESE
Call FindWholeYearHolidays_JP(iSelYear)
Case cLANGUAGE_CHINESE
If sCurCountryLocale = &quot;TW&quot; Then
Call FindWholeYearHolidays_TW(iSelYear)
Else
Call FindWholeYearHolidays_CN(iSelYear)
End If
Case cLANGUAGE_GREEK
Call FindWholeYearHolidays_GREEK(iSelYear)
Case cLANGUAGE_TURKISH
Call FindWholeYearHolidays_TRK(iSelYear)
Case cLANGUAGE_POLISH
Call FindWholeYearHolidays_PL(iSelYear)
Case cLANGUAGE_FINNISH
Call FindWholeYearHolidays_FI(iSelYear)
End Select
Call CalInsertOwnDataInTables(iSelYear)
If DlgCalModel.optYear.State = 1 Then
oSheets.RemovebyName(oSheets.GetbyIndex(0).Name)
oSheet = oSheets.GetbyIndex(0)
oSheet.Name = sCalendarTitle$ + &quot; &quot; + iSelYear
oDocument.AddActionLock
Call CalCreateYearTable(iSelYear)
ElseIf DlgCalModel.optMonth.State = 1 Then
Dim iMonth
iMonth = DlgCalModel.lstMonth.SelectedItems(0) + 1
oSheets.RemovebyName(oSheets.GetbyIndex(1).Name)
oSheet = oSheets.GetbyIndex(0)
If sMonthTitle = &quot;&quot; Then
oSheet.Name = cCalLongMonthNames(iMonth-1)
Else
oSheet.Name = sMonthTitle + &quot; &quot; + cCalLongMonthNames(iMonth-1)
End If
oDocument.AddActionLock
Call CalCreateMonthTable(iSelYear, iMonth)
End If
oDocument.RemoveActionLock
oSheet.protect(&quot;&quot;)
oStatusLine.End
DlgCalendar.EndExecute()
bCancelTask = True
End Sub
</script:module>

View File

@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<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 iSelYear as Integer)
&apos; Completes the overview for whole year
&apos; Needed by StarOffice Calc and StarOffice Schedule
Dim CalDay as Integer
Dim CalMonth as Integer
Dim i as Integer
Dim s as Integer
Dim oYearCell as object
Dim iDate
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
&apos; On Error Goto ErrorHandling
oStatusLine.Start(&quot;&quot;,140) &apos;GetResText(sProgress)
iDate = DateSerial(iSelYear,1,1)
oYearCell = oSheet.GetCellRangeByName(&quot;Year&quot;)
oYearCell.Value = iSelYear
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(iSelYear) 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 iSelYear as Integer, iSelMonth as Integer)
Dim oMonthCell, oDateCell as Object
Dim iDate as Date
Dim oAddress
Dim i, s as Integer
Dim iStartDay as Integer
&apos; Completes the monthly calendar
&apos;On Error Goto ErrorHandling
oStatusLine.Start(&quot;&quot;,40) &apos;GetResText(sProgess)
&apos; Set month
oMonthCell = oSheet.GetCellRangeByName(&quot;Month&quot;)
iDate = DateSerial(iSelYear,iSelMonth,1)
oMonthCell.Value = iDate
&apos; Inserting holidays
iStartDay = (iSelMonth - 1) * 31 + 1
s = 5
For i = iStartDay To iStartDay + 30
oStatusLine.SetValue(s)
s = s + 1
FormatCalCells(DateColumn+1,FirstDayRow + i - iStartDay,i)
Next
oDateCell = oSheet.GetCellbyPosition(DateColumn,FirstDayRow+i-iStartDay - 1)
oAddress = oDateCell.RangeAddress
Select Case iSelMonth
Case 2,4,6,9,11
oSheet.RemoveRange(oAddress, com.sun.star.sheet.CellDeleteMode.ROWS)
If iSelMonth = 2 Then
oAddress.StartRow = oAddress.StartRow - 1
oAddress.EndRow = oAddress.StartRow
oSheet.RemoveRange(oAddress, com.sun.star.sheet.CellDeleteMode.ROWS)
If Not CalIsLeapYear(iSelYear) 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>

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Dialog1" dlg:left="160" dlg:top="81" dlg:width="208" dlg:height="156" dlg:page="1" dlg:help-url="HID:WIZARDS_HID_DLGHOLIDAYCAL_DIALOG" dlg:closeable="true" dlg:moveable="true">
<dlg:styles>
<dlg:style dlg:style-id="0" dlg:border="none"/>
<dlg:style dlg:style-id="1" dlg:font-name="Cumberland" dlg:font-stylename="Standard" dlg:font-family="modern" dlg:font-charset="ansi"/>
<dlg:style dlg:style-id="2" dlg:font-name="Cumberland" dlg:font-stylename="Standard" dlg:font-family="modern" dlg:font-charset="ansi"/>
</dlg:styles>
<dlg:bulletinboard>
<dlg:menulist dlg:id="lstHolidays" dlg:tab-index="0" dlg:left="6" dlg:top="17" dlg:width="95" dlg:height="12" dlg:page="1" dlg:help-url="HID:WIZARDS_HID_DLGHOLIDAYCAL_1_CMBSTATE" dlg:spin="true"/>
<dlg:fixedline dlg:id="hlnCalendar" dlg:tab-index="1" dlg:left="6" dlg:top="36" dlg:width="95" dlg:height="8" dlg:page="1" dlg:value="hlnCalendar"/>
<dlg:radiogroup>
<dlg:radio dlg:id="optYear" dlg:tab-index="2" dlg:left="12" dlg:top="47" dlg:width="81" dlg:height="10" dlg:page="1" dlg:help-url="HID:WIZARDS_HID_DLGHOLIDAYCAL_1_OPYEAR" dlg:value="optYear">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Schedule.CalendarMain.CalChooseCalendar?language=Basic&amp;location=application" script:language="Script"/>
</dlg:radio>
<dlg:radio dlg:id="optMonth" dlg:tab-index="3" dlg:left="12" dlg:top="61" dlg:width="81" dlg:height="10" dlg:page="1" dlg:help-url="HID:WIZARDS_HID_DLGHOLIDAYCAL_1_OPMONTH" dlg:value="optMonth">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Schedule.CalendarMain.CalChooseCalendar?language=Basic&amp;location=application" script:language="Script"/>
</dlg:radio>
</dlg:radiogroup>
<dlg:text dlg:id="lblHolidays" dlg:tab-index="4" dlg:left="6" dlg:top="6" dlg:width="96" dlg:height="8" dlg:page="1" dlg:value="lblHolidays"/>
<dlg:img dlg:style-id="0" dlg:id="imgCountry" dlg:tab-index="5" dlg:left="106" dlg:top="6" dlg:width="95" dlg:height="113" dlg:page="1" dlg:help-url="HID:WIZARDS_HID_DLGHOLIDAYCAL_1_PREVIEW">
<script:event script:event-name="on-mousedown" script:macro-name="vnd.sun.star.script:Schedule.DlgControl.SelectState?language=Basic&amp;location=application" script:language="Script"/>
<script:event script:event-name="on-mouseout" script:macro-name="vnd.sun.star.script:Schedule.DlgControl.MouseLeavesImage?language=Basic&amp;location=application" script:language="Script"/>
<script:event script:event-name="on-mousemove" script:macro-name="vnd.sun.star.script:Schedule.DlgControl.CalMouseMoved?language=Basic&amp;location=application" script:language="Script"/>
</dlg:img>
<dlg:fixedline dlg:id="hlnTime" dlg:tab-index="6" dlg:left="5" dlg:top="78" dlg:width="95" dlg:height="8" dlg:page="1" dlg:value="hlnTime"/>
<dlg:menulist dlg:id="lstMonth" dlg:tab-index="7" dlg:left="62" dlg:top="106" dlg:width="38" dlg:height="12" dlg:page="1" dlg:help-url="HID:WIZARDS_HID_DLGHOLIDAYCAL_1_EDMONTH" dlg:spin="true"/>
<dlg:text dlg:id="lblYear" dlg:tab-index="8" dlg:left="12" dlg:top="91" dlg:width="46" dlg:height="8" dlg:page="1" dlg:value="lblYear"/>
<dlg:text dlg:id="lblMonth" dlg:tab-index="9" dlg:left="12" dlg:top="108" dlg:width="46" dlg:height="8" dlg:page="1" dlg:value="lblMonth"/>
<dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="10" dlg:left="6" dlg:top="125" dlg:width="196" dlg:height="4"/>
<dlg:button dlg:id="cmdCancel" dlg:tab-index="11" dlg:left="6" dlg:top="136" dlg:width="50" dlg:height="14" dlg:help-url="HID:WIZARDS_HID_DLGHOLIDAYCAL_0_CMDCANCEL" dlg:value="cmdCancel">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Schedule.CalendarMain.CalcmdCancel?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
<dlg:button dlg:id="cmdOwnData" dlg:tab-index="12" dlg:left="99" dlg:top="136" dlg:width="50" dlg:height="14" dlg:help-url="HID:WIZARDS_HID_DLGHOLIDAYCAL_0_CMDOWNDATA" dlg:value="cmdOwnData">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Schedule.DlgControl.CalmdSwitchOwnDataOrGeneral?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
<dlg:button dlg:id="cmdGoOn" dlg:tab-index="13" dlg:left="152" dlg:top="136" dlg:width="50" dlg:height="14" dlg:help-url="HID:WIZARDS_HID_DLGHOLIDAYCAL_0_CMDOK" dlg:value="cmdGoOn">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Schedule.CalendarMain.CalcmdOk?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
<dlg:text dlg:id="lblEvent" dlg:tab-index="14" dlg:left="12" dlg:top="17" dlg:width="67" dlg:height="8" dlg:page="2" dlg:value="lblEvent"/>
<dlg:fixedline dlg:id="hlnNewEvent" dlg:tab-index="15" dlg:left="6" dlg:top="6" dlg:width="196" dlg:height="8" dlg:page="2" dlg:value="hlnNewEvent"/>
<dlg:textfield dlg:style-id="1" dlg:id="txtEvent" dlg:tab-index="16" dlg:left="12" dlg:top="28" dlg:width="107" dlg:height="12" dlg:page="2" dlg:help-url="HID:WIZARDS_HID_DLGHOLIDAYCAL_2_EDEVENT">
<script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:Schedule.OwnEvents.CheckInsertedDates?language=Basic&amp;location=application" script:language="Script"/>
</dlg:textfield>
<dlg:numericfield dlg:id="txtOwnEventDay" dlg:tab-index="17" dlg:left="13" dlg:top="55" dlg:width="30" dlg:height="12" dlg:page="2" dlg:help-url="HID:WIZARDS_HID_DLGHOLIDAYCAL_2_EDEVENTDAY" dlg:decimal-accuracy="0" dlg:value-min="1" dlg:spin="true">
<script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:Schedule.OwnEvents.CheckInsertedDates?language=Basic&amp;location=application" script:language="Script"/>
</dlg:numericfield>
<dlg:menulist dlg:id="lstOwnEventMonth" dlg:tab-index="18" dlg:left="60" dlg:top="55" dlg:width="30" dlg:height="12" dlg:page="2" dlg:help-url="HID:WIZARDS_HID_DLGHOLIDAYCAL_2_EDEVENTMONTH" dlg:spin="true">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:Schedule.OwnEvents.GetOwnMonth?language=Basic&amp;location=application" script:language="Script"/>
</dlg:menulist>
<dlg:button dlg:id="cmdInsert" dlg:tab-index="19" dlg:left="99" dlg:top="70" dlg:width="50" dlg:height="14" dlg:page="2" dlg:help-url="HID:WIZARDS_HID_DLGHOLIDAYCAL_2_CMDINSERT" dlg:value="cmdInsert">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Schedule.OwnEvents.CalcmdInsertData?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
<dlg:button dlg:id="cmdDelete" dlg:tab-index="20" dlg:left="152" dlg:top="70" dlg:width="50" dlg:height="14" dlg:page="2" dlg:help-url="HID:WIZARDS_HID_DLGHOLIDAYCAL_2_CMDDELETE" dlg:value="cmdDelete">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Schedule.DlgControl.CalcmdDeleteSelect?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
<dlg:menulist dlg:style-id="2" dlg:id="lstOwnData" dlg:tab-index="21" dlg:left="12" dlg:top="86" dlg:width="190" dlg:height="34" dlg:page="2" dlg:help-url="HID:WIZARDS_HID_DLGHOLIDAYCAL_2_LBOWNDATA">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:Schedule.DlgControl.CalUpdateNewEventFrame?language=Basic&amp;location=application" script:language="Script"/>
</dlg:menulist>
<dlg:text dlg:id="lblEventDay" dlg:tab-index="22" dlg:left="12" dlg:top="44" dlg:width="44" dlg:height="8" dlg:page="2" dlg:value="lblEventDay"/>
<dlg:text dlg:id="lblEventMonth" dlg:tab-index="23" dlg:left="60" dlg:top="44" dlg:width="44" dlg:height="8" dlg:page="2" dlg:value="lblEventMonth"/>
<dlg:numericfield dlg:id="txtYear" dlg:tab-index="24" dlg:left="62" dlg:top="89" dlg:width="38" dlg:height="12" dlg:page="1" dlg:help-url="HID:WIZARDS_HID_DLGHOLIDAYCAL_1_EDYEAR" dlg:decimal-accuracy="0" dlg:value-min="1582" dlg:value-max="9957" dlg:spin="true"/>
</dlg:bulletinboard>
</dlg:window>

View File

@@ -0,0 +1,168 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="DlgControl" script:language="StarBasic">Option Explicit
Dim CalBitmap As Object
Public bSelectByMouseMove as Boolean
Public fHeightCorrFactor as Double
Public fWidthCorrFactor as Double
Sub Main()
Call CalAutopilotTable()
End Sub
Sub CalcmdDeleteSelect()
Dim MsgBoxResult as Integer
Dim bDoEnable as Boolean
Dim iSel as Integer
Dim MaxIndex as Integer
If Ubound(DlgCalModel.lstOwnData.SelectedItems()) &gt; -1 Then
MsgBoxResult = MsgBox(cCalSubcmdDeleteSelect_DeleteSelEntry$, 4+32, cCalSubcmdDeleteSelect_DeleteSelEntryTitle$)
If MsgBoxResult = 6 Then
iSel = DlgCalModel.lstOwnData.SelectedItems(0)
DlgCalModel.lstOwnData.StringItemList() = RemoveSelected(DlgCalModel.lstOwnData)
&apos; Flag to store the new data
bCalOwnDataChanged = True
bDoEnable = Ubound(DlgCalModel.lstOwnData.StringItemList()) &gt; -1
DlgCalModel.cmdDelete.Enabled = bDoEnable
If bDoEnable Then
MaxIndex = Ubound(DlgCalModel.lstOwnData.StringItemList())
If iSel &gt; MaxIndex Then
iSel = MaxIndex
End If
DlgCalendar.GetControl(&quot;lstOwnData&quot;).SelectItemPos(iSel, True)
CalUpdateNewEventFrame()
Else
Call CalClearInputMask()
End If
End If
End If
End Sub
Sub CalSaveOwnEventControls()
With DlgCalModel
.txtOwnEventDay.Tag = .txtOwnEventDay.Value
.txtOwnEventMonth.Tag = .txtOwnEventMonth.Text
End With
End Sub
Sub CalMouseMoved(aEvent as object)
Dim ListIndex as Integer
Select Case sCurLangLocale
Case cLANGUAGE_GERMAN
If bSelectByMouseMove Then
&apos; oStatusLine.SetText(&quot;Position: &quot; &amp; aEvent.X &amp; &quot; ; &quot; &amp; aEvent.Y)
ListIndex = CalGetGermanLandAtMousePos(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor))
DlgCalendar.GetControl(&quot;lstHolidays&quot;).SelectItemPos(ListIndex, True)
End If
End Select
End Sub
Sub SelectState(aEvent as Object)
Dim ListIndex as Integer
Select Case sCurLangLocale
Case cLANGUAGE_GERMAN
If aEvent.ClickCount &gt;= 1 Then
ListIndex = CalGetGermanLandAtMousePos(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor))
DlgCalendar.GetControl(&quot;lstHolidays&quot;).SelectItemPos(ListIndex, True)
bSelectByMouseMove = False
End If
End Select
End Sub
Sub MouseLeavesImage
bSelectbyMouseMove = True
End Sub
Sub CalClearInputMask()
Dim NullList() as String
With DlgCalModel
.txtEvent.Text = &quot;&quot;
.txtOwnEventDay.SetPropertyToDefault(&quot;Value&quot;)
.cmdInsert.Enabled = False
End With
If Ubound(DlgCalModel.lstOwnData.StringItemList()) &gt; -1 Then
If Ubound(DlgCalModel.lstOwnData.SelectedItems()) = -1 Then
DlgCalendar.GetControl(&quot;lstOwnData&quot;).SelectItemPos(0,True)
CalUpdateNewEventFrame()
End If
End If
End Sub
Sub CalmdSwitchOwnDataOrGeneral()
If DlgCalModel.Step = 1 Then
DlgCalModel.Step = 2
DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_Back$
DlgCalModel.cmdInsert.Enabled = DlgCalModel.txtEvent.Text &lt;&gt; &quot;&quot;
&apos; ToggleYearBox()
Else
dim bla as boolean
DlgCalModel.Step = 1
DlgCalendar.GetControl(&quot;lblHolidays&quot;).Visible = sCurLangLocale = cLANGUAGE_GERMAN
DlgCalendar.GetControl(&quot;lstHolidays&quot;).Visible = sCurLangLocale = cLANGUAGE_GERMAN
DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_OwnData$
End If
End Sub
Sub ToggleInsertButton()
DlgCalModel.cmdInsert.Enabled = LTrim(DlgCalModel.txtEvent.Text) &lt;&gt; &quot;&quot;
End Sub
Sub CalUpdateNewEventFrame()
Dim bDoEnable as Boolean
Dim sSelectedItem
Dim ListIndex as Integer
Dim MaxSelIndex as Integer
Dim CurEvMonth as Integer
Dim CurEvDay as Integer
Dim DateStr as String
bDoEnable = False
With DlgCalModel
MaxSelIndex = Ubound(DlgCalModel.lstOwnData.SelectedItems())
If MaxSelIndex &gt; -1 Then
ListIndex = .lstOwnData.SelectedItems(MaxSelIndex)
.txtEvent.Text = CalGetNameofEvent(ListIndex)
If GetSelectedDateUnits(CurEvDay, CurEvMonth, ListIndex) &lt;&gt; SBDATEUNDEFINED Then
.txtOwnEventDay.Value = CurEvDay
DlgCalendar.GetControl(&quot;lstOwnEventMonth&quot;).SelectItemPos(CurEvMonth-1, True)
.cmdDelete.Enabled = True
.cmdInsert.Enabled = True
Else
Call CalClearInputMask()
.cmdDelete.Enabled = True
End If
End If
End With
End Sub
</script:module>

View File

@@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="GermanHolidays" script:language="StarBasic">Option Explicit
Sub Main()
Call CalAutopilotTable()
End Sub
Function CalGetGermanLandAtMousePos(byval X as single, byval Y as single) as Integer
CalChoosenLand = 0
If (X&gt;73)And(X&lt;130)And(Y&gt;=117)And(Y&lt;181) Then
CalChoosenLand = CalBLBayern
ElseIf (X&gt;41)And(X&lt;89)And(Y&gt;=136)And(Y&lt;183) Then
CalChoosenLand = CalBLBadenWuert
ElseIf (X&gt;18)And(X&lt;35)And(Y&gt;136)And(Y&lt;147) Then
CalChoosenLand = CalBLSaarland
ElseIf (X&gt;13)And(X&lt;42)And(Y&gt;111)And(Y&lt;146) Then
CalChoosenLand = CalBLRheinlandPfalz
ElseIf (X&gt;15)And(X&lt;=60)And(Y&gt;=69)And(Y&lt;112) Then
CalChoosenLand = CalBLNordrheinWest
ElseIf (X&gt;=42)And(X&lt;78)And(Y&gt;=95)And(Y&lt;136) Then
CalChoosenLand = CalBLHessen
ElseIf (X&gt;=78)And(X&lt;112)And(Y&gt;=95)And(Y&lt;117) Then
CalChoosenLand = CalBLThueringen
ElseIf (X&gt;=112)And(X&lt;158)And(Y&gt;=88)And(Y&lt;114) Then
CalChoosenLand = CalBLSachsen
ElseIf (X&gt;77)And(X&lt;84)And(Y&gt;35)And(Y&lt;42) Then
CalChoosenLand = CalBLHamburg
ElseIf (X&gt;56)And(X&lt;60)And(Y&gt;36)And(Y&lt;41) Then
CalChoosenLand = CalBLBremen
ElseIf (X&gt;58)And(X&lt;63)And(Y&gt;44)And(Y&lt;52) Then
CalChoosenLand = CalBLBremen
ElseIf (X&gt;52)And(X&lt;95)And(Y&gt;8)And(Y&lt;40) Then
CalChoosenLand = CalBLSchlHolstein
ElseIf (X&gt;90)And(X&lt;149)And(Y&gt;23)And(Y&lt;48) Then
CalChoosenLand = CalBLMeckPomm
ElseIf (X&gt;28)And(X&lt;90)And(Y&gt;35)And(Y&lt;69) Then
CalChoosenLand = CalBLNiedersachsen
ElseIf (X&gt;60)And(X&lt;90)And(Y&gt;=69)And(Y&lt;95) Then
CalChoosenLand = CalBLNiedersachsen
ElseIf (X&gt;=90)And(X&lt;=115)And(Y&gt;47)And(Y&lt;95) Then
CalChoosenLand = CalBLSachsenAnhalt
ElseIf (X&gt;129)And(X&lt;139)And(Y&gt;60)And(Y&lt;66) Then
CalChoosenLand = CalBLBerlin
ElseIf (X&gt;115)And(X&lt;151)And(Y&gt;=48)And(Y&lt;88) Then
CalChoosenLand = CalBLBrandenburg
End If
CalGetGermanLandAtMousePos = CalChoosenLand
End Function
Sub CalFindWholeYearHolidays_GERMANY(ByVal iSelYear as Integer, ByVal iCountry as Integer)
Dim So as Integer
Dim OsternDate&amp;, VierterAdvent&amp;
If (iCountry &lt; 1) Or (iCountry &gt; 16) Then
iCountry = CalBLHamburg
End If
OsternDate&amp; = CalEasterTable&amp;(iSelYear)
So = 1
CalInsertBankholiday(DateSerial(iSelYear, 1, 1), &quot;Neujahr&quot;, cHolidayType_Full)
If (iCountry = CalBLBayern) Or (iCountry = CalBLBadenWuert) Or (iCountry = CalBLSachsenAnhalt) Then
CalInsertBankholiday(DateSerial(iSelYear, 1, 6), &quot;Hl. 3 Könige&quot;, cHolidayType_Full)
End If
CalInsertBankholiday(OsternDate&amp;-2, &quot;Karfreitag&quot;, cHolidayType_Full)
CalInsertBankholiday(OsternDate&amp;, &quot;Ostersonntag&quot;, cHolidayType_Full)
CalInsertBankholiday(OsternDate&amp;+1, &quot;Ostermontag&quot;, cHolidayType_Full)
CalInsertBankholiday(DateSerial(iSelYear, 5, 1), &quot;Maifeiertag&quot;, cHolidayType_Full)
CalInsertBankholiday(OsternDate&amp;+39, &quot;Christi Himmelfahrt&quot;, cHolidayType_Full)
CalInsertBankholiday(OsternDate&amp;+49, &quot;Pfingstsonntag&quot;, cHolidayType_Full)
CalInsertBankholiday(OsternDate&amp;+50, &quot;Pfingstmontag&quot;, cHolidayType_Full)
If (iCountry = CalBLBadenWuert) Or (iCountry = CalBLBayern) Or (iCountry = CalBLHessen) Or (iCountry = CalBLNordRheinWest) Or (iCountry = CalBLRheinlandPfalz) Or (iCountry = CalBLSaarland) Or (iCountry = CalBLSachsen) Or (iCountry = CalBLThueringen) Then
CalInsertBankholiday(OsternDate&amp;+60, &quot;Fronleichnam&quot;, cHolidayType_Full)
End If
If (iCountry = CalBLBayern) Or (iCountry = CalBLSaarland) Then
CalInsertBankholiday(DateSerial(iSelYear, 8, 15), &quot;Mariä Himmelfahrt&quot;, cHolidayType_Full)
End If
CalInsertBankholiday(DateSerial(iSelYear, 10, 3), &quot;Tag der dt. Einheit&quot;, cHolidayType_Full)
If (iCountry=CalBLBrandenburg) Or (iCountry=CalBLMeckPomm) Or (iCountry=CalBLSachsenAnhalt) Or (iCountry=CalBLSachsen) Or (iCountry=CalBLThueringen) Then
CalInsertBankholiday(DateSerial(iSelYear, 10, 31), &quot;Reformationstag&quot;, cHolidayType_Full)
End If
If (iCountry = CalBLBadenWuert) Or (iCountry = CalBLBayern) Or (iCountry = CalBLNordRheinWest) Or (iCountry = CalBLRheinlandPfalz) Or (iCountry = CalBLSaarland) Or (iCountry = CalBLSachsen) Or (iCountry = CalBLThueringen) Then
CalInsertBankholiday(DateSerial(iSelYear, 11, 1), &quot;Allerheiligen&quot;, cHolidayType_Full)
End If
vierterAdvent = DateSerial(iSelYear, 12, 24)
While WeekDay(vierterAdvent) &lt;&gt; So
vierterAdvent = vierterAdvent - 1
Wend
If iCountry = CalBLSachsen Then
CalInsertBankholiday(vierterAdvent-32, &quot;Buß- und Bettag&quot;, cHolidayType_Full)
Else
CalInsertBankholiday(vierterAdvent-32, &quot;Buß- und Bettag&quot;, cHolidayType_Half)
End If
CalInsertBankholiday(vierterAdvent-21, &quot;1. Advent&quot;, cHolidayType_Full)
CalInsertBankholiday(vierterAdvent-14, &quot;2. Advent&quot;, cHolidayType_Full)
CalInsertBankholiday(vierterAdvent-7, &quot;3. Advent&quot;, cHolidayType_Full)
CalInsertBankholiday(vierterAdvent, &quot;4. Advent&quot;, cHolidayType_Full)
CalInsertBankholiday(Dateserial(iSelYear, 12, 24), &quot;Heiligabend&quot;, cHolidayType_Half)
CalInsertBankholiday(Dateserial(iSelYear, 12, 25), &quot;1. Weihnachtstag&quot;, cHolidayType_Full)
CalInsertBankholiday(Dateserial(iSelYear, 12, 26), &quot;2. Weihnachtstag&quot;, cHolidayType_Full)
CalInsertBankholiday(Dateserial(iSelYear, 12, 31), &quot;Sylvester&quot;, cHolidayType_Half)
End Sub
</script:module>

View File

@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Language" script:language="StarBasic">Option Explicit
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(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
Sub LoadLanguage%(ByVal LangLocale)
Dim Dummy$
Dim i as Integer
Const dlgMonth = 1200
&apos; Abreviated months start 1225
Const dlgShortMonth = 1225
If InitResources(&quot;schedule&quot;, &quot;cal&quot;) Then
If LangLocale = cLANGUAGE_GERMAN Then
&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;
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;
DlgCalModel.lstHolidays.StringItemList() = BLNameList()
End If
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)
sBitmapFilename = ReplaceString(sBitmapFileName, &quot;.gif&quot;, &quot;.bmp&quot;)
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)
&apos; .lblEventYear.Label = GetResText(1023)
&apos; .chkEventOnce.Label = GetResText(1020)
.cmdInsert.Label = GetResText(1016)
.cmdDelete.Label = GetResText(1017)
&apos; Load long month names
For i = 0 To 11
cCalLongMonthNames(i) = GetResText(dlgMonth+i)
cCalShortMonthNames(i)= cCalLongMonthNames(i)
&apos;cCalShortMonthNames(i)= Left$(cCalLongMonthNames(i), 3)
cCalShortMonthNames(i)= RTrim(cCalShortMonthNames(i))
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>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,237 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="OwnEvents" script:language="StarBasic">Option Explicit
Public Const SBDATEUNDEFINED as Double = -98765432.1
Sub Main
Call CalAutopilotTable()
End Sub
Sub CalSaveOwnData()
Dim FileName as String
Dim FileChannel as Integer
Dim i as Integer
If bCalOwnDataChanged Then
FileName = GetPathSettings(&quot;UserConfig&quot;, False) &amp; &quot;/&quot; &amp; &quot;DATE.DAT&quot;
SaveDataToFile(FileName, DlgCalModel.lstOwnData.StringItemList())
End If
End Sub
Sub CalLoadOwnData()
Dim FileName as String
Dim LocList() as String
FileName = GetPathSettings(&quot;UserConfig&quot;, False) &amp; &quot;/DATE.DAT&quot;
If LoadDataFromFile(FileName, LocList()) Then
DlgCalModel.lstOwnData.StringItemList() = LocList()
End If
End Sub
Function CalCreateDateStrOfInput() as String
Dim DateStr as String
Dim CurOwnMonth as Integer
Dim CurOwnDay as Integer
Dim FormatDateStr as String
Dim dblDate as Double
Dim iLen as Integer
Dim iDiff as Integer
Dim i as Integer
CurOwnDay = DlgCalModel.txtOwnEventDay.Value
CurOwnMonth = DlgCalendar.GetControl(&quot;lstOwnEventMonth&quot;).getselectedItemPos() + 1
DateStr = DateSerial(0, CurOwnMonth, CurOwnDay)
dblDate = CDbl(DateValue(DateStr))
FormatDateStr = oNumberFormatter.convertNumberToString(lDateFormat, dblDate)
iLen = Len(FormatDateStr)
iDiff = 16 - iLen
If iDiff &gt; 0 Then
For i = 0 To iDiff
FormatDateStr = FormatDateStr + &quot; &quot;
Next i
Else
MsgBox(&quot;Invalid DateFormat: &apos;FormatDateStr&apos;&quot;, 16, sWizardTitle)
CalCreateDateStrOfInput = &quot;&quot;
Exit Function
End If
DateStr = FormatDateStr &amp; Trim(DlgCalModel.txtEvent.Text)
CalCreateDateStrOfInput = DateStr
End Function
Sub CalcmdInsertData()
Dim MaxIndex as Integer
Dim UIDateStr as String
Dim DateStr as String
Dim NewDate as Double
Dim bInserted as Boolean
Dim i as Integer
Dim CurOwnDay as Integer
Dim CurOwnMonth as Integer
Dim CurOwnYear as Integer
CurOwnDay = DlgCalModel.txtOwnEventDay.Value
CurOwnMonth = DlgCalendar.GetControl(&quot;lstOwnEventMonth&quot;).getSelectedItemPos() + 1
UIDateStr = CalCreateDateStrOfInput()
NewDate = GetDateUnits(CurOwnDay, CurOwnMonth, UIDateStr)
If UIDateStr = &quot;&quot; Then Exit Sub
MaxIndex = Ubound(DlgCalModel.lstOwnData.StringItemList())
If MaxIndex = -1 Then
DlgCalendar.GetControl(&quot;lstOwnData&quot;).AddItem(UIDateStr, 0 + 1)
bInserted = True
Else
Dim CurEvMonth(MaxIndex) as Integer
Dim CurEvDay(MaxIndex) as Integer
Dim CurDate(MaxIndex) as Double
&apos; same Years(&quot;no years&quot; are treated like same years) -&gt; delete old entry and insert new one
i = 0
Do
CurDate(i) = GetSelectedDateUnits(CurEvDay(i), CurEvMonth(i), i)
If CurDate(i) = NewDate Then
DlgCalendar.GetControl(&quot;lstOwnData&quot;).RemoveItems(i,1)
DlgCalendar.GetControl(&quot;lstOwnData&quot;).AddItem(UIDateStr, i)
bInserted = True
End If
i = i + 1
Loop Until bInserted Or i &gt; MaxIndex
&apos; There exists already a date
If Not bInserted Then
i = 0
Do
If (CurEvMonth(i) = CurOwnMonth) And (CurEvDay(i) = CurOwnDay) Then
bInserted = True
DlgCalendar.GetControl(&quot;lstOwnData&quot;).RemoveItems(i,1)
DlgCalendar.GetControl(&quot;lstOwnData&quot;).AddItem(UIDateStr, i)
End If
i = i + 1
Loop Until bInserted Or i &gt; MaxIndex
End If
&apos; The date is not yet existing and will will be sorted in accordingly
If Not bInserted Then
i = 0
Do
bInserted = NewDate &lt; CurDate(i)
If bInserted Then
DlgCalendar.GetControl(&quot;lstOwnData&quot;).AddItem(UIDateStr, i)
End If
i = i + 1
Loop Until bInserted Or i &gt; MaxIndex
If Not bInserted Then
DlgCalendar.GetControl(&quot;lstOwnData&quot;).AddItem(UIDateStr, MaxIndex+1)
End If
End If
End If
bCalOwnDataChanged = True
Call CalClearInputMask()
End Sub
Function GetSelectedDateUnits(CurEvDay as Integer, CurEvMonth as Integer, i as Integer) as Double
Dim dblDate as Double
Dim DateStr as String
dblDate = SBDATEUNDEFINED
DateStr = DlgCalModel.lstOwnData.StringItemList(i)
If DateStr &lt;&gt; &quot;&quot; Then
dblDate = GetDateUnits(CurEvDay, CurEvMonth, DateStr)
End If
GetSelectedDateUnits() = dblDate
End Function
Function GetDateUnits(CurEvDay as Integer, CurEvMonth as Integer, DateStr) as Double
Dim bEventOnce as String
Dim LocDateStr as String
Dim dblDate as Double
Dim lDate as Long
LocDateStr = Mid(DateStr, 1, 15)
LocDateStr = Trim(LocDateStr)
bEventOnce = True
On Local Error Goto NODATEFORMAT
dblDate = oNumberFormatter.convertStringToNumber(lDateFormat, LocDateStr)
lDate = Clng(dblDate)
CurEvMonth = Month(lDate)
CurEvDay = Day(lDate)
GetDateUnits() = dblDate
Exit Function
GetDateUnits() =SBDATEUNDEFINED
NODATEFORMAT:
If Err &lt;&gt; 0 Then
MsgBox(&quot;Error: Date : &apos; &quot; &amp; LocDateStr &amp; &quot;&apos; is not a valid Format&quot;, 16, sWizardTitle)
Resume GETRETURNVALUE
GETRETURNVALUE:
GetDateUnits() = SBDATEUNDEFINED
End If
End Function
Function CalGetNameOfEvent(ByVal ListIndex as Integer) as String
Dim NameStr as String
NameStr = DlgCalModel.lstOwnData.StringItemList(ListIndex)
NameStr = Trim (Mid(NameStr, 16))
CalGetNameOfEvent = NameStr
End Function
Sub CheckInsertedDates(Optional ControlEnvironment, Optional CurOwnMonth as Integer)
Dim EvYear as Long
Dim EvDay as Long
Dim sEvMonth as String
Dim bDoEnable as Boolean
Dim ListboxName as String
Dim MaxValue as Integer
If Not IsMissing(ControlEnvironment) Then
CurOwnMonth = DlgCalendar.GetControl(&quot;lstOwnEventMonth&quot;).getSelectedItemPos()+1
End If
EvYear = Year(Now())
bDoEnable = CurOwnMonth &lt;&gt; 0
If bDoEnable Then
MaxValue = CalMaxDayInMonth(EvYear, CurOwnMonth)
DlgCalModel.txtOwnEventDay.ValueMax = MaxValue
If DlgCalModel.txtOwnEventDay.Value &gt; MaxValue Then
DlgCalModel.txtOwnEventDay.Value = MaxValue
End If
bDoEnable = DlgCalModel.txtOwnEventDay.Value &lt;&gt; 0
If bDoEnable Then
bDoEnable = Ubound(DlgCalModel.lstOwnEventMonth.SelectedItems()) &gt; -1
If bDoEnable Then
bDoEnable = LTrim(DlgCalModel.txtEvent.Text) &lt;&gt; &quot;&quot;
End If
End If
End If
DlgCalModel.cmdInsert.Enabled = bDoEnable
End Sub
Sub GetOwnMonth()
Dim EvYear as Integer
Dim CurOwnMonth as Integer
EvYear = year(now())
CurOwnMonth = DlgCalModel.lstOwnEventMonth.SelectedItems(0) + 1
DlgCalModel.txtOwnEventDay.ValueMax = CalMaxDayInMonth(EvYear, CurOwnMonth)
CheckInsertedDates(,CurOwnMonth)
End Sub</script:module>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Schedule" library:readonly="true" library:passwordprotected="false">
<library:element library:name="DlgCalendar"/>
</library:library>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Schedule" library:readonly="true" library:passwordprotected="false">
<library:element library:name="OwnEvents"/>
<library:element library:name="CalendarMain"/>
<library:element library:name="BankHoliday"/>
<library:element library:name="DlgControl"/>
<library:element library:name="Language"/>
<library:element library:name="CreateTable"/>
<library:element library:name="GermanHolidays"/>
<library:element library:name="LocalHolidays"/>
</library:library>