diff options
Diffstat (limited to 'wizards/source/schedule/DlgControl.xba')
-rw-r--r-- | wizards/source/schedule/DlgControl.xba | 358 |
1 files changed, 122 insertions, 236 deletions
diff --git a/wizards/source/schedule/DlgControl.xba b/wizards/source/schedule/DlgControl.xba index 659f8c02fd2c..deee7546ae4f 100644 --- a/wizards/source/schedule/DlgControl.xba +++ b/wizards/source/schedule/DlgControl.xba @@ -1,9 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> - +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> <script:module xmlns:script="http://openoffice.org/2000/script" script:name="DlgControl" script:language="StarBasic">Option Explicit Dim CalBitmap As Object +Public bDoSelect as Boolean +' Todo: Adjustmentlistener an der Scrollbar anmelden Sub Main() Call CalAutopilotTable() @@ -40,110 +42,27 @@ End Sub -Sub CalCalcPictureData() - Dim bFittingX%, bFittingY%, DlgWidth%, DlgHeight%, nXMove%, nYMove%, Width%, Height% - Dim x#, y# - - Width% = 152 - Height% = 189 - BitmapDir = GetBitmapDir() - - Set CalBitmap = LoadPicture(BitmapDir & GetPathSeparator() & sBitmapFilename$ '(sCurLangLocale)) - If 1 = GetGUIType() Then - DlgHeight% = CInt(DlgBuffer.Preview1.Height * GetDialogZoomFactorY(DlgBuffer.Preview1.Height)) - DlgWidth% = CInt(DlgBuffer.Preview1.Width * GetDialogZoomFactorX(DlgBuffer.Preview1.Width)) - nXMove% = TwipsPerPixelX() * 3 - nYMove% = TwipsPerPixelX() * 3 - Else - DlgHeight% = CInt((DlgBuffer.Preview1.Height - TwipsPerPixelY() * 3) * GetDialogZoomFactorY(DlgBuffer.Preview1.Height)) - DlgWidth% = CInt((DlgBuffer.Preview1.Width - TwipsPerPixelX() * 3) * GetDialogZoomFactorX(DlgBuffer.Preview1.Width)) - nXMove% = 0 - nYMove% = 0 - End If - - CalTWIPSPicWidth% = TwipsPerPixelX() * Width% - CalTWIPSPicHeight% = TwipsPerPixelY() * Height% - - ' Beste Möglichkeit: Bild in Orignalgroesse zentrieren - ' Alternative : Nach schlchechter passenden Faktor skalieren - If (Not ((CalTWIPSPicWidth% <= DlgWidth%) And (CalTWIPSPicHeight% <= DlgHeight%))) Then - x# = (CalTWIPSPicWidth% / DlgWidth%) - y# = (CalTWIPSPicHeight% / DlgHeight%) - If (x# > y#) Then - CalTWIPSPicWidth% = CInt(DlgWidth%) - CalTWIPSPicHeight% = CInt(CalTWIPSPicHeight% / x#) - Else - CalTWIPSPicHeight% = CInt(DlgHeight%) - CalTWIPSPicWidth% = CInt(CalTWIPSPicWidth% / y#) - End If - End If - - CalStartX% = CInt((DlgWidth% / 2) - (CalTWIPSPicWidth% / 2)) - nXMove% - CalStartY% = CInt((DlgHeight% / 2) - (CalTWIPSPicHeight% / 2)) - nYMove% -End Sub - - - -Sub CalPreviewPaint() - Preview1.Cls() - Preview1.DrawPicture(CalBitmap, CalStartX%, CalStartY%, CalStartX% + CalTWIPSPicWidth%, CalStartY% + CalTWIPSPicHeight%) - Preview1.DrawBox(CalStartX%, CalStartY%, CalStartX% + CalTWIPSPicWidth%, CalStartY% + CalTWIPSPicHeight%) -End Sub - - - Sub CalcmdDeleteSelect() - - Dim Count%, CountMarked%, MsgBoxResult%, AllSelected% - - AllSelected = False - CountMarked% = 0 - For Count% = 0 To lbOwnData.ListCount-1 - If (DlgBuffer.lbOwnData.Selected(Count%) = True) Then CountMarked% = CountMarked% + 1 - Next - - If (CountMarked% > 0) Then - MsgBoxResult% = MsgBox(cCalSubCmdDeleteSelect_DeleteSelEntry$, 4+32, cCalSubCmdDeleteSelect_DeleteSelEntryTitle$) - - If MsgBoxResult% = 6 Then - If Not AllSelected% Then - Call CalDeleteAllSelected() - Else - DlgBuffer.lbOwnData.Clear() - End If - ' Flag zum Speichern der neuen Daten. - CalOwnDataChanged% = True - - cmdDelete.Enabled = False +Dim MsgBoxResult as Integer + If Ubound(DlgCalModel.lstOwnData.SelectedItems()) > -1 Then + MsgBoxResult = MsgBox(cCalSubcmdDeleteSelect_DeleteSelEntry$, 4+32, cCalSubcmdDeleteSelect_DeleteSelEntryTitle$) + If MsgBoxResult = 6 Then + DlgCalModel.lstOwnData.StringItemList() = RemoveSelected(DlgCalModel.lstOwnData) + ' Flag zum Speichern der neuen Daten. + bCalOwnDataChanged = True + DlgCalModel.cmdDelete.Enabled = Ubound(DlgCalModel.lstOwnData.StringItemList()) > -1 Call CalClearInputMask() End If End If End Sub - -Sub CalDeleteAllSelected() - - Dim Count%, LastSelPos% - - While LastSelPos% <> -1 - LastSelPos% = -1 - For Count%=0 To lbOwnData.ListCount()-1 - If DlgBuffer.lbOwnData.Selected(Count%) Then LastSelPos% = Count% - Next - If LastSelPos% <> - 1 Then - DlgBuffer.lbOwnData.RemoveItem(LastSelPos%) - End If - Wend - DlgBuffer.lbOwnData.Refresh() -End Sub - - - Sub CalSaveOwnEventControls() - DlgBuffer.txtOwnEventDay.Tag = DlgBuffer.txtOwnEventDay.Text - DlgBuffer.txtOwnEventMonth.Tag = DlgBuffer.txtOwnEventMonth.Text - DlgBuffer.txtOwnEventYear.Tag = DlgBuffer.txtOwnEventYear.Text + With DlgCalModel + .txtOwnEventDay.Tag = .txtOwnEventDay.Text + .txtOwnEventMonth.Tag = .txtOwnEventMonth.Text + .DlgCalModel.txtOwnEventYear.Tag = .DlgCalModel.txtOwnEventYear.Text + End With End Sub @@ -174,105 +93,47 @@ Sub ModIntTextBox (txtYear As Object, ByVal nMax%, ByVal nMin%, ByVal sDefault$, End Sub -Sub CalSpinOwnEventDayUp() - Call ModIntTextBox(txtOwnEventDay, 31, 1, "1", 1) -End Sub - - -Sub CalSpinOwnEventDayDown() - Call ModIntTextBox(txtOwnEventDay, 31, 1, "1", -1) -End Sub - - -Sub CalSpinGeneralYearUp() - Call ModIntTextBox(txtYear, 9956, 1583, Trim(Str(Year(Now()))),1) -End Sub - - -Sub CalSpinGeneralYearDown() - Call ModIntTextBox(txtYear, 9956, 1583, Trim(Str(Year(Now()))), -1 ) -End Sub - - -Sub CalSpinOwnEventYearDown() - Call ModIntTextBox(txtOwnEventYear, 9956, 1583, Trim(Str(Year(Now()))), -1 ) -End Sub - - -Sub CalSpinOwnEventYearUp() - Call ModIntTextBox(txtOwnEventYear, 9956, 1583, Trim(Str(Year(Now()))) , 1) -End Sub - -Sub CalModMonthTextBox(txtMonth As Object,IncFactor as Integer) - Dim nActVal& - nActVal& = Val(txtMonth.Text) - If (1 <= nActVal& And 12 >= nActVal) Then - txtMonth.Text = cCalShortMonthNames$(nActVal&) - End If - nActVal& = CalGetIntOfShortMonthName%(txtMonth.Text) - If 0 = nActVal& Then - Beep - txtMonth.Text = cCalShortMonthNames$(1) - ElseIf (1 < nActVal&) AND (IncFactor = -1) Then - txtMonth.Text = cCalShortMonthNames$(nActVal& + IncFactor) - ElseIf (12 > nActVal&)AND (IncFactor = 1) Then - txtMonth.Text = cCalShortMonthNames$(nActVal& + IncFactor) - End If -End Sub - - -Sub CalSpinGeneralMonthUp() - CalModMonthTextBox(txtMonth, 1) -End Sub - - -Sub CalSpinGeneralMonthDown() - CalModMonthTextBox(txtMonth,-1) -End Sub - - -Sub CalSpinOwnEventMonthDown() - Call CalModMonthTextBox(txtOwnEventMonth, -1) -End Sub - - -Sub CalSpinOwnEventMonthUp() - Call CalModMonthTextBox(txtOwnEventMonth, 1) -End Sub - - -Sub CalChkYearEnDisabled() - ' Falls der RadioButton für einen Jahreskalender angeklickt - ' worden ist, müssen die Controls für den Monat Disabled - ' werden, da ihre Werte in einer Jahrestabelle aufgehen. - lblEventYear.Enabled = Not lblEventYear.Enabled - txtownEventYear.Enabled = Not txtownEventYear.Enabled - SpinOwnEventYear.Enabled = Not SpinOwnEventYear.Enabled - If (txtOwnEventYear.Text = "") And (lblEventYear.Enabled = True) Then - txtOwnEventYear.Text = Trim$(Str$(Year(Now()))) - End If +Sub ToggleYearBox() +' Falls der RadioButton für einen Jahreskalender angeklickt +' worden ist, müssen die Controls für den Monat Disabled +' werden, da ihre Werte in einer Jahrestabelle aufgehen. + With DlgCalModel + .txtOwnEventYear.Enabled = .chkEventOnce.State = 1 + .lblEventYear.Enabled = .chkEventOnce.State = 1 + If .txtOwnEventYear.Text = "" And .lblEventYear.Enabled Then + .txtOwnEventYear.Text = Trim$(Str$(Year(Now()))) + End If + End With End Sub -Sub CalMouseMoved(Button as integer, Shift as integer, X as single, Y as single) - +Sub CalMouseMoved(aEvent as object) +Dim ListIndex as Integer + oStatusline.SetText(aEvent.ClickCount) +' If aEvent.ClickCount = 2 Then +' oStatusLine.SetText("Click") +' bDoSelect = False +' Else +' oStatusLine.SetText("") +' End If ' Nimmt Mousemoves ueber dem Bitmap entgegen, und wertet sie je nach ' Land aus. - Select Case sCurLangLocale - Case "de" 'cLANGUAGE_GERMAN - ' Ermittelt das Land auf dem sich der MausCursor befindet, und - ' aktualisiert die Textbox mit der Bundeslandbezeichnung, falls - ' ein Mausklick stattfandt. - Dim Land$ - If (Button = 1) Or (MouseClicked% = False)Then - cmbState.ListIndex = CalGetGermanLandAtMousePos(X, Y, Land$) - End If + Case cLANGUAGE_GERMAN + ' Ermittelt das Land auf dem sich der MausCursor befindet, und aktualisiert + ' die Textbox mit der Bundeslandbezeichnung, falls ein Mausklick stattfandt. +' If bDoSelect Then + ListIndex = CalGetGermanLandAtMousePos(aEvent.X, aEvent.Y, Land$) + DlgCalendar.GetControl("lstHolidays").SelectItemPos(ListIndex, True) + If aEvent.ClickCount = 2 Then + bDoSelect = False + End If +' End If End Select - LastMousePosX = X - LastMousePosY = Y + LastMousePosX = aEvent.X + LastMousePosY = aEvent.Y End Sub @@ -281,19 +142,19 @@ Sub CalChangeGeneralMonth() Dim MonthToCheck$ Dim ValMonthToCheck% - MonthToCheck$ = DlgBuffer.txtMonth.Text + MonthToCheck$ = DlgCalModel.txtMonth.Text ValMonthToCheck% = Val(MonthToCheck$) If (ValMonthToCheck% >= 1) And (ValMonthToCheck% <=12) Then - DlgBuffer.txtMonth.Text = cCalShortMonthNames$(ValMonthToCheck%) + DlgCalModel.txtMonth.Text = cCalShortMonthNames$(ValMonthToCheck%) Exit Sub End If If CalGetIntOfShortMonthName%(Trim(Left(MonthToCheck$, 3))) = 0 Then Beep - DlgBuffer.txtMonth.Text = DlgBuffer.txtMonth.Tag + DlgCalModel.txtMonth.Text = DlgCalModel.txtMonth.Tag Else - DlgBuffer.txtMonth.Text = Trim(Left(MonthToCheck, 3)) + DlgCalModel.txtMonth.Text = Trim(Left(MonthToCheck, 3)) End If End Sub @@ -301,69 +162,94 @@ End Sub Sub CalChkForChangeInsertAccept - ' Aktualisiert die Caption des Insert/Accept Buttons - If (DataSelectedFromList=True) And (ButtonCaptionIsInsert) Then - DlgBuffer.cmdInsert.Caption = cSubChkForChangeInsertAccept_Accpet$ + ' Aktualisiert die Label des Insert/Accept Buttons + If (DataSelectedFromList=True) And (ButtonLabelIsInsert) Then + DlgCalModel.cmdInsert.Label = cSubChkForChangeInsertAccept_Accpet$ End If End Sub Sub CalClearInputMask() - ' Löscht die Werte der Eingabe Controls für ein - ' neues Ereignis. - chkEventOnce.Value = False - lblEventYear.Enabled = False - txtownEventYear.Enabled = False - SpinOwnEventYear.Enabled = False - txtOwnEventYear.Text = "" - txtEvent.Text = "" - txtOwnEventDay.Text = "" - txtOwnEventMonth.Text = "" - - txtEvent.SetFocus() +Dim NullList() as String +' Löscht die Werte der Eingabe Controls für ein neues Ereignis. + With DlgCalModel + .chkEventOnce.State = 0 + .lblEventYear.Enabled = False + .txtOwnEventYear.Enabled = False +' SpinOwnEventYear.Enabled = False + .txtOwnEventYear.Text = "" + .txtEvent.Text = "" + .txtOwnEventDay.Text = "" +' Todo: Wie kriegt man den Focus auf dieses verdammte Control? +' .txtEvent.DefaultButton = True + End With + DlgCalModel.lstOwnEventMonth.SelectedItems() = Nulllist() End Sub - -Function CalCountSelected%(ByVal listBox as Object, PosSelect%) - ' Zählt die selekierten Einträge im Control listBox. - ' PosSelect liefert den Index des selektierten Eintrags - ' zurück. Dieser Wert ist natürlich nur zu gebrachen, - ' wenn nur ein Eintrag selektiert ist. - Dim Count%, Result% - - Result% = 0 - For Count% = 0 To listBox.ListCount-1 - If ListBox.Selected(Count%) Then - Result% = Result% + 1 - PosSelect% = Count% - End If - Next - CalCountSelected% = Result% -End Function - - - Sub CalmdSwitchOwnDataOrGeneral() - 'Ändert den Titel der Dialogbox beim Seitenwechsel und die 'Beschriftungen der Knöpfe - If DlgBuffer.CurrentStep = 1 Then - DlgBuffer.CurrentStep = 2 - DlgBuffer.DlgCmdOwnData.Caption = cCalSubcmdSwitchOwnDataOrGeneral_Back$ + If DlgCalModel.Step = 1 Then + DlgCalModel.Step = 2 + DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_Back$ + DlgCalModel.cmdInsert.Enabled = DlgCalModel.txtEvent.Text <> "" + ToggleYearBox() Else - DlgBuffer.CurrentStep = 1 - DlgBuffer.DlgCmdOwnData.Caption = cCalSubcmdSwitchOwnDataOrGeneral_OwnData$ + DlgCalModel.Step = 1 + DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_OwnData$ End If End Sub -Sub LoadDialog() - DlgBuffer.load +Sub ToggleInsertButton() + DlgCalModel.cmdInsert.Enabled = LTrim(DlgCalModel.txtEvent.Text) <> "" End Sub -Sub ShowDialog() - DlgBuffer.Show + +Sub CalModMonthTextBox(txtMonth As Object,IncFactor as Integer) + Dim nActVal& + nActVal& = Val(txtMonth.Text) + If (1 <= nActVal& And 12 >= nActVal) Then + txtMonth.Text = cCalShortMonthNames$(nActVal&) + End If + nActVal& = CalGetIntOfShortMonthName%(txtMonth.Text) + If 0 = nActVal& Then + Beep + txtMonth.Text = cCalShortMonthNames$(1) + ElseIf (1 < nActVal&) AND (IncFactor = -1) Then + txtMonth.Text = cCalShortMonthNames$(nActVal& + IncFactor) + ElseIf (12 > nActVal&)AND (IncFactor = 1) Then + txtMonth.Text = cCalShortMonthNames$(nActVal& + IncFactor) + End If End Sub + + +Sub CalUpdateNewEventFrame() +Dim bDoEnable as Boolean +Dim sSelectedItem +Dim ListIndex as Integer +Dim MaxSelIndex as Integer + bDoEnable = False + With DlgCalModel + MaxSelIndex = Ubound(DlgCalModel.lstOwnData.SelectedItems()) + If MaxSelIndex > -1 Then + ListIndex = .lstOwnData.SelectedItems(MaxSelIndex) + .txtEvent.Text = CalGetNameofEvent(ListIndex) + .txtOwnEventDay.Text = CalGetDayOfEvent(ListIndex) + DlgCalendar.GetControl("lstOwnEventMonth").SelectItem(CalGetMonthOfEvent(ListIndex), True) + .txtOwnEventYear.Text = CalGetYearofEvent(ListIndex) + bDoEnable = DlgCalModel.txtOwnEventYear.Text = "" + .chkEventOnce.State = Abs(bDoEnable) + .lblEventYear.Enabled = bDoEnable + .txtOwnEventYear.Enabled = bDoEnable + .cmdDelete.Enabled = True + Else + Call CalClearInputMask() + .cmdDelete.Enabled = False + End If + End With +End Sub + </script:module>
\ No newline at end of file |