summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2023-03-13 18:22:26 +0100
committerJean-Pierre Ledure <jp@ledure.be>2023-03-14 10:46:15 +0000
commit0483b0a4bbd41f026a53ff35ab3162b57bee1a91 (patch)
treec6f84ee21cc4e3d65b7f454bc3d314db1d0002a0 /wizards
parent8a3dc12a13a3b9e99dbd5000ca6a1d541cf472f7 (diff)
ScriptForge (SFDialogs) make On properties editable
A dialog box and its controls may be associated with scripts triggered by events (mouse moved, key pressed, ...). The link is usually preset in the Basic IDE when the dialog is designed. So far, ScriptForge did not offer the setting of a link event-script by code. The actual commit removes this limitation: every On-property related to either a dialog or a dialog control is now editbale. With the important precision that such a property may be updated ONLY IF it was NOT PRESET in the Basic IDE. Static (IDE) and dynamic (by code) definition of a specific On property on a specific dialog or on a specific dialog control are mutually exclusive. The new capacity may be used both in Basic and Python scripts. A short update of the help texts (dialog and dialogcontrol) is needed with mention of above restriction. Change-Id: Ia078aaab317ced7ade7ce69694504013f8e768a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148800 Tested-by: Jean-Pierre Ledure <jp@ledure.be> Reviewed-by: Jean-Pierre Ledure <jp@ledure.be> Tested-by: Jenkins
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/scriptforge/SF_UI.xba2
-rw-r--r--wizards/source/scriptforge/python/scriptforge.py20
-rw-r--r--wizards/source/sfdialogs/SF_Dialog.xba160
-rw-r--r--wizards/source/sfdialogs/SF_DialogControl.xba198
-rw-r--r--wizards/source/sfdialogs/SF_DialogListener.xba446
-rw-r--r--wizards/source/sfwidgets/SF_Toolbar.xba4
6 files changed, 798 insertions, 32 deletions
diff --git a/wizards/source/scriptforge/SF_UI.xba b/wizards/source/scriptforge/SF_UI.xba
index 392eeb29a64d..3bde6c22e4ac 100644
--- a/wizards/source/scriptforge/SF_UI.xba
+++ b/wizards/source/scriptforge/SF_UI.xba
@@ -1506,4 +1506,4 @@ Private Function _Repr() As String
End Function &apos; ScriptForge.SF_UI._Repr
REM ============================================ END OF SCRIPTFORGE.SF_UI
-</script:module>
+</script:module> \ No newline at end of file
diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py
index 7208ff81cda6..531b0da1e6be 100644
--- a/wizards/source/scriptforge/python/scriptforge.py
+++ b/wizards/source/scriptforge/python/scriptforge.py
@@ -1840,10 +1840,10 @@ class SFDialogs:
servicename = 'SFDialogs.Dialog'
servicesynonyms = ('dialog', 'sfdialogs.dialog')
serviceproperties = dict(Caption = True, Height = True, Modal = False, Name = False,
- OnFocusGained = False, OnFocusLost = False, OnKeyPressed = False,
- OnKeyReleased = False, OnMouseDragged = False, OnMouseEntered = False,
- OnMouseExited = False, OnMouseMoved = False, OnMousePressed = False,
- OnMouseReleased = False,
+ OnFocusGained = True, OnFocusLost = True, OnKeyPressed = True,
+ OnKeyReleased = True, OnMouseDragged = True, OnMouseEntered = True,
+ OnMouseExited = True, OnMouseMoved = True, OnMousePressed = True,
+ OnMouseReleased = True,
Page = True, Visible = True, Width = True, XDialogModel = False, XDialogView = False)
# Class constants used together with the Execute() method
OKBUTTON, CANCELBUTTON = 1, 0
@@ -1906,12 +1906,12 @@ class SFDialogs:
serviceproperties = dict(Cancel = True, Caption = True, ControlType = False, CurrentNode = True,
Default = True, Enabled = True, Format = True, ListCount = False,
ListIndex = True, Locked = True, MultiSelect = True, Name = False,
- OnActionPerformed = False, OnAdjustmentValueChanged = False, OnFocusGained = False,
- OnFocusLost = False, OnItemStateChanged = False, OnKeyPressed = False,
- OnKeyReleased = False, OnMouseDragged = False, OnMouseEntered = False,
- OnMouseExited = False, OnMouseMoved = False, OnMousePressed = False,
- OnMouseReleased = False, OnNodeExpanded = True, OnNodeSelected = True,
- OnTextChanged = False, Page = True, Parent = False, Picture = True,
+ OnActionPerformed = True, OnAdjustmentValueChanged = True, OnFocusGained = True,
+ OnFocusLost = True, OnItemStateChanged = True, OnKeyPressed = True,
+ OnKeyReleased = True, OnMouseDragged = True, OnMouseEntered = True,
+ OnMouseExited = True, OnMouseMoved = True, OnMousePressed = True,
+ OnMouseReleased = True, OnNodeExpanded = True, OnNodeSelected = True,
+ OnTextChanged = True, Page = True, Parent = False, Picture = True,
RootNode = False, RowSource = True, Text = False, TipText = True,
TripleState = True, Value = True, Visible = True,
XControlModel = False, XControlView = False, XGridColumnModel = False,
diff --git a/wizards/source/sfdialogs/SF_Dialog.xba b/wizards/source/sfdialogs/SF_Dialog.xba
index 081584f56e81..430b29d20b57 100644
--- a/wizards/source/sfdialogs/SF_Dialog.xba
+++ b/wizards/source/sfdialogs/SF_Dialog.xba
@@ -93,6 +93,30 @@ Private _ItemListener As Object &apos; com.sun.star.awt.XItemListener
Private _ActionListener As Object &apos; com.sun.star.awt.XActionListener
Private _LastPage As Long &apos; When &gt; 0, the last page in a tabbed dialog
+&apos; Updatable events
+&apos; Next identifiers MUST be identical in both SF_Dialog and SF_DialogControl class modules
+Private _FocusListener As Object &apos; com.sun.star.awt.XFocusListener
+Private _OnFocusGained As String &apos; Script to invoke when dialog gets focus
+Private _OnFocusLost As String &apos; Script to invoke when dialog loses focus
+Private _FocusCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _KeyListener As Object &apos; com.sun.star.awt.XKeyListener
+Private _OnKeyPressed As String &apos; Script to invoke when Key clicked in dialog
+Private _OnKeyReleased As String &apos; Script to invoke when Key released in dialog
+Private _KeyCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _MouseListener As Object &apos; com.sun.star.awt.XMouseListener
+Private _OnMouseEntered As String &apos; Script to invoke when mouse enters dialog
+Private _OnMouseExited As String &apos; Script to invoke when mouse leaves dialog
+Private _OnMousePressed As String &apos; Script to invoke when mouse clicked in dialog
+Private _OnMouseReleased As String &apos; Script to invoke when mouse released in dialog
+Private _MouseCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _MouseMotionListener As Object &apos; com.sun.star.awt.XMouseMotionListener
+Private _OnMouseDragged As String &apos; Script to invoke when mouse is dragged from the dialog
+Private _OnMouseMoved As String &apos; Script to invoke when mouse is moved across the dialog
+Private _MouseMotionCounter As Integer &apos; Counts the number of events set on the listener
+
&apos; Persistent storage for controls
Private _ControlCache As Variant &apos; Array of control objects sorted like ElementNames of the Dialog model
@@ -135,6 +159,24 @@ Private Sub Class_Initialize()
Set _ItemListener = Nothing
Set _ActionListener = Nothing
_LastPage = 0
+ Set _FocusListener = Nothing
+ _OnFocusGained = &quot;&quot;
+ _OnFocusLost = &quot;&quot;
+ _FocusCounter = 0
+ Set _KeyListener = Nothing
+ _OnKeyPressed = &quot;&quot;
+ _OnKeyReleased = &quot;&quot;
+ _KeyCounter = 0
+ Set _MouseListener = Nothing
+ _OnMouseEntered = &quot;&quot;
+ _OnMouseExited = &quot;&quot;
+ _OnMousePressed = &quot;&quot;
+ _OnMouseReleased = &quot;&quot;
+ _MouseCounter = 0
+ Set _MouseMotionListener = Nothing
+ _OnMouseDragged = &quot;&quot;
+ _OnMouseMoved = &quot;&quot;
+ _MouseMotionCounter = 0
_ControlCache = Array()
End Sub &apos; SFDialogs.SF_Dialog Constructor
@@ -205,60 +247,120 @@ Property Get OnFocusGained() As Variant
End Property &apos; SFDialogs.SF_Dialog.OnFocusGained (get)
REM -----------------------------------------------------------------------------
+Property Let OnFocusGained(Optional ByVal pvOnFocusGained As Variant)
+&apos;&apos;&apos; Set the updatable property OnFocusGained
+ _PropertySet(&quot;OnFocusGained&quot;, pvOnFocusGained)
+End Property &apos; SFDialogs.SF_Dialog.OnFocusGained (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnFocusLost() As Variant
&apos;&apos;&apos; Get the script associated with the OnFocusLost event
OnFocusLost = _PropertyGet(&quot;OnFocusLost&quot;)
End Property &apos; SFDialogs.SF_Dialog.OnFocusLost (get)
REM -----------------------------------------------------------------------------
+Property Let OnFocusLost(Optional ByVal pvOnFocusLost As Variant)
+&apos;&apos;&apos; Set the updatable property OnFocusLost
+ _PropertySet(&quot;OnFocusLost&quot;, pvOnFocusLost)
+End Property &apos; SFDialogs.SF_Dialog.OnFocusLost (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnKeyPressed() As Variant
&apos;&apos;&apos; Get the script associated with the OnKeyPressed event
OnKeyPressed = _PropertyGet(&quot;OnKeyPressed&quot;)
End Property &apos; SFDialogs.SF_Dialog.OnKeyPressed (get)
REM -----------------------------------------------------------------------------
+Property Let OnKeyPressed(Optional ByVal pvOnKeyPressed As Variant)
+&apos;&apos;&apos; Set the updatable property OnKeyPressed
+ _PropertySet(&quot;OnKeyPressed&quot;, pvOnKeyPressed)
+End Property &apos; SFDialogs.SF_Dialog.OnKeyPressed (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnKeyReleased() As Variant
&apos;&apos;&apos; Get the script associated with the OnKeyReleased event
OnKeyReleased = _PropertyGet(&quot;OnKeyReleased&quot;)
End Property &apos; SFDialogs.SF_Dialog.OnKeyReleased (get)
REM -----------------------------------------------------------------------------
+Property Let OnKeyReleased(Optional ByVal pvOnKeyReleased As Variant)
+&apos;&apos;&apos; Set the updatable property OnKeyReleased
+ _PropertySet(&quot;OnKeyReleased&quot;, pvOnKeyReleased)
+End Property &apos; SFDialogs.SF_Dialog.OnKeyReleased (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnMouseDragged() As Variant
&apos;&apos;&apos; Get the script associated with the OnMouseDragged event
OnMouseDragged = _PropertyGet(&quot;OnMouseDragged&quot;)
End Property &apos; SFDialogs.SF_Dialog.OnMouseDragged (get)
REM -----------------------------------------------------------------------------
+Property Let OnMouseDragged(Optional ByVal pvOnMouseDragged As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseDragged
+ _PropertySet(&quot;OnMouseDragged&quot;, pvOnMouseDragged)
+End Property &apos; SFDialogs.SF_Dialog.OnMouseDragged (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnMouseEntered() As Variant
&apos;&apos;&apos; Get the script associated with the OnMouseEntered event
OnMouseEntered = _PropertyGet(&quot;OnMouseEntered&quot;)
End Property &apos; SFDialogs.SF_Dialog.OnMouseEntered (get)
REM -----------------------------------------------------------------------------
+Property Let OnMouseEntered(Optional ByVal pvOnMouseEntered As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseEntered
+ _PropertySet(&quot;OnMouseEntered&quot;, pvOnMouseEntered)
+End Property &apos; SFDialogs.SF_Dialog.OnMouseEntered (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnMouseExited() As Variant
&apos;&apos;&apos; Get the script associated with the OnMouseExited event
OnMouseExited = _PropertyGet(&quot;OnMouseExited&quot;)
End Property &apos; SFDialogs.SF_Dialog.OnMouseExited (get)
REM -----------------------------------------------------------------------------
+Property Let OnMouseExited(Optional ByVal pvOnMouseExited As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseExited
+ _PropertySet(&quot;OnMouseExited&quot;, pvOnMouseExited)
+End Property &apos; SFDialogs.SF_Dialog.OnMouseExited (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnMouseMoved() As Variant
&apos;&apos;&apos; Get the script associated with the OnMouseMoved event
OnMouseMoved = _PropertyGet(&quot;OnMouseMoved&quot;)
End Property &apos; SFDialogs.SF_Dialog.OnMouseMoved (get)
REM -----------------------------------------------------------------------------
+Property Let OnMouseMoved(Optional ByVal pvOnMouseMoved As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseMoved
+ _PropertySet(&quot;OnMouseMoved&quot;, pvOnMouseMoved)
+End Property &apos; SFDialogs.SF_Dialog.OnMouseMoved (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnMousePressed() As Variant
&apos;&apos;&apos; Get the script associated with the OnMousePressed event
OnMousePressed = _PropertyGet(&quot;OnMousePressed&quot;)
End Property &apos; SFDialogs.SF_Dialog.OnMousePressed (get)
REM -----------------------------------------------------------------------------
+Property Let OnMousePressed(Optional ByVal pvOnMousePressed As Variant)
+&apos;&apos;&apos; Set the updatable property OnMousePressed
+ _PropertySet(&quot;OnMousePressed&quot;, pvOnMousePressed)
+End Property &apos; SFDialogs.SF_Dialog.OnMousePressed (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnMouseReleased() As Variant
&apos;&apos;&apos; Get the script associated with the OnMouseReleased event
OnMouseReleased = _PropertyGet(&quot;OnMouseReleased&quot;)
End Property &apos; SFDialogs.SF_Dialog.OnMouseReleased (get)
REM -----------------------------------------------------------------------------
+Property Let OnMouseReleased(Optional ByVal pvOnMouseReleased As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseReleased
+ _PropertySet(&quot;OnMouseReleased&quot;, pvOnMouseReleased)
+End Property &apos; SFDialogs.SF_Dialog.OnMouseReleased (let)
+
+REM -----------------------------------------------------------------------------
Property Get Page() As Variant
&apos;&apos;&apos; A dialog may have several pages that can be traversed by the user step by step.
&apos;&apos;&apos; The Page property of the Dialog object defines which page of the dialog is active.
@@ -831,7 +933,7 @@ Try:
iFlags = 0
With com.sun.star.awt.PosSize
If Left &gt;= 0 Then iFlags = iFlags + .X Else Left = oPosSize.X
- If Top &gt;= 0 Then iFlags = iFlags + .Y Else Top = oPosSize.Y
+ If Top &gt;= 0 Then iFlags = iFlags + .Y Else Top = oPosSize.Y
If Width &gt; 0 Then iFlags = iFlags + .WIDTH Else Width = oPosSize.Width
If Height &gt; 0 Then iFlags = iFlags + .HEIGHT Else Height = oPosSize.Height
End With
@@ -1021,7 +1123,7 @@ Check:
End If
Try:
- _RemovePageListeners()
+ _RemoveAllListeners()
_DialogControl.dispose()
Set _DialogControl = Nothing
SF_Register._CleanCacheEntry(_CacheIndex)
@@ -1292,12 +1394,26 @@ Const cstSubArgs = &quot;&quot;
Case UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;), UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;) _
, UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMouseMoved&quot;) _
, UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;)
+ &apos; Check OnEvents set statically in Basic IDE
Set oDialogEvents = _DialogModel.getEvents()
sEventName = &quot;com.sun.star.awt.&quot; &amp; _GetListener(psProperty) &amp; &quot;::&quot; &amp; _GetEventName(psProperty)
If oDialogEvents.hasByName(sEventName) Then
_PropertyGet = oDialogEvents.getByName(sEventName).ScriptCode
Else
- _PropertyGet = &quot;&quot;
+ &apos; Check OnEvents set dynamically by code
+ Select Case UCase(psProperty)
+ Case UCase(&quot;OnFocusGained&quot;) : _PropertyGet = _OnFocusGained
+ Case UCase(&quot;OnFocusLost&quot;) : _PropertyGet = _OnFocusLost
+ Case UCase(&quot;OnKeyPressed&quot;) : _PropertyGet = _OnKeyPressed
+ Case UCase(&quot;OnKeyReleased&quot;) : _PropertyGet = _OnKeyReleased
+ Case UCase(&quot;OnMouseDragged&quot;) : _PropertyGet = _OnMouseDragged
+ Case UCase(&quot;OnMouseEntered&quot;) : _PropertyGet = _OnMouseEntered
+ Case UCase(&quot;OnMouseExited&quot;) : _PropertyGet = _OnMouseExited
+ Case UCase(&quot;OnMouseMoved&quot;) : _PropertyGet = _OnMouseMoved
+ Case UCase(&quot;OnMousePressed&quot;) : _PropertyGet = _OnMousePressed
+ Case UCase(&quot;OnMouseReleased&quot;) : _PropertyGet = _OnMouseReleased
+ Case Else : _PropertyGet = &quot;&quot;
+ End Select
End If
Case UCase(&quot;Page&quot;)
If oSession.HasUNOProperty(_DialogModel, &quot;Step&quot;) Then _PropertyGet = _DialogModel.Step
@@ -1347,23 +1463,28 @@ Const cstSubArgs = &quot;Value&quot;
bSet = True
Select Case UCase(psProperty)
Case UCase(&quot;Caption&quot;)
- If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Caption&quot;, V_STRING) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Caption&quot;, V_STRING) Then GoTo Catch
If oSession.HasUNOProperty(_DialogModel, &quot;Title&quot;) Then _DialogModel.Title = pvValue
Case UCase(&quot;Height&quot;)
- If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Height&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Height&quot;, ScriptForge.V_NUMERIC) Then GoTo Catch
If oSession.HasUNOProperty(_DialogModel, &quot;Height&quot;) Then _DialogModel.Height = pvValue
+ Case UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;), UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;) _
+ , UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMouseMoved&quot;) _
+ , UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING) Then GoTo Catch
+ bSet = SF_DialogListener._SetOnProperty([Me], psProperty, pvValue)
Case UCase(&quot;Page&quot;)
- If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Page&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Page&quot;, ScriptForge.V_NUMERIC) Then GoTo Catch
If oSession.HasUNOProperty(_DialogModel, &quot;Step&quot;) Then
_DialogModel.Step = CLng(pvValue)
&apos; Execute the page manager instructions
_JumpToPage(pvValue)
End If
Case UCase(&quot;Visible&quot;)
- If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Visible&quot;, ScriptForge.V_BOOLEAN) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Visible&quot;, ScriptForge.V_BOOLEAN) Then GoTo Catch
If oSession.HasUnoMethod(_DialogControl, &quot;setVisible&quot;) Then _DialogControl.setVisible(pvValue)
Case UCase(&quot;Width&quot;)
- If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Width&quot;, ScriptForge.V_NUMERIC) Then GoTo Finally
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Width&quot;, ScriptForge.V_NUMERIC) Then GoTo Catch
If oSession.HasUNOProperty(_DialogModel, &quot;Width&quot;) Then _DialogModel.Width = pvValue
Case Else
bSet = False
@@ -1374,6 +1495,7 @@ Finally:
ScriptForge.SF_Utils._ExitFunction(cstThisSub)
Exit Function
Catch:
+ bSet = False
GoTo Finally
End Function &apos; SFDialogs.SF_Dialog._PropertySet
@@ -1449,8 +1571,9 @@ Catch:
End Function &apos; SFDialogs.SF_Dialog._RegisterPageListener
REM -----------------------------------------------------------------------------
-Private Sub _RemovePageListeners()
-&apos;&apos;&apos; Executed at dialog termination to drop at once all listeners set by the page manager
+Private Sub _RemoveAllListeners()
+&apos;&apos;&apos; Executed at dialog termination to drop at once all listeners set
+&apos;&apos;&apos; either by the page manager or by an On-property setting
Dim oPageManager As Object &apos; Item of _PageManagement array of _PageManager type
Dim oControl As Object &apos; DialogControl instance
@@ -1467,7 +1590,7 @@ Try:
If .ListenerType = ACTIONPERFORMED Then
oControl._ControlView.removeActionListener(_ActionListener)
ElseIf .ListenerType = ITEMSTATECHANGED Then
- oControl._ControlView.addItemListener(_ItemListener)
+ oControl._ControlView.removeItemListener(_ItemListener)
End If
End If
End With
@@ -1476,9 +1599,22 @@ Try:
Set _ActionListener = Nothing
Set _ItemListener = Nothing
+ &apos; Clean listeners linked to On properties
+ With _DialogControl
+ If Not IsNull(_FocusListener) Then .removeFocusListener(_FocusListener)
+ If Not IsNull(_KeyListener) Then .removeKeyListener(_KeyListener)
+ If Not IsNull(_MouseListener) Then .removeMouseListener(_MouseListener)
+ If Not IsNull(_MouseMotionListener) Then .removeMouseMotionListener(_MouseMotionListener)
+ End With
+
+ Set _FocusListener = Nothing
+ Set _KeyListener = Nothing
+ Set _MouseListener = Nothing
+ Set _MouseMotionListener = Nothing
+
Finally:
Exit Sub
-End Sub &apos; SFDialogs.SF_Dialog._RemovePageListeners
+End Sub &apos; SFDialogs.SF_Dialog._RemoveAllListeners
REM -----------------------------------------------------------------------------
Private Function _Repr() As String
&apos;&apos;&apos; Convert the Model instance to a readable string, typically for debugging purposes (DebugPrint ...)
diff --git a/wizards/source/sfdialogs/SF_DialogControl.xba b/wizards/source/sfdialogs/SF_DialogControl.xba
index f4a0891d92c4..081885301bf7 100644
--- a/wizards/source/sfdialogs/SF_DialogControl.xba
+++ b/wizards/source/sfdialogs/SF_DialogControl.xba
@@ -82,6 +82,45 @@ Private _OnNodeExpanded As String &apos; Script to invoke when a node is expan
Private _SelectListener As Object &apos; com.sun.star.view.XSelectionChangeListener
Private _ExpandListener As Object &apos; com.sun.star.awt.tree.XTreeExpansionListener
+&apos; Updatable events
+Private _ActionListener As Object &apos; com.sun.star.awt.XActionListener
+Private _OnActionPerformed As String &apos; Script to invoke when action triggered
+Private _ActionCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _AdjustmentListener As Strung &apos; com.sun.star.awt.XAdjustmentListener
+Private _OnAdjustmentValueChanged As String &apos; Script to invoke when scrollbar value has changed
+Private _AdjustmentCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _FocusListener As Object &apos; com.sun.star.awt.XFocusListener
+Private _OnFocusGained As String &apos; Script to invoke when control gets focus
+Private _OnFocusLost As String &apos; Script to invoke when control loses focus
+Private _FocusCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _ItemListener As Object &apos; com.sun.star.awt.XItemListener
+Private _OnItemStateChanged As String &apos; Script to invoke when status of item changes
+Private _ItemCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _KeyListener As Object &apos; com.sun.star.awt.XKeyListener
+Private _OnKeyPressed As String &apos; Script to invoke when Key clicked in control
+Private _OnKeyReleased As String &apos; Script to invoke when Key released in control
+Private _KeyCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _MouseListener As Object &apos; com.sun.star.awt.XMouseListener
+Private _OnMouseEntered As String &apos; Script to invoke when mouse enters control
+Private _OnMouseExited As String &apos; Script to invoke when mouse leaves control
+Private _OnMousePressed As String &apos; Script to invoke when mouse clicked in control
+Private _OnMouseReleased As String &apos; Script to invoke when mouse released in control
+Private _MouseCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _MouseMotionListener As Object &apos; com.sun.star.awt.XMouseMotionListener
+Private _OnMouseDragged As String &apos; Script to invoke when mouse is dragged from the control
+Private _OnMouseMoved As String &apos; Script to invoke when mouse is moved across the control
+Private _MouseMotionCounter As Integer &apos; Counts the number of events set on the listener
+&apos; ---
+Private _TextListener As Object &apos; com.sun.star.awt.XTextListener
+Private _OnTextChanged As String &apos; Script to invoke when textual content has changed
+Private _TextCounter As Integer &apos; Counts the number of events set on the listener
+
&apos; Table control attributes
Private _ColumnWidths As Variant &apos; Array of column widths
@@ -127,10 +166,43 @@ Private Sub Class_Initialize()
Set _GridDataModel = Nothing
_ImplementationName = &quot;&quot;
_ControlType = &quot;&quot;
+
_OnNodeSelected = &quot;&quot;
_OnNodeExpanded = &quot;&quot;
Set _SelectListener = Nothing
Set _ExpandListener = Nothing
+
+ Set _ActionListener = Nothing
+ _OnActionPerformed = &quot;&quot;
+ _ActionCounter = 0
+ Set _AdjustmentListener = Nothing
+ _OnAdjustmentValueChanged = &quot;&quot;
+ _AdjustmentCounter = 0
+ Set _FocusListener = Nothing
+ _OnFocusGained = &quot;&quot;
+ _OnFocusLost = &quot;&quot;
+ _FocusCounter = 0
+ Set _KeyListener = Nothing
+ _OnKeyPressed = &quot;&quot;
+ _OnKeyReleased = &quot;&quot;
+ _KeyCounter = 0
+ Set _MouseListener = Nothing
+ _OnMouseEntered = &quot;&quot;
+ _OnMouseExited = &quot;&quot;
+ _OnMousePressed = &quot;&quot;
+ _OnMouseReleased = &quot;&quot;
+ _MouseCounter = 0
+ Set _MouseMotionListener = Nothing
+ _OnMouseDragged = &quot;&quot;
+ _OnMouseMoved = &quot;&quot;
+ _MouseMotionCounter = 0
+ Set _ItemListener = Nothing
+ _OnItemStateChanged = &quot;&quot;
+ _ItemCounter = 0
+ Set _TextListener = Nothing
+ _OnTextChanged = &quot;&quot;
+ _TextCounter = 0
+
_ColumnWidths = Array()
End Sub &apos; SFDialogs.SF_DialogControl Constructor
@@ -284,78 +356,156 @@ Property Get OnActionPerformed() As Variant
End Property &apos; SFDialogs.SF_DialogControl.OnActionPerformed (get)
REM -----------------------------------------------------------------------------
+Property Let OnActionPerformed(Optional ByVal pvActionPerformed As Variant)
+&apos;&apos;&apos; Set the updatable property OnActionPerformed
+ _PropertySet(&quot;OnActionPerformed&quot;, pvActionPerformed)
+End Property &apos; SFDialogs.SF_DialogControl.OnActionPerformed (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnAdjustmentValueChanged() As Variant
&apos;&apos;&apos; Get the script associated with the OnAdjustmentValueChanged event
OnAdjustmentValueChanged = _PropertyGet(&quot;OnAdjustmentValueChanged&quot;)
End Property &apos; SFDialogs.SF_DialogControl.OnAdjustmentValueChanged (get)
REM -----------------------------------------------------------------------------
+Property Let OnAdjustmentValueChanged(Optional ByVal pvAdjustmentValueChanged As Variant)
+&apos;&apos;&apos; Set the updatable property OnAdjustmentValueChanged
+ _PropertySet(&quot;OnAdjustmentValueChanged&quot;, pvAdjustmentValueChanged)
+End Property &apos; SFDialogs.SF_DialogControl.OnAdjustmentValueChanged (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnFocusGained() As Variant
&apos;&apos;&apos; Get the script associated with the OnFocusGained event
OnFocusGained = _PropertyGet(&quot;OnFocusGained&quot;)
End Property &apos; SFDialogs.SF_DialogControl.OnFocusGained (get)
REM -----------------------------------------------------------------------------
+Property Let OnFocusGained(Optional ByVal pvOnFocusGained As Variant)
+&apos;&apos;&apos; Set the updatable property OnFocusGained
+ _PropertySet(&quot;OnFocusGained&quot;, pvOnFocusGained)
+End Property &apos; SFDialogs.SF_DialogControl.OnFocusGained (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnFocusLost() As Variant
&apos;&apos;&apos; Get the script associated with the OnFocusLost event
OnFocusLost = _PropertyGet(&quot;OnFocusLost&quot;)
End Property &apos; SFDialogs.SF_DialogControl.OnFocusLost (get)
REM -----------------------------------------------------------------------------
+Property Let OnFocusLost(Optional ByVal pvOnFocusLost As Variant)
+&apos;&apos;&apos; Set the updatable property OnFocusLost
+ _PropertySet(&quot;OnFocusLost&quot;, pvOnFocusLost)
+End Property &apos; SFDialogs.SF_DialogControl.OnFocusLost (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnItemStateChanged() As Variant
&apos;&apos;&apos; Get the script associated with the OnItemStateChanged event
OnItemStateChanged = _PropertyGet(&quot;OnItemStateChanged&quot;)
End Property &apos; SFDialogs.SF_DialogControl.OnItemStateChanged (get)
REM -----------------------------------------------------------------------------
+Property Let OnItemStateChanged(Optional ByVal pvItemStateChanged As Variant)
+&apos;&apos;&apos; Set the updatable property OnItemStateChanged
+ _PropertySet(&quot;OnItemStateChanged&quot;, pvItemStateChanged)
+End Property &apos; SFDialogs.SF_DialogControl.OnItemStateChanged (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnKeyPressed() As Variant
&apos;&apos;&apos; Get the script associated with the OnKeyPressed event
OnKeyPressed = _PropertyGet(&quot;OnKeyPressed&quot;)
End Property &apos; SFDialogs.SF_DialogControl.OnKeyPressed (get)
REM -----------------------------------------------------------------------------
+Property Let OnKeyPressed(Optional ByVal pvOnKeyPressed As Variant)
+&apos;&apos;&apos; Set the updatable property OnKeyPressed
+ _PropertySet(&quot;OnKeyPressed&quot;, pvOnKeyPressed)
+End Property &apos; SFDialogs.SF_DialogControl.OnKeyPressed (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnKeyReleased() As Variant
&apos;&apos;&apos; Get the script associated with the OnKeyReleased event
OnKeyReleased = _PropertyGet(&quot;OnKeyReleased&quot;)
End Property &apos; SFDialogs.SF_DialogControl.OnKeyReleased (get)
REM -----------------------------------------------------------------------------
+Property Let OnKeyReleased(Optional ByVal pvOnKeyReleased As Variant)
+&apos;&apos;&apos; Set the updatable property OnKeyReleased
+ _PropertySet(&quot;OnKeyReleased&quot;, pvOnKeyReleased)
+End Property &apos; SFDialogs.SF_DialogControl.OnKeyReleased (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnMouseDragged() As Variant
&apos;&apos;&apos; Get the script associated with the OnMouseDragged event
OnMouseDragged = _PropertyGet(&quot;OnMouseDragged&quot;)
End Property &apos; SFDialogs.SF_DialogControl.OnMouseDragged (get)
REM -----------------------------------------------------------------------------
+Property Let OnMouseDragged(Optional ByVal pvOnMouseDragged As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseDragged
+ _PropertySet(&quot;OnMouseDragged&quot;, pvOnMouseDragged)
+End Property &apos; SFDialogs.SF_DialogControl.OnMouseDragged (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnMouseEntered() As Variant
&apos;&apos;&apos; Get the script associated with the OnMouseEntered event
OnMouseEntered = _PropertyGet(&quot;OnMouseEntered&quot;)
End Property &apos; SFDialogs.SF_DialogControl.OnMouseEntered (get)
REM -----------------------------------------------------------------------------
+Property Let OnMouseEntered(Optional ByVal pvOnMouseEntered As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseEntered
+ _PropertySet(&quot;OnMouseEntered&quot;, pvOnMouseEntered)
+End Property &apos; SFDialogs.SF_DialogControl.OnMouseEntered (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnMouseExited() As Variant
&apos;&apos;&apos; Get the script associated with the OnMouseExited event
OnMouseExited = _PropertyGet(&quot;OnMouseExited&quot;)
End Property &apos; SFDialogs.SF_DialogControl.OnMouseExited (get)
REM -----------------------------------------------------------------------------
+Property Let OnMouseExited(Optional ByVal pvOnMouseExited As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseExited
+ _PropertySet(&quot;OnMouseExited&quot;, pvOnMouseExited)
+End Property &apos; SFDialogs.SF_DialogControl.OnMouseExited (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnMouseMoved() As Variant
&apos;&apos;&apos; Get the script associated with the OnMouseMoved event
OnMouseMoved = _PropertyGet(&quot;OnMouseMoved&quot;)
End Property &apos; SFDialogs.SF_DialogControl.OnMouseMoved (get)
REM -----------------------------------------------------------------------------
+Property Let OnMouseMoved(Optional ByVal pvOnMouseMoved As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseMoved
+ _PropertySet(&quot;OnMouseMoved&quot;, pvOnMouseMoved)
+End Property &apos; SFDialogs.SF_DialogControl.OnMouseMoved (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnMousePressed() As Variant
&apos;&apos;&apos; Get the script associated with the OnMousePressed event
OnMousePressed = _PropertyGet(&quot;OnMousePressed&quot;)
End Property &apos; SFDialogs.SF_DialogControl.OnMousePressed (get)
REM -----------------------------------------------------------------------------
+Property Let OnMousePressed(Optional ByVal pvOnMousePressed As Variant)
+&apos;&apos;&apos; Set the updatable property OnMousePressed
+ _PropertySet(&quot;OnMousePressed&quot;, pvOnMousePressed)
+End Property &apos; SFDialogs.SF_DialogControl.OnMousePressed (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnMouseReleased() As Variant
&apos;&apos;&apos; Get the script associated with the OnMouseReleased event
OnMouseReleased = _PropertyGet(&quot;OnMouseReleased&quot;)
End Property &apos; SFDialogs.SF_DialogControl.OnMouseReleased (get)
REM -----------------------------------------------------------------------------
+Property Let OnMouseReleased(Optional ByVal pvOnMouseReleased As Variant)
+&apos;&apos;&apos; Set the updatable property OnMouseReleased
+ _PropertySet(&quot;OnMouseReleased&quot;, pvOnMouseReleased)
+End Property &apos; SFDialogs.SF_DialogControl.OnMouseReleased (let)
+
+REM -----------------------------------------------------------------------------
Property Get OnNodeExpanded() As Variant
&apos;&apos;&apos; Get the script associated with the OnNodeExpanded event
OnNodeExpanded = _PropertyGet(&quot;OnNodeExpanded&quot;)
@@ -386,6 +536,12 @@ Property Get OnTextChanged() As Variant
End Property &apos; SFDialogs.SF_DialogControl.OnTextChanged (get)
REM -----------------------------------------------------------------------------
+Property Let OnTextChanged(Optional ByVal pvTextChanged As Variant)
+&apos;&apos;&apos; Set the updatable property OnTextChanged
+ _PropertySet(&quot;OnTextChanged&quot;, pvTextChanged)
+End Property &apos; SFDialogs.SF_DialogControl.OnTextChanged (let)
+
+REM -----------------------------------------------------------------------------
Property Get Page() As Variant
&apos;&apos;&apos; A dialog may have several pages that can be traversed by the user step by step. The Page property of the Dialog object defines which page of the dialog is active.
&apos;&apos;&apos; The Page property of a control defines the page of the dialog on which the control is visible.
@@ -1606,7 +1762,24 @@ Const cstSubArgs = &quot;&quot;
If oControlEvents.hasByName(sEventName) Then
_PropertyGet = oControlEvents.getByName(sEventName).ScriptCode
Else
- _PropertyGet = &quot;&quot;
+ &apos; Check OnEvents set dynamically by code
+ Select Case UCase(psProperty)
+ Case UCase(&quot;OnActionPerformed&quot;) : _PropertyGet = _OnActionPerformed
+ Case UCase(&quot;OnAdjustmentValueChanged&quot;) : _PropertyGet = _OnAdjustmentValueChanged
+ Case UCase(&quot;OnFocusGained&quot;) : _PropertyGet = _OnFocusGained
+ Case UCase(&quot;OnFocusLost&quot;) : _PropertyGet = _OnFocusLost
+ Case UCase(&quot;OnItemStateChanged&quot;) : _PropertyGet = _OnItemStateChanged
+ Case UCase(&quot;OnKeyPressed&quot;) : _PropertyGet = _OnKeyPressed
+ Case UCase(&quot;OnKeyReleased&quot;) : _PropertyGet = _OnKeyReleased
+ Case UCase(&quot;OnMouseDragged&quot;) : _PropertyGet = _OnMouseDragged
+ Case UCase(&quot;OnMouseEntered&quot;) : _PropertyGet = _OnMouseEntered
+ Case UCase(&quot;OnMouseExited&quot;) : _PropertyGet = _OnMouseExited
+ Case UCase(&quot;OnMouseMoved&quot;) : _PropertyGet = _OnMouseMoved
+ Case UCase(&quot;OnMousePressed&quot;) : _PropertyGet = _OnMousePressed
+ Case UCase(&quot;OnMouseReleased&quot;) : _PropertyGet = _OnMouseReleased
+ Case UCase(&quot;OnTextChanged&quot;) : _PropertyGet = _OnTextChanged
+ Case Else : _PropertyGet = &quot;&quot;
+ End Select
End If
Case UCase(&quot;OnNodeExpanded&quot;)
Select Case _ControlType
@@ -1893,6 +2066,29 @@ Const cstSubArgs = &quot;Value&quot;
End If
Case Else : GoTo CatchType
End Select
+ Case UCase(&quot;OnActionPerformed&quot;), UCase(&quot;OnAdjustmentValueChanged&quot;), UCase(&quot;OnFocusGained&quot;), UCase(&quot;OnFocusLost&quot;) _
+ , UCase(&quot;OnItemStateChanged&quot;), UCase(&quot;OnKeyPressed&quot;), UCase(&quot;OnKeyReleased&quot;) _
+ , UCase(&quot;OnMouseDragged&quot;), UCase(&quot;OnMouseEntered&quot;), UCase(&quot;OnMouseExited&quot;), UCase(&quot;OnMouseMoved&quot;) _
+ , UCase(&quot;OnMousePressed&quot;), UCase(&quot;OnMouseReleased&quot;), UCase(&quot;OnTextChanged&quot;)
+ If Not ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING) Then GoTo Catch
+ &apos; Check control type for not universal event types
+ Select Case UCase(psProperty)
+ Case UCase(&quot;OnActionPerformed&quot;), UCase(&quot;OnItemStateChanged&quot;)
+ Select Case _ControlType
+ Case CTLBUTTON, CTLCHECKBOX, CTLCOMBOBOX, CTLLISTBOX, CTLRADIOBUTTON
+ Case Else : GoTo CatchType
+ End Select
+ Case UCase(&quot;OnAdjustmentValueChanged&quot;)
+ If _ControlType &lt;&gt; CTLSCROLLBAR Then GoTo CatchType
+ Case UCase(&quot;OnTextChanged&quot;)
+ Select Case _ControlType
+ Case CTLCOMBOBOX, CTLCURRENCYFIELD, CTLDATEFIELD, CTLFILECONTROL, CTLFORMATTEDFIELD _
+ , CTLNUMERICFIELD, CTLPATTERNFIELD, CTLTEXTFIELD, CTLTIMEFIELD, CTLTREECONTROL
+ Case Else : GoTo CatchType
+ End Select
+ Case Else
+ End Select
+ bSet = SF_DialogListener._SetOnProperty([Me], psProperty, pvValue)
Case UCase(&quot;OnNodeExpanded&quot;)
Select Case _ControlType
Case CTLTREECONTROL
diff --git a/wizards/source/sfdialogs/SF_DialogListener.xba b/wizards/source/sfdialogs/SF_DialogListener.xba
index 25634b3d7107..805a43d8c358 100644
--- a/wizards/source/sfdialogs/SF_DialogListener.xba
+++ b/wizards/source/sfdialogs/SF_DialogListener.xba
@@ -13,7 +13,7 @@ Option Explicit
&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; which are not defined with the Basic IDE
&apos;&apos;&apos;
&apos;&apos;&apos; Concerned events:
&apos;&apos;&apos; TreeControl control type, prefix = _SFEXP_
@@ -31,6 +31,11 @@ Option Explicit
&apos;&apos;&apos;
&apos;&apos;&apos; The described events are processed thru UNO listeners
&apos;&apos;&apos;
+&apos;&apos;&apos; &quot;On&quot; events defined by code, prefix = _SFFOCUS_, _SFKEY_, _SFMOUSE_, _SFMOVE_, _SFITEM_, _SFADJUST_, _SFTEXT_
+&apos;&apos;&apos; -----------
+&apos;&apos;&apos; All event types applicable on dialogs and control types &lt;&gt; TreeControl
+&apos;&apos;&apos; The events MUST NOT be preset in the Basic IDE
+&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
@@ -63,7 +68,7 @@ Finally:
Exit Sub
Catch:
GoTo Finally
-End Sub
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFEXP_requestChildNodes
Sub _SFEXP_disposing(ByRef poEvent As Object)
End Sub
@@ -84,7 +89,7 @@ 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; The argument is passed to a user routine stored 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
@@ -108,7 +113,7 @@ Finally:
Exit Sub
Catch:
GoTo Finally
-End Sub
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFSEL_selectionChanged
Sub _SFSEL_disposing(ByRef poEvent As Object)
End Sub
@@ -153,7 +158,7 @@ Try:
Finally:
Exit Sub
-End Sub
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFTAB_actionPerformed
REM -----------------------------------------------------------------------------
Public Sub _SFTAB_itemStateChanged(Optional ByRef poEvent As Object)
@@ -187,13 +192,442 @@ Try:
Finally:
Exit Sub
-End Sub
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFTAB_itemStateChanged
REM -----------------------------------------------------------------------------
Public Sub _SFTAB_disposing(Optional ByRef poEvent As Object)
End Sub
+REM ========================== PUBLIC METHODS (GENERIC DIALOG AND CONTROL EVENTS)
+
+&apos;&apos;&apos; Next methods SIMULATE the behaviour of events set on dialogs and dialog controls
+&apos;&apos;&apos; in the Events tab of a dialog editing page in the Basic IDE.
+&apos;&apos;&apos; They are not triggered by events preset in the Basic IDE.
+&apos;&apos;&apos; They are triggered ONLY when the event has been set by code with one of the OnXxxYyyy properties,
+&apos;&apos;&apos; like in:
+&apos;&apos;&apos; dialog.OnActionPerformed = &quot;vnd....&quot; &apos; URI notation
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFACTION_actionPerformed(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnActionPerformed event in a dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XActionListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;actionPerformed&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener. _SFACTION_actionPerformed
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFACTION_disposing()
+End Sub
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFADJUST_adjustmentValueChanged(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnAdjustmentValueChanged event in a scrollbar
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XAdjustmentListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;adjustmentValueChanged&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener. _SFADJUST_adjustmentValueChanged
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFADJUST_disposing()
+End Sub
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFFOCUS_focusGained(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnFocusGained event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XFocusListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;focusGained&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFFOCUS_focusGained
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFFOCUS_focusLost(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnFocusLost event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XFocusListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;focusLost&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFFOCUS_focusLost
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFFOCUS_disposing()
+End Sub
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFITEM_itemStateChanged(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnItemStateChanged event in a dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XItemListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;itemStateChanged&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener. _SFACTION_actionPerformed
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFITEM_disposing()
+End Sub
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFKEY_keyPressed(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnKeyPressed event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XKeyListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;keyPressed&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFKEY_keyPressed
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFKEY_keyReleased(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnKeyReleased event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XKeyListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;keyReleased&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFKEY_keyReleased
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFKEY_disposing()
+End Sub
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFMOUSE_mouseEntered(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnMouseEntered event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XMouseListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;mouseEntered&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFMOUSE_mouseEntered
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFMOUSE_mouseExited(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnMouseExited event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XMouseListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;mouseExited&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFMOUSE_mouseExited
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFMOUSE_mousePressed(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnMousePressed event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XMouseListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;mousePressed&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFMOUSE_mousePressed
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFMOUSE_mouseReleased(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnMouseReleased event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XMouseListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;mouseReleased&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFMOUSE_mouseReleased
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFMOUSE_disposing()
+End Sub
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFMOVE_mouseDragged(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnMouseDragged event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XMouseMotionListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;mouseDragged&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFMOUSE_mouseDragged
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFMOVE_mouseMoved(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnMouseMoved event in a dialog or dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XMouseMotionListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;mouseMoved&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener._SFMOUSE_mouseMoved
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFMOVE_disposing()
+End Sub
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFTEXT_textChanged(Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the OnTextChanged event in a dialog control
+&apos;&apos;&apos; The event is triggered thru a com.sun.star.awt.XTextListener
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+ _TriggerEvent(&quot;textChanged&quot;, poEvent)
+
+End Sub &apos; SFDialogs.SF_Dialoglistener. _SFTEXT_textChanged
+
+REM -----------------------------------------------------------------------------
+Public Sub _SFTEXT_disposing()
+End Sub
+
REM ============================================================= PRIVATE METHODS
+REM -----------------------------------------------------------------------------
+Public Function _SetOnProperty(ByRef poInstance As Object _
+ , ByVal psProperty As String _
+ , ByVal psScript As String _
+ ) As Boolean
+&apos;&apos;&apos; Set one of the On properties related to either a SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; Such a property is typically set by next pseudo-code:
+&apos;&apos;&apos; poInstance.psProperty = psScript
+&apos;&apos;&apos; It requires a strictly identical nomenclature of internal variables in both classes.
+&apos;&apos;&apos; Args:
+&apos;&apos;&apos; poInstance: a SF_Dialog or a SF_DialogControl instance
+&apos;&apos;&apos; psProperty: one of the applicable On properties (&quot;OnFocusGained&quot;, &quot;OnMouseMoved&quot;, ...)
+&apos;&apos;&apos; psScript: the script to run when the event is triggered
+&apos;&apos;&apos; When the zero-length strng, the trigger is deactivated
+
+Dim bSet As Boolean &apos; Return value
+Dim oModel As Object &apos; com.sun.star.awt.XControlModel
+Dim oView As Object &apos; com.sun.star.awt.XControl
+Dim oDialogEvents As Object &apos; com.sun.star.container.XNameContainer
+Dim sListener As String &apos; Applicable listener, depending on property, f.i. &quot;XMouseListener&quot;
+Dim sEventName As String &apos; Internal event name
+Dim iCounterIncrement As Integer &apos; Increment to be applied on listener counter
+Dim sPrevious As String &apos; Actual value of script before the change
+
+Const cstPrefix = &quot;com.sun.star.awt.&quot;
+
+ bSet = True
+
+Check:
+ If IsNull(poInstance) Or Len(psProperty) = 0 Then GoTo Catch
+ With poInstance
+
+ &apos; Initialize local variables depending on instance type
+ If .ObjectType = &quot;DIALOG&quot; Then
+ Set oModel = ._DialogModel
+ Set oView = ._DialogControl
+ Else &apos; DIALOGCONTROL
+ Set oModel = ._ControlModel
+ Set oView = ._ControlView
+ End If
+ If IsNull(oModel) Or IsNull(oView) Then GoTo Catch
+
+ &apos; Ignore request if an event has been statically preset (in the Basic IDE) with the same name
+ Set oDialogEvents = oModel.getEvents()
+ sListener = ._GetListener(psProperty)
+ sEventName = cstPrefix &amp; sListener &amp; &quot;::&quot; &amp; ._GetEventName(psProperty)
+ If oDialogEvents.hasByName(sEventName) Then GoTo Catch
+
+Try:
+ &apos; Note the target scripts. Compare previous and new values. Fix the increment to be applied on counter
+ Select Case UCase(psProperty)
+ Case UCase(&quot;OnActionPerformed&quot;)
+ sPrevious = ._OnActionPerformed
+ ._OnActionPerformed = psScript
+ Case UCase(&quot;OnAdjustmentValueChanged&quot;)
+ sPrevious = ._OnAdjustmentValueChanged
+ ._OnAdjustmentValueChanged = psScript
+ Case UCase(&quot;OnFocusGained&quot;)
+ sPrevious = ._OnfocusGained
+ ._OnFocusGained = psScript
+ Case UCase(&quot;OnFocusLost&quot;)
+ sPrevious = ._OnFocusLost
+ ._OnFocusLost = psScript
+ Case UCase(&quot;OnItemStateChanged&quot;)
+ sPrevious = ._OnItemStateChanged
+ ._OnItemStateChanged = psScript
+ Case UCase(&quot;OnKeyPressed&quot;)
+ sPrevious = ._OnKeyPressed
+ ._OnKeyPressed = psScript
+ Case UCase(&quot;OnKeyReleased&quot;)
+ sPrevious = ._OnKeyReleased
+ ._OnKeyReleased = psScript
+ Case UCase(&quot;OnMouseDragged&quot;)
+ sPrevious = ._OnMouseDragged
+ ._OnMouseDragged = psScript
+ Case UCase(&quot;OnMouseEntered&quot;)
+ sPrevious = ._OnMouseEntered
+ ._OnMouseEntered = psScript
+ Case UCase(&quot;OnMouseExited&quot;)
+ sPrevious = ._OnMouseExited
+ ._OnMouseExited = psScript
+ Case UCase(&quot;OnMouseMoved&quot;)
+ sPrevious = ._OnMouseMoved
+ ._OnMouseMoved = psScript
+ Case UCase(&quot;OnMousePressed&quot;)
+ sPrevious = ._OnMousePressed
+ ._OnMousePressed = psScript
+ Case UCase(&quot;OnMouseReleased&quot;)
+ sPrevious = ._OnMouseReleased
+ ._OnMouseReleased = psScript
+ Case UCase(&quot;OnTextChanged&quot;)
+ sPrevious = ._OnTextChanged
+ ._OnTextChanged = psScript
+ End Select
+ &apos; Compare previous and new event to know what to do next with the listener
+ If sPrevious = psScript Then GoTo Finally &apos; No change
+ If Len(sPrevious) = 0 Then &apos; New event
+ iCounterIncrement = +1
+ ElseIf Len(psScript) = 0 Then &apos; Cancel event
+ iCounterIncrement = -1
+ Else &apos; Event replacement
+ iCounterIncrement = 0
+ End If
+
+ &apos; Setup a new fresh listener, only once by listener during dialog or control life time,
+ &apos; (re)add it to the instance view or remove the existing one if not needed anymore
+ Select Case sListener
+ Case &quot;XActionListener&quot;
+ ._ActionCounter = ._ActionCounter + iCounterIncrement
+ If ._ActionCounter = 1 Then
+ If IsNull(._ActionListener) Then Set ._ActionListener = CreateUnoListener(&quot;_SFACTION_&quot;, cstPrefix &amp; sListener)
+ If iCounterIncrement = 1 Then oView.addActionListener(._ActionListener)
+ ElseIf ._ActionCounter &lt;= 0 Then
+ If Not IsNull(._ActionListener) Then oView.removeActionListener(._ActionListener)
+ ._ActionCounter = 0 &apos; Prevent negative values
+ End If
+ Case &quot;XAdjustmentListener&quot;
+ ._AdjustmentCounter = ._AdjustmentCounter + iCounterIncrement
+ If ._AdjustmentCounter = 1 Then
+ If IsNull(._AdjustmentListener) Then Set ._AdjustmentListener = CreateUnoListener(&quot;_SFADJUST_&quot;, cstPrefix &amp; sListener)
+ If iCounterIncrement = 1 Then oView.addAdjustmentListener(._AdjustmentListener)
+ ElseIf ._AdjustmentCounter &lt;= 0 Then
+ If Not IsNull(._AdjustmentListener) Then oView.removeAdjustmentListener(._AdjustmentListener)
+ ._AdjustmentCounter = 0 &apos; Prevent negative values
+ End If
+ Case &quot;XFocusListener&quot;
+ ._FocusCounter = ._FocusCounter + iCounterIncrement
+ If ._FocusCounter = 1 Then
+ If IsNull(._FocusListener) Then Set ._FocusListener = CreateUnoListener(&quot;_SFFOCUS_&quot;, cstPrefix &amp; sListener)
+ If iCounterIncrement = 1 Then oView.addFocusListener(._FocusListener)
+ ElseIf ._FocusCounter &lt;= 0 Then
+ If Not IsNull(._FocusListener) Then oView.removeFocusListener(._FocusListener)
+ ._FocusCounter = 0 &apos; Prevent negative values
+ End If
+ Case &quot;XItemListener&quot;
+ ._ItemCounter = ._ItemCounter + iCounterIncrement
+ If ._ItemCounter = 1 Then
+ If IsNull(._ItemListener) Then Set ._ItemListener = CreateUnoListener(&quot;_SFITEM_&quot;, cstPrefix &amp; sListener)
+ If iCounterIncrement = 1 Then oView.addItemListener(._ItemListener)
+ ElseIf ._ItemCounter &lt;= 0 Then
+ If Not IsNull(._ItemListener) Then oView.removeItemListener(._ItemListener)
+ ._ItemCounter = 0 &apos; Prevent negative values
+ End If
+ Case &quot;XKeyListener&quot;
+ ._KeyCounter = ._KeyCounter + iCounterIncrement
+ If ._KeyCounter= 1 Then
+ If IsNull(._KeyListener) Then Set ._KeyListener = CreateUnoListener(&quot;_SFKEY_&quot;, cstPrefix &amp; sListener)
+ If iCounterIncrement = 1 Then oView.addKeyListener(._KeyListener)
+ ElseIf ._KeyCounter &lt;= 0 Then
+ If Not IsNull(._KeyListener) Then oView.removeKeyListener(._KeyListener)
+ ._KeyCounter = 0 &apos; Prevent negative values
+ End If
+ Case &quot;XMouseListener&quot;
+ ._MouseCounter = ._MouseCounter + iCounterIncrement
+ If ._MouseCounter= 1 Then
+ If IsNull(._MouseListener) Then Set ._MouseListener = CreateUnoListener(&quot;_SFMOUSE_&quot;, cstPrefix &amp; sListener)
+ If iCounterIncrement = 1 Then oView.addMouseListener(._MouseListener)
+ ElseIf ._MouseCounter &lt;= 0 Then
+ If Not IsNull(._MouseListener) Then oView.removeMouseListener(._MouseListener)
+ ._MouseCounter = 0 &apos; Prevent negative values
+ End If
+ Case &quot;XMouseMotionListener&quot;
+ ._MouseMotionCounter = ._MouseMotionCounter + iCounterIncrement
+ If ._MouseMotionCounter = 1 Then
+ If IsNull(._MouseMotionListener) Then Set ._MouseMotionListener = CreateUnoListener(&quot;_SFMOVE_&quot;, cstPrefix &amp; sListener)
+ If iCounterIncrement = 1 Then oView.addMouseMotionListener(._MouseMotionListener)
+ ElseIf ._MouseMotionCounter &lt;= 0 Then
+ If Not IsNull(._MouseMotionListener) Then oView.removeMouseMotionListener(._MouseMotionListener)
+ ._MouseMotionCounter = 0 &apos; Prevent negative values
+ End If
+ Case &quot;XTextListener&quot;
+ ._TextCounter = ._TextCounter + iCounterIncrement
+ If ._TextCounter = 1 Then
+ If IsNull(._TextListener) Then Set ._TextListener = CreateUnoListener(&quot;_SFTEXT_&quot;, cstPrefix &amp; sListener)
+ If iCounterIncrement = 1 Then oView.addTextListener(._TextListener)
+ ElseIf ._TextCounter &lt;= 0 Then
+ If Not IsNull(._TextListener) Then oView.removeTextListener(._TextListener)
+ ._TextCounter = 0 &apos; Prevent negative values
+ End If
+ End Select
+
+ End With
+
+Finally:
+ _SetOnProperty = bSet
+ Exit Function
+Catch:
+ bSet = False
+ GoTo Finally
+End Function &apos; SFDialogs.SF_Dialoglistener._SetOnProperty
+
+REM -----------------------------------------------------------------------------
+Public Sub _TriggerEvent(ByVal EventType, Optional ByRef poEvent As Object)
+&apos;&apos;&apos; Triggered by the EventType event in a dialog or dialog control
+&apos;&apos;&apos; The argument is passed to a user routine stored in the SF_Dialog or SF_DialogControl instance
+&apos;&apos;&apos; as a scripting framework URI
+
+Dim oDialog As Object &apos; The SF_Dialog or SF_DialogControl object having triggered the event
+Dim sScript As String &apos; Script to be invoked
+
+ On Local Error GoTo Catch &apos; Avoid stopping event scripts
+
+Check:
+ If IsNull(poEvent) Or IsMissing(poEvent) Then Exit Sub
+
+Try:
+ Set oDialog = ScriptForge.SF_Services.CreateScriptService(&quot;SFDialogs.DialogEvent&quot;, poEvent)
+ If IsNull(oDialog) Then Exit Sub
+ With oDialog
+ Select Case EventType
+ Case &quot;actionPerformed&quot; : sScript = .OnActionPerformed
+ Case &quot;adjustmentValueChanged&quot; : sScript = .OnAdjustmentValueChanged
+ Case &quot;focusGained&quot; : sScript = .OnFocusGained
+ Case &quot;focusLost&quot; : sScript = .OnFocusLost
+ Case &quot;itemStateChanged&quot; : sScript = .OnItemStateChanged
+ Case &quot;mouseDragged&quot; : sScript = .OnMouseDragged
+ Case &quot;mouseEntered&quot; : sScript = .OnMouseEntered
+ Case &quot;mouseExited&quot; : sScript = .OnMouseExited
+ Case &quot;mouseMoved&quot; : sScript = .OnMouseMoved
+ Case &quot;mousePressed&quot; : sScript = .OnMousePressed
+ Case &quot;mouseReleased&quot; : sScript = .OnMouseReleased
+ Case &quot;textChanged&quot; : sScript = .OnTextChanged
+ Case Else : sScript = &quot;&quot; &apos; Should not happen
+ End Select
+ If Len(sScript) = 0 Then Exit Sub
+ ScriptForge.SF_Session._ExecuteScript(sScript, poEvent)
+ End With
+
+Finally:
+ Exit Sub
+Catch:
+ GoTo Finally
+End Sub &apos; SFDialogs.SF_Dialoglistener._TriggerEvent
+
REM ============================================ END OF SFDIALOGS.SF_DIALOGLISTENER
</script:module> \ No newline at end of file
diff --git a/wizards/source/sfwidgets/SF_Toolbar.xba b/wizards/source/sfwidgets/SF_Toolbar.xba
index d65e7c61db06..c457a62f1cad 100644
--- a/wizards/source/sfwidgets/SF_Toolbar.xba
+++ b/wizards/source/sfwidgets/SF_Toolbar.xba
@@ -154,7 +154,7 @@ End Property &apos; SFWidgets.SF_Toolbar.Name (get)
REM -----------------------------------------------------------------------------
Property Get ResourceURL() As String
-&apos;&apos;&apos; Returns True when the toolbar is available in all documents of the same type
+&apos;&apos;&apos; Returns URL of the toolbar, in the form private:toolbar/xxx
&apos;&apos;&apos; Example:
&apos;&apos;&apos; MsgBox myToolbar.ResourceURL
@@ -538,4 +538,4 @@ Private Function _Repr() As String
End Function &apos; SFWidgets.SF_Toolbar._Repr
REM ============================================ END OF SFWIDGETS.SF_TOOLBAR
-</script:module>
+</script:module> \ No newline at end of file