集成OpenOffice替换为LibreOffice

This commit is contained in:
陈精华
2021-06-23 10:26:22 +08:00
parent 8a1eebb9b0
commit 79341b2c8e
14724 changed files with 2184695 additions and 551131 deletions

File diff suppressed because it is too large Load Diff

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>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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>

File diff suppressed because it is too large Load Diff

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>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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>

File diff suppressed because it is too large Load Diff

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>

File diff suppressed because it is too large Load Diff

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>