home *** CD-ROM | disk | FTP | other *** search
/ PC World 2004 May / PCWorld_2004-05_cd.bin / akce / openoffice / f_0191 / DlgControl.xba < prev    next >
Extensible Markup Language  |  2002-10-29  |  5KB  |  147 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="DlgControl" script:language="StarBasic">Option Explicit
  4.  
  5. Dim CalBitmap As Object
  6. Public bSelectByMouseMove as Boolean
  7. Public fHeightCorrFactor as Double
  8. Public fWidthCorrFactor as Double
  9.  
  10.  
  11.  
  12. Sub Main()
  13.     Call CalAutopilotTable()
  14. End Sub
  15.  
  16.  
  17. Sub CalcmdDeleteSelect()
  18. Dim MsgBoxResult as Integer
  19. Dim bDoEnable as Boolean
  20. Dim iSel as Integer
  21. Dim MaxIndex as Integer
  22.     If Ubound(DlgCalModel.lstOwnData.SelectedItems()) > -1 Then
  23.         MsgBoxResult = MsgBox(cCalSubcmdDeleteSelect_DeleteSelEntry$, 4+32, cCalSubcmdDeleteSelect_DeleteSelEntryTitle$)
  24.         If MsgBoxResult = 6 Then
  25.             iSel = DlgCalModel.lstOwnData.SelectedItems(0)
  26.             DlgCalModel.lstOwnData.StringItemList() = RemoveSelected(DlgCalModel.lstOwnData)
  27.             ' Flag to store the new data
  28.             bCalOwnDataChanged = True
  29.             bDoEnable = Ubound(DlgCalModel.lstOwnData.StringItemList()) > -1
  30.             DlgCalModel.cmdDelete.Enabled = bDoEnable
  31.             If bDoEnable Then
  32.                 MaxIndex = Ubound(DlgCalModel.lstOwnData.StringItemList()) 
  33.                 If iSel > MaxIndex Then
  34.                     iSel = MaxIndex
  35.                 End If
  36.                 DlgCalendar.GetControl("lstOwnData").SelectItemPos(iSel, True)
  37.                 CalUpdateNewEventFrame()
  38.             Else
  39.                 Call CalClearInputMask()
  40.             End If
  41.         End If
  42.     End If
  43. End Sub
  44.  
  45.  
  46. Sub CalSaveOwnEventControls()
  47.     With DlgCalModel
  48.         .txtOwnEventDay.Tag = .txtOwnEventDay.Value
  49.         .txtOwnEventMonth.Tag = .txtOwnEventMonth.Text
  50.     End With
  51. End Sub
  52.  
  53.  
  54. Sub CalMouseMoved(aEvent as object)
  55. Dim ListIndex as Integer
  56.     Select Case sCurLangLocale
  57.         Case  cLANGUAGE_GERMAN
  58.             If bSelectByMouseMove Then
  59. '                oStatusLine.SetText("Position: " & aEvent.X & " ; " & aEvent.Y)
  60.                 ListIndex = CalGetGermanLandAtMousePos(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor), Land$)
  61.                 DlgCalendar.GetControl("lstHolidays").SelectItemPos(ListIndex, True)
  62.             End If
  63.     End Select    
  64. End Sub
  65.  
  66.  
  67. Sub SelectState(aEvent as Object)
  68. Dim ListIndex as Integer
  69.     Select Case sCurLangLocale
  70.         Case  cLANGUAGE_GERMAN
  71.             If aEvent.ClickCount >= 1 Then
  72.                 ListIndex = CalGetGermanLandAtMousePos(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor), Land$)
  73.             DlgCalendar.GetControl("lstHolidays").SelectItemPos(ListIndex, True)
  74.             bSelectByMouseMove = False
  75.         End If
  76.     End Select
  77. End Sub
  78.  
  79.  
  80. Sub MouseLeavesImage
  81.     bSelectbyMouseMove = True
  82. End Sub
  83.  
  84.  
  85. Sub CalClearInputMask()
  86. Dim NullList() as String
  87.     With DlgCalModel
  88.         .txtEvent.Text = ""
  89.         .txtOwnEventDay.SetPropertyToDefault("Value")
  90.         .cmdInsert.Enabled = False
  91.     End With
  92.     If Ubound(DlgCalModel.lstOwnData.StringItemList()) > -1 Then
  93.         If Ubound(DlgCalModel.lstOwnData.SelectedItems()) = -1 Then
  94.             DlgCalendar.GetControl("lstOwnData").SelectItemPos(0,True)
  95.             CalUpdateNewEventFrame()
  96.         End If
  97.     End If
  98. End Sub
  99.  
  100.  
  101. Sub CalmdSwitchOwnDataOrGeneral()
  102.     If DlgCalModel.Step = 1 Then
  103.         DlgCalModel.Step = 2
  104.         DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_Back$
  105.         DlgCalModel.cmdInsert.Enabled = DlgCalModel.txtEvent.Text <> ""
  106. '        ToggleYearBox()
  107.     Else
  108.         dim bla as boolean
  109.         DlgCalModel.Step = 1
  110.         DlgCalendar.GetControl("lblHolidays").Visible = sCurLangLocale  = cLANGUAGE_GERMAN
  111.         DlgCalendar.GetControl("lstHolidays").Visible = sCurLangLocale  = cLANGUAGE_GERMAN
  112.         DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_OwnData$
  113.     End If
  114. End Sub
  115.  
  116.  
  117. Sub ToggleInsertButton()
  118.     DlgCalModel.cmdInsert.Enabled = LTrim(DlgCalModel.txtEvent.Text) <> ""    
  119. End Sub
  120.  
  121.  
  122. Sub CalUpdateNewEventFrame()
  123. Dim bDoEnable as Boolean
  124. Dim sSelectedItem
  125. Dim ListIndex as Integer
  126. Dim MaxSelIndex as Integer
  127. Dim CurEvMonth as Integer
  128. Dim CurEvDay as Integer
  129. Dim DateStr as String
  130.     bDoEnable = False
  131.     With DlgCalModel
  132.         MaxSelIndex = Ubound(DlgCalModel.lstOwnData.SelectedItems())
  133.         If MaxSelIndex > -1 Then
  134.             ListIndex = .lstOwnData.SelectedItems(MaxSelIndex)
  135.             .txtEvent.Text = CalGetNameofEvent(ListIndex)
  136.             If GetSelectedDateUnits(CurEvDay, CurEvMonth, ListIndex) <> SBDATEUNDEFINED Then
  137.                 .txtOwnEventDay.Value = CurEvDay
  138.                 DlgCalendar.GetControl("lstOwnEventMonth").SelectItemPos(CurEvMonth-1, True)
  139.                 .cmdDelete.Enabled = True
  140.                 .cmdInsert.Enabled = True
  141.             Else
  142.                 Call CalClearInputMask()
  143.                 .cmdDelete.Enabled = True
  144.             End If
  145.         End If
  146.     End With
  147. End Sub</script:module>