This commit is contained in:
Jane
2024-07-16 15:55:31 +08:00
parent 8f4ec86367
commit 29bc31ade5
12411 changed files with 8139339 additions and 0 deletions

View File

@@ -0,0 +1,399 @@
<?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="Collect" 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 MODULE NAME &lt;&gt; COLLECTION (is a reserved name for ... collections)
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS ROOT FIELDS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private _Type As String &apos; Must be COLLECTION
Private _This As Object &apos; Workaround for absence of This builtin function
Private _CollType As String
Private _Parent As Object
Private _Count As Long
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CONSTRUCTORS / DESTRUCTORS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJCOLLECTION
Set _This = Nothing
_CollType = &quot;&quot;
Set _Parent = Nothing
_Count = 0
End Sub &apos; Constructor
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Terminate()
On Local Error Resume Next
Call Class_Initialize()
End Sub &apos; Destructor
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub Dispose()
Call Class_Terminate()
End Sub &apos; Explicit destructor
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS GET/LET/SET PROPERTIES ---
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Count() As Long
Count = _PropertyGet(&quot;Count&quot;)
End Property &apos; Count (get)
REM -----------------------------------------------------------------------------------------------------------------------
Function Item(ByVal Optional pvItem As Variant) As Variant
&apos;Return property value.
&apos;pvItem either numeric index or property name
Const cstThisSub = &quot;Collection.getItem&quot;
If _ErrorHandler() Then On Local Error Goto Error_Function
Utils._SetCalledSub(cstThisSub)
If IsMissing(pvItem) Then Goto Exit_Function &apos; To allow object watching in Basic IDE, do not generate error
Select Case _CollType
Case COLLCOMMANDBARCONTROLS &apos; Have no name
If Not Utils._CheckArgument(pvItem, 1, Utils._AddNumeric()) Then Goto Exit_Function
Case Else
If Not Utils._CheckArgument(pvItem, 1, Utils._AddNumeric(vbString)) Then Goto Exit_Function
End Select
Dim vNames() As Variant, oProperty As Object
Set Item = Nothing
Select Case _CollType
Case COLLALLDIALOGS
Set Item = Application.AllDialogs(pvItem)
Case COLLALLFORMS
Set Item = Application.AllForms(pvItem)
Case COLLALLMODULES
Set Item = Application.AllModules(pvItem)
Case COLLCOMMANDBARS
Set Item = Application.CommandBars(pvItem)
Case COLLCOMMANDBARCONTROLS
If IsNull(_Parent) Then GoTo Error_Parent
Set Item = _Parent.CommandBarControls(pvItem)
Case COLLCONTROLS
If IsNull(_Parent) Then GoTo Error_Parent
Set Item = _Parent.Controls(pvItem)
Case COLLFORMS
Set Item = Application.Forms(pvItem)
Case COLLFIELDS
If IsNull(_Parent) Then GoTo Error_Parent
Set Item = _Parent.Fields(pvItem)
Case COLLPROPERTIES
If IsNull(_Parent) Then GoTo Error_Parent
Select Case _Parent._Type
Case OBJCONTROL, OBJSUBFORM, OBJDATABASE, OBJDIALOG, OBJFIELD _
, OBJFORM, OBJQUERYDEF, OBJRECORDSET, OBJTABLEDEF
Set Item = _Parent.Properties(pvItem)
Case OBJCOLLECTION, OBJEVENT, OBJOPTIONGROUP, OBJPROPERTY
&apos; NOT SUPPORTED
End Select
Case COLLQUERYDEFS
Set Item = _Parent.QueryDefs(pvItem)
Case COLLRECORDSETS
Set Item = _Parent.Recordsets(pvItem)
Case COLLTABLEDEFS
Set Item = _Parent.TableDefs(pvItem)
Case COLLTEMPVARS
Set Item = Application.TempVars(pvItem)
Case Else
End Select
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, Utils._CalledSub(), Erl)
Set Item = Nothing
GoTo Exit_Function
Error_Parent:
TraceError(TRACEFATAL, ERROBJECTNOTFOUND, Utils._CalledSub(), 0, True, Array(_GetLabel(&quot;OBJECT&quot;), _GetLabel(&quot;PARENT&quot;)))
Set Item = Nothing
GoTo Exit_Function
End Function &apos; Item V1.1.0
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ObjectType() As String
ObjectType = _PropertyGet(&quot;ObjectType&quot;)
End Property &apos; ObjectType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
&apos; Return
&apos; a Collection object if pvIndex absent
&apos; a Property object otherwise
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
Exit Function
End Function &apos; Properties
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS METHODS ---
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Add(Optional pvNew As Variant, Optional pvValue As Variant) As Boolean
&apos; Append a new TableDef or TempVar object to the TableDefs/TempVars collections
Const cstThisSub = &quot;Collection.Add&quot;
Utils._SetCalledSub(cstThisSub)
If _ErrorHandler() Then On Local Error Goto Error_Function
Dim odbDatabase As Object, oConnection As Object, oTables As Object, oTable As Object
Dim vObject As Variant, oTempVar As Object
Add = False
If IsMissing(pvNew) Then Call _TraceArguments()
Select Case _CollType
Case COLLTABLEDEFS
If Not Utils._CheckArgument(pvNew, 1, vbObject) Then Goto Exit_Function
Set vObject = pvNew
With vObject
Set odbDatabase = ._ParentDatabase
If odbDatabase._DbConnect &lt;&gt; DBCONNECTBASE Then Goto Error_NotApplicable
Set oConnection = odbDatabase.Connection
If IsNull(.TableDescriptor) Or .TableFieldsCount = 0 Then Goto Error_Sequence
Set oTables = oConnection.getTables()
oTables.appendByDescriptor(.TableDescriptor)
Set .Table = oTables.getByName(._Name)
.CatalogName = .Table.CatalogName
.SchemaName = .Table.SchemaName
.TableName = .Table.Name
.TableDescriptor.dispose()
Set .TableDescriptor = Nothing
.TableFieldsCount = 0
.TableKeysCount = 0
End With
Case COLLTEMPVARS
If Not Utils._CheckArgument(pvNew, 1, vbString) Then Goto Exit_Function
If pvNew = &quot;&quot; Then Goto Error_Name
If IsMissing(pvValue) Then Call _TraceArguments()
If _A2B_.hasItem(COLLTEMPVARS, pvNew) Then Goto Error_Name
Set oTempVar = New TempVar
oTempVar._This = oTempVar
oTempVar._Name = pvNew
oTempVar._Value = pvValue
_A2B_.TempVars.Add(oTempVar, UCase(pvNew))
Case Else
Goto Error_NotApplicable
End Select
_Count = _Count + 1
Add = True
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
GoTo Exit_Function
Error_NotApplicable:
TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, 1, cstThisSub)
Goto Exit_Function
Error_Sequence:
TraceError(TRACEFATAL, ERRTABLECREATION, Utils._CalledSub(), 0, 1, vObject._Name)
Goto Exit_Function
Error_Name:
TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), False, ,Array(1, pvNew))
AddItem = False
Goto Exit_Function
End Function &apos; Add V1.1.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Delete(ByVal Optional pvName As Variant) As Boolean
&apos; Delete a TableDef or QueryDef object in the TableDefs/QueryDefs collections
Const cstThisSub = &quot;Collection.Delete&quot;
Utils._SetCalledSub(cstThisSub)
If _ErrorHandler() Then On Local Error Goto Error_Function
Dim odbDatabase As Object, oColl As Object, vName As Variant
Delete = False
If IsMissing(pvName) Then pvName = &quot;&quot;
If Not Utils._CheckArgument(pvName, 1, vbString) Then Goto Exit_Function
If pvName = &quot;&quot; Then Call _TraceArguments()
Select Case _CollType
Case COLLTABLEDEFS, COLLQUERYDEFS
If _A2B_.CurrentDocIndex() &lt;&gt; 0 Then Goto Error_NotApplicable
Set odbDatabase = Application._CurrentDb()
If odbDatabase._DbConnect &lt;&gt; DBCONNECTBASE Then Goto Error_NotApplicable
If _CollType = COLLTABLEDEFS Then Set oColl = odbDatabase.Connection.getTables() Else Set oColl = odbDatabase.Connection.getQueries()
With oColl
vName = _InList(pvName, .getElementNames(), True)
If vName = False Then Goto trace_NotFound
.dropByName(vName)
End With
odbDatabase.Document.store()
Case Else
Goto Error_NotApplicable
End Select
_Count = _Count - 1
Delete = True
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
GoTo Exit_Function
Error_NotApplicable:
TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, 1, cstThisSub)
Goto Exit_Function
Trace_NotFound:
TraceError(TRACEFATAL, ERROBJECTNOTFOUND, Utils._CalledSub(), 0, , Array(_GetLabel(Left(_CollType, 5)), pvName))
Goto Exit_Function
End Function &apos; Delete V1.1.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
&apos; Return property value of psProperty property name
Utils._SetCalledSub(&quot;Collection.getProperty&quot;)
If IsMissing(pvProperty) Then Call _TraceArguments()
getProperty = _PropertyGet(pvProperty)
Utils._ResetCalledSub(&quot;Collection.getProperty&quot;)
End Function &apos; getProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
&apos; 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 &apos; hasProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Remove(ByVal Optional pvName As Variant) As Boolean
&apos; Remove a TempVar from the TempVars collection
Const cstThisSub = &quot;Collection.Remove&quot;
Utils._SetCalledSub(cstThisSub)
If _ErrorHandler() Then On Local Error Goto Error_Function
Dim oColl As Object, vName As Variant
Remove = False
If IsMissing(pvName) Then pvName = &quot;&quot;
If Not Utils._CheckArgument(pvName, 1, vbString) Then Goto Exit_Function
If pvName = &quot;&quot; Then Call _TraceArguments()
Select Case _CollType
Case COLLTEMPVARS
If Not _A2B_.hasItem(COLLTEMPVARS, pvName) Then Goto Error_Name
_A2B_.TempVars.Remove(UCase(pvName))
Case Else
Goto Error_NotApplicable
End Select
_Count = _Count - 1
Remove = True
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
GoTo Exit_Function
Error_NotApplicable:
TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, 1, cstThisSub)
Goto Exit_Function
Error_Name:
TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), False, ,Array(1, pvName))
AddItem = False
Goto Exit_Function
End Function &apos; Remove V1.2.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function RemoveAll() As Boolean
&apos; Remove the whole TempVars collection
Const cstThisSub = &quot;Collection.Remove&quot;
Utils._SetCalledSub(cstThisSub)
If _ErrorHandler() Then On Local Error Goto Error_Function
Select Case _CollType
Case COLLTEMPVARS
Set _A2B_.TempVars = New Collection
_Count = 0
Case Else
Goto Error_NotApplicable
End Select
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
GoTo Exit_Function
Error_NotApplicable:
TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, 1, cstThisSub)
Goto Exit_Function
End Function &apos; RemoveAll V1.2.0
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertiesList() As Variant
_PropertiesList = Array(&quot;Count&quot;, &quot;Item&quot;, &quot;ObjectType&quot;)
End Function &apos; _PropertiesList
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertyGet(ByVal psProperty As String) As Variant
&apos; Return property value of the psProperty property name
If _ErrorHandler() Then On Local Error Goto Error_Function
Utils._SetCalledSub(&quot;Collection.get&quot; &amp; psProperty)
_PropertyGet = Nothing
Select Case UCase(psProperty)
Case UCase(&quot;Count&quot;)
_PropertyGet = _Count
Case UCase(&quot;Item&quot;)
Case UCase(&quot;ObjectType&quot;)
_PropertyGet = _Type
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(&quot;Collection.get&quot; &amp; psProperty)
Exit Function
Trace_Error:
TraceError(TRACEWARNING, ERRPROPERTY, Utils._CalledSub(), 0, , psProperty)
_PropertyGet = Nothing
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;Collection._PropertyGet&quot;, Erl)
_PropertyGet = Nothing
GoTo Exit_Function
End Function &apos; _PropertyGet
</script:module>

View File

@@ -0,0 +1,396 @@
<?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="CommandBar" 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 &apos; Must be COMMANDBAR
Private _This As Object &apos; Workaround for absence of This builtin function
Private _Parent As Object
Private _Name As String
Private _ResourceURL As String
Private _Window As Object &apos; com.sun.star.frame.XFrame
Private _Module As String
Private _Toolbar As Object
Private _BarBuiltin As Integer &apos; 1 = builtin, 2 = custom stored in LO/AOO (Base), 3 = custom stored in document (Form)
Private _BarType As Integer &apos; See msoBarTypeXxx constants
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CONSTRUCTORS / DESTRUCTORS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJCOMMANDBAR
Set _This = Nothing
Set _Parent = Nothing
_Name = &quot;&quot;
_ResourceURL = &quot;&quot;
Set _Window = Nothing
_Module = &quot;&quot;
Set _Toolbar = Nothing
_BarBuiltin = 0
_BarType = -1
End Sub &apos; Constructor
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Terminate()
On Local Error Resume Next
Call Class_Initialize()
End Sub &apos; Destructor
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub Dispose()
Call Class_Terminate()
End Sub &apos; Explicit destructor
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS GET/LET/SET PROPERTIES ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Property Get BuiltIn() As Boolean
BuiltIn = _PropertyGet(&quot;BuiltIn&quot;)
End Property &apos; BuiltIn (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Name() As String
Name = _PropertyGet(&quot;Name&quot;)
End Property &apos; Name (get)
Public Function pName() As String &apos; For compatibility with &lt; V0.9.0
pName = _PropertyGet(&quot;Name&quot;)
End Function &apos; pName (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ObjectType() As String
ObjectType = _PropertyGet(&quot;ObjectType&quot;)
End Property &apos; ObjectType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Parent() As Object
Parent = _Parent
End Function &apos; Parent (get) V6.4.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
&apos; Return
&apos; a Collection object if pvIndex absent
&apos; a Property object otherwise
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
Exit Function
End Function &apos; Properties
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Visible() As Variant
Visible = _PropertyGet(&quot;Visible&quot;)
End Property &apos; Visible (get)
Property Let Visible(ByVal pvValue As Variant)
Call _PropertySet(&quot;Visible&quot;, pvValue)
End Property &apos; Visible (set)
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS METHODS ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Public Function CommandBarControls(Optional ByVal pvIndex As Variant) As Variant
&apos; Return an object of type CommandBarControl indicated by its index
&apos; Index is different from UNO index: separators do not count
&apos; If no pvIndex argument, return a Collection type
If _ErrorHandler() Then On Local Error Goto Error_Function
Const cstThisSub = &quot;CommandBar.CommandBarControls&quot;
Utils._SetCalledSub(cstThisSub)
Dim oLayout As Object, vElements() As Variant, iIndexToolbar As Integer, oToolbar As Object
Dim i As Integer, iItemsCount As Integer, oSettings As Object, vItem() As Variant, bSeparator As Boolean
Dim oObject As Object
Set oObject = Nothing
If Not IsMissing(pvIndex) Then
If Not Utils._CheckArgument(pvIndex, 1, Utils._AddNumeric()) Then Goto Exit_Function
If pvIndex &lt; 0 Then Goto Trace_IndexError
End If
Select Case _BarType
Case msoBarTypeNormal, msoBarTypeMenuBar
Case Else : Goto Error_NotApplicable &apos; Status bar not supported
End Select
Set oLayout = _Window.LayoutManager
vElements = oLayout.getElements()
iIndexToolbar = _FindElement(vElements())
If iIndexToolbar &lt; 0 Then Goto Error_NotApplicable &apos; Toolbar not visible
Set oToolbar = vElements(iIndexToolbar)
iItemsCount = 0
Set oSettings = oToolbar.getSettings(False)
bSeparator = False
For i = 0 To oSettings.getCount() - 1
Set vItem() = oSettings.getByIndex(i)
If _GetPropertyValue(vItem, &quot;Type&quot;, 1) &lt;&gt; 1 Then &apos; Type = 1 indicates separator
iItemsCount = iItemsCount + 1
If Not IsMissing(pvIndex) Then
If pvIndex = iItemsCount - 1 Then
Set oObject = New CommandBarControl
With oObject
Set ._This = oObject
Set ._Parent = _This
._ParentCommandBarName = _Name
._ParentCommandBar = oToolbar
._ParentBuiltin = ( _BarBuiltin = 1 )
._Element = vItem()
._InternalIndex = i
._Index = iItemsCount &apos; Indexes start at 1
._BeginGroup = bSeparator
End With
End If
bSeparator = False
End If
Else
bSeparator = True
End If
Next i
If IsNull(oObject) Then
Select Case True
Case IsMissing(pvIndex)
Set oObject = New Collect
Set oObject._This = oObject
oObject._CollType = COLLCOMMANDBARCONTROLS
Set oObject._Parent = _This
oObject._Count = iItemsCount
Case Else &apos; pvIndex is numeric
Goto Trace_IndexError
End Select
End If
Exit_Function:
Set CommandBarControls = oObject
Set oObject = Nothing
Utils._ResetCalledSub(cstThisSub)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
GoTo Exit_Function
Trace_IndexError:
TraceError(TRACEFATAL, ERRCOLLECTION, Utils._CalledSub(), 0)
Goto Exit_Function
Error_NotApplicable:
TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, 1, cstThisSub)
Goto Exit_Function
End Function &apos; CommandBarControls V1,3,0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Controls(Optional ByVal pvIndex As Variant) As Variant
&apos; Alias for CommandBarControls (VBA)
If _ErrorHandler() Then On Local Error Goto Error_Function
Const cstThisSub = &quot;CommandBar.Controls&quot;
Utils._SetCalledSub(cstThisSub)
Dim oObject As Object
If IsMissing(pvIndex) Then Set oObject = CommandBarControls() Else Set oObject = CommandBarControls(pvIndex)
Exit_Function:
Set Controls = oObject
Set oObject = Nothing
Utils._ResetCalledSub(cstThisSub)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
GoTo Exit_Function
End Function &apos; Controls V1,3,0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
&apos; Return property value of psProperty property name
Utils._SetCalledSub(&quot;CommandBar.getProperty&quot;)
If IsMissing(pvProperty) Then Call _TraceArguments()
getProperty = _PropertyGet(pvProperty)
Utils._ResetCalledSub(&quot;CommandBar.getProperty&quot;)
End Function &apos; getProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
&apos; 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 &apos; hasProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Reset() As Boolean
&apos; Reset a whole command bar to its initial values
If _ErrorHandler() Then On Local Error Goto Error_Function
Const cstThisSub = &quot;CommandBar.Reset&quot;
Utils._SetCalledSub(cstThisSub)
_Toolbar.reload()
Exit_Function:
Reset = True
Utils._ResetCalledSub(cstThisSub)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
Reset = False
GoTo Exit_Function
End Function &apos; Reset V1.3.0
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _FindElement(pvElements As Variant) As Integer
&apos; Return -1 if not found, otherwise return index in elements table of LayoutManager
Dim i As Integer
_FindElement = -1
If Not IsArray(pvElements) Then Exit Function
For i = 0 To UBound(pvElements)
If _ResourceURL = pvElements(i).ResourceURL Then
_FindElement = i
Exit Function
End If
Next i
End Function
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertiesList() As Variant
_PropertiesList = Array(&quot;BuiltIn&quot;, &quot;Name&quot;, &quot;ObjectType&quot;, &quot;Visible&quot;)
End Function &apos; _PropertiesList
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertyGet(ByVal psProperty As String) As Variant
&apos; Return property value of the psProperty property name
If _ErrorHandler() Then On Local Error Goto Error_Function
Dim cstThisSub As String
cstThisSub = &quot;CommandBar.get&quot; &amp; psProperty
Utils._SetCalledSub(cstThisSub)
_PropertyGet = Nothing
Dim oLayout As Object, iElementIndex As Integer
Select Case UCase(psProperty)
Case UCase(&quot;BuiltIn&quot;)
_PropertyGet = ( _BarBuiltin = 1 )
Case UCase(&quot;Name&quot;)
_PropertyGet = _Name
Case UCase(&quot;ObjectType&quot;)
_PropertyGet = _Type
Case UCase(&quot;Visible&quot;)
Set oLayout = _Window.LayoutManager
iElementIndex = _FindElement(oLayout.getElements())
If iElementIndex &lt; 0 Then _PropertyGet = False Else _PropertyGet = oLayout.isElementVisible(_ResourceURL)
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Trace_Error:
TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
_PropertyGet = Nothing
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, Utils._CalledSub(), Erl)
_PropertyGet = Nothing
GoTo Exit_Function
End Function &apos; _PropertyGet
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Variant) As Boolean
&apos; Return True if property setting OK
If _ErrorHandler() Then On Local Error Goto Error_Function
Dim cstThisSub As String
cstThisSub = &quot;CommandBar.set&quot; &amp; psProperty
Utils._SetCalledSub(cstThisSub)
_PropertySet = True
Dim iArgNr As Integer
Dim oLayout As Object, iElementIndex As Integer
Select Case UCase(_A2B_.CalledSub)
Case UCase(&quot;setProperty&quot;) : iArgNr = 3
Case UCase(&quot;CommandBar.setProperty&quot;) : iArgNr = 2
Case UCase(cstThisSub) : iArgNr = 1
End Select
If Not hasProperty(psProperty) Then Goto Trace_Error
Select Case UCase(psProperty)
Case UCase(&quot;Visible&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
Set oLayout = _Window.LayoutManager
With oLayout
iElementIndex = _FindElement(.getElements())
If iElementIndex &lt; 0 Then
If pvValue Then
.createElement(_ResourceURL)
.showElement(_ResourceURL)
End If
Else
If pvValue &lt;&gt; .isElementVisible(_ResourceURL) Then
If pvValue Then .showElement(_ResourceURL) Else .hideElement(_ResourceURL)
End If
End If
End With
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Trace_Error:
TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, , psProperty)
_PropertySet = False
Goto Exit_Function
Trace_Error_Value:
TraceError(TRACEFATAL, ERRPROPERTYVALUE, Utils._CalledSub(), 0, 1, Array(pvValue, psProperty))
_PropertySet = False
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
_PropertySet = False
GoTo Exit_Function
End Function &apos; _PropertySet
</script:module>

View File

@@ -0,0 +1,339 @@
<?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="CommandBarControl" 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 &apos; Must be COMMANDBARCONTROL
Private _This As Object &apos; Workaround for absence of This builtin function
Private _Parent As Object
Private _InternalIndex As Integer &apos; Index in toolbar including separators
Private _Index As Integer &apos; Index in collection, starting at 1 !!
Private _ControlType As Integer &apos; 1 of the msoControl* constants
Private _ParentCommandBarName As String
Private _ParentCommandBar As Object &apos; com.sun.star.ui.XUIElement
Private _ParentBuiltin As Boolean
Private _Element As Variant
Private _BeginGroup As Boolean
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CONSTRUCTORS / DESTRUCTORS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJCOMMANDBARCONTROL
Set _This = Nothing
Set _Parent = Nothing
_Index = -1
_ParentCommandBarName = &quot;&quot;
Set _ParentCommandBar = Nothing
_ParentBuiltin = False
_Element = Array()
_BeginGroup = False
End Sub &apos; Constructor
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Terminate()
On Local Error Resume Next
Call Class_Initialize()
End Sub &apos; Destructor
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub Dispose()
Call Class_Terminate()
End Sub &apos; Explicit destructor
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS GET/LET/SET PROPERTIES ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Property Get BeginGroup() As Boolean
BeginGroup = _PropertyGet(&quot;BeginGroup&quot;)
End Property &apos; BeginGroup (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get BuiltIn() As Boolean
BuiltIn = _PropertyGet(&quot;BuiltIn&quot;)
End Property &apos; BuiltIn (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Caption() As Variant
Caption = _PropertyGet(&quot;Caption&quot;)
End Property &apos; Caption (get)
Property Let Caption(ByVal pvValue As Variant)
Call _PropertySet(&quot;Caption&quot;, pvValue)
End Property &apos; Caption (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Index() As Integer
Index = _PropertyGet(&quot;Index&quot;)
End Property &apos; Index (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ObjectType() As String
ObjectType = _PropertyGet(&quot;ObjectType&quot;)
End Property &apos; ObjectType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnAction() As Variant
OnAction = _PropertyGet(&quot;OnAction&quot;)
End Property &apos; OnAction (get)
Property Let OnAction(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnAction&quot;, pvValue)
End Property &apos; OnAction (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Parent() As Object
Parent = _PropertyGet(&quot;Parent&quot;)
End Property &apos; Parent (get)
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
&apos; Return
&apos; a Collection object if pvIndex absent
&apos; a Property object otherwise
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
Exit Function
End Function &apos; Properties
REM -----------------------------------------------------------------------------------------------------------------------
Property Get TooltipText() As Variant
TooltipText = _PropertyGet(&quot;TooltipText&quot;)
End Property &apos; TooltipText (get)
Property Let TooltipText(ByVal pvValue As Variant)
Call _PropertySet(&quot;TooltipText&quot;, pvValue)
End Property &apos; TooltipText (set)
REM -----------------------------------------------------------------------------------------------------------------------
Public Function pType() As Integer
pType = _PropertyGet(&quot;Type&quot;)
End Function &apos; Type (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Visible() As Variant
Visible = _PropertyGet(&quot;Visible&quot;)
End Property &apos; Visible (get)
Property Let Visible(ByVal pvValue As Variant)
Call _PropertySet(&quot;Visible&quot;, pvValue)
End Property &apos; Visible (set)
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS METHODS ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Execute()
&apos; Execute the command stored in a toolbar button
If _ErrorHandler() Then On Local Error Goto Error_Function
Const cstThisSub = &quot;CommandBarControl.Execute&quot;
Utils._SetCalledSub(cstThisSub)
Dim sExecute As String
Execute = True
sExecute = _GetPropertyValue(_Element, &quot;CommandURL&quot;, &quot;&quot;)
Select Case True
Case sExecute = &quot;&quot; : Execute = False
Case _IsLeft(sExecute, &quot;.uno:&quot;)
Execute = DoCmd.RunCommand(sExecute)
Case _IsLeft(sExecute, &quot;vnd.sun.star.script:&quot;)
Execute = Utils._RunScript(sExecute, Array(Nothing))
Case Else
End Select
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
Execute = False
GoTo Exit_Function
End Function &apos; Execute V1.3.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
&apos; Return property value of psProperty property name
Utils._SetCalledSub(&quot;CommandBarControl.getProperty&quot;)
If IsMissing(pvProperty) Then Call _TraceArguments()
getProperty = _PropertyGet(pvProperty)
Utils._ResetCalledSub(&quot;CommandBar.getProperty&quot;)
End Function &apos; getProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
&apos; 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 &apos; hasProperty
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertiesList() As Variant
_PropertiesList = Array(&quot;BeginGroup&quot;, &quot;BuiltIn&quot;, &quot;Caption&quot;, &quot;Index&quot; _
, &quot;ObjectType&quot;, &quot;OnAction&quot;, &quot;Parent&quot; _
, &quot;TooltipText&quot;, &quot;Type&quot;, &quot;Visible&quot; _
)
End Function &apos; _PropertiesList
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertyGet(ByVal psProperty As String) As Variant
&apos; Return property value of the psProperty property name
If _ErrorHandler() Then On Local Error Goto Error_Function
Dim cstThisSub As String
cstThisSub = &quot;CommandBarControl.get&quot; &amp; psProperty
Utils._SetCalledSub(cstThisSub)
_PropertyGet = Null
Dim oLayout As Object, iElementIndex As Integer
Dim sValue As String
Const cstUnoPrefix = &quot;.uno:&quot;
Select Case UCase(psProperty)
Case UCase(&quot;BeginGroup&quot;)
_PropertyGet = _BeginGroup
Case UCase(&quot;BuiltIn&quot;)
sValue = _GetPropertyValue(_Element, &quot;CommandURL&quot;, &quot;&quot;)
_PropertyGet = ( _IsLeft(sValue, cstUnoPrefix) )
Case UCase(&quot;Caption&quot;)
_PropertyGet = _GetPropertyValue(_Element, &quot;Label&quot;, &quot;&quot;)
Case UCase(&quot;Index&quot;)
_PropertyGet = _Index
Case UCase(&quot;ObjectType&quot;)
_PropertyGet = _Type
Case UCase(&quot;OnAction&quot;)
_PropertyGet = _GetPropertyValue(_Element, &quot;CommandURL&quot;, &quot;&quot;)
Case UCase(&quot;Parent&quot;)
Set _PropertyGet = _Parent
Case UCase(&quot;TooltipText&quot;)
sValue = _GetPropertyValue(_Element, &quot;Tooltip&quot;, &quot;&quot;)
If sValue &lt;&gt; &quot;&quot; Then _PropertyGet = sValue Else _PropertyGet = _GetPropertyValue(_Element, &quot;Label&quot;, &quot;&quot;)
Case UCase(&quot;Type&quot;)
_PropertyGet = msoControlButton
Case UCase(&quot;Visible&quot;)
_PropertyGet = _GetPropertyValue(_Element, &quot;IsVisible&quot;, &quot;&quot;)
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Trace_Error:
TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
_PropertyGet = Nothing
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, Utils._CalledSub(), Erl)
_PropertyGet = Nothing
GoTo Exit_Function
End Function &apos; _PropertyGet
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Variant) As Boolean
&apos; Return True if property setting OK
If _ErrorHandler() Then On Local Error Goto Error_Function
Dim cstThisSub As String
cstThisSub = &quot;CommandBarControl.set&quot; &amp; psProperty
Utils._SetCalledSub(cstThisSub)
_PropertySet = True
Dim iArgNr As Integer
Dim oSettings As Object, sValue As String
Select Case UCase(_A2B_.CalledSub)
Case UCase(&quot;setProperty&quot;) : iArgNr = 3
Case UCase(&quot;CommandBar.setProperty&quot;) : iArgNr = 2
Case UCase(cstThisSub) : iArgNr = 1
End Select
If Not hasProperty(psProperty) Then Goto Trace_Error
If _ParentBuiltin Then Goto Trace_Error &apos; Modifications of individual controls forbidden for builtin toolbars (design choice)
Const cstUnoPrefix = &quot;.uno:&quot;
Const cstScript = &quot;vnd.sun.star.script:&quot;
Set oSettings = _ParentCommandBar.getSettings(True)
Select Case UCase(psProperty)
Case UCase(&quot;OnAction&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, _AddNumeric(vbString), , False) Then Goto Trace_Error_Value
Select Case VarType(pvValue)
Case vbString
If _IsLeft(pvValue, cstUnoPrefix) Then
sValue = pvValue
ElseIf _IsLeft(pvValue, cstScript) Then
sValue = pvValue
Else
sValue = DoCmd.RunCommand(pvValue, True)
End If
Case Else &apos; Numeric
sValue = DoCmd.RunCommand(pvValue, True)
End Select
_SetPropertyValue(_Element, &quot;CommandURL&quot;, sValue)
Case UCase(&quot;TooltipText&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
_SetPropertyValue(_Element, &quot;Tooltip&quot;, pvValue)
Case UCase(&quot;Visible&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
_SetPropertyValue(_Element, &quot;IsVisible&quot;, pvValue)
Case Else
Goto Trace_Error
End Select
oSettings.replaceByIndex(_InternalIndex, _Element)
_ParentCommandBar.setSettings(oSettings)
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Trace_Error:
TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, , psProperty)
_PropertySet = False
Goto Exit_Function
Trace_Error_Value:
TraceError(TRACEFATAL, ERRPROPERTYVALUE, Utils._CalledSub(), 0, 1, Array(pvValue, psProperty))
_PropertySet = False
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
_PropertySet = False
GoTo Exit_Function
End Function &apos; _PropertySet
</script:module>

View File

@@ -0,0 +1,598 @@
<?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="DataDef" 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 &apos; Must be TABLEDEF or QUERYDEF
Private _This As Object &apos; Workaround for absence of This builtin function
Private _Parent As Object
Private _Name As String &apos; For tables: [[Catalog.]Schema.]Table
Private _ParentDatabase As Object
Private _ReadOnly As Boolean
Private Table As Object &apos; com.sun.star.sdb.dbaccess.ODBTable
Private CatalogName As String
Private SchemaName As String
Private TableName As String
Private Query As Object &apos; com.sun.star.sdb.dbaccess.OQuery
Private TableDescriptor As Object &apos; com.sun.star.sdb.dbaccess.ODBTable
Private TableFieldsCount As Integer
Private TableKeysCount As Integer
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CONSTRUCTORS / DESTRUCTORS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = &quot;&quot;
Set _This = Nothing
Set _Parent = Nothing
_Name = &quot;&quot;
Set _ParentDatabase = Nothing
_ReadOnly = False
Set Table = Nothing
CatalogName = &quot;&quot;
SchemaName = &quot;&quot;
TableName = &quot;&quot;
Set Query = Nothing
Set TableDescriptor = Nothing
TableFieldsCount = 0
TableKeysCount = 0
End Sub &apos; Constructor
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Terminate()
On Local Error Resume Next
Call Class_Initialize()
End Sub &apos; Destructor
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub Dispose()
Call Class_Terminate()
End Sub &apos; Explicit destructor
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS GET/LET/SET PROPERTIES ---
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Name() As String
Name = _PropertyGet(&quot;Name&quot;)
End Property &apos; Name (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ObjectType() As String
ObjectType = _PropertyGet(&quot;ObjectType&quot;)
End Property &apos; ObjectType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get SQL() As Variant
SQL = _PropertyGet(&quot;SQL&quot;)
End Property &apos; SQL (get)
Property Let SQL(ByVal pvValue As Variant)
Call _PropertySet(&quot;SQL&quot;, pvValue)
End Property &apos; SQL (set)
REM -----------------------------------------------------------------------------------------------------------------------
Public Function pType() As Integer
pType = _PropertyGet(&quot;Type&quot;)
End Function &apos; Type (get)
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS METHODS ---
REM -----------------------------------------------------------------------------------------------------------------------
Public Function CreateField(ByVal Optional pvFieldName As Variant _
, ByVal optional pvType As Variant _
, ByVal optional pvSize As Variant _
, ByVal optional pvAttributes As Variant _
) As Object
&apos;Return a Field object
Const cstThisSub = &quot;TableDef.CreateField&quot;
Utils._SetCalledSub(cstThisSub)
If _ErrorHandler() Then On Local Error Goto Error_Function
Dim oTable As Object, oNewField As Object, oKeys As Object, oPrimaryKey As Object, oColumn As Object
Const cstMaxKeyLength = 30
CreateField = Nothing
If _ParentDatabase._DbConnect &lt;&gt; DBCONNECTBASE Then Goto Error_NotApplicable
If IsMissing(pvFieldName) Then Call _TraceArguments()
If Not Utils._CheckArgument(pvFieldName, 1, vbString) Then Goto Exit_Function
If pvFieldName = &quot;&quot; Then Call _TraceArguments()
If IsMissing(pvType) Then Call _TraceArguments()
If Not Utils._CheckArgument(pvType, 1, Utils._AddNumeric( _
dbInteger, dbLong, dbBigInt, dbFloat, vbSingle, dbDouble _
, dbNumeric, dbDecimal, dbText, dbChar, dbMemo _
, dbDate, dbTime, dbTimeStamp _
, dbBinary, dbVarBinary, dbLongBinary, dbBoolean _
)) Then Goto Exit_Function
If IsMissing(pvSize) Then pvSize = 0
If pvSize &lt; 0 Then pvSize = 0
If Not Utils._CheckArgument(pvSize, 1, Utils._AddNumeric()) Then Goto Exit_Function
If IsMissing(pvAttributes) Then pvAttributes = 0
If Not Utils._CheckArgument(pvAttributes, 1, Utils._AddNumeric(), Array(0, dbAutoIncrField)) Then Goto Exit_Function
If _Type &lt;&gt; OBJTABLEDEF Then Goto Error_NotApplicable
If IsNull(Table) And IsNull(TableDescriptor) Then Goto Error_NotApplicable
If _ReadOnly Then Goto Error_NoUpdate
Set oNewField = New Field
With oNewField
._This = oNewField
._Name = pvFieldName
._ParentName = _Name
._ParentType = OBJTABLEDEF
If IsNull(Table) Then Set oTable = TableDescriptor Else Set oTable = Table
Set .Column = oTable.Columns.createDataDescriptor()
End With
With oNewField.Column
.Name = pvFieldName
Select Case pvType
Case dbInteger : .Type = com.sun.star.sdbc.DataType.TINYINT
Case dbLong : .Type = com.sun.star.sdbc.DataType.INTEGER
Case dbBigInt : .Type = com.sun.star.sdbc.DataType.BIGINT
Case dbFloat : .Type = com.sun.star.sdbc.DataType.FLOAT
Case dbSingle : .Type = com.sun.star.sdbc.DataType.REAL
Case dbDouble : .Type = com.sun.star.sdbc.DataType.DOUBLE
Case dbNumeric, dbCurrency : .Type = com.sun.star.sdbc.DataType.NUMERIC
Case dbDecimal : .Type = com.sun.star.sdbc.DataType.DECIMAL
Case dbText : .Type = com.sun.star.sdbc.DataType.CHAR
Case dbChar : .Type = com.sun.star.sdbc.DataType.VARCHAR
Case dbMemo : .Type = com.sun.star.sdbc.DataType.LONGVARCHAR
Case dbDate : .Type = com.sun.star.sdbc.DataType.DATE
Case dbTime : .Type = com.sun.star.sdbc.DataType.TIME
Case dbTimeStamp : .Type = com.sun.star.sdbc.DataType.TIMESTAMP
Case dbBinary : .Type = com.sun.star.sdbc.DataType.BINARY
Case dbVarBinary : .Type = com.sun.star.sdbc.DataType.VARBINARY
Case dbLongBinary : .Type = com.sun.star.sdbc.DataType.LONGVARBINARY
Case dbBoolean : .Type = com.sun.star.sdbc.DataType.BOOLEAN
End Select
.Precision = Int(pvSize)
If pvType = dbNumeric Or pvType = dbDecimal Or pvType = dbCurrency Then .Scale = Int(pvSize * 10) - Int(pvSize) * 10
.IsNullable = com.sun.star.sdbc.ColumnValue.NULLABLE
If Utils._hasUNOProperty(oNewField.Column, &quot;CatalogName&quot;) Then .CatalogName = CatalogName
If Utils._hasUNOProperty(oNewField.Column, &quot;SchemaName&quot;) Then .SchemaName = SchemaName
If Utils._hasUNOProperty(oNewField.Column, &quot;TableName&quot;) Then .TableName = TableName
If Not IsNull(TableDescriptor) Then TableFieldsCount = TableFieldsCount + 1
If pvAttributes = dbAutoIncrField Then
If Not IsNull(Table) Then Goto Error_Sequence &apos; Do not accept adding an AutoValue field when table exists
Set oKeys = oTable.Keys
Set oPrimaryKey = oKeys.createDataDescriptor()
Set oColumn = oPrimaryKey.Columns.createDataDescriptor()
oColumn.Name = pvFieldName
oColumn.CatalogName = CatalogName
oColumn.SchemaName = SchemaName
oColumn.TableName = TableName
oColumn.IsAutoIncrement = True
oColumn.IsNullable = com.sun.star.sdbc.ColumnValue.NO_NULLS
oPrimaryKey.Columns.appendByDescriptor(oColumn)
oPrimaryKey.Name = Left(&quot;PK_&quot; &amp; Join(Split(TableName, &quot; &quot;), &quot;_&quot;) &amp; &quot;_&quot; &amp; Join(Split(pvFieldName, &quot; &quot;), &quot;_&quot;), cstMaxKeyLength)
oPrimaryKey.Type = com.sun.star.sdbcx.KeyType.PRIMARY
oKeys.appendByDescriptor(oPrimaryKey)
.IsAutoIncrement = True
.IsNullable = com.sun.star.sdbc.ColumnValue.NO_NULLS
oColumn.dispose()
Else
.IsAutoIncrement = False
End If
End With
oTable.Columns.appendByDescriptor(oNewfield.Column)
Set CreateField = oNewField
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
GoTo Exit_Function
Error_NotApplicable:
TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, 1, cstThisSub)
Goto Exit_Function
Error_Sequence:
TraceError(TRACEFATAL, ERRFIELDCREATION, Utils._CalledSub(), 0, 1, pvFieldName)
Goto Exit_Function
Error_NoUpdate:
TraceError(TRACEFATAL, ERRNOTUPDATABLE, Utils._CalledSub(), 0)
Goto Exit_Function
End Function &apos; CreateField V1.1.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Execute(ByVal Optional pvOptions As Variant) As Boolean
&apos;Execute a stored query. The query must be an ACTION query.
Dim cstThisSub As String
cstThisSub = Utils._PCase(_Type) &amp; &quot;.Execute&quot;
Utils._SetCalledSub(cstThisSub)
On Local Error Goto Error_Function
Const cstNull = -1
Execute = False
If _Type &lt;&gt; OBJQUERYDEF Then Goto Trace_Method
If IsMissing(pvOptions) Then
pvOptions = cstNull
Else
If Not Utils._CheckArgument(pvOptions, 1, Utils._AddNumeric(), dbSQLPassThrough) Then Goto Exit_Function
End If
&apos;Check action query
Dim oStatement As Object, vResult As Variant
Dim iType As Integer, sSql As String
iType = pType
If ( (iType And DBQAction) = 0 ) And ( (iType And DBQDDL) = 0 ) Then Goto Trace_Action
&apos;Execute action query
Set oStatement = _ParentDatabase.Connection.createStatement()
sSql = Query.Command
If pvOptions = dbSQLPassThrough Then oStatement.EscapeProcessing = False _
Else oStatement.EscapeProcessing = Query.EscapeProcessing
On Local Error Goto SQL_Error
vResult = oStatement.executeUpdate(_ParentDatabase._ReplaceSquareBrackets(sSql))
On Local Error Goto Error_Function
Execute = True
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Trace_Method:
TraceError(TRACEFATAL, ERRMETHOD, cstThisSub, 0, , cstThisSub)
Goto Exit_Function
Trace_Action:
TraceError(TRACEFATAL, ERRNOTACTIONQUERY, cstThisSub, 0, , _Name)
Goto Exit_Function
SQL_Error:
TraceError(TRACEFATAL, ERRSQLSTATEMENT, Utils._CalledSub(), 0, , sSql)
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
GoTo Exit_Function
End Function &apos; Execute V1.1.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Fields(ByVal Optional pvIndex As Variant) As Object
If _ErrorHandler() Then On Local Error Goto Error_Function
Dim cstThisSub As String
cstThisSub = Utils._PCase(_Type) &amp; &quot;.Fields&quot;
Utils._SetCalledSub(cstThisSub)
Set Fields = Nothing
If Not IsMissing(pvIndex) Then
If Not Utils._CheckArgument(pvIndex, 1, Utils._AddNumeric(vbString)) Then Goto Exit_Function
End If
Dim sObjects() As String, sObjectName As String, oObject As Object
Dim i As Integer, bFound As Boolean, oFields As Object
If _Type = OBJTABLEDEF Then Set oFields = Table.getColumns() Else Set oFields = Query.getColumns()
sObjects = oFields.ElementNames()
Select Case True
Case IsMissing(pvIndex)
Set oObject = New Collect
Set oObject._This = oObject
oObject._CollType = COLLFIELDS
Set oObject._Parent = _This
oObject._Count = UBound(sObjects) + 1
Goto Exit_Function
Case VarType(pvIndex) = vbString
bFound = False
&apos; Check existence of object and find its exact (case-sensitive) name
For i = 0 To UBound(sObjects)
If UCase(pvIndex) = UCase(sObjects(i)) Then
sObjectName = sObjects(i)
bFound = True
Exit For
End If
Next i
If Not bFound Then Goto Trace_NotFound
Case Else &apos; pvIndex is numeric
If pvIndex &lt; 0 Or pvIndex &gt; UBound(sObjects) Then Goto Trace_IndexError
sObjectName = sObjects(pvIndex)
End Select
Set oObject = New Field
Set oObject._This = oObject
oObject._Name = sObjectName
Set oObject.Column = oFields.getByName(sObjectName)
oObject._ParentName = _Name
oObject._ParentType = _Type
Set oObject._ParentDatabase = _ParentDatabase
Exit_Function:
Set Fields = oObject
Set oObject = Nothing
Utils._ResetCalledSub(cstThisSub)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
GoTo Exit_Function
Trace_NotFound:
TraceError(TRACEFATAL, ERROBJECTNOTFOUND, Utils._CalledSub(), 0, , Array(_GetLabel(&quot;FIELD&quot;), pvIndex))
Goto Exit_Function
Trace_IndexError:
TraceError(TRACEFATAL, ERRCOLLECTION, Utils._CalledSub(), 0)
Goto Exit_Function
End Function &apos; Fields
REM -----------------------------------------------------------------------------------------------------------------------
Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
&apos; Return property value of psProperty property name
Dim cstThisSub As String
cstThisSub = Utils._PCase(_Type) &amp; &quot;.getProperty&quot;
Utils._SetCalledSub(cstThisSub)
If IsMissing(pvProperty) Then Call _TraceArguments()
getProperty = _PropertyGet(pvProperty)
Utils._ResetCalledSub(cstThisSub)
End Function &apos; getProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
&apos; Return True if object has a valid property called pvProperty (case-insensitive comparison !)
Dim cstThisSub As String
cstThisSub = Utils._PCase(_Type) &amp; &quot;.hasProperty&quot;
Utils._SetCalledSub(cstThisSub)
If IsMissing(pvProperty) Then hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList()) Else hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList(), pvProperty)
Utils._ResetCalledSub(cstThisSub)
Exit Function
End Function &apos; hasProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function OpenRecordset(ByVal Optional pvType As Variant, ByVal Optional pvOptions As Variant, ByVal Optional pvLockEdit As Variant) As Object
&apos;Return a Recordset object based on current table- or querydef object
Dim cstThisSub As String
cstThisSub = Utils._PCase(_Type) &amp; &quot;.OpenRecordset&quot;
Utils._SetCalledSub(cstThisSub)
Const cstNull = -1
Dim lCommandType As Long, sCommand As String, oObject As Object,bPassThrough As Boolean
Dim iType As Integer, iOptions As Integer, iLockEdit As Integer
Set oObject = Nothing
If VarType(pvType) = vbError Then
iType = cstNull
ElseIf IsMissing(pvType) Then
iType = cstNull
Else
If Not Utils._CheckArgument(pvType, 1, Utils._AddNumeric(), Array(cstNull, dbOpenForwardOnly)) Then Goto Exit_Function
iType = pvType
End If
If VarType(pvOptions) = vbError Then
iOptions = cstNull
ElseIf IsMissing(pvOptions) Then
iOptions = cstNull
Else
If Not Utils._CheckArgument(pvOptions, 2, Utils._AddNumeric(), Array(cstNull, dbSQLPassThrough)) Then Goto Exit_Function
iOptions = pvOptions
End If
If VarType(pvLockEdit) = vbError Then
iLockEdit = cstNull
ElseIf IsMissing(pvLockEdit) Then
iLockEdit = cstNull
Else
If Not Utils._CheckArgument(pvLockEdit, 3, Utils._AddNumeric(), Array(cstNull, dbReadOnly)) Then Goto Exit_Function
iLockEdit = pvLockEdit
End If
Select Case _Type
Case OBJTABLEDEF
lCommandType = com.sun.star.sdb.CommandType.TABLE
sCommand = _Name
Case OBJQUERYDEF
lCommandType = com.sun.star.sdb.CommandType.QUERY
sCommand = _Name
If iOptions = dbSQLPassThrough Then bPassThrough = True Else bPassThrough = Not Query.EscapeProcessing
End Select
Set oObject = New Recordset
With oObject
._CommandType = lCommandType
._Command = sCommand
._ParentName = _Name
._ParentType = _Type
._ForwardOnly = ( iType = dbOpenForwardOnly )
._PassThrough = bPassThrough
._ReadOnly = ( (iLockEdit = dbReadOnly) Or _ReadOnly )
Set ._ParentDatabase = _ParentDatabase
Set ._This = oObject
Call ._Initialize()
End With
With _ParentDatabase
.RecordsetMax = .RecordsetMax + 1
oObject._Name = Format(.RecordsetMax, &quot;0000000&quot;)
.RecordsetsColl.Add(oObject, UCase(oObject._Name))
End With
If Not ( oObject._BOF And oObject._EOF ) Then oObject.MoveFirst() &apos; Do nothing if resultset empty
Exit_Function:
Set OpenRecordset = oObject
Set oObject = Nothing
Utils._ResetCalledSub(cstThisSub)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
Set oObject = Nothing
GoTo Exit_Function
End Function &apos; OpenRecordset V1.1.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
&apos; Return
&apos; a Collection object if pvIndex absent
&apos; a Property object otherwise
Dim vProperty As Variant, vPropertiesList() As Variant, sObject As String
Dim cstThisSub As String
cstThisSub = Utils._PCase(_Type) &amp; &quot;.Properties&quot;
Utils._SetCalledSub(cstThisSub)
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
Set vProperty._ParentDatabase = _ParentDatabase
Exit_Function:
Set Properties = vProperty
Utils._ResetCalledSub(cstThisSub)
Exit Function
End Function &apos; Properties
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setProperty(ByVal Optional psProperty As String, ByVal Optional pvValue As Variant) As Boolean
&apos; Return True if property setting OK
Dim cstThisSub As String
cstThisSub = Utils._PCase(_Type) &amp; &quot;.setProperty&quot;
Utils._SetCalledSub(cstThisSub)
setProperty = _PropertySet(psProperty, pvValue)
Utils._ResetCalledSub(cstThisSub)
End Function
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertiesList() As Variant
Select Case _Type
Case OBJTABLEDEF
_PropertiesList = Array(&quot;Name&quot;, &quot;ObjectType&quot;)
Case OBJQUERYDEF
_PropertiesList = Array(&quot;Name&quot;, &quot;ObjectType&quot;, &quot;SQL&quot;, &quot;Type&quot;)
Case Else
End Select
End Function &apos; _PropertiesList
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertyGet(ByVal psProperty As String) As Variant
&apos; Return property value of the psProperty property name
If _ErrorHandler() Then On Local Error Goto Error_Function
Dim cstThisSub As String
cstThisSub = Utils._PCase(_Type)
Utils._SetCalledSub(cstThisSub &amp; &quot;.get&quot; &amp; psProperty)
Dim sSql As String, sVerb As String, iType As Integer
_PropertyGet = EMPTY
If Not hasProperty(psProperty) Then Goto Trace_Error
Select Case UCase(psProperty)
Case UCase(&quot;Name&quot;)
_PropertyGet = _Name
Case UCase(&quot;ObjectType&quot;)
_PropertyGet = _Type
Case UCase(&quot;SQL&quot;)
_PropertyGet = Query.Command
Case UCase(&quot;Type&quot;)
iType = 0
sSql = Utils._Trim(UCase(Query.Command))
sVerb = Split(sSql, &quot; &quot;)(0)
If sVerb = &quot;SELECT&quot; Then iType = iType + dbQSelect
If sVerb = &quot;SELECT&quot; And InStr(sSql, &quot; INTO &quot;) &gt; 0 _
Or sVerb = &quot;CREATE&quot; And InStr(sSql, &quot; TABLE &quot;) &gt; 0 _
Then iType = iType + dbQMakeTable
If sVerb = &quot;SELECT&quot; And InStr(sSql, &quot; UNION &quot;) &gt; 0 Then iType = iType + dbQSetOperation
If Not Query.EscapeProcessing Then iType = iType + dbQSQLPassThrough
If sVerb = &quot;INSERT&quot; Then iType = iType + dbQAppend
If sVerb = &quot;DELETE&quot; Then iType = iType + dbQDelete
If sVerb = &quot;UPDATE&quot; Then iType = iType + dbQUpdate
If sVerb = &quot;CREATE&quot; _
Or sVerb = &quot;ALTER&quot; _
Or sVerb = &quot;DROP&quot; _
Or sVerb = &quot;RENAME&quot; _
Or sVerb = &quot;TRUNCATE&quot; _
Then iType = iType + dbQDDL
&apos; dbQAction implied by dbQMakeTable, dbQAppend, dbQDelete and dbQUpdate
&apos; To check Type use: If (iType And dbQxxx) &lt;&gt; 0 Then ...
_PropertyGet = iType
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(cstThisSub &amp; &quot;.get&quot; &amp; psProperty)
Exit Function
Trace_Error:
TraceError(TRACEWARNING, ERRPROPERTY, Utils._CalledSub(), 0, , psProperty)
_PropertyGet = EMPTY
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub &amp; &quot;._PropertyGet&quot;, Erl)
_PropertyGet = EMPTY
GoTo Exit_Function
End Function &apos; _PropertyGet
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Variant) As Boolean
&apos; Return True if property setting OK
If _ErrorHandler() Then On Local Error Goto Error_Function
Dim cstThisSub As String
cstThisSub = Utils._PCase(_Type)
Utils._SetCalledSub(cstThisSub &amp; &quot;.set&quot; &amp; psProperty)
&apos;Execute
Dim iArgNr As Integer
_PropertySet = True
Select Case UCase(_A2B_.CalledSub)
Case UCase(&quot;setProperty&quot;) : iArgNr = 3
Case UCase(cstThisSub &amp; &quot;.setProperty&quot;) : iArgNr = 2
Case UCase(cstThisSub &amp; &quot;.set&quot; &amp; psProperty) : iArgNr = 1
End Select
If Not hasProperty(psProperty) Then Goto Trace_Error
If _ReadOnly Then Goto Error_NoUpdate
Select Case UCase(psProperty)
Case UCase(&quot;SQL&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
Query.Command = pvValue
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(cstThisSub &amp; &quot;.set&quot; &amp; psProperty)
Exit Function
Trace_Error:
TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, , psProperty)
_PropertySet = False
Goto Exit_Function
Trace_Error_Value:
TraceError(TRACEFATAL, ERRPROPERTYVALUE, Utils._CalledSub(), 0, 1, Array(pvValue, psProperty))
_PropertySet = False
Goto Exit_Function
Error_NoUpdate:
TraceError(TRACEFATAL, ERRNOTUPDATABLE, Utils._CalledSub(), 0)
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub &amp; &quot;._PropertySet&quot;, Erl)
_PropertySet = False
GoTo Exit_Function
End Function &apos; _PropertySet
</script:module>

View File

@@ -0,0 +1,818 @@
<?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="Dialog" 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 &apos; Must be DIALOG
Private _This As Object &apos; Workaround for absence of This builtin function
Private _Parent As Object
Private _Name As String
Private _Shortcut As String
Private _Dialog As Object &apos; com.sun.star.io.XInputStreamProvider
Private _Storage As String &apos; GLOBAL or DOCUMENT
Private _Library As String
Private UnoDialog As Object &apos; com.sun.star.awt.XControl
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CONSTRUCTORS / DESTRUCTORS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJDIALOG
Set _This = Nothing
Set _Parent = Nothing
_Name = &quot;&quot;
Set _Dialog = Nothing
_Storage = &quot;&quot;
_Library = &quot;&quot;
Set UnoDialog = Nothing
End Sub &apos; Constructor
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Terminate()
On Local Error Resume Next
Call Class_Initialize()
End Sub &apos; Destructor
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub Dispose()
Call Class_Terminate()
End Sub &apos; Explicit destructor
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS GET/LET/SET PROPERTIES ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Caption() As Variant
Caption = _PropertyGet(&quot;Caption&quot;)
End Property &apos; Caption (get)
Property Let Caption(ByVal pvValue As Variant)
Call _PropertySet(&quot;Caption&quot;, pvValue)
End Property &apos; Caption (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Height() As Variant
Height = _PropertyGet(&quot;Height&quot;)
End Property &apos; Height (get)
Property Let Height(ByVal pvValue As Variant)
Call _PropertySet(&quot;Height&quot;, pvValue)
End Property &apos; Height (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get IsLoaded() As Boolean
IsLoaded = _PropertyGet(&quot;IsLoaded&quot;)
End Property
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Name() As String
Name = _PropertyGet(&quot;Name&quot;)
End Property &apos; Name (get)
Public Function pName() As String &apos; For compatibility with &lt; V0.9.0
pName = _PropertyGet(&quot;Name&quot;)
End Function &apos; pName (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ObjectType() As String
ObjectType = _PropertyGet(&quot;ObjectType&quot;)
End Property &apos; ObjectType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnFocusGained() As Variant
OnFocusGained = _PropertyGet(&quot;OnFocusGained&quot;)
End Property &apos; OnFocusGained (get)
Property Let OnFocusGained(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnFocusGained&quot;, pvValue)
End Property &apos; OnFocusGained (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnFocusLost() As Variant
OnFocusLost = _PropertyGet(&quot;OnFocusLost&quot;)
End Property &apos; OnFocusLost (get)
Property Let OnFocusLost(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnFocusLost&quot;, pvValue)
End Property &apos; OnFocusLost (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnKeyPressed() As Variant
OnKeyPressed = _PropertyGet(&quot;OnKeyPressed&quot;)
End Property &apos; OnKeyPressed (get)
Property Let OnKeyPressed(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnKeyPressed&quot;, pvValue)
End Property &apos; OnKeyPressed (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnKeyReleased() As Variant
OnKeyReleased = _PropertyGet(&quot;OnKeyReleased&quot;)
End Property &apos; OnKeyReleased (get)
Property Let OnKeyReleased(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnKeyReleased&quot;, pvValue)
End Property &apos; OnKeyReleased (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnMouseDragged() As Variant
OnMouseDragged = _PropertyGet(&quot;OnMouseDragged&quot;)
End Property &apos; OnMouseDragged (get)
Property Let OnMouseDragged(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnMouseDragged&quot;, pvValue)
End Property &apos; OnMouseDragged (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnMouseEntered() As Variant
OnMouseEntered = _PropertyGet(&quot;OnMouseEntered&quot;)
End Property &apos; OnMouseEntered (get)
Property Let OnMouseEntered(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnMouseEntered&quot;, pvValue)
End Property &apos; OnMouseEntered (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnMouseExited() As Variant
OnMouseExited = _PropertyGet(&quot;OnMouseExited&quot;)
End Property &apos; OnMouseExited (get)
Property Let OnMouseExited(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnMouseExited&quot;, pvValue)
End Property &apos; OnMouseExited (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnMouseMoved() As Variant
OnMouseMoved = _PropertyGet(&quot;OnMouseMoved&quot;)
End Property &apos; OnMouseMoved (get)
Property Let OnMouseMoved(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnMouseMoved&quot;, pvValue)
End Property &apos; OnMouseMoved (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnMousePressed() As Variant
OnMousePressed = _PropertyGet(&quot;OnMousePressed&quot;)
End Property &apos; OnMousePressed (get)
Property Let OnMousePressed(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnMousePressed&quot;, pvValue)
End Property &apos; OnMousePressed (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnMouseReleased() As Variant
OnMouseReleased = _PropertyGet(&quot;OnMouseReleased&quot;)
End Property &apos; OnMouseReleased (get)
Property Let OnMouseReleased(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnMouseReleased&quot;, pvValue)
End Property &apos; OnMouseReleased (set)
REM -----------------------------------------------------------------------------------------------------------------------
Public Function OptionGroup(ByVal Optional pvGroupName As Variant) As Variant
&apos; Return either an error or an object of type OPTIONGROUP based on its name
&apos; A group is determined by the successive TabIndexes of the radio button
&apos; The name of the group = the name of its first element
Utils._SetCalledSub(&quot;Dialog.OptionGroup&quot;)
If IsMissing(pvGroupName) Then Call _TraceArguments()
If _ErrorHandler() Then On Local Error Goto Error_Function
Set OptionGroup = Nothing
If Not Utils._CheckArgument(pvGroupName, 1, vbString) Then Goto Exit_Function
Dim iAllCount As Integer, iRadioLast As Integer, iGroupCount As Integer, iBegin As Integer, iEnd As Integer
Dim oRadios() As Object, sGroupName As String
Dim i As Integer, j As Integer, bFound As Boolean, ocControl As Object, oRadio As Object, iTabIndex As Integer
Dim ogGroup As Object, vGroup() As Variant, vIndex() As Variant
iAllCount = Controls.Count
If iAllCount &gt; 0 Then
iRadioLast = -1
ReDim oRadios(0 To iAllCount - 1)
For i = 0 To iAllCount - 1 &apos; Store all RadioButtons objects
Set ocControl = Controls(i)
If ocControl._SubType = CTLRADIOBUTTON Then
iRadioLast = iRadioLast + 1
Set oRadios(iRadioLast) = ocControl
End If
Next i
Else
Goto Error_Arg &apos; No control in dialog
End If
If iRadioLast &lt; 0 then Goto Error_Arg &apos; No radio buttons in the dialog
&apos;Resort oRadio array based on tab indexes
If iRadioLast &gt; 0 Then
For i = 0 To iRadioLast - 1 &apos; Bubble sort
For j = i + 1 To iRadioLast
If oRadios(i).TabIndex &gt; oRadios(j).TabIndex Then
Set oRadio = oRadios(i)
Set oRadios(i) = oRadios(j)
Set oRadios(j) = oRadio
End If
Next j
Next i
End If
&apos;Scan Names to find match with argument
bFound = False
For i = 0 To iRadioLast
If UCase(oRadios(i)._Name) = UCase(pvGroupName) Then
Select Case i
Case 0 : bFound = True
Case Else
If oRadios(i).TabIndex &gt; oRadios(i - 1).TabIndex + 1 Then
bFound = True
Else
Goto Error_Arg &apos; same group as preceding item although name correct
End If
End Select
If bFound Then
iBegin = i
iEnd = i
sGroupName = oRadios(i)._Name
End If
ElseIf bFound Then
If oRadios(i).TabIndex = oRadios(i - 1).TabIndex + 1 Then iEnd = i
End If
Next i
If bFound Then &apos; Create OptionGroup
iGroupCount = iEnd - iBegin + 1
Set ogGroup = New OptionGroup
ReDim vGroup(0 To iGroupCount - 1)
ReDim vIndex(0 To iGroupCount - 1)
With ogGroup
._This = ogGroup
._Name = sGroupName
._Count = iGroupCount
._ButtonsGroup = vGroup
._ButtonsIndex = vIndex
For i = 0 To iGroupCount - 1
Set ._ButtonsGroup(i) = oRadios(iBegin + i).ControlModel
._ButtonsIndex(i) = i
Next i
._ParentType = CTLPARENTISDIALOG
._ParentComponent = UnoDialog
End With
Else Goto Error_Arg
End If
Set OptionGroup = ogGroup
Exit_Function:
Utils._ResetCalledSub(&quot;Dialog.OptionGroup&quot;)
Exit Function
Error_Arg:
TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), 0, , Array(1, pvGroupName))
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;Dialog.OptionGroup&quot;, Erl)
GoTo Exit_Function
End Function &apos; OptionGroup V0.9.1
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Page() As Variant
Page = _PropertyGet(&quot;Page&quot;)
End Property &apos; Page (get)
Property Let Page(ByVal pvValue As Variant)
Call _PropertySet(&quot;Page&quot;, pvValue)
End Property &apos; Page (set)
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Parent() As Object
Parent = _Parent
End Function &apos; Parent (get) V6.4.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
&apos; Return
&apos; a Collection object if pvIndex absent
&apos; a Property object otherwise
Const cstThisSub = &quot;Dialog.Properties&quot;
Utils._SetCalledSub(cstThisSub)
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(cstThisSub)
Exit Function
End Function &apos; Properties
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Visible() As Variant
Visible = _PropertyGet(&quot;Visible&quot;)
End Property &apos; Visible (get)
Property Let Visible(ByVal pvValue As Variant)
Call _PropertySet(&quot;Visible&quot;, pvValue)
End Property &apos; Visible (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Width() As Variant
Width = _PropertyGet(&quot;Width&quot;)
End Property &apos; Width (get)
Property Let Width(ByVal pvValue As Variant)
Call _PropertySet(&quot;Width&quot;, pvValue)
End Property &apos; Width (set)
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS METHODS ---
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Controls(Optional ByVal pvIndex As Variant) As Variant
&apos; Return a Control object with name or index = pvIndex
If _ErrorHandler() Then On Local Error Goto Error_Function
Utils._SetCalledSub(&quot;Dialog.Controls&quot;)
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
Set ocControl = Nothing
If Not IsLoaded Then Goto Trace_Error_NotOpen
Set ocControl = New Control
Set ocControl._This = ocControl
Set ocControl._Parent = _This
ocControl._ParentType = CTLPARENTISDIALOG
sParentShortcut = _Shortcut
sControls() = UnoDialog.Model.getElementNames()
iControlCount = UBound(sControls) + 1
If IsMissing(pvIndex) Then &apos; No argument, return Collection object
Set oCounter = New Collect
Set oCounter._This = oCounter
oCounter._CollType = COLLCONTROLS
oCounter._Count = iControlCount
Set oCounter._Parent = _This
Set Controls = oCounter
Goto Exit_Function
End If
If Not Utils._CheckArgument(pvIndex, 1, Utils._AddNumeric(vbString)) Then Goto Exit_Function
&apos; Start building the ocControl object
&apos; Determine exact name
Select Case VarType(pvIndex)
Case vbInteger, vbLong, vbSingle, vbDouble, vbCurrency, vbBigint, vbDecimal
If pvIndex &lt; 0 Or pvIndex &gt; iControlCount - 1 Then Goto Trace_Error_Index
ocControl._Name = sControls(pvIndex)
Case vbString &apos; 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
ocControl._Shortcut = sParentShortcut &amp; &quot;!&quot; &amp; Utils._Surround(ocControl._Name)
Set ocControl.ControlModel = UnoDialog.Model.getByName(ocControl._Name)
Set ocControl.ControlView = UnoDialog.getControl(ocControl._Name)
ocControl._ImplementationName = ocControl.ControlModel.getImplementationName()
ocControl._FormComponent = UnoDialog
ocControl._Initialize()
Set Controls = ocControl
Exit_Function:
Utils._ResetCalledSub(&quot;Dialog.Controls&quot;)
Exit Function
Trace_Error:
TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), 0, , Array(iArg, pvIndex))
Set Controls = Nothing
Goto Exit_Function
Trace_Error_NotOpen:
TraceError(TRACEFATAL, ERRDIALOGNOTSTARTED, Utils._CalledSub(), 0, , _Name)
Set Controls = Nothing
Goto 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, pvIndex))
Set Controls = Nothing
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;Dialog.Controls&quot;, Erl)
Set Controls = Nothing
GoTo Exit_Function
End Function &apos; Controls
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub EndExecute(ByVal Optional pvReturn As Variant)
&apos; Stop executing the dialog
If _ErrorHandler() Then On Local Error Goto Error_Sub
Utils._SetCalledSub(&quot;Dialog.endExecute&quot;)
If IsMissing(pvReturn) Then pvReturn = 0
If Not Utils._CheckArgument(pvReturn, 1, Utils._AddNumeric(), , False) Then Goto Trace_Error
Dim lExecute As Long
lExecute = CLng(pvReturn)
If IsNull(_Dialog) Then Goto Error_Execute
If IsNull(UnoDialog) Then Goto Error_Not_Started
Call UnoDialog.endDialog(lExecute)
Exit_Sub:
Utils._ResetCalledSub(&quot;Dialog.endExecute&quot;)
Exit Sub
Trace_Error:
TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), 0, , Array(&quot;1&quot;, Utils._CStr(pvReturn)))
Goto Exit_Sub
Error_Execute:
TraceError(TRACEFATAL, ERRDIALOGUNDEFINED, Utils._CalledSub(), 0)
Goto Exit_Sub
Error_Not_Started:
TraceError(TRACEWARNING, ERRDIALOGNOTSTARTED, Utils._CalledSub(), 0, 1, _Name)
Goto Exit_Sub
Error_Sub:
TraceError(TRACEABORT, Err, &quot;Dialog.endExecute&quot;, Erl)
GoTo Exit_Sub
End Sub &apos; EndExecute
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Execute() As Long
&apos; Execute dialog
&apos;If _ErrorHandler() Then On Local Error Goto Error_Function
&apos;Seems smart not to trap errors: debugging of dialog events otherwise made very difficult !
Utils._SetCalledSub(&quot;Dialog.Execute&quot;)
Dim lExecute As Long
If IsNull(_Dialog) Then Goto Error_Execute
If IsNull(UnoDialog) Then Goto Error_Not_Started
lExecute = UnoDialog.execute()
Select Case lExecute
Case 1 : Execute = dlgOK
Case 0 : Execute = dlgCancel
Case Else : Execute = lExecute
End Select
Exit_Function:
Utils._ResetCalledSub(&quot;Dialog.Execute&quot;)
Exit Function
Error_Execute:
TraceError(TRACEFATAL, ERRDIALOGUNDEFINED, Utils._CalledSub(), 0)
Goto Exit_Function
Error_Not_Started:
TraceError(TRACEWARNING, ERRDIALOGNOTSTARTED, Utils._CalledSub(), 0, 1, _Name)
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;Dialog.Execute&quot;, Erl)
GoTo Exit_Function
End Function &apos; Execute
REM -----------------------------------------------------------------------------------------------------------------------
Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
&apos; Return property value of psProperty property name
Utils._SetCalledSub(&quot;Dialog.getProperty&quot;)
If IsMissing(pvProperty) Then Call _TraceArguments()
getProperty = _PropertyGet(pvProperty)
Utils._ResetCalledSub(&quot;Dialog.getProperty&quot;)
End Function &apos; getProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
&apos; 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 &apos; hasProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Move( ByVal Optional pvLeft As Variant _
, ByVal Optional pvTop As Variant _
, ByVal Optional pvWidth As Variant _
, ByVal Optional pvHeight As Variant _
) As Variant
&apos; Execute Move method
Utils._SetCalledSub(&quot;Dialog.Move&quot;)
On Local Error Goto Error_Function
Move = False
Dim iArgNr As Integer
Select Case UCase(_A2B_.CalledSub)
Case UCase(&quot;Move&quot;) : iArgNr = 1
Case UCase(&quot;Dialog.Move&quot;) : iArgNr = 0
End Select
If IsMissing(pvLeft) Then pvLeft = -1
If IsMissing(pvTop) Then pvTop = -1
If IsMissing(pvWidth) Then pvWidth = -1
If IsMissing(pvHeight) Then pvHeight = -1
If Not Utils._CheckArgument(pvLeft, iArgNr + 1, Utils._AddNumeric()) Then Goto Exit_Function
If Not Utils._CheckArgument(pvTop, iArgNr + 2, Utils._AddNumeric()) Then Goto Exit_Function
If Not Utils._CheckArgument(pvWidth, iArgNr + 3, Utils._AddNumeric()) Then Goto Exit_Function
If Not Utils._CheckArgument(pvHeight, iArgNr + 4, Utils._AddNumeric()) Then Goto Exit_Function
Dim iArg As Integer, iWrong As Integer &apos; Check arguments values
iArg = 0
If pvHeight &lt; -1 Then
iArg = 4 : iWrong = pvHeight
ElseIf pvWidth &lt; -1 Then
iArg = 3 : iWrong = pvWidth
ElseIf pvTop &lt; -1 Then
iArg = 2 : iWrong = pvTop
ElseIf pvLeft &lt; -1 Then
iArg = 1 : iWrong = pvLeft
End If
If iArg &gt; 0 Then
TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), 0, 1, Array(iArgNr + iArg, iWrong))
Goto Exit_Function
End If
Dim iPosSize As Integer
iPosSize = 0
If pvLeft &gt;= 0 Then iPosSize = iPosSize + com.sun.star.awt.PosSize.X
If pvTop &gt;= 0 Then iPosSize = iPosSize + com.sun.star.awt.PosSize.Y
If pvWidth &gt; 0 Then iPosSize = iPosSize + com.sun.star.awt.PosSize.WIDTH
If pvHeight &gt; 0 Then iPosSize = iPosSize + com.sun.star.awt.PosSize.HEIGHT
If iPosSize &gt; 0 Then UnoDialog.setPosSize(pvLeft, pvTop, pvWidth, pvHeight, iPosSize)
Move = True
Exit_Function:
Utils._ResetCalledSub(&quot;Dialog.Move&quot;)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;Dialog.Move&quot;, Erl)
GoTo Exit_Function
End Function &apos; Move
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setProperty(ByVal Optional psProperty As String, ByVal Optional pvValue As Variant) As Boolean
&apos; Return True if property setting OK
Utils._SetCalledSub(&quot;Dialog.setProperty&quot;)
setProperty = _PropertySet(psProperty, pvValue)
Utils._ResetCalledSub(&quot;Dialog.setProperty&quot;)
End Function
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Start() As Boolean
&apos; Create dialog
If _ErrorHandler() Then On Local Error Goto Error_Function
Utils._SetCalledSub(&quot;Dialog.Start&quot;)
Dim oStart As Object
Start = False
If IsNull(_Dialog) Then Goto Error_Start
If Not IsNull(UnoDialog) Then Goto Error_Yet_Started
Set oStart = CreateUnoDialog(_Dialog)
If IsNull(oStart) Then
Goto Error_Start
Else
Start = True
Set UnoDialog = oStart
With _A2B_
If .hasItem(COLLALLDIALOGS, _Name) Then .Dialogs.Remove(_Name) &apos; Inserted to solve errors, when aborts between start and terminate
.Dialogs.Add(UnoDialog, UCase(_Name))
End With
End If
Exit_Function:
Utils._ResetCalledSub(&quot;Dialog.Start&quot;)
Exit Function
Error_Start:
TraceError(TRACEFATAL, ERRDIALOGUNDEFINED, Utils._CalledSub(), 0)
Goto Exit_Function
Error_Yet_Started:
TraceError(TRACEWARNING, ERRDIALOGSTARTED, Utils._CalledSub(), 0)
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;Dialog.Start&quot;, Erl)
GoTo Exit_Function
End Function &apos; Start
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Terminate() As Boolean
&apos; Close dialog
If _ErrorHandler() Then On Local Error Goto Error_Function
Utils._SetCalledSub(&quot;Dialog.Terminate&quot;)
Terminate = False
If IsNull(_Dialog) Then Goto Error_Terminate
If IsNull(UnoDialog) Then Goto Error_Not_Started
UnoDialog.Dispose()
Set UnoDialog = Nothing
_A2B_.Dialogs.Remove(_Name)
Terminate = True
Exit_Function:
Utils._ResetCalledSub(&quot;Dialog.Terminate&quot;)
Exit Function
Error_Terminate:
TraceError(TRACEFATAL, ERRDIALOGUNDEFINED, Utils._CalledSub(), 0)
Goto Exit_Function
Error_Not_Started:
TraceError(TRACEWARNING, ERRDIALOGNOTSTARTED, Utils._CalledSub(), 0, 1, _Name)
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;Dialog.Terminate&quot;, Erl)
GoTo Exit_Function
End Function &apos; Terminate
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _GetListener(ByVal psProperty As String) As String
&apos; Return the X...Listener corresponding with the property in argument
Select Case UCase(psProperty)
Case UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;)
_GetListener = &quot;XFocusListener&quot;
Case UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;)
_GetListener = &quot;XKeyListener&quot;
Case UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseMoved&quot;)
_GetListener = &quot;XMouseMotionListener&quot;
Case UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;)
_GetListener = &quot;XMouseListener&quot;
End Select
End Function &apos; _GetListener V1.7.0
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertiesList() As Variant
If IsLoaded Then
_PropertiesList = Array(&quot;Caption&quot;, &quot;Height&quot;, &quot;IsLoaded&quot;, &quot;Name&quot; _
, &quot;OnFocusGained&quot;, &quot;OnFocusLost&quot;, &quot;OnKeyPressed&quot;, &quot;OnKeyReleased&quot;, &quot;OnMouseDragged&quot; _
, &quot;OnMouseEntered&quot;, &quot;OnMouseExited&quot;, &quot;OnMouseMoved&quot;, &quot;OnMousePressed&quot;, &quot;OnMouseReleased&quot; _
, &quot;ObjectType&quot;, &quot;Page&quot;, &quot;Visible&quot;, &quot;Width&quot; _
)
Else
_PropertiesList = Array(&quot;IsLoaded&quot;, &quot;Name&quot; _
)
End If
End Function &apos; _PropertiesList
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertyGet(ByVal psProperty As String) As Variant
&apos; Return property value of the psProperty property name
If _ErrorHandler() Then On Local Error Goto Error_Function
Utils._SetCalledSub(&quot;Dialog.get&quot; &amp; psProperty)
Dim oDialogEvents As Object, sEventName As String
&apos;Execute
_PropertyGet = EMPTY
Select Case UCase(psProperty)
Case UCase(&quot;Name&quot;), UCase(&quot;IsLoaded&quot;)
Case Else
If IsNull(UnoDialog) Then Goto Trace_Error_Dialog
End Select
Select Case UCase(psProperty)
Case UCase(&quot;Caption&quot;)
_PropertyGet = UnoDialog.getTitle()
Case UCase(&quot;Height&quot;)
_PropertyGet = UnoDialog.getPosSize().Height
Case UCase(&quot;IsLoaded&quot;)
_PropertyGet = _A2B_.hasItem(COLLALLDIALOGS, _Name)
Case UCase(&quot;Name&quot;)
_PropertyGet = _Name
Case UCase(&quot;ObjectType&quot;)
_PropertyGet = _Type
Case UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;), UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;) _
, UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMouseMoved&quot;) _
, UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;)
Set oDialogEvents = unoDialog.Model.getEvents()
sEventName = &quot;com.sun.star.awt.&quot; &amp; _GetListener(psProperty) &amp; &quot;::&quot; &amp; Utils._GetEventName(psProperty)
If oDialogEvents.hasByName(sEventName) Then
_PropertyGet = oDialogEvents.getByName(sEventName).ScriptCode
Else
_PropertyGet = &quot;&quot;
End If
Case UCase(&quot;Page&quot;)
_PropertyGet = UnoDialog.Model.Step
Case UCase(&quot;Visible&quot;)
_PropertyGet = UnoDialog.IsVisible()
Case UCase(&quot;Width&quot;)
_PropertyGet = UnoDialog.getPosSize().Width
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(&quot;Dialog.get&quot; &amp; psProperty)
Exit Function
Trace_Error:
TraceError(TRACEWARNING, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
_PropertyGet = EMPTY
Goto Exit_Function
Trace_Error_Dialog:
TraceError(TRACEFATAL, ERRDIALOGNOTSTARTED, Utils._CalledSub(), 0, 1, _Name)
_PropertyGet = EMPTY
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;Dialog._PropertyGet&quot;, Erl)
_PropertyGet = EMPTY
GoTo Exit_Function
End Function &apos; _PropertyGet
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Variant) As Boolean
Utils._SetCalledSub(&quot;Dialog.set&quot; &amp; psProperty)
If _ErrorHandler() Then On Local Error Goto Error_Function
_PropertySet = True
Dim oDialogEvents As Object, sEventName As String, oEvent As Object, sListener As String, sEvent As String
&apos;Execute
Dim iArgNr As Integer
If _IsLeft(_A2B_.CalledSub, &quot;Dialog.&quot;) Then iArgNr = 1 Else iArgNr = 2
If IsNull(UnoDialog) Then Goto Trace_Error_Dialog
Select Case UCase(psProperty)
Case UCase(&quot;Caption&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
UnoDialog.setTitle(pvValue)
Case UCase(&quot;Height&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
UnoDialog.setPosSize(0, 0, 0, pvValue, com.sun.star.awt.PosSize.HEIGHT)
Case UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;), UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;) _
, UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMouseMoved&quot;) _
, UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
If Not Utils._RegisterDialogEventScript(UnoDialog.Model _
, psProperty _
, _GetListener(psProperty) _
, pvValue _
) Then GoTo Trace_Error_Dialog
Case UCase(&quot;Page&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
If pvValue &lt; 0 Then Goto Trace_Error_Value
UnoDialog.Model.Step = pvValue
Case UCase(&quot;Visible&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
UnoDialog.setVisible(pvValue)
Case UCase(&quot;Width&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric()) Then Goto Trace_Error_Value
UnoDialog.setPosSize(0, 0, pvValue, 0, com.sun.star.awt.PosSize.WIDTH)
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(&quot;Dialog.set&quot; &amp; psProperty)
Exit Function
Trace_Error_Dialog:
TraceError(TRACEFATAL, ERRDIALOGNOTSTARTED, Utils._CalledSub(), 0, 1, _Name)
_PropertySet = False
Goto Exit_Function
Trace_Error:
TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
_PropertySet = False
Goto Exit_Function
Trace_Error_Value:
TraceError(TRACEFATAL, ERRPROPERTYVALUE, Utils._CalledSub(), 0, 1, Array(pvValue, psProperty))
_PropertySet = False
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;Dialog._PropertySet&quot;, Erl)
_PropertySet = False
GoTo Exit_Function
End Function &apos; _PropertySet
</script:module>

View File

@@ -0,0 +1,493 @@
<?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="Event" 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 &apos; Must be EVENT
Private _EventSource As Object
Private _EventType As String
Private _EventName As String
Private _SubComponentName As String
Private _SubComponentType As Long
Private _ContextShortcut As String
Private _ButtonLeft As Boolean &apos; com.sun.star.awt.MouseButton.XXX
Private _ButtonRight As Boolean
Private _ButtonMiddle As Boolean
Private _XPos As Variant &apos; Null or Long
Private _YPos As Variant &apos; Null or Long
Private _ClickCount As Long
Private _KeyCode As Integer &apos; com.sun.star.awt.Key.XXX
Private _KeyChar As String
Private _KeyFunction As Integer &apos; com.sun.star.awt.KeyFunction.XXX
Private _KeyAlt As Boolean
Private _KeyCtrl As Boolean
Private _KeyShift As Boolean
Private _FocusChangeTemporary As Boolean &apos; False if user action in same window
Private _RowChangeAction As Long &apos; com.sun.star.sdb.RowChangeAction.XXX
Private _Recommendation As String &apos; &quot;IGNORE&quot; or &quot;&quot;
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CONSTRUCTORS / DESTRUCTORS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJEVENT
_EventSource = Nothing
_EventType = &quot;&quot;
_EventName = &quot;&quot;
_SubComponentName = &quot;&quot;
_SubComponentType = -1
_ContextShortcut = &quot;&quot;
_ButtonLeft = False &apos; See com.sun.star.awt.MouseButton.XXX
_ButtonRight = False
_ButtonMiddle = False
_XPos = Null
_YPos = Null
_ClickCount = 0
_KeyCode = 0
_KeyChar = &quot;&quot;
_KeyFunction = com.sun.star.awt.KeyFunction.DONTKNOW
_KeyAlt = False
_KeyCtrl = False
_KeyShift = False
_FocusChangeTemporary = False
_RowChangeAction = 0
_Recommendation = &quot;&quot;
End Sub &apos; Constructor
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Terminate()
On Local Error Resume Next
Call Class_Initialize()
End Sub &apos; Destructor
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub Dispose()
Call Class_Terminate()
End Sub &apos; Explicit destructor
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS GET/LET/SET PROPERTIES ---
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ButtonLeft() As Variant
ButtonLeft = _PropertyGet(&quot;ButtonLeft&quot;)
End Property &apos; ButtonLeft (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ButtonMiddle() As Variant
ButtonMiddle = _PropertyGet(&quot;ButtonMiddle&quot;)
End Property &apos; ButtonMiddle (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ButtonRight() As Variant
ButtonRight = _PropertyGet(&quot;ButtonRight&quot;)
End Property &apos; ButtonRight (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ClickCount() As Variant
ClickCount = _PropertyGet(&quot;ClickCount&quot;)
End Property &apos; ClickCount (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ContextShortcut() As Variant
ContextShortcut = _PropertyGet(&quot;ContextShortcut&quot;)
End Property &apos; ContextShortcut (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get EventName() As Variant
EventName = _PropertyGet(&quot;EventName&quot;)
End Property &apos; EventName (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get EventSource() As Variant
EventSource = _PropertyGet(&quot;EventSource&quot;)
End Property &apos; EventSource (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get EventType() As Variant
EventType = _PropertyGet(&quot;EventType&quot;)
End Property &apos; EventType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get FocusChangeTemporary() As Variant
FocusChangeTemporary = _PropertyGet(&quot;FocusChangeTemporary&quot;)
End Property &apos; FocusChangeTemporary (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get KeyAlt() As Variant
KeyAlt = _PropertyGet(&quot;KeyAlt&quot;)
End Property &apos; KeyAlt (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get KeyChar() As Variant
KeyChar = _PropertyGet(&quot;KeyChar&quot;)
End Property &apos; KeyChar (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get KeyCode() As Variant
KeyCode = _PropertyGet(&quot;KeyCode&quot;)
End Property &apos; KeyCode (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get KeyCtrl() As Variant
KeyCtrl = _PropertyGet(&quot;KeyCtrl&quot;)
End Property &apos; KeyCtrl (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get KeyFunction() As Variant
KeyFunction = _PropertyGet(&quot;KeyFunction&quot;)
End Property &apos; KeyFunction (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get KeyShift() As Variant
KeyShift = _PropertyGet(&quot;KeyShift&quot;)
End Property &apos; KeyShift (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ObjectType() As String
ObjectType = _PropertyGet(&quot;ObjectType&quot;)
End Property &apos; ObjectType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
&apos; Return
&apos; a Collection object if pvIndex absent
&apos; a Property object otherwise
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
Exit Function
End Function &apos; Properties
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Recommendation() As Variant
Recommendation = _PropertyGet(&quot;Recommendation&quot;)
End Property &apos; Recommendation (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get RowChangeAction() As Variant
RowChangeAction = _PropertyGet(&quot;RowChangeAction&quot;)
End Property &apos; RowChangeAction (get)
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Source() As Variant
&apos; Return the object having fired the event: Form, Control or SubForm
&apos; Else return the root Database object
Source = _PropertyGet(&quot;Source&quot;)
End Function &apos; Source (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get SubComponentName() As String
SubComponentName = _PropertyGet(&quot;SubComponentName&quot;)
End Property &apos; SubComponentName (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get SubComponentType() As Long
SubComponentType = _PropertyGet(&quot;SubComponentType&quot;)
End Property &apos; SubComponentType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get XPos() As Variant
XPos = _PropertyGet(&quot;XPos&quot;)
End Property &apos; XPos (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get YPos() As Variant
YPos = _PropertyGet(&quot;YPos&quot;)
End Property &apos; YPos (get)
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS METHODS ---
REM -----------------------------------------------------------------------------------------------------------------------
Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
&apos; Return property value of psProperty property name
Utils._SetCalledSub(&quot;Form.getProperty&quot;)
If IsMissing(pvProperty) Then Call _TraceArguments()
getProperty = _PropertyGet(pvProperty)
Utils._ResetCalledSub(&quot;Form.getProperty&quot;)
End Function &apos; getProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
&apos; 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 &apos; hasProperty
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub _Initialize(poEvent As Object)
Dim oObject As Object, i As Integer
Dim sShortcut As String, sAddShortcut As String, sArray() As String
Dim sImplementation As String, oSelection As Object
Dim iCurrentDoc As Integer, oDoc As Object
Dim vPersistent As Variant
Const cstDatabaseForm = &quot;com.sun.star.comp.forms.ODatabaseForm&quot;
If _ErrorHandler() Then On Local Error Goto Error_Function
Set oObject = poEvent.Source
_EventSource = oObject
sArray = Split(Utils._getUNOTypeName(poEvent), &quot;.&quot;)
_EventType = UCase(sArray(UBound(sArray)))
If Utils._hasUNOProperty(poEvent, &quot;EventName&quot;) Then _EventName = poEvent.EventName
Select Case _EventType
Case &quot;DOCUMENTEVENT&quot;
&apos;SubComponent processing
Select Case UCase(_EventName)
Case UCase(&quot;OnSubComponentClosed&quot;), UCase(&quot;OnSubComponentOpened&quot;)
Set oSelection = poEvent.ViewController.getSelection()(0)
_SubComponentName = oSelection.Name
With com.sun.star.sdb.application.DatabaseObject
Select Case oSelection.Type
Case .TABLE : _SubComponentType = acTable
Case .QUERY : _SubComponentType = acQuery
Case .FORM : _SubComponentType = acForm
Case .REPORT : _SubComponentType = acReport
Case Else
End Select
End With
Case Else
End Select
Case &quot;EVENTOBJECT&quot;
Case &quot;ACTIONEVENT&quot;
Case &quot;FOCUSEVENT&quot;
_FocusChangeTemporary = poEvent.Temporary
Case &quot;ITEMEVENT&quot;
Case &quot;INPUTEVENT&quot;, &quot;KEYEVENT&quot;
_KeyCode = poEvent.KeyCode
_KeyChar = poEvent.KeyChar
_KeyFunction = poEvent.KeyFunc
_KeyAlt = Utils._BitShift(poEvent.Modifiers, com.sun.star.awt.KeyModifier.MOD2)
_KeyCtrl = Utils._BitShift(poEvent.Modifiers, com.sun.star.awt.KeyModifier.MOD1)
_KeyShift = Utils._BitShift(poEvent.Modifiers, com.sun.star.awt.KeyModifier.SHIFT)
Case &quot;MOUSEEVENT&quot;
_ButtonLeft = Utils._BitShift(poEvent.Buttons, com.sun.star.awt.MouseButton.LEFT)
_ButtonRight = Utils._BitShift(poEvent.Buttons, com.sun.star.awt.MouseButton.RIGHT)
_ButtonMiddle = Utils._BitShift(poEvent.Buttons, com.sun.star.awt.MouseButton.MIDDLE)
_XPos = poEvent.X
_YPos = poEvent.Y
_ClickCount = poEvent.ClickCount
Case &quot;ROWCHANGEEVENT&quot;
_RowChangeAction = poEvent.Action
Case &quot;TEXTEVENT&quot;
Case &quot;ADJUSTMENTEVENT&quot;, &quot;DOCKINGEVENT&quot;, &quot;ENDDOCKINGEVENT&quot;, &quot;ENDPOPUPMODEEVENT&quot;, &quot;ENHANCEDMOUSEEVENT&quot; _
, &quot;MENUEVENT&quot;, &quot;PAINTEVENT&quot;, &quot;SPINEVENT&quot;, &quot;VCLCONTAINEREVENT&quot;, &quot;WINDOWEVENT&quot;
Goto Exit_Function
Case Else
Goto Exit_Function
End Select
&apos; Evaluate ContextShortcut
sShortcut = &quot;&quot;
sImplementation = Utils._ImplementationName(oObject)
Select Case True
Case sImplementation = &quot;stardiv.Toolkit.UnoDialogControl&quot; &apos; Dialog
_ContextShortcut = &quot;Dialogs!&quot; &amp; _EventSource.Model.Name
Goto Exit_Function
Case Left(sImplementation, 16) = &quot;stardiv.Toolkit.&quot; &apos; Control in Dialog
_ContextShortcut = &quot;Dialogs!&quot; &amp; _EventSource.Context.Model.Name _
&amp; &quot;!&quot; &amp; _EventSource.Model.Name
Goto Exit_Function
Case Else
End Select
iCurrentDoc = _A2B_.CurrentDocIndex(, False)
If iCurrentDoc &lt; 0 Then Goto Exit_Function
Set oDoc = _A2B_.CurrentDocument(iCurrentDoc)
&apos; To manage 2x triggers of &quot;Before record action&quot; form event
If _EventType = &quot;ROWCHANGEEVENT&quot; And sImplementation &lt;&gt; &quot;com.sun.star.comp.forms.ODatabaseForm&quot; Then _Recommendation = &quot;IGNORE&quot;
Do While sImplementation &lt;&gt; &quot;SwXTextDocument&quot;
sAddShortcut = &quot;&quot;
Select Case sImplementation
Case &quot;com.sun.star.comp.forms.OFormsCollection&quot; &apos; Do nothing
Case Else
If Utils._hasUNOProperty(oObject, &quot;Model&quot;) Then
If oObject.Model.Name &lt;&gt; &quot;MainForm&quot; And oObject.Model.Name &lt;&gt; &quot;Form&quot; Then sAddShortcut = Utils._Surround(oObject.Model.Name)
ElseIf Utils._hasUNOProperty(oObject, &quot;Name&quot;) Then
If oObject.Name &lt;&gt; &quot;MainForm&quot; And oObject.Name &lt;&gt; &quot;Form&quot; Then sAddShortcut = Utils._Surround(oObject.Name)
End If
If sAddShortcut &lt;&gt; &quot;&quot; Then
If sImplementation = cstDatabaseForm And oDoc.DbConnect = DBCONNECTBASE Then sAddShortcut = sAddShortcut &amp; &quot;.Form&quot;
sShortcut = sAddShortcut &amp; Iif(Len(sShortcut) &gt; 0, &quot;!&quot; &amp; sShortcut, &quot;&quot;)
End If
End Select
Select Case True
Case Utils._hasUNOProperty(oObject, &quot;Model&quot;)
Set oObject = oObject.Model.Parent
Case Utils._hasUNOProperty(oObject, &quot;Parent&quot;)
Set oObject = oObject.Parent
Case Else
Goto Exit_Function
End Select
sImplementation = Utils._ImplementationName(oObject)
Loop
&apos; Add Forms! prefix
Select Case oDoc.DbConnect
Case DBCONNECTBASE
vPersistent = Split(oObject.StringValue, &quot;/&quot;)
sAddShortcut = Utils._Surround(_GetHierarchicalName(vPersistent(UBound(vPersistent) - 1)))
sShortcut = &quot;Forms!&quot; &amp; sAddShortcut &amp; &quot;!&quot; &amp; sShortcut
Case DBCONNECTFORM
sShortcut = &quot;Forms!0!&quot; &amp; sShortcut
End Select
sArray = Split(sShortcut, &quot;!&quot;)
&apos; If presence of &quot;Forms!myform!myform.Form&quot;, eliminate 2nd element
&apos; Eliminate anyway blanco subcomponents (e.g. Forms!!myForm)
If UBound(sArray) &gt;= 2 Then
If UCase(sArray(1)) &amp; &quot;.FORM&quot; = UCase(sArray(2)) Then sArray(1) = &quot;&quot;
sArray = Utils._TrimArray(sArray)
End If
&apos; If first element ends with .Form, remove suffix
If UBound(sArray) &gt;= 1 Then
If Len(sArray(1)) &gt; 5 And Right(sArray(1), 5) = &quot;.Form&quot; Then sArray(1) = left(sArray(1), Len(sArray(1)) - 5)
sShortcut = Join(sArray, &quot;!&quot;)
End If
If Len(sShortcut) &gt;= 2 Then
If Right(sShortcut, 1) = &quot;!&quot; Then
_ContextShortcut = Left(sShortcut, Len(sShortcut) - 1)
Else
_ContextShortcut = sShortcut
End If
End If
Exit_Function:
Exit Sub
Error_Function:
TraceError(TRACEWARNING, Err, &quot;Event.Initialize&quot;, Erl)
GoTo Exit_Function
End Sub &apos; _Initialize V0.9.1
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertiesList() As Variant
Dim sSubComponentName As String, sSubComponentType As String
sSubComponentName = Iif(_SubComponentType &gt; -1, &quot;SubComponentName&quot;, &quot;&quot;)
sSubComponentType = Iif(_SubComponentType &gt; -1, &quot;SubComponentType&quot;, &quot;&quot;)
Dim sXPos As String, sYPos As String
sXPos = Iif(IsNull(_XPos), &quot;&quot;, &quot;XPos&quot;)
sYPos = Iif(IsNull(_YPos), &quot;&quot;, &quot;YPos&quot;)
_PropertiesList = Utils._TrimArray(Array( _
&quot;ButtonLeft&quot;, &quot;ButtonRight&quot;, &quot;ButtonMiddle&quot;, &quot;ClickCount&quot; _
, &quot;ContextShortcut&quot;, &quot;EventName&quot;, &quot;EventType&quot;, &quot;FocusChangeTemporary&quot;, _
, &quot;KeyAlt&quot;, &quot;KeyChar&quot;, &quot;KeyCode&quot;, &quot;KeyCtrl&quot;, &quot;KeyFunction&quot;, &quot;KeyShift&quot; _
, &quot;ObjectType&quot;, &quot;Recommendation&quot;, &quot;RowChangeAction&quot;, &quot;Source&quot; _
, sSubComponentName, sSubComponentType, sXPos, sYPos _
))
End Function &apos; _PropertiesList
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertyGet(ByVal psProperty As String) As Variant
&apos; Return property value of the psProperty property name
If _ErrorHandler() Then On Local Error Goto Error_Function
Utils._SetCalledSub(&quot;Event.get&quot; &amp; psProperty)
_PropertyGet = EMPTY
Select Case UCase(psProperty)
Case UCase(&quot;ButtonLeft&quot;)
_PropertyGet = _ButtonLeft
Case UCase(&quot;ButtonMiddle&quot;)
_PropertyGet = _ButtonMiddle
Case UCase(&quot;ButtonRight&quot;)
_PropertyGet = _ButtonRight
Case UCase(&quot;ClickCount&quot;)
_PropertyGet = _ClickCount
Case UCase(&quot;ContextShortcut&quot;)
_PropertyGet = _ContextShortcut
Case UCase(&quot;FocusChangeTemporary&quot;)
_PropertyGet = _FocusChangeTemporary
Case UCase(&quot;EventName&quot;)
_PropertyGet = _EventName
Case UCase(&quot;EventSource&quot;)
_PropertyGet = _EventSource
Case UCase(&quot;EventType&quot;)
_PropertyGet = _EventType
Case UCase(&quot;KeyAlt&quot;)
_PropertyGet = _KeyAlt
Case UCase(&quot;KeyChar&quot;)
_PropertyGet = _KeyChar
Case UCase(&quot;KeyCode&quot;)
_PropertyGet = _KeyCode
Case UCase(&quot;KeyCtrl&quot;)
_PropertyGet = _KeyCtrl
Case UCase(&quot;KeyFunction&quot;)
_PropertyGet = _KeyFunction
Case UCase(&quot;KeyShift&quot;)
_PropertyGet = _KeyShift
Case UCase(&quot;ObjectType&quot;)
_PropertyGet = _Type
Case UCase(&quot;Recommendation&quot;)
_PropertyGet = _Recommendation
Case UCase(&quot;RowChangeAction&quot;)
_PropertyGet = _RowChangeAction
Case UCase(&quot;Source&quot;)
If _ContextShortcut = &quot;&quot; Then
_PropertyGet = _EventSource
Else
_PropertyGet = getObject(_ContextShortcut)
End If
Case UCase(&quot;SubComponentName&quot;)
_PropertyGet = _SubComponentName
Case UCase(&quot;SubComponentType&quot;)
_PropertyGet = _SubComponentType
Case UCase(&quot;XPos&quot;)
If IsNull(_XPos) Then Goto Trace_Error
_PropertyGet = _XPos
Case UCase(&quot;YPos&quot;)
If IsNull(_YPos) Then Goto Trace_Error
_PropertyGet = _YPos
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(&quot;Event.get&quot; &amp; psProperty)
Exit Function
Trace_Error:
&apos; Errors are not displayed to avoid display infinite cycling
TraceError(TRACEWARNING, ERRPROPERTY, Utils._CalledSub(), 0, False, psProperty)
_PropertyGet = EMPTY
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;Event._PropertyGet&quot;, Erl)
_PropertyGet = EMPTY
GoTo Exit_Function
End Function &apos; _PropertyGet V1.1.0
</script:module>

View File

@@ -0,0 +1,923 @@
<?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="Field" 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 &apos; Must be FIELD
Private _This As Object &apos; Workaround for absence of This builtin function
Private _Parent As Object
Private _Name As String
Private _Precision As Long
Private _ParentName As String
Private _ParentType As String
Private _ParentDatabase As Object
Private _ParentRecordset As Object
Private _DefaultValue As String
Private _DefaultValueSet As Boolean
Private Column As Object &apos; com.sun.star.sdb.OTableColumnWrapper
&apos; or org.openoffice.comp.dbaccess.OQueryColumn
&apos; or com.sun.star.sdb.ODataColumn
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CONSTRUCTORS / DESTRUCTORS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJFIELD
Set _This = Nothing
Set _Parent = Nothing
_Name = &quot;&quot;
_ParentName = &quot;&quot;
_ParentType = &quot;&quot;
_DefaultValue = &quot;&quot;
_DefaultValueSet = False
Set Column = Nothing
End Sub &apos; Constructor
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Terminate()
On Local Error Resume Next
Call Class_Initialize()
End Sub &apos; Destructor
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub Dispose()
Call Class_Terminate()
End Sub &apos; Explicit destructor
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS GET/LET/SET PROPERTIES ---
REM -----------------------------------------------------------------------------------------------------------------------
Property Get DataType() As Long &apos; AOO/LibO type
DataType = _PropertyGet(&quot;DataType&quot;)
End Property &apos; DataType (get)
Property Get DataUpdatable() As Boolean
DataUpdatable = _PropertyGet(&quot;DataUpdatable&quot;)
End Property &apos; DataUpdatable (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get DbType() As Long &apos; MSAccess type
DbType = _PropertyGet(&quot;DbType&quot;)
End Property &apos; DbType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get DefaultValue() As Variant
DefaultValue = _PropertyGet(&quot;DefaultValue&quot;)
End Property &apos; DefaultValue (get)
Property Let DefaultValue(ByVal pvDefaultValue As Variant)
Call _PropertySet(&quot;DefaultValue&quot;, pvDefaultValue)
End Property &apos; DefaultValue (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Description() As Variant
Description = _PropertyGet(&quot;Description&quot;)
End Property &apos; Description (get)
Property Let Description(ByVal pvDescription As Variant)
Call _PropertySet(&quot;Description&quot;, pvDescription)
End Property &apos; Description (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get FieldSize() As Long
FieldSize = _PropertyGet(&quot;FieldSize&quot;)
End Property &apos; FieldSize (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Name() As String
Name = _PropertyGet(&quot;Name&quot;)
End Property &apos; Name (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ObjectType() As String
ObjectType = _PropertyGet(&quot;ObjectType&quot;)
End Property &apos; ObjectType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Size() As Long
Size = _PropertyGet(&quot;Size&quot;)
End Property &apos; Size (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get SourceField() As String
SourceField = _PropertyGet(&quot;SourceField&quot;)
End Property &apos; SourceField (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get SourceTable() As String
SourceTable = _PropertyGet(&quot;SourceTable&quot;)
End Property &apos; SourceTable (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get TypeName() As String
TypeName = _PropertyGet(&quot;TypeName&quot;)
End Property &apos; TypeName (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Value() As Variant
Value = _PropertyGet(&quot;Value&quot;)
End Property &apos; Value (get)
Property Let Value(ByVal pvValue As Variant)
Call _PropertySet(&quot;Value&quot;, pvValue)
End Property &apos; Value (set)
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS METHODS ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Public Function AppendChunk(ByRef Optional pvValue As Variant) As Boolean
&apos; Store a chunk of string or binary characters into the current field, presumably a large object (CLOB or BLOB)
If _ErrorHandler() Then On Local Error Goto Error_Function
Const cstThisSub = &quot;Field.AppendChunk&quot;
Utils._SetCalledSub(cstThisSub)
AppendChunk = False
If IsMissing(pvValue) Then Call _TraceArguments()
If _ParentType &lt;&gt; OBJRECORDSET Then Goto Trace_Error &apos; Not on table- or querydefs ... !
If Not Column.IsWritable Then Goto Trace_Error_Updatable
If Column.IsReadOnly Then Goto Trace_Error_Updatable
If _ParentDatabase.Recordsets(_ParentName)._EditMode = dbEditNone Then Goto Trace_Error_Update
Dim iChunkType As Integer
With com.sun.star.sdbc.DataType
Select Case Column.Type &apos; DOES NOT WORK FOR CHARACTER TYPES
&apos; Case .CHAR, .VARCHAR, .LONGVARCHAR, .CLOB
&apos; iChunkType = vbString
Case .BINARY, .VARBINARY, .LONGVARBINARY, .BLOB, .CHAR &apos; .CHAR added for Sqlite3
iChunkType = vbByte
Case Else
Goto Trace_Error
End Select
End With
AppendChunk = _ParentRecordset._AppendChunk(_Name, pvValue, iChunkType)
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Trace_Error_Update:
TraceError(TRACEFATAL, ERRUPDATESEQUENCE, Utils._CalledSub(), 0, 1)
_PropertySet = False
Goto Exit_Function
Trace_Error_Updatable:
TraceError(TRACEFATAL, ERRNOTUPDATABLE, Utils._CalledSub(), 0, 1)
_PropertySet = False
Goto Exit_Function
Trace_Error:
TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, , cstThisSub)
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
_PropertySet = False
GoTo Exit_Function
End Function &apos; AppendChunk V1.5.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function GetChunk(ByVal Optional pvOffset As Variant, ByVal Optional pvBytes As Variant) As Variant
&apos; Get a chunk of string or binary characters from the current field, presumably a large object (CLOB or BLOB)
If _ErrorHandler() Then On Local Error Goto Error_Function
Const cstThisSub = &quot;Field.GetChunk&quot;
Utils._SetCalledSub(cstThisSub)
Dim oValue As Object, bNullable As Boolean, bNull As Boolean, vValue() As Variant
Dim lLength As Long, lOffset As Long, lValue As Long
If IsMissing(pvOffset) Or IsMissing(pvBytes) Then Call _TraceArguments()
If Not Utils._CheckArgument(pvOffset, 1, _AddNumeric()) Then Goto Exit_Function
If pvOffset &lt; 0 Then
TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), 0, , Array(1, pvOffset))
Goto Exit_Function
End If
If Not Utils._CheckArgument(pvBytes, 2, _AddNumeric()) Then Goto Exit_Function
If pvBytes &lt; 0 Then
TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), 0, , Array(2, pvBytes))
Goto Exit_Function
End If
bNullable = ( Column.IsNullable = com.sun.star.sdbc.ColumnValue.NULLABLE )
bNull = False
GetChunk = Null
vValue = Array()
With com.sun.star.sdbc.DataType
Select Case Column.Type &apos; DOES NOT WORK FOR CHARACTER TYPES
&apos; Case .CHAR, .VARCHAR, .LONGVARCHAR
&apos; Set oValue = Column.getCharacterStream()
&apos; Case .CLOB
&apos; Set oValue = Column.getClob.getCharacterStream()
Case .BINARY, .VARBINARY, .LONGVARBINARY
Set oValue = Column.getBinaryStream()
Case .BLOB
Set oValue = Column.getBlob.getBinaryStream()
Case Else
Goto Trace_Error
End Select
If bNullable Then bNull = Column.wasNull()
If Not bNull Then
lOffset = CLng(pvOffset)
If lOffset &gt; 0 Then oValue.skipBytes(lOffset)
lValue = oValue.readBytes(vValue, pvBytes)
End If
oValue.closeInput()
End With
GetChunk = vValue
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Trace_Error:
TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, , cstThisSub)
Goto Exit_Function
Trace_Argument:
TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), 0, , Array(iArg, pvIndex))
Set vForms = Nothing
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
GoTo Exit_Function
End Function &apos; GetChunk V1.5.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
&apos; Return property value of psProperty property name
Const cstThisSub = &quot;Field.getProperty&quot;
Utils._SetCalledSub(cstThisSub)
If IsMissing(pvProperty) Then Call _TraceArguments()
getProperty = _PropertyGet(pvProperty)
Utils._ResetCalledSub(cstThisSub)
End Function &apos; getProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
&apos; Return True if object has a valid property called pvProperty (case-insensitive comparison !)
Const cstThisSub = &quot;Field.hasProperty&quot;
Utils._SetCalledSub(cstThisSub)
If IsMissing(pvProperty) Then hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList()) Else hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList(), pvProperty)
Utils._ResetCalledSub(cstThisSub)
Exit Function
End Function &apos; hasProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
&apos; Return
&apos; a Collection object if pvIndex absent
&apos; a Property object otherwise
Dim vProperty As Variant, vPropertiesList() As Variant, sObject As String, sName As String
Const cstThisSub = &quot;Field.Properties&quot;
Utils._SetCalledSub(cstThisSub)
vPropertiesList = _PropertiesList()
sObject = Utils._PCase(_Type)
sName = _ParentType &amp; &quot;/&quot; &amp; _ParentName &amp; &quot;/&quot; &amp; _Name
If IsMissing(pvIndex) Then
vProperty = PropertiesGet._Properties(sObject, _This, vPropertiesList)
Else
vProperty = PropertiesGet._Properties(sObject, _This, vPropertiesList, pvIndex)
vProperty._Value = _PropertyGet(vPropertiesList(pvIndex))
Set vProperty._ParentDatabase = _ParentDatabase
End If
Exit_Function:
Set Properties = vProperty
Utils._ResetCalledSub(cstThisSub)
Exit Function
End Function &apos; Properties
REM -----------------------------------------------------------------------------------------------------------------------
Public Function ReadAllBytes(ByVal Optional pvFile As Variant) As Boolean
&apos; Read the whole content of a file into Long Binary Field object
Const cstThisSub = &quot;Field.ReadAllBytes&quot;
Utils._SetCalledSub(cstThisSub)
If Not Utils._CheckArgument(pvFile, 1, vbString) Then Goto Exit_Function
ReadAllBytes = _ReadAll(pvFile, &quot;ReadAllBytes&quot;)
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
End Function &apos; ReadAllBytes
REM -----------------------------------------------------------------------------------------------------------------------
Public Function ReadAllText(ByVal Optional pvFile As Variant) As Boolean
&apos; Read the whole content of a file into a Long Char Field object
Const cstThisSub = &quot;Field.ReadAllText&quot;
Utils._SetCalledSub(cstThisSub)
If Not Utils._CheckArgument(pvFile, 1, vbString) Then Goto Exit_Function
ReadAllText = _ReadAll(pvFile, &quot;ReadAllText&quot;)
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
End Function &apos; ReadAllText
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setProperty(ByVal Optional psProperty As String, ByVal Optional pvValue As Variant) As Boolean
&apos; Return True if property setting OK
Const cstThisSub = &quot;Field.setProperty&quot;
Utils._SetCalledSub(cstThisSub)
setProperty = _PropertySet(psProperty, pvValue)
Utils._ResetCalledSub(cstThisSub)
End Function
REM -----------------------------------------------------------------------------------------------------------------------
Public Function WriteAllBytes(ByVal Optional pvFile As Variant) As Boolean
&apos; Write the whole content of a Long Binary Field object to a file
Const cstThisSub = &quot;Field.WriteAllBytes&quot;
Utils._SetCalledSub(cstThisSub)
If Not Utils._CheckArgument(pvFile, 1, vbString) Then Goto Exit_Function
WriteAllBytes = _WriteAll(pvFile, &quot;WriteAllBytes&quot;)
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
End Function &apos; WriteAllBytes
REM -----------------------------------------------------------------------------------------------------------------------
Public Function WriteAllText(ByVal Optional pvFile As Variant) As Boolean
&apos; Write the whole content of a Long Char Field object to a file
Const cstThisSub = &quot;Field.WriteAllText&quot;
Utils._SetCalledSub(cstThisSub)
If Not Utils._CheckArgument(pvFile, 1, vbString) Then Goto Exit_Function
WriteAllText = _WriteAll(pvFile, &quot;WriteAllText&quot;)
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
End Function &apos; WriteAllText
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertiesList() As Variant
Select Case _ParentType
Case OBJTABLEDEF
_PropertiesList =Array(&quot;DataType&quot;, &quot;dbType&quot;, &quot;DefaultValue&quot; _
, &quot;Description&quot;, &quot;Name&quot;, &quot;ObjectType&quot;, &quot;Size&quot;, &quot;SourceField&quot;, &quot;SourceTable&quot; _
, &quot;TypeName&quot; _
)
Case OBJQUERYDEF
_PropertiesList = Array(&quot;DataType&quot;, &quot;dbType&quot;, &quot;DefaultValue&quot; _
, &quot;Description&quot;, &quot;Name&quot;, &quot;ObjectType&quot;, &quot;Size&quot;, &quot;SourceField&quot;, &quot;SourceTable&quot; _
, &quot;TypeName&quot; _
)
Case OBJRECORDSET
_PropertiesList = Array(&quot;DataType&quot;, &quot;DataUpdatable&quot;, &quot;dbType&quot;, &quot;DefaultValue&quot; _
, &quot;Description&quot; , &quot;FieldSize&quot;, &quot;Name&quot;, &quot;ObjectType&quot; _
, &quot;Size&quot;, &quot;SourceTable&quot;, &quot;TypeName&quot;, &quot;Value&quot; _
)
End Select
End Function &apos; _PropertiesList
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertyGet(ByVal psProperty As String) As Variant
&apos; Return property value of the psProperty property name
If _ErrorHandler() Then On Local Error Goto Error_Function
Dim cstThisSub As String
cstThisSub = &quot;Field.get&quot; &amp; psProperty
Utils._SetCalledSub(cstThisSub)
If Not hasProperty(psProperty) Then Goto Trace_Error
Dim bCond1 As Boolean, bCond2 As Boolean, vValue As Variant, oValue As Object, sValue As String
Dim oSize As Object, lSize As Long, bNullable As Boolean, bNull As Boolean
Const cstMaxBinlength = 2 * 65535
_PropertyGet = EMPTY
Select Case UCase(psProperty)
Case UCase(&quot;DataType&quot;)
_PropertyGet = Column.Type
Case UCase(&quot;DbType&quot;)
With com.sun.star.sdbc.DataType
Select Case Column.Type
Case .BIT : _PropertyGet = dbBoolean
Case .TINYINT : _PropertyGet = dbInteger
Case .SMALLINT : _PropertyGet = dbLong
Case .INTEGER : _PropertyGet = dbLong
Case .BIGINT : _PropertyGet = dbBigInt
Case .FLOAT : _PropertyGet = dbFloat
Case .REAL : _PropertyGet = dbSingle
Case .DOUBLE : _PropertyGet = dbDouble
Case .NUMERIC : _PropertyGet = dbNumeric
Case .DECIMAL : _PropertyGet = dbDecimal
Case .CHAR : _PropertyGet = dbChar
Case .VARCHAR : _PropertyGet = dbText
Case .LONGVARCHAR : _PropertyGet = dbMemo
Case .CLOB : _PropertyGet = dbMemo
Case .DATE : _PropertyGet = dbDate
Case .TIME : _PropertyGet = dbTime
Case .TIMESTAMP : _PropertyGet = dbTimeStamp
Case .BINARY : _PropertyGet = dbBinary
Case .VARBINARY : _PropertyGet = dbVarBinary
Case .LONGVARBINARY : _PropertyGet = dbLongBinary
Case .BLOB : _PropertyGet = dbLongBinary
Case .BOOLEAN : _PropertyGet = dbBoolean
Case Else : _PropertyGet = dbUndefined
End Select
End With
Case UCase(&quot;DataUpdatable&quot;)
If Utils._hasUNOProperty(Column, &quot;IsWritable&quot;) Then
_PropertyGet = Column.IsWritable
ElseIf Utils._hasUNOProperty(Column, &quot;IsReadOnly&quot;) Then
_PropertyGet = Not Column.IsReadOnly
ElseIf Utils._hasUNOProperty(Column, &quot;IsDefinitelyWritable&quot;) Then
_PropertyGet = Column.IsDefinitelyWritable
Else
_PropertyGet = False
End If
If Utils._hasUNOProperty(Column, &quot;IsAutoIncrement&quot;) Then
If Column.IsAutoIncrement Then _PropertyGet = False &apos; Forces False if auto-increment (MSAccess)
End If
Case UCase(&quot;DefaultValue&quot;)
&apos; default value buffered to avoid multiple calls
If Not _DefaultValueSet Then
If Utils._hasUNOProperty(Column, &quot;DefaultValue&quot;) Then &apos; Default value in database set via SQL statement
_DefaultValue = Column.DefaultValue
ElseIf Utils._hasUNOProperty(Column, &quot;ControlDefault&quot;) Then &apos; Default value set in Base via table edition
If IsEmpty(Column.ControlDefault) Then _DefaultValue = &quot;&quot; Else _DefaultValue = Column.ControlDefault
Else
_DefaultValue = &quot;&quot;
End If
_DefaultValueSet = True
End If
_PropertyGet = _DefaultValue
Case UCase(&quot;Description&quot;)
bCond1 = Utils._hasUNOProperty(Column, &quot;Description&quot;)
bCond2 = Utils._hasUNOProperty(Column, &quot;HelpText&quot;)
Select Case True
Case ( bCond1 And bCond2 )
If IsEmpty(Column.HelpText) Then _PropertyGet = Column.Description Else _PropertyGet = Column.HelpText
Case ( bCond1 And ( Not bCond2 ) )
_PropertyGet = Column.Description
Case ( ( Not bCond1 ) And bCond2 )
_PropertyGet = Column.HelpText
Case Else
_PropertyGet = &quot;&quot;
End Select
Case UCase(&quot;FieldSize&quot;)
With com.sun.star.sdbc.DataType
Select Case Column.Type
Case .VARCHAR, .LONGVARCHAR, .CLOB
Set oSize = Column.getCharacterStream
Case .LONGVARBINARY, .VARBINARY, .BINARY, .BLOB
Set oSize = Column.getBinaryStream
Case Else
Set oSize = Nothing
End Select
End With
If Not IsNull(oSize) Then
bNullable = ( Column.IsNullable = com.sun.star.sdbc.ColumnValue.NULLABLE )
If bNullable Then
If Column.wasNull() Then _PropertyGet = 0 Else _PropertyGet = CLng(oSize.getLength())
Else
_PropertyGet = CLng(oSize.getLength())
End If
oSize.closeInput()
Else
_PropertyGet = EMPTY
End If
Case UCase(&quot;Name&quot;)
_PropertyGet = _Name
Case UCase(&quot;ObjectType&quot;)
_PropertyGet = _Type
Case UCase(&quot;Size&quot;)
With com.sun.star.sdbc.DataType
Select Case Column.Type
Case .LONGVARCHAR, .LONGVARBINARY, .VARBINARY, .BINARY, .BLOB, .CLOB
_PropertyGet = 0 &apos; Always 0 (MSAccess)
Case Else
If Utils._hasUNOProperty(Column, &quot;Precision&quot;) Then _PropertyGet = Column.Precision Else _PropertyGet = 0
End Select
End With
Case UCase(&quot;SourceField&quot;)
Select Case _ParentType
Case OBJTABLEDEF
_PropertyGet = _Name
Case OBJQUERYDEF &apos; RealName = not documented ?!?
If Utils._hasUNOProperty(Column, &quot;RealName&quot;) Then _PropertyGet = Column.RealName Else _PropertyGet = _Name
End Select
Case UCase(&quot;SourceTable&quot;)
Select Case _ParentType
Case OBJTABLEDEF
_PropertyGet = _ParentName
Case OBJQUERYDEF, OBJRECORDSET
_PropertyGet = Column.TableName
End Select
Case UCase(&quot;TypeName&quot;)
_PropertyGet = Column.TypeName
Case UCase(&quot;Value&quot;)
bNullable = ( Column.IsNullable = com.sun.star.sdbc.ColumnValue.NULLABLE )
bNull = False
With com.sun.star.sdbc.DataType
Select Case Column.Type
Case .BIT, .BOOLEAN : vValue = Column.getBoolean() &apos; vbBoolean
Case .TINYINT : vValue = Column.getShort() &apos; vbInteger
Case .SMALLINT, .INTEGER: vValue = Column.getInt() &apos; vbLong
Case .BIGINT : vValue = Column.getLong() &apos; vbBigint
Case .FLOAT : vValue = Column.getFloat() &apos; vbSingle
Case .REAL, .DOUBLE : vValue = Column.getDouble() &apos; vbDouble
Case .NUMERIC, .DECIMAL
If Utils._hasUNOProperty(Column, &quot;Scale&quot;) Then
If Column.Scale &gt; 0 Then
vValue = Column.getDouble()
Else &apos; Try Long otherwise Double (CDec not implemented anymore in LO ?!?)
On Local Error Resume Next &apos; Avoid overflow error
&apos; CLng checks local decimal point, getString does not !
sValue = Join(Split(Column.getString(), &quot;.&quot;), Utils._DecimalPoint())
vValue = CLng(sValue)
If Err &lt;&gt; 0 Then
vValue = CDbl(sValue)
Err.Clear
On Local Error Goto Error_Function
End If
End If
Else
vValue = CDbl(Column.getString())
End If
Case .CHAR : vValue = Column.getString()
Case .VARCHAR : vValue = Column.getString() &apos; vbString
Case .LONGVARCHAR, .CLOB
Set oValue = Column.getCharacterStream()
If bNullable Then bNull = Column.wasNull()
If Not bNull Then
lSize = CLng(oValue.getLength())
oValue.closeInput()
vValue = Column.getString() &apos; vbString
Else
oValue.closeInput()
End If
Case .DATE : Set oValue = Column.getDate() &apos; vbObject with members VarType Unsigned Short = 18
If bNullable Then bNull = Column.wasNull()
If Not bNull Then vValue = DateSerial(CInt(oValue.Year), CInt(oValue.Month), CInt(oValue.Day))
Case .TIME : Set oValue = Column.getTime() &apos; vbObject with members VarType Unsigned Short = 18
If bNullable Then bNull = Column.wasNull()
If Not bNull Then vValue = TimeSerial(oValue.Hours, oValue.Minutes, oValue.Seconds)&apos;, oValue.HundredthSeconds)
Case .TIMESTAMP : Set oValue = Column.getTimeStamp()
If bNullable Then bNull = Column.wasNull()
If Not bNull Then vValue = DateSerial(CInt(oValue.Year), CInt(oValue.Month), CInt(oValue.Day)) _
+ TimeSerial(oValue.Hours, oValue.Minutes, oValue.Seconds)&apos;, oValue.HundredthSeconds)
Case .BINARY, .VARBINARY, .LONGVARBINARY, .BLOB
Set oValue = Column.getBinaryStream()
If bNullable Then bNull = Column.wasNull()
If Not bNull Then
lSize = CLng(oValue.getLength()) &apos; vbLong =&gt; equivalent to FieldSize
If lSize &gt; cstMaxBinlength Then Goto Trace_Length
vValue = Array()
oValue.readBytes(vValue, lSize)
End If
oValue.closeInput()
Case Else
vValue = Column.getString() &apos;GIVE STRING A TRY
If IsNumeric(vValue) Then vValue = Val(vValue) &apos;Required when type = &quot;&quot;, sometimes numeric fields are returned as strings (query/MSAccess)
End Select
If bNullable Then
If Column.wasNull() Then vValue = Null &apos;getXXX must precede wasNull()
End If
End With
_PropertyGet = vValue
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Trace_Error:
TraceError(TRACEWARNING, ERRPROPERTY, Utils._CalledSub(), 0, , psProperty)
_PropertyGet = EMPTY
Goto Exit_Function
Trace_Length:
TraceError(TRACEFATAL, ERROVERFLOW, Utils._CalledSub(), 0, , Array(lSize, &quot;GetChunk&quot;))
_PropertyGet = EMPTY
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
_PropertyGet = EMPTY
GoTo Exit_Function
End Function &apos; _PropertyGet V1.1.0
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Variant) As Boolean
&apos; Return True if property setting OK
If _ErrorHandler() Then On Local Error Goto Error_Function
Dim cstThisSub As String
cstThisSub = &quot;Field.set&quot; &amp; psProperty
Utils._SetCalledSub(cstThisSub)
_PropertySet = True
Dim iArgNr As Integer, vTemp As Variant
Dim oParent As Object
Select Case UCase(_A2B_.CalledSub)
Case UCase(&quot;setProperty&quot;) : iArgNr = 3
Case UCase(&quot;Field.setProperty&quot;) : iArgNr = 2
Case UCase(cstThisSub) : iArgNr = 1
End Select
If Not hasProperty(psProperty) Then Goto Trace_Error
Select Case UCase(psProperty)
Case UCase(&quot;DefaultValue&quot;)
If _ParentType &lt;&gt; OBJTABLEDEF Then Goto Trace_Error
If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
If Utils._hasUNOProperty(Column, &quot;ControlDefault&quot;) Then &apos; Default value set in Base via table edition
Column.ControlDefault = pvValue
_DefaultValue = pvValue
_DefaultValueSet = True
End If
Case UCase(&quot;Description&quot;)
If _ParentType &lt;&gt; OBJTABLEDEF Then Goto Trace_Error
If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
Column.HelpText = pvValue
Case UCase(&quot;Value&quot;)
If _ParentType &lt;&gt; OBJRECORDSET Then Goto Trace_Error &apos; Not on table- or querydefs ... !
If Not Column.IsWritable Then Goto Trace_Error_Updatable
If Column.IsReadOnly Then Goto Trace_Error_Updatable
If _ParentDatabase.Recordsets(_ParentName)._EditMode = dbEditNone Then Goto Trace_Error_Update
With com.sun.star.sdbc.DataType
If IsNull(pvValue) Then
If Column.IsNullable = com.sun.star.sdbc.ColumnValue.NULLABLE Then Column.updateNull() Else Goto Trace_Null
Else
Select Case Column.Type
Case .BIT, .BOOLEAN
If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
Column.updateBoolean(pvValue)
Case .TINYINT
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
If pvValue &lt; -128 Or pvValue &gt; +127 Then Goto Trace_Error_Value
Column.updateShort(CInt(pvValue))
Case .SMALLINT
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
If pvValue &lt; -32768 Or pvValue &gt; 32767 Then Goto trace_Error_Value
Column.updateInt(CLng(pvValue))
Case .INTEGER
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
If pvValue &lt; -2147483648 Or pvValue &gt; 2147483647 Then Goto trace_Error_Value
Column.updateInt(CLng(pvValue))
Case .BIGINT
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
Column.updateLong(pvValue) &apos; No proper type conversion for HYPER data type
Case .FLOAT
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
If Abs(pvValue) &lt; 3.402823E38 And Abs(pvValue) &gt; 1.401298E-45 Then Column.updateFloat(CSng(pvValue)) Else Goto trace_Error_Value
Case .REAL, .DOUBLE
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
&apos;If Abs(pvValue) &lt; 1.79769313486232E308 And Abs(pvValue) &gt; 4.94065645841247E-307 Then Column.updateDouble(CDbl(pvValue)) Else Goto trace_Error_Value
Column.updateDouble(CDbl(pvValue))
Case .NUMERIC, .DECIMAL
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
If Utils._hasUNOProperty(Column, &quot;Scale&quot;) Then
If Column.Scale &gt; 0 Then
&apos;If Abs(pvValue) &lt; 1.79769313486232E308 And Abs(pvValue) &gt; 4.94065645841247E-307 Then Column.updateDouble(CDbl(pvValue)) Else Goto trace_Error_Value
Column.updateDouble(CDbl(pvValue))
Else
Column.updateString(CStr(pvValue))
End If
Else
Column.updateString(CStr(pvValue))
End If
Case .CHAR, .VARCHAR, .LONGVARCHAR, .CLOB
If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
If _Precision &gt; 0 And Len(pvValue) &gt; _Precision Then Goto Trace_Error_Length
Column.updateString(pvValue) &apos; vbString
Case .DATE
If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value
vTemp = New com.sun.star.util.Date
With vTemp
.Day = Day(pvValue)
.Month = Month(pvValue)
.Year = Year(pvValue)
End With
Column.updateDate(vTemp)
Case .TIME
If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value
vTemp = New com.sun.star.util.Time
With vTemp
.Hours = Hour(pvValue)
.Minutes = Minute(pvValue)
.Seconds = Second(pvValue)
&apos;.HundredthSeconds = 0 &apos; replaced with Long nanoSeconds in LO 4.1 ??
End With
Column.updateTime(vTemp)
Case .TIMESTAMP
If Not Utils._CheckArgument(pvValue, iArgNr, vbDate, , False) Then Goto Trace_Error_Value
vTemp = New com.sun.star.util.DateTime
With vTemp
.Day = Day(pvValue)
.Month = Month(pvValue)
.Year = Year(pvValue)
.Hours = Hour(pvValue)
.Minutes = Minute(pvValue)
.Seconds = Second(pvValue)
&apos;.HundredthSeconds = 0
End With
Column.updateTimestamp(vTemp)
Case .BINARY, .VARBINARY, .LONGVARBINARY, .BLOB
If Not IsArray(pvValue) Then Goto Trace_Error_Value
If UBound(pvValue) &lt; LBound(pvValue) Then Goto Trace_Error_Value
If Not Utils._CheckArgument(pvValue(LBound(pvValue)), iArgNr, vbInteger, , False) Then Goto Trace_Error_Value
Column.updateBytes(pvValue)
Case Else
Goto trace_Error
End Select
End If
End With
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Trace_Error:
TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, , psProperty)
_PropertySet = False
Goto Exit_Function
Trace_Error_Value:
TraceError(TRACEFATAL, ERRPROPERTYVALUE, Utils._CalledSub(), 0, 1, Array(pvValue, psProperty))
_PropertySet = False
Goto Exit_Function
Trace_Null:
TraceError(TRACEFATAL, ERRNOTNULLABLE, Utils._CalledSub(), 0, 1, _Name)
_PropertySet = False
Goto Exit_Function
Trace_Error_Update:
TraceError(TRACEFATAL, ERRUPDATESEQUENCE, Utils._CalledSub(), 0, 1)
_PropertySet = False
Goto Exit_Function
Trace_Error_Updatable:
TraceError(TRACEFATAL, ERRNOTUPDATABLE, Utils._CalledSub(), 0, 1)
_PropertySet = False
Goto Exit_Function
Trace_Error_Length:
TraceError(TRACEFATAL, ERROVERFLOW, Utils._CalledSub(), 0, , Array(Len(pvValue), &quot;AppendChunk&quot;))
_PropertySet = False
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
_PropertySet = False
GoTo Exit_Function
End Function &apos; _PropertySet
REM -----------------------------------------------------------------------------------------------------------------------
Public Function _ReadAll(ByVal psFile As String, ByVal psMethod As String) As Boolean
&apos; Write the whole content of a file into a stream object
If _ErrorHandler() Then On Local Error Goto Error_Function
_ReadAll = False
If _ParentType &lt;&gt; OBJRECORDSET Then Goto Trace_Error &apos; Not on table- or querydefs ... !
If Not Column.IsWritable Then Goto Trace_Error_Updatable
If Column.IsReadOnly Then Goto Trace_Error_Updatable
If _ParentDatabase.Recordsets(_ParentName)._EditMode = dbEditNone Then Goto Trace_Error_Update
Dim sFile As String, oSimpleFileAccess As Object, sMethod As String, oStream As Object
Dim lFileLength As Long, sBuffer As String, sMemo As String, iFile As Integer
Const cstMaxLength = 64000
sFile = ConvertToURL(psFile)
oSimpleFileAccess = CreateUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
If Not oSimpleFileAccess.exists(sFile) Then Goto Trace_File
With com.sun.star.sdbc.DataType
Select Case Column.Type
Case .BINARY, .VARBINARY, .LONGVARBINARY, .BLOB
If psMethod &lt;&gt; &quot;ReadAllBytes&quot; Then Goto Trace_Error
Set oStream = oSimpleFileAccess.openFileRead(sFile)
lFileLength = oStream.getLength()
If lFileLength = 0 Then Goto Trace_File
Column.updateBinaryStream(oStream, lFileLength)
oStream.closeInput()
Case .VARCHAR, .LONGVARCHAR, .CLOB
If psMethod &lt;&gt; &quot;ReadAllText&quot; Then Goto Trace_Error
sMemo = &quot;&quot;
lFileLength = 0
iFile = FreeFile()
Open sFile For Input Access Read Shared As iFile
Do While Not Eof(iFile)
Line Input #iFile, sBuffer
lFileLength = lFileLength + Len(sBuffer) + 1
If lFileLength &gt; cstMaxLength Then Exit Do
sMemo = sMemo &amp; sBuffer &amp; vbNewLine
Loop
If lFileLength = 0 Or lFileLength &gt; cstMaxLength Then
Close #iFile
Goto Trace_File
End If
sMemo = Left(sMemo, lFileLength - 1)
Column.updateString(sMemo)
&apos;Column.updateCharacterStream(oStream, lFileLength) &apos; DOES NOT WORK ?!?
Case Else
Goto Trace_Error
End Select
End With
_ReadAll = True
Exit_Function:
Exit Function
Trace_Error:
TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, , psMethod)
Goto Exit_Function
Trace_File:
TraceError(TRACEFATAL, ERRFILEACCESS, Utils._CalledSub(), 0, , sFile)
If Not IsNull(oStream) Then oStream.closeInput()
Goto Exit_Function
Trace_Error_Update:
TraceError(TRACEFATAL, ERRUPDATESEQUENCE, Utils._CalledSub(), 0, 1)
If Not IsNull(oStream) Then oStream.closeInput()
Goto Exit_Function
Trace_Error_Updatable:
TraceError(TRACEFATAL, ERRNOTUPDATABLE, Utils._CalledSub(), 0, 1)
If Not IsNull(oStream) Then oStream.closeInput()
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, _CalledSub, Erl)
GoTo Exit_Function
End Function &apos; ReadAll
REM -----------------------------------------------------------------------------------------------------------------------
Public Function _WriteAll(ByVal psFile As String, ByVal psMethod As String) As Boolean
&apos; Write the whole content of a stream object to a file
If _ErrorHandler() Then On Local Error Goto Error_Function
_WriteAll = False
Dim sFile As String, oSimpleFileAccess As Object, sMethod As String, oStream As Object
sFile = ConvertToURL(psFile)
oSimpleFileAccess = CreateUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
With com.sun.star.sdbc.DataType
Select Case Column.Type
Case .BINARY, .VARBINARY, .LONGVARBINARY, .BLOB
If psMethod &lt;&gt; &quot;WriteAllBytes&quot; Then Goto Trace_Error
Set oStream = Column.getBinaryStream()
Case .VARCHAR, .LONGVARCHAR, .CLOB
If psMethod &lt;&gt; &quot;WriteAllText&quot; Then Goto Trace_Error
Set oStream = Column.getCharacterStream()
Case Else
Goto Trace_Error
End Select
End With
If Column.IsNullable = com.sun.star.sdbc.ColumnValue.NULLABLE Then
If Column.wasNull() Then Goto Trace_Null
End If
If oStream.getLength() = 0 Then Goto Trace_Null
On Local Error Goto Trace_File
If oSimpleFileAccess.exists(sFile) Then oSimpleFileAccess.kill(sFile)
oSimpleFileAccess.writeFile(sFile, oStream)
On Local Error Goto Error_Function
oStream.closeInput()
_WriteAll = True
Exit_Function:
Exit Function
Trace_Error:
TraceError(TRACEFATAL, ERRMETHOD, Utils._CalledSub(), 0, , psMethod)
Goto Exit_Function
Trace_File:
TraceError(TRACEFATAL, ERRFILEACCESS, Utils._CalledSub(), 0, , sFile)
If Not IsNull(oStream) Then oStream.closeInput()
Goto Exit_Function
Trace_Null:
TraceError(TRACEFATAL, ERRFIELDNULL, _CalledSub, 0)
If Not IsNull(oStream) Then oStream.closeInput()
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, _CalledSub, Erl)
GoTo Exit_Function
End Function &apos; WriteAll
</script:module>

View File

@@ -0,0 +1,540 @@
<?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="L10N" 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 Explicit
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
Public Function _GetLabel(ByVal psShortlabel As String, Optional ByVal psLocale As String) As String
&apos; Return the localized label corresponding with ShortLabel
If IsMissing(psLocale) Then psLocale = UCase(Left(_A2B_.Locale, 2)) Else psLocale = UCase(psLocale)
On Local Error Goto Error_Function
If Not Utils._InList(psLocale, Array( _
&quot;EN&quot;, &quot;FR&quot;, &quot;ES&quot;, &quot;DE&quot; _
)) Then psLocale = &quot;DEFAULT&quot; &apos; If list incomplete a recursive call will be provided anyway
Dim sLocal As String
sLocal = psShortLabel
Select Case psLocale
Case &quot;EN&quot;, &quot;DEFAULT&quot;
Select Case UCase(psShortlabel)
Case &quot;ERR&quot; &amp; ERRDBNOTCONNECTED : sLocal = &quot;No active connection to a database found&quot;
Case &quot;ERR&quot; &amp; ERRMISSINGARGUMENTS : sLocal = &quot;Arguments are missing or are not initialized&quot;
Case &quot;ERR&quot; &amp; ERRWRONGARGUMENT : sLocal = &quot;Argument nr. %0 [Value = &apos;%1&apos;] is invalid&quot;
Case &quot;ERR&quot; &amp; ERRMAINFORM : sLocal = &quot;Document &apos;%0&apos; does not contain any form&quot;
Case &quot;ERR&quot; &amp; ERRFORMNOTIDENTIFIED : sLocal = &quot;Form &apos;%0&apos; not identified in database Forms set&quot;
Case &quot;ERR&quot; &amp; ERRFORMNOTFOUND : sLocal = &quot;Form &apos;%0&apos; not found&quot;
Case &quot;ERR&quot; &amp; ERRFORMNOTOPEN : sLocal = &quot;Form &apos;%0&apos; is currently not open&quot;
Case &quot;ERR&quot; &amp; ERRDFUNCTION : sLocal = &quot;DFunction execution failed, SQL=%0&quot;
Case &quot;ERR&quot; &amp; ERROPENFORM : sLocal = &quot;Form &apos;%0&apos; could not be opened&quot;
Case &quot;ERR&quot; &amp; ERRPROPERTY : sLocal = &quot;Property &apos;%0&apos; not applicable in this context&quot;
Case &quot;ERR&quot; &amp; ERRPROPERTYVALUE : sLocal = &quot;Value &apos;%0&apos; is invalid for property &apos;%1&apos;&quot;
Case &quot;ERR&quot; &amp; ERRINDEXVALUE : sLocal = &quot;Out of array range or incorrect array size for property &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERRCOLLECTION : sLocal = &quot;Out of array range&quot;
Case &quot;ERR&quot; &amp; ERRPROPERTYNOTARRAY : sLocal = &quot;Argument nr.%0 should be an array&quot;
Case &quot;ERR&quot; &amp; ERRCONTROLNOTFOUND : sLocal = &quot;Control &apos;%0&apos; not found in parent (form, grid or dialog) &apos;%1&apos;&quot;
Case &quot;ERR&quot; &amp; ERRNOACTIVEFORM : sLocal = &quot;No active form or control found&quot;
Case &quot;ERR&quot; &amp; ERRDATABASEFORM : sLocal = &quot;Form &apos;%0&apos; has no underlying dataset&quot;
Case &quot;ERR&quot; &amp; ERRFOCUSINGRID : sLocal = &quot;Control &apos;%0&apos; not found in gridcontrol &apos;%1&apos;&quot;
Case &quot;ERR&quot; &amp; ERRNOGRIDINFORM : sLocal = &quot;No gridcontrol found in form &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERRFINDRECORD : sLocal = &quot;FindNext() must be preceded by a successful FindRecord(...) call&quot;
Case &quot;ERR&quot; &amp; ERRSQLSTATEMENT : sLocal = &quot;SQL Error, SQL statement = &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERROBJECTNOTFOUND : sLocal = &quot;%0 &apos;%1&apos; not found&quot;
Case &quot;ERR&quot; &amp; ERROPENOBJECT : sLocal = &quot;%0 &apos;%1&apos; could not be opened&quot;
Case &quot;ERR&quot; &amp; ERRCLOSEOBJECT : sLocal = &quot;%0 &apos;%1&apos; could not be closed&quot;
Case &quot;ERR&quot; &amp; ERRACTION : sLocal = &quot;Action not applicable in this context&quot;
Case &quot;ERR&quot; &amp; ERRSENDMAIL : sLocal = &quot;Mail service could not be activated&quot;
Case &quot;ERR&quot; &amp; ERRFORMYETOPEN : sLocal = &quot;Form %0 is already open&quot;
Case &quot;ERR&quot; &amp; ERRMETHOD : sLocal = &quot;Method &apos;%0&apos; not applicable in this context&quot;
Case &quot;ERR&quot; &amp; ERRPROPERTYINIT : sLocal = &quot;Property &apos;%0&apos; applicable but not initialized&quot;
Case &quot;ERR&quot; &amp; ERRFILENOTCREATED : sLocal = &quot;File &apos;%0&apos; could not be created&quot;
Case &quot;ERR&quot; &amp; ERRDIALOGNOTFOUND : sLocal = &quot;Dialog &apos;%0&apos; not found in the currently loaded libraries&quot;
Case &quot;ERR&quot; &amp; ERRDIALOGUNDEFINED : sLocal = &quot;Dialog unknown&quot;
Case &quot;ERR&quot; &amp; ERRDIALOGSTARTED : sLocal = &quot;Dialog already started&quot;
Case &quot;ERR&quot; &amp; ERRDIALOGNOTSTARTED : sLocal = &quot;Dialog &apos;%0&apos; not active&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETNODATA : sLocal = &quot;Recordset delivered no data. Action on current record rejected&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETCLOSED : sLocal = &quot;Recordset has been closed. Recordset action rejected&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETRANGE : sLocal = &quot;Current record out of range&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETFORWARD : sLocal = &quot;Action rejected in a forward-only or not bookmarkable recordset&quot;
Case &quot;ERR&quot; &amp; ERRFIELDNULL : sLocal = &quot;Field is null or empty. Action rejected&quot;
Case &quot;ERR&quot; &amp; ERRFILEACCESS : sLocal = &quot;File access error on file &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERROVERFLOW : sLocal = &quot;Field length (%0) exceeds maximum length. Use the &apos;%1&apos; method instead&quot;
Case &quot;ERR&quot; &amp; ERRNOTACTIONQUERY : sLocal = &quot;Query &apos;%0&apos; is not an action query&quot;
Case &quot;ERR&quot; &amp; ERRNOTUPDATABLE : sLocal = &quot;Database, recordset or field is read only&quot;
Case &quot;ERR&quot; &amp; ERRUPDATESEQUENCE : sLocal = &quot;Recordset update sequence error&quot;
Case &quot;ERR&quot; &amp; ERRNOTNULLABLE : sLocal = &quot;Field &apos;%0&apos; must not contain a NULL value&quot;
Case &quot;ERR&quot; &amp; ERRROWDELETED : sLocal = &quot;Current row has been deleted by another process or user&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETCLONE : sLocal = &quot;Cloning a cloned Recordset is forbidden&quot;
Case &quot;ERR&quot; &amp; ERRQUERYDEFDELETED : sLocal = &quot;Pre-existing query &apos;%0&apos; has been deleted&quot;
Case &quot;ERR&quot; &amp; ERRTABLEDEFDELETED : sLocal = &quot;Pre-existing table &apos;%0&apos; has been deleted&quot;
Case &quot;ERR&quot; &amp; ERRTABLECREATION : sLocal = &quot;Table &apos;%0&apos; could not be created&quot;
Case &quot;ERR&quot; &amp; ERRFIELDCREATION : sLocal = &quot;Field &apos;%0&apos; could not be created&quot;
Case &quot;ERR&quot; &amp; ERRSUBFORMNOTFOUND : sLocal = &quot;Subform &apos;%0&apos; not found in parent form &apos;%1&apos;&quot;
Case &quot;ERR&quot; &amp; ERRWINDOW : sLocal = &quot;Current window is not a document&quot;
Case &quot;ERR&quot; &amp; ERRCOMPATIBILITY : sLocal = &quot;Field &apos;%0&apos; could not be converted due to incompatibility of field types between the respective database systems&quot;
Case &quot;ERR&quot; &amp; ERRPRECISION : sLocal = &quot;Field &apos;%0&apos; could not be loaded in record #%1 due to capacity shortage&quot;
Case &quot;ERR&quot; &amp; ERRMODULENOTFOUND : sLocal = &quot;Module &apos;%0&apos; not found in the currently loaded libraries&quot;
Case &quot;ERR&quot; &amp; ERRPROCEDURENOTFOUND : sLocal = &quot;Procedure &apos;%0&apos; not found in module &apos;%1&apos;&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case &quot;OBJECT&quot; : sLocal = &quot;Object&quot;
Case &quot;TABLE&quot; : sLocal = &quot;Table&quot;
Case &quot;QUERY&quot; : slocal = &quot;Query&quot;
Case &quot;FORM&quot; : sLocal = &quot;Form&quot;
Case &quot;REPORT&quot; : sLocal = &quot;Report&quot;
Case &quot;RECORDSET&quot; : sLocal = &quot;Recordset&quot;
Case &quot;FIELD&quot; : sLocal = &quot;Field&quot;
Case &quot;TEMPVAR&quot; : sLocal = &quot;Temporary variable&quot;
Case &quot;COMMANDBAR&quot; : sLocal = &quot;Command bar&quot;
Case &quot;COMMANDBARCONTROL&quot; : sLocal = &quot;Command bar control&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case &quot;ERR#&quot; : sLocal = &quot;Error #&quot;
Case &quot;ERROCCUR&quot; : sLocal = &quot;occurred&quot;
Case &quot;ERRLINE&quot; : sLocal = &quot;at line&quot;
Case &quot;ERRIN&quot; : sLocal = &quot;in&quot;
Case &quot;CALLTO&quot; : sLocal = &quot;a call to function&quot;
Case &quot;SAVECONSOLE&quot; : sLocal = &quot;Save console&quot;
Case &quot;SAVECONSOLEENTRIES&quot; : sLocal = &quot;The console entries have been saved successfully.&quot;
Case &quot;QUITSHORT&quot; : sLocal = &quot;Quit&quot;
Case &quot;QUIT&quot; : sLocal = &quot;Do you really want to quit the application ? Changed data will be saved.&quot;
Case &quot;ENTERING&quot; : sLocal = &quot;Entering&quot;
Case &quot;EXITING&quot; : sLocal = &quot;Exiting&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case &quot;DLGTRACE_HELP&quot; : sLocal = &quot;Manage the console buffer and its entries&quot;
Case &quot;DLGTRACE_TITLE&quot; : sLocal = &quot;Console&quot;
Case &quot;DLGTRACE_LBLENTRIES_HELP&quot; : sLocal = &quot;Clear the list and resize the circular buffer&quot;
Case &quot;DLGTRACE_LBLENTRIES_LABEL&quot; : sLocal = &quot;Set max number of entries&quot;
Case &quot;DLGTRACE_TXTTRACELOG_HELP&quot; : sLocal = &quot;Text can be selected, copied, ...&quot;
Case &quot;DLGTRACE_TXTTRACELOG_TEXT&quot; : sLocal = &quot;--- Log file is empty ---&quot;
Case &quot;DLGTRACE_CMDCANCEL_HELP&quot; : sLocal = &quot;Cancel and close the dialog&quot;
Case &quot;DLGTRACE_CMDCANCEL_LABEL&quot; : sLocal = &quot;Cancel&quot;
Case &quot;DLGTRACE_LBLCLEAR_HELP&quot; : sLocal = &quot;Clear the list&quot;
Case &quot;DLGTRACE_LBLCLEAR_LABEL&quot; : sLocal = &quot;Clear the list&quot;
Case &quot;DLGTRACE_LBLMINLEVEL_HELP&quot; : sLocal = &quot;Register only logging requests above given level&quot;
Case &quot;DLGTRACE_LBLMINLEVEL_LABEL&quot; : sLocal = &quot;Set minimal trace level&quot;
Case &quot;DLGTRACE_CMDOK_HELP&quot; : sLocal = &quot;Validate&quot;
Case &quot;DLGTRACE_CMDOK_LABEL&quot; : sLocal = &quot;OK&quot;
Case &quot;DLGTRACE_CMDDUMP_HELP&quot; : sLocal = &quot;Choose a file and dump the actual list content in it&quot;
Case &quot;DLGTRACE_CMDDUMP_LABEL&quot; : sLocal = &quot;Dump to file&quot;
Case &quot;DLGTRACE_LBLNBENTRIES_HELP&quot; : sLocal = &quot;Actual size of list&quot;
Case &quot;DLGTRACE_LBLNBENTRIES_LABEL&quot; : sLocal = &quot;Actual number of entries:&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case &quot;DLGFORMAT_HELP&quot; : sLocal = &quot;Export the form&quot;
Case &quot;DLGFORMAT_TITLE&quot; : sLocal = &quot;OutputTo&quot;
Case &quot;DLGFORMAT_LBLFORMAT_HELP&quot; : sLocal = &quot;Format in which the form should be exported&quot;
Case &quot;DLGFORMAT_LBLFORMAT_LABEL&quot; : sLocal = &quot;Select the output format&quot;
Case &quot;DLGFORMAT_CMDOK_HELP&quot; : sLocal = &quot;Validate your choice&quot;
Case &quot;DLGFORMAT_CMDOK_LABEL&quot; : sLocal = &quot;OK&quot;
Case &quot;DLGFORMAT_CMDCANCEL_HELP&quot; : sLocal = &quot;Cancel and close the dialog&quot;
Case &quot;DLGFORMAT_CMDCANCEL_LABEL&quot; : sLocal = &quot;Cancel&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case Else : sLocal = &quot;&quot;
End Select
Case &quot;FR&quot;
Select Case UCase(psShortlabel)
Case &quot;ERR&quot; &amp; ERRDBNOTCONNECTED : sLocal = &quot;Pas de connexion active trouvée à une banque de données&quot;
Case &quot;ERR&quot; &amp; ERRMISSINGARGUMENTS : sLocal = &quot;Des arguments sont manquants ou non initialisés&quot;
Case &quot;ERR&quot; &amp; ERRWRONGARGUMENT : sLocal = &quot;L&apos;argument n° %0 [Valeur = &apos;%1&apos;] n&apos;est pas valable&quot;
Case &quot;ERR&quot; &amp; ERRMAINFORM : sLocal = &quot;Le document &apos;%0&apos; ne contient aucun formulaire&quot;
Case &quot;ERR&quot; &amp; ERRFORMNOTIDENTIFIED : sLocal = &quot;Le formulaire &apos;%0&apos; n&apos;a pas pu être identifié parmi l&apos;ensemble des formulaires de la Database&quot;
Case &quot;ERR&quot; &amp; ERRFORMNOTFOUND : sLocal = &quot;Formulaire &apos;%0&apos; non trouvé&quot;
Case &quot;ERR&quot; &amp; ERRFORMNOTOPEN : sLocal = &quot;Le formulaire &apos;%0&apos; n&apos;est actuellement pas ouvert&quot;
Case &quot;ERR&quot; &amp; ERRDFUNCTION : sLocal = &quot;L&apos;exécution de la &quot;&quot;fonction database&quot;&quot; a échoué, SQL=%0&quot;
Case &quot;ERR&quot; &amp; ERROPENFORM : sLocal = &quot;Le formulaire &apos;%0&apos; n&apos;a pas pu être ouvert&quot;
Case &quot;ERR&quot; &amp; ERRPROPERTY : sLocal = &quot;La propriété &apos;%0&apos; n&apos;est pas applicable dans ce contexte&quot;
Case &quot;ERR&quot; &amp; ERRPROPERTYVALUE : sLocal = &quot;La valeur &apos;%0&apos; est invalide pour la propriété &apos;%1&apos;&quot;
Case &quot;ERR&quot; &amp; ERRINDEXVALUE : sLocal = &quot;Indice invalide ou dimension erronée du tableau pour la propriété &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERRCOLLECTION : sLocal = &quot;Indice de tableau invalide&quot;
Case &quot;ERR&quot; &amp; ERRPROPERTYNOTARRAY : sLocal = &quot;L&apos;argument n°%0 doit être un tableau&quot;
Case &quot;ERR&quot; &amp; ERRCONTROLNOTFOUND : sLocal = &quot;Contrôle &apos;%0&apos; non trouvé dans le parent (formulaire, contrôle de table ou dialogue) &apos;%1&apos;&quot;
Case &quot;ERR&quot; &amp; ERRNOACTIVEFORM : sLocal = &quot;Pas de formulaire ou de contrôle actif&quot;
Case &quot;ERR&quot; &amp; ERRDATABASEFORM : sLocal = &quot;Le formulaire &apos;%0&apos; n&apos;a pas de données sous-jacentes&quot;
Case &quot;ERR&quot; &amp; ERRFOCUSINGRID : sLocal = &quot;Contrôle &apos;%0&apos; non trouvé dans le contrôle de table &apos;%1&apos;&quot;
Case &quot;ERR&quot; &amp; ERRNOGRIDINFORM : sLocal = &quot;Aucun contrôle de table trouvé dans le formulaire &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERRFINDRECORD : sLocal = &quot;FindNext() doit être précédé par un appel réussi à FindRecord(...)&quot;
Case &quot;ERR&quot; &amp; ERRSQLSTATEMENT : sLocal = &quot;Erreur SQL, instruction SQL = &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERROBJECTNOTFOUND : sLocal = &quot;%0 &apos;%1&apos; non trouvé(e)&quot;
Case &quot;ERR&quot; &amp; ERROPENOBJECT : sLocal = &quot;%0 &apos;%1&apos;: ouverture en échec&quot;
Case &quot;ERR&quot; &amp; ERRCLOSEOBJECT : sLocal = &quot;%0 &apos;%1&apos;: fermeture en échec&quot;
Case &quot;ERR&quot; &amp; ERRACTION : sLocal = &quot;Action non applicable dans ce contexte&quot;
Case &quot;ERR&quot; &amp; ERRSENDMAIL : sLocal = &quot;Le service de messagerie n&apos;a pas pu être activé&quot;
Case &quot;ERR&quot; &amp; ERRFORMYETOPEN : sLocal = &quot;Le formulaire %0 est déjà ouvert&quot;
Case &quot;ERR&quot; &amp; ERRMETHOD : sLocal = &quot;La méthode &apos;%0&apos; n&apos;est pas applicable dans ce contexte&quot;
Case &quot;ERR&quot; &amp; ERRPROPERTYINIT : sLocal = &quot;Propriété &apos;%0&apos; applicable mais non initialisée&quot;
Case &quot;ERR&quot; &amp; ERRFILENOTCREATED : sLocal = &quot;Erreur de création du fichier &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERRDIALOGNOTFOUND : sLocal = &quot;Dialogue &apos;%0&apos; introuvable dans les librairies chargées actuellement&quot;
Case &quot;ERR&quot; &amp; ERRDIALOGUNDEFINED : sLocal = &quot;Boîte de dialogue inconnue&quot;
Case &quot;ERR&quot; &amp; ERRDIALOGSTARTED : sLocal = &quot;Dialogue déjà initialisé précédemment&quot;
Case &quot;ERR&quot; &amp; ERRDIALOGNOTSTARTED : sLocal = &quot;Dialogue &apos;%0&apos; non initialisé&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETNODATA : sLocal = &quot;Recordset n&apos;a pas fourni de données. Toute action sur les enregistrements est rejetée&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETCLOSED : sLocal = &quot;Recordset a été clôturé. Action sur l&apos;enregistrement courant est rejetée&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETRANGE : sLocal = &quot;L&apos;enregistrement courant est hors cadre&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETFORWARD : sLocal = &quot;Action rejetée car recordset lisible seulement vers l&apos;avant ou n&apos;acceptant pas de signets&quot;
Case &quot;ERR&quot; &amp; ERRFIELDNULL : sLocal = &quot;Champ nul ou vide. Action rejetée&quot;
Case &quot;ERR&quot; &amp; ERRFILEACCESS : sLocal = &quot;Erreur d&apos;accès au fichier &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERROVERFLOW : sLocal = &quot;La longueur du champ (%0) dépasse la taille maximale autorisée. Utiliser de préférence la méthode &apos;%1&apos;&quot;
Case &quot;ERR&quot; &amp; ERRNOTACTIONQUERY : sLocal = &quot;La requête &apos;%0&apos; n&apos;est pas une requête d&apos;action&quot;
Case &quot;ERR&quot; &amp; ERRNOTUPDATABLE : sLocal = &quot;La banque de données, le recordset ou le champ sont en lecture seulement&quot;
Case &quot;ERR&quot; &amp; ERRUPDATESEQUENCE : sLocal = &quot;Erreur de séquence lors de la mise à jour d&apos;un Recordset&quot;
Case &quot;ERR&quot; &amp; ERRNOTNULLABLE : sLocal = &quot;Le champ &apos;%0&apos; ne peut pas recevoir une valeur NULLe&quot;
Case &quot;ERR&quot; &amp; ERRROWDELETED : sLocal = &quot;L&apos;enregistrement courant a été effacé par un autre processus ou un autre utilisateur&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETCLONE : sLocal = &quot;Le clonage d&apos;un Recordset cloné est interdit&quot;
Case &quot;ERR&quot; &amp; ERRQUERYDEFDELETED : sLocal = &quot;La requête existante &apos;%0&apos; a été supprimée&quot;
Case &quot;ERR&quot; &amp; ERRTABLEDEFDELETED : sLocal = &quot;La table existante &apos;%0&apos; a été supprimée&quot;
Case &quot;ERR&quot; &amp; ERRTABLECREATION : sLocal = &quot;La table &apos;%0&apos; n&apos;a pas pu être créée&quot;
Case &quot;ERR&quot; &amp; ERRFIELDCREATION : sLocal = &quot;Le champ &apos;%0&apos; n&apos;a pas pu être créé&quot;
Case &quot;ERR&quot; &amp; ERRSUBFORMNOTFOUND : sLocal = &quot;Sous-formulaire &apos;%0&apos; non trouvé dans le formulaire parent &apos;%1&apos;&quot;
Case &quot;ERR&quot; &amp; ERRWINDOW : sLocal = &quot;La fenêtre courante n&apos;est pas un document&quot;
Case &quot;ERR&quot; &amp; ERRCOMPATIBILITY : sLocal = &quot;Le champ &apos;%0&apos; n&apos;a pas pu être converti à cause d&apos;une incompatibilité entre les types de champs supportés par les systèmes de bases de données respectifs&quot;
Case &quot;ERR&quot; &amp; ERRPRECISION : sLocal = &quot;Le champ &apos;%0&apos; n&apos;a pas pu être chargé dans l&apos;enregistrement #%1 par manque de capacité&quot;
Case &quot;ERR&quot; &amp; ERRMODULENOTFOUND : sLocal = &quot;Le module &apos;%0&apos; est introuvable dans les librairies chargées actuellement&quot;
Case &quot;ERR&quot; &amp; ERRPROCEDURENOTFOUND : sLocal = &quot;La procédure &apos;%0&apos; est introuvable dans le module &apos;%1&apos;&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case &quot;OBJECT&quot; : sLocal = &quot;Objet&quot;
Case &quot;TABLE&quot; : sLocal = &quot;Table&quot;
Case &quot;QUERY&quot; : slocal = &quot;Requête&quot;
Case &quot;FORM&quot; : sLocal = &quot;Formulaire&quot;
Case &quot;REPORT&quot; : sLocal = &quot;Rapport&quot;
Case &quot;RECORDSET&quot; : sLocal = &quot;Recordset&quot;
Case &quot;FIELD&quot; : sLocal = &quot;Champ&quot;
Case &quot;TEMPVAR&quot; : sLocal = &quot;Variable temporaire&quot;
Case &quot;COMMANDBAR&quot; : sLocal = &quot;Barre de commande&quot;
Case &quot;COMMANDBARCONTROL&quot; : sLocal = &quot;Elément de barre de commande&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case &quot;ERR#&quot; : sLocal = &quot;L&apos;erreur #&quot;
Case &quot;ERROCCUR&quot; : sLocal = &quot;s&apos;est produite&quot;
Case &quot;ERRLINE&quot; : sLocal = &quot;à la ligne&quot;
Case &quot;ERRIN&quot; : sLocal = &quot;dans&quot;
Case &quot;CALLTO&quot; : sLocal = &quot;un appel à la fonction&quot;
Case &quot;SAVECONSOLE&quot; : sLocal = &quot;Sauver console&quot;
Case &quot;SAVECONSOLEENTRIES&quot; : sLocal = &quot;Les entrées de la console ont été sauvées avec succès.&quot;
Case &quot;QUITSHORT&quot; : sLocal = &quot;Quitter&quot;
Case &quot;QUIT&quot; : sLocal = &quot;Voulez-vous réellement quitter l&apos;application ? Les données modifiées seront sauvées.&quot;
Case &quot;ENTERING&quot; : sLocal = &quot;Entrée dans&quot;
Case &quot;EXITING&quot; : sLocal = &quot;Sortie de&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case &quot;DLGTRACE_HELP&quot; : sLocal = &quot;Gestion du tampon de la console et toutes ses entrées&quot;
Case &quot;DLGTRACE_TITLE&quot; : sLocal = &quot;Console&quot;
Case &quot;DLGTRACE_LBLENTRIES_HELP&quot; : sLocal = &quot;Effacer la liste et redimensionner le tampon circulaire&quot;
Case &quot;DLGTRACE_LBLENTRIES_LABEL&quot; : sLocal = &quot;Définir le nombre maximum d&apos;entrées&quot;
Case &quot;DLGTRACE_TXTTRACELOG_HELP&quot; : sLocal = &quot;Le texte peut être sélectionné, copié, ...&quot;
Case &quot;DLGTRACE_TXTTRACELOG_TEXT&quot; : sLocal = &quot;--- Le fichier journal est vide ---&quot;
Case &quot;DLGTRACE_CMDCANCEL_HELP&quot; : sLocal = &quot;Annuler et fermer la boîte de dialogue&quot;
Case &quot;DLGTRACE_CMDCANCEL_LABEL&quot; : sLocal = &quot;Annuler&quot;
Case &quot;DLGTRACE_LBLCLEAR_HELP&quot; : sLocal = &quot;Effacer la liste&quot;
Case &quot;DLGTRACE_LBLCLEAR_LABEL&quot; : sLocal = &quot;Effacer la liste&quot;
Case &quot;DLGTRACE_LBLMINLEVEL_HELP&quot; : sLocal = &quot;N&apos;enregistrer que les demandes de journalisation à partir du niveau indiqué&quot;
Case &quot;DLGTRACE_LBLMINLEVEL_LABEL&quot; : sLocal = &quot;Définir le niveau minimal d&apos;enregistrement&quot;
Case &quot;DLGTRACE_CMDOK_HELP&quot; : sLocal = &quot;Valider&quot;
Case &quot;DLGTRACE_CMDOK_LABEL&quot; : sLocal = &quot;OK&quot;
Case &quot;DLGTRACE_CMDDUMP_HELP&quot; : sLocal = &quot;Sélectionner un fichier et y vider le contenu actuel des traces enregistrées&quot;
Case &quot;DLGTRACE_CMDDUMP_LABEL&quot; : sLocal = &quot;Vider dans fichier&quot;
Case &quot;DLGTRACE_LBLNBENTRIES_HELP&quot; : sLocal = &quot;Taille actuelle de la liste&quot;
Case &quot;DLGTRACE_LBLNBENTRIES_LABEL&quot; : sLocal = &quot;Nombre actuel d&apos;entrées:&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case &quot;DLGFORMAT_HELP&quot; : sLocal = &quot;Exporter le formulaire&quot;
Case &quot;DLGFORMAT_TITLE&quot; : sLocal = &quot;OutputTo&quot;
Case &quot;DLGFORMAT_LBLFORMAT_HELP&quot; : sLocal = &quot;Format dans lequel le formulaire sera exporté&quot;
Case &quot;DLGFORMAT_LBLFORMAT_LABEL&quot; : sLocal = &quot;Selectionner le format de sortie&quot;
Case &quot;DLGFORMAT_CMDOK_HELP&quot; : sLocal = &quot;Valider votre choix&quot;
Case &quot;DLGFORMAT_CMDOK_LABEL&quot; : sLocal = &quot;OK&quot;
Case &quot;DLGFORMAT_CMDCANCEL_HELP&quot; : sLocal = &quot;Annuler et fermer la boîte de dialogue&quot;
Case &quot;DLGFORMAT_CMDCANCEL_LABEL&quot; : sLocal = &quot;Annuler&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case Else : sLocal = _Getlabel(psShortLabel, &quot;DEFAULT&quot;)
End Select
&apos;********************************************************
&apos;Translated by Iñigo Zuluaga
&apos;********************************************************
Case &quot;ES&quot; &apos;(España)
Select Case UCase(psShortlabel)
Case &quot;ERR&quot; &amp; ERRDBNOTCONNECTED : sLocal = &quot;No se ha encontrado una conexión activa a una base de datos&quot;
Case &quot;ERR&quot; &amp; ERRMISSINGARGUMENTS : sLocal = &quot;Faltan argumentos o no están inicializados&quot;
Case &quot;ERR&quot; &amp; ERRWRONGARGUMENT : sLocal = &quot;El argumento nr. %0 [Value = &apos;%1&apos;] no es válido&quot;
Case &quot;ERR&quot; &amp; ERRMAINFORM : sLocal = &quot;El documento &apos;%0&apos; no contiene ningún formulario&quot;
Case &quot;ERR&quot; &amp; ERRFORMNOTIDENTIFIED : sLocal = &quot;No se ha identificado el formulario &apos;%0&apos; en el conjunto de formularios de la base de datos&quot;
Case &quot;ERR&quot; &amp; ERRFORMNOTFOUND : sLocal = &quot;No se ha encontrado el formulario &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERRFORMNOTOPEN : sLocal = &quot;El formulario &apos;%0&apos; no está abierto&quot;
Case &quot;ERR&quot; &amp; ERRDFUNCTION : sLocal = &quot;La ejecución de DFunction falló, SQL=%0&quot;
Case &quot;ERR&quot; &amp; ERROPENFORM : sLocal = &quot;El formulario &apos;%0&apos; no se puede abrir&quot;
Case &quot;ERR&quot; &amp; ERRPROPERTY : sLocal = &quot;La propiedad &apos;%0&apos; no es aplicable en este contexto&quot;
Case &quot;ERR&quot; &amp; ERRPROPERTYVALUE : sLocal = &quot;El valor &apos;%0&apos; es inválido para la propiedad &apos;%1&apos;&quot;
Case &quot;ERR&quot; &amp; ERRINDEXVALUE : sLocal = &quot;Fuera del rango de la matriz o tamaño incorrecto de la matriz para la propiedad &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERRCOLLECTION : sLocal = &quot;Fuera del rango de la matriz&quot;
Case &quot;ERR&quot; &amp; ERRPROPERTYNOTARRAY : sLocal = &quot;El argumento nr.%0 debería ser una matriz&quot;
Case &quot;ERR&quot; &amp; ERRCONTROLNOTFOUND : sLocal = &quot;El control &apos;%0&apos; not found in parent (formulario, control de tabla or diálogo) &apos;%1&apos;&quot;
Case &quot;ERR&quot; &amp; ERRNOACTIVEFORM : sLocal = &quot;No se ha encontrado un formulario o control activo&quot;
Case &quot;ERR&quot; &amp; ERRDATABASEFORM : sLocal = &quot;El formulario &apos;%0&apos; no tiene datos subyacentes&quot;
Case &quot;ERR&quot; &amp; ERRFOCUSINGRID : sLocal = &quot;No se ha encontrado el control &apos;%0&apos; en el control de tabla &apos;%1&apos;&quot;
Case &quot;ERR&quot; &amp; ERRNOGRIDINFORM : sLocal = &quot;No se ha encontrado un control de tabla en el formulario &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERRFINDRECORD : sLocal = &quot;FindNext() tiene que ser precedido por una llamada exitosa de FindRecord(...)&quot;
Case &quot;ERR&quot; &amp; ERRSQLSTATEMENT : sLocal = &quot;Error SQL, instrución SQL = &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERROBJECTNOTFOUND : sLocal = &quot;%0 &apos;%1&apos; no encontrado&quot;
Case &quot;ERR&quot; &amp; ERROPENOBJECT : sLocal = &quot;%0 &apos;%1&apos; no se puede abrir&quot;
Case &quot;ERR&quot; &amp; ERRCLOSEOBJECT : sLocal = &quot;%0 &apos;%1&apos; no se puede abrir&quot;
Case &quot;ERR&quot; &amp; ERRACTION : sLocal = &quot;Acción no aplicable en este contexto&quot;
Case &quot;ERR&quot; &amp; ERRSENDMAIL : sLocal = &quot;No se puede activar el servicio de correo&quot;
Case &quot;ERR&quot; &amp; ERRFORMYETOPEN : sLocal = &quot;El formulario %0 ya está abierto&quot;
Case &quot;ERR&quot; &amp; ERRMETHOD : sLocal = &quot;El método &apos;%0&apos; no es aplicable en este contexto&quot;
Case &quot;ERR&quot; &amp; ERRPROPERTYINIT : sLocal = &quot;Propiedad &apos;%0&apos; aplicable pero no inicializada&quot;
Case &quot;ERR&quot; &amp; ERRFILENOTCREATED : sLocal = &quot;No se ha podido crear el archivo &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERRDIALOGNOTFOUND : sLocal = &quot;No se ha encontrado el diálogo &apos;%0&apos; en las bibliotecas cargadas actualmente&quot;
Case &quot;ERR&quot; &amp; ERRDIALOGUNDEFINED : sLocal = &quot;Diálogo desconocido&quot;
Case &quot;ERR&quot; &amp; ERRDIALOGSTARTED : sLocal = &quot;El diálogo ya está iniciado&quot;
Case &quot;ERR&quot; &amp; ERRDIALOGNOTSTARTED : sLocal = &quot;El diálogo &apos;%0&apos; no está activo&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETNODATA : sLocal = &quot;El Recordset no suministra datos. La acción en el registro actual rechazada&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETCLOSED : sLocal = &quot;El recorset se ha cerrado. Acción con el Recordset rechazada&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETRANGE : sLocal = &quot;Registro actual fuera de rango&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETFORWARD : sLocal = &quot;Acción rechazada en un recorset legible sólo hacia adelante o que no admita marcadores&quot;
Case &quot;ERR&quot; &amp; ERRFIELDNULL : sLocal = &quot;El campo es nulo o vacío. Acción rechazada&quot;
Case &quot;ERR&quot; &amp; ERRFILEACCESS : sLocal = &quot;Error durante el acceso al archivo &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERROVERFLOW : sLocal = &quot;La longitud del campo (%0) excede la longitud máxima. Reemplazar por el método &apos;%1&apos;&quot;
Case &quot;ERR&quot; &amp; ERRNOTACTIONQUERY : sLocal = &quot;La consulta &apos;%0&apos; no es una consulta de acción&quot;
Case &quot;ERR&quot; &amp; ERRNOTUPDATABLE : sLocal = &quot;La base de datos, el Recordset o el Campo es de sólo lectura&quot;
Case &quot;ERR&quot; &amp; ERRUPDATESEQUENCE : sLocal = &quot;Error durante la secuencia de actualización del Recordset&quot;
Case &quot;ERR&quot; &amp; ERRNOTNULLABLE : sLocal = &quot;El campo &apos;%0&apos; no puede contener un valor NULL&quot;
Case &quot;ERR&quot; &amp; ERRROWDELETED : sLocal = &quot;La fila actual ha sido borrada por otro proceso o usuario&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETCLONE : sLocal = &quot;No se puede clonar un Recordset clonado&quot;
Case &quot;ERR&quot; &amp; ERRQUERYDEFDELETED : sLocal = &quot;Se ha borrado la consulta pre-existente &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERRTABLEDEFDELETED : sLocal = &quot;Se ha borrado la tabla pre-existente &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERRTABLECREATION : sLocal = &quot;No se ha podido crear la Tabla &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERRFIELDCREATION : sLocal = &quot;No se ha podido crear el campo &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERRSUBFORMNOTFOUND : sLocal = &quot;No se ha encontrado el Subformulario &apos;%0&apos; en el subformulario padre &apos;%1&apos;&quot;
Case &quot;ERR&quot; &amp; ERRWINDOW : sLocal = &quot;La ventana actual no es un documento&quot;
Case &quot;ERR&quot; &amp; ERRCOMPATIBILITY : sLocal = &quot;El campo &apos;%0&apos; no se ha convertido debido a una incompatibilidad de los tipos de campo soportados entre las dos bases de datos&quot;
Case &quot;ERR&quot; &amp; ERRPRECISION : sLocal = &quot;El campo &apos;%0&apos; no se ha cargado en el registro #%1 por falta de capacidad&quot;
Case &quot;ERR&quot; &amp; ERRMODULENOTFOUND : sLocal = &quot;Module &apos;%0&apos; not found in the currently loaded libraries&quot;
Case &quot;ERR&quot; &amp; ERRPROCEDURENOTFOUND : sLocal = &quot;Procedure &apos;%0&apos; not found in module &apos;%1&apos;&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case &quot;OBJECT&quot; : sLocal = &quot;Objeto&quot;
Case &quot;TABLE&quot; : sLocal = &quot;Tabla&quot;
Case &quot;QUERY&quot; : slocal = &quot;Consulta&quot;
Case &quot;FORM&quot; : sLocal = &quot;Formulario&quot;
Case &quot;REPORT&quot; : sLocal = &quot;Informe&quot;
Case &quot;RECORDSET&quot; : sLocal = &quot;Recordset&quot;
Case &quot;FIELD&quot; : sLocal = &quot;Campo&quot;
Case &quot;TEMPVAR&quot; : sLocal = &quot;Variable temporal&quot;
Case &quot;COMMANDBAR&quot; : sLocal = &quot;Barra de comandos&quot;
Case &quot;COMMANDBARCONTROL&quot; : sLocal = &quot;Control de barra de comandos&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case &quot;ERR#&quot; : sLocal = &quot;Error #&quot;
Case &quot;ERROCCUR&quot; : sLocal = &quot;ocurrido&quot;
Case &quot;ERRLINE&quot; : sLocal = &quot;en línea&quot;
Case &quot;ERRIN&quot; : sLocal = &quot;en&quot;
Case &quot;CALLTO&quot; : sLocal = &quot;una llamada a la función&quot;
Case &quot;SAVECONSOLE&quot; : sLocal = &quot;Guardar consola&quot;
Case &quot;SAVECONSOLEENTRIES&quot; : sLocal = &quot;Las entradas de la consola han sido guardadas correctamente.&quot;
Case &quot;QUITSHORT&quot; : sLocal = &quot;Cerrar&quot;
Case &quot;QUIT&quot; : sLocal = &quot;Quieres realmente cerrar la aplicación? los datos cambiados se guardarán.&quot;
Case &quot;ENTERING&quot; : sLocal = &quot;Entrando&quot;
Case &quot;EXITING&quot; : sLocal = &quot;Saliendo&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case &quot;DLGTRACE_HELP&quot; : sLocal = &quot;Gestión del buffer de la consola y sus entradas&quot;
Case &quot;DLGTRACE_TITLE&quot; : sLocal = &quot;Consola&quot;
Case &quot;DLGTRACE_LBLENTRIES_HELP&quot; : sLocal = &quot;Limpiar la lista y redimensionar el buffer circular&quot;
Case &quot;DLGTRACE_LBLENTRIES_LABEL&quot; : sLocal = &quot;Definir el número máximo de entradas&quot;
Case &quot;DLGTRACE_TXTTRACELOG_HELP&quot; : sLocal = &quot;El texto puede ser seleccionado, copiado, ...&quot;
Case &quot;DLGTRACE_TXTTRACELOG_TEXT&quot; : sLocal = &quot;--- El archivo Histórico está vacío ---&quot;
Case &quot;DLGTRACE_CMDCANCEL_HELP&quot; : sLocal = &quot;Cancelar y cerrar el diálogo&quot;
Case &quot;DLGTRACE_CMDCANCEL_LABEL&quot; : sLocal = &quot;Cancelar&quot;
Case &quot;DLGTRACE_LBLCLEAR_HELP&quot; : sLocal = &quot;Limpiar la lista&quot;
Case &quot;DLGTRACE_LBLCLEAR_LABEL&quot; : sLocal = &quot;Limpiar la lista&quot;
Case &quot;DLGTRACE_LBLMINLEVEL_HELP&quot; : sLocal = &quot;No registrar más que las peticiones de registro a partir de un nivel indicado&quot;
Case &quot;DLGTRACE_LBLMINLEVEL_LABEL&quot; : sLocal = &quot;Definir el nivel mínimo de registro&quot;
Case &quot;DLGTRACE_CMDOK_HELP&quot; : sLocal = &quot;Validar&quot;
Case &quot;DLGTRACE_CMDOK_LABEL&quot; : sLocal = &quot;Aceptar&quot;
Case &quot;DLGTRACE_CMDDUMP_HELP&quot; : sLocal = &quot;Elegir un archivo y guardar en él el contenido de la lista actual&quot;
Case &quot;DLGTRACE_CMDDUMP_LABEL&quot; : sLocal = &quot;Guardar en a archivo&quot;
Case &quot;DLGTRACE_LBLNBENTRIES_HELP&quot; : sLocal = &quot;Tamaño actual de la lista&quot;
Case &quot;DLGTRACE_LBLNBENTRIES_LABEL&quot; : sLocal = &quot;Numero actual de entradas:&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case &quot;DLGFORMAT_HELP&quot; : sLocal = &quot;Exportar el formulario&quot;
Case &quot;DLGFORMAT_TITLE&quot; : sLocal = &quot;Exportar como&quot;
Case &quot;DLGFORMAT_LBLFORMAT_HELP&quot; : sLocal = &quot;Formato en el que será ser exportado el formulario&quot;
Case &quot;DLGFORMAT_LBLFORMAT_LABEL&quot; : sLocal = &quot;Seleccionar el formato de salida&quot;
Case &quot;DLGFORMAT_CMDOK_HELP&quot; : sLocal = &quot;Validar su elección&quot;
Case &quot;DLGFORMAT_CMDOK_LABEL&quot; : sLocal = &quot;Aceptar&quot;
Case &quot;DLGFORMAT_CMDCANCEL_HELP&quot; : sLocal = &quot;Cancelar y cerrar el diálogo&quot;
Case &quot;DLGFORMAT_CMDCANCEL_LABEL&quot; : sLocal = &quot;Cancelar&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case Else : sLocal = _Getlabel(psShortLabel, &quot;DEFAULT&quot;)
End Select
&apos;********************************************************
&apos;Translated by Gisbert Friege
&apos;********************************************************
Case &quot;DE&quot;
Select Case UCase(psShortlabel)
Case &quot;ERR&quot; &amp; ERRDBNOTCONNECTED : sLocal = &quot;Keine aktive Verbindung zu einer Datenbank gefunden&quot;
Case &quot;ERR&quot; &amp; ERRMISSINGARGUMENTS : sLocal = &quot;Argumente fehlen oder sind nicht initialisiert&quot;
Case &quot;ERR&quot; &amp; ERRWRONGARGUMENT : sLocal = &quot;Argument Nr. %0 [Wert = &apos;%1&apos;] ist ungültig&quot;
Case &quot;ERR&quot; &amp; ERRMAINFORM : sLocal = &quot;Dokument &apos;%0&apos; enthält kein Formular&quot;
Case &quot;ERR&quot; &amp; ERRFORMNOTIDENTIFIED : sLocal = &quot;Formular &apos;%0&apos; nicht bei den Datenbank-Formularen erkannt&quot;
Case &quot;ERR&quot; &amp; ERRFORMNOTFOUND : sLocal = &quot;Formular &apos;%0&apos; nicht gefunden&quot;
Case &quot;ERR&quot; &amp; ERRFORMNOTOPEN : sLocal = &quot;Formular &apos;%0&apos; ist zur Zeit nicht offen&quot;
Case &quot;ERR&quot; &amp; ERRDFUNCTION : sLocal = &quot;DFunction Ausführung misslungen, SQL=%0&quot;
Case &quot;ERR&quot; &amp; ERROPENFORM : sLocal = &quot;Formular &apos;%0&apos; konnte nicht geöffnet werden&quot;
Case &quot;ERR&quot; &amp; ERRPROPERTY : sLocal = &quot;Eigenschaft &apos;%0&apos; in diesem Kontext nicht anwendbar&quot;
Case &quot;ERR&quot; &amp; ERRPROPERTYVALUE : sLocal = &quot;Wert &apos;%0&apos; ist ungültig für die Eigenschaft &apos;%1&apos;&quot;
Case &quot;ERR&quot; &amp; ERRINDEXVALUE : sLocal = &quot;Außerhalb des Array-Bereichs oder falsche Array-Größe für Eigenschaft &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERRCOLLECTION : sLocal = &quot;Außerhalb des Array-Bereichs&quot;
Case &quot;ERR&quot; &amp; ERRPROPERTYNOTARRAY : sLocal = &quot;Argument Nr.%0 sollte ein Array sein&quot;
Case &quot;ERR&quot; &amp; ERRCONTROLNOTFOUND : sLocal = &quot;Steuerelement &apos;%0&apos; nicht gefunden in parent (Formular, Tabelle oder Dialog) &apos;%1&apos;&quot;
Case &quot;ERR&quot; &amp; ERRNOACTIVEFORM : sLocal = &quot;Kein aktives Formular oder Steuerelement gefunden&quot;
Case &quot;ERR&quot; &amp; ERRDATABASEFORM : sLocal = &quot;Formular &apos;%0&apos; basiert nicht auf einem Datensatz&quot;
Case &quot;ERR&quot; &amp; ERRFOCUSINGRID : sLocal = &quot;Steuerelement &apos;%0&apos; im Tabellen-Steuerelement &apos;%1&apos; nicht gefunden&quot;
Case &quot;ERR&quot; &amp; ERRNOGRIDINFORM : sLocal = &quot;Kein Tabellen-Steuerelement im Formular &apos;%0&apos; gefunden&quot;
Case &quot;ERR&quot; &amp; ERRFINDRECORD : sLocal = &quot;Bei FindNext() muss ein erfolgreicher FindRecord(...)-Aufruf vorhergehen&quot;
Case &quot;ERR&quot; &amp; ERRSQLSTATEMENT : sLocal = &quot;SQL Error, SQL statement = &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERROBJECTNOTFOUND : sLocal = &quot;%0 &apos;%1&apos; nicht gefunden&quot;
Case &quot;ERR&quot; &amp; ERROPENOBJECT : sLocal = &quot;%0 &apos;%1&apos; konnte nicht geöffnet werden&quot;
Case &quot;ERR&quot; &amp; ERRCLOSEOBJECT : sLocal = &quot;%0 &apos;%1&apos; konnte nicht geschlossen werden&quot;
Case &quot;ERR&quot; &amp; ERRACTION : sLocal = &quot;Aktion in diesem Kontext nicht anwendbar&quot;
Case &quot;ERR&quot; &amp; ERRSENDMAIL : sLocal = &quot;Email-Dienst konnte nicht aktiviert werden&quot;
Case &quot;ERR&quot; &amp; ERRFORMYETOPEN : sLocal = &quot;Formular %0 ist schon offen&quot;
Case &quot;ERR&quot; &amp; ERRMETHOD : sLocal = &quot;Methode &apos;%0&apos; in diesem Kontext nicht anwendbar&quot;
Case &quot;ERR&quot; &amp; ERRPROPERTYINIT : sLocal = &quot;Eigenschaft &apos;%0&apos; anwendbar aber nicht initialisiert&quot;
Case &quot;ERR&quot; &amp; ERRFILENOTCREATED : sLocal = &quot;Datei &apos;%0&apos; konnte nicht erzeugt werden&quot;
Case &quot;ERR&quot; &amp; ERRDIALOGNOTFOUND : sLocal = &quot;Dialog &apos;%0&apos; nicht in den aktuell geladenen Bibliotheken gefunden&quot;
Case &quot;ERR&quot; &amp; ERRDIALOGUNDEFINED : sLocal = &quot;Dialog unbekannt&quot;
Case &quot;ERR&quot; &amp; ERRDIALOGSTARTED : sLocal = &quot;Dialog schon gestartet&quot;
Case &quot;ERR&quot; &amp; ERRDIALOGNOTSTARTED : sLocal = &quot;Dialog &apos;%0&apos; nicht aktiv&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETNODATA : sLocal = &quot;Datensatz ergab keine Daten. Aktion auf aktuellem Datensatz verweigert&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETCLOSED : sLocal = &quot;Datensatz wurde geschlossen. Datensatz-Aktion verweigert&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETRANGE : sLocal = &quot;Aktueller Datensatz außerhalb des Bereichs&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETFORWARD : sLocal = &quot;Aktion verweigert auf einem nur vorwärts lesbaren oder keine Textmarken unterstützenden Datensatz&quot;
Case &quot;ERR&quot; &amp; ERRFIELDNULL : sLocal = &quot;Feld ist null oder leer. Aktion verweigert&quot;
Case &quot;ERR&quot; &amp; ERRFILEACCESS : sLocal = &quot;Dateizugriffs-Fehler bei Datei &apos;%0&apos;&quot;
Case &quot;ERR&quot; &amp; ERROVERFLOW : sLocal = &quot;Feldlänge (%0) überschreitet die maximale Länge. Verwende stattdessen die Methode &apos;%1&apos;&quot;
Case &quot;ERR&quot; &amp; ERRNOTACTIONQUERY : sLocal = &quot;Abfrage &apos;%0&apos; ist keine Aktionsabfrage&quot;
Case &quot;ERR&quot; &amp; ERRNOTUPDATABLE : sLocal = &quot;Datenbank, Datensatz oder Feld kann nur gelesen werden&quot;
Case &quot;ERR&quot; &amp; ERRUPDATESEQUENCE : sLocal = &quot;Datensatz-Update Folgefehler&quot;
Case &quot;ERR&quot; &amp; ERRNOTNULLABLE : sLocal = &quot;Feld &apos;%0&apos; darf keinen NULL-Wert haben&quot;
Case &quot;ERR&quot; &amp; ERRROWDELETED : sLocal = &quot;Aktuelle Zeile wurde durch einen anderen Prozess oder Benutzer gelösch&quot;
Case &quot;ERR&quot; &amp; ERRRECORDSETCLONE : sLocal = &quot;Ein geklonter Datensatz kann nicht geklont werden&quot;
Case &quot;ERR&quot; &amp; ERRQUERYDEFDELETED : sLocal = &quot;Bereits vorhandene Abfrage &apos;%0&apos; wurde gelöscht&quot;
Case &quot;ERR&quot; &amp; ERRTABLEDEFDELETED : sLocal = &quot;Bereits vorhandene Tabelle &apos;%0&apos; wurde gelöscht&quot;
Case &quot;ERR&quot; &amp; ERRTABLECREATION : sLocal = &quot;Tabelle &apos;%0&apos; konnte nicht erzeugt werden&quot;
Case &quot;ERR&quot; &amp; ERRFIELDCREATION : sLocal = &quot;Feld &apos;%0&apos; konnte nicht erzeugt werden&quot;
Case &quot;ERR&quot; &amp; ERRSUBFORMNOTFOUND : sLocal = &quot;Unterformular &apos;%0&apos; nicht im Eltern-Formular &apos;%1‘ gefunden&quot;
Case &quot;ERR&quot; &amp; ERRWINDOW : sLocal = &quot;Aktuelles Fenster ist kein Dokument&quot;
Case &quot;ERR&quot; &amp; ERRCOMPATIBILITY : sLocal = &quot;Feld &apos;%0&apos; konnte wegen inkompatibler Feldtypen der Datenbanksysteme nicht konvertiert werden&quot;
Case &quot;ERR&quot; &amp; ERRPRECISION : sLocal = &quot;Feld &apos;%0&apos; konnte wegen fehlender Speicherkapazität nicht in den Datensatz #%1 geladen werden&quot;
Case &quot;ERR&quot; &amp; ERRMODULENOTFOUND : sLocal = &quot;Modul &apos;%0&apos; nicht gefunden in den aktuell geladen Bibliotheken&quot;
Case &quot;ERR&quot; &amp; ERRPROCEDURENOTFOUND : sLocal = &quot;Prozedur &apos;%0&apos; im Modul &apos;%1&apos; nicht gefunden&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case &quot;OBJECT&quot; : sLocal = &quot;Objekt&quot;
Case &quot;TABLE&quot; : sLocal = &quot;Tabelle&quot;
Case &quot;QUERY&quot; : slocal = &quot;Abfrage&quot;
Case &quot;FORM&quot; : sLocal = &quot;Formular&quot;
Case &quot;REPORT&quot; : sLocal = &quot;Report&quot;
Case &quot;RECORDSET&quot; : sLocal = &quot;Datensatz&quot;
Case &quot;FIELD&quot; : sLocal = &quot;Feld&quot;
Case &quot;TEMPVAR&quot; : sLocal = &quot;Temporäre Variable&quot;
Case &quot;COMMANDBAR&quot; : sLocal = &quot;Befehlsleiste&quot;
Case &quot;COMMANDBARCONTROL&quot; : sLocal = &quot;Befehlsleisten-Steuerelement&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case &quot;ERR#&quot; : sLocal = &quot;Error #&quot;
Case &quot;ERROCCUR&quot; : sLocal = &quot;aufgetreten&quot;
Case &quot;ERRLINE&quot; : sLocal = &quot;in Zeile&quot;
Case &quot;ERRIN&quot; : sLocal = &quot;in&quot;
Case &quot;CALLTO&quot; : sLocal = &quot;ein Funktionsaufruf&quot;
Case &quot;SAVECONSOLE&quot; : sLocal = &quot;Konsoleneingaben sichern&quot;
Case &quot;SAVECONSOLEENTRIES&quot; : sLocal = &quot;Die Konsoleneingaben wurden erfolgreich gesichert.&quot;
Case &quot;QUITSHORT&quot; : sLocal = &quot;Beenden&quot;
Case &quot;QUIT&quot; : sLocal = &quot;Wollen Sie wirklich die Anwendung beenden? Geänderte Daten werden gesichert.&quot;
Case &quot;ENTERING&quot; : sLocal = &quot;Beginne mit&quot;
Case &quot;EXITING&quot; : sLocal = &quot;Verlasse&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case &quot;DLGTRACE_HELP&quot; : sLocal = &quot;Verwalte den Konsolenpuffer und seine Eingaben&quot;
Case &quot;DLGTRACE_TITLE&quot; : sLocal = &quot;Konsole&quot;
Case &quot;DLGTRACE_LBLENTRIES_HELP&quot; : sLocal = &quot;Leere die Liste und ändere die Größe des Umlaufpuffers&quot;
Case &quot;DLGTRACE_LBLENTRIES_LABEL&quot; : sLocal = &quot;Setze maximale Anzahl von Eingaben&quot;
Case &quot;DLGTRACE_TXTTRACELOG_HELP&quot; : sLocal = &quot;Text kann ausgewählt, kopiert, ... werden&quot;
Case &quot;DLGTRACE_TXTTRACELOG_TEXT&quot; : sLocal = &quot;--- Log Datei ist leer ---&quot;
Case &quot;DLGTRACE_CMDCANCEL_HELP&quot; : sLocal = &quot;Abbrechen und den Dialog schließen&quot;
Case &quot;DLGTRACE_CMDCANCEL_LABEL&quot; : sLocal = &quot;Abbrechen&quot;
Case &quot;DLGTRACE_LBLCLEAR_HELP&quot; : sLocal = &quot;Leere die Liste&quot;
Case &quot;DLGTRACE_LBLCLEAR_LABEL&quot; : sLocal = &quot;Leere die Liste&quot;
Case &quot;DLGTRACE_LBLMINLEVEL_HELP&quot; : sLocal = &quot;Registriere nur Logging-Anfragen oberhalb des gegebenen Levels&quot;
Case &quot;DLGTRACE_LBLMINLEVEL_LABEL&quot; : sLocal = &quot;Setze minimalen Fehlerbehandlungs-Level&quot;
Case &quot;DLGTRACE_CMDOK_HELP&quot; : sLocal = &quot;Übernehmen&quot;
Case &quot;DLGTRACE_CMDOK_LABEL&quot; : sLocal = &quot;OK&quot;
Case &quot;DLGTRACE_CMDDUMP_HELP&quot; : sLocal = &quot;Wähle eine Datei und speichere darin den aktuellen Listeninhalt&quot;
Case &quot;DLGTRACE_CMDDUMP_LABEL&quot; : sLocal = &quot;Ausgabe in Datei&quot;
Case &quot;DLGTRACE_LBLNBENTRIES_HELP&quot; : sLocal = &quot;Aktuelle Länge der Liste&quot;
Case &quot;DLGTRACE_LBLNBENTRIES_LABEL&quot; : sLocal = &quot;Aktuelle Anzahl von Einträgen:&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case &quot;DLGFORMAT_HELP&quot; : sLocal = &quot;Exportiere das Formular&quot;
Case &quot;DLGFORMAT_TITLE&quot; : sLocal = &quot;Export&quot;
Case &quot;DLGFORMAT_LBLFORMAT_HELP&quot; : sLocal = &quot;Format, in dem das Formular exportiert werden soll&quot;
Case &quot;DLGFORMAT_LBLFORMAT_LABEL&quot; : sLocal = &quot;Wähle das Ausgabe-Format&quot;
Case &quot;DLGFORMAT_CMDOK_HELP&quot; : sLocal = &quot;Auswahl übernehmen&quot;
Case &quot;DLGFORMAT_CMDOK_LABEL&quot; : sLocal = &quot;OK&quot;
Case &quot;DLGFORMAT_CMDCANCEL_HELP&quot; : sLocal = &quot;Abbrechen und den Dialog schließen&quot;
Case &quot;DLGFORMAT_CMDCANCEL_LABEL&quot; : sLocal = &quot;Abbrechen&quot;
&apos;----------------------------------------------------------------------------------------------------------------------
Case Else : sLocal = _Getlabel(psShortLabel, &quot;DEFAULT&quot;)
End Select
REM *******************************************************************************************************************************************
REM *** ***
REM *** ANY OTHER LANGUAGE TO BE INSERTED HERE ***
REM *** ***
REM *******************************************************************************************************************************************
Case Else
sLocal = _Getlabel(psShortLabel, &quot;DEFAULT&quot;)
End Select
Exit_Function:
_Getlabel = sLocal
Exit Function
Error_Function:
sLocal = psShortLabel
GoTo Exit_Function
End Function &apos; GetLabel V0.8.9
REM -----------------------------------------------------------------------------------------------------------------------
Public Function _GetLabelArray(ByVal pvShortlabel As Variant, Optional ByVal psLocale As String) As Variant
&apos; Return the localized label corresponding with the ShortLabel array of strings
If IsMissing(psLocale) Then psLocale = UCase(Left(_GetLocale(), 2)) Else psLocale = UCase(psLocale)
On Local Error Goto Error_Function
Dim vLocal() As Variant, i As integer
vLocal = Array()
If Not IsArray(pvShortLabel) Then
vLocal = _GetLabel(pvShortLabel, psLocale)
Goto Exit_Function
End If
ReDim vLocal(LBound(pvShortLabel) To UBound(pvShortlabel))
For i = LBound(pvShortLabel) To UBound(pvShortlabel)
vLocal(i) = _GetLabel(pvShortLabel(i), psLocale)
Next i
Exit_Function:
_GetlabelArray = vLocal()
Exit Function
Error_Function:
vLocal = Array()
GoTo Exit_Function
End Function &apos; GetLabelArray V0.8.9
REM -----------------------------------------------------------------------------------------------------------------------
Public Function _GetLocale() as String
&apos;Return OO localization
&apos;Derived from Tools library
Dim oLocale as Object
oLocale = _GetRegistryKeyContent(&quot;org.openoffice.Setup/L10N&quot;)
_GetLocale = oLocale.getByName(&quot;ooLocale&quot;)
End Function &apos; GetLocale V0.8.9
</script:module>

View File

@@ -0,0 +1,300 @@
<?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="Methods" 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 Explicit
REM -----------------------------------------------------------------------------------------------------------------------
Public Function AddItem(Optional pvBox As Variant, ByVal Optional pvItem As Variant, ByVal Optional pvIndex) As Boolean
&apos; Add an item in a Listbox
Utils._SetCalledSub(&quot;AddItem&quot;)
If _ErrorHandler() Then On Local Error Goto Error_Function
If IsMissing(pvBox) Or IsMissing(pvItem) Then Call _TraceArguments()
If IsMissing(pvIndex) Then pvIndex = -1
If Not Utils._CheckArgument(pvBox, 1, Array(CTLLISTBOX, CTLCOMBOBOX)) Then Goto Exit_Function
AddItem = pvBox.AddItem(pvItem, pvIndex)
Exit_Function:
Utils._ResetCalledSub(&quot;AddItem&quot;)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;AddItem&quot;, Erl)
AddItem = False
GoTo Exit_Function
End Function &apos; AddItem V0.9.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function hasProperty(Optional pvObject As Variant, ByVal Optional pvProperty As Variant) As Boolean
&apos; Return True if pvObject has a valid property called pvProperty (case-insensitive comparison !)
Dim vPropertiesList As Variant
Utils._SetCalledSub(&quot;hasProperty&quot;)
If IsMissing(pvObject) Or IsMissing(pvProperty) Then Call _TraceArguments()
hasProperty = False
If Not Utils._CheckArgument(pvObject, 1, Array(OBJCOLLECTION, OBJFORM, OBJSUBFORM, OBJCONTROL, OBJOPTIONGROUP, OBJEVENT _
, OBJPROPERTY, OBJDATABASE, OBJQUERYDEF, OBJTABLEDEF, OBJRECORDSET _
)) Then Goto Exit_Function
If Not Utils._CheckArgument(pvProperty, 2, vbString) Then Goto Exit_Function
hasProperty = pvObject.hasProperty(pvProperty)
Exit_Function:
Utils._ResetCalledSub(&quot;hasProperty&quot;)
Exit Function
End Function &apos; hasProperty V0.9.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Move(Optional pvObject As Object _
, ByVal Optional pvLeft As Variant _
, ByVal Optional pvTop As Variant _
, ByVal Optional pvWidth As Variant _
, ByVal Optional pvHeight As Variant _
) As Variant
&apos; Execute Move method
Utils._SetCalledSub(&quot;Move&quot;)
If IsMissing(pvObject) Then Call _TraceArguments()
If _ErrorHandler() Then On Local Error Goto Error_Function
Move = False
If Not Utils._CheckArgument(pvObject, 1, Array(OBJFORM, OBJDIALOG)) Then Goto Exit_Function
If IsMissing(pvLeft) Then Call _TraceArguments()
If IsMissing(pvTop) Then pvTop = -1
If IsMissing(pvWidth) Then pvWidth = -1
If IsMissing(pvHeight) Then pvHeight = -1
Move = pvObject.Move(pvLeft, pvTop, pvWidth, pvHeight)
Exit_Function:
Utils._ResetCalledSub(&quot;Move&quot;)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;Move&quot;, Erl)
GoTo Exit_Function
End Function &apos; Move V.0.9.1
REM -----------------------------------------------------------------------------------------------------------------------
Public Function OpenHelpFile()
&apos; Open the help file from the Help menu (IDE only)
Const cstHelpFile = &quot;http://www.access2base.com/access2base.html&quot;
On Local Error Resume Next
Call _ShellExecute(cstHelpFile)
End Function &apos; OpenHelpFile V0.8.5
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Properties(Optional pvObject As Variant, ByVal Optional pvIndex As Variant) As Variant
&apos; Return
&apos; a Collection object if pvIndex absent
&apos; a Property object otherwise
Dim vProperties As Variant, oCounter As Variant, opProperty As Variant
Dim vPropertiesList() As Variant
If IsMissing(pvObject) Or IsEmpty(pvObject) Then Call _TraceArguments()
Utils._SetCalledSub(&quot;Properties&quot;)
Set vProperties = Nothing
If Not Utils._CheckArgument(pvObject, 1, Array(OBJCOLLECTION, OBJFORM, OBJSUBFORM, OBJCONTROL, OBJOPTIONGROUP, OBJEVENT _
, OBJPROPERTY, OBJDATABASE, OBJQUERYDEF, OBJTABLEDEF, OBJRECORDSET _
)) Then Goto Exit_Function
If IsMissing(pvIndex) Then vProperties = pvObject.Properties Else vProperties = pvObject.Properties(pvIndex)
Exit_Function:
Set Properties = vProperties
Utils._ResetCalledSub(&quot;Properties&quot;)
Exit Function
End Function &apos; Properties V0.9.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Refresh(Optional pvObject As Variant) As Boolean
&apos; Refresh data with its most recent value in the database in a form or subform
Utils._SetCalledSub(&quot;Refresh&quot;)
If IsMissing(pvObject) Then Call _TraceArguments()
If _ErrorHandler() Then On Local Error Goto Error_Function
Refresh = False
If Not Utils._CheckArgument(pvObject, 1, Array(OBJFORM, OBJSUBFORM)) Then Goto Exit_Function
Refresh = pvObject.Refresh()
Exit_Function:
Utils._ResetCalledSub(&quot;Refresh&quot;)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;Refresh&quot;, Erl)
GoTo Exit_Function
End Function &apos; Refresh V0.9.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function RemoveItem(Optional pvBox As Variant,ByVal Optional pvIndex) As Boolean
&apos; Remove an item from a Listbox
&apos; Index may be a string value or an index-position
Utils._SetCalledSub(&quot;RemoveItem&quot;)
If _ErrorHandler() Then On Local Error Goto Error_Function
If IsMissing(pvBox) Or IsMissing(pvIndex) Then Call _TraceArguments()
If Not Utils._CheckArgument(pvBox, 1, Array(CTLLISTBOX, CTLCOMBOBOX)) Then Goto Exit_Function
RemoveItem = pvBox.RemoveItem(pvIndex)
Exit_Function:
Utils._ResetCalledSub(&quot;RemoveItem&quot;)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;RemoveItem&quot;, Erl)
RemoveItem = False
GoTo Exit_Function
End Function &apos; RemoveItem V0.9.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Requery(Optional pvObject As Variant) As Boolean
&apos; Refresh data displayed in a form, subform, combobox or listbox
Utils._SetCalledSub(&quot;Requery&quot;)
If IsMissing(pvObject) Then Call _TraceArguments()
If _ErrorHandler() Then On Local Error Goto Error_Function
If Not Utils._CheckArgument(pvObject, 1, Array(OBJFORM, OBJCONTROL, OBJSUBFORM)) Then Goto Exit_Function
Requery = pvObject.Requery()
Exit_Function:
Utils._ResetCalledSub(&quot;Requery&quot;)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;Requery&quot;, Erl)
GoTo Exit_Function
End Function &apos; Requery V0.9.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function SetFocus(Optional pvObject As Variant) As Boolean
&apos; Execute SetFocus method
Utils._SetCalledSub(&quot;setFocus&quot;)
If IsMissing(pvObject) Then Call _TraceArguments()
If _ErrorHandler() Then On Local Error Goto Error_Function
If Not Utils._CheckArgument(pvObject, 1, Array(OBJFORM, OBJCONTROL)) Then Goto Exit_Function
SetFocus = pvObject.setFocus()
Exit_Function:
Utils._ResetCalledSub(&quot;SetFocus&quot;)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;SetFocus&quot;, Erl)
Goto Exit_Function
Error_Grid:
TraceError(TRACEFATAL, ERRFOCUSINGRID, Utils._CalledSub(), 0, 1, Array(pvObject._Name, ocGrid._Name))
Goto Exit_Function
End Function &apos; SetFocus V0.9.0
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
Public Function _OptionGroup(ByVal pvGroupName As Variant _
, ByVal psParentType As String _
, poComponent As Object _
, poParent As Object _
) As Variant
&apos; Return either an error or an object of type OPTIONGROUP based on its name
If IsMissing(pvGroupName) Then Call _TraceArguments()
If _ErrorHandler() Then On Local Error Goto Error_Function
Set _OptionGroup = Nothing
If Not Utils._CheckArgument(pvGroupName, 1, vbString) Then Goto Exit_Function
Dim ogGroup As Variant, i As Integer, j As Integer, bFound As Boolean
Dim vOptionButtons() As Variant, sGroupName As String
Dim lXY() As Long, iIndex() As Integer &apos; Two indexes X-Y coordinates
Dim oView As Object, oDatabaseForm As Object, vControls As Variant
Const cstPixels = 10 &apos; Tolerance on coordinates when drawn approximately
bFound = False
Select Case psParentType
Case CTLPARENTISFORM
&apos;poParent is a forms collection, find the appropriate database form
For i = 0 To poParent.Count - 1
Set oDatabaseForm = poParent.getByIndex(i)
If Not IsNull(oDatabaseForm) Then
For j = 0 To oDatabaseForm.GroupCount - 1 &apos; Does a group with the right name exist ?
oDatabaseForm.getGroup(j, vOptionButtons, sGroupName)
If UCase(sGroupName) = UCase(Utils._Trim(pvGroupName)) Then
bFound = True
Exit For
End If
Next j
If bFound Then Exit For
End If
If bFound Then Exit For
Next i
Case CTLPARENTISSUBFORM
&apos;poParent is already a database form
Set oDatabaseForm = poParent
For j = 0 To oDatabaseForm.GroupCount - 1 &apos; Does a group with the right name exist ?
oDatabaseForm.getGroup(j, vOptionButtons, sGroupName)
If UCase(sGroupName) = UCase(Utils._Trim(pvGroupName)) Then
bFound = True
Exit For
End If
Next j
End Select
If bFound Then
ogGroup = New Optiongroup
ogGroup._This = ogGroup
ogGroup._Name = sGroupName
ogGroup._ButtonsGroup = vOptionButtons
ogGroup._Count = UBound(vOptionButtons) + 1
ogGroup._ParentType = psParentType
ogGroup._MainForm = oDatabaseForm.Name
Set ogGroup._ParentComponent = poComponent
ReDim lXY(1, ogGroup._Count - 1)
ReDim iIndex(ogGroup._Count - 1)
For i = 0 To ogGroup._Count - 1 &apos; Find the position of each radiobutton
Set oView = poComponent.CurrentController.getControl(ogGroup._ButtonsGroup(i))
lXY(0, i) = oView.PosSize.X
lXY(1, i) = oView.PosSize.Y
Next i
For i = 0 To ogGroup._Count - 1 &apos; Sort them on XY coordinates
If i = 0 Then
iIndex(0) = 0
Else
iIndex(i) = i
For j = i - 1 To 0 Step -1
If lXY(1, i) - lXY(1, j) &lt; - cstPixels Or ( Abs(lXY(1, i) - lXY(1, j)) &lt;= cstPixels And lXY(0, i) - lXY(0, j) &lt; - cstPixels ) Then
iIndex(i) = iIndex(j)
iIndex(j) = iIndex(j) + 1
End If
Next j
End If
Next i
ogGroup._ButtonsIndex = iIndex()
Set _OptionGroup = ogGroup
Else
Set _OptionGroup = Nothing
TraceError(TRACEFATAL, ERRWRONGARGUMENT, Utils._CalledSub(), 0, , Array(1, pvGroupName))
End If
Exit_Function:
Exit Function
Error_Function:
TraceError(TRACEABORT, Err,&quot;_OptionGroup&quot;, Erl)
GoTo Exit_Function
End Function &apos; _OptionGroup V1.1.0
</script:module>

View File

@@ -0,0 +1,722 @@
<?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="Module" 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 &apos; Must be MODULE
Private _This As Object &apos; Workaround for absence of This builtin function
Private _Parent As Object
Private _Name As String
Private _Library As Object &apos; com.sun.star.container.XNameAccess
Private _LibraryName As String
Private _Storage As String &apos; GLOBAL or DOCUMENT
Private _Script As String &apos; Full script (string with vbLf&apos;s)
Private _Lines As Variant &apos; Array of script lines
Private _CountOfLines As Long
Private _ProcsParsed As Boolean &apos; To test before use of proc arrays
Private _ProcNames() As Variant &apos; All procedure names
Private _ProcDecPositions() As Variant &apos; All procedure declarations
Private _ProcEndPositions() As Variant &apos; All end procedure statements
Private _ProcTypes() As Variant &apos; One of the vbext_pk_* constants
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CONSTRUCTORS / DESTRUCTORS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJMODULE
Set _This = Nothing
Set _Parent = Nothing
_Name = &quot;&quot;
Set _Library = Nothing
_LibraryName = &quot;&quot;
_Storage = &quot;&quot;
_Script = &quot;&quot;
_Lines = Array()
_CountOfLines = 0
_ProcsParsed = False
_ProcNames = Array()
_ProcDecPositions = Array()
_ProcEndPositions = Array()
End Sub &apos; Constructor
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Terminate()
On Local Error Resume Next
Call Class_Initialize()
End Sub &apos; Destructor
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub Dispose()
Call Class_Terminate()
End Sub &apos; Explicit destructor
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS GET/LET/SET PROPERTIES ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Property Get CountOfDeclarationLines() As Long
CountOfDeclarationLines = _PropertyGet(&quot;CountOfDeclarationLines&quot;)
End Property &apos; CountOfDeclarationLines (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get CountOfLines() As Long
CountOfLines = _PropertyGet(&quot;CountOfLines&quot;)
End Property &apos; CountOfLines (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Name() As String
Name = _PropertyGet(&quot;Name&quot;)
End Property &apos; Name (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ObjectType() As String
ObjectType = _PropertyGet(&quot;ObjectType&quot;)
End Property &apos; ObjectType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Lines(Optional ByVal pvLine As Variant, Optional ByVal pvNumLines As Variant) As String
&apos; Returns a string containing the contents of a specified line or lines in a standard module or a class module
Const cstThisSub = &quot;Module.Lines&quot;
Utils._SetCalledSub(cstThisSub)
Dim sLines As String, lLine As Long
sLines = &quot;&quot;
If IsMissing(pvLine) Or IsMissing(pvNumLines) Then Call _TraceArguments()
If Not Utils._CheckArgument(pvLine, 1, _AddNumeric()) Then GoTo Exit_Function
If Not Utils._CheckArgument(pvNumLines, 1, _AddNumeric()) Then GoTo Exit_Function
lLine = pvLine
Do While lLine &lt; _CountOfLines And lLine &lt; pvLine + pvNumLines
sLines = sLines &amp; _Lines(lLine - 1) &amp; vbLf
lLine = lLine + 1
Loop
If Len(sLines) &gt; 0 Then sLines = Left(sLines, Len(sLines) - 1)
Exit_Function:
Lines = sLines
Utils._ResetCalledSub(cstThisSub)
Exit Function
End Function &apos; Lines
REM -----------------------------------------------------------------------------------------------------------------------
Public Function ProcBodyLine(Optional ByVal pvProc As Variant, Optional ByVal pvProcType As Variant) As Long
&apos; Return the number of the line at which the body of a specified procedure begins
Const cstThisSub = &quot;Module.ProcBodyLine&quot;
Utils._SetCalledSub(cstThisSub)
Dim iIndex As Integer
If IsMissing(pvProc) Or IsMissing(pvProcType) Then Call _TraceArguments()
If Not Utils._CheckArgument(pvProc, 1, vbString) Then GoTo Exit_Function
If Not Utils._CheckArgument(pvProcType, 2, _AddNumeric()) Then GoTo Exit_Function
iIndex = _FindProcIndex(pvProc, pvProcType)
If iIndex &gt;= 0 Then ProcBodyLine = _LineOfPosition(_ProcDecPositions(iIndex)) Else ProcBodyLine = iIndex
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
End Function &apos; ProcBodyline
REM -----------------------------------------------------------------------------------------------------------------------
Public Function ProcCountLines(Optional ByVal pvProc As Variant, Optional ByVal pvProcType As Variant) As Long
&apos; Return the number of lines in the specified procedure
Const cstThisSub = &quot;Module.ProcCountLines&quot;
Utils._SetCalledSub(cstThisSub)
Dim iIndex As Integer, lStart As Long, lEnd As Long
If IsMissing(pvProc) Or IsMissing(pvProcType) Then Call _TraceArguments()
If Not Utils._CheckArgument(pvProc, 1, vbString) Then GoTo Exit_Function
If Not Utils._CheckArgument(pvProcType, 2, _AddNumeric()) Then GoTo Exit_Function
iIndex = _FindProcIndex(pvProc, pvProcType)
lStart = ProcStartLine(pvProc, pvProcType)
lEnd = _LineOfPosition(_ProcEndPositions(iIndex))
ProcCountLines = lEnd - lStart + 1
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
End Function &apos; ProcCountLines
REM -----------------------------------------------------------------------------------------------------------------------
Public Function ProcOfLine(Optional ByVal pvLine As Variant, Optional ByRef pvProcType As Variant) As String
&apos; Return the name and type of the procedure containing line pvLine
Const cstThisSub = &quot;Module.ProcOfLine&quot;
Utils._SetCalledSub(cstThisSub)
Dim sProcedure As String, iProc As Integer, lLineDec As Long, lLineEnd As Long
If IsMissing(pvLine) Or IsMissing(pvProcType) Then Call _TraceArguments()
If Not Utils._CheckArgument(pvLine, 1, _AddNumeric()) Then GoTo Exit_Function
If Not Utils._CheckArgument(pvProcType, 2, _AddNumeric()) Then GoTo Exit_Function
If Not _ProcsParsed Then _ParseProcs()
sProcedure = &quot;&quot;
For iProc = 0 To UBound(_ProcNames)
lLineEnd = _LineOfPosition(_ProcEndPositions(iProc))
If pvLine &lt;= lLineEnd Then
lLineDec = _LineOfPosition(_ProcDecPositions(iProc))
If pvLine &lt; lLineDec Then &apos; Line between 2 procedures
sProcedure = &quot;&quot;
Else
sProcedure = _ProcNames(iProc)
pvProcType = _ProcTypes(iProc)
End If
Exit For
End If
Next iProc
Exit_Function:
ProcOfLine = sProcedure
Utils._ResetCalledSub(cstThisSub)
Exit Function
End Function &apos; ProcOfline
REM -----------------------------------------------------------------------------------------------------------------------
Public Function ProcStartLine(Optional ByVal pvProc As Variant, Optional ByVal pvProcType As Variant) As Long
&apos; Return the number of the line at which the specified procedure begins
Const cstThisSub = &quot;Module.ProcStartLine&quot;
Utils._SetCalledSub(cstThisSub)
Dim lLine As Long, lIndex As Long, sLine As String
If IsMissing(pvProc) Or IsMissing(pvProcType) Then Call _TraceArguments()
If Not Utils._CheckArgument(pvProc, 1, vbString) Then GoTo Exit_Function
If Not Utils._CheckArgument(pvProcType, 2, _AddNumeric()) Then GoTo Exit_Function
lLine = ProcBodyLine(pvProc, pvProcType)
&apos; Search baclIndexward for comment lines
lIndex = lLine - 1
Do While lIndex &gt; 0
sLine = _Trim(_Lines(lIndex - 1))
If UCase(Left(sLine, 4)) = &quot;REM &quot; Or Left(sLine, 1) = &quot;&apos;&quot; Then
lLine = lIndex
Else
Exit Do
End If
lIndex = lIndex - 1
Loop
ProcStartLine = lLine
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
End Function &apos; ProcStartLine
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
&apos; Return
&apos; a Collection object if pvIndex absent
&apos; a Property object otherwise
Const cstThisSub = &quot;Module.Properties&quot;
Utils._SetCalledSub(cstThisSub)
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(cstThisSub)
Exit Function
End Function &apos; Properties
REM -----------------------------------------------------------------------------------------------------------------------
Property Get pType() As String
pType = _PropertyGet(&quot;Type&quot;)
End Property &apos; Type (get)
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS METHODS ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Find(Optional ByVal pvTarget As Variant _
, Optional ByRef pvStartLine As Variant _
, Optional ByRef pvStartColumn As Variant _
, Optional ByRef pvEndLine As Variant _
, Optional ByRef pvEndColumn As Variant _
, Optional ByVal pvWholeWord As Boolean _
, Optional ByVal pvMatchCase As Boolean _
, Optional ByVal pvPatternSearch As Boolean _
) As Boolean
&apos; Finds specified text in the module
&apos; xxLine and xxColumn arguments are mainly to return the position of the found string
&apos; If they are initialized but nonsense, the function returns False
Const cstThisSub = &quot;Module.Find&quot;
Utils._SetCalledSub(cstThisSub)
If _ErrorHandler() Then On Local Error Goto Error_Function
Dim bFound As Boolean, lPosition As Long, lStartLine As Long, lStartColumn As Long, lStartPosition As Long
Dim lEndLine As Long, lEndColumn As Long, lEndPosition As Long
Dim sMatch As String, vOptions As Variant, sPattern As String
Dim i As Integer, sSpecChar As String
Const cstSpecialCharacters = &quot;\[^$.|?*+()&quot;
bFound = False
If IsMissing(pvTarget) Or IsMissing(pvStartLine) Or IsMissing(pvStartColumn) Or IsMissing(pvEndLine) Or IsMissing(pvEndColumn) Then Call _TraceArguments()
If Not Utils._CheckArgument(pvTarget, 1, vbString) Then GoTo Exit_Function
If Len(pvTarget) = 0 Then GoTo Exit_Function
If Not IsEmpty(pvStartLine) Then
If Not Utils._CheckArgument(pvStartLine, 2, _AddNumeric()) Then GoTo Exit_Function
End If
If Not IsEmpty(pvStartColumn) Then
If Not Utils._CheckArgument(pvStartColumn, 3, _AddNumeric()) Then GoTo Exit_Function
End If
If Not IsEmpty(pvEndLine) Then
If Not Utils._CheckArgument(pvEndLine, 4, _AddNumeric()) Then GoTo Exit_Function
End If
If Not IsEmpty(pvEndColumn) Then
If Not Utils._CheckArgument(pvEndColumn, 5, _AddNumeric()) Then GoTo Exit_Function
End If
If IsMissing(pvWholeWord) Then pvWholeWord = False
If Not Utils._CheckArgument(pvWholeWord, 6, vbBoolean) Then GoTo Exit_Function
If IsMissing(pvMatchCase) Then pvMatchCase = False
If Not Utils._CheckArgument(pvMatchCase, 7, vbBoolean) Then GoTo Exit_Function
If IsMissing(pvPatternSearch) Then pvPatternSearch = False
If Not Utils._CheckArgument(pvPatternSearch, 8, vbBoolean) Then GoTo Exit_Function
&apos; Initialize starting values
If IsEmpty(pvStartLine) Then lStartLine = 1 Else lStartLine = pvStartLine
If lStartLine &lt;= 0 Or lStartLine &gt; UBound(_Lines) + 1 Then GoTo Exit_Function
If IsEmpty(pvStartColumn) Then lStartColumn = 1 Else lStartColumn = pvStartColumn
If lStartColumn &lt;= 0 Then GoTo Exit_Function
If lStartColumn &gt; 1 And lStartColumn &gt; Len(_Lines(lStartLine + 1)) Then GoTo Exit_Function
lStartPosition = _PositionOfLine(lStartline) + lStartColumn - 1
If IsEmpty(pvEndLine) Then lEndLine = UBound(_Lines) + 1 Else lEndLine = pvEndLine
If lEndLine &lt; lStartLine Or lEndLine &gt; UBound(_Lines) + 1 Then GoTo Exit_Function
If IsEmpty(pvEndColumn) Then lEndColumn = Len(_Lines(lEndLine - 1)) Else lEndColumn = pvEndColumn
If lEndColumn &lt; 0 Then GoTo Exit_Function
If lEndColumn = 0 Then lEndColumn = 1
If lEndColumn &gt; Len(_Lines(lEndLine - 1)) + 1 Then GoTo Exit_Function
lEndPosition = _PositionOfLine(lEndline) + lEndColumn - 1
If pvMatchCase Then
Set vOptions = _A2B_.SearchOptions
vOptions.transliterateFlags = 0
End If
&apos; Define pattern to search for
sPattern = pvTarget
&apos; Protect special characters in regular expressions
For i = 1 To Len(cstSpecialCharacters)
sSpecChar = Mid(cstSpecialCharacters, i, 1)
sPattern = Replace(sPattern, sSpecChar, &quot;\&quot; &amp; sSpecChar)
Next i
If pvPatternSearch Then sPattern = Replace(Replace(sPattern, &quot;\*&quot;, &quot;.*&quot;), &quot;\?&quot;, &quot;.&quot;)
If pvWholeWord Then sPattern = &quot;\b&quot; &amp; sPattern &amp; &quot;\b&quot;
lPosition = lStartPosition
sMatch = Utils._RegexSearch(_Script, sPattern, lPosition)
&apos; Re-establish default options for later searches
If pvMatchCase Then vOptions.transliterateFlags = com.sun.star.i18n.TransliterationModules.IGNORE_CASE
&apos; Found within requested bounds ?
If sMatch &lt;&gt; &quot;&quot; And lPosition &gt;= lStartPosition And lPosition &lt;= lEndPosition Then
pvStartLine = _LineOfPosition(lPosition)
pvStartColumn = lPosition - _PositionOfLine(pvStartLine) + 1
pvEndLine = _LineOfPosition(lPosition + Len(sMatch) - 1)
If pvEndLine &gt; pvStartLine Then
pvEndColumn = lPosition + Len(sMatch) - 1 - _PositionOfLine(pvEndLine)
Else
pvEndColumn = pvStartColumn + Len(sMatch) - 1
End If
bFound = True
End If
Exit_Function:
Find = bFound
Utils._ResetCalledSub(cstThisSub)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;Module.Find&quot;, Erl)
bFound = False
GoTo Exit_Function
End Function &apos; Find
REM -----------------------------------------------------------------------------------------------------------------------
Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
&apos; Return property value of psProperty property name
Const cstThisSub = &quot;Module.Properties&quot;
Utils._SetCalledSub(cstThisSub)
If IsMissing(pvProperty) Then Call _TraceArguments()
getProperty = _PropertyGet(pvProperty)
Utils._ResetCalledSub(cstThisSub)
End Function &apos; getProperty
REM --------------------------------Mid(a._Script, iCtl, 25)---------------------------------------------------------------------------------------
Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
&apos; Return True if object has a valid property called pvProperty (case-insensitive comparison !)
Const cstThisSub = &quot;Module.hasProperty&quot;
Utils._SetCalledSub(cstThisSub)
If IsMissing(pvProperty) Then hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList()) Else hasProperty = PropertiesGet._hasProperty(_Type, _PropertiesList(), pvProperty)
Utils._ResetCalledSub(cstThisSub)
Exit Function
End Function &apos; hasProperty
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _BeginStatement(ByVal plStart As Long) As Long
&apos; Return the position in _Script of the beginning of the current statement as defined by plStart
Dim sProc As String, iProc As Integer, iType As Integer
Dim lPosition As Long, lPrevious As Long, sFind As String
sProc = ProcOfLine(_LineOfPosition(plStart), iType)
iProc = _FindProcIndex(sProc, iType)
If iProc &lt; 0 Then lPosition = 1 Else lPosition = _ProcDecPositions(iProc)
sFind = &quot;Any&quot;
Do While lPosition &lt; plStart And sFind &lt;&gt; &quot;&quot;
lPrevious = lPosition
sFind = _FindPattern(&quot;%^\w&quot;, lPosition)
If sFind = &quot;&quot; Then Exit Do
Loop
_BeginStatement = lPrevious
End Function &apos; _EndStatement
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _EndStatement(ByVal plStart As Long) As Long
&apos; Return the position in _Script of the end of the current statement as defined by plStart
&apos; plStart is assumed not to be in the middle of a comment or a string
Dim sMatch As String, lPosition As Long
lPosition = plStart
sMatch = _FindPattern(&quot;%$&quot;, lPosition)
_EndStatement = lPosition
End Function &apos; _EndStatement
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _FindPattern(ByVal psPattern As Variant, Optional ByRef plStart As Long) As String
&apos; Find first occurrence of any of the patterns in |-delimited string psPattern
&apos; Special escapes
&apos; - for word breaks: &quot;%B&quot; (f.i. for searching &quot;END%BFUNCTION&quot;)
&apos; - for statement start: &quot;%^&quot; (f.i. for searching &quot;%^END%BFUNCTION&quot;). Necessarily first 2 characters of pattern
&apos; - for statement end: &quot;%$&quot;. Pattern should not contain anything else
&apos; If quoted string searched, pattern should start and end with a double quote
&apos; Return &quot;&quot; if none found, otherwise returns the matching string
&apos; plStart = start position of _Script to search (starts at 1)
&apos; In output plStart contains the first position of the matching string or is left unchanged
&apos; To search again the same or another pattern =&gt; plStart = plStart + Len(matching string)
&apos; Comments and strings are skipped
&apos; Common patterns
Const cstComment = &quot;(&apos;|\bREM\b)[^\n]*$&quot;
Const cstString = &quot;&quot;&quot;[^&quot;&quot;\n]*&quot;&quot;&quot;
Const cstBeginStatement = &quot;(^|:|\bthen\b|\belse\b|\n)[ \t]*&quot;
Const cstEndStatement = &quot;[ \t]*($|:|\bthen\b|\belse\b|\n)&quot;
Const cstContinuation = &quot;[ \t]_\n&quot;
Const cstWordBreak = &quot;\b[ \t]+(_\n[ \t]*)?\b&quot;
Const cstAlt = &quot;|&quot;
Dim sRegex As String, lStart As Long, bContinue As Boolean, sMatch As String
Dim bEndStatement As Boolean, bQuote As Boolean
If psPattern = &quot;%$&quot; Then
sRegex = cstEndStatement
Else
sRegex = psPattern
If Left(psPattern, 2) = &quot;%^&quot; Then sRegex = cstBeginStatement &amp; Right(sRegex, Len(sregex) - 2)
sregex = Replace(sregex, &quot;%B&quot;, cstWordBreak)
End If
&apos; Add all to ignore patterns to regex. If pattern = quoted string do not add cstString
If Len(psPattern) &gt; 2 And Left(psPattern, 1) = &quot;&quot;&quot;&quot; And Right(psPattern, 1) = &quot;&quot;&quot;&quot; Then
bQuote = True
sRegex = sRegex &amp; cstAlt &amp; cstComment &amp; cstAlt &amp; cstContinuation
Else
bQuote = False
sRegex = sRegex &amp; cstAlt &amp; cstComment &amp; cstAlt &amp; cstString &amp; cstAlt &amp; cstContinuation
End If
If IsMissing(plStart) Then plStart = 1
lStart = plStart
bContinue = True
Do While bContinue
bEndStatement = False
sMatch = Utils._RegexSearch(_Script, sRegex, lStart)
Select Case True
Case sMatch = &quot;&quot;
bContinue = False
Case Left(sMatch, 1) = &quot;&apos;&quot;
bEndStatement = True
Case Left(sMatch, 1) = &quot;&quot;&quot;&quot;
If bQuote Then
plStart = lStart
bContinue = False
End If
Case Left(smatch, 1) = &quot;:&quot; Or Left(sMatch, 1) = vbLf
If psPattern = &quot;%$&quot; Then
bEndStatement = True
Else
bContinue = False
plStart = lStart + 1
sMatch = Right(sMatch, Len(sMatch) - 1)
End If
Case UCase(Left(sMatch, 4)) = &quot;REM &quot; Or UCase(Left(sMatch, 4)) = &quot;REM&quot; &amp; vbTab Or UCase(Left(sMatch, 4)) = &quot;REM&quot; &amp; vbNewLine
bEndStatement = True
Case UCase(Left(sMatch, 4)) = &quot;THEN&quot; Or UCase(Left(sMatch, 4)) = &quot;ELSE&quot;
If psPattern = &quot;%$&quot; Then
bEndStatement = True
Else
bContinue = False
plStart = lStart + 4
sMatch = Right(sMatch, Len(sMatch) - 4)
End If
Case sMatch = &quot; _&quot; &amp; vbLf
Case Else &apos; Found
plStart = lStart
bContinue = False
End Select
If bEndStatement And psPattern = &quot;%$&quot; Then
bContinue = False
plStart = lStart - 1
sMatch = &quot;&quot;
End If
lStart = lStart + Len(sMatch)
Loop
_FindPattern = sMatch
End Function &apos; _FindPattern
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _FindProcIndex(ByVal psProc As String, ByVal piType As Integer) As Integer
&apos; Return index of entry in _Procnames corresponding with pvProc
Dim i As Integer, iIndex As Integer
If Not _ProcsParsed Then _ParseProcs
iIndex = -1
For i = 0 To UBound(_ProcNames)
If UCase(psProc) = UCase(_ProcNames(i)) And piType = _ProcTypes(i) Then
iIndex = i
Exit For
End If
Next i
If iIndex &lt; 0 Then TraceError(TRACEFATAL, ERRPROCEDURENOTFOUND, Utils._CalledSub(), 0, , Array(psProc, _Name))
Exit_Function:
_FindProcIndex = iIndex
Exit Function
End Function &apos; _FindProcIndex
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub _Initialize()
_Script = Replace(_Script, vbCr, &quot;&quot;)
_Lines = Split(_Script, vbLf)
_CountOfLines = UBound(_Lines) + 1
End Sub &apos; _Initialize
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _LineOfPosition(ByVal plPosition) As Long
&apos; Return the line number of a position in _Script
Dim lLine As Long, lLength As Long
&apos; Start counting from start or end depending on how close position is
If plPosition &lt;= Len(_Script) / 2 Then
lLength = 0
For lLine = 0 To UBound(_Lines)
lLength = lLength + Len(_Lines(lLine)) + 1 &apos; + 1 for line feed
If lLength &gt;= plPosition Then
_LineOfPosition = lLine + 1
Exit Function
End If
Next lLine
Else
If Right(_Script, 1) = vbLf Then lLength = Len(_Script) + 1 Else lLength = Len(_Script)
For lLine = UBound(_Lines) To 0 Step -1
lLength = lLength - Len(_Lines(lLine)) - 1 &apos; - 1 for line feed
If lLength &lt;= plPosition Then
_LineOfPosition = lLine + 1
Exit Function
End If
Next lLine
End If
End Function &apos; _LineOfPosition
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub _ParseProcs()
&apos; Fills the Proc arrays: name, start and end position
&apos; Executed at first request needing this processing
Dim lPosition As Long, iProc As Integer, sDecProc As String, sEndProc As String, sNameProc As String, sType As String
Const cstDeclaration = &quot;%^(private%B|public%B)?\b(property%Bget|property%Blet|property%Bset|function|sub)\b&quot;
Const cstEnd = &quot;%^end%B(property|function|sub)\b&quot;
Const cstName = &quot;\w*&quot; &apos;&quot;[A-Za-z_][A-Za-z_0-9]*&quot;
If _ProcsParsed Then Exit Sub &apos; Do not redo if already done
_ProcNames = Array()
_ProcDecPositions = Array()
_ProcEndPositions = Array()
_ProcTypes = Array()
lPosition = 1
iProc = -1
sDecProc = &quot;???&quot;
Do While sDecProc &lt;&gt; &quot;&quot;
&apos; Identify Function/Sub declaration string
sDecProc = _FindPattern(cstDeclaration, lPosition)
If sDecProc &lt;&gt; &quot;&quot; Then
iProc = iProc + 1
ReDim Preserve _ProcNames(0 To iProc)
ReDim Preserve _ProcDecPositions(0 To iProc)
ReDim Preserve _ProcEndPositions(0 To iProc)
ReDim Preserve _ProcTypes(0 To iProc)
_ProcDecPositions(iProc) = lPosition
lPosition = lPosition + Len(sDecProc)
&apos; Identify procedure type
Select Case True
Case InStr(UCase(sDecProc), &quot;FUNCTION&quot;) &gt; 0 : _ProcTypes(iProc) = vbext_pk_Proc
Case InStr(UCase(sDecProc), &quot;SUB&quot;) &gt; 0 : _ProcTypes(iProc) = vbext_pk_Proc
Case InStr(UCase(sDecProc), &quot;GET&quot;) &gt; 0 : _ProcTypes(iProc) = vbext_pk_Get
Case InStr(UCase(sDecProc), &quot;LET&quot;) &gt; 0 : _ProcTypes(iProc) = vbext_pk_Let
Case InStr(UCase(sDecProc), &quot;SET&quot;) &gt; 0 : _ProcTypes(iProc) = vbext_pk_Set
End Select
&apos; Identify name of Function/Sub
sNameProc = _FindPattern(cstName, lPosition)
If sNameProc = &quot;&quot; Then Exit Do &apos; Should never happen
_ProcNames(iProc) = sNameProc
lPosition = lPosition + Len(sNameProc)
&apos; Identify End statement
sEndProc = _FindPattern(cstEnd, lPosition)
If sEndProc = &quot;&quot; Then Exit Do &apos; Should never happen
_ProcEndPositions(iProc) = lPosition
lPosition = lPosition + Len(sEndProc)
End If
Loop
_ProcsParsed = True
End Sub
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PositionOfLine(ByVal plLine) As Long
&apos; Return the position of the first character of the given line in _Script
Dim lLine As Long, lPosition As Long
&apos; Start counting from start or end depending on how close line is
If plLine &lt;= (UBound(_Lines) + 1) / 2 Then
lPosition = 0
For lLine = 0 To plLine - 1
lPosition = lPosition + 1 &apos; + 1 for line feed
If lLine &lt; plLine - 1 Then lPosition = lPosition + Len(_Lines(lLine))
Next lLine
Else
lPosition = Len(_Script) + 2 &apos; Anticipate an ending null-string and a line feed
For lLine = UBound(_Lines) To plLine - 1 Step -1
lPosition = lPosition - Len(_Lines(lLine)) - 1 &apos; - 1 for line feed
Next lLine
End If
_PositionOfLine = lPosition
End Function &apos; _LineOfPosition
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertiesList() As Variant
_PropertiesList = Array(&quot;CountOfDeclarationLines&quot;, &quot;CountOfLines&quot;, &quot;Name&quot;, &quot;ObjectType&quot;, &quot;Type&quot;)
End Function &apos; _PropertiesList
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertyGet(ByVal psProperty As String) As Variant
&apos; Return property value of the psProperty property name
Dim cstThisSub As String
Const cstDot = &quot;.&quot;
Dim sText As String
If _ErrorHandler() Then On Local Error Goto Error_Function
cstThisSub = &quot;Module.get&quot; &amp; psProperty
Utils._SetCalledSub(cstThisSub)
_PropertyGet = Null
Select Case UCase(psProperty)
Case UCase(&quot;CountOfDeclarationLines&quot;)
If Not _ProcsParsed Then _ParseProcs()
If UBound(_ProcNames) &gt;= 0 Then
_PropertyGet = ProcStartLine(_ProcNames(0), _ProcTypes(0)) - 1
Else
_PropertyGet = _CountOfLines
End If
Case UCase(&quot;CountOfLines&quot;)
_PropertyGet = _CountOfLines
Case UCase(&quot;Name&quot;)
_PropertyGet = _Storage &amp; cstDot &amp; _LibraryName &amp; cstDot &amp; _Name
Case UCase(&quot;ObjectType&quot;)
_PropertyGet = _Type
Case UCase(&quot;Type&quot;)
&apos; Find option statement before any procedure declaration
sText = _FindPattern(&quot;%^option%Bclassmodule\b|\bfunction\b|\bsub\b|\bproperty\b&quot;)
If UCase(Left(sText, 6)) = &quot;OPTION&quot; Then _PropertyGet = acClassModule Else _PropertyGet = acStandardModule
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Trace_Error:
TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
_PropertyGet = Nothing
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;Module._PropertyGet&quot;, Erl)
_PropertyGet = Null
GoTo Exit_Function
End Function &apos; _PropertyGet
</script:module>

View File

@@ -0,0 +1,315 @@
<?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="OptionGroup" 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 &apos; Must be FORM
Private _This As Object &apos; Workaround for absence of This builtin function
Private _Parent As Object
Private _Name As String
Private _ParentType As String
Private _ParentComponent As Object
Private _MainForm As String
Private _DocEntry As Integer
Private _DbEntry As Integer
Private _ButtonsGroup() As Variant
Private _ButtonsIndex() As Variant
Private _Count As Long
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CONSTRUCTORS / DESTRUCTORS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJOPTIONGROUP
Set _This = Nothing
Set _Parent = Nothing
_Name = &quot;&quot;
_ParentType = &quot;&quot;
_ParentComponent = Nothing
_DocEntry = -1
_DbEntry = -1
_ButtonsGroup = Array()
_ButtonsIndex = Array()
_Count = 0
End Sub &apos; Constructor
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Terminate()
On Local Error Resume Next
Call Class_Initialize()
End Sub &apos; Destructor
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub Dispose()
Call Class_Terminate()
End Sub &apos; Explicit destructor
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS GET/LET/SET PROPERTIES ---
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Count() As Variant
Count = _PropertyGet(&quot;Count&quot;)
End Property &apos; Count (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Name() As String
Name = _PropertyGet(&quot;Name&quot;)
End Property &apos; Name (get)
Public Function pName() As String &apos; For compatibility with &lt; V0.9.0
pName = _PropertyGet(&quot;Name&quot;)
End Function &apos; pName (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ObjectType() As String
ObjectType = _PropertyGet(&quot;ObjectType&quot;)
End Property &apos; ObjectType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
&apos; Return
&apos; a Collection object if pvIndex absent
&apos; a Property object otherwise
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
Exit Function
End Function &apos; Properties
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Value() As Variant
Value = _PropertyGet(&quot;Value&quot;)
End Property &apos; Value (get)
Property Let Value(ByVal pvValue As Variant)
Call _PropertySet(&quot;Value&quot;, pvValue)
End Property &apos; Value (set)
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS METHODS ---
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Controls(Optional ByVal pvIndex As Variant) As Variant
&apos; Return a Control object with name or index = pvIndex
If _ErrorHandler() Then On Local Error Goto Error_Function
Utils._SetCalledSub(&quot;OptionGroup.Controls&quot;)
Dim ocControl As Variant, iArgNr As Integer, i As Integer
Dim oCounter As Object
Set ocControl = Nothing
If IsMissing(pvIndex) Then &apos; No argument, return Collection object
Set oCounter = New Collect
Set oCounter._This = oCounter
oCounter._CollType = COLLCONTROLS
Set oCounter._Parent = _This
oCounter._Count = _Count
Set Controls = oCounter
Goto Exit_Function
End If
If _IsLeft(_A2B_.CalledSub, &quot;OptionGroup.&quot;) Then iArgNr = 1 Else iArgNr = 2
If Not Utils._CheckArgument(pvIndex, iArgNr, Utils._AddNumeric()) Then Goto Exit_Function
If pvIndex &lt; 0 Or pvIndex &gt; _Count - 1 Then Goto Trace_Error_Index
&apos; Start building the ocControl object
&apos; Determine exact name
Set ocControl = New Control
Set ocControl._This = ocControl
Set ocControl._Parent = _This
ocControl._ParentType = CTLPARENTISGROUP
ocControl._Shortcut = &quot;&quot;
For i = 0 To _Count - 1
If _ButtonsIndex(i) = pvIndex Then
Set ocControl.ControlModel = _ButtonsGroup(i)
Select Case _ParentType
Case CTLPARENTISDIALOG : ocControl._Name = _ButtonsGroup(i).Name
Case Else : ocControl._Name = _Name &apos; OptionGroup and individual radio buttons share the same name
End Select
ocControl._ImplementationName = ocControl.ControlModel.getImplementationName()
Exit For
End If
Next i
ocControl._FormComponent = _ParentComponent
ocControl._ClassId = acRadioButton
Select Case _ParentType
Case CTLPARENTISDIALOG : Set ocControl.ControlView = _ParentComponent.getControl(ocControl._Name)
Case Else : Set ocControl.ControlView = _ParentComponent.CurrentController.getControl(ocControl.ControlModel)
End Select
ocControl._Initialize()
ocControl._DocEntry = _DocEntry
ocControl._DbEntry = _DbEntry
Set Controls = ocControl
Exit_Function:
Utils._ResetCalledSub(&quot;OptionGroup.Controls&quot;)
Exit Function
Trace_Error_Index:
TraceError(TRACEFATAL, ERRCOLLECTION, Utils._CalledSub(), 0, 1)
Set Controls = Nothing
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;OptionGroup.Controls&quot;, Erl)
Set Controls = Nothing
GoTo Exit_Function
End Function &apos; Controls
REM -----------------------------------------------------------------------------------------------------------------------
Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
&apos; Return property value of psProperty property name
Utils._SetCalledSub(&quot;OptionGroup.getProperty&quot;)
If IsMissing(pvProperty) Then Call _TraceArguments()
getProperty = _PropertyGet(pvProperty)
Utils._ResetCalledSub(&quot;OptionGroup.getProperty&quot;)
End Function &apos; getProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
&apos; 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 &apos; hasProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setProperty(ByVal Optional psProperty As String, ByVal Optional pvValue As Variant) As Boolean
&apos; Return True if property setting OK
Utils._SetCalledSub(&quot;OptionGroup.setProperty&quot;)
setProperty = _PropertySet(psProperty, pvValue)
Utils._ResetCalledSub(&quot;OptionGroup.setProperty&quot;)
End Function
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertiesList() As Variant
_PropertiesList = Array(&quot;Count&quot;, &quot;Name&quot;, &quot;ObjectType&quot;, &quot;Value&quot;)
End Function &apos; _PropertiesList
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertyGet(ByVal psProperty As String) As Variant
&apos; Return property value of the psProperty property name
If _ErrorHandler() Then On Local Error Goto Error_Function
Utils._SetCalledSub(&quot;OptionGroup.get&quot; &amp; psProperty)
&apos;Execute
Dim oDatabase As Object, vBookmark As Variant
Dim iValue As Integer, i As Integer
_PropertyGet = EMPTY
Select Case UCase(psProperty)
Case UCase(&quot;Count&quot;)
_PropertyGet = _Count
Case UCase(&quot;Name&quot;)
_PropertyGet = _Name
Case UCase(&quot;ObjectType&quot;)
_PropertyGet = _Type
Case UCase(&quot;Value&quot;)
iValue = -1
For i = 0 To _Count - 1 &apos; Find the selected RadioButton
If _ButtonsGroup(i).State = 1 Then
iValue = _ButtonsIndex(i)
Exit For
End If
Next i
_PropertyGet = iValue
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(&quot;OptionGroup.get&quot; &amp; psProperty)
Exit Function
Trace_Error:
TraceError(TRACEWARNING, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
_PropertyGet = EMPTY
Goto Exit_Function
Trace_Error_Index:
TraceError(TRACEFATAL, ERRINDEXVALUE, Utils._CalledSub(), 0, 1, psProperty)
_PropertyGet = EMPTY
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;OptionGroup._PropertyGet&quot;, Erl)
_PropertyGet = EMPTY
GoTo Exit_Function
End Function &apos; _PropertyGet
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Variant) As Boolean
Utils._SetCalledSub(&quot;OptionGroup.set&quot; &amp; psProperty)
If _ErrorHandler() Then On Local Error Goto Error_Function
_PropertySet = True
&apos;Execute
Dim i As Integer, iRadioIndex As Integer, oModel As Object, iArgNr As Integer
If _IsLeft(_A2B_.CalledSub, &quot;OptionGroup.&quot;) Then iArgNr = 1 Else iArgNr = 2
Select Case UCase(psProperty)
Case UCase(&quot;Value&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
If pvValue &lt; 0 Or pvValue &gt; _Count - 1 Then Goto Trace_Error_Value
For i = 0 To _Count - 1
_ButtonsGroup(i).State = 0
If _ButtonsIndex(i) = pvValue Then iRadioIndex = i
Next i
_ButtonsGroup(iRadioIndex).State = 1
Set oModel = _ButtonsGroup(iRadioIndex)
If Utils._hasUNOProperty(oModel, &quot;DataField&quot;) Then
If Not IsNull(oModel.Datafield) And Not IsEmpty(oModel.Datafield) Then
If oModel.Datafield &lt;&gt; &quot;&quot; And Utils._hasUNOMethod(oModel, &quot;commit&quot;) Then oModel.commit() &apos; f.i. checkboxes have no commit method ?? [PASTIM]
End If
End If
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(&quot;OptionGroup.set&quot; &amp; psProperty)
Exit Function
Trace_Error:
TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
_PropertySet = False
Goto Exit_Function
Trace_Error_Value:
TraceError(TRACEFATAL, ERRPROPERTYVALUE, Utils._CalledSub(), 0, 1, Array(pvValue, psProperty))
_PropertySet = False
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;OptionGroup._PropertySet&quot;, Erl)
_PropertySet = False
GoTo Exit_Function
End Function &apos; _PropertySet
</script:module>

View File

@@ -0,0 +1,577 @@
<?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="PropertiesSet" 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 Explicit
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setAbsolutePosition(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
&apos; Only for open forms
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setAbsolutePosition&quot;)
setAbsolutePosition = PropertiesSet._setProperty(pvObject, &quot;AbsolutePosition&quot;, pvValue)
End Function &apos; setAbsolutePosition
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setAllowAdditions(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
&apos; Only for open forms
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setAllowAdditions&quot;)
setAllowAdditions = PropertiesSet._setProperty(pvObject, &quot;AllowAdditions&quot;, pvValue)
End Function &apos; setAllowAdditions
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setAllowDeletions(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
&apos; Only for open forms
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setAllowDeletions&quot;)
setAllowDeletions = PropertiesSet._setProperty(pvObject, &quot;AllowDeletions&quot;, pvValue)
End Function &apos; setAllowDeletions
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setAllowEdits(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
&apos; Only for open forms
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setAllowEdits&quot;)
setAllowEdits = PropertiesSet._setProperty(pvObject, &quot;AllowEdits&quot;, pvValue)
End Function &apos; setAllowEdits
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setBackColor(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setBackColor&quot;)
setBackColor = PropertiesSet._setProperty(pvObject, &quot;BackColor&quot;, pvValue)
End Function &apos; setBackColor
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setBookmark(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setBookmark&quot;)
setBookmark = PropertiesSet._setProperty(pvObject, &quot;Bookmark&quot;, pvValue)
End Function &apos; setBookmark
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setBorderColor (Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setBorderColor&quot;)
setBorderColor = PropertiesSet._setProperty(pvObject, &quot;BorderColor&quot;, pvValue)
End Function &apos; setBorderColor
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setBorderStyle(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setBorderStyle&quot;)
setBorderStyle = PropertiesSet._setProperty(pvObject, &quot;BorderStyle&quot;, pvValue)
End Function &apos; setBorderStyle
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setCancel(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setCancel&quot;)
setCancel = PropertiesSet._setProperty(pvObject, &quot;Cancel&quot;, pvValue)
End Function &apos; setCancel
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setCaption(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setCaption&quot;)
setCaption = PropertiesSet._setProperty(pvObject, &quot;Caption&quot;, pvValue)
End Function &apos; setCaption
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setControlTipText(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setControlTipText&quot;)
setControlTipText = PropertiesSet._setProperty(pvObject, &quot;ControlTipText&quot;, pvValue)
End Function &apos; setControlTipText
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setCurrentRecord(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setCurrentRecord&quot;)
setCurrentRecord = PropertiesSet._setProperty(pvObject, &quot;CurrentRecord&quot;, pvValue)
End Function &apos; setCurrentRecord
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setDefault(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setDefault&quot;)
setDefault = PropertiesSet._setProperty(pvObject, &quot;Default&quot;, pvValue)
End Function &apos; setDefault
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setDefaultValue(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setDefaultValue&quot;)
setDefaultValue = PropertiesSet._setProperty(pvObject, &quot;DefaultValue&quot;, pvValue)
End Function &apos; setDefaultValue
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setDescription(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setDescription&quot;)
setDescription = PropertiesSet._setProperty(pvObject, &quot;Description&quot;, pvValue)
End Function &apos; setDescription
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setEnabled(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setEnabled&quot;)
setEnabled = PropertiesSet._setProperty(pvObject, &quot;Enabled&quot;, pvValue)
End Function &apos; setEnabled
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setFilter(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setFilter&quot;)
setFilter = PropertiesSet._setProperty(pvObject, &quot;Filter&quot;, pvValue)
End Function &apos; setFilter
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setFilterOn(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
&apos; Only for open forms
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setFilterOn&quot;)
setFilterOn = PropertiesSet._setProperty(pvObject, &quot;FilterOn&quot;, pvValue)
End Function &apos; setFilterOn
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setFontBold(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setFontBold&quot;)
setFontBold = PropertiesSet._setProperty(pvObject, &quot;FontBold&quot;, pvValue)
End Function &apos; setFontBold
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setFontItalic(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setFontItalic&quot;)
setFontItalic = PropertiesSet._setProperty(pvObject, &quot;FontItalic&quot;, pvValue)
End Function &apos; setFontItalic
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setFontName(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setFontName&quot;)
setFontName = PropertiesSet._setProperty(pvObject, &quot;FontName&quot;, pvValue)
End Function &apos; setFontName
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setFontSize(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setFontSize&quot;)
setFontSize = PropertiesSet._setProperty(pvObject, &quot;FontSize&quot;, pvValue)
End Function &apos; setFontSize
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setFontUnderline(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setFontUnderline&quot;)
setFontUnderline = PropertiesSet._setProperty(pvObject, &quot;FontUnderline&quot;, pvValue)
End Function &apos; setFontUnderline
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setFontWeight(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setFontWeight&quot;)
setFontWeight = PropertiesSet._setProperty(pvObject, &quot;FontWeight&quot;, pvValue)
End Function &apos; setFontWeight
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setForeColor(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setForeColor&quot;)
setForeColor = PropertiesSet._setProperty(pvObject, &quot;ForeColor&quot;, pvValue)
End Function &apos; setForeColor
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setHeight(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
&apos; Only for open forms
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setHeight&quot;)
setHeight = PropertiesSet._setProperty(pvObject, &quot;Height&quot;, pvValue)
End Function &apos; setHeight
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setListIndex(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setListIndex&quot;)
setListIndex = PropertiesSet._setProperty(pvObject, &quot;ListIndex&quot;, pvValue)
End Function &apos; setListIndex
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setLocked(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setLocked&quot;)
setLocked = PropertiesSet._setProperty(pvObject, &quot;Locked&quot;, pvValue)
End Function &apos; setLocked
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setMultiSelect(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setMultiSelect&quot;)
setMultiSelect = PropertiesSet._setProperty(pvObject, &quot;MultiSelect&quot;, pvValue)
End Function &apos; setMultiSelect
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setOnAction(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setOnAction&quot;)
setOnAction = PropertiesSet._setProperty(pvObject, &quot;OnAction&quot;, pvValue)
End Function &apos; setOnAction
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setOptionValue(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setOptionValue&quot;)
setOptionValue = PropertiesSet._setProperty(pvObject, &quot;OptionValue&quot;, pvValue)
End Function &apos; setOptionValue
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setOrderBy(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setOrderBy&quot;)
setOrderBy = PropertiesSet._setProperty(pvObject, &quot;OrderBy&quot;, pvValue)
End Function &apos; setOrderBy
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setOrderByOn(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
&apos; Only for open forms
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setOrderByOn&quot;)
setOrderByOn = PropertiesSet._setProperty(pvObject, &quot;OrderByOn&quot;, pvValue)
End Function &apos; setOrderByOn
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setPage(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setPage&quot;)
setPage = PropertiesSet._setProperty(pvObject, &quot;Page&quot;, pvValue)
End Function &apos; setPage V0.9.1
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setProperty(Optional pvItem As Variant, ByVal Optional psProperty As String, ByVal Optional pvValue As Variant, ByVal Optional pvIndex As Variant) As Variant
&apos; Return True if property setting OK
Utils._SetCalledSub(&quot;setProperty&quot;)
If IsMissing(pvItem) Or IsMissing(psProperty) Or IsMissing(pvValue) Or IsEmpty(pvItem) Then Call _TraceArguments()
If IsMissing(pvIndex) Then
setProperty = PropertiesSet._setProperty(pvItem, psProperty, pvValue)
Else
setProperty = PropertiesSet._setProperty(pvItem, psProperty, pvValue, pvIndex)
End If
Utils._ResetCalledSub(&quot;setProperty&quot;)
End Function
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setRecordSource(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
&apos; Only for open forms
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setRecordSource&quot;)
setRecordSource = PropertiesSet._setProperty(pvObject, &quot;RecordSource&quot;, pvValue)
End Function &apos; setRecordSource
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setRequired(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setRequired&quot;)
setRequired = PropertiesSet._setProperty(pvObject, &quot;Required&quot;, pvValue)
End Function &apos; setRequired
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setRowSource(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setRowSource&quot;)
setRowSource = PropertiesSet._setProperty(pvObject, &quot;RowSource&quot;, pvValue)
End Function &apos; setRowSource
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setRowSourceType(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setRowSourceType&quot;)
setRowSourceType = PropertiesSet._setProperty(pvObject, &quot;RowSourceType&quot;, pvValue)
End Function &apos; setRowSourceType
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setSelected(Optional pvObject As Variant, ByVal Optional pvValue As Variant, ByVal Optional pvIndex As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Then Call _TraceArguments(&quot;setSelected&quot;)
If IsEmpty(pvObject) Then Call _TraceArguments(&quot;setSelected&quot;)
If IsMissing(pvIndex) Then
setSelected = PropertiesSet._setProperty(pvObject, &quot;Selected&quot;, pvValue)
Else
setSelected = PropertiesSet._setProperty(pvObject, &quot;Selected&quot;, pvValue, pvIndex)
End If
End Function &apos; setSelected
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setSelLength(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setSelLength&quot;)
setSelLength = PropertiesSet._setProperty(pvObject, &quot;SelLength&quot;, pvValue)
End Function &apos; setSelLength
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setSelStart(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setSelStart&quot;)
setSelStart = PropertiesSet._setProperty(pvObject, &quot;SelStart&quot;, pvValue)
End Function &apos; setSelStart
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setSelText(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setSelText&quot;)
setSelText = PropertiesSet._setProperty(pvObject, &quot;SelText&quot;, pvValue)
End Function &apos; setSelText
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setSpecialEffect(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setSpecialEffect&quot;)
setSpecialEffect = PropertiesSet._setProperty(pvObject, &quot;SpecialEffect&quot;, pvValue)
End Function &apos; setSpecialEffect
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setTabIndex(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setTabIndex&quot;)
setTabIndex = PropertiesSet._setProperty(pvObject, &quot;TabIndex&quot;, pvValue)
End Function &apos; setTabIndex
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setTabStop(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setTabStop&quot;)
setTabStop = PropertiesSet._setProperty(pvObject, &quot;TabStop&quot;, pvValue)
End Function &apos; setTabStop
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setTag(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setTag&quot;)
setTag = PropertiesSet._setProperty(pvObject, &quot;Tag&quot;, pvValue)
End Function &apos; setTag
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setTextAlign(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setTextAlign&quot;)
setTextAlign = PropertiesSet._setProperty(pvObject, &quot;TextAlign&quot;, pvValue)
End Function &apos; setTextAlign
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setTooltipText(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setTooltipText&quot;)
setTooltipText = PropertiesSet._setProperty(pvObject, &quot;TooltipText&quot;, pvValue)
End Function &apos; setTooltipText
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setTripleState(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setTripleState&quot;)
setTripleState = PropertiesSet._setProperty(pvObject, &quot;TripleState&quot;, pvValue)
End Function &apos; setTripleState
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setVisible(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
&apos; Only for open forms and controls
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setVisible&quot;)
setVisible = PropertiesSet._setProperty(pvObject, &quot;Visible&quot;, pvValue)
End Function &apos; setVisible
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setWidth(Optional pvObject As Variant, ByVal Optional pvValue As Variant) As Boolean
&apos; Only for open forms
If IsMissing(pvObject) Or IsMissing(pvValue) Or IsEmpty(pvObject) Then Call _TraceArguments(&quot;setWidth&quot;)
setWidth = PropertiesSet._setProperty(pvObject, &quot;Width&quot;, pvValue)
End Function &apos; setWidth
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _CheckProperty(pvObject As Object, ByVal psProperty As String) As Boolean
&apos; Return False if psProperty not within the PropertyValues set of pvItem
Dim i As Integer, oPropertyValues As Variant, oProperty As Variant
oPropertyValues = pvObject.PropertyValues
For i = LBound(oPropertyValues) To UBound(oPropertyValues)
oProperty = oPropertyValues(i)
If UCase(oProperty.Name) = UCase(psProperty) Then
_CheckProperty = True
Exit Function
End If
Next i
_CheckProperty = False
Exit Function
End Function &apos; CheckProperty V0.7.5
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _setProperty(pvItem As Variant, ByVal psProperty As String, ByVal pvValue As Variant, ByVal Optional pvIndex As Variant) As Boolean
&apos; Return True if property setting OK
Utils._SetCalledSub(&quot;set&quot; &amp; psProperty)
If _ErrorHandler() Then On Local Error Goto Error_Function
&apos;pvItem must be an object and have the requested property
If Not Utils._CheckArgument(pvItem, 1, vbObject) Then Goto Exit_Function
&apos;Check Index argument
If Not IsMissing(pvIndex) Then
If Not Utils._CheckArgument(pvIndex, 4, Utils._AddNumeric()) Then Goto Exit_Function
End If
&apos;Execute
Dim iArgNr As Integer, lFormat As Long
Dim i As Integer, iCount As Integer, iSelectedItems() As Integer, bListboxBound As Boolean
Dim odbDatabase As Object, vNames As Variant, bFound As Boolean, sName As String, oModel As Object
Dim ocButton As Variant, iRadioIndex As Integer
_setProperty = True
If _A2B_.CalledSub = &quot;setProperty&quot; Then iArgNr = 3 Else iArgNr = 2
If Not PropertiesGet._hasProperty(pvItem._Type, pvItem._PropertiesList(), psProperty) Then Goto Trace_Error_Control
Select Case UCase(psProperty)
Case UCase(&quot;AbsolutePosition&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJRECORDSET) Then Goto Exit_Function
pvItem.AbsolutePosition = pvValue
Case UCase(&quot;AllowAdditions&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJSUBFORM)) Then Goto Exit_Function
pvItem.AllowAdditions = pvValue
Case UCase(&quot;AllowDeletions&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJSUBFORM)) Then Goto Exit_Function
pvItem.AllowDeletions = pvValue
Case UCase(&quot;AllowEdits&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJSUBFORM)) Then Goto Exit_Function
pvItem.AllowEdits = pvValue
Case UCase(&quot;BackColor&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.BackColor = pvValue
Case UCase(&quot;Bookmark&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJRECORDSET)) Then Goto Exit_Function
pvItem.Bookmark = pvValue
Case UCase(&quot;BorderColor&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.BorderColor = pvValue
Case UCase(&quot;BorderStyle&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.BorderColor = pvValue
Case UCase(&quot;Cancel&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.Cancel = pvValue
Case UCase(&quot;Caption&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJDIALOG, OBJCONTROL)) Then Goto Exit_Function
pvItem.Caption = pvValue
Case UCase(&quot;ControlTipText&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.ControlTipText = pvValue
Case UCase(&quot;CurrentRecord&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJSUBFORM)) Then Goto Exit_Function
pvItem.CurrentRecord = pvValue
Case UCase(&quot;Default&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.Default = pvValue
Case UCase(&quot;DefaultValue&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJCONTROL, OBJFIELD)) Then Goto Exit_Function
pvItem.DefaultValue = pvValue
Case UCase(&quot;Description&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJFIELD) Then Goto Exit_Function
pvItem.DefaultValue = pvValue
Case UCase(&quot;Enabled&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.Enabled = pvValue
Case UCase(&quot;Filter&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJSUBFORM, OBJRECORDSET)) Then Goto Exit_Function
pvItem.Filter = pvValue
Case UCase(&quot;FilterOn&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJSUBFORM)) Then Goto Exit_Function
pvItem.FilterOn = pvValue
Case UCase(&quot;FontBold&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.FontBold = pvValue
Case UCase(&quot;FontItalic&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.FontItalic = pvValue
Case UCase(&quot;FontName&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.FontName = pvValue
Case UCase(&quot;FontSize&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.FontSize = pvValue
Case UCase(&quot;FontUnderline&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.FontUnderline = pvValue
Case UCase(&quot;FontWeight&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.FontWeight = pvValue
Case UCase(&quot;ForeColor&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.ForeColor = pvValue
Case UCase(&quot;Height&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJDIALOG)) Then Goto Exit_Function
pvItem.Height = pvValue
Case UCase(&quot;ListIndex&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.ListIndex = pvValue
Case UCase(&quot;Locked&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.Locked = pvValue
Case UCase(&quot;MultiSelect&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.MultiSelect = pvValue
Case UCase(&quot;OnAction&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCOMMANDBARCONTROL) Then Goto Exit_Function
pvItem.OnAction = pvValue
Case UCase(&quot;OptionValue&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.OptionValue = pvValue
Case UCase(&quot;OrderBy&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJSUBFORM)) Then Goto Exit_Function
pvItem.OrderBy = pvValue
Case UCase(&quot;OrderByOn&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJSUBFORM)) Then Goto Exit_Function
pvItem.OrderByOn = pvValue
Case UCase(&quot;Page&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJDIALOG, OBJCONTROL)) Then Goto Exit_Function
pvItem.Page = pvValue
Case UCase(&quot;RecordSource&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJSUBFORM)) Then Goto Exit_Function
pvItem.RecordSource = pvValue
Case UCase(&quot;Required&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.Required = pvValue
Case UCase(&quot;RowSource&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.RowSource = pvValue
Case UCase(&quot;RowSourceType&quot;) &apos; Refresh done when RowSource changes, not RowSourceType
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.RowSourceType = pvValue
Case UCase(&quot;Selected&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
If IsMissing(pvIndex) Then pvItem.Selected = pvValue Else pvItem.SelectedI(pvValue, pvIndex)
Case UCase(&quot;SelLength&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.SelLength = pvValue
Case UCase(&quot;SelStart&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.SelStart = pvValue
Case UCase(&quot;SelText&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.SelText = pvValue
Case UCase(&quot;SpecialEffect&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.SpecialEffect = pvValue
Case UCase(&quot;TabIndex&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.TabIndex = pvValue
Case UCase(&quot;TabStop&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.TabStop = pvValue
Case UCase(&quot;Tag&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.Tag = pvValue
Case UCase(&quot;TextAlign&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.TextAlign = pvValue
Case UCase(&quot;TooltipText&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCOMMANDBARCONTROL) Then Goto Exit_Function
pvItem.TooltipText = pvValue
Case UCase(&quot;TripleState&quot;)
If Not Utils._CheckArgument(pvItem, 1, OBJCONTROL) Then Goto Exit_Function
pvItem.TripleState = pvValue
Case UCase(&quot;Value&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJCONTROL, OBJOPTIONGROUP, OBJFIELD, OBJTEMPVAR)) Then Goto Exit_Function
pvItem.Value = pvValue
Case UCase(&quot;Visible&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJDIALOG, OBJCONTROL, OBJCOMMANDBAR, OBJCOMMANDBARCONTROL)) Then Goto Exit_Function
pvItem.Visible = pvValue
Case UCase(&quot;Width&quot;)
If Not Utils._CheckArgument(pvItem, 1, Array(OBJFORM, OBJDIALOG)) Then Goto Exit_Function
pvItem.Width = pvValue
Case Else
Goto Trace_Error_Control
End Select
Exit_Function:
Utils._ResetCalledSub(&quot;set&quot; &amp; psProperty)
Exit Function
Trace_Error_Form:
TraceError(TRACEFATAL, ERRFORMNOTFOUND, Utils._CalledSub(), 0, 1, pvItem._Name)
_setProperty = False
Goto Exit_Function
Trace_Error_Control:
TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
_setProperty = False
Goto Exit_Function
Trace_Error_Value:
TraceError(TRACEFATAL, ERRPROPERTYVALUE, Utils._CalledSub(), 0, 1, Array(pvValue, psProperty))
_setProperty = False
Goto Exit_Function
Trace_Error_Index:
TraceError(TRACEFATAL, ERRINDEXVALUE, Utils._CalledSub(), 0, 1, psProperty)
_setProperty = Nothing
Goto Exit_Function
Trace_Error_Array:
TraceError(TRACEFATAL, ERRPROPERTYNOTARRAY, Utils._CalledSub(), 0, 1, iArgNr)
_setProperty = Nothing
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;_setProperty&quot;, Erl)
GoTo Exit_Function
End Function &apos; _setProperty V0.9.1
</script:module>

View File

@@ -0,0 +1,152 @@
<?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="Property" 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 &apos; Must be PROPERTY
Private _This As Object &apos; Workaround for absence of This builtin function
Private _Parent As Object
Private _Name As String
Private _Value As Variant
Private _ParentDatabase As Object
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CONSTRUCTORS / DESTRUCTORS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJPROPERTY
Set _This = Nothing
Set _Parent = Nothing
_Name = &quot;&quot;
_Value = Null
End Sub &apos; Constructor
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Terminate()
On Local Error Resume Next
Call Class_Initialize()
End Sub &apos; Destructor
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub Dispose()
Call Class_Terminate()
End Sub &apos; Explicit destructor
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS GET/LET/SET PROPERTIES ---
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Name() As String
Name = _PropertyGet(&quot;Name&quot;)
End Property &apos; Name (get)
Public Function pName() As String &apos; For compatibility with &lt; V0.9.0
pName = _PropertyGet(&quot;Name&quot;)
End Function &apos; pName (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ObjectType() As String
ObjectType = _PropertyGet(&quot;ObjectType&quot;)
End Property &apos; ObjectType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
&apos; Return
&apos; a Collection object if pvIndex absent
&apos; a Property object otherwise
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
Exit Function
End Function &apos; Properties
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Value() As Variant
Value = _PropertyGet(&quot;Value&quot;)
End Property &apos; Value (get)
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS METHODS ---
REM -----------------------------------------------------------------------------------------------------------------------
Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
&apos; Return property value of psProperty property name
Utils._SetCalledSub(&quot;Property.getProperty&quot;)
If IsMissing(pvProperty) Then Call _TraceArguments()
getProperty = _PropertyGet(pvProperty)
Utils._ResetCalledSub(&quot;Property.getProperty&quot;)
End Function &apos; getProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
&apos; 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 &apos; hasProperty
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertiesList() As Variant
_PropertiesList = Array(&quot;Name&quot;, &quot;ObjectType&quot;, &quot;Value&quot;)
End Function &apos; _PropertiesList
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertyGet(ByVal psProperty As String) As Variant
&apos; Return property value of the psProperty property name
If _ErrorHandler() Then On Local Error Goto Error_Function
Utils._SetCalledSub(&quot;Property.get&quot; &amp; psProperty)
_PropertyGet = Nothing
Select Case UCase(psProperty)
Case UCase(&quot;Name&quot;)
_PropertyGet = _Name
Case UCase(&quot;ObjectType&quot;)
_PropertyGet = _Type
Case UCase(&quot;Value&quot;)
_PropertyGet = _Value
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(&quot;Property.get&quot; &amp; psProperty)
Exit Function
Trace_Error:
TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
_PropertyGet = Nothing
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;Property._PropertyGet&quot;, Erl)
_PropertyGet = Nothing
GoTo Exit_Function
End Function &apos; _PropertyGet
</script:module>

View File

@@ -0,0 +1,613 @@
<?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="Python" 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 Explicit
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub DebugPrint(ParamArray pvArgs() As Variant)
&apos;Print arguments unconditionally in console
&apos;Arguments are separated by a TAB (simulated by spaces)
&apos;Some pvArgs might be missing: a TAB is still generated
Dim vVarTypes() As Variant, i As Integer
Const cstTab = 5
On Local Error Goto Exit_Sub &apos; Never interrupt processing
Utils._SetCalledSub(&quot;DebugPrint&quot;)
vVarTypes = Utils._AddNumeric(Array(vbEmpty, vbNull, vbDate, vbString, vbBoolean, vbObject, vbVariant, vbByte, vbArray + vbByte))
If UBound(pvArgs) &gt;= 0 Then
For i = 0 To UBound(pvArgs)
If Not Utils._CheckArgument(pvArgs(i), i + 1, vVarTypes(), , False) Then pvArgs(i) = &quot;[TYPE?]&quot;
Next i
End If
Dim sOutput As String, sArg As String
sOutput = &quot;&quot;
For i = 0 To UBound(pvArgs)
sArg = Replace(Utils._CStr(pvArgs(i), _A2B_.DebugPrintShort), &quot;\;&quot;, &quot;;&quot;)
&apos; Add argument to output
If i = 0 Then
sOutput = sArg
Else
sOutput = sOutput &amp; Space(cstTab - (Len(sOutput) Mod cstTab)) &amp; sArg
End If
Next i
TraceLog(TRACEANY, sOutput, False)
Exit_Sub:
Utils._ResetCalledSub(&quot;DebugPrint&quot;)
Exit Sub
End Sub &apos; DebugPrint V0.9.5
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PYTHON WRAPPERS ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Public Function PythonEventsWrapper(Optional poEvent As Variant) As Variant
&apos; Python wrapper when Application.Events() method is invoked
&apos; The ParamArray mechanism empties UNO objects when they are member of the arguments list
&apos; As a workaround, the Application.Events function is executed directly
If _ErrorHandler() Then On Local Error GoTo Exit_Function &apos; Do never interrupt
PythonEventsWrapper = Null
Dim vReturn As Variant, vArray As Variant
Const cstObject = 1
vReturn = Application.Events(poEvent)
vArray = Array(cstObject, _A2B_.AddPython(vReturn), vReturn._Type)
PythonEventsWrapper = vArray
Exit_Function:
Exit Function
End Function &apos; PythonEventsWrapper V6.4
REM -----------------------------------------------------------------------------------------------------------------------
Public Function PythonWrapper(ByVal pvCallType As Variant _
, ByVal pvObject As Variant _
, ByVal pvScript As Variant _
, ParamArray pvArgs() As Variant _
) As Variant
&apos; Called from Python to apply
&apos; - on object with entry pvObject in PythonCache
&apos; Conventionally: -1 = Application
&apos; -2 = DoCmd
&apos; - a script pvScript which type is described by pvCallType
&apos; - with arguments pvArgs(0)... (max. 8 for object methods)
&apos; The value returned by the method/property is encapsulated in an array
&apos; [0] =&gt; 0 = scalar or array returned by the method
&apos; =&gt; 1 = basic object returned by the method
&apos; =&gt; 2 = a null value
&apos; [1] =&gt; the object reference or the returned value (complemented with arguments passed by reference, if any) or Null
&apos; [2] =&gt; the object type or Null
&apos; [3] =&gt; the object name, if any
&apos; or, when pvCallType == vbUNO, as the UNO object returned by the property
Dim vReturn As Variant, vArray As Variant
Dim vObject As Variant, sScript As String, sModule As String
Dim i As Integer, iNbArgs As Integer, vArg As Variant, vArgs() As Variant
Const cstApplication = -1, cstDoCmd = -2
Const cstScalar = 0, cstObject = 1, cstNull = 2, cstUNO = 3
&apos;Conventional special values
Const cstNoArgs = &quot;+++NOARGS+++&quot;, cstSymEmpty = &quot;+++EMPTY+++&quot;, cstSymNull = &quot;+++NULL+++&quot;, cstSymMissing = &quot;+++MISSING+++&quot;
&apos;https://support.office.com/en-us/article/CallByName-fonction-49ce9475-c315-4f13-8d35-e98cfe98729a
&apos;Determines the pvCallType
Const vbGet = 2, vbLet = 4, vbMethod = 1, vbSet = 8, vbUNO = 16
If _ErrorHandler() Then On Local Error GoTo Error_Function
PythonWrapper = Null
&apos;Reinterpret arguments one by one into vArgs, examine iso-dates and conventional NoArgs/Empty/Null values
iNbArgs = -1
vArgs = Array()
If UBound(pvArgs) &gt;= 0 Then
For i = 0 To UBound(pvArgs)
vArg = pvArgs(i)
If i = 0 And VarType(vArg) = vbString Then
If vArg = cstNoArgs Then Exit For
End If
If VarType(vArg) = vbString Then
If vArg = cstSymEmpty Then
vArg = Empty
ElseIf vArg = cstSymNull Then
vArg = Null
ElseIf vArg = cstSymMissing Then
Exit For &apos; Next arguments must be missing also
Else
vArg = _CDate(vArg)
End If
End If
iNbArgs = iNbArgs + 1
ReDim Preserve vArgs(iNbArgs)
vArgs(iNbArgs) = vArg
Next i
End If
&apos;Check pvObject
Select Case pvObject &apos; Always numeric
Case cstApplication
sModule = &quot;Application&quot;
Select Case pvScript
Case &quot;AllDialogs&quot; : If iNbArgs &lt; 0 Then vReturn = Application.AllDialogs() Else vReturn = Application.AllDialogs(vArgs(0))
Case &quot;AllForms&quot; : If iNbArgs &lt; 0 Then vReturn = Application.AllForms() Else vReturn = Application.AllForms(vArgs(0))
Case &quot;AllModules&quot; : If iNbArgs &lt; 0 Then vReturn = Application.AllModules() Else vReturn = Application.AllModules(vArgs(0))
Case &quot;CloseConnection&quot;
vReturn = Application.CloseConnection()
Case &quot;CommandBars&quot; : If iNbArgs &lt; 0 Then vReturn = Application.CommandBars() Else vReturn = Application.CommandBars(vArgs(0))
Case &quot;CurrentDb&quot; : vReturn = Application.CurrentDb()
Case &quot;CurrentUser&quot; : vReturn = Application.CurrentUser()
Case &quot;DAvg&quot; : vReturn = Application.DAvg(vArgs(0), vArgs(1), vArgs(2))
Case &quot;DCount&quot; : vReturn = Application.DCount(vArgs(0), vArgs(1), vArgs(2))
Case &quot;DLookup&quot; : vReturn = Application.DLookup(vArgs(0), vArgs(1), vArgs(2), vArgs(3))
Case &quot;DMax&quot; : vReturn = Application.DMax(vArgs(0), vArgs(1), vArgs(2))
Case &quot;DMin&quot; : vReturn = Application.DMin(vArgs(0), vArgs(1), vArgs(2))
Case &quot;DStDev&quot; : vReturn = Application.DStDev(vArgs(0), vArgs(1), vArgs(2))
Case &quot;DStDevP&quot; : vReturn = Application.DStDevP(vArgs(0), vArgs(1), vArgs(2))
Case &quot;DSum&quot; : vReturn = Application.DSum(vArgs(0), vArgs(1), vArgs(2))
Case &quot;DVar&quot; : vReturn = Application.DVar(vArgs(0), vArgs(1), vArgs(2))
Case &quot;DVarP&quot; : vReturn = Application.DVarP(vArgs(0), vArgs(1), vArgs(2))
Case &quot;Forms&quot; : If iNbArgs &lt; 0 Then vReturn = Application.Forms() Else vReturn = Application.Forms(vArgs(0))
Case &quot;getObject&quot; : vReturn = Application.getObject(vArgs(0))
Case &quot;getValue&quot; : vReturn = Application.getValue(vArgs(0))
Case &quot;HtmlEncode&quot; : vReturn = Application.HtmlEncode(vArgs(0), vArgs(1))
Case &quot;OpenDatabase&quot; : vReturn = Application.OpenDatabase(vArgs(0), vArgs(1), vArgs(2), vArgs(3))
Case &quot;ProductCode&quot; : vReturn = Application.ProductCode()
Case &quot;setValue&quot; : vReturn = Application.setValue(vArgs(0), vArgs(1))
Case &quot;SysCmd&quot; : vReturn = Application.SysCmd(vArgs(0), vArgs(1), vARgs(2))
Case &quot;TempVars&quot; : If iNbArgs &lt; 0 Then vReturn = Application.TempVars() Else vReturn = Application.TempVars(vArgs(0))
Case &quot;Version&quot; : vReturn = Application.Version()
Case Else
GoTo Error_Proc
End Select
Case cstDoCmd
sModule = &quot;DoCmd&quot;
Select Case pvScript
Case &quot;ApplyFilter&quot; : vReturn = DoCmd.ApplyFilter(vArgs(0), vArgs(1), vArgs(2))
Case &quot;Close&quot; : vReturn = DoCmd.mClose(vArgs(0), vArgs(1), vArgs(2))
Case &quot;CopyObject&quot; : vReturn = DoCmd.CopyObject(vArgs(0), vArgs(1), vArgs(2), vArgs(3))
Case &quot;FindNext&quot; : vReturn = DoCmd.FindNext()
Case &quot;FindRecord&quot; : vReturn = DoCmd.FindRecord(vArgs(0), vArgs(1), vArgs(2), vArgs(3), vArgs(4), vArgs(5), vArgs(6))
Case &quot;GetHiddenAttribute&quot;
vReturn = DoCmd.GetHiddenAttribute(vArgs(0), vArgs(1))
Case &quot;GoToControl&quot; : vReturn = DoCmd.GoToControl(vArgs(0))
Case &quot;GoToRecord&quot; : vReturn = DoCmd.GoToRecord(vArgs(0), vArgs(1), vArgs(2), vArgs(3))
Case &quot;Maximize&quot; : vReturn = DoCmd.Maximize()
Case &quot;Minimize&quot; : vReturn = DoCmd.Minimize()
Case &quot;MoveSize&quot; : vReturn = DoCmd.MoveSize(vArgs(0), vArgs(1), vArgs(2), vArgs(3))
Case &quot;OpenForm&quot; : vReturn = DoCmd.OpenForm(vArgs(0), vArgs(1), vArgs(2), vArgs(3), vArgs(4), vArgs(5), vArgs(6))
Case &quot;OpenQuery&quot; : vReturn = DoCmd.OpenQuery(vArgs(0), vArgs(1), vArgs(2))
Case &quot;OpenReport&quot; : vReturn = DoCmd.OpenReport(vArgs(0), vArgs(1))
Case &quot;OpenSQL&quot; : vReturn = DoCmd.OpenSQL(vArgs(0), vArgs(1))
Case &quot;OpenTable&quot; : vReturn = DoCmd.OpenTable(vArgs(0), vArgs(1), vArgs(2))
Case &quot;OutputTo&quot; : vReturn = DoCmd.OutputTo(vArgs(0), vArgs(1), vArgs(2), vArgs(3), vArgs(4), vArgs(5), vArgs(6), vArgs(7))
Case &quot;Quit&quot; : _A2B_.CalledSub = &quot;Quit&quot; : GoTo Error_Action
Case &quot;RunApp&quot; : vReturn = DoCmd.RunApp(vArgs(0))
Case &quot;RunCommand&quot; : vReturn = DoCmd.RunCommand(vArgs(0))
Case &quot;RunSQL&quot; : vReturn = DoCmd.RunSQL(vArgs(0), vArgs(1))
Case &quot;SelectObject&quot; : vReturn = DoCmd.SelectObject(vArgs(0), vArgs(1), vArgs(2))
Case &quot;SendObject&quot; : vReturn = DoCmd.SendObject(vArgs(0), vArgs(1), vArgs(2), vArgs(3), vArgs(4), vArgs(5), vArgs(6), vArgs(7), vArgs(8), vArgs(9))
Case &quot;SetHiddenAttribute&quot;
vReturn = DoCmd.SetHiddenAttribute(vArgs(0), vArgs(1), vArgs(2))
Case &quot;SetOrderBy&quot; : vReturn = DoCmd.SetOrderBy(vArgs(0), vArgs(1))
Case &quot;ShowAllRecords&quot;
vReturn = DoCmd.ShowAllRecords()
Case Else
GoTo Error_Proc
End Select
Case Else
&apos; Locate targeted object
If pvObject &gt; UBound(_A2B_.PythonCache) Or pvObject &lt; 0 Then GoTo Error_Object
Set vObject = _A2B_.PythonCache(pvObject)
If IsNull(vObject) Then
If pvScript = &quot;Dispose&quot; Then GoTo Exit_Function Else GoTo Error_Object
End If
&apos; Preprocessing
sScript = pvScript
sModule = vObject._Type
Select Case sScript
Case &quot;Add&quot;
If vObject._Type = &quot;COLLECTION&quot; And vObject._CollType = COLLTABLEDEFS Then vArgs = Array(_A2B_.PythonCache(vArgs(0)))
Case &quot;Close&quot;
sSCript = &quot;mClose&quot;
Case &quot;Type&quot;
sScript = &quot;pType&quot;
Case Else
End Select
&apos; Execute method
Select Case UBound(vArgs) &apos; Dirty but ... CallByName does not support an array of arguments or return values
Case -1
If pvCallType = vbUNO Then
With vObject
Select Case sScript &apos; List all properties that should be called directly (UNO)
Case &quot;BoundField&quot; : vReturn = .BoundField
Case &quot;Column&quot; : vReturn = .Column
Case &quot;Connection&quot; : vReturn = .Connection
case &quot;ContainerWindow&quot; : vReturn = .ContainerWindow
Case &quot;ControlModel&quot; : vReturn = .ControlModel
Case &quot;ControlView&quot; : vReturn = .ControlView
Case &quot;DatabaseForm&quot; : vReturn = .DatabaseForm
Case &quot;Document&quot; : vReturn = .Document
Case &quot;FormsCollection&quot; : vReturn = .FormsCollection
Case &quot;LabelControl&quot; : vReturn = .LabelControl
Case &quot;MetaData&quot; : vReturn = .MetaData
Case &quot;ParentComponent&quot; : vReturn = .ParentComponent
Case &quot;Query&quot; : vReturn = .Query
Case &quot;RowSet&quot; : vReturn = .RowSet
Case &quot;Table&quot; : vReturn = .Table
Case &quot;UnoDialog&quot; : vReturn = .UnoDialog
Case Else
End Select
End With
ElseIf sScript = &quot;ItemData&quot; Then &apos; List all properties that should be called directly (arrays not supported by CallByName)
vReturn = vObject.ItemData
ElseIf sScript = &quot;LinkChildFields&quot; Then
vReturn = vObject.LinkChildFields
ElseIf sScript = &quot;LinkMasterFields&quot; Then
vReturn = vObject.LinkMasterFields
ElseIf sScript = &quot;OpenArgs&quot; Then
vReturn = vObject.OpenArgs
ElseIf sScript = &quot;Selected&quot; Then
vReturn = vObject.Selected
ElseIf sScript = &quot;Value&quot; Then
vReturn = vObject.Value
Else
vReturn = CallByName(vObject, sScript, pvCallType)
End If
Case 0
Select Case sScript
Case &quot;AppendChunk&quot; &apos; Arg is a vector, not supported by CallByName
vReturn = vObject.GetChunk(vArgs(0), vArgs(1))
Case &quot;GetRows&quot; &apos; Returns an array, not supported by CallByName
vReturn = vObject.GetRows(vArgs(0), True) &apos; Force iso dates
Case Else
vReturn = CallByName(vObject, sScript, pvCallType, vArgs(0))
End Select
Case 1
Select Case sScript
Case &quot;GetChunk&quot; &apos; Returns a vector, not supported by CallByName
vReturn = vObject.GetChunk(vArgs(0), vArgs(1))
Case Else
vReturn = CallByName(vObject, sScript, pvCallType, vArgs(0), vArgs(1))
End Select
Case 2 : vReturn = CallByName(vObject, sScript, pvCallType, vArgs(0), vArgs(1), vArgs(2))
Case 3 : vReturn = CallByName(vObject, sScript, pvCallType, vArgs(0), vArgs(1), vArgs(2), vArgs(3))
Case 4 : vReturn = CallByName(vObject, sScript, pvCallType, vArgs(0), vArgs(1), vArgs(2), vArgs(3), vArgs(4))
Case 5 : vReturn = CallByName(vObject, sScript, pvCallType, vArgs(0), vArgs(1), vArgs(2), vArgs(3), vArgs(4), vArgs(5))
Case 6 : vReturn = CallByName(vObject, sScript, pvCallType, vArgs(0), vArgs(1), vArgs(2), vArgs(3), vArgs(4), vArgs(5), vArgs(6))
Case 7 : vReturn = CallByName(vObject, sScript, pvCallType, vArgs(0), vArgs(1), vArgs(2), vArgs(3), vArgs(4), vArgs(5), vArgs(6), vArgs(7))
End Select
&apos; Postprocessing
Select Case pvScript
Case &quot;Close&quot;, &quot;Dispose&quot;, &quot;Terminate&quot;
Set _A2B_.PythonCache(pvObject) = Nothing
Case &quot;Move&quot;, &quot;MoveFirst&quot;, &quot;MoveLast&quot;, &quot;MoveNext&quot;, &quot;MovePrevious&quot; &apos; Pass the new BOF, EOF values (binary format)
If vObject._Type = &quot;RECORDSET&quot; Then
vReturn = (Iif(vObject.BOF, 1, 0) * 2 + Iif(vObject.EOF, 1, 0)) * Iif(vReturn, 1, -1)
End If
Case &quot;Find&quot; &apos; Store in array the arguments passed by reference
If vObject._Type = &quot;MODULE&quot; And vReturn = True Then
vReturn = Array(vReturn, vArgs(1), vArgs(2), vArgs(3), vArgs(4))
End If
Case &quot;ProcOfLine&quot; &apos; Store in array the arguments passed by reference
vReturn = Array(vReturn, vArgs(1))
Case Else
End Select
End Select
&apos; Structure the returned array
If pvCallType = vbUNO Then
vArray = vReturn
Else
If IsNull(vReturn) Then
vArray = Array(cstNull, Null, Null)
ElseIf IsObject(vReturn) Then
Select Case vReturn._Type
Case &quot;COLLECTION&quot;, &quot;COMMANDBARCONTROL&quot;, &quot;EVENT&quot;
vArray = Array(cstObject, _A2B_.AddPython(vReturn), vReturn._Type)
Case Else
vArray = Array(cstObject, _A2B_.AddPython(vReturn), vReturn._Type, vReturn.Name)
End Select
Else
If VarType(vReturn) = vbDate Then
vArray = Array(cstScalar, _CStr(vReturn), Null)
ElseIf VarType(vReturn) = vbBigint Then &apos; Could happen for big integer database fields
vArray = Array(cstScalar, CLng(vReturn), Null)
Else
vArray = Array(cstScalar, vReturn, Null)
End If
End If
End If
PythonWrapper = vArray
Exit_Function:
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;PythonWrapper&quot;, Erl)
GoTo Exit_Function
Error_Object:
TraceError(TRACEFATAL, ERROBJECTNOTFOUND, &quot;Python Wrapper (&quot; &amp; pvScript &amp; &quot;)&quot;, 0, , Array(_GetLabel(&quot;OBJECT&quot;), &quot;#&quot; &amp; pvObject))
GoTo Exit_Function
Error_Action:
TraceError(TRACEFATAL, ERRACTION, Utils._CalledSub(), 0)
GoTo Exit_Function
Error_Proc:
TraceError(TRACEFATAL, ERRPROCEDURENOTFOUND, &quot;Python Wrapper&quot;, 0, , Array(pvScript, sModule))
GoTo Exit_Function
End Function &apos; PythonWrapper V6.4
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PYTHON HELPER FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Public Function PyConvertFromUrl(ByVal pvFile As Variant) As String
&apos; Convenient function to have common conversions of filenames from/to url notations both in Python and Basic
On Local Error GoTo Exit_Function
PyConvertFromUrl = &quot;&quot;
If Not Utils._CheckArgument(pvFile, 1, vbString) Then Goto Exit_Function
PyConvertFromUrl = ConvertFromUrl(pvFile)
Exit_Function:
Exit Function
End Function &apos; PyConvertFromUrl V6.4
REM -----------------------------------------------------------------------------------------------------------------------
Public Function PyConvertToUrl(ByVal pvFile As Variant) As String
&apos; Convenient function to have common conversions of filenames from/to url notations both in Python and Basic
On Local Error GoTo Exit_Function
PyConvertToUrl = &quot;&quot;
If Not Utils._CheckArgument(pvFile, 1, vbString) Then Goto Exit_Function
PyConvertToUrl = ConvertToUrl(pvFile)
Exit_Function:
Exit Function
End Function &apos; PyConvertToUrl V6.4
REM -----------------------------------------------------------------------------------------------------------------------
Public Function PyCreateUnoService(ByVal pvService As Variant) As Variant
&apos; Convenient function to create a UNO service in Python
On Local Error GoTo Exit_Function
Set PyCreateUnoService = Nothing
If Not Utils._CheckArgument(pvService, 1, vbString) Then Goto Exit_Function
Set PyCreateUnoService = CreateUnoService(pvService)
Exit_Function:
Exit Function
End Function &apos; PyCreateUnoService V6.4
REM -----------------------------------------------------------------------------------------------------------------------
Public Function PyDateAdd(ByVal pvAdd As Variant _
, ByVal pvCount As Variant _
, ByVal pvDate As Variant _
) As Variant
&apos; Convenient shortcut to useful and easy-to-use Basic date functions
Dim vDate As Variant, vNewDate As Variant
On Local Error GoTo Exit_Function
PyDateAdd = Null
If Not Utils._CheckArgument(pvAdd, 1, vbString) Then Goto Exit_Function
If Not Utils._CheckArgument(pvCount, 2, Utils._AddNumeric()) Then Goto Exit_Function
If Not Utils._CheckArgument(pvDate, 3, vbString) Then Goto Exit_Function
vDate = _CDate(pvDate)
vNewDate = DateAdd(pvAdd, pvCount, vDate)
If VarType(vNewDate) = vbDate Then PyDateAdd = _CStr(vNewDate) Else PyDateAdd = vNewDate
Exit_Function:
Exit Function
End Function &apos; PyDateAdd V6.4
REM -----------------------------------------------------------------------------------------------------------------------
Public Function PyDateDiff(ByVal pvAdd As Variant _
, ByVal pvDate1 As Variant _
, ByVal pvDate2 As Variant _
, ByVal pvWeekStart As Variant _
, ByVal pvYearStart As Variant _
) As Variant
&apos; Convenient shortcut to useful and easy-to-use Basic date functions
Dim vDate1 As Variant, vDate2 As Variant
On Local Error GoTo Exit_Function
PyDateDiff = Null
If Not Utils._CheckArgument(pvAdd, 1, vbString) Then Goto Exit_Function
If Not Utils._CheckArgument(pvDate1, 2, vbString) Then Goto Exit_Function
If Not Utils._CheckArgument(pvDate2, 3, vbString) Then Goto Exit_Function
If Not Utils._CheckArgument(pvWeekStart, 4, Utils._AddNumeric()) Then Goto Exit_Function
If Not Utils._CheckArgument(pvWeekStart, 5, Utils._AddNumeric()) Then Goto Exit_Function
vDate1 = _CDate(pvDate1)
vDate2 = _CDate(pvDate2)
PyDateDiff = DateDiff(pvAdd, vDate1, vDate2, pvWeekStart, pvYearStart)
Exit_Function:
Exit Function
End Function &apos; PyDateDiff V6.4
REM -----------------------------------------------------------------------------------------------------------------------
Public Function PyDatePart(ByVal pvAdd As Variant _
, ByVal pvDate As Variant _
, ByVal pvWeekStart As Variant _
, ByVal pvYearStart As Variant _
) As Variant
&apos; Convenient shortcut to useful and easy-to-use Basic date functions
Dim vDate As Variant
On Local Error GoTo Exit_Function
PyDatePart = Null
If Not Utils._CheckArgument(pvAdd, 1, vbString) Then Goto Exit_Function
If Not Utils._CheckArgument(pvDate, 2, vbString) Then Goto Exit_Function
If Not Utils._CheckArgument(pvWeekStart, 3, Utils._AddNumeric()) Then Goto Exit_Function
If Not Utils._CheckArgument(pvWeekStart, 4, Utils._AddNumeric()) Then Goto Exit_Function
vDate = _CDate(pvDate)
PyDatePart = DatePart(pvAdd, vDate, pvWeekStart, pvYearStart)
Exit_Function:
Exit Function
End Function &apos; PyDatePart V6.4
REM -----------------------------------------------------------------------------------------------------------------------
Public Function PyDateValue(ByVal pvDate As Variant) As Variant
&apos; Convenient shortcut to useful and easy-to-use Basic date functions
Dim vDate As Variant
On Local Error GoTo Exit_Function
PyDateValue = Null
If Not Utils._CheckArgument(pvDate, 1, vbString) Then Goto Exit_Function
vDate = DateValue(pvDate)
If VarType(vDate) = vbDate Then PyDateValue = _CStr(vDate) Else PyDateValue = vDate
Exit_Function:
Exit Function
End Function &apos; PyDateValue V6.4
REM -----------------------------------------------------------------------------------------------------------------------
Public Function PyFormat(ByVal pvValue As Variant, pvFormat As Variant) As String
&apos; Convenient function to format numbers or dates
On Local Error GoTo Exit_Function
PyFormat = &quot;&quot;
If Not Utils._CheckArgument(pvValue, 1, Utils._AddNumeric(vbString)) Then Goto Exit_Function
pvValue = _CDate(pvValue)
If IsEmpty(pvFormat) Then
PyFormat = Str(pvValue)
Else
If Not Utils._CheckArgument(pvFormat, 2, vbString) Then Goto Exit_Function
PyFormat = Format(pvValue, pvFormat)
End If
Exit_Function:
Exit Function
End Function &apos; PyFormat V6.4
REM -----------------------------------------------------------------------------------------------------------------------
Public Function PyGetGUIType() As Variant
PyGetGUIType = GetGUIType()
End Function &apos; PyGetGUIType V6.4
REM -----------------------------------------------------------------------------------------------------------------------
Public Function PyGetSystemTicks() As Variant
PyGetSystemTicks = GetSystemTicks()
End Function &apos; PyGetSystemTicks V6.4
REM -----------------------------------------------------------------------------------------------------------------------
Public Function PyGlobalScope(ByVal pvLib As Variant) As Variant
Select Case pvLib
Case &quot;Basic&quot;
PyGlobalScope = GlobalScope.BasicLibraries()
Case &quot;Dialog&quot;
PyGlobalScope = GlobalScope.DialogLibraries()
Case Else
End Select
End Function &apos; PyGlobalScope V6.4
REM -----------------------------------------------------------------------------------------------------------------------
Public Function PyInputBox(ByVal pvText As Variant _
, ByVal pvTitle As Variant _
, ByVal pvDefault As Variant _
, ByVal pvXPos As Variant _
, ByVal pvYPos As Variant _
) As Variant
&apos; Convenient function to open input box from Python
On Local Error GoTo Exit_Function
PyInputBox = Null
If Not Utils._CheckArgument(pvText, 1, vbString) Then Goto Exit_Function
If IsEmpty(pvTitle) Then pvTitle = &quot;&quot;
If Not Utils._CheckArgument(pvTitle, 2, vbString) Then Goto Exit_Function
If IsEmpty(pvDefault) Then pvDefault = &quot;&quot;
If Not Utils._CheckArgument(pvDefault, 3, vbString) Then Goto Exit_Function
If IsEmpty(pvXPos) Or IsEmpty(pvYPos) Then
PyInputBox = InputBox(pvText, pvTitle, pvDefault)
Else
If Not Utils._CheckArgument(pvXPos, 4, Utils._AddNumeric()) Then Goto Exit_Function
If Not Utils._CheckArgument(pvYPos, 5, Utils._AddNumeric()) Then Goto Exit_Function
PyInputBox = InputBox(pvText, pvTitle, pvDefault, pvXPos, pvYPos)
End If
Exit_Function:
Exit Function
End Function &apos; PyInputBox V6.4.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function PyMsgBox(ByVal pvText As Variant _
, ByVal pvType As Variant _
, ByVal pvDialogTitle As Variant _
) As Variant
&apos; Convenient function to open message box from Python
On Local Error GoTo Exit_Function
PyMsgBox = Null
If Not Utils._CheckArgument(pvText, 1, vbString) Then Goto Exit_Function
If IsEmpty(pvType) Then pvType = 0
If Not Utils._CheckArgument(pvType, 2, Utils._AddNumeric()) Then Goto Exit_Function
If IsEmpty(pvDialogTitle) Then
PyMsgBox = MsgBox(pvText, pvType)
Else
If Not Utils._CheckArgument(pvDialogTitle, 3, vbString) Then Goto Exit_Function
PyMsgBox = MsgBox(pvText, pvType, pvDialogTitle)
End If
Exit_Function:
Exit Function
End Function &apos; PyMsgBox V6.4.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function PyTimer() As Long
&apos; Convenient function to call Timer from Python
PyTimer = Timer
End Function &apos; PyTimer V6.4
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _CDate(ByVal pvValue As Variant) As Variant
&apos; Return a Date type if iso date, otherwise return input
Dim vValue As Variant
vValue = pvValue
If VarType(pvValue) = vbString Then
If pvValue &lt;&gt; &quot;&quot; And IsDate(pvValue) Then vValue = CDate(pvValue) &apos; IsDate(&quot;&quot;) gives True !?
End If
_CDate = vValue
End Function
</script:module>

View File

@@ -0,0 +1,311 @@
<?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="Root_" 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 --- FOR INTERNAL USE ONLY ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS ROOT FIELDS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private ErrorHandler As Boolean
Private MinimalTraceLevel As Integer
Private TraceLogs() As Variant
Private TraceLogCount As Integer
Private TraceLogLast As Integer
Private TraceLogMaxEntries As Integer
Private LastErrorCode As Integer
Private LastErrorLevel As String
Private ErrorText As String
Private ErrorLongText As String
Private CalledSub As String
Private DebugPrintShort As Boolean
Private Introspection As Object &apos; com.sun.star.beans.Introspection
Private VersionNumber As String &apos; Actual Access2Base version number
Private Locale As String
Private ExcludeA2B As Boolean
Private TextSearch As Object
Private SearchOptions As Variant
Private FindRecord As Object
Private StatusBar As Object
Private Dialogs As Object &apos; Collection
Private TempVars As Object &apos; Collection
Private CurrentDoc() As Variant &apos; Array of document containers - [0] = Base document, [1 ... N] = other documents
Private PythonCache() As Variant &apos; Array of objects created in Python scripts
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CONSTRUCTORS / DESTRUCTORS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Initialize()
VersionNumber = Access2Base_Version
ErrorHandler = True
MinimalTraceLevel = 0
TraceLogs() = Array()
TraceLogCount = 0
TraceLogLast = 0
TraceLogMaxEntries = 0
LastErrorCode = 0
LastErrorLevel = &quot;&quot;
ErrorText = &quot;&quot;
ErrorLongText = &quot;&quot;
CalledSub = &quot;&quot;
DebugPrintShort = True
Locale = L10N._GetLocale()
ExcludeA2B = True
Set Introspection = CreateUnoService(&quot;com.sun.star.beans.Introspection&quot;)
Set TextSearch = CreateUnoService(&quot;com.sun.star.util.TextSearch&quot;)
SearchOptions = New com.sun.star.util.SearchOptions
With SearchOptions
.algorithmType = com.sun.star.util.SearchAlgorithms.REGEXP
.searchFlag = 0
.transliterateFlags = com.sun.star.i18n.TransliterationModules.IGNORE_CASE
End With
Set FindRecord = Nothing
Set StatusBar = Nothing
Set Dialogs = New Collection
Set TempVars = New Collection
CurrentDoc = Array()
ReDim CurrentDoc(0 To 0)
Set CurrentDoc(0) = Nothing
PythonCache = Array()
End Sub &apos; Constructor
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Terminate()
Call Class_Initialize()
End Sub &apos; Destructor
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub Dispose()
Call Class_Terminate()
End Sub &apos; Explicit destructor
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS GET/LET/SET PROPERTIES ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS METHODS ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Public Function AddPython(ByRef pvObject As Variant) As Long
&apos; Store the object as a new entry in PythonCache and return its entry number
Dim lVars As Long, vObject As Variant
lVars = UBound(PythonCache) + 1
ReDim Preserve PythonCache(0 To lVars)
PythonCache(lVars) = pvObject
AddPython = lVars
End Function &apos; AddPython V6.4
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub CloseConnection()
&apos; Close all connections established by current document to free memory.
&apos; - if Base document =&gt; close the one concerned database connection
&apos; - if non-Base documents =&gt; close the connections of each individual standalone form
Dim i As Integer, iCurrentDoc As Integer
Dim vDbContainer As Variant, vDbContainers() As Variant, vDocContainer As Variant
If ErrorHandler Then On Local Error Goto Error_Sub
If Not IsArray(CurrentDoc) Then Goto Exit_Sub
If UBound(CurrentDoc) &lt; 0 Then Goto Exit_Sub
iCurrentDoc = CurrentDocIndex( , False) &apos; False prevents error raising if not found
If iCurrentDoc &lt; 0 Then GoTo Exit_Sub &apos; If not found ignore
vDocContainer = CurrentDocument(iCurrentDoc)
With vDocContainer
If Not .Active Then GoTo Exit_Sub &apos; e.g. if multiple calls to CloseConnection()
For i = 0 To UBound(.DbContainers)
If Not IsNull(.DbContainers(i).Database) Then
.DbContainers(i).Database.Dispose()
Set .DbContainers(i).Database = Nothing
End If
TraceLog(TRACEANY, UCase(CalledSub) &amp; &quot; &quot; &amp; .URL &amp; Iif(i = 0, &quot;&quot;, &quot; Form=&quot; &amp; .DbContainers(i).FormName), False)
Set .DbContainers(i) = Nothing
Next i
.DbContainers = Array()
.URL = &quot;&quot;
.DbConnect = 0
.Active = False
Set .Document = Nothing
End With
CurrentDoc(iCurrentDoc) = vDocContainer
Exit_Sub:
Exit Sub
Error_Sub:
TraceError(TRACEABORT, Err, CalledSub, Erl, False) &apos; No error message addressed to the user, only stored in console
GoTo Exit_Sub
End Sub &apos; CloseConnection
REM -----------------------------------------------------------------------------------------------------------------------
Public Function CurrentDb() As Object
&apos; Returns _A2B_.CurrentDocument().Database as an object to allow access to its properties
Dim iCurrentDoc As Integer
Set CurrentDb = Nothing
If Not IsArray(CurrentDoc) Then Goto Exit_Function
If UBound(CurrentDoc) &lt; 0 Then Goto Exit_Function
iCurrentDoc = CurrentDocIndex(, False) &apos; False = no abort
If iCurrentDoc &gt;= 0 Then
If UBound(CurrentDoc(iCurrentDoc).DbContainers) &gt;= 0 Then Set CurrentDb = CurrentDoc(iCurrentDoc).DbContainers(0).Database
End If
Exit_Function:
Exit Function
End Function &apos; CurrentDb
REM -----------------------------------------------------------------------------------------------------------------------
Public Function CurrentDocIndex(Optional pvURL As Variant, Optional pbAbort As Variant) As Integer
&apos; Returns the entry in CurrentDoc(...) referring to the current document
Dim i As Integer, bFound As Boolean, sURL As String
Const cstBase = &quot;com.sun.star.comp.dba.ODatabaseDocument&quot;
bFound = False
CurrentDocIndex = -1
If Not IsArray(CurrentDoc) Then Goto Trace_Error
If UBound(CurrentDoc) &lt; 0 Then Goto Trace_Error
For i = 1 To UBound(CurrentDoc) &apos; [0] reserved to database .odb document
If IsMissing(pvURL) Then &apos; Not on 1 single line ?!?
If Utils._hasUNOProperty(ThisComponent, &quot;URL&quot;) Then
sURL = ThisComponent.URL
Else
Exit For &apos; f.i. ThisComponent = Basic IDE ...
End If
Else
sURL = pvURL &apos; To support the SelectObject action
End If
If CurrentDoc(i).Active And CurrentDoc(i).URL = sURL Then
CurrentDocIndex = i
bFound = True
Exit For
End If
Next i
If Not bFound Then
If IsNull(CurrentDoc(0)) Then GoTo Trace_Error
With CurrentDoc(0)
If Not .Active Then GoTo Trace_Error
If IsNull(.Document) Then GoTo Trace_Error
End With
CurrentDocIndex = 0
End If
Exit_Function:
Exit Function
Trace_Error:
If IsMissing(pbAbort) Then pbAbort = True
If pbAbort Then TraceError(TRACEABORT, ERRDBNOTCONNECTED, Utils._CalledSub(), 0, 1) Else CurrentDocIndex = -1
Goto Exit_Function
End Function &apos; CurrentDocIndex
REM -----------------------------------------------------------------------------------------------------------------------
Public Function CurrentDocument(ByVal Optional piDocIndex As Integer) As Variant
&apos; Returns the CurrentDoc(...) referring to the current document or to the argument
Dim iDocIndex As Integer
If IsMissing(piDocIndex) Then iDocIndex = CurrentDocIndex(, False) Else iDocIndex = piDocIndex
If iDocIndex &gt;= 0 And iDocIndex &lt;= UBound(CurrentDoc) Then Set CurrentDocument = CurrentDoc(iDocIndex) Else Set CurrentDocument = Nothing
End Function
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub Dump()
&apos; For debugging purposes
Dim i As Integer, j As Integer, vCurrentDoc As Variant
On Local Error Resume Next
DebugPrint &quot;Version&quot;, VersionNumber
DebugPrint &quot;TraceLevel&quot;, MinimalTraceLevel
DebugPrint &quot;TraceCount&quot;, TraceLogCount
DebugPrint &quot;CalledSub&quot;, CalledSub
If IsArray(CurrentDoc) Then
For i = 0 To UBound(CurrentDoc)
vCurrentDoc = CurrentDoc(i)
If Not IsNull(vCurrentDoc) Then
DebugPrint i, &quot;URL&quot;, vCurrentDoc.URL
For j = 0 To UBound(vCurrentDoc.DbContainers)
DebugPrint i, j, &quot;Form&quot;, vCurrentDoc.DbContainers(j).FormName
DebugPrint i, j, &quot;Database&quot;, vCurrentDoc.DbContainers(j).Database.Title
Next j
End If
Next i
End If
End Sub
REM -----------------------------------------------------------------------------------------------------------------------
Public Function hasItem(psCollType As String, ByVal psName As String) As Boolean
&apos; Return True if psName if in the collection
Dim oItem As Object
On Local Error Goto Error_Function &apos; Whatever ErrorHandler !
hasItem = True
Select Case psCollType
Case COLLALLDIALOGS
Set oItem = Dialogs.Item(UCase(psName))
Case COLLTEMPVARS
Set oItem = TempVars.Item(UCase(psName))
Case Else
hasItem = False
End Select
Exit_Function:
Exit Function
Error_Function: &apos; Item by key aborted
hasItem = False
GoTo Exit_Function
End Function &apos; hasItem
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
REM -----------------------------------------------------------------------------------------------------------------------
Public Function _CurrentDb(ByVal Optional piDocEntry As Integer, ByVal Optional piDbEntry As Integer) As Variant
REM Without arguments same as CurrentDb() except that it generates an error if database not connected (internal use)
REM With 2 arguments return the corresponding entry in Root
Dim odbDatabase As Variant
If IsMissing(piDocEntry) Then
Set odbDatabase = CurrentDb()
Else
If Not IsArray(CurrentDoc) Then Goto Trace_Error
If piDocEntry &lt; 0 Or piDbEntry &lt; 0 Then Goto Trace_Error
If piDocEntry &gt; UBound(CurrentDoc) Then Goto Trace_Error
If piDbEntry &gt; UBound(CurrentDoc(piDocEntry).DbContainers) Then Goto Trace_Error
Set odbDatabase = CurrentDoc(piDocEntry).DbContainers(piDbEntry).Database
End If
If IsNull(odbDatabase) Then GoTo Trace_Error
Exit_Function:
Set _CurrentDb = odbDatabase
Exit Function
Trace_Error:
TraceError(TRACEABORT, ERRDBNOTCONNECTED, Utils._CalledSub(), 0, 1)
Goto Exit_Function
End Function &apos; _CurrentDb
</script:module>

View File

@@ -0,0 +1,757 @@
<?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="SubForm" 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 &apos; Must be SUBFORM
Private _This As Object &apos; Workaround for absence of This builtin function
Private _Parent As Object
Private _Shortcut As String
Private _Name As String
Private _MainForm As String
Private _DocEntry As Integer
Private _DbEntry As Integer
Private _OrderBy As String
Public ParentComponent As Object &apos; com.sun.star.text.TextDocument
Public DatabaseForm As Object &apos; com.sun.star.form.component.DataForm and com.sun.star.sdb.ResultSet (a.o.)
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CONSTRUCTORS / DESTRUCTORS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJSUBFORM
Set _This = Nothing
Set _Parent = Nothing
_Shortcut = &quot;&quot;
_Name = &quot;&quot;
_MainForm = &quot;&quot;
_DocEntry = -1
_DbEntry = -1
_OrderBy = &quot;&quot;
Set ParentComponent = Nothing
Set DatabaseForm = Nothing
End Sub &apos; Constructor
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Terminate()
On Local Error Resume Next
Call Class_Initialize()
End Sub &apos; Destructor
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub Dispose()
Call Class_Terminate()
End Sub &apos; Explicit destructor
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS GET/LET/SET PROPERTIES ---
REM -----------------------------------------------------------------------------------------------------------------------
Property Get AllowAdditions() As Variant
AllowAdditions = _PropertyGet(&quot;AllowAdditions&quot;)
End Property &apos; AllowAdditions (get)
Property Let AllowAdditions(ByVal pvValue As Variant)
Call _PropertySet(&quot;AllowAdditions&quot;, pvValue)
End Property &apos; AllowAdditions (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get AllowDeletions() As Variant
AllowDeletions = _PropertyGet(&quot;AllowDeletions&quot;)
End Property &apos; AllowDeletions (get)
Property Let AllowDeletions(ByVal pvValue As Variant)
Call _PropertySet(&quot;AllowDeletions&quot;, pvValue)
End Property &apos; AllowDeletions (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get AllowEdits() As Variant
AllowEdits = _PropertyGet(&quot;AllowEdits&quot;)
End Property &apos; AllowEdits (get)
Property Let AllowEdits(ByVal pvValue As Variant)
Call _PropertySet(&quot;AllowEdits&quot;, pvValue)
End Property &apos; AllowEdits (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get CurrentRecord() As Variant
CurrentRecord = _PropertyGet(&quot;CurrentRecord&quot;)
End Property &apos; CurrentRecord (get)
Property Let CurrentRecord(ByVal pvValue As Variant)
Call _PropertySet(&quot;CurrentRecord&quot;, pvValue)
End Property &apos; CurrentRecord (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Filter() As Variant
Filter = _PropertyGet(&quot;Filter&quot;)
End Property &apos; Filter (get)
Property Let Filter(ByVal pvValue As Variant)
Call _PropertySet(&quot;Filter&quot;, pvValue)
End Property &apos; Filter (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get FilterOn() As Variant
FilterOn = _PropertyGet(&quot;FilterOn&quot;)
End Property &apos; FilterOn (get)
Property Let FilterOn(ByVal pvValue As Variant)
Call _PropertySet(&quot;FilterOn&quot;, pvValue)
End Property &apos; FilterOn (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get LinkChildFields(ByVal Optional pvIndex As Variant) As Variant
If IsMissing(pvIndex) Then LinkChildFields = _PropertyGet(&quot;LinkChildFields&quot;) Else LinkChildFields = _PropertyGet(&quot;LinkChildFields&quot;, pvIndex)
End Property &apos; LinkChildFields (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get LinkMasterFields(ByVal Optional pvIndex As Variant) As Variant
If IsMissing(pvIndex) Then LinkMasterFields = _PropertyGet(&quot;LinkMasterFields&quot;) Else LinkMasterFields = _PropertyGet(&quot;LinkMasterFields&quot;, pvIndex)
End Property &apos; LinkMasterFields (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Name() As String
Name = _PropertyGet(&quot;Name&quot;)
End Property &apos; Name (get)
Public Function pName() As String &apos; For compatibility with &lt; V0.9.0
pName = _PropertyGet(&quot;Name&quot;)
End Function &apos; pName (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ObjectType() As String
ObjectType = _PropertyGet(&quot;ObjectType&quot;)
End Property &apos; ObjectType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnApproveCursorMove() As Variant
OnApproveCursorMove = _PropertyGet(&quot;OnApproveCursorMove&quot;)
End Property &apos; OnApproveCursorMove (get)
Property Let OnApproveCursorMove(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnApproveCursorMove&quot;, pvValue)
End Property &apos; OnApproveCursorMove (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnApproveParameter() As Variant
OnApproveParameter = _PropertyGet(&quot;OnApproveParameter&quot;)
End Property &apos; OnApproveParameter (get)
Property Let OnApproveParameter(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnApproveParameter&quot;, pvValue)
End Property &apos; OnApproveParameter (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnApproveReset() As Variant
OnApproveReset = _PropertyGet(&quot;OnApproveReset&quot;)
End Property &apos; OnApproveReset (get)
Property Let OnApproveReset(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnApproveReset&quot;, pvValue)
End Property &apos; OnApproveReset (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnApproveRowChange() As Variant
OnApproveRowChange = _PropertyGet(&quot;OnApproveRowChange&quot;)
End Property &apos; OnApproveRowChange (get)
Property Let OnApproveRowChange(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnApproveRowChange&quot;, pvValue)
End Property &apos; OnApproveRowChange (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnApproveSubmit() As Variant
OnApproveSubmit = _PropertyGet(&quot;OnApproveSubmit&quot;)
End Property &apos; OnApproveSubmit (get)
Property Let OnApproveSubmit(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnApproveSubmit&quot;, pvValue)
End Property &apos; OnApproveSubmit (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnConfirmDelete() As Variant
OnConfirmDelete = _PropertyGet(&quot;OnConfirmDelete&quot;)
End Property &apos; OnConfirmDelete (get)
Property Let OnConfirmDelete(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnConfirmDelete&quot;, pvValue)
End Property &apos; OnConfirmDelete (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnCursorMoved() As Variant
OnCursorMoved = _PropertyGet(&quot;OnCursorMoved&quot;)
End Property &apos; OnCursorMoved (get)
Property Let OnCursorMoved(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnCursorMoved&quot;, pvValue)
End Property &apos; OnCursorMoved (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnErrorOccurred() As Variant
OnErrorOccurred = _PropertyGet(&quot;OnErrorOccurred&quot;)
End Property &apos; OnErrorOccurred (get)
Property Let OnErrorOccurred(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnErrorOccurred&quot;, pvValue)
End Property &apos; OnErrorOccurred (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnLoaded() As Variant
OnLoaded = _PropertyGet(&quot;OnLoaded&quot;)
End Property &apos; OnLoaded (get)
Property Let OnLoaded(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnLoaded&quot;, pvValue)
End Property &apos; OnLoaded (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnReloaded() As Variant
OnReloaded = _PropertyGet(&quot;OnReloaded&quot;)
End Property &apos; OnReloaded (get)
Property Let OnReloaded(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnReloaded&quot;, pvValue)
End Property &apos; OnReloaded (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnReloading() As Variant
OnReloading = _PropertyGet(&quot;OnReloading&quot;)
End Property &apos; OnReloading (get)
Property Let OnReloading(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnReloading&quot;, pvValue)
End Property &apos; OnReloading (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnResetted() As Variant
OnResetted = _PropertyGet(&quot;OnResetted&quot;)
End Property &apos; OnResetted (get)
Property Let OnResetted(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnResetted&quot;, pvValue)
End Property &apos; OnResetted (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnRowChanged() As Variant
OnRowChanged = _PropertyGet(&quot;OnRowChanged&quot;)
End Property &apos; OnRowChanged (get)
Property Let OnRowChanged(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnRowChanged&quot;, pvValue)
End Property &apos; OnRowChanged (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnUnloaded() As Variant
OnUnloaded = _PropertyGet(&quot;OnUnloaded&quot;)
End Property &apos; OnUnloaded (get)
Property Let OnUnloaded(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnUnloaded&quot;, pvValue)
End Property &apos; OnUnloaded (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OnUnloading() As Variant
OnUnloading = _PropertyGet(&quot;OnUnloading&quot;)
End Property &apos; OnUnloading (get)
Property Let OnUnloading(ByVal pvValue As Variant)
Call _PropertySet(&quot;OnUnloading&quot;, pvValue)
End Property &apos; OnUnloading (set)
REM -----------------------------------------------------------------------------------------------------------------------
Public Function OptionGroup(ByVal Optional pvGroupName As Variant) As Variant
&apos; Return either an error or an object of type OPTIONGROUP based on its name
Const cstThisSub = &quot;SubForm.OptionGroup&quot;
Dim ogGroup As Object
Utils._SetCalledSub(cstThisSub)
If IsMissing(pvGroupName) Then Call _TraceArguments()
If _ErrorHandler() Then On Local Error Goto Error_Function
Set ogGroup = _OptionGroup(pvGroupName, CTLPARENTISSUBFORM, ParentComponent, DatabaseForm)
If Not IsNull(ogGroup) Then
ogGroup._DocEntry = _DocEntry
ogGroup._DbEntry = _DbEntry
End If
Set OptionGroup = ogGroup
Exit_Function:
Utils._ResetCalledSub(cstThisSub)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, cstThisSub, Erl)
GoTo Exit_Function
End Function &apos; OptionGroup V1.1.0
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OrderBy() As Variant
OrderBy = _PropertyGet(&quot;OrderBy&quot;)
End Property &apos; OrderBy (get) V1.2.0
Property Let OrderBy(ByVal pvValue As Variant)
Call _PropertySet(&quot;OrderBy&quot;, pvValue)
End Property &apos; OrderBy (set)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get OrderByOn() As Variant
OrderByOn = _PropertyGet(&quot;OrderByOn&quot;)
End Property &apos; OrderByOn (get) V1.2.0
Property Let OrderByOn(ByVal pvValue As Variant)
Call _PropertySet(&quot;OrderByOn&quot;, pvValue)
End Property &apos; OrderByOn (set)
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Parent() As Object
Utils._SetCalledSub(&quot;SubForm.getParent&quot;)
On Error Goto Error_Function
Set Parent = _Parent
Exit_Function:
Utils._ResetCalledSub(&quot;SubForm.getParent&quot;)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;SubForm.getParent&quot;, Erl)
Set Parent = Nothing
GoTo Exit_Function
End Function &apos; Parent
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
&apos; Return
&apos; a Collection object if pvIndex absent
&apos; a Property object otherwise
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
Exit Function
End Function &apos; Properties
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Recordset() As Object
Recordset = _PropertyGet(&quot;Recordset&quot;)
End Property &apos; Recordset (get) V0.9.5
REM -----------------------------------------------------------------------------------------------------------------------
Property Get RecordSource() As Variant
RecordSource = _PropertyGet(&quot;RecordSource&quot;)
End Property &apos; RecordSource (get)
Property Let RecordSource(ByVal pvValue As Variant)
Call _PropertySet(&quot;RecordSource&quot;, pvValue)
End Property &apos; RecordSource (set)
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS METHODS ---
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Controls(Optional ByVal pvIndex As Variant) As Variant
&apos; Return a Control object with name or index = pvIndex
If _ErrorHandler() Then On Local Error Goto Error_Function
Utils._SetCalledSub(&quot;SubForm.Controls&quot;)
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
Set ocControl = Nothing
iControlCount = DatabaseForm.getCount()
If IsMissing(pvIndex) Then &apos; No argument, return Collection pseudo-object
Set oCounter = New Collect
Set oCounter._This = oCounter
oCounter._CollType = COLLCONTROLS
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
&apos; Start building the ocControl object
&apos; Determine exact name
Set ocControl = New Control
Set ocControl._This = ocControl
Set ocControl._Parent = _This
ocControl._ParentType = CTLPARENTISSUBFORM
sParentShortcut = _Shortcut
sControls() = DatabaseForm.getElementNames()
Select Case VarType(pvIndex)
Case vbInteger, vbLong, vbSingle, vbDouble, vbCurrency, vbBigint, vbDecimal
If pvIndex &lt; 0 Or pvIndex &gt; iControlCount - 1 Then Goto Trace_Error_Index
ocControl._Name = sControls(pvIndex)
Case vbString &apos; 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 &amp; &quot;!&quot; &amp; Utils._Surround(._Name)
Set .ControlModel = DatabaseForm.getByName(._Name)
._ImplementationName = .ControlModel.getImplementationName()
._FormComponent = ParentComponent
If Utils._hasUNOProperty(.ControlModel, &quot;ClassId&quot;) Then ._ClassId = .ControlModel.ClassId
If ._ClassId &gt; 0 And ._ClassId &lt;&gt; acHiddenControl Then
Set .ControlView = ParentComponent.CurrentController.getControl(.ControlModel)
End If
._Initialize()
._DocEntry = _DocEntry
._DbEntry = _DbEntry
End With
Set Controls = ocControl
Exit_Function:
Utils._ResetCalledSub(&quot;SubForm.Controls&quot;)
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
Error_Function:
TraceError(TRACEABORT, Err, &quot;SubForm.Controls&quot;, Erl)
Set Controls = Nothing
GoTo Exit_Function
End Function &apos; Controls V1.1.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
&apos; Return property value of psProperty property name
Utils._SetCalledSub(&quot;SubForm.getProperty&quot;)
If IsMissing(pvProperty) Then Call _TraceArguments()
getProperty = _PropertyGet(pvProperty)
Utils._ResetCalledSub(&quot;SubForm.getProperty&quot;)
End Function &apos; getProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
&apos; 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 &apos; hasProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Refresh() As Boolean
&apos; Refresh data with its most recent value in the database in a form or subform
Utils._SetCalledSub(&quot;SubForm.Refresh&quot;)
If _ErrorHandler() Then On Local Error Goto Error_Function
Refresh = False
Dim oSet As Object
Set oSet = DatabaseForm.createResultSet()
If Not IsNull(oSet) Then
oSet.refreshRow()
Refresh = True
End If
Exit_Function:
Set oSet = Nothing
Utils._ResetCalledSub(&quot;SubForm.Refresh&quot;)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;SubForm.Refresh&quot;, Erl)
GoTo Exit_Function
End Function &apos; Refresh
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Requery() As Boolean
&apos; Refresh data displayed in a form, subform, combobox or listbox
Utils._SetCalledSub(&quot;SubForm.Requery&quot;)
If _ErrorHandler() Then On Local Error Goto Error_Function
Requery = False
DatabaseForm.reload()
Requery = True
Exit_Function:
Utils._ResetCalledSub(&quot;SubForm.Requery&quot;)
Exit Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;SubForm.Requery&quot;, Erl)
GoTo Exit_Function
End Function &apos; Requery
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setProperty(ByVal Optional psProperty As String, ByVal Optional pvValue As Variant) As Boolean
&apos; Return True if property setting OK
Utils._SetCalledSub(&quot;SubForm.setProperty&quot;)
setProperty = _PropertySet(psProperty, pvValue)
Utils._ResetCalledSub(&quot;SubForm.setProperty&quot;)
End Function
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _GetListener(ByVal psProperty As String) As String
&apos; Return the X...Listener corresponding with the property in argument
Select Case UCase(psProperty)
Case UCase(&quot;OnApproveCursorMove&quot;)
_GetListener = &quot;XRowSetApproveListener&quot;
Case UCase(&quot;OnApproveParameter&quot;)
_GetListener = &quot;XDatabaseParameterListener&quot;
Case UCase(&quot;OnApproveReset&quot;), UCase(&quot;OnResetted&quot;)
_GetListener = &quot;XResetListener&quot;
Case UCase(&quot;OnApproveRowChange&quot;)
_GetListener = &quot;XRowSetApproveListener&quot;
Case UCase(&quot;OnApproveSubmit&quot;)
_GetListener = &quot;XSubmitListener&quot;
Case UCase(&quot;OnConfirmDelete&quot;)
_GetListener = &quot;XConfirmDeleteListener&quot;
Case UCase(&quot;OnCursorMoved&quot;), UCase(&quot;OnRowChanged&quot;)
_GetListener = &quot;XRowSetListener&quot;
Case UCase(&quot;OnErrorOccurred&quot;)
_GetListener = &quot;XSQLErrorListener&quot;
Case UCase(&quot;OnLoaded&quot;), UCase(&quot;OnReloaded&quot;), UCase(&quot;OnReloading&quot;), UCase(&quot;OnUnloaded&quot;), UCase(&quot;OnUnloading&quot;)
_GetListener = &quot;XLoadListener&quot;
End Select
End Function &apos; _GetListener V1.7.0
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertiesList() As Variant
_PropertiesList = Array(&quot;AllowAdditions&quot;, &quot;AllowDeletions&quot;, &quot;AllowEdits&quot;, &quot;CurrentRecord&quot; _
, &quot;Filter&quot;, &quot;FilterOn&quot;, &quot;LinkChildFields&quot;, &quot;LinkMasterFields&quot;, &quot;Name&quot; _
, &quot;ObjectType&quot;, &quot;OnApproveCursorMove&quot;, &quot;OnApproveParameter&quot; _
, &quot;OnApproveReset&quot;, &quot;OnApproveRowChange&quot;, &quot;OnApproveSubmit&quot;, &quot;OnConfirmDelete&quot; _
, &quot;OnCursorMoved&quot;, &quot;OnErrorOccurred&quot;, &quot;OnLoaded&quot;, &quot;OnReloaded&quot;, &quot;OnReloading&quot; _
, &quot;OnResetted&quot;, &quot;OnRowChanged&quot;, &quot;OnUnloaded&quot;, &quot;OnUnloading&quot;, &quot;OrderBy&quot; _
, &quot;OrderByOn&quot;, &quot;Parent&quot;, &quot;RecordSource&quot; _
) &apos; Recordset removed
End Function &apos; _PropertiesList
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertyGet(ByVal psProperty As String, ByVal Optional pvIndex As Variant) As Variant
&apos; Return property value of the psProperty property name
If _ErrorHandler() Then On Local Error Goto Error_Function
Utils._SetCalledSub(&quot;SubForm.get&quot; &amp; psProperty)
Dim iArgNr As Integer
If Not IsMissing(pvIndex) Then
Select Case UCase(_A2B_.CalledSub)
Case UCase(&quot;getProperty&quot;) : iArgNr = 3
Case UCase(&quot;SubForm.getProperty&quot;) : iArgNr = 2
Case UCase(&quot;SubForm.get&quot; &amp; psProperty) : iArgNr = 1
End Select
If Not Utils._CheckArgument(pvIndex, iArgNr, Utils._AddNumeric()) Then Goto Exit_Function
End If
&apos;Execute
Dim oDatabase As Object, vBookmark As Variant, oObject As Object
_PropertyGet = EMPTY
Select Case UCase(psProperty)
Case UCase(&quot;AllowAdditions&quot;)
_PropertyGet = DatabaseForm.AllowInserts
Case UCase(&quot;AllowDeletions&quot;)
_PropertyGet = DatabaseForm.AllowDeletes
Case UCase(&quot;AllowEdits&quot;)
_PropertyGet = DatabaseForm.AllowUpdates
Case UCase(&quot;CurrentRecord&quot;)
_PropertyGet = DatabaseForm.Row
Case UCase(&quot;Filter&quot;)
_PropertyGet = DatabaseForm.Filter
Case UCase(&quot;FilterOn&quot;)
_PropertyGet = DatabaseForm.ApplyFilter
Case UCase(&quot;LinkChildFields&quot;)
If Utils._hasUNOProperty(DatabaseForm, &quot;DetailFields&quot;) Then
If IsMissing(pvIndex) Then
_PropertyGet = DatabaseForm.DetailFields
Else
If pvIndex &lt; 0 Or pvIndex &gt; UBound(DatabaseForm.DetailFields) Then Goto trace_Error_Index
_PropertyGet = DatabaseForm.DetailFields(pvIndex)
End If
End If
Case UCase(&quot;LinkMasterFields&quot;)
If Utils._hasUNOProperty(DatabaseForm, &quot;MasterFields&quot;) Then
If IsMissing(pvIndex) Then
_PropertyGet = DatabaseForm.MasterFields
Else
If pvIndex &lt; 0 Or pvIndex &gt; UBound(DatabaseForm.MasterFields) Then Goto trace_Error_Index
_PropertyGet = DatabaseForm.MasterFields(pvIndex)
End If
End If
Case UCase(&quot;Name&quot;)
_PropertyGet = _Name
Case UCase(&quot;ObjectType&quot;)
_PropertyGet = _Type
Case UCase(&quot;OnApproveCursorMove&quot;), UCase(&quot;OnApproveParameter&quot;), UCase(&quot;OnApproveReset&quot;), UCase(&quot;OnApproveRowChange&quot;) _
, UCase(&quot;OnApproveSubmit&quot;), UCase(&quot;OnConfirmDelete&quot;), UCase(&quot;OnCursorMoved&quot;), UCase(&quot;OnErrorOccurred&quot;) _
, UCase(&quot;OnLoaded&quot;), UCase(&quot;OnReloaded&quot;), UCase(&quot;OnReloading&quot;), UCase(&quot;OnResetted&quot;), UCase(&quot;OnRowChanged&quot;) _
, UCase(&quot;OnUnloaded&quot;), UCase(&quot;OnUnloading&quot;)
_PropertyGet = Utils._GetEventScriptCode(DatabaseForm, psProperty, _Name)
Case UCase(&quot;OrderBy&quot;)
_PropertyGet = _OrderBy
Case UCase(&quot;OrderByOn&quot;)
If DatabaseForm.Order = &quot;&quot; Then _PropertyGet = False Else _PropertyGet = True
Case UCase(&quot;Parent&quot;) &apos; Only for indirect access from property object
_PropertyGet = Parent
Case UCase(&quot;Recordset&quot;)
If DatabaseForm.Command = &quot;&quot; Then Goto Trace_Error &apos; No underlying data ??
Set oObject = New Recordset
With DatabaseForm
Set oObject._This = oObject
oObject._CommandType = .CommandType
oObject._Command = .Command
oObject._ParentName = _Name
oObject._ParentType = _Type
Set oDatabase = Application._CurrentDb(_DocEntry, _DbEntry)
Set oObject._ParentDatabase = oDatabase
Set oObject._ParentDatabase.Connection = .ActiveConnection
oObject._ForwardOnly = ( .ResultSetType = com.sun.star.sdbc.ResultSetType.FORWARD_ONLY )
oObject._PassThrough = ( .EscapeProcessing = False )
oObject._ReadOnly = ( .ResultSetConcurrency = com.sun.star.sdbc.ResultSetConcurrency.READ_ONLY )
Call oObject._Initialize()
End With
With oDatabase
.RecordsetMax = .RecordsetMax + 1
oObject._Name = Format(.RecordsetMax, &quot;0000000&quot;)
.RecordsetsColl.Add(oObject, UCase(oObject._Name))
End With
Set _PropertyGet = oObject
Case UCase(&quot;RecordSource&quot;)
_PropertyGet = DatabaseForm.Command
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(&quot;SubForm.get&quot; &amp; psProperty)
Exit Function
Trace_Error:
TraceError(TRACEWARNING, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
_PropertyGet = EMPTY
Goto Exit_Function
Trace_Error_Index:
TraceError(TRACEFATAL, ERRINDEXVALUE, Utils._CalledSub(), 0, 1, psProperty)
_PropertyGet = EMPTY
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;SubForm._PropertyGet&quot;, Erl)
_PropertyGet = EMPTY
GoTo Exit_Function
End Function &apos; _PropertyGet
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Variant) As Boolean
Utils._SetCalledSub(&quot;SubForm.set&quot; &amp; psProperty)
If _ErrorHandler() Then On Local Error Goto Error_Function
_PropertySet = True
&apos;Execute
Dim iArgNr As Integer
If _IsLeft(_A2B_.CalledSub, &quot;SubForm.&quot;) Then iArgNr = 1 Else iArgNr = 2
Select Case UCase(psProperty)
Case UCase(&quot;AllowAdditions&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
DatabaseForm.AllowInserts = pvValue
DatabaseForm.reload()
Case UCase(&quot;AllowDeletions&quot;)
If Not Utils._CheckArgument(pvValue,iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
DatabaseForm.AllowDeletes = pvValue
DatabaseForm.reload()
Case UCase(&quot;AllowEdits&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
DatabaseForm.AllowUpdates = pvValue
DatabaseForm.reload()
Case UCase(&quot;CurrentRecord&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, Utils._AddNumeric(), , False) Then Goto Trace_Error_Value
DatabaseForm.absolute(pvValue)
Case UCase(&quot;Filter&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
DatabaseForm.Filter = Application._CurrentDb(_DocEntry, _DbEntry)._ReplaceSquareBrackets(pvValue)
Case UCase(&quot;FilterOn&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
DatabaseForm.ApplyFilter = pvValue
DatabaseForm.reload()
Case UCase(&quot;OnApproveCursorMove&quot;), UCase(&quot;OnApproveParameter&quot;), UCase(&quot;OnApproveReset&quot;), UCase(&quot;OnApproveRowChange&quot;) _
, UCase(&quot;OnApproveSubmit&quot;), UCase(&quot;OnConfirmDelete&quot;), UCase(&quot;OnCursorMoved&quot;), UCase(&quot;OnErrorOccurred&quot;) _
, UCase(&quot;OnLoaded&quot;), UCase(&quot;OnReloaded&quot;), UCase(&quot;OnReloading&quot;), UCase(&quot;OnResetted&quot;), UCase(&quot;OnRowChanged&quot;) _
, UCase(&quot;OnUnloaded&quot;), UCase(&quot;OnUnloading&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
If Not Utils._RegisterEventScript(DatabaseForm _
, psProperty _
, _GetListener(psProperty) _
, pvValue, _Name _
) Then GoTo Trace_Error
Case UCase(&quot;OrderBy&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
_OrderBy = Application._CurrentDb(_DocEntry, _DbEntry)._ReplaceSquareBrackets(pvValue)
Case UCase(&quot;OrderByOn&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value
If pvValue Then DatabaseForm.Order = _OrderBy Else DatabaseForm.Order = &quot;&quot;
DatabaseForm.reload()
Case UCase(&quot;RecordSource&quot;)
If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
DatabaseForm.Command = Application._CurrentDb(_DocEntry, _DbEntry)._ReplaceSquareBrackets(pvValue)
DatabaseForm.CommandType = com.sun.star.sdb.CommandType.COMMAND
DatabaseForm.Filter = &quot;&quot;
DatabaseForm.reload()
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(&quot;SubForm.set&quot; &amp; psProperty)
Exit Function
Trace_Error:
TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
_PropertySet = False
Goto Exit_Function
Trace_Error_Value:
TraceError(TRACEFATAL, ERRPROPERTYVALUE, Utils._CalledSub(), 0, 1, Array(pvValue, psProperty))
_PropertySet = False
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;SubForm._PropertySet&quot;, Erl)
_PropertySet = False
GoTo Exit_Function
End Function &apos; _PropertySet
</script:module>

View File

@@ -0,0 +1,195 @@
<?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="TempVar" 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 &apos; Must be TEMPVAR
Private _This As Object &apos; Workaround for absence of This builtin function
Private _Parent As Object
Private _Name As String
Private _Value As Variant
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CONSTRUCTORS / DESTRUCTORS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJTEMPVAR
Set _This = Nothing
Set _Parent = Nothing
_Name = &quot;&quot;
_Value = Null
End Sub &apos; Constructor
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub Class_Terminate()
On Local Error Resume Next
Call Class_Initialize()
End Sub &apos; Destructor
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub Dispose()
Call Class_Terminate()
End Sub &apos; Explicit destructor
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS GET/LET/SET PROPERTIES ---
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Name() As String
Name = _PropertyGet(&quot;Name&quot;)
End Property &apos; Name (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get ObjectType() As String
ObjectType = _PropertyGet(&quot;ObjectType&quot;)
End Property &apos; ObjectType (get)
REM -----------------------------------------------------------------------------------------------------------------------
Property Get Value() As Variant
Value = _PropertyGet(&quot;Value&quot;)
End Property &apos; Value (get)
Property Let Value(ByVal pvValue As Variant)
Call _PropertySet(&quot;Value&quot;, pvValue)
End Property &apos; Value (set)
REM -----------------------------------------------------------------------------------------------------------------------
REM --- CLASS METHODS ---
REM -----------------------------------------------------------------------------------------------------------------------
Public Function getProperty(Optional ByVal pvProperty As Variant) As Variant
&apos; Return property value of psProperty property name
Utils._SetCalledSub(&quot;TempVar.getProperty&quot;)
If IsMissing(pvProperty) Then Call _TraceArguments()
getProperty = _PropertyGet(pvProperty)
Utils._ResetCalledSub(&quot;TempVar.getProperty&quot;)
End Function &apos; getProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function hasProperty(ByVal Optional pvProperty As Variant) As Boolean
&apos; 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 &apos; hasProperty
REM -----------------------------------------------------------------------------------------------------------------------
Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
&apos; Return
&apos; a Collection object if pvIndex absent
&apos; a Property object otherwise
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
Exit Function
End Function &apos; Properties
REM -----------------------------------------------------------------------------------------------------------------------
Public Function setProperty(ByVal Optional psProperty As String, ByVal Optional pvValue As Variant) As Boolean
&apos; Return True if property setting OK
Utils._SetCalledSub(&quot;TempVar.getProperty&quot;)
setProperty = _PropertySet(psProperty, pvValue)
Utils._ResetCalledSub(&quot;TempVar.getProperty&quot;)
End Function
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertiesList() As Variant
_PropertiesList = Array(&quot;Name&quot;, &quot;ObjectType&quot;, &quot;Value&quot;)
End Function &apos; _PropertiesList
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertyGet(ByVal psProperty As String) As Variant
&apos; Return property value of the psProperty property name
If _ErrorHandler() Then On Local Error Goto Error_Function
Utils._SetCalledSub(&quot;TempVar.get&quot; &amp; psProperty)
_PropertyGet = Nothing
Select Case UCase(psProperty)
Case UCase(&quot;Name&quot;)
_PropertyGet = _Name
Case UCase(&quot;ObjectType&quot;)
_PropertyGet = _Type
Case UCase(&quot;Value&quot;)
_PropertyGet = _Value
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(&quot;TempVar.get&quot; &amp; psProperty)
Exit Function
Trace_Error:
TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
_PropertyGet = Nothing
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;TempVar._PropertyGet&quot;, Erl)
_PropertyGet = Nothing
GoTo Exit_Function
End Function &apos; _PropertyGet
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Variant) As Boolean
Utils._SetCalledSub(&quot;TempVar.set&quot; &amp; psProperty)
If _ErrorHandler() Then On Local Error Goto Error_Function
_PropertySet = True
&apos;Execute
Dim iArgNr As Integer
If _IsLeft(_A2B_.CalledSub, &quot;TempVar.&quot;) Then iArgNr = 1 Else iArgNr = 2
Select Case UCase(psProperty)
Case UCase(&quot;Value&quot;)
_Value = pvValue
_A2B_.TempVars.Item(UCase(_Name)).Value = pvValue
Case Else
Goto Trace_Error
End Select
Exit_Function:
Utils._ResetCalledSub(&quot;TempVar.set&quot; &amp; psProperty)
Exit Function
Trace_Error:
TraceError(TRACEFATAL, ERRPROPERTY, Utils._CalledSub(), 0, 1, psProperty)
_PropertySet = False
Goto Exit_Function
Trace_Error_Value:
TraceError(TRACEFATAL, ERRPROPERTYVALUE, Utils._CalledSub(), 0, 1, Array(pvValue, psProperty))
_PropertySet = False
Goto Exit_Function
Error_Function:
TraceError(TRACEABORT, Err, &quot;TempVar._PropertySet&quot;, Erl)
_PropertySet = False
GoTo Exit_Function
End Function &apos; _PropertySet
</script:module>

View File

@@ -0,0 +1,14 @@
<?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="Test" script:language="StarBasic">Option Explicit
&apos;Option Compatible
Sub Main
Dim a, b()
_ErrorHandler(False)
&apos; DebugPrint vbLF
&apos; TraceConsole()
exit sub
End Sub
</script:module>

View File

@@ -0,0 +1,438 @@
<?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="Trace" 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 Explicit
Public Const cstLogMaxEntries = 99
REM Typical Usage
REM TraceLog(&quot;INFO&quot;, &quot;The OK button was pressed&quot;)
REM
REM Typical Usage for error logging
REM Sub MySub()
REM On Local Error GoTo Error_Sub
REM ...
REM Exit_Sub:
REM Exit Sub
REM Error_Sub:
REM TraceError(&quot;ERROR&quot;, Err, &quot;MySub&quot;, Erl)
REM GoTo Exit_Sub
REM End Sub
REM
REM To display the current logged traces and/or to set parameters
REM TraceConsole()
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub TraceConsole()
&apos; Display the Trace dialog with current trace log values and parameter choices
If _ErrorHandler() Then On Local Error Goto Error_Sub
Dim sLineBreak As String, oTraceDialog As Object
sLineBreak = vbNewLine
Set oTraceDialog = CreateUnoDialog(Utils._GetDialogLib().dlgTrace)
oTraceDialog.Title = _GetLabel(&quot;DLGTRACE_TITLE&quot;)
oTraceDialog.Model.HelpText = _GetLabel(&quot;DLGTRACE_HELP&quot;)
Dim oEntries As Object, oTraceLog As Object, oClear As Object, oMinLevel As Object, oNbEntries As Object, oDump As Object
Dim oControl As Object
Dim i As Integer, sText As String, iOKCancel As Integer
Set oNbEntries = oTraceDialog.Model.getByName(&quot;numNbEntries&quot;)
oNbEntries.Value = _A2B_.TraceLogCount
oNbEntries.HelpText = _GetLabel(&quot;DLGTRACE_LBLNBENTRIES_HELP&quot;)
Set oControl = oTraceDialog.Model.getByName(&quot;lblNbEntries&quot;)
oControl.Label = _GetLabel(&quot;DLGTRACE_LBLNBENTRIES_LABEL&quot;)
oControl.HelpText = _GetLabel(&quot;DLGTRACE_LBLNBENTRIES_HELP&quot;)
Set oEntries = oTraceDialog.Model.getByName(&quot;numEntries&quot;)
If _A2B_.TraceLogMaxEntries = 0 Then _A2B_.TraceLogMaxEntries = cstLogMaxEntries
oEntries.Value = _A2B_.TraceLogMaxEntries
oEntries.HelpText = _GetLabel(&quot;DLGTRACE_LBLENTRIES_HELP&quot;)
Set oControl = oTraceDialog.Model.getByName(&quot;lblEntries&quot;)
oControl.Label = _GetLabel(&quot;DLGTRACE_LBLENTRIES_LABEL&quot;)
oControl.HelpText = _GetLabel(&quot;DLGTRACE_LBLENTRIES_HELP&quot;)
Set oDump = oTraceDialog.Model.getByName(&quot;cmdDump&quot;)
oDump.Enabled = 0
oDump.Label = _GetLabel(&quot;DLGTRACE_CMDDUMP_LABEL&quot;)
oDump.HelpText = _GetLabel(&quot;DLGTRACE_CMDDUMP_HELP&quot;)
Set oTraceLog = oTraceDialog.Model.getByName(&quot;txtTraceLog&quot;)
oTraceLog.HelpText = _GetLabel(&quot;DLGTRACE_TXTTRACELOG_HELP&quot;)
If UBound(_A2B_.TraceLogs) &gt;= 0 Then &apos; Array yet initialized
oTraceLog.HardLineBreaks = True
sText = &quot;&quot;
If _A2B_.TraceLogCount &gt; 0 Then
If _A2B_.TraceLogCount &lt; _A2B_.TraceLogMaxEntries Then i = -1 Else i = _A2B_.TraceLogLast
Do
If i &lt; _A2B_.TraceLogMaxEntries - 1 Then i = i + 1 Else i = 0
If Len(_A2B_.TraceLogs(i)) &gt; 11 Then
sText = sText &amp; Right(_A2B_.TraceLogs(i), Len(_A2B_.TraceLogs(i)) - 11) &amp; sLineBreak &apos; Skip date in display
End If
Loop While i &lt;&gt; _A2B_.TraceLogLast
oDump.Enabled = 1 &apos; Enable DumpToFile only if there is something to dump
End If
If Len(sText) &gt; 0 Then sText = Left(sText, Len(sText) - Len(sLineBreak)) &apos; Skip last linefeed
oTraceLog.Text = sText
Else
oTraceLog.Text = _GetLabel(&quot;DLGTRACE_TXTTRACELOG_TEXT&quot;)
End If
Set oClear = oTraceDialog.Model.getByName(&quot;chkClear&quot;)
oClear.State = 0 &apos; Unchecked
oClear.HelpText = _GetLabel(&quot;DLGTRACE_LBLCLEAR_HELP&quot;)
Set oControl = oTraceDialog.Model.getByName(&quot;lblClear&quot;)
oControl.Label = _GetLabel(&quot;DLGTRACE_LBLCLEAR_LABEL&quot;)
oControl.HelpText = _GetLabel(&quot;DLGTRACE_LBLCLEAR_HELP&quot;)
Set oMinLevel = oTraceDialog.Model.getByName(&quot;cboMinLevel&quot;)
If _A2B_.MinimalTraceLevel = 0 Then _A2B_.MinimalTraceLevel = _TraceLevel(TRACEERRORS)
oMinLevel.Text = _TraceLevel(_A2B_.MinimalTraceLevel)
oMinLevel.HelpText = _GetLabel(&quot;DLGTRACE_LBLMINLEVEL_HELP&quot;)
Set oControl = oTraceDialog.Model.getByName(&quot;lblMinLevel&quot;)
oControl.Label = _GetLabel(&quot;DLGTRACE_LBLMINLEVEL_LABEL&quot;)
oControl.HelpText = _GetLabel(&quot;DLGTRACE_LBLMINLEVEL_HELP&quot;)
Set oControl = oTraceDialog.Model.getByName(&quot;cmdOK&quot;)
oControl.Label = _GetLabel(&quot;DLGTRACE_CMDOK_LABEL&quot;)
oControl.HelpText = _GetLabel(&quot;DLGTRACE_CMDOK_HELP&quot;)
Set oControl = oTraceDialog.Model.getByName(&quot;cmdCancel&quot;)
oControl.Label = _GetLabel(&quot;DLGTRACE_CMDCANCEL_LABEL&quot;)
oControl.HelpText = _GetLabel(&quot;DLGTRACE_CMDCANCEL_HELP&quot;)
iOKCancel = oTraceDialog.Execute()
Select Case iOKCancel
Case 1 &apos; OK
If oClear.State = 1 Then
_A2B_.TraceLogs() = Array() &apos; Erase logged traces
_A2B_.TraceLogCount = 0
End If
If oMinLevel.Text &lt;&gt; &quot;&quot; Then _A2B_.MinimalTraceLevel = _TraceLevel(oMinLevel.Text)
If oEntries.Value &lt;&gt; 0 And oEntries.Value &lt;&gt; _A2B_.TraceLogMaxEntries Then
_A2B_.TraceLogs() = Array()
_A2B_.TraceLogMaxEntries = oEntries.Value
End If
Case 0 &apos; Cancel
Case Else
End Select
Exit_Sub:
If Not IsNull(oTraceDialog) Then oTraceDialog.Dispose()
Exit Sub
Error_Sub:
With _A2B_
.TraceLogs() = Array()
.TraceLogCount = 0
.TraceLogLast = 0
End With
GoTo Exit_Sub
End Sub &apos; TraceConsole V1.1.0
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub TraceError(ByVal psErrorLevel As String _
, ByVal piErrorCode As Integer _
, ByVal psErrorProc As String _
, ByVal piErrorLine As Integer _
, ByVal Optional pvMsgBox As Variant _
, ByVal Optional pvArgs As Variant _
)
&apos; Store error code and description in trace rolling buffer
&apos; Display error message if errorlevel &gt;= ERROR
&apos; Stop program execution if errorlevel = FATAL or ABORT
On Local Error Resume Next
If IsEmpty(_A2B_) Then Call Application._RootInit() &apos; First use of Access2Base in current LibO/AOO session
Dim sErrorText As String, sErrorDesc As String, oDb As Object, bMsgBox As Boolean
sErrorDesc = _ErrorMessage(piErrorCode, pvArgs)
sErrorText = _GetLabel(&quot;ERR#&quot;) &amp; CStr(piErrorCode) _
&amp; &quot; (&quot; &amp; sErrorDesc &amp; &quot;) &quot; &amp; _GetLabel(&quot;ERROCCUR&quot;) _
&amp; Iif(piErrorLine &gt; 0, &quot; &quot; &amp; _GetLabel(&quot;ERRLINE&quot;) &amp; &quot; &quot; &amp; CStr(piErrorLine), &quot;&quot;) _
&amp; Iif(psErrorProc &lt;&gt; &quot;&quot;, &quot; &quot; &amp; _GetLabel(&quot;ERRIN&quot;) &amp; &quot; &quot; &amp; psErrorProc, Iif(_A2B_.CalledSub = &quot;&quot;, &quot;&quot;, &quot; &quot; &amp; _Getlabel(&quot;ERRIN&quot;) &amp; &quot; &quot; &amp; _A2B_.CalledSub))
With _A2B_
.LastErrorCode = piErrorCode
.LastErrorLevel = psErrorLevel
.ErrorText = sErrorDesc
.ErrorLongText = sErrorText
.CalledSub = &quot;&quot;
End With
If VarType(pvMsgBox) = vbError Then
bMsgBox = ( psErrorLevel = TRACEERRORS Or psErrorLevel = TRACEFATAL Or psErrorLevel = TRACEABORT )
ElseIf IsMissing(pvMsgBox) Then
bMsgBox = ( psErrorLevel = TRACEERRORS Or psErrorLevel = TRACEFATAL Or psErrorLevel = TRACEABORT )
Else
bMsgBox = pvMsgBox
End If
TraceLog(psErrorLevel, sErrorText, bMsgBox)
&apos; Unexpected error detected in user program or in Access2Base
If psErrorLevel = TRACEFATAL Or psErrorLevel = TRACEABORT Then
If psErrorLevel = TRACEFATAL Then
Set oDb = _A2B_.CurrentDb()
If Not IsNull(oDb) Then oDb.CloseAllrecordsets()
End If
Stop
End If
End Sub &apos; TraceError V0.9.5
REM -----------------------------------------------------------------------------------------------------------------------
Public Function TraceErrorCode() As Variant
&apos; Return the last encountered error code, level, description in an array
&apos; UNPUBLISHED
Dim vError As Variant
With _A2B_
vError = Array( _
.LastErrorCode _
, .LastErrorLevel _
, .ErrorText _
, .ErrorLongText _
)
End With
TraceErrorCode = vError
End Function &apos; TraceErrorCode V6.3
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub TraceLevel(ByVal Optional psTraceLevel As String)
&apos; Set trace level to argument
If _ErrorHandler() Then On Local Error Goto Error_Sub
Select Case True
Case IsMissing(psTraceLevel) : psTraceLevel = &quot;ERROR&quot;
Case psTraceLevel = &quot;&quot; : psTraceLevel = &quot;ERROR&quot;
Case Utils._InList(UCase(psTraceLevel), Array( _
TRACEDEBUG, TRACEINFO, TRACEWARNING, TRACEERRORS, TRACEFATAL, TRACEABORT _
))
Case Else : Goto Exit_Sub
End Select
_A2B_.MinimalTraceLevel = _TraceLevel(psTraceLevel)
Exit_Sub:
Exit Sub
Error_Sub:
With _A2B_
.TraceLogs() = Array()
.TraceLogCount = 0
.TraceLogLast = 0
End With
GoTo Exit_Sub
End Sub &apos; TraceLevel V0.9.5
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub TraceLog(ByVal psTraceLevel As String _
, ByVal psText As String _
, ByVal Optional pbMsgBox As Boolean _
)
&apos; Store Text in trace log (circular buffer)
If _ErrorHandler() Then On Local Error Goto Error_Sub
Dim vTraceLogs() As String, sTraceLevel As String
With _A2B_
If .MinimalTraceLevel = 0 Then .MinimalTraceLevel = _TraceLevel(TRACEERRORS)
If _TraceLevel(psTraceLevel) &lt; .MinimalTraceLevel Then Exit Sub
If UBound(.TraceLogs) = -1 Then &apos; Initialize TraceLog
If .TraceLogMaxEntries = 0 Then .TraceLogMaxEntries = cstLogMaxEntries
Redim vTraceLogs(0 To .TraceLogMaxEntries - 1)
.TraceLogs = vTraceLogs
.TraceLogCount = 0
.TraceLogLast = -1
If .MinimalTraceLevel = 0 Then .MinimalTraceLevel = _TraceLevel(TRACEERRORS) &apos; Set default value
End If
.TraceLogLast = .TraceLogLast + 1
If .TraceLogLast &gt; UBound(.TraceLogs) Then .TraceLogLast = LBound(.TraceLogs) &apos; Circular buffer
If Len(psTraceLevel) &gt; 7 Then sTraceLevel = Left(psTraceLevel, 7) Else sTraceLevel = psTraceLevel &amp; Spc(8 - Len(psTraceLevel))
.TraceLogs(.TraceLogLast) = Format(Now(), &quot;YYYY-MM-DD hh:mm:ss&quot;) &amp; &quot; &quot; &amp; sTraceLevel &amp; psText
If .TraceLogCount &lt;= UBound(.TraceLogs) Then .TraceLogCount = .TraceLogCount + 1 &apos; # of active entries
End With
If IsMissing(pbMsgBox) Then pbMsgBox = True
Dim iMsgBox As Integer
If pbMsgBox Then
Select Case psTraceLevel
Case TRACEINFO: iMsgBox = vbInformation
Case TRACEERRORS, TRACEWARNING: iMsgBox = vbExclamation
Case TRACEFATAL, TRACEABORT: iMsgBox = vbCritical
Case Else: iMsgBox = vbInformation
End Select
MsgBox psText, vbOKOnly + iMsgBox, psTraceLevel
End If
Exit_Sub:
Exit Sub
Error_Sub:
With _A2B_
.TraceLogs() = Array()
.TraceLogCount = 0
.TraceLogLast = 0
End With
GoTo Exit_Sub
End Sub &apos; TraceLog V0.9.5
REM -----------------------------------------------------------------------------------------------------------------------
REM --- PRIVATE FUNCTIONS ---
REM -----------------------------------------------------------------------------------------------------------------------
Private Sub _DumpToFile(oEvent As Object)
&apos; Execute the Dump To File command from the Trace dialog
&apos; Modified from Andrew Pitonyak&apos;s Base Macro Programming §10.4
If _ErrorHandler() Then On Local Error GoTo Error_Sub
Dim sPath as String, iFileNumber As Integer, i As Integer
sPath = _PromptFilePicker(&quot;txt&quot;)
If sPath &lt;&gt; &quot;&quot; Then &apos; Save button pressed
If UBound(_A2B_.TraceLogs) &gt;= 0 Then &apos; Array yet initialized
iFileNumber = FreeFile()
Open sPath For Append Access Write Lock Read As iFileNumber
If _A2B_.TraceLogCount &gt; 0 Then
If _A2B_.TraceLogCount &lt; _A2B_.TraceLogMaxEntries Then i = -1 Else i = _A2B_.TraceLogLast
Do
If i &lt; _A2B_.TraceLogMaxEntries - 1 Then i = i + 1 Else i = 0
Print #iFileNumber _A2B_.TraceLogs(i)
Loop While i &lt;&gt; _A2B_.TraceLogLast
End If
Close iFileNumber
MsgBox _GetLabel(&quot;SAVECONSOLEENTRIES&quot;), vbOK + vbInformation, _GetLabel(&quot;SAVECONSOLE&quot;)
End If
End If
Exit_Sub:
Exit Sub
Error_Sub:
TraceError(&quot;ERROR&quot;, Err, &quot;DumpToFile&quot;, Erl)
GoTo Exit_Sub
End Sub &apos; DumpToFile V0.8.5
REM -----------------------------------------------------------------------------------------------------------------------
Public Function _ErrorHandler(Optional ByVal pbCheck As Boolean) As Boolean
&apos; Indicate if error handler is activated or not
&apos; When argument present set error handler
If IsEmpty(_A2B_) Then Call Application._RootInit() &apos; First use of Access2Base in current LibO/AOO session
If Not IsMissing(pbCheck) Then _A2B_.ErrorHandler = pbCheck
_ErrorHandler = _A2B_.ErrorHandler
Exit Function
End Function
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _ErrorMessage(ByVal piErrorNumber As Integer, Optional ByVal pvArgs As Variant) As String
&apos; Return error message corresponding to ErrorNumber (standard or not)
&apos; and replaces %0, %1, ... , %9 by psArgs(0), psArgs(1), ...
Dim sErrorMessage As String, i As Integer, sErrLabel
_ErrorMessage = &quot;&quot;
If piErrorNumber &gt; ERRINIT Then
sErrLabel = &quot;ERR&quot; &amp; piErrorNumber
sErrorMessage = _Getlabel(sErrLabel)
If Not IsMissing(pvArgs) Then
If Not IsArray(pvArgs) Then
sErrorMessage = Join(Split(sErrorMessage, &quot;%0&quot;), Utils._CStr(pvArgs, False))
Else
For i = LBound(pvArgs) To UBound(pvArgs)
sErrorMessage = Join(Split(sErrorMessage, &quot;%&quot; &amp; i), Utils._CStr(pvArgs(i), False))
Next i
End If
End If
Else
sErrorMessage = Error(piErrorNumber)
&apos; Most (or all?) error messages terminate with a &quot;.&quot;
If Len(sErrorMessage) &gt; 1 And Right(sErrorMessage, 1) = &quot;.&quot; Then sErrorMessage = Left(sErrorMessage, Len(sErrorMessage)-1)
End If
_ErrorMessage = sErrorMessage
Exit Function
End Function &apos; ErrorMessage V0.8.9
REM -----------------------------------------------------------------------------------------------------------------------
Public Function _PromptFilePicker(ByVal psSuffix As String) As String
&apos; Prompt for output file name
&apos; Return &quot;&quot; if Cancel
&apos; Modified from Andrew Pitonyak&apos;s Base Macro Programming §10.4
If _ErrorHandler() Then On Local Error GoTo Error_Function
Dim oFileDialog as Object, oUcb as object, oPath As Object
Dim iAccept as Integer, sInitPath as String
Set oFileDialog = CreateUnoService(&quot;com.sun.star.ui.dialogs.FilePicker&quot;)
oFileDialog.Initialize(Array(com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_AUTOEXTENSION))
Set oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
oFileDialog.appendFilter(&quot;*.&quot; &amp; psSuffix, &quot;*.&quot; &amp; psSuffix)
oFileDialog.appendFilter(&quot;*.*&quot;, &quot;*.*&quot;)
oFileDialog.setCurrentFilter(&quot;*.&quot; &amp; psSuffix)
Set oPath = createUnoService(&quot;com.sun.star.util.PathSettings&quot;)
sInitPath = oPath.Work &apos; Probably My Documents
If oUcb.Exists(sInitPath) Then oFileDialog.SetDisplayDirectory(sInitPath)
iAccept = oFileDialog.Execute()
_PromptFilePicker = &quot;&quot;
If iAccept = 1 Then &apos; Save button pressed
_PromptFilePicker = oFileDialog.Files(0)
End If
Exit_Function:
If Not IsEmpty(oFileDialog) And Not IsNull(oFileDialog) Then oFileDialog.Dispose()
Exit Function
Error_Function:
TraceError(&quot;ERROR&quot;, Err, &quot;PromptFilePicker&quot;, Erl)
GoTo Exit_Function
End Function &apos; PromptFilePicker V0.8.5
REM -----------------------------------------------------------------------------------------------------------------------
Public Sub _TraceArguments(Optional psCall As String)
&apos; Process the ERRMISSINGARGUMENTS error
&apos; psCall is present if error detected before call to _SetCalledSub
If Not IsMissing(psCall) Then Utils._SetCalledSub(psCall)
TraceError(TRACEFATAL, ERRMISSINGARGUMENTS, Utils._CalledSub(), 0)
Exit Sub
End Sub &apos; TraceArguments
REM -----------------------------------------------------------------------------------------------------------------------
Private Function _TraceLevel(ByVal pvTraceLevel As Variant) As Variant
&apos; Convert string trace level to numeric value or the opposite
Dim vTraces As Variant, i As Integer
vTraces = Array(TRACEDEBUG, TRACEINFO, TRACEWARNING, TRACEERRORS, TRACEFATAL, TRACEABORT, TRACEANY)
Select Case VarType(pvTraceLevel)
Case vbString
_TraceLevel = 4 &apos; 4 = Default
For i = 0 To UBound(vTraces)
If UCase(pvTraceLevel) = UCase(vTraces(i)) Then
_TraceLevel = i + 1
Exit For
End If
Next i
Case vbInteger, vbLong, vbSingle, vbDouble, vbCurrency, vbBigint, vbDecimal
If pvTraceLevel &lt; 1 Or pvTraceLevel &gt; UBound(vTraces) + 1 Then _TraceLevel = TRACEERRORS Else _TraceLevel = vTraces(pvTraceLevel - 1)
End Select
End Function &apos; TraceLevel
</script:module>

View File

@@ -0,0 +1,331 @@
<?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="UtilProperty" 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 =======================================================================================================================
&apos;**********************************************************************
&apos; UtilProperty module
&apos;
&apos; Module of utilities to manipulate arrays of PropertyValue&apos;s.
&apos;**********************************************************************
&apos;**********************************************************************
&apos; Copyright (c) 2003-2004 Danny Brewer
&apos; d29583@groovegarden.com
&apos;**********************************************************************
&apos;**********************************************************************
&apos; If you make changes, please append to the change log below.
&apos;
&apos; Change Log
&apos; Danny Brewer Revised 2004-02-25-01
&apos; Jean-Pierre Ledure Adapted to Access2Base coding conventions
&apos; PropValuesToStr rewritten and addition of StrToPropValues
&apos; Bug corrected on date values
&apos; Addition of support of 2-dimensional arrays
&apos; Support of empty arrays to allow JSON conversions
&apos;**********************************************************************
Option Explicit
Private Const cstHEADER = &quot;### PROPERTYVALUES ###&quot;
Private Const cstEMPTYARRAY = &quot;### EMPTY ARRAY ###&quot;
REM =======================================================================================================================
Public Function _MakePropertyValue(ByVal Optional psName As String, Optional pvValue As Variant) As com.sun.star.beans.PropertyValue
&apos; Create and return a new com.sun.star.beans.PropertyValue.
Dim oPropertyValue As New com.sun.star.beans.PropertyValue
If Not IsMissing(psName) Then oPropertyValue.Name = psName
If Not IsMissing(pvValue) Then oPropertyValue.Value = _CheckPropertyValue(pvValue)
_MakePropertyValue() = oPropertyValue
End Function &apos; _MakePropertyValue V1.3.0
REM =======================================================================================================================
Public Function _CheckPropertyValue(ByRef pvValue As Variant) As Variant
&apos; Date BASIC variables give error. Change them to strings
&apos; Empty arrays should be replaced by cstEMPTYARRAY
If VarType(pvValue) = vbDate Then
_CheckPropertyValue = Utils._CStr(pvValue, False)
ElseIf IsArray(pvValue) Then
If UBound(pvValue, 1) &lt; LBound(pvValue, 1) Then _CheckPropertyValue = cstEMPTYARRAY Else _CheckPropertyValue = pvValue
Else
_CheckPropertyValue = pvValue
End If
End Function &apos; _CheckPropertyValue
REM =======================================================================================================================
Public Function _NumPropertyValues(ByRef pvPropertyValuesArray As Variant) As Integer
&apos; Return the number of PropertyValue&apos;s in an array.
&apos; Parameters:
&apos; pvPropertyValuesArray - an array of PropertyValue&apos;s, that is an array of com.sun.star.beans.PropertyValue.
&apos; Returns zero if the array contains no elements.
Dim iNumProperties As Integer
If Not IsArray(pvPropertyValuesArray) Then iNumProperties = 0 Else iNumProperties = UBound(pvPropertyValuesArray) + 1
_NumPropertyValues() = iNumProperties
End Function &apos; _NumPropertyValues V1.3.0
REM =======================================================================================================================
Public Function _FindPropertyIndex(ByRef pvPropertyValuesArray As Variant, ByVal psPropName As String ) As Integer
&apos; Find a particular named property from an array of PropertyValue&apos;s.
&apos; Finds the index in the array of PropertyValue&apos;s and returns it, or returns -1 if it was not found.
Dim iNumProperties As Integer, i As Integer, vProp As Variant
iNumProperties = _NumPropertyValues(pvPropertyValuesArray)
For i = 0 To iNumProperties - 1
vProp = pvPropertyValuesArray(i)
If UCase(vProp.Name) = UCase(psPropName) Then
_FindPropertyIndex() = i
Exit Function
EndIf
Next i
_FindPropertyIndex() = -1
End Function &apos; _FindPropertyIndex V1.3.0
REM =======================================================================================================================
Public Function _FindProperty(ByRef pvPropertyValuesArray As Variant, ByVal psPropName As String) As com.sun.star.beans.PropertyValue
&apos; Find a particular named property from an array of PropertyValue&apos;s.
&apos; Finds the PropertyValue and returns it, or returns Null if not found.
Dim iPropIndex As Integer, vProp As Variant
iPropIndex = _FindPropertyIndex(pvPropertyValuesArray, psPropName)
If iPropIndex &gt;= 0 Then
vProp = pvPropertyValuesArray(iPropIndex) &apos; access array subscript
_FindProperty() = vProp
EndIf
End Function &apos; _FindProperty V1.3.0
REM =======================================================================================================================
Public Function _GetPropertyValue(ByRef pvPropertyValuesArray As Variant, ByVal psPropName As String, Optional pvDefaultValue) As Variant
&apos; Get the value of a particular named property from an array of PropertyValue&apos;s.
&apos; vDefaultValue - This value is returned if the property is not found in the array.
Dim iPropIndex As Integer, vProp As Variant, vValue As Variant, vMatrix As Variant, i As Integer, j As Integer
iPropIndex = _FindPropertyIndex(pvPropertyValuesArray, psPropName)
If iPropIndex &gt;= 0 Then
vProp = pvPropertyValuesArray(iPropIndex) &apos; access array subscript
vValue = vProp.Value &apos; get the value from the PropertyValue
If VarType(vValue) = vbString Then
If vValue = cstEMPTYARRAY Then _GetPropertyValue() = Array() Else _GetPropertyValue() = vValue
ElseIf IsArray(vValue) Then
If IsArray(vValue(0)) Then &apos; Array of arrays
vMatrix = Array()
ReDim vMatrix(0 To UBound(vValue), 0 To UBound(vValue(0)))
For i = 0 To UBound(vValue)
For j = 0 To UBound(vValue(0))
vMatrix(i, j) = vValue(i)(j)
Next j
Next i
_GetPropertyValue() = vMatrix
Else
_GetPropertyValue() = vValue &apos; Simple vector OK
End If
Else
_GetPropertyValue() = vValue
End If
Else
If IsMissing(pvDefaultValue) Then pvDefaultValue = Null
_GetPropertyValue() = pvDefaultValue
EndIf
End Function &apos; _GetPropertyValue V1.3.0
REM =======================================================================================================================
Public Sub _SetPropertyValue(ByRef pvPropertyValuesArray As Variant, ByVal psPropName As String, ByVal pvValue As Variant)
&apos; Set the value of a particular named property from an array of PropertyValue&apos;s.
Dim iPropIndex As Integer, vProp As Variant, iNumProperties As Integer
iPropIndex = _FindPropertyIndex(pvPropertyValuesArray, psPropName)
If iPropIndex &gt;= 0 Then
&apos; Found, the PropertyValue is already in the array. Just modify its value.
vProp = pvPropertyValuesArray(iPropIndex) &apos; access array subscript
vProp.Value = _CheckPropertyValue(pvValue) &apos; set the property value.
pvPropertyValuesArray(iPropIndex) = vProp &apos; put it back into array
Else
&apos; Not found, the array contains no PropertyValue with this name. Append new element to array.
iNumProperties = _NumPropertyValues(pvPropertyValuesArray)
If iNumProperties = 0 Then
pvPropertyValuesArray = Array(_MakePropertyValue(psPropName, pvValue))
Else
&apos; Make array larger.
Redim Preserve pvPropertyValuesArray(iNumProperties)
&apos; Assign new PropertyValue
pvPropertyValuesArray(iNumProperties) = _MakePropertyValue(psPropName, pvValue)
EndIf
EndIf
End Sub &apos; _SetPropertyValue V1.3.0
REM =======================================================================================================================
Public Sub _DeleteProperty(ByRef pvPropertyValuesArray As Variant, ByVal psPropName As String)
&apos; Delete a particular named property from an array of PropertyValue&apos;s.
Dim iPropIndex As Integer
iPropIndex = _FindPropertyIndex(pvPropertyValuesArray, psPropName)
If iPropIndex &gt;= 0 Then _DeleteIndexedProperty(pvPropertyValuesArray, iPropIndex)
End Sub &apos; _DeletePropertyValue V1.3.0
REM =======================================================================================================================
Public Sub _DeleteIndexedProperty(ByRef pvPropertyValuesArray As Variant, ByVal piPropIndex As Integer)
&apos; Delete a particular indexed property from an array of PropertyValue&apos;s.
Dim iNumProperties As Integer, i As Integer
iNumProperties = _NumPropertyValues(pvPropertyValuesArray)
&apos; Did we find it?
If piPropIndex &lt; 0 Then
&apos; Do nothing
ElseIf iNumProperties = 1 Then
&apos; Just return a new empty array
pvPropertyValuesArray = Array()
Else
&apos; If it is NOT the last item in the array, then shift other elements down into it&apos;s position.
If piPropIndex &lt; iNumProperties - 1 Then
&apos; Bump items down lower in the array.
For i = piPropIndex To iNumProperties - 2
pvPropertyValuesArray(i) = pvPropertyValuesArray(i + 1)
Next i
EndIf
&apos; Redimension the array to have one fewer element.
Redim Preserve pvPropertyValuesArray(iNumProperties - 2)
EndIf
End Sub &apos; _DeleteIndexedProperty V1.3.0
REM =======================================================================================================================
Public Function _PropValuesToStr(ByRef pvPropertyValuesArray As Variant) As String
&apos; Return a string with dumped content of the array of PropertyValue&apos;s.
&apos; SYNTAX:
&apos; NameOfProperty = This is a string (or 12 or 2016-12-31 12:05 or 123.45 or -0.12E-05 ...)
&apos; NameOfArray = (10)
&apos; 1;2;3;4;5;6;7;8;9;10
&apos; NameOfMatrix = (2,10)
&apos; 1;2;3;4;5;6;7;8;9;10
&apos; A;B;C;D;E;F;G;H;I;J
&apos; Semicolons and backslashes are escaped with a backslash (see _CStr and _CVar functions)
Dim iNumProperties As Integer, sResult As String, i As Integer, j As Integer, vProp As Variant
Dim sName As String, vValue As Variant, iType As Integer
Dim cstLF As String
cstLF = vbLf()
iNumProperties = _NumPropertyValues(pvPropertyValuesArray)
sResult = cstHEADER &amp; cstLF
For i = 0 To iNumProperties - 1
vProp = pvPropertyValuesArray(i)
sName = vProp.Name
vValue = vProp.Value
iType = VarType(vValue)
Select Case iType
Case &lt; vbArray &apos; Scalar
sResult = sResult &amp; sName &amp; &quot; = &quot; &amp; Utils._CStr(vValue, False) &amp; cstLF
Case Else &apos; Vector or matrix
If uBound(vValue, 1) &lt; 0 Then
sResult = sResult &amp; sName &amp; &quot; = (0)&quot; &amp; cstLF
&apos; 1-dimension but vector of vectors must also be considered
ElseIf VarType(vValue(0)) &gt;= vbArray Then
sResult = sResult &amp; sName &amp; &quot; = (&quot; &amp; UBound(vValue) + 1 &amp; &quot;,&quot; &amp; UBound(vValue(0)) + 1 &amp; &quot;)&quot; &amp; cstLF
For j = 0 To UBound(vValue)
sResult = sResult &amp; Utils._CStr(vValue(j), False) &amp; cstLF
Next j
Else
sResult = sResult &amp; sName &amp; &quot; = (&quot; &amp; UBound(vValue, 1) + 1 &amp; &quot;)&quot; &amp; cstLF
sResult = sResult &amp; Utils._CStr(vValue, False) &amp; cstLF
End If
End Select
Next i
_PropValuesToStr() = Left(sResult, Len(sResult) - 1) &apos; Remove last LF
End Function &apos; _PropValuesToStr V1.3.0
REM =======================================================================================================================
Public Function _StrToPropValues(psString) As Variant
&apos; Return an array of PropertyValue&apos;s rebuilt from the string parameter
Dim vString() As Variant, i As Integer,iArray As Integer, iRows As Integer, iCols As Integer
Dim lPosition As Long, sName As String, vValue As Variant, vResult As Variant, sDim As String
Dim lSearch As Long
Dim cstLF As String
Const cstEqualArray = &quot; = (&quot;, cstEqual = &quot; = &quot;
cstLF = Chr(10)
_StrToPropValues = Array()
vResult = Array()
If psString = &quot;&quot; Then Exit Function
vString = Split(psString, cstLF)
If UBound(vString) &lt;= 0 Then Exit Function &apos; There must be at least one name-value pair
If vString(0) &lt;&gt; cstHEADER Then Exit Function &apos; Check origin
iArray = -1
For i = 1 To UBound(vString)
If vString(i) &lt;&gt; &quot;&quot; Then &apos; Skip empty lines
If iArray &lt; 0 Then &apos; Not busy with array row
lPosition = 1
sName = Utils._RegexSearch(vString(i), &quot;^\b\w+\b&quot;, lPosition) &apos; Identifier
If sName = &quot;&quot; Then Exit Function
If InStr(vString(i), cstEqualArray) = lPosition + Len(sName) Then &apos; Start array processing
lSearch = lPosition + Len(sName) + Len(cstEqualArray) - 1
sDim = Utils._RegexSearch(vString(i), &quot;\([0-9]+\)&quot;, lSearch) &apos; e.g. (10)
If sDim = &quot;(0)&quot; Then &apos; Empty array
iRows = -1
vValue = Array()
_SetPropertyValue(vResult, sName, vValue)
ElseIf sDim &lt;&gt; &quot;&quot; Then &apos; Vector with content
iCols = CInt(Mid(sDim, 2, Len(sDim) - 2))
iRows = 0
ReDim vValue(0 To iCols - 1)
iArray = 0
Else &apos; Matrix with content
lSearch = lPosition + Len(sName) + Len(cstEqualArray) - 1
sDim = Utils._RegexSearch(vString(i), &quot;\([0-9]+,&quot;, lSearch) &apos; e.g. (10,
iRows = CInt(Mid(sDim, 2, Len(sDim) - 2))
sDim = Utils._RegexSearch(vString(i), &quot;,[0-9]+\)&quot;, lSearch) &apos; e.g. ,20)
iCols = CInt(Mid(sDim, 2, Len(sDim) - 2))
ReDim vValue(0 To iRows - 1)
iArray = 0
End If
ElseIf InStr(vString(i), cstEqual) = lPosition + Len(sName) Then
vValue = Utils._CVar(Mid(vString(i), Len(sName) + Len(cstEqual) + 1))
_SetPropertyValue(vResult, sName, vValue)
Else
Exit Function
End If
Else &apos; Line is an array row
If iRows = 0 Then
vValue = Utils._CVar(vString(i), True) &apos; Keep dates as strings
iArray = -1
_SetPropertyValue(vResult, sName, vValue)
Else
vValue(iArray) = Utils._CVar(vString(i), True)
If iArray &lt; iRows - 1 Then
iArray = iArray + 1
Else
iArray = -1
_SetPropertyValue(vResult, sName, vValue)
End If
End If
End If
End If
Next i
_StrToPropValues = vResult
End Function
</script:module>

View File

@@ -0,0 +1,25 @@
<?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="_License" script:language="StarBasic">
&apos; Copyright 2012-2017 Jean-Pierre LEDURE
REM =======================================================================================================================
REM === The Access2Base library is a part of the LibreOffice project. ===
REM === Full documentation is available on http://www.access2base.com ===
REM =======================================================================================================================
&apos; Access2Base is distributed in the hope that it will be useful,
&apos; but WITHOUT ANY WARRANTY; without even the implied warranty of
&apos; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
&apos; Access2Base is free software; you can redistribute it and/or modify it under the terms of either (at your option):
&apos;
&apos; 1) The Mozilla Public License, v. 2.0. If a copy of the MPL was not
&apos; distributed with this file, you can obtain one at http://mozilla.org/MPL/2.0/ .
&apos;
&apos; 2) The GNU Lesser General Public License as published by
&apos; the Free Software Foundation, either version 3 of the License, or
&apos; (at your option) any later version. If a copy of the LGPL was not
&apos; distributed with this file, see http://www.gnu.org/licenses/ .
</script:module>

View File

@@ -0,0 +1,395 @@
<?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="acConstants" 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 Explicit
REM Access2Base -----------------------------------------------------
Global Const Access2Base_Version = &quot;7.1.0&quot; &apos; Alignment on LibreOffice versions
REM AcCloseSave
REM -----------------------------------------------------------------
Global Const acSaveNo = 2
Global Const acSavePrompt = 0
Global Const acSaveYes = 1
REM AcFormView
REM -----------------------------------------------------------------
Global Const acDesign = 1
Global Const acNormal = 0
Global Const acPreview = 2
REM AcFormOpenDataMode
REM -----------------------------------------------------------------
Global Const acFormAdd = 0
Global Const acFormEdit = 1
Global Const acFormPropertySettings = -1
Global Const acFormReadOnly = 2
REM acView
REM -----------------------------------------------------------------
Global Const acViewDesign = 1
Global Const acViewNormal = 0
Global Const acViewPreview = 2
REM acOpenDataMode
REM -----------------------------------------------------------------
Global Const acAdd = 0
Global Const acEdit = 1
Global Const acReadOnly = 2
REM AcObjectType
REM -----------------------------------------------------------------
Global Const acDefault = -1
Global Const acDiagram = 8
Global Const acForm = 2
Global Const acQuery = 1
Global Const acReport = 3
Global Const acTable = 0
&apos; Unexisting in MS/Access
Global Const acBasicIDE = 101
Global Const acDatabaseWindow = 102
Global Const acDocument = 111
Global Const acWelcome = 112
&apos; Subtype if acDocument
Global Const docWriter = &quot;Writer&quot;
Global Const docCalc = &quot;Calc&quot;
Global Const docImpress = &quot;Impress&quot;
Global Const docDraw = &quot;Draw&quot;
Global Const docMath = &quot;Math&quot;
REM AcWindowMode
REM -----------------------------------------------------------------
Global Const acDialog = 3
Global Const acHidden = 1
Global Const acIcon = 2
Global Const acWindowNormal = 0
REM VarType constants
REM -----------------------------------------------------------------
Global Const vbEmpty = 0
Global Const vbNull = 1
Global Const vbInteger = 2
Global Const vbLong = 3
Global Const vbSingle = 4
Global Const vbDouble = 5
Global Const vbCurrency = 6
Global Const vbDate = 7
Global Const vbString = 8
Global Const vbObject = 9
Global Const vbError = 10
Global Const vbBoolean = 11
Global Const vbVariant = 12
Global Const vbByte = 17
Global Const vbUShort = 18
Global Const vbULong = 19
Global Const vbBigint = 35
Global Const vbDecimal = 37
Global Const vbArray = 8192
REM MsgBox constants
REM -----------------------------------------------------------------
Global Const vbOKOnly = 0 &apos; OK button only (default)
Global Const vbOKCancel = 1 &apos; OK and Cancel buttons
Global Const vbAbortRetryIgnore = 2 &apos; Abort, Retry, and Ignore buttons
Global Const vbYesNoCancel = 3 &apos; Yes, No, and Cancel buttons
Global Const vbYesNo = 4 &apos; Yes and No buttons
Global Const vbRetryCancel = 5 &apos; Retry and Cancel buttons
Global Const vbCritical = 16 &apos; Critical message
Global Const vbQuestion = 32 &apos; Warning query
Global Const vbExclamation = 48 &apos; Warning message
Global Const vbInformation = 64 &apos; Information message
Global Const vbDefaultButton1 = 128 &apos; First button is default (default) (VBA: 0)
Global Const vbDefaultButton2 = 256 &apos; Second button is default
Global Const vbDefaultButton3 = 512 &apos; Third button is default
Global Const vbApplicationModal = 0 &apos; Application modal message box (default)
REM MsgBox Return Values
REM -----------------------------------------------------------------
Global Const vbOK = 1 &apos; OK button pressed
Global Const vbCancel = 2 &apos; Cancel button pressed
Global Const vbAbort = 3 &apos; Abort button pressed
Global Const vbRetry = 4 &apos; Retry button pressed
Global Const vbIgnore = 5 &apos; Ignore button pressed
Global Const vbYes = 6 &apos; Yes button pressed
Global Const vbNo = 7 &apos; No button pressed
REM Dialogs Return Values
REM ------------------------------------------------------------------
Global Const dlgOK = 1 &apos; OK button pressed
Global Const dlgCancel = 0 &apos; Cancel button pressed
REM Control Types
REM -----------------------------------------------------------------
Global Const acCheckBox = 5
Global Const acComboBox = 7
Global Const acCommandButton = 2 : Global Const acToggleButton = 122
Global Const acCurrencyField = 18
Global Const acDateField = 15
Global Const acFileControl = 12
Global Const acFixedLine = 24 &apos; FREE ENTRY (USEFUL IN DIALOGS)
Global Const acFixedText = 10 : Global Const acLabel = 10
Global Const acFormattedField = 1 &apos; FREE ENTRY TAKEN TO NOT CONFUSE WITH acTextField
Global Const acGridControl = 11
Global Const acGroupBox = 8 : Global Const acOptionGroup = 8
Global Const acHiddenControl = 13
Global Const acImageButton = 4
Global Const acImageControl = 14 : Global Const acImage = 14
Global Const acListBox = 6
Global Const acNavigationBar = 22
Global Const acNumericField = 17
Global Const acPatternField = 19
Global Const acProgressBar = 23 &apos; FREE ENTRY (USEFUL IN DIALOGS)
Global Const acRadioButton = 3 : Global Const acOptionButton = 3
Global Const acScrollBar = 20
Global Const acSpinButton = 21
Global Const acSubform = 112
Global Const acTextField = 9 : Global Const acTextBox = 9
Global Const acTimeField = 16
REM AcRecord
REM -----------------------------------------------------------------
Global Const acFirst = 2
Global Const acGoTo = 4
Global Const acLast = 3
Global Const acNewRec = 5
Global Const acNext = 1
Global Const acPrevious = 0
REM FindRecord
REM -----------------------------------------------------------------
Global Const acAnywhere = 0
Global Const acEntire = 1
Global Const acStart = 2
Global Const acDown = 1
Global Const acSearchAll = 2
Global Const acUp = 0
Global Const acAll = 0
Global Const acCurrent = -1
REM AcDataObjectType
REM -----------------------------------------------------------------
Global Const acActiveDataObject = -1
Global Const acDataForm = 2
Global Const acDataQuery = 1
Global Const acDataServerView = 7
Global Const acDataStoredProcedure = 9
Global Const acDataTable = 0
REM AcQuitOption
REM -----------------------------------------------------------------
Global Const acQuitPrompt = 0
Global Const acQuitSaveAll = 1
Global Const acQuitSaveNone = 2
REM AcCommand
REM -----------------------------------------------------------------
Global Const acCmdAboutMicrosoftAccess = 35
Global Const acCmdAboutOpenOffice = 35
Global Const acCmdAboutLibreOffice = 35
Global Const acCmdVisualBasicEditor = 525
Global Const acCmdBringToFront = 52
Global Const acCmdClose = 58
Global Const acCmdToolbarsCustomize = 165
Global Const acCmdChangeToCommandButton = 501
Global Const acCmdChangeToCheckBox = 231
Global Const acCmdChangeToComboBox = 230
Global Const acCmdChangeToTextBox = 227
Global Const acCmdChangeToLabel = 228
Global Const acCmdChangeToImage = 234
Global Const acCmdChangeToListBox = 229
Global Const acCmdChangeToOptionButton = 233
Global Const acCmdCopy = 190
Global Const acCmdCut = 189
Global Const acCmdCreateRelationship = 150
Global Const acCmdDelete = 337
Global Const acCmdDatabaseProperties = 256
Global Const acCmdSQLView = 184
Global Const acCmdRemove = 366
Global Const acCmdDesignView = 183
Global Const acCmdFormView = 281
Global Const acCmdNewObjectForm = 136
Global Const acCmdNewObjectTable = 134
Global Const acCmdNewObjectView = 350
Global Const acCmdOpenDatabase = 25
Global Const acCmdNewObjectQuery = 135
Global Const acCmdShowAllRelationships = 149
Global Const acCmdNewObjectReport = 137
Global Const acCmdSelectAll = 333
Global Const acCmdRemoveTable = 84
Global Const acCmdOpenTable = 221
Global Const acCmdRename = 143
Global Const acCmdDeleteRecord = 223
Global Const acCmdApplyFilterSort = 93
Global Const acCmdSnapToGrid = 62
Global Const acCmdViewGrid = 63
Global Const acCmdInsertHyperlink = 259
Global Const acCmdMaximumRecords = 508
Global Const acCmdObjectBrowser = 200
Global Const acCmdPaste = 191
Global Const acCmdPasteSpecial = 64
Global Const acCmdPrint = 340
Global Const acCmdPrintPreview = 54
Global Const acCmdSaveRecord = 97
Global Const acCmdFind = 30
Global Const acCmdUndo = 292
Global Const acCmdRefresh = 18
Global Const acCmdRemoveFilterSort = 144
Global Const acCmdRunMacro = 31
Global Const acCmdSave = 20
Global Const acCmdSaveAs = 21
Global Const acCmdSelectAllRecords = 109
Global Const acCmdSendToBack = 53
Global Const acCmdSortDescending = 164
Global Const acCmdSortAscending = 163
Global Const acCmdTabOrder = 41
Global Const acCmdDatasheetView = 282
Global Const acCmdZoomSelection = 371
REM AcSendObjectType
REM -----------------------------------------------------------------
Global Const acSendForm = 2
Global Const acSendNoObject = -1
Global Const acSendQuery = 1
Global Const acSendReport = 3
Global Const acSendTable = 0
REM AcOutputObjectType
REM -----------------------------------------------------------------
Global Const acOutputTable = 0
Global Const acOutputQuery = 1
Global Const acOutputForm = 2
Global Const acOutputArray = -1
REM AcEncoding
REM -----------------------------------------------------------------
Global Const acUTF8Encoding = 76
REM AcFormat
REM -----------------------------------------------------------------
Global Const acFormatPDF = &quot;writer_pdf_Export&quot;
Global Const acFormatODT = &quot;writer8&quot;
Global Const acFormatDOC = &quot;MS Word 97&quot;
Global Const acFormatHTML = &quot;HTML&quot;
Global Const acFormatODS = &quot;calc8&quot;
Global Const acFormatXLS = &quot;MS Excel 97&quot;
Global Const acFormatXLSX = &quot;Calc MS Excel 2007 XML&quot;
Global Const acFormatTXT = &quot;Text - txt - csv (StarCalc)&quot;
REM AcExportQuality
REM -----------------------------------------------------------------
Global Const acExportQualityPrint = 0
Global Const acExportQualityScreen = 1
REM AcSysCmdAction
REM -----------------------------------------------------------------
Global Const acSysCmdAccessDir = 9
Global Const acSysCmdAccessVer = 7
Global Const acSysCmdClearHelpTopic = 11
Global Const acSysCmdClearStatus = 5
Global Const acSysCmdGetObjectState = 10
Global Const acSysCmdGetWorkgroupFile = 13
Global Const acSysCmdIniFile = 8
Global Const acSysCmdInitMeter = 1
Global Const acSysCmdProfile = 12
Global Const acSysCmdRemoveMeter = 3
Global Const acSysCmdRuntime = 6
Global Const acSysCmdSetStatus = 4
Global Const acSysCmdUpdateMeter = 2
REM Type property
REM -----------------------------------------------------------------
Global Const dbBigInt = 16
Global Const dbBinary = 9
Global Const dbBoolean = 1
Global Const dbByte = 2
Global Const dbChar = 18
Global Const dbCurrency = 5
Global Const dbDate = 8
Global Const dbDecimal = 20
Global Const dbDouble = 7
Global Const dbFloat = 21
Global Const dbGUID = 15
Global Const dbInteger = 3
Global Const dbLong = 4
Global Const dbLongBinary = 11 &apos; (OLE Object)
Global Const dbMemo= 12
Global Const dbNumeric = 19
Global Const dbSingle = 6
Global Const dbText = 10
Global Const dbTime = 22
Global Const dbTimeStamp = 23
Global Const dbVarBinary = 17
Global Const dbUndefined = -1
REM Attributes property
REM -----------------------------------------------------------------
Global Const dbAutoIncrField = 16
Global Const dbDescending = 1
Global Const dbFixedField = 1
Global Const dbHyperlinkField = 32768
Global Const dbSystemField = 8192
Global Const dbUpdatableField = 32
Global Const dbVariableField = 2
REM OpenRecordset
REM -----------------------------------------------------------------
Global Const dbOpenForwardOnly = 8
Global Const dbSQLPassThrough = 64
Global Const dbReadOnly = 4
REM Query types
REM -----------------------------------------------------------------
Global Const dbQAction = 240
Global Const dbQAppend = 64
Global Const dbQDDL = 4 &apos;96
Global Const dbQDelete = 32
Global Const dbQMakeTable = 128 &apos;80
Global Const dbQSelect = 0
Global Const dbQSetOperation = 8 &apos;128
Global Const dbQSQLPassThrough = 1 &apos;112
Global Const dbQUpdate = 16 &apos;48
REM Edit mode
REM -----------------------------------------------------------------
Global Const dbEditNone = 0
Global Const dbEditInProgress = 1
Global Const dbEditAdd = 2
REM Toolbars
REM -----------------------------------------------------------------
Global Const msoBarTypeNormal = 0 &apos; Usual toolbar
Global Const msoBarTypeMenuBar = 1 &apos; Menu bar
Global Const msoBarTypePopup = 2 &apos; Shortcut menu
Global Const msoBarTypeStatusBar = 11 &apos; Status bar
Global Const msoBarTypeFloater = 12 &apos; Floating window
Global Const msoControlButton = 1 &apos; Command button
Global Const msoControlPopup = 10 &apos; Popup, submenu
REM New Lines
REM -----------------------------------------------------------------
Public Function vbCr() As String : vbCr = Chr(13) : End Function
Public Function vbLf() As String : vbLf = Chr(10) : End Function
Public Function vbNewLine() As String
Const cstWindows = 1
If GetGuiType() = cstWindows Then vbNewLine = vbCR &amp; vbLF Else vbNewLine = vbLF
End Function &apos; vbNewLine V1.4.0
Public Function vbTab() As String : vbTab = Chr(9) : End Function
REM Module types
REM -----------------------------------------------------------------
Global Const acClassModule = 1
Global Const acStandardModule = 0
REM (Module) procedure types
REM -----------------------------------------------------------------
Global Const vbext_pk_Get = 1 &apos; A Property Get procedure
Global Const vbext_pk_Let = 2 &apos; A Property Let procedure
Global Const vbext_pk_Proc = 0 &apos; A Sub or Function procedure
Global Const vbext_pk_Set = 3 &apos; A Property Set procedure
</script:module>

View File

@@ -0,0 +1,6 @@
<?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="Access2Base" library:readonly="false" library:passwordprotected="false">
<library:element library:name="dlgTrace"/>
<library:element library:name="dlgFormat"/>
</library:library>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="dlgFormat" dlg:left="246" dlg:top="119" dlg:width="153" dlg:height="40" dlg:help-text="Export the form" dlg:closeable="true" dlg:moveable="true" dlg:title="OutputTo">
<dlg:bulletinboard>
<dlg:combobox dlg:id="cboFormat" dlg:tab-index="0" dlg:left="4" dlg:top="18" dlg:width="71" dlg:height="8" dlg:help-text="Format in which the form should be exported" dlg:value="PDF" dlg:spin="true">
<dlg:menupopup>
<dlg:menuitem dlg:value="PDF"/>
<dlg:menuitem dlg:value="ODT"/>
<dlg:menuitem dlg:value="DOC"/>
<dlg:menuitem dlg:value="HTML"/>
</dlg:menupopup>
</dlg:combobox>
<dlg:text dlg:id="lblFormat" dlg:tab-index="1" dlg:left="4" dlg:top="7" dlg:width="100" dlg:height="9" dlg:help-text="Format in which the form should be exported" dlg:value="Select the output format"/>
<dlg:button dlg:id="cmdOK" dlg:tab-index="2" dlg:left="111" dlg:top="5" dlg:width="35" dlg:height="12" dlg:help-text="Validate your choice" dlg:default="true" dlg:value="OK" dlg:button-type="ok">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Access2Base.Trace._TraceOK?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
<dlg:button dlg:id="cmdCancel" dlg:tab-index="3" dlg:left="111" dlg:top="20" dlg:width="35" dlg:height="12" dlg:help-text="Cancel and close the dialog" dlg:value="Cancel" dlg:button-type="cancel"/>
</dlg:bulletinboard>
</dlg:window>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="dlgTrace" dlg:left="81" dlg:top="63" dlg:width="438" dlg:height="154" dlg:help-text="Manage the console file and its entries" dlg:closeable="true" dlg:moveable="true" dlg:title="Console">
<dlg:styles>
<dlg:style dlg:style-id="0" dlg:font-name="Courier New" dlg:font-stylename="Regular" dlg:font-family="modern"/>
<dlg:style dlg:style-id="1" dlg:look="simple"/>
<dlg:style dlg:style-id="2" dlg:background-color="0xe6e6e6" dlg:border="none"/>
</dlg:styles>
<dlg:bulletinboard>
<dlg:text dlg:id="lblEntries" dlg:tab-index="3" dlg:left="265" dlg:top="134" dlg:width="130" dlg:height="9" dlg:help-text="Clear the list and resize the circular buffer" dlg:value="Set max number of entries" dlg:align="right"/>
<dlg:numericfield dlg:id="numEntries" dlg:tab-index="4" dlg:left="399" dlg:top="129" dlg:width="28" dlg:height="16" dlg:help-text="Clear the list and resize the circular buffer" dlg:decimal-accuracy="0" dlg:value="20" dlg:value-min="5" dlg:value-max="999" dlg:spin="true"/>
<dlg:textfield dlg:style-id="0" dlg:id="txtTraceLog" dlg:tab-index="0" dlg:left="9" dlg:top="20" dlg:width="360" dlg:height="105" dlg:help-text="Text can be selected, copied, ..." dlg:hscroll="true" dlg:vscroll="true" dlg:multiline="true" dlg:readonly="true" dlg:value="--- Log file is empty ---"/>
<dlg:checkbox dlg:style-id="1" dlg:id="chkClear" dlg:tab-index="5" dlg:left="58" dlg:top="133" dlg:width="6" dlg:height="9" dlg:help-text="Clear the list" dlg:value="Clear" dlg:checked="false"/>
<dlg:button dlg:id="cmdCancel" dlg:tab-index="6" dlg:left="381" dlg:top="38" dlg:width="40" dlg:height="12" dlg:help-text="Cancel and close the dialog" dlg:value="Cancel" dlg:button-type="cancel"/>
<dlg:text dlg:id="lblClear" dlg:tab-index="7" dlg:left="9" dlg:top="133" dlg:width="46" dlg:height="9" dlg:help-text="Clear the list" dlg:value="Clear the list" dlg:align="right"/>
<dlg:text dlg:id="lblMinLevel" dlg:tab-index="8" dlg:left="74" dlg:top="133" dlg:width="130" dlg:height="9" dlg:help-text="Register only logging requests above given level" dlg:value="Set minimal trace level" dlg:align="right"/>
<dlg:combobox dlg:id="cboMinLevel" dlg:tab-index="9" dlg:left="209" dlg:top="133" dlg:width="50" dlg:height="9" dlg:help-text="Register only logging requests above given level" dlg:spin="true">
<dlg:menupopup>
<dlg:menuitem dlg:value="DEBUG"/>
<dlg:menuitem dlg:value="INFO"/>
<dlg:menuitem dlg:value="WARNING"/>
<dlg:menuitem dlg:value="ERROR"/>
<dlg:menuitem dlg:value="ABORT"/>
</dlg:menupopup>
</dlg:combobox>
<dlg:button dlg:id="cmdOK" dlg:tab-index="1" dlg:left="381" dlg:top="20" dlg:width="40" dlg:height="12" dlg:help-text="Validate" dlg:default="true" dlg:value="OK" dlg:button-type="ok"/>
<dlg:button dlg:id="cmdDump" dlg:tab-index="2" dlg:left="381" dlg:top="68" dlg:width="40" dlg:height="31" dlg:help-text="Choose a file and dump the actual list content in it" dlg:value="Dump to file" dlg:multiline="true">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Access2Base.Trace._DumpToFile?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
<dlg:text dlg:id="lblNbEntries" dlg:tab-index="10" dlg:left="9" dlg:top="10" dlg:width="105" dlg:height="7" dlg:help-text="Actual size of list" dlg:value="Actual number of entries:"/>
<dlg:numericfield dlg:style-id="2" dlg:id="numNbEntries" dlg:tab-index="11" dlg:left="123" dlg:top="9" dlg:width="17" dlg:height="9" dlg:help-text="Actual size of list" dlg:readonly="true" dlg:decimal-accuracy="0" dlg:value="0"/>
</dlg:bulletinboard>
</dlg:window>

View File

@@ -0,0 +1,34 @@
<?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="Access2Base" library:readonly="false" library:passwordprotected="false">
<library:element library:name="Application"/>
<library:element library:name="Methods"/>
<library:element library:name="acConstants"/>
<library:element library:name="Test"/>
<library:element library:name="Trace"/>
<library:element library:name="DoCmd"/>
<library:element library:name="Utils"/>
<library:element library:name="Database"/>
<library:element library:name="PropertiesSet"/>
<library:element library:name="Collect"/>
<library:element library:name="PropertiesGet"/>
<library:element library:name="Form"/>
<library:element library:name="Python"/>
<library:element library:name="_License"/>
<library:element library:name="SubForm"/>
<library:element library:name="L10N"/>
<library:element library:name="OptionGroup"/>
<library:element library:name="Event"/>
<library:element library:name="Property"/>
<library:element library:name="Control"/>
<library:element library:name="Dialog"/>
<library:element library:name="Field"/>
<library:element library:name="DataDef"/>
<library:element library:name="Recordset"/>
<library:element library:name="TempVar"/>
<library:element library:name="Root_"/>
<library:element library:name="UtilProperty"/>
<library:element library:name="CommandBar"/>
<library:element library:name="CommandBarControl"/>
<library:element library:name="Module"/>
</library:library>