1*b1cdbd2cSJim Jagielski<?xml version="1.0" encoding="UTF-8"?>
2*b1cdbd2cSJim Jagielski<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3*b1cdbd2cSJim Jagielski<!--***********************************************************
4*b1cdbd2cSJim Jagielski *
5*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
6*b1cdbd2cSJim Jagielski * or more contributor license agreements.  See the NOTICE file
7*b1cdbd2cSJim Jagielski * distributed with this work for additional information
8*b1cdbd2cSJim Jagielski * regarding copyright ownership.  The ASF licenses this file
9*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
10*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
11*b1cdbd2cSJim Jagielski * with the License.  You may obtain a copy of the License at
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski *   http://www.apache.org/licenses/LICENSE-2.0
14*b1cdbd2cSJim Jagielski *
15*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
16*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
17*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18*b1cdbd2cSJim Jagielski * KIND, either express or implied.  See the License for the
19*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
20*b1cdbd2cSJim Jagielski * under the License.
21*b1cdbd2cSJim Jagielski *
22*b1cdbd2cSJim Jagielski ***********************************************************-->
23*b1cdbd2cSJim Jagielski<script:module xmlns:script="http://openoffice.org/2000/script" script:name="GermanHolidays" script:language="StarBasic">Option Explicit
24*b1cdbd2cSJim Jagielski
25*b1cdbd2cSJim JagielskiSub Main()
26*b1cdbd2cSJim Jagielski	Call CalAutopilotTable()
27*b1cdbd2cSJim JagielskiEnd Sub
28*b1cdbd2cSJim Jagielski
29*b1cdbd2cSJim JagielskiFunction CalGetGermanLandAtMousePos(byval X as single, byval Y as single) as Integer
30*b1cdbd2cSJim Jagielski	CalChoosenLand = 0
31*b1cdbd2cSJim Jagielski	If (X&gt;73)And(X&lt;130)And(Y&gt;=117)And(Y&lt;181) Then
32*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLBayern
33*b1cdbd2cSJim Jagielski
34*b1cdbd2cSJim Jagielski	ElseIf (X&gt;41)And(X&lt;89)And(Y&gt;=136)And(Y&lt;183) Then
35*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLBadenWuert
36*b1cdbd2cSJim Jagielski
37*b1cdbd2cSJim Jagielski	ElseIf (X&gt;18)And(X&lt;35)And(Y&gt;136)And(Y&lt;147) Then
38*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLSaarland
39*b1cdbd2cSJim Jagielski
40*b1cdbd2cSJim Jagielski	ElseIf (X&gt;13)And(X&lt;42)And(Y&gt;111)And(Y&lt;146) Then
41*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLRheinlandPfalz
42*b1cdbd2cSJim Jagielski
43*b1cdbd2cSJim Jagielski	ElseIf (X&gt;15)And(X&lt;=60)And(Y&gt;=69)And(Y&lt;112) Then
44*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLNordrheinWest
45*b1cdbd2cSJim Jagielski
46*b1cdbd2cSJim Jagielski	ElseIf (X&gt;=42)And(X&lt;78)And(Y&gt;=95)And(Y&lt;136) Then
47*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLHessen
48*b1cdbd2cSJim Jagielski
49*b1cdbd2cSJim Jagielski	ElseIf (X&gt;=78)And(X&lt;112)And(Y&gt;=95)And(Y&lt;117) Then
50*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLThueringen
51*b1cdbd2cSJim Jagielski
52*b1cdbd2cSJim Jagielski	ElseIf (X&gt;=112)And(X&lt;158)And(Y&gt;=88)And(Y&lt;114) Then
53*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLSachsen
54*b1cdbd2cSJim Jagielski
55*b1cdbd2cSJim Jagielski	ElseIf (X&gt;77)And(X&lt;84)And(Y&gt;35)And(Y&lt;42) Then
56*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLHamburg
57*b1cdbd2cSJim Jagielski
58*b1cdbd2cSJim Jagielski	ElseIf (X&gt;56)And(X&lt;60)And(Y&gt;36)And(Y&lt;41) Then
59*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLBremen
60*b1cdbd2cSJim Jagielski
61*b1cdbd2cSJim Jagielski	ElseIf (X&gt;58)And(X&lt;63)And(Y&gt;44)And(Y&lt;52) Then
62*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLBremen
63*b1cdbd2cSJim Jagielski
64*b1cdbd2cSJim Jagielski	ElseIf (X&gt;52)And(X&lt;95)And(Y&gt;8)And(Y&lt;40) Then
65*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLSchlHolstein
66*b1cdbd2cSJim Jagielski
67*b1cdbd2cSJim Jagielski	ElseIf (X&gt;90)And(X&lt;149)And(Y&gt;23)And(Y&lt;48) Then
68*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLMeckPomm
69*b1cdbd2cSJim Jagielski
70*b1cdbd2cSJim Jagielski	ElseIf (X&gt;28)And(X&lt;90)And(Y&gt;35)And(Y&lt;69) Then
71*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLNiedersachsen
72*b1cdbd2cSJim Jagielski
73*b1cdbd2cSJim Jagielski	ElseIf (X&gt;60)And(X&lt;90)And(Y&gt;=69)And(Y&lt;95) Then
74*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLNiedersachsen
75*b1cdbd2cSJim Jagielski
76*b1cdbd2cSJim Jagielski	ElseIf (X&gt;=90)And(X&lt;=115)And(Y&gt;47)And(Y&lt;95) Then
77*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLSachsenAnhalt
78*b1cdbd2cSJim Jagielski
79*b1cdbd2cSJim Jagielski	ElseIf (X&gt;129)And(X&lt;139)And(Y&gt;60)And(Y&lt;66) Then
80*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLBerlin
81*b1cdbd2cSJim Jagielski
82*b1cdbd2cSJim Jagielski	ElseIf (X&gt;115)And(X&lt;151)And(Y&gt;=48)And(Y&lt;88) Then
83*b1cdbd2cSJim Jagielski		CalChoosenLand = CalBLBrandenburg
84*b1cdbd2cSJim Jagielski	End If
85*b1cdbd2cSJim Jagielski	CalGetGermanLandAtMousePos = CalChoosenLand
86*b1cdbd2cSJim JagielskiEnd Function
87*b1cdbd2cSJim Jagielski
88*b1cdbd2cSJim Jagielski
89*b1cdbd2cSJim Jagielski
90*b1cdbd2cSJim JagielskiSub CalFindWholeYearHolidays_GERMANY(ByVal iSelYear as Integer, ByVal iCountry as Integer)
91*b1cdbd2cSJim Jagielski	Dim So as Integer
92*b1cdbd2cSJim Jagielski	Dim OsternDate&amp;, VierterAdvent&amp;
93*b1cdbd2cSJim Jagielski
94*b1cdbd2cSJim Jagielski	If (iCountry &lt; 1) Or (iCountry &gt; 16) Then
95*b1cdbd2cSJim Jagielski		iCountry = CalBLHamburg
96*b1cdbd2cSJim Jagielski	End If
97*b1cdbd2cSJim Jagielski	OsternDate&amp; = CalEasterTable&amp;(iSelYear)
98*b1cdbd2cSJim Jagielski	So = 1
99*b1cdbd2cSJim Jagielski
100*b1cdbd2cSJim Jagielski	CalInsertBankholiday(DateSerial(iSelYear, 1, 1), &quot;Neujahr&quot;, cHolidayType_Full)
101*b1cdbd2cSJim Jagielski
102*b1cdbd2cSJim Jagielski	If (iCountry = CalBLBayern) Or (iCountry = CalBLBadenWuert) Or (iCountry = CalBLSachsenAnhalt) Then
103*b1cdbd2cSJim Jagielski		CalInsertBankholiday(DateSerial(iSelYear, 1, 6), &quot;Hl. 3 Könige&quot;, cHolidayType_Full)
104*b1cdbd2cSJim Jagielski	End If
105*b1cdbd2cSJim Jagielski
106*b1cdbd2cSJim Jagielski	CalInsertBankholiday(OsternDate&amp;-2, &quot;Karfreitag&quot;, cHolidayType_Full)
107*b1cdbd2cSJim Jagielski	CalInsertBankholiday(OsternDate&amp;, &quot;Ostersonntag&quot;, cHolidayType_Full)
108*b1cdbd2cSJim Jagielski	CalInsertBankholiday(OsternDate&amp;+1, &quot;Ostermontag&quot;, cHolidayType_Full)
109*b1cdbd2cSJim Jagielski	CalInsertBankholiday(DateSerial(iSelYear, 5, 1), &quot;Maifeiertag&quot;, cHolidayType_Full)
110*b1cdbd2cSJim Jagielski	CalInsertBankholiday(OsternDate&amp;+39, &quot;Christi Himmelfahrt&quot;, cHolidayType_Full)
111*b1cdbd2cSJim Jagielski	CalInsertBankholiday(OsternDate&amp;+49, &quot;Pfingstsonntag&quot;, cHolidayType_Full)
112*b1cdbd2cSJim Jagielski	CalInsertBankholiday(OsternDate&amp;+50, &quot;Pfingstmontag&quot;, cHolidayType_Full)
113*b1cdbd2cSJim Jagielski
114*b1cdbd2cSJim Jagielski	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
115*b1cdbd2cSJim Jagielski		CalInsertBankholiday(OsternDate&amp;+60, &quot;Fronleichnam&quot;, cHolidayType_Full)
116*b1cdbd2cSJim Jagielski	End If
117*b1cdbd2cSJim Jagielski
118*b1cdbd2cSJim Jagielski	If (iCountry = CalBLBayern) Or (iCountry = CalBLSaarland) Then
119*b1cdbd2cSJim Jagielski		CalInsertBankholiday(DateSerial(iSelYear, 8, 15), &quot;Mariä Himmelfahrt&quot;, cHolidayType_Full)
120*b1cdbd2cSJim Jagielski	End If
121*b1cdbd2cSJim Jagielski
122*b1cdbd2cSJim Jagielski	CalInsertBankholiday(DateSerial(iSelYear, 10, 3), &quot;Tag der dt. Einheit&quot;, cHolidayType_Full)
123*b1cdbd2cSJim Jagielski
124*b1cdbd2cSJim Jagielski	If (iCountry=CalBLBrandenburg) Or (iCountry=CalBLMeckPomm) Or (iCountry=CalBLSachsenAnhalt) Or (iCountry=CalBLSachsen) Or (iCountry=CalBLThueringen) Then
125*b1cdbd2cSJim Jagielski		CalInsertBankholiday(DateSerial(iSelYear, 10, 31), &quot;Reformationstag&quot;, cHolidayType_Full)
126*b1cdbd2cSJim Jagielski	End If
127*b1cdbd2cSJim Jagielski
128*b1cdbd2cSJim Jagielski	If (iCountry = CalBLBadenWuert) Or (iCountry = CalBLBayern) Or (iCountry = CalBLNordRheinWest) Or (iCountry = CalBLRheinlandPfalz) Or (iCountry = CalBLSaarland) Or (iCountry = CalBLSachsen) Or (iCountry = CalBLThueringen) Then
129*b1cdbd2cSJim Jagielski		CalInsertBankholiday(DateSerial(iSelYear, 11, 1), &quot;Allerheiligen&quot;, cHolidayType_Full)
130*b1cdbd2cSJim Jagielski	End If
131*b1cdbd2cSJim Jagielski
132*b1cdbd2cSJim Jagielski	vierterAdvent = DateSerial(iSelYear, 12, 24)
133*b1cdbd2cSJim Jagielski	While WeekDay(vierterAdvent) &lt;&gt; So
134*b1cdbd2cSJim Jagielski		vierterAdvent = vierterAdvent - 1
135*b1cdbd2cSJim Jagielski	Wend
136*b1cdbd2cSJim Jagielski
137*b1cdbd2cSJim Jagielski	If iCountry = CalBLSachsen Then
138*b1cdbd2cSJim Jagielski		CalInsertBankholiday(vierterAdvent-32, &quot;Buß- und Bettag&quot;, cHolidayType_Full)
139*b1cdbd2cSJim Jagielski	Else
140*b1cdbd2cSJim Jagielski		CalInsertBankholiday(vierterAdvent-32, &quot;Buß- und Bettag&quot;, cHolidayType_Half)
141*b1cdbd2cSJim Jagielski	End If
142*b1cdbd2cSJim Jagielski	CalInsertBankholiday(vierterAdvent-21, &quot;1. Advent&quot;, cHolidayType_Full)
143*b1cdbd2cSJim Jagielski	CalInsertBankholiday(vierterAdvent-14, &quot;2. Advent&quot;, cHolidayType_Full)
144*b1cdbd2cSJim Jagielski	CalInsertBankholiday(vierterAdvent-7, &quot;3. Advent&quot;, cHolidayType_Full)
145*b1cdbd2cSJim Jagielski	CalInsertBankholiday(vierterAdvent, &quot;4. Advent&quot;, cHolidayType_Full)
146*b1cdbd2cSJim Jagielski
147*b1cdbd2cSJim Jagielski	CalInsertBankholiday(Dateserial(iSelYear, 12, 24), &quot;Heiligabend&quot;, cHolidayType_Half)
148*b1cdbd2cSJim Jagielski	CalInsertBankholiday(Dateserial(iSelYear, 12, 25), &quot;1. Weihnachtstag&quot;, cHolidayType_Full)
149*b1cdbd2cSJim Jagielski	CalInsertBankholiday(Dateserial(iSelYear, 12, 26), &quot;2. Weihnachtstag&quot;, cHolidayType_Full)
150*b1cdbd2cSJim Jagielski	CalInsertBankholiday(Dateserial(iSelYear, 12, 31), &quot;Sylvester&quot;, cHolidayType_Half)
151*b1cdbd2cSJim JagielskiEnd Sub
152*b1cdbd2cSJim Jagielski</script:module>
153