[Libreoffice-commits] core.git: wizards/source

Jean-Pierre Ledure (via logerrit) logerrit at kemper.freedesktop.org
Sat Jul 13 14:23:16 UTC 2019


 wizards/source/access2base/CommandBar.xba        |   10 +++++++++-
 wizards/source/access2base/CommandBarControl.xba |    4 +++-
 wizards/source/access2base/Control.xba           |    5 ++++-
 wizards/source/access2base/DataDef.xba           |    2 ++
 wizards/source/access2base/Database.xba          |    2 ++
 wizards/source/access2base/Dialog.xba            |    8 ++++++++
 wizards/source/access2base/Field.xba             |    2 ++
 wizards/source/access2base/Form.xba              |   10 +++++++++-
 wizards/source/access2base/Module.xba            |    2 ++
 wizards/source/access2base/OptionGroup.xba       |    3 +++
 wizards/source/access2base/Property.xba          |    2 ++
 wizards/source/access2base/Recordset.xba         |    2 ++
 wizards/source/access2base/SubForm.xba           |    5 ++++-
 wizards/source/access2base/TempVar.xba           |    2 ++
 14 files changed, 54 insertions(+), 5 deletions(-)

New commits:
commit 15fec4ee1c07b7c2b234384654ca3ee730acc2c8
Author:     Jean-Pierre Ledure <jp at ledure.be>
AuthorDate: Sat Jul 13 16:19:17 2019 +0200
Commit:     Jean-Pierre Ledure <jp at ledure.be>
CommitDate: Sat Jul 13 16:22:32 2019 +0200

    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

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		'	Must be COMMANDBAR
 Private _This			As Object		'	Workaround for absence of This builtin function
+Private _Parent			As Object
 Private _Name			As String
 Private _ResourceURL	As String
 Private _Window			As Object		'	com.sun.star.frame.XFrame
@@ -31,6 +32,7 @@ REM ----------------------------------------------------------------------------
 Private Sub Class_Initialize()
 	_Type = OBJCOMMANDBAR
 	Set _This = Nothing
+	Set _Parent = Nothing
 	_Name = ""
 	_ResourceURL = ""
 	Set _Window = Nothing
@@ -75,6 +77,11 @@ Property Get ObjectType() As String
 End Property		'	ObjectType (get)
 
 REM -----------------------------------------------------------------------------------------------------------------------
+Public Function Parent() As Object
+	Parent = _Parent
+End Function		'	Parent (get)	V6.4.0
+
+REM -----------------------------------------------------------------------------------------------------------------------
 Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
 '	Return
 '		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		'	Must be COMMANDBARCONTROL
 Private _This					As Object		'	Workaround for absence of This builtin function
+Private _Parent					As Object
 Private _InternalIndex			As Integer		'	Index in toolbar including separators
 Private _Index					As Integer		'	Index in collection, starting at 1 !!
 Private _ControlType			As Integer		'	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 = ""
 	Set _ParentCommandBar = Nothing
@@ -238,7 +240,7 @@ Const cstUnoPrefix = ".uno:"
 		Case UCase("OnAction")
 			_PropertyGet = _GetPropertyValue(_Element, "CommandURL", "")
 		Case UCase("Parent")
-			Set _PropertyGet = Application.CommandBars(_ParentCommandBarName)
+			Set _PropertyGet = _Parent
 		Case UCase("TooltipText")
 				sValue = _GetPropertyValue(_Element, "Tooltip", "")
 				If sValue <> "" Then _PropertyGet = sValue Else _PropertyGet = _GetPropertyValue(_Element, "Label", "")
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				'	Must be CONTROL
 Private _This					As Object				'	Workaround for absence of This builtin function
+Private _Parent					As Object
 Private	_ImplementationName		As String
 Private _ClassId				As Integer
 Private	_ParentType				As String				'	One of CTLPARENTISxxxx constants
@@ -40,6 +41,7 @@ REM ----------------------------------------------------------------------------
 Private Sub Class_Initialize()
 	_Type				= OBJCONTROL
 	Set _This			= Nothing
+	Set _Parent			= Nothing
 	_ClassId 			= -1
 	_ParentType			= ""
 	_Shortcut			= ""
@@ -781,6 +783,7 @@ Dim j As Integer, oView As Object
 	'	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("Page")
 			If Utils._hasUNOProperty(ControlModel, "Step") Then _PropertyGet = ControlModel.Step
 		Case UCase("Parent")
-			Set _PropertyGet = PropertiesGet._ParentObject(_Shortcut)
+			Set _PropertyGet = _Parent
 		Case UCase("Picture")
 			_PropertyGet = ConvertToUrl(ControlModel.ImageURL)
 		Case UCase("Required")
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				'	Must be TABLEDEF or QUERYDEF
 Private _This					As Object				'	Workaround for absence of This builtin function
