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

Jean-Pierre Ledure (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 8 15:32:00 UTC 2020


 wizards/Package_sfdialogs.mk                   |    1 
 wizards/source/scriptforge/SF_Exception.xba    |    2 
 wizards/source/scriptforge/SF_Session.xba      |   46 +++++++++-
 wizards/source/sfdialogs/SF_Dialog.xba         |   54 +++++++----
 wizards/source/sfdialogs/SF_DialogControl.xba  |   84 +++++++++++++++++-
 wizards/source/sfdialogs/SF_DialogListener.xba |  113 +++++++++++++++++++++++++
 wizards/source/sfdialogs/SF_Register.xba       |   11 +-
 wizards/source/sfdialogs/script.xlb            |    1 
 8 files changed, 275 insertions(+), 37 deletions(-)

New commits:
commit 5fa2182d3b5c79bc4cf8ec9621228ddc00283a1f
Author:     Jean-Pierre Ledure <jp at ledure.be>
AuthorDate: Tue Dec 8 15:06:31 2020 +0100
Commit:     Jean-Pierre Ledure <jp at ledure.be>
CommitDate: Tue Dec 8 16:31:11 2020 +0100

    ScriptForge - (SFDialogs) OnNodeSelected/Expanded for tree controls
    
    OnNodeSelected and OnNodeExpanded cannot be defined thru the Basic IDE
    Those editable new properties are used to set up the relevant
    listeners on the control's view
    
    The listener Subs are garthered in a new module, SF_DialogListener
    
    The need to preserve these 2 properties required the existence of
    a cache of all control objects in the parent dialog instance
    
    This technique with listeners can be reused (mutatis mutandis)
    in other contexts to introduce additional event types
    
    Change-Id: I243808590e0534901e041a5f5abad64eb5e118d2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107420
    Tested-by: Jean-Pierre Ledure <jp at ledure.be>
    Tested-by: Jenkins
    Reviewed-by: Jean-Pierre Ledure <jp at ledure.be>

diff --git a/wizards/Package_sfdialogs.mk b/wizards/Package_sfdialogs.mk
index 56ec2db9e165..8a072225a356 100644
--- a/wizards/Package_sfdialogs.mk
+++ b/wizards/Package_sfdialogs.mk
@@ -22,6 +22,7 @@ $(eval $(call gb_Package_Package,wizards_basicsrvsfdialogs,$(SRCDIR)/wizards/sou
 $(eval $(call gb_Package_add_files,wizards_basicsrvsfdialogs,$(LIBO_SHARE_FOLDER)/basic/SFDialogs,\
 	SF_Dialog.xba \
 	SF_DialogControl.xba \
+	SF_DialogListener.xba \
 	SF_Register.xba \
 	__License.xba \
 	dialog.xlb \
diff --git a/wizards/source/scriptforge/SF_Exception.xba b/wizards/source/scriptforge/SF_Exception.xba
index a7dc6b418304..5a04fc0bca29 100644
--- a/wizards/source/scriptforge/SF_Exception.xba
+++ b/wizards/source/scriptforge/SF_Exception.xba
@@ -1104,4 +1104,4 @@ Private Function _Repr() As String
 End Function	'	ScriptForge.SF_Exception._Repr
 
 REM ============================================ END OF SCRIPTFORGE.SF_EXCEPTION
-</script:module>
+</script:module>
\ No newline at end of file
diff --git a/wizards/source/scriptforge/SF_Session.xba b/wizards/source/scriptforge/SF_Session.xba
index a41bffa51377..84351de24add 100644
--- a/wizards/source/scriptforge/SF_Session.xba
+++ b/wizards/source/scriptforge/SF_Session.xba
@@ -42,7 +42,7 @@ REM ============================================================ MODULE CONSTANT
 '''			ExecuteBasicScript()
 '''			ExecutePythonScript()
 '''		Example:
-'''			session.ExecuteBasicScript(session.SCRIPTISEMBEDDED, "Standard.myLib.myFunc", etc)
+'''			session.ExecuteBasicScript(session.SCRIPTISEMBEDDED, "Standard.myModule.myFunc", etc)
 
 Const cstSCRIPTISEMBEDDED		= "document"				' a library of the document						(BASIC + PYTHON)
 Const cstSCRIPTISAPPLICATION	= "application"				' a shared library								(BASIC)
@@ -52,6 +52,11 @@ Const cstSCRIPTISSHARED			= "share"					' a library of LibreOffic
 Const cstSCRIPTISSHAROXT		= "share:uno_packages"		' an extension for all users					(PYTHON)
 Const cstSCRIPTISOXT			= "uno_packages"			' an extension but install params are unknown	(PYTHON)
 
+'''	To build or to parse scripting framework URI's
+Const cstScript1				= "vnd.sun.star.script:"
+Const cstScript2				= "?language="
+Const cstScript3				= "&location="
+
 REM ===================================================== CONSTRUCTOR/DESTRUCTOR
 
 REM -----------------------------------------------------------------------------
@@ -860,6 +865,42 @@ End Function	'	ScriptForge.SF_Session.WebService
 
 REM =========================================================== PRIVATE FUNCTIONS
 
+REM -----------------------------------------------------------------------------
+Private Function _ExecuteScript(ByVal psScript As String _
+									, ByRef poEvent As Object _
+									) As Variant
+'''	Execute the script expressed in the scripting framework_URI notation
+'''	Args:
+'''		psScript: read https://wiki.openoffice.org/wiki/Documentation/DevGuide/Scripting/Scripting_Framework_URI_Specification
+'''		poEvent: the event object which triggered the execution. It is given as argument to the called script
+'''	Returns:
+'''		The return value after the script execution. May be ignored for events
+
+Dim sScope As String			'	The scope part of the script URI
+Dim sLanguage As String			'	The language part of the script URI
+Dim sScript As String			'	The script part of the script URI
+Dim vStrings As Variant			'	Array of strings: (script, language, scope)
+Const cstComma = ","
+
+Try:
+	If ScriptForge.SF_String.StartsWith(psScript, cstScript1) Then
+		'	Parse script
+		vStrings = Split( _
+						Replace( _
+							Replace(Mid(psScript, Len(cstScript1) + 1), cstScript2, cstComma) _
+							, cstScript3, cstComma) _
+						, cstComma)
+		sScript = vStrings(0)	:	sLanguage = vStrings(1)	:	sScope = vStrings(2)
+		'	Execute script
+		If UCase(sLanguage) = "BASIC" Then
+			_ExecuteScript = ExecuteBasicScript(sScope, sScript, poEvent)
+		Else	'	Python
+			_ExecuteScript = ExecutePythonScript(sScope, sScript, poEvent)
+		End If
+	End If
+
+End Function	'	ScriptForge.SF_Session._ExecuteScript
+
 REM -----------------------------------------------------------------------------
 Private Function _GetScript(ByVal psLanguage As String _
 								, ByVal psScope As String _
@@ -881,9 +922,6 @@ Private Function _GetScript(ByVal psLanguage As String _
 Dim sScript As String			'	The complete script string
 Dim oScriptProvider As Object	'	Script provider singleton
 Dim oScript As Object			'	Return value
-Const cstScript1 = "vnd.sun.star.script:"
-Const cstScript2 = "?language="
-Const cstScript3 = "&location="
 
 Try:
 	'	Build script string
diff --git a/wizards/source/sfdialogs/SF_Dialog.xba b/wizards/source/sfdialogs/SF_Dialog.xba
index 3d293e77e125..88869534a581 100644
--- a/wizards/source/sfdialogs/SF_Dialog.xba
+++ b/wizards/source/sfdialogs/SF_Dialog.xba
@@ -70,20 +70,15 @@ Private _DialogModel		As Object		' com.sun.star.awt.XControlModel - stardiv
 Private _Displayed			As Boolean		' True after Execute()
 Private _Modal				As Boolean		' Set by Execute()
 
-'	Cache for TreeControl events
-Private _TreeCache			As Object		' Dictionary: key = control name, item = _TreeControl
-
-Type _TreeControl
-	OnNodeSelected			As String
-	OnNodeExpanded			As String
-End Type
+'	Persistent storage for controls
+Private _ControlCache		As Variant		' Array of control objects sorted like ElementNames of the Dialog model
 
 REM ============================================================ MODULE CONSTANTS
 
 Private Const OKBUTTON		= 1
 Private Const CANCELBUTTON	= 0
 
-REM ===================================================== CONSTRUCTOR/DESTRUCTOR
+REM ====================================================== CONSTRUCTOR/DESTRUCTOR
 
 REM -----------------------------------------------------------------------------
 Private Sub Class_Initialize()
@@ -100,7 +95,7 @@ Private Sub Class_Initialize()
 	Set _DialogModel = Nothing
 	_Displayed = False
 	_Modal = True
-	Set _TreeCache = ScriptForge.SF_Services.CreateScriptService("Dictionary")
+	_ControlCache = Array()
 End Sub		'	SFDialogs.SF_Dialog Constructor
 
 REM -----------------------------------------------------------------------------
@@ -381,7 +376,9 @@ Public Function Controls(Optional ByVal ControlName As Variant) As Variant
 '''				myList = myDialog.Controls()
 '''				Set myControl = myDialog.Controls("myTextBox")
 
-Dim oControl As Object			'	The new control class instance
+Dim oControl As Object				'	The new control class instance
+Dim lIndexOfNames As Long			'	Index in ElementNames array. Used to access _ControlCache
+Dim vControl As Variant				'	Alias of _ControlCache entry
 Const cstThisSub = "SFDialogs.Dialog.Controls"
 Const cstSubArgs = "[ControlName]"
 
@@ -399,17 +396,25 @@ Try:
 		Controls = _DialogModel.getElementNames()
 	Else
 		If Not _DialogModel.hasByName(ControlName) Then GoTo CatchNotFound
-		'	Create the new dialog control class instance
-		Set oControl = New SF_DialogControl
-		With oControl
-			._Name = ControlName
-			Set .[Me] = oControl
-			Set .[_Parent] = [Me]
-			._DialogName = _Name
-			Set ._ControlModel = _DialogModel.getByName(ControlName)
-			Set ._ControlView = _DialogControl.getControl(ControlName)
-			._Initialize()
-		End With
+		lIndexOfNames = ScriptForge.IndexOf(_DialogModel.getElementNames(), ControlName, CaseSensitive := True)
+		'	Reuse cache when relevant
+		vControl = _ControlCache(lIndexOfNames)
+		If IsEmpty(vControl) Then
+			'	Create the new dialog control class instance
+			Set oControl = New SF_DialogControl
+			With oControl
+				._Name = ControlName
+				Set .[Me] = oControl
+				Set .[_Parent] = [Me]
+				._IndexOfNames = ScriptForge.IndexOf(_DialogModel.getElementNames(), ControlName, CaseSensitive := True)
+				._DialogName = _Name
+				Set ._ControlModel = _DialogModel.getByName(ControlName)
+				Set ._ControlView = _DialogControl.getControl(ControlName)
+				._Initialize()
+			End With
+		Else
+			Set oControl = vControl
+		End If
 		Set Controls = oControl
 	End If
 
@@ -710,6 +715,7 @@ Public Sub _Initialize()
 '''		- Initialization of private members
 '''		- Creation of the dialog graphical interface
 '''		- Addition of the new object in the Dialogs buffer
+'''		- Initialisation of persistent storage for controls
 
 Try:
 	'	Create the graphical interface
@@ -718,7 +724,11 @@ Try:
 
 	'	Add dialog reference to cache
 	_CacheIndex = SF_Register._AddDialogToCache(_DialogControl, [Me])
-	85
+
+	'	Size the persistent storage
+	_ControlCache = Array()
+	ReDim _ControlCache(0 To UBound(_DialogModel.getElementNames()))
+
 Finally:
 	Exit Sub
 End Sub			'	SFDialogs.SF_Dialog._Initialize
diff --git a/wizards/source/sfdialogs/SF_DialogControl.xba b/wizards/source/sfdialogs/SF_DialogControl.xba
index 95f99a245f33..f635043ac8b1 100644
--- a/wizards/source/sfdialogs/SF_DialogControl.xba
+++ b/wizards/source/sfdialogs/SF_DialogControl.xba
@@ -25,7 +25,7 @@ Option Explicit
 '''
 '''		A special attention is given to controls with type TreeControl.
 '''		It is easy with the API proposed in the current class to populate a tree, either
-'''			- branch by branch (CreateRoot and AddChild), or
+'''			- branch by branch (CreateRoot and AddSubNode), or
 '''			- with a set of branches at once (AddSubtree)
 '''		Additionally populating a TreeControl can be done statically or dynamically
 '''
@@ -54,6 +54,7 @@ Private ServiceName 		As String
 
 '	Control naming
 Private _Name				As String
+Private _IndexOfNames		As Long			' Index in ElementNames array. Used to access SF_Dialog._ControlCache
 Private _DialogName			As String		' Parent dialog name
 
 '	Control UNO references
@@ -65,6 +66,13 @@ Private _TreeDataModel		As Object		' com.sun.star.awt.tree.MutableTreeDataM
 Private	_ImplementationName	As String
 Private _ControlType		As String		' One of the CTLxxx constants
 
+'	Tree control on-select and on-expand attributes
+'	Tree controls may be associated with events not defined in the Basic IDE
+Private _OnNodeSelected		As String		' Script to invoke when a node is selected
+Private _OnNodeExpanded		As String		' Script to invoke when a node is expanded
+Private _SelectListener		As Object		' com.sun.star.view.XSelectionChangeListener
+Private _ExpandListener		As Object		' com.sun.star.awt.tree.XTreeExpansionListener
+
 REM ============================================================ MODULE CONSTANTS
 
 Private Const CTLBUTTON			= "Button"
@@ -88,7 +96,7 @@ Private Const CTLTEXTFIELD		= "TextField"
 Private Const CTLTIMEFIELD		= "TimeField"
 Private Const CTLTREECONTROL	= "TreeControl"
 
-REM ===================================================== CONSTRUCTOR/DESTRUCTOR
+REM ====================================================== CONSTRUCTOR/DESTRUCTOR
 
 REM -----------------------------------------------------------------------------
 Private Sub Class_Initialize()
@@ -97,12 +105,17 @@ Private Sub Class_Initialize()
 	ObjectType = "DIALOGCONTROL"
 	ServiceName = "SFDialogs.DialogControl"
 	_Name = ""
+	_IndexOfNames = -1
 	_DialogName = ""
 	Set _ControlModel = Nothing
 	Set _ControlView = Nothing
 	Set _TreeDataModel = Nothing
 	_ImplementationName = ""
 	_ControlType = ""
+	_OnNodeSelected = ""
+	_OnNodeExpanded = ""
+	Set _SelectListener = Nothing
+	Set _ExpandListener = Nothing
 End Sub		'	SFDialogs.SF_DialogControl Constructor
 
 REM -----------------------------------------------------------------------------
@@ -918,6 +931,8 @@ Public Function Properties() As Variant
 					, "OnMouseMoved" _
 					, "OnMousePressed" _
 					, "OnMouseReleased" _
+					, "OnNodeExpanded" _
+					, "OnNodeSelected" _
 					, "OnTextChanged" _
 					, "Page" _
 					, "Parent" _
@@ -1218,10 +1233,12 @@ REM ----------------------------------------------------------------------------
 Public Sub _Initialize()
 '''	Complete the object creation process:
 '''		- Initialization of private members
-'''		- Collection of main attributes
+'''		- Collection of specific attributes
+'''		- synchonization with parent dialog instance
 
 Dim vServiceName As Variant		'	Split service name
 Dim sType As String				'	Last component of service name
+
 Try:
 	_ImplementationName = _ControlModel.getImplementationName()
 
@@ -1232,13 +1249,17 @@ Try:
 		Case "UnoControlSpinButtonModel"
 			_ControlType = ""	' Not supported
 		Case "Edit"					:	_ControlType = CTLTEXTFIELD
-		Case "TreeControlModel"	' Initialize the data model
+		Case "TreeControlModel"
+			'	Initialize the data model
 			_ControlType = CTLTREECONTROL
 			Set _ControlModel.DataModel = ScriptForge.SF_Utils._GetUNOService("TreeDataModel")
 			_TreeDataModel = _ControlModel.DataModel
 		Case Else					:	_ControlType = sType
 	End Select
-	
+
+	'	Store  the SF_DialogControl object in the parent cache
+	Set _Parent._ControlCache(_IndexOfNames) = [Me]
+
 Finally:
 	Exit Sub
 End Sub			'	SFDialogs.SF_DialogControl._Initialize
@@ -1380,6 +1401,18 @@ Const cstSubArgs = ""
 			Else
 				_PropertyGet = ""
 			End If
+		Case UCase("OnNodeExpanded")
+			Select Case _ControlType
+				Case CTLTREECONTROL
+					_PropertyGet = _OnNodeExpanded
+				Case Else	:	GoTo CatchType
+			End Select
+		Case UCase("OnNodeSelected")
+			Select Case _ControlType
+				Case CTLTREECONTROL
+					_PropertyGet = _OnNodeSelected
+				Case Else	:	GoTo CatchType
+			End Select
 		Case UCase("Page")
 			If oSession.HasUnoProperty(_ControlModel, "Step") Then _PropertyGet = _ControlModel.Step
 		Case UCase("Parent")
@@ -1563,7 +1596,10 @@ Const cstSubArgs = "Value"
 						.clearSelection()
 						If Not IsNull(pvValue) Then
 							.addSelection(pvValue)
-							.makeNodeVisible(pvValue)		'	Expand parent nodes and put node in the display area
+							'	Suspending temporarily the expansion listener avoids conflicts
+							If Len(_OnNodeExpanded) > 0 Then _ControlView.removeTreeExpansionListener(_ExpandListener)
+							.makeNodeVisible(pvValue)	' Expand parent nodes and put node in the display area
+							If Len(_OnNodeExpanded) > 0 Then _ControlView.addTreeExpansionListener(_ExpandListener)
 						End If
 					End With
 				Case Else	:	GoTo CatchType
@@ -1650,6 +1686,42 @@ Const cstSubArgs = "Value"
 						, _GetListener(psProperty) _
 						, pvValue _
 						)
+		Case UCase("OnNodeExpanded")
+			Select Case _ControlType
+				Case CTLTREECONTROL
+					If Not ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING) Then GoTo Finally
+					'	If the listener was already set, then stop it
+					If Len(_OnNodeExpanded) > 0 Then
+						_ControlView.removeTreeExpansionListener(_ExpandListener)
+						Set _ExpandListener = Nothing
+						_OnNodeExpanded = ""
+					End If
+					'	Setup a new fresh listener
+					If Len(pvValue) > 0 Then
+						Set _ExpandListener = CreateUnoListener("_SFEXP_", "com.sun.star.awt.tree.XTreeExpansionListener")
+						_ControlView.addTreeExpansionListener(_ExpandListener)
+						_OnNodeExpanded = pvValue
+					End If
+				Case Else	:	GoTo CatchType
+			End Select
+		Case UCase("OnNodeSelected")
+			Select Case _ControlType
+				Case CTLTREECONTROL
+					If Not ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING) Then GoTo Finally
+					'	If the listener was already set, then stop it
+					If Len(_OnNodeSelected) > 0 Then
+						_ControlView.removeSelectionChangeListener(_SelectListener)
+						Set _SelectListener = Nothing
+						_OnNodeSelected = ""
+					End If
+					'	Setup a new fresh listener
+					If Len(pvValue) > 0 Then
+						Set _SelectListener = CreateUnoListener("_SFSEL_", "com.sun.star.view.XSelectionChangeListener")
+						_ControlView.addSelectionChangeListener(_SelectListener)
+						_OnNodeSelected = pvValue
+					End If
+				Case Else	:	GoTo CatchType
+			End Select
 		Case UCase("Page")
 			If Not ScriptForge.SF_Utils._Validate(pvValue, "Page", ScriptForge.V_NUMERIC) Then GoTo Finally
 			If oSession.HasUnoProperty(_ControlModel, "Step") Then _ControlModel.Step = CLng(pvValue)
diff --git a/wizards/source/sfdialogs/SF_DialogListener.xba b/wizards/source/sfdialogs/SF_DialogListener.xba
new file mode 100644
index 000000000000..0f324b60963f
--- /dev/null
+++ b/wizards/source/sfdialogs/SF_DialogListener.xba
@@ -0,0 +1,113 @@
+<?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="SF_DialogListener" script:language="StarBasic" script:moduleType="normal">REM =======================================================================================================================
+REM ===			The ScriptForge library and its associated libraries are part of the LibreOffice project.				===
+REM	===						The SFDialogs library is one of the associated libraries.									===
+REM ===					Full documentation is available on https://help.libreoffice.org/								===
+REM =======================================================================================================================
+
+Option Compatible
+Option Explicit
+
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+'''	SF_Listener
+'''	===========
+'''		The current module is dedicated to the management of dialog control events, triggered by user actions,
+'''		which cannot be defined with the Basic IDE
+'''
+'''		Concerned events:
+'''			TreeControl control type
+'''			-----------
+'''				The OnNodeSelected event, triggered when a user selects a node
+'''					A typical action is to display additional info about the selected item elsewhere in the dialog
+'''				The OnNodeExpanded event, triggered when a user clicks on the expansion symbol
+'''					A typical action is to create dynamically a subnode or a subtree below the expanded item
+'''
+'''		The described events are processed thru UNO listeners
+'''
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+REM ================================================================= DEFINITIONS
+
+REM ================================================================== EXCEPTIONS
+
+REM ============================================================== PUBLIC METHODS
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFEXP_requestChildNodes(Optional ByRef poEvent As Object)
+'''	Triggered by the OnNodeExpanded event of a tree control
+'''	The event is triggered thru a com.sun.star.view.XTreeExpansionListener
+'''	The argument is passed to a user routine sstored in the SF_DialogControl instance
+'''		as a scripting framework URI
+
+Dim oControl As Object				'	The SF_DialogControl object having triggered the event
+
+	On Local Error GoTo Catch		'	Avoid stopping event scripts
+
+Check:	
+	'	Ensure there is a node
+	If IsNull(poEvent) Or IsMissing(poEvent) Then Exit Sub
+	If IsNull(poEvent.Node) Then Exit Sub
+
+Try:
+	Set oControl = ScriptForge.SF_Services.CreateScriptService("SFDialogs.DialogEvent", poEvent)
+	ScriptForge.SF_Session._ExecuteScript(oControl.OnNodeExpanded, poEvent)
+
+Finally:
+	Exit Sub
+Catch:
+	GoTo Finally
+End Sub
+
+Sub _SFEXP_disposing(ByRef poEvent As Object)
+End Sub
+
+Sub _SFEXP_treeExpanding(Optional ByRef poEvent As Object)
+End Sub
+
+Sub _SFEXP_treeCollapsing(ByRef poEvent As Object)
+End Sub
+
+Sub _SFEXP_treeExpanded(ByRef poEvent As Object)
+End Sub
+
+Sub _SFEXP_treeCollapsed(ByRef poEvent As Object)
+End Sub
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFSEL_selectionChanged(Optional ByRef poEvent As Object)
+'''	Triggered by the OnNodeSelected event of a tree control
+'''	The event is triggered thru a com.sun.star.view.XSelectionChangeListener
+'''	The argument is passed to a user routine sstored in the SF_DialogControl instance
+'''		as a scripting framework URI
+'''
+'''	Nothing happens if there are several selected nodes or none
+
+Dim vSelection As Variant			'	Variant, not object !!
+Dim oControl As Object				'	The SF_DialogControl object having triggered the event
+
+	On Local Error GoTo Catch		'	Avoid stopping event scripts
+
+Check:	
+	'	Ensure there is a selection
+	If IsNull(poEvent) Or IsMissing(poEvent) Then Exit Sub
+	vSelection = poEvent.Source.getSelection()
+	If IsEmpty(vSelection) Or IsArray(vSelection) Then Exit Sub
+
+Try:
+	Set oControl = ScriptForge.SF_Services.CreateScriptService("SFDialogs.DialogEvent", poEvent)
+	ScriptForge.SF_Session._ExecuteScript(oControl.OnNodeSelected, poEvent)
+
+Finally:
+	Exit Sub
+Catch:
+	GoTo Finally
+End Sub
+
+Sub _SFSEL_disposing(ByRef poEvent As Object)
+End Sub
+
+REM ============================================================= PRIVATE METHODS
+
+REM ============================================ END OF SFDIALOGS.SF_DIALOGLISTENER
+</script:module>
\ No newline at end of file
diff --git a/wizards/source/sfdialogs/SF_Register.xba b/wizards/source/sfdialogs/SF_Register.xba
index 7018385a1442..ac19bdebff34 100644
--- a/wizards/source/sfdialogs/SF_Register.xba
+++ b/wizards/source/sfdialogs/SF_Register.xba
@@ -203,6 +203,8 @@ Dim oBasicDialog As Object		'	Return value
 Dim oCache As _DialogCache		'	Entry in the cache
 
 	Set oBasicDialog = Nothing
+
+Try:
 	For Each oCache In _SF_.SFDialogs
 		If EqualUnoObjects(poDialog, oCache.XUnoDialog) And Not oCache.Terminated Then
 			Set oBasicDialog = oCache.BasicDialog
@@ -210,8 +212,9 @@ Dim oCache As _DialogCache		'	Entry in the cache
 		End If
 	Next oCache
 
+Finally:
 	Set _FindDialogInCache = oBasicDialog
-
+	Exit Function
 End Function	'	SFDialogs.SF_Documents._FindDialogInCache
 
 REM -----------------------------------------------------------------------------
@@ -231,7 +234,7 @@ Dim vLibrary As Variant				'	Alias of pvArgs(1)
 Dim vDialogName As Variant			'	Alias of pvArgs(2)
 Dim oLibraries As Object			'	com.sun.star.comp.sfx2.DialogLibraryContainer
 Dim oLibrary As Object				'	com.sun.star.container.XNameAccess
-Dim o_DialogProvider As Object		'	com.sun.star.io.XInputStreamProvider
+Dim oDialogProvider As Object		'	com.sun.star.io.XInputStreamProvider
 Dim oEnum As Object					'	com.sun.star.container.XEnumeration
 Dim oComp As Object					'	com.sun.star.lang.XComponent
 Dim vWindow As Window				'	A single component
@@ -301,7 +304,7 @@ Try:
 		If Not .isLibraryLoaded(vLibrary) Then .loadLibrary(vLibrary)
 		Set oLibrary = .getByName(vLibrary)
 		If Not oLibrary.hasByName(vDialogName) Then GoTo CatchNotFound
-		Set o_DialogProvider = oLibrary.getByName(vDialogName)
+		Set oDialogProvider = oLibrary.getByName(vDialogName)
 	End With
 
 	Set oDialog = New SF_Dialog
@@ -310,7 +313,7 @@ Try:
 		If VarType(vContainer) = V_STRING Then ._Container = vContainer Else ._Container = vWindow.WindowName
 		._Library = vLibrary
 		._Name = vDialogName
-		Set ._DialogProvider = o_DialogProvider
+		Set ._DialogProvider = oDialogProvider
 		._Initialize()
 	End With
 
diff --git a/wizards/source/sfdialogs/script.xlb b/wizards/source/sfdialogs/script.xlb
index 1a171c326079..6dff54d872f5 100644
--- a/wizards/source/sfdialogs/script.xlb
+++ b/wizards/source/sfdialogs/script.xlb
@@ -5,4 +5,5 @@
  <library:element library:name="SF_Register"/>
  <library:element library:name="SF_Dialog"/>
  <library:element library:name="SF_DialogControl"/>
+ <library:element library:name="SF_DialogListener"/>
 </library:library>
\ No newline at end of file


More information about the Libreoffice-commits mailing list