Quelle Control.xba
Sprache: unbekannt
|
|
<?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="Control" script:language="StarBasic">
REM =======================================================================================================================
REM === The Access2Base library is a part of the LibreOffice project. ===
REM === Full documentation is available on http://www.access2base.com ===
REM =======================================================================================================================
Option Compatible
Option ClassModule
Option Explicit
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS ROOT FIELDS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private _Type As String ' Must be CONTROL
Private _This As Object ' Workaround for absence of This builtin function
Private _Parent As Object
Private _ImplementationName As String
Private _ClassId As Integer
Private _ParentType As String ' One of CTLPARENTISxxxx constants
Private _Shortcut As String
Private _Name As String
Private _FormComponent As Object ' com.sun.star.text.TextDocument
Private _MainForm As String ' To be propagated to all subcontrols
Private _DocEntry As Integer ' Doc- and DbContainer entries in Root structure
Private _DbEntry As Integer
Private _ControlType As Integer
Private _ThisProperties As Variant ' Buffer for properties list
Private _SubType As String
Private ControlModel As Object ' com.sun.star.comp.forms.XXXModel
Private ControlView As Object ' com.sun.star.comp.forms.XXXControl (NULL if form open in edit mode)
Private BoundField As Object ' com.sun.star.sdb.ODataColumn
Private LabelControl As Object ' com.sun.star.form.component.FixedText or com.sun.star.form.component.GroupBox
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CONSTRUCTORS / DESTRUCTORS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJCONTROL
Set _This = Nothing
Set _Parent = Nothing
_ClassId = -1
_ParentType = ""
_Shortcut = ""
_Name = ""
Set _FormComponent = Nothing
_MainForm = ""
_DocEntry = -1
_DbEntry = -1
_ThisProperties = Array()
_SubType = ""
Set ControlModel = Nothing
Set ControlView = Nothing
Set BoundField = Nothing
Set LabelControl = Nothing
End Sub ' Constructor
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Terminate()
On Local Error Resume Next
Call Class_Initialize()
End Sub ' Destructor
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub Dispose()
Call Class_Terminate()
End Sub ' Explicit destructor
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS GET/LET/SET PROPERTIES ---
REM -----------------------------------------------------------------------------------------------------------------------
Property Get BackColor() As Variant
BackColor = _PropertyGet("BackColor")
End Property ' BackColor (get)
Property Let BackColor(ByVal pvValue As Variant)
Call _PropertySet("BackColor", pvValue)
End Property ' BackColor (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get BorderColor() As Variant
BorderColor = _PropertyGet("BorderColor")
End Property ' BorderColor (get)
Property Let BorderColor(ByVal pvValue As Variant)
Call _PropertySet("BorderColor", pvValue)
End Property ' BorderColor (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get BorderStyle() As Variant
BorderStyle = _PropertyGet("BorderStyle")
End Property ' BorderStyle (get)
Property Let BorderStyle(ByVal pvValue As Variant)
Call _PropertySet("BorderStyle", pvValue)
End Property ' BorderStyle (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Cancel() As Variant
Cancel = _PropertyGet("Cancel")
End Property ' Cancel (get)
Property Let Cancel(ByVal pvValue As Variant)
Call _PropertySet("Cancel", pvValue)
End Property ' Cancel (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Caption() As Variant
Caption = _PropertyGet("Caption")
End Property ' Caption (get)
Property Let Caption(ByVal pvValue As Variant)
Call _PropertySet("Caption", pvValue)
End Property ' Caption (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ControlSource() As Variant
ControlSource = _PropertyGet("ControlSource")
End Property ' ControlSource (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ControlTipText() As Variant
ControlTipText = _PropertyGet("ControlTipText")
End Property ' ControlTipText (get)
Property Let ControlTipText(ByVal pvValue As Variant)
Call _PropertySet("ControlTipText", pvValue)
End Property ' ControlTipText (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ControlType() As Variant
ControlType = _PropertyGet("ControlType")
End Property ' ControlType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Default() As Variant
Default = _PropertyGet("Default")
End Property ' Default (get)
Property Let Default(ByVal pvValue As Variant)
Call _PropertySet("Default", pvValue)
End Property ' Default (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get DefaultValue() As Variant
DefaultValue = _PropertyGet("DefaultValue")
End Property ' DefaultValue (get)
Property Let DefaultValue(ByVal pvValue As Variant)
Call _PropertySet("DefaultValue", pvValue)
End Property ' DefaultValue (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Enabled() As Variant
Enabled = _PropertyGet("Enabled")
End Property ' Enabled (get)
Property Let Enabled(ByVal pvValue As Variant)
Call _PropertySet("Enabled", pvValue)
End Property ' Enabled (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get FontBold() As Variant
FontBold = _PropertyGet("FontBold")
End Property ' FontBold (get)
Property Let FontBold(ByVal pvValue As Variant)
Call _PropertySet("FontBold", pvValue)
End Property ' FontBold (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get FontItalic() As Variant
FontItalic = _PropertyGet("FontItalic")
End Property ' FontItalic (get)
Property Let FontItalic(ByVal pvValue As Variant)
Call _PropertySet("FontItalic", pvValue)
End Property ' FontItalic (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get FontName() As Variant
FontName = _PropertyGet("FontName")
End Property ' FontName (get)
Property Let FontName(ByVal pvValue As Variant)
Call _PropertySet("FontName", pvValue)
End Property ' FontName (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get FontSize() As Variant
FontSize = _PropertyGet("FontSize")
End Property ' FontSize (get)
Property Let FontSize(ByVal pvValue As Variant)
Call _PropertySet("FontSize", pvValue)
End Property ' FontSize (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get FontUnderline() As Variant
FontUnderline = _PropertyGet("FontUnderline")
End Property ' FontUnderline (get)
Property Let FontUnderline(ByVal pvValue As Variant)
Call _PropertySet("FontUnderline", pvValue)
End Property ' FontUnderline (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get FontWeight() As Variant
FontWeight = _PropertyGet("FontWeight")
End Property ' FontWeight (get)
Property Let FontWeight(ByVal pvValue As Variant)
Call _PropertySet("FontWeight", pvValue)
End Property ' FontWeight (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ForeColor() As Variant
ForeColor = _PropertyGet("ForeColor")
End Property ' ForeColor (get)
Property Let ForeColor(ByVal pvValue As Variant)
Call _PropertySet("ForeColor", pvValue)
End Property ' ForeColor (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Form() As Variant
Form = _PropertyGet("Form")
End Property ' Form (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Format() As Variant
Format = _PropertyGet("Format")
End Property ' Format (get)
Property Let Format(ByVal pvValue As Variant)
Call _PropertySet("Format", pvValue)
End Property ' Format (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ItemData(ByVal Optional pvIndex As Variant) As Variant
If IsMissing(pvIndex) Then ItemData = _PropertyGet("ItemData") Else ItemData = _PropertyGet("ItemData", pvIndex)
End Property ' ItemData (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ListCount() As Variant
ListCount = _PropertyGet("ListCount")
End Property ' ListCount (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ListIndex() As Variant
ListIndex = _PropertyGet("ListIndex")
End Property ' ListIndex (get)
Property Let ListIndex(ByVal pvValue As Variant)
Call _PropertySet("ListIndex", pvValue)
End Property ' ListIndex (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Locked() As Variant
Locked = _PropertyGet("Locked")
End Property ' Locked (get)
Property Let Locked(ByVal pvValue As Variant)
Call _PropertySet("Locked", pvValue)
End Property ' Locked (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get MultiSelect() As Variant
MultiSelect = _PropertyGet("MultiSelect")
End Property ' MultiSelect (get)
Property Let MultiSelect(ByVal pvValue As Variant)
Call _PropertySet("MultiSelect", pvValue)
End Property ' MultiSelect (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Name() As String
Name = _PropertyGet("Name")
End Property ' Name (get)
Public Function pName() As String ' For compatibility with < V0.9.0
pName = _PropertyGet("Name")
End Function ' pName (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ObjectType() As String
ObjectType = _PropertyGet("ObjectType")
End Property ' ObjectType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnActionPerformed() As Variant
OnActionPerformed = _PropertyGet("OnActionPerformed")
End Property ' OnActionPerformed (get)
Property Let OnActionPerformed(ByVal pvValue As Variant)
Call _PropertySet("OnActionPerformed", pvValue)
End Property ' OnActionPerformed (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnAdjustmentValueChanged() As Variant
OnAdjustmentValueChanged = _PropertyGet("OnAdjustmentValueChanged")
End Property ' OnAdjustmentValueChanged (get)
Property Let OnAdjustmentValueChanged(ByVal pvValue As Variant)
Call _PropertySet("OnAdjustmentValueChanged", pvValue)
End Property ' OnAdjustmentValueChanged (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnApproveAction() As Variant
OnApproveAction = _PropertyGet("OnApproveAction")
End Property ' OnApproveAction (get)
Property Let OnApproveAction(ByVal pvValue As Variant)
Call _PropertySet("OnApproveAction", pvValue)
End Property ' OnApproveAction (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnApproveReset() As Variant
OnApproveReset = _PropertyGet("OnApproveReset")
End Property ' OnApproveReset (get)
Property Let OnApproveReset(ByVal pvValue As Variant)
Call _PropertySet("OnApproveReset", pvValue)
End Property ' OnApproveReset (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnApproveUpdate() As Variant
OnApproveUpdate = _PropertyGet("OnApproveUpdate")
End Property ' OnApproveUpdate (get)
Property Let OnApproveUpdate(ByVal pvValue As Variant)
Call _PropertySet("OnApproveUpdate", pvValue)
End Property ' OnApproveUpdate (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnChanged() As Variant
OnChanged = _PropertyGet("OnChanged")
End Property ' OnChanged (get)
Property Let OnChanged(ByVal pvValue As Variant)
Call _PropertySet("OnChanged", pvValue)
End Property ' OnChanged (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnErrorOccurred() As Variant
OnErrorOccurred = _PropertyGet("OnErrorOccurred")
End Property ' OnErrorOccurred (get)
Property Let OnErrorOccurred(ByVal pvValue As Variant)
Call _PropertySet("OnErrorOccurred", pvValue)
End Property ' OnErrorOccurred (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnFocusGained() As Variant
OnFocusGained = _PropertyGet("OnFocusGained")
End Property ' OnFocusGained (get)
Property Let OnFocusGained(ByVal pvValue As Variant)
Call _PropertySet("OnFocusGained", pvValue)
End Property ' OnFocusGained (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnFocusLost() As Variant
OnFocusLost = _PropertyGet("OnFocusLost")
End Property ' OnFocusLost (get)
Property Let OnFocusLost(ByVal pvValue As Variant)
Call _PropertySet("OnFocusLost", pvValue)
End Property ' OnFocusLost (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnItemStateChanged() As Variant
OnItemStateChanged = _PropertyGet("OnItemStateChanged")
End Property ' OnItemStateChanged (get)
Property Let OnItemStateChanged(ByVal pvValue As Variant)
Call _PropertySet("OnItemStateChanged", pvValue)
End Property ' OnItemStateChanged (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnKeyPressed() As Variant
OnKeyPressed = _PropertyGet("OnKeyPressed")
End Property ' OnKeyPressed (get)
Property Let OnKeyPressed(ByVal pvValue As Variant)
Call _PropertySet("OnKeyPressed", pvValue)
End Property ' OnKeyPressed (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnKeyReleased() As Variant
OnKeyReleased = _PropertyGet("OnKeyReleased")
End Property ' OnKeyReleased (get)
Property Let OnKeyReleased(ByVal pvValue As Variant)
Call _PropertySet("OnKeyReleased", pvValue)
End Property ' OnKeyReleased (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnMouseDragged() As Variant
OnMouseDragged = _PropertyGet("OnMouseDragged")
End Property ' OnMouseDragged (get)
Property Let OnMouseDragged(ByVal pvValue As Variant)
Call _PropertySet("OnMouseDragged", pvValue)
End Property ' OnMouseDragged (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnMouseEntered() As Variant
OnMouseEntered = _PropertyGet("OnMouseEntered")
End Property ' OnMouseEntered (get)
Property Let OnMouseEntered(ByVal pvValue As Variant)
Call _PropertySet("OnMouseEntered", pvValue)
End Property ' OnMouseEntered (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnMouseExited() As Variant
OnMouseExited = _PropertyGet("OnMouseExited")
End Property ' OnMouseExited (get)
Property Let OnMouseExited(ByVal pvValue As Variant)
Call _PropertySet("OnMouseExited", pvValue)
End Property ' OnMouseExited (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnMouseMoved() As Variant
OnMouseMoved = _PropertyGet("OnMouseMoved")
End Property ' OnMouseMoved (get)
Property Let OnMouseMoved(ByVal pvValue As Variant)
Call _PropertySet("OnMouseMoved", pvValue)
End Property ' OnMouseMoved (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnMousePressed() As Variant
OnMousePressed = _PropertyGet("OnMousePressed")
End Property ' OnMousePressed (get)
Property Let OnMousePressed(ByVal pvValue As Variant)
Call _PropertySet("OnMousePressed", pvValue)
End Property ' OnMousePressed (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnMouseReleased() As Variant
OnMouseReleased = _PropertyGet("OnMouseReleased")
End Property ' OnMouseReleased (get)
Property Let OnMouseReleased(ByVal pvValue As Variant)
Call _PropertySet("OnMouseReleased", pvValue)
End Property ' OnMouseReleased (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnResetted() As Variant
OnResetted = _PropertyGet("OnResetted")
End Property ' OnResetted (get)
Property Let OnResetted(ByVal pvValue As Variant)
Call _PropertySet("OnResetted", pvValue)
End Property ' OnResetted (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnTextChanged() As Variant
OnTextChanged = _PropertyGet("OnTextChanged")
End Property ' OnTextChanged (get)
Property Let OnTextChanged(ByVal pvValue As Variant)
Call _PropertySet("OnTextChanged", pvValue)
End Property ' OnTextChanged (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnUpdated() As Variant
OnUpdated = _PropertyGet("OnUpdated")
End Property ' OnUpdated (get)
Property Let OnUpdated(ByVal pvValue As Variant)
Call _PropertySet("OnUpdated", pvValue)
End Property ' OnUpdated (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OptionValue() As Variant
OptionValue = _PropertyGet("OptionValue")
End Property ' OptionValue (get)
Property Let OptionValue(ByVal pvValue As Variant)
Call _PropertySet("OptionValue", pvValue)
End Property ' OptionValue (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Page() As Variant
Page = _PropertyGet("Page")
End Property ' Page (get)
Property Let Page(ByVal pvValue As Variant)
Call _PropertySet("Page", pvValue)
End Property ' Page (set)
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Parent() As Object
Parent = _PropertyGet("Parent")
End Function ' Parent (get) V0.9.1
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Picture() As Variant
Picture = _PropertyGet("Picture")
End Property ' Picture (get)
Property Let Picture(ByVal pvValue As Variant)
Call _PropertySet("Picture", pvValue)
End Property ' Picture (set) V1.5.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
' Return
' a Collection object if pvIndex absent
' a Property object otherwise
Utils._SetCalledSub("Control.Properties")
Dim vProperty As Variant, vPropertiesList() As Variant, sObject As String
vPropertiesList = _PropertiesList()
sObject = Utils._PCase(_Type)
If IsMissing(pvIndex) Then
vProperty = PropertiesGet._Properties(sObject, _This, vPropertiesList)
Else
vProperty = PropertiesGet._Properties(sObject, _This, vPropertiesList, pvIndex)
vProperty._Value = _PropertyGet(vPropertiesList(pvIndex))
End If
Exit_Function:
Set Properties = vProperty
Utils._ResetCalledSub("Control.Properties")
Exit Function
End Function ' Properties
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Required() As Variant
Required = _PropertyGet("Required")
End Property ' Required (get)
Property Let Required(ByVal pvValue As Variant)
Call _PropertySet("Required", pvValue)
End Property ' Required (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get RowSource() As Variant
RowSource = _PropertyGet("RowSource")
End Property ' RowSource (get)
Property Let RowSource(ByVal pvValue As Variant)
Call _PropertySet("RowSource", pvValue)
End Property ' RowSource (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get RowSourceType() As Variant
RowSourceType = _PropertyGet("RowSourceType")
End Property ' RowSourceType (get)
Property Let RowSourceType(ByVal pvValue As Variant)
Call _PropertySet("RowSourceType", pvValue)
End Property ' RowSourceType (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Selected(ByVal Optional pvIndex As Variant) As Variant
If IsMissing(pvIndex) Then Selected = _PropertyGet("Selected") Else Selected = _PropertyGet("Selected", pvIndex)
End Property ' Selected (get)
Property Let Selected(ByVal pvValue As Variant) ' , ByVal Optional pvIndex As Variant)
' If IsMissing(pvIndex) Then Call _PropertySet("Selected", pvValue) Else Call _PropertySet("Selected", pvValue, pvIndex)
Call _PropertySet("Selected", pvValue)
End Property ' Selected (set)
Public Function SelectedI(ByVal pvValue As variant, ByVal pvIndex As Variant)
Call _PropertySet("Selected", pvValue, pvIndex)
End Function
REM -----------------------------------------------------------------------------------------------------------------------
Property Get SelLength() As Variant
SelLength = _PropertyGet("SelLength")
End Property ' SelLength (get)
Property Let SelLength(ByVal pvValue As Variant)
Call _PropertySet("SelLength", pvValue)
End Property ' SelLength (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get SelStart() As Variant
SelStart = _PropertyGet("SelStart")
End Property ' SelStart (get)
Property Let SelStart(ByVal pvValue As Variant)
Call _PropertySet("SelStart", pvValue)
End Property ' SelStart (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get SelText() As Variant
SelText = _PropertyGet("SelText")
End Property ' SelText (get)
Property Let SelText(ByVal pvValue As Variant)
Call _PropertySet("SelText", pvValue)
End Property ' SelText (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get SpecialEffect() As Variant
SpecialEffect = _PropertyGet("SpecialEffect")
End Property ' SpecialEffect (get)
Property Let SpecialEffect(ByVal pvValue As Variant)
Call _PropertySet("SpecialEffect", pvValue)
End Property ' SpecialEffect (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get SubType() As Variant
SubType = _PropertyGet("SubType")
End Property ' SubType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get TabIndex() As Variant
TabIndex = _PropertyGet("TabIndex")
End Property ' TabIndex (get)
Property Let TabIndex(ByVal pvValue As Variant)
Call _PropertySet("TabIndex", pvValue)
End Property ' TabIndex (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get TabStop() As Variant
TabStop = _PropertyGet("TabStop")
End Property ' TabStop (get)
Property Let TabStop(ByVal pvValue As Variant)
Call _PropertySet("TabStop", pvValue)
End Property ' TabStop (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Tag() As Variant
Tag = _PropertyGet("Tag")
End Property ' Tag (get)
Property Let Tag(ByVal pvValue As Variant)
Call _PropertySet("Tag", pvValue)
End Property ' Tag (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Text() As Variant
Text = _PropertyGet("Text")
End Property ' Text (get)
Public Function pText() As Variant
pText = _PropertyGet("Text")
End Function ' pText (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get TextAlign() As Variant
TextAlign = _PropertyGet("TextAlign")
End Property ' TextAlign (get)
Property Let TextAlign(ByVal pvValue As Variant)
Call _PropertySet("TextAlign", pvValue)
End Property ' TextAlign (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get TripleState() As Variant
TripleState = _PropertyGet("TripleState")
End Property ' TripleState (get)
Property Let TripleState(ByVal pvValue As Variant)
Call _PropertySet("TripleState", pvValue)
End Property ' TripleState (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Value() As Variant
Value = _PropertyGet("Value")
End Property ' Value (get)
Property Let Value(ByVal pvValue As Variant)
Call _PropertySet("Value", pvValue)
End Property ' Value (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Visible() As Variant
Visible = _PropertyGet("Visible")
End Property ' Visible (get)
Property Let Visible(ByVal pvValue As Variant)
Call _PropertySet("Visible", pvValue)
End Property ' Visible (set)
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS METHODS ---
REM -----------------------------------------------------------------------------------------------------------------------
Public Function AddItem(ByVal Optional pvItem As Variant, ByVal Optional pvIndex) As Boolean
' Add an item in a Listbox
Utils._SetCalledSub("Control.AddItem")
AddItem = False
If _ErrorHandler() Then On Local Error Goto Error_Function
If IsMissing(pvItem) Then Call _TraceArguments()
If IsMissing(pvIndex) Then pvIndex = -1
Dim iArgNr As Integer
Select Case UCase(_A2B_.CalledSub)
Case UCase("AddItem") : iArgNr = 1
Case UCase("Control.AddItem") : iArgNr = 0
End Select
If Not Utils._CheckArgument(pvItem, iArgNr + 1, vbString) Then Goto Exit_Function
If Not Utils._CheckArgument(pvIndex, iArgNr + 2, Utils._AddNumeric()) Then Goto Exit_Function
If _SubType <> CTLLISTBOX Then Goto Error_Control
If _ParentType <> CTLPARENTISDIALOG Then
If ControlModel.ListSourceType <> com.sun.star.form.ListSourceType.VALUELIST Then Goto Error_Control
End If
Dim vRowSource() As Variant, iCount As Integer, i As Integer
If IsArray(ControlModel.StringItemList) Then vRowSource = ControlModel.StringItemList Else vRowSource = Array(ControlModel.StringItemList)
iCount = UBound(vRowSource)
If pvIndex < -1 Or pvIndex > iCount + 1 Then Goto Error_Index
ReDim Preserve vRowSource(0 To iCount + 1)
If pvIndex = -1 Then pvIndex = iCount + 1
For i = iCount + 1 To pvIndex + 1 Step -1
vRowSource(i) = vRowSource(i - 1)
Next i
vRowSource(pvIndex) = pvItem
If _ParentType <> CTLPARENTISDIALOG Then
ControlModel.ListSource = vRowSource()
End If
ControlModel.StringItemList = vRowSource()
AddItem = True
Exit_Function:
Utils._ResetCalledSub("Control.AddItem")
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, "Control.AddItem", Erl)
AddItem = False
GoTo Exit_Function
Error_Control:
TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, , "Control.AddItem")
AddItem = False
Goto Exit_Function
Error_Index:
TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), False, ,Array(iArgNr + 2,pvIndex))
AddItem = False
Goto Exit_Function
End Function ' AddItem V0.9.1
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Controls(Optional ByVal pvIndex As Variant) As Variant
' Return a Control object with name or index = pvIndex
Const cstThisSub = "Control.Controls"
If _ErrorHandler() Then On Local Error Goto Error_Function
Utils._SetCalledSub(cstThisSub)
Dim ocControl As Variant, sParentShortcut As String, iControlCount As Integer
Dim oCounter As Variant, sControls() As Variant, i As Integer, bFound As Boolean, sIndex As String
Dim j As Integer, oView As Object
If _SubType <> CTLGRIDCONTROL Then Goto Trace_Error_Context
Set ocControl = Nothing
iControlCount = ControlModel.getCount()
If IsMissing(pvIndex) Then ' No argument, return Collection pseudo-object
Set oCounter = New Collect
Set oCounter._This = oCounter
oCounter._CollType = COLLCONTROLS
Set oCounter._Parent = _This
oCounter._Count = iControlCount
Set Controls = oCounter
Goto Exit_Function
End If
If Not Utils._CheckArgument(pvIndex, 1, Utils._AddNumeric(vbString)) Then Goto Exit_Function
' Start building the ocControl object
' Determine exact name
Set ocControl = New Control
Set ocControl._This = ocControl
Set ocControl._Parent = _This
ocControl._ParentType = CTLPARENTISGRID
sParentShortcut = _Shortcut
sControls() = ControlModel.getElementNames()
Select Case VarType(pvIndex)
Case vbInteger, vbLong, vbSingle, vbDouble, vbCurrency, vbBigint, vbDecimal
If pvIndex < 0 Or pvIndex > iControlCount - 1 Then Goto Trace_Error_Index
ocControl._Name = sControls(pvIndex)
Case vbString ' Check control name validity (non case sensitive)
bFound = False
sIndex = UCase(Utils._Trim(pvIndex))
For i = 0 To iControlCount - 1
If UCase(sControls(i)) = sIndex Then
bFound = True
Exit For
End If
Next i
If bFound Then ocControl._Name = sControls(i) Else Goto Trace_NotFound
End Select
With ocControl
._Shortcut = sParentShortcut & "!" & Utils._Surround(._Name)
Set .ControlModel = ControlModel.getByName(._Name)
._ImplementationName = .ControlModel.ColumnServiceName ' getImplementationName aborts for subcontrols !?
._FormComponent = ParentComponent
._MainForm = _MainForm
If Utils._hasUNOProperty(.ControlModel, "ClassId") Then ._ClassId = .ControlModel.ClassId
' Complex bypass to find View of grid subcontrols !
If Not IsNull(ControlView) Then ' Anticipate absence of ControlView in grid controls when edit mode
For i = 0 to ControlView.getCount() - 1
Set oView = ControlView.GetByIndex(i)
If Not IsNull(oView) Then
If oView.getModel.Name = ._Name Then
Set .ControlView = oView
Exit For
End If
End If
Next i
End If
._Initialize()
._DocEntry = _DocEntry
._DbEntry = _DbEntry
End With
Set Controls = ocControl
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Trace_Error_Index:
TraceError(TRACEFATAL, ERRCOLLECTION, Utils._CalledSub(), 0, 1)
Set Controls = Nothing
Goto Exit_Function
Trace_NotFound:
TraceError(TRACEFATAL, ERRCONTROLNOTFOUND, Utils._CalledSub(), 0, , Array(pvIndex, _Name))
Set Controls = Nothing
Goto Exit_Function
Trace_Error_Context:
TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, , "Grid.Controls")
Set Controls = Nothing
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
Set Controls = Nothing
GoTo Exit_Function
End Function ' Controls
REM -----------------------------------------------------------------------------------------------------------------------
Public Function getProperty(Optional ByVal pvProperty As Variant, ByVal Optional pvIndex As Variant) As Variant
' Return property value of psProperty property name
Utils._SetCalledSub("Control.getProperty")
If IsMissing(pvProperty) Then Call _TraceArguments()
If IsMissing(pvIndex) Then
getProperty = _PropertyGet(pvProperty)
Else
getProperty = _PropertyGet(pvProperty, pvIndex)
End If
Utils._ResetCalledSub("Control.getProperty")
End Function ' getProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
' Return True if object has a valid property called pvProperty (case-insensitive comparison !)
If IsMissing(pvProperty) Then hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList()) Else hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList(), pvProperty)
Exit Function
End Function ' hasProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function RemoveItem(ByVal Optional pvIndex) As Boolean
' Remove an item from a Listbox
' Index may be a string value or an index-position
Utils._SetCalledSub("Control.RemoveItem")
If _ErrorHandler() Then On Local Error Goto Error_Function
If IsMissing(pvIndex) Then Call _TraceArguments()
Dim iArgNr As Integer
Select Case UCase(_A2B_.CalledSub)
Case UCase("RemoveItem") : iArgNr = 1
Case UCase("Control.RemoveItem") : iArgNr = 0
End Select
If Not Utils._CheckArgument(pvIndex, iArgNr + 1, Utils._AddNumeric(vbString)) Then Goto Exit_Function
If _SubType <> CTLLISTBOX Then Goto Error_Control
If _ParentType <> CTLPARENTISDIALOG Then
If ControlModel.ListSourceType <> com.sun.star.form.ListSourceType.VALUELIST Then Goto Error_Control
End If
Dim vRowSource() As Variant, iCount As Integer, i As Integer, j As integer, bFound As Boolean
If IsArray(ControlModel.StringItemList) Then vRowSource = ControlModel.StringItemList Else vRowSource = Array(ControlModel.StringItemList)
iCount = UBound(vRowSource)
Select Case VarType(pvIndex)
Case vbString
bFound = False
For i = 0 To iCount
If vRowSource(i) = pvIndex Then
For j = i To iCount - 1
vRowSource(j) = vRowSource(j + 1)
Next j
bFound = True
Exit For ' Remove only 1st occurrence of string
End If
Next i
Case Else
If pvIndex < 0 Or pvIndex > iCount Then Goto Error_Index
For i = pvIndex To iCount - 1
vRowSource(i) = vRowSource(i + 1)
Next i
bFound = True
End Select
If bFound Then
If iCount > 0 Then ' https://forum.openoffice.org/en/forum/viewtopic.php?f=47&t=75008
ReDim Preserve vRowSource(0 To iCount - 1)
Else
vRowSource = Array()
End If
If _ParentType <> CTLPARENTISDIALOG Then
ControlModel.ListSource = vRowSource()
End If
ControlModel.StringItemList = vRowSource()
RemoveItem = True
Else
RemoveItem = False
End If
Exit_Function:
Utils._ResetCalledSub("Control.RemoveItem")
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, "Control.RemoveItem", Erl)
RemoveItem = False
GoTo Exit_Function
Error_Control:
TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, 1, "Control.RemoveItem")
RemoveItem = False
Goto Exit_Function
Error_Index:
TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), False, ,Array(2, pvIndex))
RemoveItem = False
Goto Exit_Function
End Function ' RemoveItem V0.9.1
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Requery() As Boolean
' Refresh data displayed in a form, subform, combobox or listbox
Utils._SetCalledSub("Control.Requery")
If _ErrorHandler() Then On Local Error Goto Error_Function
Requery = False
Select Case _SubType
Case CTLCOMBOBOX, CTLLISTBOX
If Utils._InList(ControlModel.ListSourceType, Array( _
com.sun.star.form.ListSourceType.QUERY _
, com.sun.star.form.ListSourceType.TABLE _
, com.sun.star.form.ListSourceType.TABLEFIELDS _
, com.sun.star.form.ListSourceType.SQL _
, com.sun.star.form.ListSourceType.SQLPASSTHROUGH _
)) Then
ControlModel.refresh()
End If
Case Else
Goto Error_Control
End Select
Requery = True
Exit_Function:
Utils._ResetCalledSub("Control.Requery")
Exit Function
Error_Control:
TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, 1, "Control.Requery")
Requery = False
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, "Control.Requery", Erl)
GoTo Exit_Function
End Function ' Requery
REM -----------------------------------------------------------------------------------------------------------------------
Public Function SetFocus() As Boolean
' Execute setFocus method
Utils._SetCalledSub("Control.SetFocus")
If _ErrorHandler() Then On Local Error Goto Error_Function
SetFocus = False
Dim i As Integer, j As Integer, iColPosition As Integer
Dim ocControl As Object, ocGrid As Variant, oGridModel As Object
If IsNull(ControlView) Then GoTo Exit_Function
If _ParentType = CTLPARENTISGRID Then 'setFocus method does not work on controlviews in grid ?!?
' Find column position of control
iColPosition = -1
ocGrid = getObject(_getUpperShortcut(_Shortcut, _Name)) ' return containing grid
Set oGridModel = ocGrid.ControlModel
j = -1
For i = 0 To oGridModel.Count - 1
Set ocControl = oGridModel.GetByIndex(i)
If Not ocControl.Hidden Then j = j + 1 ' Skip if hidden
If oGridModel.GetByIndex(i).Name = _Name Then
iColPosition = j
Exit For
End If
Next i
If iColPosition >= 0 Then
ocGrid.ControlView.setFocus() 'Set first focus on grid itself
ocGrid.ControlView.setCurrentColumnPosition(iColPosition) 'Deprecated but no alternative found
Else
Goto Error_Grid
End If
Else
ControlView.setFocus()
End If
SetFocus = True
Exit_Function:
Utils._ResetCalledSub("Control.SetFocus")
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, "Control.SetFocus", Erl)
Goto Exit_Function
Error_Grid:
TraceError(TRACEFATAL, ERRFOCUSINGRID, Utils._CalledSub(), 0, 1, Array(_Name, ocGrid._Name))
Goto Exit_Function
End Function ' SetFocus V0.9.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setProperty(ByVal Optional psProperty As String, ByVal Optional pvValue As Variant, ByVal Optional pvIndex As Variant) As Boolean
' Return True if property setting OK
Utils._SetCalledSub("Control.setProperty")
If IsMissing(pvIndex) Then
setProperty = _PropertySet(psProperty, pvValue)
Else
setProperty = _PropertySet(psProperty, pvValue, pvIndex)
End If
Utils._ResetCalledSub("Control.setProperty")
End Function ' setProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function SetSelected(ByVal Optional pvValue As Variant, ByVal Optional pvIndex As Variant) As Boolean
' Workaround for limitation of Basic: Property Let does not accept optional arguments
If IsMissing(pvValue) Then Call _TraceArguments()
If IsMissing(pvIndex) Then
SetSelected = _PropertySet("Selected", pvValue)
Else
SetSelected = _PropertySet("Selected", pvValue, pvIndex)
End If
End Function ' SetSelected
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _Formats(ByVal psControlType As String) As Variant
' Return allowed format entries for Date and Time control types
Dim vFormats() As Variant
Select Case psControlType
Case CTLDATEFIELD
vFormats = Array( _
"Standard (short)" _
, "Standard (short YY)" _
, "Standard (short YYYY)" _
, "Standard (long)" _
, "DD/MM/YY" _
, "MM/DD/YY" _
, "YY/MM/DD" _
, "DD/MM/YYYY" _
, "MM/DD/YYYY" _
, "YYYY/MM/DD" _
, "YY-MM-DD" _
, "YYYY-MM-DD" _
)
Case CTLTIMEFIELD
vFormats = Array( _
"24h short" _
, "24h long" _
, "12h short" _
, "12h long" _
)
Case Else
vFormats = Array()
End Select
_Formats = vFormats
End Function ' _Formats V0.9.1
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _GetListener(ByVal psProperty As String) As String
' Return the X...Listener corresponding with the property in argument
Select Case UCase(psProperty)
Case UCase("OnActionPerformed")
_GetListener = "XActionListener"
Case UCase("OnAdjustmentValueChanged")
_GetListener = "XAdjustmentListener"
Case UCase("OnApproveAction")
_GetListener = "XApproveActionListener"
Case UCase("OnApproveReset"), UCase("OnResetted")
_GetListener = "XResetListener"
Case UCase("OnApproveUpdate"), UCase("OnUpdated")
_GetListener = "XUpdateListener"
Case UCase("OnChanged")
_GetListener = "XChangeListener"
Case UCase("OnErrorOccurred")
_GetListener = "XErrorListener"
Case UCase("OnFocusGained"), UCase("OnFocusLost")
_GetListener = "XFocusListener"
Case UCase("OnItemStateChanged")
_GetListener = "XItemListener"
Case UCase("OnKeyPressed"), UCase("OnKeyReleased")
_GetListener = "XKeyListener"
Case UCase("OnMouseDragged"), UCase("OnMouseMoved")
_GetListener = "XMouseMotionListener"
Case UCase("OnMouseEntered"), UCase("OnMouseExited"), UCase("OnMousePressed"), UCase("OnMouseReleased")
_GetListener = "XMouseListener"
Case UCase("OnTextChanged")
_GetListener = "XTextListener"
End Select
End Function ' _GetListener V1.7.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub _Initialize()
' Initialize new Control
' ControlModel, ParentType, Name, Shortcut, ControlView, ImplementationName, ClassId (if parent <> dialog)
' are presumed preexisting
' Identify SubType and ControlView
Dim sControlTypes() As Variant, i As Integer, vSplit() As Variant, sTrailer As String
sControlTypes = array( CTLCONTROL _
, CTLCOMMANDBUTTON _
, CTLRADIOBUTTON _
, CTLIMAGEBUTTON _
, CTLCHECKBOX _
, CTLLISTBOX _
, CTLCOMBOBOX _
, CTLGROUPBOX _
, CTLTEXTFIELD _
, CTLFIXEDTEXT _
, CTLGRIDCONTROL _
, CTLFILECONTROL _
, CTLHIDDENCONTROL _
, CTLIMAGECONTROL _
, CTLDATEFIELD _
, CTLTIMEFIELD _
, CTLNUMERICFIELD _
, CTLCURRENCYFIELD _
, CTLPATTERNFIELD _
, CTLSCROLLBAR _
, CTLSPINBUTTON _
, CTLNAVIGATIONBAR _
, CTLPROGRESSBAR _
, CTLFIXEDLINE _
)
Select Case _ParentType
Case CTLPARENTISDIALOG
vSplit = Split(ControlModel.getServiceName(), ".")
sTrailer = UCase(vSplit(UBound(vSplit)))
' Manage homonyms
Select Case sTrailer
Case "BUTTON" : sTrailer = CTLCOMMANDBUTTON
Case "EDIT" : sTrailer = CTLTEXTFIELD
Case Else
End Select
If sTrailer <> CTLFORMATTEDFIELD Then
For i = 0 To UBound(sControlTypes)
If sControlTypes(i) = sTrailer Then
_ClassId = i + 1
_SubType = sTrailer
_ControlType = _ClassId
Exit For
End If
Next i
Else
_ClassId = acFormattedField
_SubType = CTLFORMATTEDFIELD
_ControlType = _ClassId
End If
Case Else
'Is ClassId one of the properties ?
If _ClassId > 0 Then ' All control types have a ClassId except subforms
_SubType = sControlTypes(_ClassId - 1)
_ControlType = _ClassId
If _SubType = CTLTEXTFIELD Then ' Formatted fields belong to the TextField family
If _ImplementationName = "com.sun.star.comp.forms.OFormattedFieldWrapper" _
Or _ImplementationName = "com.sun.star.comp.forms.OFormattedFieldWrapper_ForcedFormatted" _
Or _ImplementationName = "com.sun.star.form.component.FormattedField" Then ' When in datagrid
_SubType = CTLFORMATTEDFIELD
_ControlType = acFormattedField
End If
End If
Else ' Initialize subform Control
If ControlModel.ImplementationName = "com.sun.star.comp.forms.ODatabaseForm" Then
_SubType = CTLSUBFORM
_ControlType = acSubform
End If
End If
End Select
End Sub ' _Initialize
REM -----------------------------------------------------------------------------------------------------------------------
Public Function _ListboxBound() As Boolean
' Return True if listbox has a bound column
Dim bListboxBound As Boolean, j As Integer
Dim vValue() As variant, vString As Variant
bListboxBound = False
If Not IsNull(ControlModel.ValueItemList) _
And ControlModel.DataField <> "" _
And Not IsNull(ControlModel.BoundField) _
And Utils._InList(ControlModel.ListSourceType, Array( _
com.sun.star.form.ListSourceType.TABLE _
, com.sun.star.form.ListSourceType.QUERY _
, com.sun.star.form.ListSourceType.SQL _
, com.sun.star.form.ListSourceType.SQLPASSTHROUGH _
)) Then ' MultiSelect behaviour changed in OpenOffice >= 3.3
If IsArray(ControlModel.ValueItemList) Then
vValue = ControlModel.ValueItemList
vString = ControlModel.StringItemList
For j = 0 To UBound(vValue)
If VarType(vValue(j)) <> VarType(vString(j)) Then
bListboxBound = True
ElseIf vValue(j) <> vString(j) Then
bListboxBound = True
End If
If bListboxBound Then Exit For
Next j
End If
End If
_ListboxBound = bListboxBound
End Function ' _ListboxBound V0.9.0
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertiesList() As Variant
' Based on ControlProperties.ods analysis
Dim vFullPropertiesList() As Variant
'List established only once
If UBound(_ThisProperties) > -1 Then
_PropertiesList = _ThisProperties
Exit Function
End If
vFullPropertiesList = Array( _
"BackColor" _
, "BorderColor" _
, "BorderStyle" _
, "Cancel" _
, "Caption" _
, "ControlSource" _
, "ControlTipText" _
, "ControlType" _
, "Default" _
, "DefaultValue" _
, "Enabled" _
, "FontBold" _
, "FontItalic" _
, "FontName" _
, "FontSize" _
, "FontUnderline" _
, "FontWeight" _
, "ForeColor" _
, "Form" _
, "Format" _
, "ItemData" _
, "LinkChildFields" _
, "LinkMasterFields" _
, "ListCount" _
, "ListIndex" _
, "Locked" _
, "MultiSelect" _
, "Name" _
, "ObjectType" _
, "OnActionPerformed" _
, "OnAdjustmentValueChanged" _
, "OnApproveAction" _
, "OnApproveReset" _
, "OnApproveUpdate" _
, "OnChanged" _
, "OnErrorOccurred" _
, "OnFocusGained" _
, "OnFocusLost" _
, "OnItemStateChanged" _
, "OnKeyPressed" _
, "OnKeyReleased" _
, "OnMouseDragged" _
, "OnMouseEntered" _
, "OnMouseExited" _
, "OnMouseMoved" _
, "OnMousePressed" _
, "OnMouseReleased" _
, "OnResetted" _
, "OnTextChanged" _
, "OnUpdated" _
, "OptionValue" _
, "Page" _
, "Parent" _
, "Picture" _
, "Required" _
, "RowSource" _
, "RowSourceType" _
, "Selected" _
, "SelLength" _
, "SelStart" _
, "Seltext" _
, "SpecialEffect" _
, "SubType" _
, "TabIndex" _
, "TabStop" _
, "Tag" _
, "Text" _
, "TextAlign" _
, "TripleState" _
, "Value" _
, "Visible" _
)
Dim vPropertiesMatrix(25) As Variant
Select Case _ParentType
Case CTLPARENTISFORM, CTLPARENTISSUBFORM
vPropertiesMatrix(acCheckBox) = Array(0,4,5,6,7,9,10,11,12,13,14,15,16,17,27,28,29,32,36,37,38,39,40,41,42,43,44,45,46,47,52,54,61,62,63,64,65,67,68,69,70)
vPropertiesMatrix(acComboBox) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,20,23,24,25,27,28,29,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,52,54,55,56,62,63,64,65,66,67,69,70)
vPropertiesMatrix(acCommandButton) = Array(0,3,4,6,7,8,10,11,12,13,14,15,16,17,27,28,29,31,32,36,37,38,39,40,41,42,43,44,45,46,47,52,53,62,63,64,65,67,69,70)
vPropertiesMatrix(acCurrencyField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,63,64,65,67,69,70)
vPropertiesMatrix(acDateField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,19,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,63,64,65,66,67,69,70)
vPropertiesMatrix(acFileControl) = Array(0,1,2,6,7,9,10,11,12,13,14,15,16,17,25,27,28,32,36,37,39,40,41,42,43,44,45,46,47,48,52,62,63,64,65,66,69,70)
vPropertiesMatrix(acFixedText) = Array(0,1,2,4,6,7,10,11,12,13,14,15,16,17,27,28,36,37,39,40,41,42,43,44,45,46,52,62,65,67,70)
vPropertiesMatrix(acFormattedField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,19,25,27,28,32,33,35,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,63,64,65,66,67,69,70)
vPropertiesMatrix(acGridControl) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,27,28,32,33,35,36,37,39,40,41,42,43,44,45,46,47,49,52,62,63,64,65,70)
vPropertiesMatrix(acGroupBox) = Array(4,6,7,10,11,12,13,14,15,16,17,27,28,32,36,37,39,40,41,42,43,44,45,46,47,52,62,65,70)
vPropertiesMatrix(acHiddenControl) = Array(7,27,28,52,62,65,69,70)
vPropertiesMatrix(acImageButton) = Array(0,1,2,6,7,10,27,28,31,36,37,39,40,41,42,43,44,45,46,52,53,62,63,64,65,70)
vPropertiesMatrix(acImageControl) = Array(0,1,2,5,6,7,10,25,27,28,32,36,37,39,40,41,42,43,44,45,46,47,52,53,54,62,63,64,65,70)
vPropertiesMatrix(acListBox) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,20,23,24,25,26,27,28,29,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,49,52,54,55,56,57,62,63,64,65,67,69,70)
vPropertiesMatrix(acNavigationBar) = Array(0,2,6,7,10,11,12,13,14,15,16,17,27,28,36,37,39,40,41,42,43,44,45,46,52,62,63,64,65,70)
vPropertiesMatrix(acNumericField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,63,64,65,67,69,70)
vPropertiesMatrix(acPatternField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,58,59,60,62,63,64,65,66,67,69,70)
vPropertiesMatrix(acRadioButton) = Array(0,4,5,6,7,9,10,11,12,13,14,15,16,17,27,28,29,32,36,37,38,39,40,41,42,43,44,45,46,47,50,52,54,61,62,63,64,65,67,69,70)
vPropertiesMatrix(acScrollBar) = Array(0,1,2,6,7,10,27,28,30,32,33,36,37,39,40,41,42,43,44,45,46,47,49,52,62,63,64,65,69,70)
vPropertiesMatrix(acSpinButton) = Array(0,1,2,6,7,9,10,27,28,30,32,33,36,37,39,40,41,42,43,44,45,46,47,49,52,62,63,64,65,69,70)
vPropertiesMatrix(0) = Array(7,18,21,22,27,28,52,62)
vPropertiesMatrix(acTextField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,25,27,28,32,33,34,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,58,59,60,62,63,64,65,66,67,69,70)
vPropertiesMatrix(acTimeField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,19,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,63,64,65,66,67,69,70)
Case CTLPARENTISGROUP
' To be duplicated from above !!!
vPropertiesMatrix(acRadioButton) = Array(0,4,5,6,7,9,10,11,12,13,14,15,16,17,27,28,29,32,36,37,38,39,40,41,42,43,44,45,46,47,50,52,54,61,62,63,64,65,67,69,70)
Case CTLPARENTISGRID
vPropertiesMatrix(acCheckBox) = Array(4,5,6,7,9,10,27,28,29,32,36,37,38,39,40,41,42,43,44,45,46,47,52,54,61,62,65,67,68,69)
vPropertiesMatrix(acComboBox) = Array(4,5,6,7,9,10,20,23,24,25,27,28,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,52,54,55,56,62,65,66,67,69)
vPropertiesMatrix(acCurrencyField) = Array(4,5,6,7,9,10,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,65,67,69)
vPropertiesMatrix(acDateField) = Array(4,5,6,7,9,10,19,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,65,66,67,69)
vPropertiesMatrix(acFormattedField) = Array(4,5,6,7,9,10,19,25,27,28,32,33,35,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,65,66,67,69)
vPropertiesMatrix(acListBox) = Array(4,5,6,7,9,10,20,23,24,25,26,27,28,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47,49,52,54,55,56,57,62,65,67,69)
vPropertiesMatrix(acNumericField) = Array(4,5,6,7,9,10,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,65,67,69)
vPropertiesMatrix(acPatternField) = Array(4,5,6,7,9,10,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,58,59,60,62,65,66,67,69)
vPropertiesMatrix(acTextField) = Array(4,5,6,7,9,10,25,27,28,32,33,34,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,58,59,60,62,65,66,67,69)
vPropertiesMatrix(acTimeField) = Array(4,5,6,7,9,10,19,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,65,66,67,69)
Case CTLPARENTISDIALOG
vPropertiesMatrix(acCheckBox) = Array(0,4,6,7,10,11,12,13,14,15,16,17,27,28,29,36,37,38,39,40,41,42,43,44,45,46,51,52,61,62,63,64,65,67,68,69,70)
vPropertiesMatrix(acComboBox) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,20,23,24,25,27,28,29,36,37,38,39,40,41,42,43,44,45,46,48,51,52,55,62,63,64,65,66,67,69,70)
vPropertiesMatrix(acCommandButton) = Array(0,3,4,6,7,8,10,11,12,13,14,15,16,17,27,28,29,36,37,38,39,40,41,42,43,44,45,46,51,52,53,62,63,64,65,67,70)
vPropertiesMatrix(acCurrencyField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,25,27,28,36,37,39,40,41,42,43,44,45,46,48,51,52,62,63,64,65,67,69,70)
vPropertiesMatrix(acDateField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,19,25,27,28,36,37,39,40,41,42,43,44,45,46,48,51,52,62,63,64,65,66,67,69,70)
vPropertiesMatrix(acFileControl) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,25,27,28,36,37,39,40,41,42,43,44,45,46,48,51,52,62,63,64,65,66,67,69,70)
vPropertiesMatrix(acFixedLine) = Array(0,4,6,7,10,11,12,13,14,15,16,17,27,28,36,37,39,40,41,42,43,44,45,46,51,52,62,63,65,70)
vPropertiesMatrix(acFixedText) = Array(0,1,2,4,6,7,10,11,12,13,14,15,16,17,27,28,36,37,39,40,41,42,43,44,45,46,51,52,62,63,64,65,67,70)
vPropertiesMatrix(acFormattedField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,19,25,27,28,36,37,39,40,41,42,43,44,45,46,48,51,52,62,63,64,65,66,67,69,70)
vPropertiesMatrix(acGroupBox) = Array(4,6,7,10,11,12,13,14,15,16,17,27,28,36,37,39,40,41,42,43,44,45,46,51,52,62,63,65,70)
vPropertiesMatrix(acImageControl) = Array(0,1,2,6,7,10,27,28,36,37,39,40,41,42,43,44,45,46,51,52,53,62,63,64,65,70)
vPropertiesMatrix(acListBox) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,20,23,24,25,26,27,28,29,36,37,38,39,40,41,42,43,44,45,46,51,52,55,57,62,63,64,65,67,69,70)
vPropertiesMatrix(acNavigationBar) = Array(36,37,39,40,41,42,43,44,45,46)
vPropertiesMatrix(acNumericField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,25,27,28,36,37,39,40,41,42,43,44,45,46,48,51,52,62,63,64,65,67,69,70)
vPropertiesMatrix(acPatternField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,25,27,28,36,37,39,40,41,42,43,44,45,46,48,51,52,58,59,60,62,63,64,65,66,67,69,70)
vPropertiesMatrix(acProgressBar) = Array(0,1,2,6,7,10,27,28,36,37,39,40,41,42,43,44,45,46,51,52,62,63,65,69,70)
vPropertiesMatrix(acRadioButton) = Array(0,4,6,7,10,11,12,13,14,15,16,17,27,28,29,36,37,38,39,40,41,42,43,44,45,46,50,51,52,61,62,63,64,65,67,69,70)
vPropertiesMatrix(acScrollBar) = Array(0,1,2,6,7,10,27,28,30,36,37,39,40,41,42,43,44,45,46,51,52,62,63,64,65,69,70)
vPropertiesMatrix(acTextField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,25,27,28,36,37,39,40,41,42,43,44,45,46,48,51,52,58,59,60,62,63,64,65,66,67,69,70)
vPropertiesMatrix(acTimeField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,19,25,27,28,36,37,39,40,41,42,43,44,45,46,48,51,52,62,63,64,65,66,67,69,70)
End Select
Dim i As Integer, iIndex As Integer
If _ControlType = acSubForm Then iIndex = 0 Else iIndex = _ControlType
If IsEmpty(vPropertiesMatrix(iIndex)) Then
_ThisProperties = Array()
Else
ReDim _ThisProperties(0 To UBound(vPropertiesMatrix(iIndex)))
For i = 0 To UBound(_ThisProperties)
_ThisProperties(i) = vFullPropertiesList(vPropertiesMatrix(iIndex)(i))
Next i
End If
_PropertiesList = _ThisProperties()
End Function ' _PropertiesList
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertyGet(ByVal psProperty As String, ByVal Optional pvIndex As Variant) As Variant
' Return property value of the psProperty property name
Dim iArg As Integer
If _ErrorHandler() Then On Local Error Goto Error_Function
Utils._SetCalledSub("Control.get" & psProperty)
_PropertyGet = EMPTY
'Check Index argument
Dim iArgNr As Integer
If Not IsMissing(pvIndex) Then
Select Case UCase(_A2B_.CalledSub)
Case UCase("getProperty") : iArgNr = 3
Case UCase("Control.getProperty") : iArgNr = 2
Case UCase("Control.get" & psProperty) : iArgNr = 1
End Select
If Not Utils._CheckArgument(pvIndex, iArgNr, Utils._AddNumeric()) Then Goto Exit_Function
End If
Dim vDefaultValue As Variant, oDefaultValue As Object, vValue As Variant, oValue As Object, iIndex As Integer
Dim lListIndex As Long, i As Integer, j As Integer, vCurrentValue As Variant, lListCount As Long
Dim vListboxValue As Variant, vListSource, bSelected() As Boolean, bListboxBound As Boolean
Dim vGet As Variant, vDate As Variant
Dim ofSubForm As Object
Dim vFormats() As Variant
Dim vSelection As Variant, sSelectedText As String
Dim oControlEvents As Object, sEventName As String
If Not hasProperty(psProperty) Then Goto Trace_Error
Select Case UCase(psProperty)
Case UCase("BackColor")
If Utils._hasUNOProperty(ControlModel, "BackgroundColor") Then _PropertyGet = ControlModel.BackgroundColor
Case UCase("BorderColor")
If Utils._hasUNOProperty(ControlModel, "BorderColor") Then _PropertyGet = ControlModel.BorderColor
Case UCase("BorderStyle")
If Utils._hasUNOProperty(ControlModel, "Border") Then _PropertyGet = ControlModel.Border
Case UCase("Cancel")
If Utils._hasUNOProperty(ControlModel, "PushButtonType") Then _PropertyGet = ( ControlModel.PushButtonType = com.sun.star.awt.PushButtonType.CANCEL )
Case UCase("Caption")
If Utils._hasUNOProperty(ControlModel, "Label") Then _PropertyGet = ControlModel.Label
Case UCase("ControlSource")
If Utils._hasUNOProperty(ControlModel, "DataField") Then _PropertyGet = ControlModel.DataField
Case UCase("ControlTipText")
If Utils._hasUNOProperty(ControlModel, "HelpText") Then _PropertyGet = ControlModel.HelpText
--> --------------------
--> maximum size reached
--> --------------------
[ Dauer der Verarbeitung: 0.22 Sekunden
(vorverarbeitet)
]
|
2026-04-02
|