diff options
Diffstat (limited to 'wizards/source/sfdialogs/SF_DialogListener.xba')
-rw-r--r-- | wizards/source/sfdialogs/SF_DialogListener.xba | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/wizards/source/sfdialogs/SF_DialogListener.xba b/wizards/source/sfdialogs/SF_DialogListener.xba new file mode 100644 index 000000000..0f324b609 --- /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 |