[Libreoffice-commits] core.git: wizards/source
Jean-Pierre Ledure (via logerrit)
logerrit at kemper.freedesktop.org
Sun Nov 29 11:05:42 UTC 2020
wizards/source/sfdialogs/SF_DialogControl.xba | 27 ++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
New commits:
commit 0cd33fe7bbe420719cc9c77e4e49deb0743b83ba
Author: Jean-Pierre Ledure <jp at ledure.be>
AuthorDate: Sat Nov 28 17:43:59 2020 +0100
Commit: Jean-Pierre Ledure <jp at ledure.be>
CommitDate: Sun Nov 29 12:05:09 2020 +0100
ScriptForge - (SF_DialogControl) set OnEvent properties
Applied on DialogControl class:
Assign the triggered script as a string to the OnXxx properties
or as a zero-length string to remove any trigger
Check of control type is included
Change-Id: I199fbfb565740f7ca4576c39bebf7dc9e4052289
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106807
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/source/sfdialogs/SF_DialogControl.xba b/wizards/source/sfdialogs/SF_DialogControl.xba
index 2dce649a1db3..7200f1b25876 100644
--- a/wizards/source/sfdialogs/SF_DialogControl.xba
+++ b/wizards/source/sfdialogs/SF_DialogControl.xba
@@ -1098,6 +1098,7 @@ Dim vSelection As Variant ' Alias of Model.SelectedItems
Dim vList As Variant ' Alias of Model.StringItemList
Dim lIndex As Long ' Index in StringItemList
Dim sItem As String ' A single item
+Dim vCtlTypes As Variant ' Array of allowed control types
Dim i As Long
Dim cstThisSub As String
Const cstSubArgs = "Value"
@@ -1185,6 +1186,32 @@ Const cstSubArgs = "Value"
End If
Case Else : GoTo CatchType
End Select
+ Case UCase("OnActionPerformed"), UCase("OnAdjustmentValueChanged"), UCase("OnFocusGained"), UCase("OnFocusLost") _
+ , UCase("OnItemStateChanged"), UCase("OnKeyPressed"), UCase("OnKeyReleased") _
+ , UCase("OnMouseDragged"), UCase("OnMouseEntered"), UCase("OnMouseExited"), UCase("OnMouseMoved") _
+ , UCase("OnMousePressed"), UCase("OnMouseReleased"), UCase("OnTextChanged")
+ If Not ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING) Then GoTo Finally
+ ' Most properties are common to all control types, but there are exceptions
+ Select Case UCase(psProperty)
+ Case UCase("OnActionPerformed"), UCase("OnItemStateChanged")
+ vCtlTypes = Array(CTLBUTTON, CTLCHECKBOX, CTLCOMBOBOX, CTLLISTBOX, CTLRADIOBUTTON)
+ Case UCase("OnAdjustmentValueChanged")
+ vCtlTypes = Array(CTLSCROLLBAR)
+ Case UCase("OnTextChanged")
+ vCtlTypes = Array(CTLCOMBOBOX, CTLCURRENCYFIELD, CTLDATEFIELD, CTLFILECONTROL, CTLFORMATTEDFIELD _
+ , CTLNUMERICFIELD, CTLPATTERNFIELD, CTLTEXTFIELD, CTLTIMEFIELD)
+ Case Else
+ vCtlTypes = Array()
+ End Select
+ If UBound(vCtlTypes) >= 0 Then
+ If Not ScriptForge.SF_Array.Contains(vCtlTypes, _ControlType) Then GoTo CatchType
+ End If
+ SFDialogs.SF_Register._SetEventScript( _
+ _ControlModel _
+ , _GetEventName(psProperty) _
+ , _GetListener(psProperty) _
+ , pvValue _
+ )
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)
More information about the Libreoffice-commits
mailing list