+Private _Parent					As Object
 Private _Name					As String				'	For tables: [[Catalog.]Schema.]Table
 Private _ParentDatabase			As Object
 Private _ReadOnly				As Boolean
@@ -35,6 +36,7 @@ REM ----------------------------------------------------------------------------
 Private Sub Class_Initialize()
 	_Type = ""
 	Set _This = Nothing
+	Set _Parent = Nothing
 	_Name = ""
 	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				'	Must be DATABASE
 Private _This					As Object				'	Workaround for absence of This builtin function
+Private _Parent					As Object
 Private	_DbConnect				As Integer				'	DBCONNECTxxx constants
 Private	Title					As String
 Private	Document				As Object				'	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 = ""
 	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				'	Must be DIALOG
 Private _This					As Object				'	Workaround for absence of This builtin function
+Private _Parent					As Object
 Private	_Name					As String
 Private _Shortcut				As String
 Private _Dialog					As Object				'	com.sun.star.io.XInputStreamProvider
@@ -30,6 +31,7 @@ REM ----------------------------------------------------------------------------
 Private Sub Class_Initialize()
 	_Type = OBJDIALOG
 	Set _This = Nothing
+	Set _Parent = Nothing
 	_Name = ""
 	Set _Dialog = Nothing
 	_Storage = ""
@@ -292,6 +294,11 @@ Property Let Page(ByVal pvValue As Variant)
 End Property		'	Page (set)
 
 REM -----------------------------------------------------------------------------------------------------------------------
+Public Function Parent() As Object
+	Parent = _Parent
+End Function		'	Parent (get)	V6.4.0
+
+REM -----------------------------------------------------------------------------------------------------------------------
 Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
 '	Return
 '		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				'	Must be FIELD
 Private _This					As Object				'	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 = ""
 	_ParentName = ""
 	_ParentType = ""
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				'	Must be FORM
 Private _This					As Object				'	Workaround for absence of This builtin function
+Private _Parent					As Object
 Private	_Shortcut				As String
 Private	_Name					As String
 Private _DocEntry				As Integer				'	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 = ""
 	_Name = ""
 	_DocEntry = -1
@@ -398,6 +400,11 @@ Error_Function:
 End Function		'	OptionGroup	V1.1.0
 
 REM -----------------------------------------------------------------------------------------------------------------------
+Public Function Parent() As Object
+	Parent = _Parent
+End Function		'	Parent (get)	V6.4.0
+
+REM -----------------------------------------------------------------------------------------------------------------------
 Public Function Properties(ByVal Optional pvIndex As Variant) As Variant
 '	Return
 '		a Collection object if pvIndex absent
@@ -556,7 +563,8 @@ Dim oDatabaseForm As Object, iCtlCount As Integer
 	'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 & "!" & 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				'	Must be MODULE
 Private _This					As Object				'	Workaround for absence of This builtin function
+Private _Parent					As Object
 Private	_Name					As String
 Private _Library				As Object				'	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 = ""
 	Set _Library = Nothing
 	_LibraryName = ""
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				'	Must be FORM
 Private _This					As Object				'	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 = ""
 	_ParentType = ""
 	_ParentComponent = Nothing
@@ -137,6 +139,7 @@ Dim oCounter As Object
 	'	Determine exact name
 	Set ocControl = New Control
 	Set ocControl._This = ocControl
+	Set ocControl._Parent = _This
 	ocControl._ParentType = CTLPARENTISGROUP
 	
 	ocControl._Shortcut = ""
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		'	Must be PROPERTY
 Private _This			As Object		'	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 = ""
 	_Value = Null
 End Sub		'	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				'	Must be RECORDSET
 Private _This					As Object				'	Workaround for absence of This builtin function
+Private _Parent					As Object
 Private _Name					As String				'	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 = ""
 	_Fields = Array()
 	_ParentName = ""
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				'	Must be SUBFORM
 Private _This					As Object				'	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 = ""
 	_Name = ""
 	_MainForm = ""
@@ -317,7 +319,7 @@ Public Function Parent() As Object
 	Utils._SetCalledSub("SubForm.getParent")
 	On Error Goto Error_Function
 
-	Set Parent = PropertiesGet._ParentObject(_Shortcut)
+	Set Parent = _Parent
 	
 Exit_Function:
 	Utils._ResetCalledSub("SubForm.getParent")
@@ -395,6 +397,7 @@ Dim j As Integer
 	'	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		'	Must be TEMPVAR
 Private _This			As Object		'	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 = ""
 	_Value = Null
 End Sub		'	Constructor


More information about the Libreoffice-commits mailing list