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
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' 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>
|