mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-05-09 08:24:02 +00: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>
|
||||
File diff suppressed because it is too large
Load Diff
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