summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2019-07-13 16:19:17 +0200
committerJean-Pierre Ledure <jp@ledure.be>2019-07-13 16:22:32 +0200
commit15fec4ee1c07b7c2b234384654ca3ee730acc2c8 (patch)
treed053260ace1ac15e11f53519c0bb44ea6e5baa35 /wizards
parent35463d886e15d13a81bce36610140e40ae742416 (diff)
Access2Base - Set Parent property in all classes
To get faster access to parents from controls Top classes (form, dialog and commandbar) should return Parent = Nothing
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/access2base/CommandBar.xba10
-rw-r--r--wizards/source/access2base/CommandBarControl.xba4
-rw-r--r--wizards/source/access2base/Control.xba5
-rw-r--r--wizards/source/access2base/DataDef.xba2
-rw-r--r--wizards/source/access2base/Database.xba2
-rw-r--r--wizards/source/access2base/Dialog.xba8
-rw-r--r--wizards/source/access2base/Field.xba2
-rw-r--r--wizards/source/access2base/Form.xba10
-rw-r--r--wizards/source/access2base/Module.xba2
-rw-r--r--wizards/source/access2base/OptionGroup.xba3
-rw-r--r--wizards/source/access2base/Property.xba2
-rw-r--r--wizards/source/access2base/Recordset.xba2
-rw-r--r--wizards/source/access2base/SubForm.xba5
-rw-r--r--wizards/source/access2base/TempVar.xba2
14 files changed, 54 insertions, 5 deletions
diff --git a/wizards/source/access2base/CommandBar.xba b/wizards/source/access2base/CommandBar.xba
index 69e2e97efc74..c30f696fb7d5 100644
--- a/wizards/source/access2base/CommandBar.xba
+++ b/wizards/source/access2base/CommandBar.xba
@@ -17,6 +17,7 @@ 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
@@ -31,6 +32,7 @@ REM ----------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJCOMMANDBAR
Set _This = Nothing
+ Set _Parent = Nothing
_Name = &quot;&quot;
_ResourceURL = &quot;&quot;
Set _Window = Nothing
@@ -75,6 +77,11 @@ Property Get ObjectType() As String
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
@@ -151,7 +158,8 @@ Dim oObject As Object
If pvIndex = iItemsCount - 1 Then
Set oObject = New CommandBarControl
With oObject
- ._This = oObject
+ Set ._This = oObject
+ Set ._Parent = _This
._ParentCommandBarName = _Name
._ParentCommandBar = oToolbar
._ParentBuiltin = ( _BarBuiltin = 1 )
diff --git a/wizards/source/access2base/CommandBarControl.xba b/wizards/source/access2base/CommandBarControl.xba
index b4676ea48fcf..9cf183ba9abf 100644
--- a/wizards/source/access2base/CommandBarControl.xba
+++ b/wizards/source/access2base/CommandBarControl.xba
@@ -17,6 +17,7 @@ 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
@@ -32,6 +33,7 @@ REM ----------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJCOMMANDBARCONTROL
Set _This = Nothing
+ Set _Parent = Nothing
_Index = -1
_ParentCommandBarName = &quot;&quot;
Set _ParentCommandBar = Nothing
@@ -238,7 +240,7 @@ Const cstUnoPrefix = &quot;.uno:&quot;
Case UCase(&quot;OnAction&quot;)
_PropertyGet = _GetPropertyValue(_Element, &quot;CommandURL&quot;, &quot;&quot;)
Case UCase(&quot;Parent&quot;)
- Set _PropertyGet = Application.CommandBars(_ParentCommandBarName)
+ 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;)
diff --git a/wizards/source/access2base/Control.xba b/wizards/source/access2base/Control.xba
index 9f6f36f1ba04..5e241186f081 100644
--- a/wizards/source/access2base/Control.xba
+++ b/wizards/source/access2base/Control.xba
@@ -17,6 +17,7 @@ REM ----------------------------------------------------------------------------
Private _Type As String &apos; Must be CONTROL
Private _This As Object &apos; Workaround for absence of This builtin function
+Private _Parent As Object
Private _ImplementationName As String
Private _ClassId As Integer
Private _ParentType As String &apos; One of CTLPARENTISxxxx constants
@@ -40,6 +41,7 @@ REM ----------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJCONTROL
Set _This = Nothing
+ Set _Parent = Nothing
_ClassId = -1
_ParentType = &quot;&quot;
_Shortcut = &quot;&quot;
@@ -781,6 +783,7 @@ Dim j As Integer, oView As Object
&apos; Determine exact name
Set ocControl = New Control
Set ocControl._This = ocControl
+ Set ocControl._Parent = _This
ocControl._ParentType = CTLPARENTISGRID
sParentShortcut = _Shortcut
sControls() = ControlModel.getElementNames()
@@ -1649,7 +1652,7 @@ Dim oControlEvents As Object, sEventName As String
Case UCase(&quot;Page&quot;)
If Utils._hasUNOProperty(ControlModel, &quot;Step&quot;) Then _PropertyGet = ControlModel.Step
Case UCase(&quot;Parent&quot;)
- Set _PropertyGet = PropertiesGet._ParentObject(_Shortcut)
+ Set _PropertyGet = _Parent
Case UCase(&quot;Picture&quot;)
_PropertyGet = ConvertToUrl(ControlModel.ImageURL)
Case UCase(&quot;Required&quot;)
diff --git a/wizards/source/access2base/DataDef.xba b/wizards/source/access2base/DataDef.xba
index 57ec601908cd..338e99c550f2 100644
--- a/wizards/source/access2base/DataDef.xba
+++ b/wizards/source/access2base/DataDef.xba
@@ -17,6 +17,7 @@ REM ----------------------------------------------------------------------------
Private _Type As String &apos; Must be TABLEDEF or QUERYDEF
Private _This As Object &apos; Workaround for absence of This builtin function
+Private _Parent As Object
Private _Name As String &apos; For tables: [[Catalog.]Schema.]Table
Private _ParentDatabase As Object
Private _ReadOnly As Boolean
@@ -35,6 +36,7 @@ REM ----------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = &quot;&quot;
Set _This = Nothing
+ Set _Parent = Nothing
_Name = &quot;&quot;
Set _ParentDatabase = Nothing
_ReadOnly = False
diff --git a/wizards/source/access2base/Database.xba b/wizards/source/access2base/Database.xba
index bf0aaee41f95..2e361cecfc13 100644
--- a/wizards/source/access2base/Database.xba
+++ b/wizards/source/access2base/Database.xba
@@ -17,6 +17,7 @@ REM ----------------------------------------------------------------------------
Private _Type As String &apos; Must be DATABASE
Private _This As Object &apos; Workaround for absence of This builtin function
+Private _Parent As Object
Private _DbConnect As Integer &apos; DBCONNECTxxx constants
Private Title As String
Private Document As Object &apos; com.sun.star.comp.dba.ODatabaseDocument or SwXTextDocument or ScModelObj
@@ -43,6 +44,7 @@ REM ----------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJDATABASE
Set _This = Nothing
+ Set _Parent = Nothing
_DbConnect = 0
Title = &quot;&quot;
Set Document = Nothing
diff --git a/wizards/source/access2base/Dialog.xba b/wizards/source/access2base/Dialog.xba
index 935f7cf7debc..69caed33ccae 100644
--- a/wizards/source/access2base/Dialog.xba
+++ b/wizards/source/access2base/Dialog.xba
@@ -17,6 +17,7 @@ REM ----------------------------------------------------------------------------
Private _Type As String &apos; Must be DIALOG
Private _This As Object &apos; Workaround for absence of This builtin function
+Private _Parent As Object
Private _Name As String
Private _Shortcut As String
Private _Dialog As Object &apos; com.sun.star.io.XInputStreamProvider
@@ -30,6 +31,7 @@ REM ----------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJDIALOG
Set _This = Nothing
+ Set _Parent = Nothing
_Name = &quot;&quot;
Set _Dialog = Nothing
_Storage = &quot;&quot;
@@ -292,6 +294,11 @@ Property Let Page(ByVal pvValue As Variant)
End Property &apos; Page (set)
REM -----------------------------------------------------------------------------------------------------------------------
+Public Function Parent() As Object
+ Parent = _Parent
+End Function &apos; Parent (get) V6.4.0
+
+REM -----------------------------------------------------------------------------------------------------------------------
Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
&apos; Return
&apos; a Collection object if pvIndex absent
@@ -353,6 +360,7 @@ Dim j As Integer
If Not IsLoaded Then Goto Trace_Error_NotOpen
Set ocControl = New Control
Set ocControl._This = ocControl
+ Set ocControl._Parent = _This
ocControl._ParentType = CTLPARENTISDIALOG
sParentShortcut = _Shortcut
sControls() = UnoDialog.Model.getElementNames()
diff --git a/wizards/source/access2base/Field.xba b/wizards/source/access2base/Field.xba
index 35d21aa2f7a1..1fe2f185e24c 100644
--- a/wizards/source/access2base/Field.xba
+++ b/wizards/source/access2base/Field.xba
@@ -17,6 +17,7 @@ REM ----------------------------------------------------------------------------
Private _Type As String &apos; Must be FIELD
Private _This As Object &apos; Workaround for absence of This builtin function
+Private _Parent As Object
Private _Name As String
Private _Precision As Long
Private _ParentName As String
@@ -35,6 +36,7 @@ REM ----------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJFIELD
Set _This = Nothing
+ Set _Parent = Nothing
_Name = &quot;&quot;
_ParentName = &quot;&quot;
_ParentType = &quot;&quot;
diff --git a/wizards/source/access2base/Form.xba b/wizards/source/access2base/Form.xba
index f05d326dc1cc..84dee353413a 100644
--- a/wizards/source/access2base/Form.xba
+++ b/wizards/source/access2base/Form.xba
@@ -17,6 +17,7 @@ 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 _Shortcut As String
Private _Name As String
Private _DocEntry As Integer &apos; Doc- and DbContainer entries in Root structure
@@ -37,6 +38,7 @@ REM ----------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJFORM
Set _This = Nothing
+ Set _Parent = Nothing
_Shortcut = &quot;&quot;
_Name = &quot;&quot;
_DocEntry = -1
@@ -398,6 +400,11 @@ Error_Function:
End Function &apos; OptionGroup V1.1.0
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
@@ -556,7 +563,8 @@ Dim oDatabaseForm As Object, iCtlCount As Integer
&apos;Initialize a new Control object
Set ocControl = New Control
With ocControl
- ._This = ocControl
+ Set ._This = ocControl
+ Set ._Parent = _This
._ParentType = CTLPARENTISFORM
._Name = sName
._Shortcut = _Shortcut &amp; &quot;!&quot; &amp; Utils._Surround(sName)
diff --git a/wizards/source/access2base/Module.xba b/wizards/source/access2base/Module.xba
index 34d7c244cb92..d3095d6459f5 100644
--- a/wizards/source/access2base/Module.xba
+++ b/wizards/source/access2base/Module.xba
@@ -17,6 +17,7 @@ REM ----------------------------------------------------------------------------
Private _Type As String &apos; Must be MODULE
Private _This As Object &apos; Workaround for absence of This builtin function
+Private _Parent As Object
Private _Name As String
Private _Library As Object &apos; com.sun.star.container.XNameAccess
Private _LibraryName As String
@@ -36,6 +37,7 @@ REM ----------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJMODULE
Set _This = Nothing
+ Set _Parent = Nothing
_Name = &quot;&quot;
Set _Library = Nothing
_LibraryName = &quot;&quot;
diff --git a/wizards/source/access2base/OptionGroup.xba b/wizards/source/access2base/OptionGroup.xba
index 02c9c170a808..f4b749ef6128 100644
--- a/wizards/source/access2base/OptionGroup.xba
+++ b/wizards/source/access2base/OptionGroup.xba
@@ -17,6 +17,7 @@ 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
@@ -33,6 +34,7 @@ REM ----------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJOPTIONGROUP
Set _This = Nothing
+ Set _Parent = Nothing
_Name = &quot;&quot;
_ParentType = &quot;&quot;
_ParentComponent = Nothing
@@ -137,6 +139,7 @@ Dim oCounter As Object
&apos; Determine exact name
Set ocControl = New Control
Set ocControl._This = ocControl
+ Set ocControl._Parent = _This
ocControl._ParentType = CTLPARENTISGROUP
ocControl._Shortcut = &quot;&quot;
diff --git a/wizards/source/access2base/Property.xba b/wizards/source/access2base/Property.xba
index c64b0066a786..8b881c284c88 100644
--- a/wizards/source/access2base/Property.xba
+++ b/wizards/source/access2base/Property.xba
@@ -17,6 +17,7 @@ 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
@@ -27,6 +28,7 @@ REM ----------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJPROPERTY
Set _This = Nothing
+ Set _Parent = Nothing
_Name = &quot;&quot;
_Value = Null
End Sub &apos; Constructor
diff --git a/wizards/source/access2base/Recordset.xba b/wizards/source/access2base/Recordset.xba
index e9ad9e20cbc4..88a029190a27 100644
--- a/wizards/source/access2base/Recordset.xba
+++ b/wizards/source/access2base/Recordset.xba
@@ -17,6 +17,7 @@ REM ----------------------------------------------------------------------------
Private _Type As String &apos; Must be RECORDSET
Private _This As Object &apos; Workaround for absence of This builtin function
+Private _Parent As Object
Private _Name As String &apos; Unique, generated
Private _Fields() As Variant
Private _ParentName As String
@@ -52,6 +53,7 @@ REM ----------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJRECORDSET
Set _This = Nothing
+ Set _Parent = Nothing
_Name = &quot;&quot;
_Fields = Array()
_ParentName = &quot;&quot;
diff --git a/wizards/source/access2base/SubForm.xba b/wizards/source/access2base/SubForm.xba
index 30add0f38a09..d905a9836058 100644
--- a/wizards/source/access2base/SubForm.xba
+++ b/wizards/source/access2base/SubForm.xba
@@ -17,6 +17,7 @@ REM ----------------------------------------------------------------------------
Private _Type As String &apos; Must be SUBFORM
Private _This As Object &apos; Workaround for absence of This builtin function
+Private _Parent As Object
Private _Shortcut As String
Private _Name As String
Private _MainForm As String
@@ -32,6 +33,7 @@ REM ----------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJSUBFORM
Set _This = Nothing
+ Set _Parent = Nothing
_Shortcut = &quot;&quot;
_Name = &quot;&quot;
_MainForm = &quot;&quot;
@@ -317,7 +319,7 @@ Public Function Parent() As Object
Utils._SetCalledSub(&quot;SubForm.getParent&quot;)
On Error Goto Error_Function
- Set Parent = PropertiesGet._ParentObject(_Shortcut)
+ Set Parent = _Parent
Exit_Function:
Utils._ResetCalledSub(&quot;SubForm.getParent&quot;)
@@ -395,6 +397,7 @@ Dim j As Integer
&apos; Determine exact name
Set ocControl = New Control
Set ocControl._This = ocControl
+ Set ocControl._Parent = _This
ocControl._ParentType = CTLPARENTISSUBFORM
sParentShortcut = _Shortcut
sControls() = DatabaseForm.getElementNames()
diff --git a/wizards/source/access2base/TempVar.xba b/wizards/source/access2base/TempVar.xba
index 411ad6336d59..d600de3b2bf4 100644
--- a/wizards/source/access2base/TempVar.xba
+++ b/wizards/source/access2base/TempVar.xba
@@ -17,6 +17,7 @@ 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
@@ -26,6 +27,7 @@ REM ----------------------------------------------------------------------------
Private Sub Class_Initialize()
_Type = OBJTEMPVAR
Set _This = Nothing
+ Set _Parent = Nothing
_Name = &quot;&quot;
_Value = Null
End Sub &apos; Constructor