home *** CD-ROM | disk | FTP | other *** search
/ com!online 2001 December / COMCD1201.iso / openoffice / f_0031 / HolidayGerman.xba < prev    next >
Encoding:
Extensible Markup Language  |  2001-07-20  |  7.5 KB  |  171 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
  3. <script:module xmlns:script="http://openoffice.org/2000/script" script:name="HolidayGerman" script:language="StarBasic">Option Explicit
  4.  
  5. Sub Main()
  6.     Call CalAutopilotTable()
  7. End Sub
  8.  
  9. Function CalGetGermanLandAtMousePos(byval X as single, byval Y as single) as Integer
  10. '    Liefert das BundesLand, das sich unter Maus befindet.
  11. '    oStatusline.SetText("X: " & X & "; " & "Y: " & Y)
  12.     CalChoosenLand = 0
  13.     If (X>68)And(X<125)And(Y>116)And(Y<176) Then
  14.         CalChoosenLand = CalBLBayern
  15.  
  16.     ElseIf (X>36)And(X<84)And(Y>131)And(Y<178) Then 
  17.         CalChoosenLand = CalBLBadenWuert
  18.         
  19.     ElseIf (X>9)And(X<26)And(Y>128)And(Y<139) Then 
  20.         CalChoosenLand = CalBLSaarland
  21.         
  22.     ElseIf (X>8)And(X<37)And(Y>107)And(Y<141) Then 
  23.         CalChoosenLand = CalBLRheinlandPfalz
  24.         
  25.     ElseIf (X>5)And(X<53)And(Y>65)And(Y<107) Then 
  26.         CalChoosenLand = CalBLNordrheinWest
  27.  
  28.     ElseIf (X>39)And(X<70)And(Y>87)And(Y<131) Then 
  29.         CalChoosenLand = CalBLHessen
  30.  
  31.     ElseIf (X>70)And(X<105)And(Y>83)And(Y<116) Then 
  32.         CalChoosenLand = CalBLThueringen
  33.         
  34.     ElseIf (X>105)And(X<150)And(Y>82)And(Y<107) Then 
  35.         CalChoosenLand = CalBLSachsen
  36.         
  37.     ElseIf (X>47)And(X<85)And(Y>6)And(Y<37) Then 
  38.         CalChoosenLand = CalBLSchlHolstein
  39.  
  40.     ElseIf (X>74)And(X<85)And(Y>37)And(Y<43) Then 
  41.         CalChoosenLand = CalBLHamburg
  42.  
  43.     ElseIf (X>85)And(X<138)And(Y>18)And(Y<45) Then 
  44.         CalChoosenLand = CalBLMeckPomm
  45.  
  46.     ElseIf (X>49)And(X<55)And(Y>41)And(Y<47) Then 
  47.         CalChoosenLand = CalBLBremen
  48.  
  49.     ElseIf (X>51)And(X<65)And(Y>53)And(Y<60) Then 
  50.         CalChoosenLand = CalBLBremen
  51.  
  52.     ElseIf (X>23)And(X<85)And(Y>38)And(Y<67) Then 
  53.         CalChoosenLand = CalBLNiedersachsen
  54.  
  55.     ElseIf (X>53)And(X<85)And(Y>67)And(Y<83) Then 
  56.         CalChoosenLand = CalBLNiedersachsen
  57.  
  58.     ElseIf (X>85)And(X<105)And(Y>45)And(Y<83) Then 
  59.         CalChoosenLand = CalBLSachsenAnhalt
  60.  
  61.     ElseIf (X>116)And(X<130)And(Y>58)And(Y<68) Then 
  62.         CalChoosenLand = CalBLBerlin
  63.  
  64.     ElseIf (X>105)And(X<144)And(Y>45)And(Y<82) Then 
  65.         CalChoosenLand = CalBLBrandenburg
  66.     End If
  67. '    If (CalChoosenLand >= Lbound(BLNameList)) AND ((CalChoosenLand <= Ubound(BLNameList))) Then
  68. '        Land$ = BLNameList(CalChoosenLand)
  69. '    End If
  70.     CalGetGermanLandAtMousePos = CalChoosenLand
  71. End Function
  72.  
  73.     
  74. Sub CalMouseClick()
  75.     '    Wenn der MausCursor auf dem Previewfeld steht, und die
  76.     '    linke Maustaste gedrueckt wird, wird das aktive Aktualisieren
  77.     '    des Bundeslandes durch MouseClicked% = True unterbunden.
  78.  
  79.     CalMouseMoved(1, 0, LastMousePosX, LastMousePosY)
  80.  
  81.     If (CalChoosenLand>=CalBLBayern) And (CalChoosenLand<=CalBLThueringen) Then 
  82.         MouseClicked% = True
  83.         LandWhenClick% = CalChoosenLand
  84.     End If
  85. End Sub
  86.  
  87.  
  88. Sub CalSyncInternalVars()
  89.     MouseClicked = True
  90.     If Ubound(DlgCalModel.lstOwnData.SelectedItems()) > 0 Then
  91.         CalChoosenLand =  DlgCalModel.lstHolidays.SelectedItems(0)
  92.         LandWhenClick = CalChoosenLand
  93.     End If
  94. End Sub
  95.  
  96.  
  97.  
  98. Sub CalFindWholeYearHolidays_GERMANY(byval YearInt%, byval Country%)
  99.     
  100.     '    Ermittelt die Feiertage eines gesamten Jahres (Parameter YearInt%),
  101.     '    bezogen auf ein bestimmtes Bundesland (Parameter Country%). Kein 
  102.     '    bestimmtes Bundesland bedeutet, dass der Parameter gleich der 
  103.     '    Konstante calBLHamburg ist, da Hamburg nur Standardfeiertage kennt. 
  104.     '    Die Feiertage werden in das Array CalBankHolidayName$ geschrieben. 
  105.     '    Der Index dieses Arrays geht bis vierhundert. Der 1. Januar hat den 
  106.     '    Indexwert 1, der 2. Januar den Indexwert 2 usw. Das bedeutet, da├ƒ 
  107.     '    wenn am 2. Januar kein Feiertag existiert, liefert 
  108.     '    CalBankHolidayName$(DateSerial(0, 1, 2) eine leere Zeichenkette ("").
  109.  
  110.     Dim So%, Count%
  111.     Dim OsternDate&, VierterAdvent&
  112.  
  113.     If (Country% < 1) Or (Country% > 16) Then 
  114.         Country% = CalBLHamburg
  115.     End If
  116.     OsternDate& = CalEasterTable&(YearInt%)
  117.     So% = 1
  118.  
  119.     CalInsertBankholiday(DateSerial(YearInt%, 1, 1), "Neujahr", cHolidayType_Full)
  120.     
  121.     If (country% = CalBLBayern) Or (country% = CalBLBadenWuert) Or (country% = CalBLSachsenAnhalt) Then
  122.         CalInsertBankholiday(DateSerial(YearInt%, 1, 6), "Hl. 3 K├╢nige", cHolidayType_Full)
  123.     End If
  124.     
  125.     CalInsertBankholiday(OsternDate&-2, "Karfreitag", cHolidayType_Full)
  126.     CalInsertBankholiday(OsternDate&, "Ostersonntag", cHolidayType_Full)
  127.     CalInsertBankholiday(OsternDate&+1, "Ostermontag", cHolidayType_Full)
  128.     CalInsertBankholiday(DateSerial(YearInt%, 5, 1), "Maifeiertag", cHolidayType_Full)
  129.     CalInsertBankholiday(OsternDate&+39, "Christi Himmelfahrt", cHolidayType_Full)
  130.     CalInsertBankholiday(OsternDate&+49, "Pfingstsonntag", cHolidayType_Full)
  131.     CalInsertBankholiday(OsternDate&+50, "Pfingstmontag", cHolidayType_Full)
  132.  
  133.     If (country% = CalBLBadenWuert) Or (country% = CalBLBayern) Or (country% = CalBLHessen) Or (country% = CalBLNordRheinWest) Or (country% = CalBLRheinlandPfalz) Or (country% = CalBLSaarland) Or (country% = CalBLSachsen) Or (country% = CalBLThueringen) Then
  134.         CalInsertBankholiday(OsternDate&+60, "Fronleichnam", cHolidayType_Full)
  135.     End If
  136.  
  137.     If (country% = CalBLBayern) Or (country% = CalBLSaarland) Then
  138.         CalInsertBankholiday(DateSerial(YearInt%, 8, 15), "Mari├ñ Himmelfahrt", cHolidayType_Full)
  139.     End If
  140.  
  141.     CalInsertBankholiday(DateSerial(YearInt%, 10, 3), "Tag der dt. Einheit", cHolidayType_Full)
  142.  
  143.     If (country%=CalBLBrandenburg) Or (country%=CalBLMeckPomm) Or (country%=CalBLSachsenAnhalt) Or (country%=CalBLSachsen) Or (country%=CalBLThueringen) Then
  144.         CalInsertBankholiday(DateSerial(YearInt%, 10, 31), "Reformationstag", cHolidayType_Full)
  145.     End If
  146.  
  147.     If (country% = CalBLBadenWuert) Or (country% = CalBLBayern) Or (country% = CalBLNordRheinWest) Or (country% = CalBLRheinlandPfalz) Or (country% = CalBLSaarland) Or (country% = CalBLSachsen) Or (country% = CalBLThueringen) Then
  148.         CalInsertBankholiday(DateSerial(YearInt%, 11, 1), "Allerheiligen", cHolidayType_Full)
  149.     End If
  150.  
  151.     VierterAdvent& = DateSerial(YearInt%, 12, 24)
  152.     While WeekDay(vierterAdvent&) <> So%
  153.         vierterAdvent& = vierterAdvent& - 1
  154.     Wend
  155.  
  156.     If country% = CalBLSachsen Then
  157.         CalInsertBankholiday(vierterAdvent&-32, "Bu├ƒ- und Bettag", cHolidayType_Full)
  158.     Else
  159.         CalInsertBankholiday(vierterAdvent&-32, "Bu├ƒ- und Bettag", cHolidayType_Half)
  160.     End If        ' Dank an die EKD f├╝r die Berechnungsvorschrift des Bu├ƒ- und Bettags!
  161.     CalInsertBankholiday(vierterAdvent&-21, "1. Advent", cHolidayType_Full)
  162.     CalInsertBankholiday(vierterAdvent&-14, "2. Advent", cHolidayType_Full)
  163.     CalInsertBankholiday(vierterAdvent&-7, "3. Advent", cHolidayType_Full)
  164.     CalInsertBankholiday(vierterAdvent&, "4. Advent", cHolidayType_Full)
  165.  
  166.     CalInsertBankholiday(Dateserial(YearInt%, 12, 24), "Heiligabend", cHolidayType_Half)
  167.     CalInsertBankholiday(Dateserial(YearInt%, 12, 25), "1. Weihnachtstag", cHolidayType_Full)
  168.     CalInsertBankholiday(Dateserial(YearInt%, 12, 26), "2. Weihnachtstag", cHolidayType_Full)
  169.     CalInsertBankholiday(Dateserial(YearInt%, 12, 31), "Sylvester", cHolidayType_Half)
  170. End Sub
  171. </script:module>