summaryrefslogtreecommitdiffstats
path: root/wizards/source/sfdialogs/SF_DialogListener.xba
blob: 0f324b60963f015ec06a146fd6fd01559071f4df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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

&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;
&apos;&apos;&apos;	SF_Listener
&apos;&apos;&apos;	===========
&apos;&apos;&apos;		The current module is dedicated to the management of dialog control events, triggered by user actions,
&apos;&apos;&apos;		which cannot be defined with the Basic IDE
&apos;&apos;&apos;
&apos;&apos;&apos;		Concerned events:
&apos;&apos;&apos;			TreeControl control type
&apos;&apos;&apos;			-----------
&apos;&apos;&apos;				The OnNodeSelected event, triggered when a user selects a node
&apos;&apos;&apos;					A typical action is to display additional info about the selected item elsewhere in the dialog
&apos;&apos;&apos;				The OnNodeExpanded event, triggered when a user clicks on the expansion symbol
&apos;&apos;&apos;					A typical action is to create dynamically a subnode or a subtree below the expanded item
&apos;&apos;&apos;
&apos;&apos;&apos;		The described events are processed thru UNO listeners
&apos;&apos;&apos;
&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;

REM ================================================================= DEFINITIONS

REM ================================================================== EXCEPTIONS

REM ============================================================== PUBLIC METHODS

REM -----------------------------------------------------------------------------
Public Sub _SFEXP_requestChildNodes(Optional ByRef poEvent As Object)
&apos;&apos;&apos;	Triggered by the OnNodeExpanded event of a tree control
&apos;&apos;&apos;	The event is triggered thru a com.sun.star.view.XTreeExpansionListener
&apos;&apos;&apos;	The argument is passed to a user routine sstored in the SF_DialogControl instance
&apos;&apos;&apos;		as a scripting framework URI

Dim oControl As Object				&apos;	The SF_DialogControl object having triggered the event

	On Local Error GoTo Catch		&apos;	Avoid stopping event scripts

Check:	
	&apos;	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(&quot;SFDialogs.DialogEvent&quot;, 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)
&apos;&apos;&apos;	Triggered by the OnNodeSelected event of a tree control
&apos;&apos;&apos;	The event is triggered thru a com.sun.star.view.XSelectionChangeListener
&apos;&apos;&apos;	The argument is passed to a user routine sstored in the SF_DialogControl instance
&apos;&apos;&apos;		as a scripting framework URI
&apos;&apos;&apos;
&apos;&apos;&apos;	Nothing happens if there are several selected nodes or none

Dim vSelection As Variant			&apos;	Variant, not object !!
Dim oControl As Object				&apos;	The SF_DialogControl object having triggered the event

	On Local Error GoTo Catch		&apos;	Avoid stopping event scripts

Check:	
	&apos;	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(&quot;SFDialogs.DialogEvent&quot;, 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>