mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-03-16 06:03:53 +08:00
优化项目结构、优化 maven 结构
This commit is contained in:
@@ -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&(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& = DateSerial(Year, nMonth,nDay)
|
||||
End Function
|
||||
|
||||
|
||||
' Note: the following algorithm is valid only till the Year 2100.
|
||||
' 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) = ""
|
||||
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 <> CalTypeOfBankHoliday(iDay) Then
|
||||
If iLevel < CalTypeOfBankHoliday(iDay) Then
|
||||
CalTypeOfBankHoliday(iDay) = iLevel
|
||||
End If
|
||||
Else
|
||||
CalTypeOfBankHoliday(iDay) = iLevel
|
||||
End If
|
||||
|
||||
If CalBankHolidayName(iDay) = "" Then
|
||||
CalBankHolidayName(iDay) = EventName
|
||||
Else
|
||||
CalBankHolidayName(iDay) = CalBankHolidayName(iDay) & " / " & EventName
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Function CalMaxDayInMonth(ByVal iYear as Integer, ByVal iMonth as Integer) as Integer
|
||||
' 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 <= nMonth And 12 >= 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
|
||||
|
||||
' Not Found
|
||||
CalGetIntOfShortMonthName = 0
|
||||
End Function
|
||||
|
||||
|
||||
Sub CalInsertOwnDataInTables(ByVal iSelYear as Integer)
|
||||
' 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) <> SBDATEUNDEFINED Then
|
||||
CurEventName = CalGetNameOfEvent(i)
|
||||
CalInsertBankholiday(DateSerial(iSelYear, CurEvMonth, CurEvDay), CurEventName, cHolidayType_Own)
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
|
||||
' Finds eg the first,second Monday in a month
|
||||
' 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
|
||||
' 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
|
||||
|
||||
|
||||
' Finds the next weekday after a fixed date
|
||||
' 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 <> 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>
|
||||
@@ -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
|
||||
|
||||
' CalenderMain
|
||||
Public sCurLangLocale as String
|
||||
Public sCurCountryLocale as String
|
||||
' This flag serves as a query if the individual Data should be saved
|
||||
Public bCalOwnDataChanged as Boolean
|
||||
|
||||
'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$
|
||||
|
||||
'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
|
||||
|
||||
' BL* means "BundesLand" (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
|
||||
|
||||
'On Error Goto ErrorHandler
|
||||
BasicLibraries.LoadLibrary("Tools")
|
||||
bSelectByMouseMove = True
|
||||
oDocument = ThisComponent
|
||||
oStatusline = oDocument.GetCurrentController.GetFrame.CreateStatusIndicator
|
||||
ToggleWindow(False)
|
||||
sCurLangLocale = oDocument.CharLocale.Language
|
||||
sCurCountryLocale = oDocument.CharLocale.Country
|
||||
DlgCalendar = LoadDialog("Schedule", "DlgCalendar")
|
||||
DlgCalModel = DlgCalendar.Model
|
||||
LoadLanguage(sCurLangLocale)
|
||||
CalInitGlobalVariablesDate()
|
||||
BitmapDir = GetOfficeSubPath("Template","../wizard/bitmap")
|
||||
DlgCalModel.imgCountry.ImageURL = BitmapDir & sBitmapFilename
|
||||
CalChoosenLand = -2
|
||||
CalLoadOwnData()
|
||||
|
||||
With DlgCalModel
|
||||
.cmdDelete.Enabled = False
|
||||
.lstMonth.StringItemList() = cCalShortMonthNames()
|
||||
Select Case sCurLangLocale
|
||||
Case cLANGUAGE_JAPANESE
|
||||
.lstOwnData.FontName = "HG MinochoL"
|
||||
.txtEvent.FontName = "HG MinchoL"
|
||||
Case cLANGUAGE_CHINESE
|
||||
If oDocument.CharLocale.Country = "CN" Then
|
||||
.lstOwnData.FontName = "FZ Song Ti"
|
||||
.txtEvent.FontName = "FZ Song Ti"
|
||||
Else
|
||||
.lstOwnData.FontName = "FZ Ming Ti"
|
||||
.txtEvent.FontName = "FZ Ming Ti"
|
||||
End If
|
||||
Case "ko"
|
||||
.lstOwnData.FontName = "Sun Gulim"
|
||||
.txtEvent.FontName = "Sun Gulim"
|
||||
End Select
|
||||
.lstOwnEventMonth.StringItemList() = cCalShortMonthNames()
|
||||
.optYear.State = 1
|
||||
.txtYear.Value = Year(Now())
|
||||
.txtYear.Tag = .txtYear.Value
|
||||
.Step = 1
|
||||
End With
|
||||
SetupNumberFormatter(sCurLangLocale, sCurCountryLocale)
|
||||
CalChooseCalendar() ' month
|
||||
iThisMonth = Month(Now)
|
||||
DlgCalendar.GetControl("lstMonth").SelectItemPos(iThisMonth-1, True)
|
||||
DlgCalendar.GetControl("lstHolidays").SelectItemPos(0,True)
|
||||
DlgCalModel.cmdGoOn.DefaultButton = True
|
||||
ToggleWindow(True)
|
||||
DlgCalendar.GetControl("lblHolidays").Visible = sCurLangLocale = cLANGUAGE_GERMAN
|
||||
DlgCalendar.GetControl("lstHolidays").Visible = sCurLangLocale = cLANGUAGE_GERMAN
|
||||
fHeightCorrFactor = DlgCalendar.GetControl("imgCountry").Size.Height/198
|
||||
fWidthCorrFactor = DlgCalendar.GetControl("imgCountry").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 = "TT.MMM"
|
||||
Case cLANGUAGE_ENGLISH
|
||||
DateFormatString = "MMM DD"
|
||||
Case cLANGUAGE_FRENCH
|
||||
DateFormatString = "JJ/MMM"
|
||||
Case cLANGUAGE_ITALIAN
|
||||
DateFormatString = "GG/MMM"
|
||||
Case cLANGUAGE_SPANISH
|
||||
DateFormatString = "DD/MMM"
|
||||
Case cLANGUAGE_PORTUGUESE
|
||||
If sCurCountryLocale = "BR" Then
|
||||
DateFormatString = "DD/MMM"
|
||||
Else
|
||||
DateFormatString = "DD-MMM"
|
||||
End If
|
||||
Case cLANGUAGE_DUTCH
|
||||
DateFormatString = "DD/MMM"
|
||||
Case cLANGUAGE_SWEDISH
|
||||
DateFormatString = "MMM DD"
|
||||
Case cLANGUAGE_DANISH
|
||||
DateFormatString = "DD-MMM"
|
||||
Case cLANGUAGE_POLISH
|
||||
DateFormatString = "MMM DD"
|
||||
Case cLANGUAGE_RUSSIAN
|
||||
DateFormatString = "MMM DD"
|
||||
Case cLANGUAGE_JAPANESE
|
||||
DateFormatString = "M月D日"
|
||||
Case cLANGUAGE_CHINESE
|
||||
If sCurCountryLocale = "TW" Then
|
||||
DateFormatString = "MMMMD" &"""" & "日" & """"
|
||||
Else
|
||||
DateFormatString = "M" & """" & "月" & """" & "D" &"""" & "日" & """"
|
||||
End If
|
||||
Case cLANGUAGE_GREEK
|
||||
DateFormatString = "DD/MMM"
|
||||
Case cLANGUAGE_TURKISH
|
||||
DateFormatString = "DD/MMM"
|
||||
Case cLANGUAGE_POLISH
|
||||
DateFormatString = "MMM DD"
|
||||
Case cLANGUAGE_FINNISH
|
||||
DateFormatString = "PP.KKK"
|
||||
End Select
|
||||
|
||||
lDateFormat = AddNumberFormat(oFormats, DateFormatString, oDocument.CharLocale)
|
||||
lDateStandardFormat = oFormats.getStandardFormat(com.sun.star.util.NumberFormat.DATE, oDocument.CharLocale)
|
||||
|
||||
' lDateStandardFormat = AddNumberFormat(oFormats, StandardDateFormatString, oDocument.CharLocale)
|
||||
oNumberFormatter = createUNOService("com.sun.star.util.NumberFormatter")
|
||||
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()
|
||||
' cmdOk is called when the Button 'Read' is clicked on
|
||||
' It is either given out a month or a year
|
||||
Dim i, iSelYear as Integer
|
||||
Dim SelYear as String
|
||||
' 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()) > -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 = "TW" 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$ + " " + 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 = "" Then
|
||||
oSheet.Name = cCalLongMonthNames(iMonth-1)
|
||||
Else
|
||||
oSheet.Name = sMonthTitle + " " + cCalLongMonthNames(iMonth-1)
|
||||
End If
|
||||
oDocument.AddActionLock
|
||||
Call CalCreateMonthTable(iSelYear, iMonth)
|
||||
End If
|
||||
|
||||
oDocument.RemoveActionLock
|
||||
oSheet.protect("")
|
||||
oStatusLine.End
|
||||
DlgCalendar.EndExecute()
|
||||
bCancelTask = True
|
||||
End Sub
|
||||
</script:module>
|
||||
@@ -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 ' Row on month sheet for first day of month
|
||||
Public Const DateColumn% = 3 ' Column on month sheet with days
|
||||
Public Const NewYearRow = 4 ' Row on year sheet for January 1st
|
||||
Public Const NewYearColumn = 2 ' Column on year sheet for January 1st
|
||||
|
||||
|
||||
Sub CalCreateYearTable(ByVal iSelYear as Integer)
|
||||
' Completes the overview for whole year
|
||||
|
||||
' 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
|
||||
' On Error Goto ErrorHandling
|
||||
oStatusLine.Start("",140) 'GetResText(sProgress)
|
||||
iDate = DateSerial(iSelYear,1,1)
|
||||
oYearCell = oSheet.GetCellRangeByName("Year")
|
||||
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
|
||||
' Delete 29th February if necessary
|
||||
oRangeFebCell = oSheet.GetCellRangeByName("Feb29")
|
||||
oCellAddress = oRangeFebCell.RangeAddress
|
||||
oFebCell = oSheet.GetCellByPosition(oCellAddress.StartColumn,oCellAddress.StartRow)
|
||||
oFebCell.String = ""
|
||||
' Change the CellStyle according to the Range "Blank"
|
||||
oRangeBlank = oSheet.GetCellRangebyName("Blank")
|
||||
sBlankStyle = oRangeBlank.CellStyle
|
||||
oRangeFebCell.CellStyle = sBlankStyle
|
||||
End If
|
||||
oStatusLine.SetValue(150)
|
||||
ErrorHandling:
|
||||
If Err <> 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
|
||||
|
||||
' Completes the monthly calendar
|
||||
'On Error Goto ErrorHandling
|
||||
oStatusLine.Start("",40) 'GetResText(sProgess)
|
||||
' Set month
|
||||
oMonthCell = oSheet.GetCellRangeByName("Month")
|
||||
|
||||
iDate = DateSerial(iSelYear,iSelMonth,1)
|
||||
oMonthCell.Value = iDate
|
||||
' 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 <> 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 <> 0 Then
|
||||
iCellValue = oDateCell.Value
|
||||
oDateCell.Value = iCellValue
|
||||
If CalBankHolidayName$(i) <> "" 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>
|
||||
@@ -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&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&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&location=application" script:language="Script"/>
|
||||
<script:event script:event-name="on-mouseout" script:macro-name="vnd.sun.star.script:Schedule.DlgControl.MouseLeavesImage?language=Basic&location=application" script:language="Script"/>
|
||||
<script:event script:event-name="on-mousemove" script:macro-name="vnd.sun.star.script:Schedule.DlgControl.CalMouseMoved?language=Basic&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&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&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&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&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&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&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&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&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&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>
|
||||
168
office-plugin/windows-office/share/basic/Schedule/DlgControl.xba
Normal file
168
office-plugin/windows-office/share/basic/Schedule/DlgControl.xba
Normal 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()) > -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)
|
||||
' Flag to store the new data
|
||||
bCalOwnDataChanged = True
|
||||
bDoEnable = Ubound(DlgCalModel.lstOwnData.StringItemList()) > -1
|
||||
DlgCalModel.cmdDelete.Enabled = bDoEnable
|
||||
If bDoEnable Then
|
||||
MaxIndex = Ubound(DlgCalModel.lstOwnData.StringItemList())
|
||||
If iSel > MaxIndex Then
|
||||
iSel = MaxIndex
|
||||
End If
|
||||
DlgCalendar.GetControl("lstOwnData").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
|
||||
' oStatusLine.SetText("Position: " & aEvent.X & " ; " & aEvent.Y)
|
||||
ListIndex = CalGetGermanLandAtMousePos(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor))
|
||||
DlgCalendar.GetControl("lstHolidays").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 >= 1 Then
|
||||
ListIndex = CalGetGermanLandAtMousePos(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor))
|
||||
DlgCalendar.GetControl("lstHolidays").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 = ""
|
||||
.txtOwnEventDay.SetPropertyToDefault("Value")
|
||||
.cmdInsert.Enabled = False
|
||||
End With
|
||||
If Ubound(DlgCalModel.lstOwnData.StringItemList()) > -1 Then
|
||||
If Ubound(DlgCalModel.lstOwnData.SelectedItems()) = -1 Then
|
||||
DlgCalendar.GetControl("lstOwnData").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 <> ""
|
||||
' ToggleYearBox()
|
||||
Else
|
||||
dim bla as boolean
|
||||
DlgCalModel.Step = 1
|
||||
DlgCalendar.GetControl("lblHolidays").Visible = sCurLangLocale = cLANGUAGE_GERMAN
|
||||
DlgCalendar.GetControl("lstHolidays").Visible = sCurLangLocale = cLANGUAGE_GERMAN
|
||||
DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_OwnData$
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Sub ToggleInsertButton()
|
||||
DlgCalModel.cmdInsert.Enabled = LTrim(DlgCalModel.txtEvent.Text) <> ""
|
||||
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 > -1 Then
|
||||
ListIndex = .lstOwnData.SelectedItems(MaxSelIndex)
|
||||
.txtEvent.Text = CalGetNameofEvent(ListIndex)
|
||||
If GetSelectedDateUnits(CurEvDay, CurEvMonth, ListIndex) <> SBDATEUNDEFINED Then
|
||||
.txtOwnEventDay.Value = CurEvDay
|
||||
DlgCalendar.GetControl("lstOwnEventMonth").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>
|
||||
@@ -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>73)And(X<130)And(Y>=117)And(Y<181) Then
|
||||
CalChoosenLand = CalBLBayern
|
||||
|
||||
ElseIf (X>41)And(X<89)And(Y>=136)And(Y<183) Then
|
||||
CalChoosenLand = CalBLBadenWuert
|
||||
|
||||
ElseIf (X>18)And(X<35)And(Y>136)And(Y<147) Then
|
||||
CalChoosenLand = CalBLSaarland
|
||||
|
||||
ElseIf (X>13)And(X<42)And(Y>111)And(Y<146) Then
|
||||
CalChoosenLand = CalBLRheinlandPfalz
|
||||
|
||||
ElseIf (X>15)And(X<=60)And(Y>=69)And(Y<112) Then
|
||||
CalChoosenLand = CalBLNordrheinWest
|
||||
|
||||
ElseIf (X>=42)And(X<78)And(Y>=95)And(Y<136) Then
|
||||
CalChoosenLand = CalBLHessen
|
||||
|
||||
ElseIf (X>=78)And(X<112)And(Y>=95)And(Y<117) Then
|
||||
CalChoosenLand = CalBLThueringen
|
||||
|
||||
ElseIf (X>=112)And(X<158)And(Y>=88)And(Y<114) Then
|
||||
CalChoosenLand = CalBLSachsen
|
||||
|
||||
ElseIf (X>77)And(X<84)And(Y>35)And(Y<42) Then
|
||||
CalChoosenLand = CalBLHamburg
|
||||
|
||||
ElseIf (X>56)And(X<60)And(Y>36)And(Y<41) Then
|
||||
CalChoosenLand = CalBLBremen
|
||||
|
||||
ElseIf (X>58)And(X<63)And(Y>44)And(Y<52) Then
|
||||
CalChoosenLand = CalBLBremen
|
||||
|
||||
ElseIf (X>52)And(X<95)And(Y>8)And(Y<40) Then
|
||||
CalChoosenLand = CalBLSchlHolstein
|
||||
|
||||
ElseIf (X>90)And(X<149)And(Y>23)And(Y<48) Then
|
||||
CalChoosenLand = CalBLMeckPomm
|
||||
|
||||
ElseIf (X>28)And(X<90)And(Y>35)And(Y<69) Then
|
||||
CalChoosenLand = CalBLNiedersachsen
|
||||
|
||||
ElseIf (X>60)And(X<90)And(Y>=69)And(Y<95) Then
|
||||
CalChoosenLand = CalBLNiedersachsen
|
||||
|
||||
ElseIf (X>=90)And(X<=115)And(Y>47)And(Y<95) Then
|
||||
CalChoosenLand = CalBLSachsenAnhalt
|
||||
|
||||
ElseIf (X>129)And(X<139)And(Y>60)And(Y<66) Then
|
||||
CalChoosenLand = CalBLBerlin
|
||||
|
||||
ElseIf (X>115)And(X<151)And(Y>=48)And(Y<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&, VierterAdvent&
|
||||
|
||||
If (iCountry < 1) Or (iCountry > 16) Then
|
||||
iCountry = CalBLHamburg
|
||||
End If
|
||||
OsternDate& = CalEasterTable&(iSelYear)
|
||||
So = 1
|
||||
|
||||
CalInsertBankholiday(DateSerial(iSelYear, 1, 1), "Neujahr", cHolidayType_Full)
|
||||
|
||||
If (iCountry = CalBLBayern) Or (iCountry = CalBLBadenWuert) Or (iCountry = CalBLSachsenAnhalt) Then
|
||||
CalInsertBankholiday(DateSerial(iSelYear, 1, 6), "Hl. 3 Könige", cHolidayType_Full)
|
||||
End If
|
||||
|
||||
CalInsertBankholiday(OsternDate&-2, "Karfreitag", cHolidayType_Full)
|
||||
CalInsertBankholiday(OsternDate&, "Ostersonntag", cHolidayType_Full)
|
||||
CalInsertBankholiday(OsternDate&+1, "Ostermontag", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(iSelYear, 5, 1), "Maifeiertag", cHolidayType_Full)
|
||||
CalInsertBankholiday(OsternDate&+39, "Christi Himmelfahrt", cHolidayType_Full)
|
||||
CalInsertBankholiday(OsternDate&+49, "Pfingstsonntag", cHolidayType_Full)
|
||||
CalInsertBankholiday(OsternDate&+50, "Pfingstmontag", 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&+60, "Fronleichnam", cHolidayType_Full)
|
||||
End If
|
||||
|
||||
If (iCountry = CalBLBayern) Or (iCountry = CalBLSaarland) Then
|
||||
CalInsertBankholiday(DateSerial(iSelYear, 8, 15), "Mariä Himmelfahrt", cHolidayType_Full)
|
||||
End If
|
||||
|
||||
CalInsertBankholiday(DateSerial(iSelYear, 10, 3), "Tag der dt. Einheit", cHolidayType_Full)
|
||||
|
||||
If (iCountry=CalBLBrandenburg) Or (iCountry=CalBLMeckPomm) Or (iCountry=CalBLSachsenAnhalt) Or (iCountry=CalBLSachsen) Or (iCountry=CalBLThueringen) Then
|
||||
CalInsertBankholiday(DateSerial(iSelYear, 10, 31), "Reformationstag", 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), "Allerheiligen", cHolidayType_Full)
|
||||
End If
|
||||
|
||||
vierterAdvent = DateSerial(iSelYear, 12, 24)
|
||||
While WeekDay(vierterAdvent) <> So
|
||||
vierterAdvent = vierterAdvent - 1
|
||||
Wend
|
||||
|
||||
If iCountry = CalBLSachsen Then
|
||||
CalInsertBankholiday(vierterAdvent-32, "Buß- und Bettag", cHolidayType_Full)
|
||||
Else
|
||||
CalInsertBankholiday(vierterAdvent-32, "Buß- und Bettag", cHolidayType_Half)
|
||||
End If
|
||||
CalInsertBankholiday(vierterAdvent-21, "1. Advent", cHolidayType_Full)
|
||||
CalInsertBankholiday(vierterAdvent-14, "2. Advent", cHolidayType_Full)
|
||||
CalInsertBankholiday(vierterAdvent-7, "3. Advent", cHolidayType_Full)
|
||||
CalInsertBankholiday(vierterAdvent, "4. Advent", cHolidayType_Full)
|
||||
|
||||
CalInsertBankholiday(Dateserial(iSelYear, 12, 24), "Heiligabend", cHolidayType_Half)
|
||||
CalInsertBankholiday(Dateserial(iSelYear, 12, 25), "1. Weihnachtstag", cHolidayType_Full)
|
||||
CalInsertBankholiday(Dateserial(iSelYear, 12, 26), "2. Weihnachtstag", cHolidayType_Full)
|
||||
CalInsertBankholiday(Dateserial(iSelYear, 12, 31), "Sylvester", cHolidayType_Half)
|
||||
End Sub
|
||||
</script:module>
|
||||
115
office-plugin/windows-office/share/basic/Schedule/Language.xba
Normal file
115
office-plugin/windows-office/share/basic/Schedule/Language.xba
Normal 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 = "", cLANGUAGE_CHINESE = "zh", cLANGUAGE_DANISH = "da"
|
||||
Public Const cLANGUAGE_DUTCH = "nl", cLANGUAGE_ENGLISH = "en", cLANGUAGE_FINNISH = "fi"
|
||||
Public Const cLANGUAGE_FRENCH = "fr", cLANGUAGE_GERMAN = "de", cLANGUAGE_GREEK = "el"
|
||||
Public Const cLANGUAGE_ITALIAN = "it", cLANGUAGE_JAPANESE = "ja", cLANGUAGE_NORWEGIAN = "no"
|
||||
Public Const cLANGUAGE_POLISH = "pl", cLANGUAGE_PORTUGUESE = "pt", cLANGUAGE_RUSSIAN = "ru"
|
||||
Public Const cLANGUAGE_SPANISH = "es", cLANGUAGE_SWEDISH = "sv", cLANGUAGE_TURKISH = "tr"
|
||||
|
||||
Public BLNameList(0 To 16) as String
|
||||
|
||||
|
||||
' R e s o u r c e s t r i n g c o n s t a n t s
|
||||
' -------------------------------------------------
|
||||
' Dialog labels start at 1000
|
||||
|
||||
Sub LoadLanguage%(ByVal LangLocale)
|
||||
Dim Dummy$
|
||||
Dim i as Integer
|
||||
Const dlgMonth = 1200
|
||||
' Abreviated months start 1225
|
||||
Const dlgShortMonth = 1225
|
||||
If InitResources("schedule", "cal") Then
|
||||
If LangLocale = cLANGUAGE_GERMAN Then
|
||||
|
||||
' Load all states
|
||||
BLNameList(0) = GetResText(1100)
|
||||
BLNameList(1) = "Bayern"
|
||||
BLNameList(2) = "Baden-Württemberg"
|
||||
BLNameList(3) = "Berlin"
|
||||
BLNameList(4) = "Bremen"
|
||||
BLNameList(5) = "Brandenburg"
|
||||
BLNameList(6) = "Hamburg"
|
||||
BLNameList(7) = "Hessen"
|
||||
BLNameList(8) = "Mecklenburg-Vorpommern"
|
||||
BLNameList(9) = "Niedersachsen"
|
||||
BLNameList(10) = "Nordrhein-Westfalen"
|
||||
BLNameList(11) = "Rheinland-Pfalz"
|
||||
BLNameList(12) = "Saarland"
|
||||
BLNameList(13) = "Sachsen"
|
||||
BLNameList(14) = "Sachsen-Anhalt"
|
||||
BLNameList(15) = "Schleswig Holstein"
|
||||
BLNameList(16) = "Thüringen"
|
||||
|
||||
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, ".gif", ".bmp")
|
||||
DlgCalModel.hlnCalendar.Label = GetResText(1006)
|
||||
.optYear.Label = GetResText(1007)
|
||||
.optMonth.Label = GetResText(1008)
|
||||
.lblMonth.Label = GetResText(1013)
|
||||
.cmdOwnData.Label = GetResText(1015)
|
||||
.hlnNewEvent.Label = GetResText(1019)
|
||||
.lblEvent.Label = GetResText(1019)
|
||||
.lblEventDay.Label = GetResText(1021)
|
||||
.lblEventMonth.Label = GetResText(1022)
|
||||
' .lblEventYear.Label = GetResText(1023)
|
||||
' .chkEventOnce.Label = GetResText(1020)
|
||||
.cmdInsert.Label = GetResText(1016)
|
||||
.cmdDelete.Label = GetResText(1017)
|
||||
' Load long month names
|
||||
For i = 0 To 11
|
||||
cCalLongMonthNames(i) = GetResText(dlgMonth+i)
|
||||
cCalShortMonthNames(i)= cCalLongMonthNames(i)
|
||||
'cCalShortMonthNames(i)= Left$(cCalLongMonthNames(i), 3)
|
||||
cCalShortMonthNames(i)= RTrim(cCalShortMonthNames(i))
|
||||
Next
|
||||
' Load sheet names
|
||||
sCalendarTitle = GetResText(1410)
|
||||
sMonthTitle = GetResText(1411)
|
||||
' Load names of styles
|
||||
cCalStyleWorkday$ = GetResText(1400)
|
||||
cCalStyleWeekend$ = GetResText(1401)
|
||||
End With
|
||||
End If
|
||||
End Sub
|
||||
</script:module>
|
||||
@@ -0,0 +1,662 @@
|
||||
<?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="LocalHolidays" script:language="StarBasic">Option Explicit
|
||||
|
||||
Sub Main
|
||||
Call CalAutopilotTable()
|
||||
End Sub
|
||||
|
||||
|
||||
Sub FindWholeYearHolidays_FRANCE(ByVal YearInt as Integer)
|
||||
Dim lEasterDate&
|
||||
Dim lDate&
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 1), "Jour de l'an", cHolidayType_Full)
|
||||
lEasterDate = CalEasterTable(YearInt)
|
||||
CalInsertBankholiday(lEasterDate, "Pâques", cHolidayType_Full)
|
||||
CalInsertBankholiday(lEasterDate + 1, "Lundi de Pâques", cHolidayType_Full)
|
||||
CalInsertBankholiday(lEasterDate + 39, "Ascension", cHolidayType_Full)
|
||||
CalInsertBankholiday(lEasterDate + 49, "Pentecôte", cHolidayType_Full)
|
||||
CalInsertBankholiday(lEasterDate + 50, "Lundi de Pentecôte", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 1), "Fête du travail", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 8), "Victoire 1945", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 7, 14), "Fête Nationale", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 8, 15), "Assomption", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 11, 1), "Toussaint", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 11, 11), "Armistice ou Victoire 1918", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 25), "Noël", cHolidayType_Full)
|
||||
End Sub
|
||||
|
||||
|
||||
Sub FindWholeYearHolidays_SWED(ByVal YearInt as Integer)
|
||||
Dim lDate&
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 1), "Nyårsdagen", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 6), "Trettondagen", cHolidayType_Full)
|
||||
lDate = CalEasterTable(YearInt)
|
||||
CalInsertBankholiday(lDate - 2, "Långfredagen", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate, "Påskdagen", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate + 1, "Annandag påsk", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate + 39, "Kristi himmelfärds dag", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate + 49, "Pingstdagen", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate + 50, "Annandag pingst", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 1), "1:a maj", cHolidayType_Full)
|
||||
' MidSummerfeast (next Sunday after 20th June)
|
||||
CalInsertBankholiday(GetNextWeekday(YearInt, 6, 20, 7), "Midsommardagen", cHolidayType_Full)
|
||||
CalInsertBankholiday(GetNextWeekDay(YearInt, 10, 31, 7), "Alla helgons dag", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 25), "Juldagen", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 26), "Annandag jul", cHolidayType_Full)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub FindWholeYearHolidays_FI(ByVal YearInt as Integer)
|
||||
Dim OsternDate&
|
||||
' New Year
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 1), "Uudenvuodenpäivä", cHolidayType_Full)
|
||||
' "the three Magi"
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 6), "Loppiainen", cHolidayType_Half)
|
||||
OsternDate = CalEasterTable(YearInt)
|
||||
CalInsertBankholiday(OsternDate-2, "Pitkäperjantai", cHolidayType_Full)
|
||||
CalInsertBankholiday(OsternDate, "Pääsiäispäivä", cHolidayType_Full)
|
||||
CalInsertBankholiday(OsternDate+1, "2. pääsiäispäivä", cHolidayType_Full)
|
||||
' Ascension Day
|
||||
CalInsertBankholiday(OsternDate+39, "Helatorstai", cHolidayType_Full)
|
||||
' First of May
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 1), "Vappu, suomalaisen työn päivä", cHolidayType_Full)
|
||||
' Mothers Day : 2nd Sunday in May, Full
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 5,1,7), "Äitienpäivä", cHolidayType_Full)
|
||||
' MidSummerfeast (next Sunday after 20th June)
|
||||
CalInsertBankholiday(GetNextWeekday(YearInt, 6, 20, 7), "Juhannus, Suomen lipun päivä", cHolidayType_Full)
|
||||
' Independance day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 6), "Itsenäisyyspäivä", cHolidayType_Full)
|
||||
' Christmas
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 25), "Joulupäivä", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 26), "Tapaninpäivä", cHolidayType_Full)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub FindWholeYearHolidays_DK (ByVal YearInt as Integer)
|
||||
Dim lDate&, VierterAdvent&
|
||||
|
||||
'New Year
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 1), "Nytårsdag", cHolidayType_Full)
|
||||
lDate = CalEasterTable (YearInt)
|
||||
' carnival
|
||||
CalInsertBankholiday(lDate-49, "Fastelavn", cHolidayType_Half)
|
||||
'"Maundy Tuesday
|
||||
CalInsertBankholiday(lDate-3, "Skærtorsdag", cHolidayType_Full)
|
||||
'"Good Friday "
|
||||
CalInsertBankholiday(lDate-2, "Langfredag", cHolidayType_Full)
|
||||
' Easter Sunday
|
||||
CalInsertBankholiday(lDate, "Påskesøndag", cHolidayType_Full)
|
||||
' Easter Monday
|
||||
CalInsertBankholiday(lDate+1, "2. påskedag", cHolidayType_Full)
|
||||
' 4th Friday after Easter
|
||||
CalInsertBankholiday(lDate+26, "Store bededag", cHolidayType_Full)
|
||||
' "Ascension Day
|
||||
CalInsertBankholiday(lDate+39, "Kristi himmelfahrt", cHolidayType_Full)
|
||||
' "Whitsunday"
|
||||
CalInsertBankholiday(lDate+49, "Pinsesøndag", cHolidayType_Full)
|
||||
' "Whitmonday"
|
||||
CalInsertBankholiday(lDate+50, "2. pinsedag", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 6, 5), "Grundlovsdag", cHolidayType_Full)
|
||||
'Christmas Days
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 25), "1. juledag", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 26), "2. juledag", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 6), "Hellig 3 konger", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 3, 28), "Dr. Ingrid", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 4, 16), "Dr. Margrete", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 4, 16), "Palmesøndag", cHolidayType_Half)
|
||||
' "Liberation day"
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 5), "Befrielsesdag", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 26), "Krpr. Frederik", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 6, 7), "Pr. Joachim", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 6, 11), "Pr. Henrik", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 6, 15), "Valdemarsdag", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 6, 24), "Skt. Hans", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 6, 30), "Prinsesse Alexandra", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 8, 28), "Pr. Nikolai", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 10, 24), "FN-dag", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 11, 11), "Morten Bisp", cHolidayType_Half)
|
||||
' all half (Memorial Days)
|
||||
'"adventdays
|
||||
VierterAdvent = DateSerial(YearInt, 12, 24)
|
||||
While (Weekday(VierterAdvent) <> 1)
|
||||
vierterAdvent = vierterAdvent - 1
|
||||
Wend
|
||||
CalInsertBankholiday(vierterAdvent-21, "1. søndag i advent", cHolidayType_Half)
|
||||
CalInsertBankholiday(vierterAdvent-14, "2. søndag i advent", cHolidayType_Half)
|
||||
CalInsertBankholiday(vierterAdvent-7, "3. søndag i advent", cHolidayType_Half)
|
||||
CalInsertBankholiday(vierterAdvent, "4. søndag i advent", cHolidayType_Half)
|
||||
'Christmas eve
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 24), "Juleaften", cHolidayType_Half)
|
||||
'"New Year's eve"
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 31), "Nytårsaften", cHolidayType_Half)
|
||||
End Sub
|
||||
|
||||
|
||||
Sub FindWholeYearHolidays_ITA(ByVal YearInt as Integer)
|
||||
Dim lDate&
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 1), "Capodanno", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 6), "Epifania", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 4, 25), "Festa della liberazione", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 8, 15), "Ferragusto", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 11, 1), "Tutti i Santi", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 8), "Immacolata concezione", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 25), "Natale", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 26), "Santo Stefano", cHolidayType_Full)
|
||||
lDate = CalEasterTable(YearInt)
|
||||
CalInsertBankholiday(lDate, "Pasqua", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate+1, "Lunedì dell'Angelo", cHolidayType_Full)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub FindWholeYearHolidays_TRK(ByVal YearInt as Integer)
|
||||
Dim lDate as Long
|
||||
' New Years' Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 1), "Yılbaşı", cHolidayType_Full)
|
||||
' National Sovereignty and Children's Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 4, 23), "Ulusal Egemenlik ve Çocuk Bayramı", cHolidayType_Full)
|
||||
' Ataturk Commemoration and Youth & Sports Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 19), "Atatürk'ü Anma, Gençlik ve Spor Bayramı", cHolidayType_Full)
|
||||
' Mothers Day : 2nd Sunday in May, Full
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 5,1,7), "Anneler günü", cHolidayType_Full)
|
||||
' Fathers Day: 3rd Sunday in May, Full
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 6,1,14), "Babalar Günü", cHolidayType_Full)
|
||||
' Victory Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 8, 30), "Zafer Bayramı", cHolidayType_Full)
|
||||
' Republic Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 10, 28), "Cumhuriyet Bayramı", cHolidayType_Full)
|
||||
' Republic Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 10, 29), "Cumhuriyet Bayramı", cHolidayType_Full)
|
||||
' Commemoration Of Ataturk-Anniversary of Ataturk's Death
|
||||
CalInsertBankholiday(DateSerial(YearInt, 11, 10), "Atatürk'ün Ölüm Günü", cHolidayType_Full)
|
||||
CalculateturkishReligousHolidays(YearInt)
|
||||
End Sub
|
||||
|
||||
|
||||
Sub CalculateturkishReligousHolidays(iSelYear as Integer)
|
||||
Dim lKurbanBayRamStartDate as Long
|
||||
Dim lRamazanBayRamStartDate as Long
|
||||
|
||||
Select Case iSelYear
|
||||
Case 2002
|
||||
lKurbanBayRamStartDate = DateSerial(iSelYear, 2, 21)
|
||||
lRamazanBayRamStartDate = DateSerial(iSelYear, 12, 4)
|
||||
Case 2003
|
||||
lKurbanBayRamStartDate = DateSerial(iSelYear, 2, 10)
|
||||
lRamazanBayRamStartDate = DateSerial(iSelYear, 11, 24)
|
||||
Case 2004
|
||||
lKurbanBayRamStartDate = DateSerial(iSelYear, 1, 31)
|
||||
lRamazanBayRamStartDate = DateSerial(iSelYear, 11, 13)
|
||||
Case 2005
|
||||
lKurbanBayRamStartDate = DateSerial(iSelYear, 1, 19)
|
||||
lRamazanBayRamStartDate = DateSerial(iSelYear, 11, 2)
|
||||
Case 2006
|
||||
lKurbanBayRamStartDate = DateSerial(iSelYear, 12, 30)
|
||||
CalInsertBankholiday(lKurbanBayRamStartDate, "Kurban Bayramı Arefesi", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(iSelYear, 12, 31), "Kurban Bayram", cHolidayType_Full)
|
||||
|
||||
lKurbanBayRamStartDate = DateSerial(iSelYear, 1, 9)
|
||||
lRamazanBayRamStartDate = DateSerial(iSelYear, 10, 22)
|
||||
Case 2007
|
||||
lKurbanBayRamStartDate = DateSerial(iSelYear, 1, 1)
|
||||
' Note: The first day has already been in 2006!!!
|
||||
AddFollowUpHolidays(lKurbanBayRamStartDate-1, 3, "Kurban Bayram", cHolidayType_Full)
|
||||
lKurbanBayRamStartDate = DateSerial(iSelYear, 12, 19)
|
||||
|
||||
lRamazanBayRamStartDate = DateSerial(iSelYear, 10, 11)
|
||||
Case 2008
|
||||
lKurbanBayRamStartDate = DateSerial(iSelYear, 12, 7)
|
||||
lRamazanBayRamStartDate = DateSerial(iSelYear, 9, 29)
|
||||
Case Else
|
||||
Exit Sub
|
||||
End Select
|
||||
'Feast Of the Sacrifice Eve
|
||||
CalInsertBankholiday(lKurbanBayRamStartDate, "Kurban Bayramı Arefesi", cHolidayType_Half)
|
||||
'Feast Of the Sacrifice
|
||||
AddFollowUpHolidays(lKurbanBayRamStartDate, 4, "Kurban Bayram", cHolidayType_Full)
|
||||
' End of Ramadan Eve
|
||||
CalInsertBankholiday(lRamazanBayRamStartDate, "Ramazan (Şeker) Bayramı Arefesi", cHolidayType_Half)
|
||||
' End of Ramadan
|
||||
AddFollowUpHolidays(lRamazanBayRamStartDate, 3, "Ramazan (Şeker) Bayramı", cHolidayType_Full)
|
||||
End Sub
|
||||
|
||||
|
||||
Sub FindWholeYearHolidays_GREEK(ByVal YearInt as Integer)
|
||||
Dim lDate as Long
|
||||
' New Year
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 1), "Πρωτοχρονιά", cHolidayType_Full)
|
||||
'Schol Holiday
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 30), "Τριών Ιεραρχών", cHolidayType_Full)
|
||||
' This is both a National Holiday and a religious holiday
|
||||
CalInsertBankholiday(DateSerial(YearInt, 3, 25), "Εθνική Εορτή Ευαγγελισμός Θεοτόκου", cHolidayType_Full)
|
||||
' Labor Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 1), "Πρωτομαγιά", cHolidayType_Full)
|
||||
' Assumption Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 8, 15), "Κοίμηση της Θεοτόκου", cHolidayType_Full)
|
||||
' National Resistance Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 10, 28), "Εθνική Εορτή", cHolidayType_Full)
|
||||
' School Holiday
|
||||
CalInsertBankholiday(DateSerial(YearInt, 11, 17), "Επέτειος του Πολυτεχνείου", cHolidayType_Full)
|
||||
' Christmas Eve
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 24), "Παραμονή Χριστουγέννων", cHolidayType_Full)
|
||||
' Christmas Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 25), "Χριστούγεννα", cHolidayType_Full)
|
||||
' Boxing Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 26), "Δεύτερη μέρα Χριστουγέννων", cHolidayType_Full)
|
||||
lDate = CalOrthodoxEasterTable(YearInt)
|
||||
' Triodon
|
||||
CalInsertBankholiday(lDate-70, "Αρχή Τριωδίου", cHolidayType_Full)
|
||||
' Meat Fare
|
||||
CalInsertBankholiday(lDate-56, "Τσικνοπέμπτη", cHolidayType_Full)
|
||||
' First Day of Lent
|
||||
CalInsertBankholiday(lDate-48, "Καθαρή Δευτέρα", cHolidayType_Full)
|
||||
' Saturday of Lazarus
|
||||
CalInsertBankholiday(lDate-8, "Σάββατο του Λαζάρου", cHolidayType_Full)
|
||||
' Palm Sunday
|
||||
CalInsertBankholiday(lDate-7, "Κυριακή των Βαΐων", cHolidayType_Full)
|
||||
' Monday before Easter
|
||||
CalInsertBankholiday(lDate-6, "Μεγάλη Δευτέρα", cHolidayType_Full)
|
||||
' Tuesday before Easter
|
||||
CalInsertBankholiday(lDate-5, "Μεγάλη Τρίτη", cHolidayType_Full)
|
||||
' Wednesday before Easter
|
||||
CalInsertBankholiday(lDate-4, "Μεγάλη Τετάρτη", cHolidayType_Full)
|
||||
' Thursday before Easter
|
||||
CalInsertBankholiday(lDate-3, "Μεγάλη Πέμπτη", cHolidayType_Full)
|
||||
' Good Friday
|
||||
CalInsertBankholiday(lDate-2, "Μεγάλη Παρασκευή", cHolidayType_Full)
|
||||
' Saturday before Easter
|
||||
CalInsertBankholiday(lDate-1, "Μεγάλο Σάββατο", cHolidayType_Full)
|
||||
' Easter Monday
|
||||
CalInsertBankholiday(lDate+1, "Δευτέρα του Πάσχα", cHolidayType_Full)
|
||||
' Pentecost
|
||||
CalInsertBankholiday(lDate+49, "Κυριακή της Πεντηκοστής", cHolidayType_Full)
|
||||
' Ascension Day
|
||||
CalInsertBankholiday(lDate+39, "Του Αγίου Πνεύματος", cHolidayType_Full)
|
||||
' All Saints Day
|
||||
CalInsertBankholiday(lDate+56, "Των Αγίων Πάντων", cHolidayType_Full)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub FindWholeYearHolidays_SPAIN(ByVal YearInt as Integer)
|
||||
Dim lDate&
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 1), "Año Nuevo", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 6), "Reyes", cHolidayType_Full)
|
||||
lDate = CalEasterTable(YearInt)
|
||||
CalInsertBankholiday(lDate-2, "Viernes Santo", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate+1, "Lunes de Pascua Florida", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate+39, "Día de la Ascensión", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 1), "Fiesta del Trabajo", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 8, 15), "Día de la Asunción", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 10, 12), "Fiesta de la Hispanidad", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 11, 1), "Todos los Santos", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 6), "Día de la Constitución", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 8), "La Inmaculada", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 25), "Navidad", cHolidayType_Full)
|
||||
End Sub
|
||||
|
||||
|
||||
Sub FindWholeYearHolidays_PORT(ByVal YearInt as Integer)
|
||||
Dim lDate&
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 1), "Ano Novo", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 6), "Reis Magos", cHolidayType_Half)
|
||||
lDate = CalEasterTable(YearInt)
|
||||
CalInsertBankholiday(lDate-47, "Carnaval", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate-7, "Domingo de Ramos", cHolidayType_Half)
|
||||
CalInsertBankholiday(lDate-2, "Sexta-feira Santa", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate, "Páscoa", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 4, 25), "25 de Abril", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 1), "Dia do Trabalhador", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 29), "Corpo de Deus", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 6, 10), "Dia de Camões e das Comunidades Portuguesas", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 6, 24), "S. João", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 6, 29), "S. Pedro", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 8, 15), "Assunção de Nossa Senhora", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 10, 5), "Implantação da República", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 11, 1), "Dia de Todos os Santos", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 8), "Imaculada Conceição", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 25), "Natal", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 1), "Restauração da Independência", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 31), "Passagem de Ano", cHolidayType_Half)
|
||||
End Sub
|
||||
|
||||
|
||||
Sub FindWholeYearHolidays_NL(ByVal YearInt as Integer)
|
||||
Dim lDate&
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 1), "Nieuwjaarsdag", cHolidayType_Full)
|
||||
lDate = CalEasterTable(YearInt)
|
||||
CalInsertBankholiday(lDate, "1e Paasdag", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate + 1, "2e Paasdag", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate + 39, "Hemelvaartsdag", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate + 49, "1e Pinksterdag", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate + 50, "2e Pinksterdag", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 4, 30), "Koninginnedag", cHolidayType_Full)
|
||||
' Bevrijdingsdag is celebrated every 5th year
|
||||
If YearInt Mod 5 = 0 then
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 5), "Bevrijdingsdag", cHolidayType_Full)
|
||||
End if
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 6), "Sinterklaas", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 25), "1e Kerstdag", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 26), "2e Kerstdag", cHolidayType_Full)
|
||||
End Sub
|
||||
|
||||
|
||||
Sub FindWholeYearHolidays_PL (ByVal YearInt as Integer)
|
||||
Dim lDate&, OsternDate&
|
||||
' New Year
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 1), "Nowy Rok", cHolidayType_Full)
|
||||
' "the three Magi"
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 6), "Trzech Króli", cHolidayType_Half)
|
||||
' "Womens' Day"
|
||||
CalInsertBankholiday(DateSerial(YearInt, 3, 8), "Dzień Kobiet", cHolidayType_Half)
|
||||
OsternDate = CalEasterTable(YearInt)
|
||||
CalInsertBankholiday(OsternDate-2, "Wielki Piątek", cHolidayType_Full)
|
||||
CalInsertBankholiday(OsternDate, "Wielka Niedziela", cHolidayType_Full)
|
||||
CalInsertBankholiday(OsternDate+1, "Lany Poniedziałek", cHolidayType_Full)
|
||||
' Ascension Day
|
||||
CalInsertBankholiday(OsternDate+39, "Wniebowstąpienie", cHolidayType_Full)
|
||||
' Pentecost
|
||||
CalInsertBankholiday(OsternDate+49, "Zielone Świątki", cHolidayType_Full)
|
||||
' Feast of Corpus Christi
|
||||
CalInsertBankholiday(OsternDate+60, "Boże Ciało", cHolidayType_Full)
|
||||
' First of May
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 1), "Święto pracy", cHolidayType_Full)
|
||||
' Memorial day of constitution
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 3), "Dzień konstytucji 3-go maja", cHolidayType_Full)
|
||||
' "Childrens' day"
|
||||
CalInsertBankholiday(DateSerial(YearInt, 6, 1), "Dzień Dziecka", cHolidayType_Half)
|
||||
' "Ascension Day"
|
||||
CalInsertBankholiday(DateSerial(YearInt, 8, 15), "Matki Boskiej Zielnej", cHolidayType_Half)
|
||||
' "All Saints' Day "
|
||||
CalInsertBankholiday(DateSerial(YearInt, 11, 1), "Wszystkich Świętych", cHolidayType_Full)
|
||||
' National day"
|
||||
CalInsertBankholiday(DateSerial(YearInt, 11, 11), "Dzień Niepodległości", cHolidayType_Full)
|
||||
' Christmas Eve
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 24), "Wigilia", cHolidayType_Half)
|
||||
' Christmas
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 25), "Boże Narodzenie", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 26), "Boże Narodzenie", cHolidayType_Full)
|
||||
' "New Year's eve"
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 31), "Sylwester", cHolidayType_Half)
|
||||
End Sub
|
||||
|
||||
|
||||
Sub FindWholeYearHolidays_RU (ByVal YearInt as Integer)
|
||||
Dim lDate&
|
||||
' New Year
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 1), "Новый Год", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 2), "Новый Год", cHolidayType_Full)
|
||||
' Russian Christmas"
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 7), "Рождество", cHolidayType_Full)
|
||||
'Day of Defender of Motherland
|
||||
CalInsertBankholiday(DateSerial(YearInt, 2, 23), "День Защитника Отечества", cHolidayType_Full)
|
||||
' Woman Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 3, 8), "Международный Женский День", cHolidayType_Full)
|
||||
' Spring and labor holiday
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 1), "Праздник Весны и Труда", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 2), "Праздник Весны и Труда", cHolidayType_Full)
|
||||
' Victory of the second World War
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 9), "День Победы", cHolidayType_Full)
|
||||
' Independence Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 6, 12), "День Независимости", cHolidayType_Full)
|
||||
' Day of Accord and Conciliation
|
||||
CalInsertBankholiday(DateSerial(YearInt, 11, 7), "День Согласия и Примирения", cHolidayType_Full)
|
||||
' Constitution Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 12), "День Конституции", cHolidayType_Full)
|
||||
End Sub
|
||||
|
||||
|
||||
Sub FindWholeYearHolidays_US(ByVal YearInt as Integer)
|
||||
Dim lDate as Long
|
||||
Dim lFirstNov as Long
|
||||
Dim lElectDate as Long
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 1), "New Year's Day", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 2, 2), "Groundhog Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 2, 14), "Valentine's Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 3, 17), "St Patrick's Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 4, 1), "April Fools' Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 4, 22), "Earth Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 6), "Nurses' Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 6, 14), "Flag Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 6, 14), "Army Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 6, 19), "Juneteenth(Liberation of Slaves)", cHolidayType_Half)
|
||||
|
||||
CalInsertBankholiday(DateSerial(YearInt, 7, 4), "Independence Day", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 8, 1), "Air Force Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 8, 4), "Coast Guard Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 9, 17), "Citizenship Day or Constitution Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 10, 16), "Bosses' Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 10, 26 ), "Mother-in-Law's Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 10, 27), "Navy Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 10, 31), "Halloween", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 11, 10), "Marine Corps Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 11, 11), "Veteran's Day", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 7), "Pearl Harbor Remembrance Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 24), "Christmas Eve", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 25), "Christmas Day", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 31), "New Year's Eve", cHolidayType_Half)
|
||||
|
||||
CalInsertBankholiday(CalEasterTable(YearInt), "Easter Sunday", cHolidayType_Half)
|
||||
|
||||
' Inauguration Day occurs every 4 years (1997, 2001) in the year following the presidential election
|
||||
' always on the 20th of January unless this is a Sunday in which case on Monday 21st January
|
||||
If YearInt Mod 4 = 1 Then
|
||||
lDate = DateSerial(YearInt, 1, 20)
|
||||
If WeekDay(lDate) = 1 Then
|
||||
CalInsertBankholiday(lDate + 1, "Inauguration Day", cHolidayType_Half)
|
||||
Else
|
||||
CalInsertBankholiday(lDate, "Inauguration Day", cHolidayType_Half)
|
||||
End If
|
||||
End If
|
||||
' First Tuesday in November, but only after the 1st of November and only on evenly numbered years
|
||||
If YearInt Mod 2 = 0 Then
|
||||
lFirstNov = DateSerial(YearInt, 11, 1)
|
||||
lElectDate = GetMonthDate(YearInt, 11, 3, 0)
|
||||
If lElectDate > lFirstNov Then
|
||||
CalInsertBankholiday(lElectDate, "Election Day", cHolidayType_Half)
|
||||
Else
|
||||
CalInsertBankholiday(lElectDate + 7, "Election Day", cHolidayType_Half)
|
||||
End If
|
||||
End If
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 1, 2, 14), "Martin Luther King Jr Day", cHolidayType_Full)
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 2, 2, 14), "President's Day", cHolidayType_Full)
|
||||
' Mothers Day : 2nd Sunday in May, Full
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 5,1,7), "Mother's Day", cHolidayType_Full)
|
||||
|
||||
' Wednesday of the last full week of April Administrative Professionals' Day (formerly Secretaries' Day)
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 5, 7, -7)-3, "Administrative Professionals' Day", cHolidayType_Half)
|
||||
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 5, 5, 0), "National Day of Prayer", cHolidayType_Half)
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 5, 7, 14), "Armed Forces Day", cHolidayType_Half)
|
||||
' Fathers Day : 3rd Sunday in June
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 6,1,14), "Father's Day", cHolidayType_Half)
|
||||
|
||||
' Last Monday in May: Menorial Day, Full
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 6, 2, 0)-7, "Memorial Day", cHolidayType_Full)
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 7, 1, 21), "Parents' Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 8, 1, 0), "Friendship Day", cHolidayType_Half)
|
||||
|
||||
' 1st Monday in Sep : Labor Day, Full
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 9, 2, 0), "Labor Day", cHolidayType_Full)
|
||||
' Sunday after Labor Day Grandparents' Day
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 9, 2, 0)+6, "Grandparents' Day", cHolidayType_Half)
|
||||
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 10, 1, 0), "National Children's Day", cHolidayType_Half)
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 10, 2, 7), "Columbus Day", cHolidayType_Full)
|
||||
' Sweetest Day: Third Saturday in October
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 10, 7, 14), "Sweetest Day", cHolidayType_Half)
|
||||
' 4th Thu in Nov : Thanksgiving, Full
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 11, 5, 21), "Thanksgiving", cHolidayType_Full)
|
||||
End Sub
|
||||
|
||||
|
||||
Sub FindWholeYearHolidays_JP(ByVal YearInt as Integer)
|
||||
Dim lDate&
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 1), "元日", cHolidayType_Full)
|
||||
' 2nd Monday in January
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 1, 2, 7), "成人の日", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 2, 11), "建国記念の日", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 3, 20), "春分の日", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 4, 29), "みどりの日", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 3), "憲法記念日", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 4), "国民の休日", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 5), "こどもの日", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 9, 23), "秋分の日", cHolidayType_Full)
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 10, 2, 7), "体育の日", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 11, 3), "文化の日", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 11, 23), "勤労感謝の日", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 23), "天皇誕生日", cHolidayType_Full)
|
||||
If YearInt > 2002 Then
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 7, 2, 14), "海の日", cHolidayType_Full)
|
||||
CalInsertBankholiday(GetMonthDate(YearInt, 9, 2, 14), "敬老の日", cHolidayType_Full)
|
||||
Else
|
||||
CalInsertBankholiday(DateSerial(YearInt, 7, 20), "海の日", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 9, 15), "敬老の日", cHolidayType_Full)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Sub FindWholeYearHolidays_TW(YearInt as Integer)
|
||||
CalculateChineseNewYear(YearInt)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 1), "元旦", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 2, 28), "和平紀念日", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 3, 8), "婦女節", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 3, 29), "革命先烈紀念日(青年節)", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 4, 4), "兒童節", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 4, 5), "民族掃墓節", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 1), "勞動節", cHolidayType_Full)
|
||||
CalInsertBankholiday(GetNextWeekDay(YearInt, 5, 19, 2), "佛陀誕辰紀念日", cHolidayType_Full) ' Just like Columbus Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 6, 15), "端午節", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 9, 3), "軍人節", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 9, 21), "中秋節", cHolidayType_Full)
|
||||
CalInsertBankholiday(GetNextWeekDay(YearInt, 9, 28, 2), "孔子誕辰紀念日(教師節)", cHolidayType_Full) ' Just like Columnbusday
|
||||
CalInsertBankholiday(DateSerial(YearInt, 10, 10), "國慶日", cHolidayType_Full)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 10, 25), "臺灣光復節", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 10, 31), "先總統 蔣公誕辰紀念日", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 11), "國父誕辰紀念日(中華文化復興節)", cHolidayType_Half)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 12, 25), "行憲紀念日", cHolidayType_Half)
|
||||
End Sub
|
||||
|
||||
|
||||
Sub FindWholeYearHolidays_CN(YearInt as Integer)
|
||||
CalculateChineseNewYear(YearInt)
|
||||
CalInsertBankholiday(DateSerial(YearInt, 1, 1), "元旦", cHolidayType_Full) ' New Year
|
||||
CalInsertBankholiday(DateSerial(YearInt, 3, 8), "妇女节", cHolidayType_Half) ' Women's Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 4, 5), "清明节", cHolidayType_Half) ' Day of the deads
|
||||
CalInsertBankholiday(DateSerial(YearInt, 5, 1), "劳动节", cHolidayType_Full) ' International Labour Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 6, 1), "儿童节", cHolidayType_Half) ' Children's Day
|
||||
CalInsertBankholiday(DateSerial(YearInt, 8, 1), "建军节", cHolidayType_Half) ' Foundation of military
|
||||
CalInsertBankholiday(DateSerial(YearInt, 10, 1), "国庆节", cHolidayType_Full) ' National festival day
|
||||
End Sub
|
||||
|
||||
|
||||
' Unfortunately I could not find a Routine to convert a 'Moon Date' into a gregorian date
|
||||
Sub CalculateChineseNewYear(iSelYear as Integer)
|
||||
Dim lDate as Long
|
||||
Select Case iSelYear
|
||||
Case 1995
|
||||
lDate = DateSerial(iSelYear, 1, 31)
|
||||
Case 1996
|
||||
lDate = DateSerial(iSelYear, 2, 19)
|
||||
Case 1997
|
||||
lDate = DateSerial(iSelYear, 2, 7)
|
||||
Case 1998
|
||||
lDate = DateSerial(iSelYear, 1, 28)
|
||||
Case 1999
|
||||
lDate = DateSerial(iSelYear,2, 16)
|
||||
Case 2000
|
||||
lDate = DateSerial(iSelYear,2, 5)
|
||||
Case 2001
|
||||
lDate = DateSerial(iSelYear, 1, 24)
|
||||
Case 2002
|
||||
lDate = DateSerial(iSelYear,2, 12)
|
||||
Case 2003
|
||||
lDate = DateSerial(iSelYear,2, 1)
|
||||
Case 2004
|
||||
lDate = DateSerial(iSelYear, 1, 22)
|
||||
Case 2005
|
||||
lDate = DateSerial(iSelYear,2, 9)
|
||||
Case 2006
|
||||
lDate = DateSerial(iSelYear, 1, 29)
|
||||
Case 2007
|
||||
lDate = DateSerial(iSelYear,2, 18)
|
||||
Case 2008
|
||||
lDate = DateSerial(iSelYear,2, 7)
|
||||
Case 2009
|
||||
lDate = DateSerial(iSelYear, 1, 26)
|
||||
Case 2010
|
||||
lDate = DateSerial(iSelYear,2, 10)
|
||||
Case 2011
|
||||
lDate = DateSerial(iSelYear,2, 3)
|
||||
Case 2012
|
||||
lDate = DateSerial(iSelYear, 1, 23)
|
||||
Case 2013
|
||||
lDate = DateSerial(iSelYear,2, 10)
|
||||
Case 2014
|
||||
lDate = DateSerial(iSelYear, 1, 31)
|
||||
Case 2015
|
||||
lDate = DateSerial(iSelYear,2, 19)
|
||||
Case 2016
|
||||
lDate = DateSerial(iSelYear,2, 9)
|
||||
Case 2017
|
||||
lDate = DateSerial(iSelYear, 1, 28)
|
||||
Case 2018
|
||||
lDate = DateSerial(iSelYear,2, 16)
|
||||
Case 2019
|
||||
lDate = DateSerial(iSelYear,2, 5)
|
||||
Case 2020
|
||||
lDate = DateSerial(iSelYear, 1, 25)
|
||||
Case Else
|
||||
Exit Sub
|
||||
End Select
|
||||
Select Case sCurCountryLocale
|
||||
Case "CN"
|
||||
CalInsertBankholiday(lDate-1, "农历除夕", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate, "春节初一", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate+1, "春节初二", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate+2, "春节初三", cHolidayType_Full)
|
||||
|
||||
Case Else
|
||||
CalInsertBankholiday(lDate-1, "農曆除夕", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate, "春節初一", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate+1, "春節初二", cHolidayType_Full)
|
||||
CalInsertBankholiday(lDate+2, "春節初三", cHolidayType_Full)
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
|
||||
Function CalculateJapaneseSpringDay(iSelYear as Integer)
|
||||
If (iSelYear > 1979) And (iSelYear < 2100) Then
|
||||
CalculateJapaneseSpringDay() = Int(20.8431 + 0.242194)* (iSelYear-1980) - (Int((iSelYear-1980)/4))
|
||||
End If
|
||||
End Function
|
||||
|
||||
|
||||
Function CalculateJapaneseAutumnDay(iSelYear as Integer)
|
||||
If (iSelYear > 1979) And (iSelYear < 2100) Then
|
||||
CalculateJapaneseAutumnDay() = Int(23.8431 + 0.242194)* (iSelYear-1980) - (Int((iSelYear-1980)/4))
|
||||
End If
|
||||
End Function</script:module>
|
||||
237
office-plugin/windows-office/share/basic/Schedule/OwnEvents.xba
Normal file
237
office-plugin/windows-office/share/basic/Schedule/OwnEvents.xba
Normal 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("UserConfig", False) & "/" & "DATE.DAT"
|
||||
SaveDataToFile(FileName, DlgCalModel.lstOwnData.StringItemList())
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Sub CalLoadOwnData()
|
||||
Dim FileName as String
|
||||
Dim LocList() as String
|
||||
FileName = GetPathSettings("UserConfig", False) & "/DATE.DAT"
|
||||
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("lstOwnEventMonth").getselectedItemPos() + 1
|
||||
DateStr = DateSerial(0, CurOwnMonth, CurOwnDay)
|
||||
dblDate = CDbl(DateValue(DateStr))
|
||||
FormatDateStr = oNumberFormatter.convertNumberToString(lDateFormat, dblDate)
|
||||
iLen = Len(FormatDateStr)
|
||||
iDiff = 16 - iLen
|
||||
If iDiff > 0 Then
|
||||
For i = 0 To iDiff
|
||||
FormatDateStr = FormatDateStr + " "
|
||||
Next i
|
||||
Else
|
||||
MsgBox("Invalid DateFormat: 'FormatDateStr'", 16, sWizardTitle)
|
||||
CalCreateDateStrOfInput = ""
|
||||
Exit Function
|
||||
End If
|
||||
DateStr = FormatDateStr & 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("lstOwnEventMonth").getSelectedItemPos() + 1
|
||||
UIDateStr = CalCreateDateStrOfInput()
|
||||
NewDate = GetDateUnits(CurOwnDay, CurOwnMonth, UIDateStr)
|
||||
If UIDateStr = "" Then Exit Sub
|
||||
MaxIndex = Ubound(DlgCalModel.lstOwnData.StringItemList())
|
||||
If MaxIndex = -1 Then
|
||||
DlgCalendar.GetControl("lstOwnData").AddItem(UIDateStr, 0 + 1)
|
||||
bInserted = True
|
||||
Else
|
||||
Dim CurEvMonth(MaxIndex) as Integer
|
||||
Dim CurEvDay(MaxIndex) as Integer
|
||||
Dim CurDate(MaxIndex) as Double
|
||||
' same Years("no years" are treated like same years) -> 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("lstOwnData").RemoveItems(i,1)
|
||||
DlgCalendar.GetControl("lstOwnData").AddItem(UIDateStr, i)
|
||||
bInserted = True
|
||||
End If
|
||||
i = i + 1
|
||||
Loop Until bInserted Or i > MaxIndex
|
||||
|
||||
' 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("lstOwnData").RemoveItems(i,1)
|
||||
DlgCalendar.GetControl("lstOwnData").AddItem(UIDateStr, i)
|
||||
End If
|
||||
i = i + 1
|
||||
Loop Until bInserted Or i > MaxIndex
|
||||
End If
|
||||
|
||||
' The date is not yet existing and will will be sorted in accordingly
|
||||
If Not bInserted Then
|
||||
i = 0
|
||||
Do
|
||||
bInserted = NewDate < CurDate(i)
|
||||
If bInserted Then
|
||||
DlgCalendar.GetControl("lstOwnData").AddItem(UIDateStr, i)
|
||||
End If
|
||||
i = i + 1
|
||||
Loop Until bInserted Or i > MaxIndex
|
||||
If Not bInserted Then
|
||||
DlgCalendar.GetControl("lstOwnData").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 <> "" 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 <> 0 Then
|
||||
MsgBox("Error: Date : ' " & LocDateStr & "' is not a valid Format", 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("lstOwnEventMonth").getSelectedItemPos()+1
|
||||
End If
|
||||
EvYear = Year(Now())
|
||||
bDoEnable = CurOwnMonth <> 0
|
||||
If bDoEnable Then
|
||||
MaxValue = CalMaxDayInMonth(EvYear, CurOwnMonth)
|
||||
DlgCalModel.txtOwnEventDay.ValueMax = MaxValue
|
||||
If DlgCalModel.txtOwnEventDay.Value > MaxValue Then
|
||||
DlgCalModel.txtOwnEventDay.Value = MaxValue
|
||||
End If
|
||||
bDoEnable = DlgCalModel.txtOwnEventDay.Value <> 0
|
||||
If bDoEnable Then
|
||||
bDoEnable = Ubound(DlgCalModel.lstOwnEventMonth.SelectedItems()) > -1
|
||||
If bDoEnable Then
|
||||
bDoEnable = LTrim(DlgCalModel.txtEvent.Text) <> ""
|
||||
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>
|
||||
@@ -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>
|
||||
12
office-plugin/windows-office/share/basic/Schedule/script.xlb
Normal file
12
office-plugin/windows-office/share/basic/Schedule/script.xlb
Normal 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>
|
||||
Reference in New Issue
Block a user