[Libreoffice-commits] core.git: wizards/source

Jean-Pierre Ledure (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 8 17:32:14 UTC 2020


 wizards/source/sfdialogs/SF_Dialog.xba        |   70 ----------------
 wizards/source/sfdialogs/SF_DialogControl.xba |  110 --------------------------
 wizards/source/sfdialogs/SF_Register.xba      |   41 ---------
 3 files changed, 221 deletions(-)

New commits:
commit 7ab550746e231537ab7dfe3f28a1be44bfa4a157
Author:     Jean-Pierre Ledure <jp at ledure.be>
AuthorDate: Tue Dec 8 16:40:09 2020 +0100
Commit:     Jean-Pierre Ledure <jp at ledure.be>
CommitDate: Tue Dec 8 18:31:28 2020 +0100

    ScriptForge: (SFDialogs) OnEvent properties are not editable
    
    The editable character of OnEvent properties is removed
    Structures in memory were updated correctly but without
    effect on behaviour of the dialog
    
    Feature is not essential
    
    NB OnNodeExpanded and OnNodeSelected remain editable: the
    mechanism is not via the Basic IDE and the functionality
    is correct
    
    Change-Id: If697120850efcc21ecf1f9004e2b64a5a69bf346
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107426
    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_Dialog.xba b/wizards/source/sfdialogs/SF_Dialog.xba
index 88869534a581..8bb5147e6384 100644
--- a/wizards/source/sfdialogs/SF_Dialog.xba
+++ b/wizards/source/sfdialogs/SF_Dialog.xba
@@ -154,120 +154,60 @@ Property Get OnFocusGained() As Variant
 	OnFocusGained = _PropertyGet("OnFocusGained")
 End Property	'	SFDialogs.SF_Dialog.OnFocusGained (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnFocusGained(Optional ByVal pvOnFocusGained As Variant)
-'''	Set the updatable property OnFocusGained
-	_PropertySet("OnFocusGained", pvOnFocusGained)
-End Property	'	SFDialogs.SF_Dialog.OnFocusGained (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnFocusLost() As Variant
 '''	Get the script associated with the OnFocusLost event
 	OnFocusLost = _PropertyGet("OnFocusLost")
 End Property	'	SFDialogs.SF_Dialog.OnFocusLost (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnFocusLost(Optional ByVal pvOnFocusLost As Variant)
-'''	Set the updatable property OnFocusLost
-	_PropertySet("OnFocusLost", pvOnFocusLost)
-End Property	'	SFDialogs.SF_Dialog.OnFocusLost (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnKeyPressed() As Variant
 '''	Get the script associated with the OnKeyPressed event
 	OnKeyPressed = _PropertyGet("OnKeyPressed")
 End Property	'	SFDialogs.SF_Dialog.OnKeyPressed (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnKeyPressed(Optional ByVal pvOnKeyPressed As Variant)
-'''	Set the updatable property OnKeyPressed
-	_PropertySet("OnKeyPressed", pvOnKeyPressed)
-End Property	'	SFDialogs.SF_Dialog.OnKeyPressed (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnKeyReleased() As Variant
 '''	Get the script associated with the OnKeyReleased event
 	OnKeyReleased = _PropertyGet("OnKeyReleased")
 End Property	'	SFDialogs.SF_Dialog.OnKeyReleased (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnKeyReleased(Optional ByVal pvOnKeyReleased As Variant)
-'''	Set the updatable property OnKeyReleased
-	_PropertySet("OnKeyReleased", pvOnKeyReleased)
-End Property	'	SFDialogs.SF_Dialog.OnKeyReleased (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnMouseDragged() As Variant
 '''	Get the script associated with the OnMouseDragged event
 	OnMouseDragged = _PropertyGet("OnMouseDragged")
 End Property	'	SFDialogs.SF_Dialog.OnMouseDragged (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnMouseDragged(Optional ByVal pvOnMouseDragged As Variant)
-'''	Set the updatable property OnMouseDragged
-	_PropertySet("OnMouseDragged", pvOnMouseDragged)
-End Property	'	SFDialogs.SF_Dialog.OnMouseDragged (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnMouseEntered() As Variant
 '''	Get the script associated with the OnMouseEntered event
 	OnMouseEntered = _PropertyGet("OnMouseEntered")
 End Property	'	SFDialogs.SF_Dialog.OnMouseEntered (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnMouseEntered(Optional ByVal pvOnMouseEntered As Variant)
-'''	Set the updatable property OnMouseEntered
-	_PropertySet("OnMouseEntered", pvOnMouseEntered)
-End Property	'	SFDialogs.SF_Dialog.OnMouseEntered (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnMouseExited() As Variant
 '''	Get the script associated with the OnMouseExited event
 	OnMouseExited = _PropertyGet("OnMouseExited")
 End Property	'	SFDialogs.SF_Dialog.OnMouseExited (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnMouseExited(Optional ByVal pvOnMouseExited As Variant)
-'''	Set the updatable property OnMouseExited
-	_PropertySet("OnMouseExited", pvOnMouseExited)
-End Property	'	SFDialogs.SF_Dialog.OnMouseExited (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnMouseMoved() As Variant
 '''	Get the script associated with the OnMouseMoved event
 	OnMouseMoved = _PropertyGet("OnMouseMoved")
 End Property	'	SFDialogs.SF_Dialog.OnMouseMoved (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnMouseMoved(Optional ByVal pvOnMouseMoved As Variant)
-'''	Set the updatable property OnMouseMoved
-	_PropertySet("OnMouseMoved", pvOnMouseMoved)
-End Property	'	SFDialogs.SF_Dialog.OnMouseMoved (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnMousePressed() As Variant
 '''	Get the script associated with the OnMousePressed event
 	OnMousePressed = _PropertyGet("OnMousePressed")
 End Property	'	SFDialogs.SF_Dialog.OnMousePressed (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnMousePressed(Optional ByVal pvOnMousePressed As Variant)
-'''	Set the updatable property OnMousePressed
-	_PropertySet("OnMousePressed", pvOnMousePressed)
-End Property	'	SFDialogs.SF_Dialog.OnMousePressed (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnMouseReleased() As Variant
 '''	Get the script associated with the OnMouseReleased event
 	OnMouseReleased = _PropertyGet("OnMouseReleased")
 End Property	'	SFDialogs.SF_Dialog.OnMouseReleased (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnMouseReleased(Optional ByVal pvOnMouseReleased As Variant)
-'''	Set the updatable property OnMouseReleased
-	_PropertySet("OnMouseReleased", pvOnMouseReleased)
-End Property	'	SFDialogs.SF_Dialog.OnMouseReleased (let)
-
 REM -----------------------------------------------------------------------------
 Property Get Page() As Variant
 '''	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.
@@ -854,16 +794,6 @@ Const cstSubArgs = "Value"
 		Case UCase("Height")
 			If Not ScriptForge.SF_Utils._Validate(pvValue, "Height", ScriptForge.V_NUMERIC) Then GoTo Finally
 			If oSession.HasUNOProperty(_DialogModel, "Height") Then _DialogModel.Height = pvValue
-		Case UCase("OnFocusGained"), UCase("OnFocusLost"), UCase("OnKeyPressed"), UCase("OnKeyReleased") _
-				, UCase("OnMouseDragged"), UCase("OnMouseEntered"), UCase("OnMouseExited"), UCase("OnMouseMoved") _
-				, UCase("OnMousePressed"), UCase("OnMouseReleased")
-			If Not ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING) Then GoTo Finally
-			SFDialogs.SF_Register._SetEventScript( _
-						_DialogModel _
-						, _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(_DialogModel, "Step") Then _DialogModel.Step = CLng(pvValue)
diff --git a/wizards/source/sfdialogs/SF_DialogControl.xba b/wizards/source/sfdialogs/SF_DialogControl.xba
index f635043ac8b1..a2dce45e585b 100644
--- a/wizards/source/sfdialogs/SF_DialogControl.xba
+++ b/wizards/source/sfdialogs/SF_DialogControl.xba
@@ -267,156 +267,78 @@ Property Get OnActionPerformed() As Variant
 	OnActionPerformed = _PropertyGet("OnActionPerformed")
 End Property	'	SFDialogs.SF_DialogControl.OnActionPerformed (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnActionPerformed(Optional ByVal pvOnActionPerformed As Variant)
-'''	Set the updatable property OnActionPerformed
-	_PropertySet("OnActionPerformed", pvOnActionPerformed)
-End Property	'	SFDialogs.SF_DialogControl.OnActionPerformed (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnAdjustmentValueChanged() As Variant
 '''	Get the script associated with the OnAdjustmentValueChanged event
 	OnAdjustmentValueChanged = _PropertyGet("OnAdjustmentValueChanged")
 End Property	'	SFDialogs.SF_DialogControl.OnAdjustmentValueChanged (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnAdjustmentValueChanged(Optional ByVal pvOnAdjustmentValueChanged As Variant)
-'''	Set the updatable property OnAdjustmentValueChanged
-	_PropertySet("OnAdjustmentValueChanged", pvOnAdjustmentValueChanged)
-End Property	'	SFDialogs.SF_DialogControl.OnAdjustmentValueChanged (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnFocusGained() As Variant
 '''	Get the script associated with the OnFocusGained event
 	OnFocusGained = _PropertyGet("OnFocusGained")
 End Property	'	SFDialogs.SF_DialogControl.OnFocusGained (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnFocusGained(Optional ByVal pvOnFocusGained As Variant)
-'''	Set the updatable property OnFocusGained
-	_PropertySet("OnFocusGained", pvOnFocusGained)
-End Property	'	SFDialogs.SF_DialogControl.OnFocusGained (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnFocusLost() As Variant
 '''	Get the script associated with the OnFocusLost event
 	OnFocusLost = _PropertyGet("OnFocusLost")
 End Property	'	SFDialogs.SF_DialogControl.OnFocusLost (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnFocusLost(Optional ByVal pvOnFocusLost As Variant)
-'''	Set the updatable property OnFocusLost
-	_PropertySet("OnFocusLost", pvOnFocusLost)
-End Property	'	SFDialogs.SF_DialogControl.OnFocusLost (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnItemStateChanged() As Variant
 '''	Get the script associated with the OnItemStateChanged event
 	OnItemStateChanged = _PropertyGet("OnItemStateChanged")
 End Property	'	SFDialogs.SF_DialogControl.OnItemStateChanged (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnItemStateChanged(Optional ByVal pvOnItemStateChanged As Variant)
-'''	Set the updatable property OnItemStateChanged
-	_PropertySet("OnItemStateChanged", pvOnItemStateChanged)
-End Property	'	SFDialogs.SF_DialogControl.OnItemStateChanged (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnKeyPressed() As Variant
 '''	Get the script associated with the OnKeyPressed event
 	OnKeyPressed = _PropertyGet("OnKeyPressed")
 End Property	'	SFDialogs.SF_DialogControl.OnKeyPressed (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnKeyPressed(Optional ByVal pvOnKeyPressed As Variant)
-'''	Set the updatable property OnKeyPressed
-	_PropertySet("OnKeyPressed", pvOnKeyPressed)
-End Property	'	SFDialogs.SF_DialogControl.OnKeyPressed (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnKeyReleased() As Variant
 '''	Get the script associated with the OnKeyReleased event
 	OnKeyReleased = _PropertyGet("OnKeyReleased")
 End Property	'	SFDialogs.SF_DialogControl.OnKeyReleased (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnKeyReleased(Optional ByVal pvOnKeyReleased As Variant)
-'''	Set the updatable property OnKeyReleased
-	_PropertySet("OnKeyReleased", pvOnKeyReleased)
-End Property	'	SFDialogs.SF_DialogControl.OnKeyReleased (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnMouseDragged() As Variant
 '''	Get the script associated with the OnMouseDragged event
 	OnMouseDragged = _PropertyGet("OnMouseDragged")
 End Property	'	SFDialogs.SF_DialogControl.OnMouseDragged (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnMouseDragged(Optional ByVal pvOnMouseDragged As Variant)
-'''	Set the updatable property OnMouseDragged
-	_PropertySet("OnMouseDragged", pvOnMouseDragged)
-End Property	'	SFDialogs.SF_DialogControl.OnMouseDragged (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnMouseEntered() As Variant
 '''	Get the script associated with the OnMouseEntered event
 	OnMouseEntered = _PropertyGet("OnMouseEntered")
 End Property	'	SFDialogs.SF_DialogControl.OnMouseEntered (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnMouseEntered(Optional ByVal pvOnMouseEntered As Variant)
-'''	Set the updatable property OnMouseEntered
-	_PropertySet("OnMouseEntered", pvOnMouseEntered)
-End Property	'	SFDialogs.SF_DialogControl.OnMouseEntered (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnMouseExited() As Variant
 '''	Get the script associated with the OnMouseExited event
 	OnMouseExited = _PropertyGet("OnMouseExited")
 End Property	'	SFDialogs.SF_DialogControl.OnMouseExited (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnMouseExited(Optional ByVal pvOnMouseExited As Variant)
-'''	Set the updatable property OnMouseExited
-	_PropertySet("OnMouseExited", pvOnMouseExited)
-End Property	'	SFDialogs.SF_DialogControl.OnMouseExited (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnMouseMoved() As Variant
 '''	Get the script associated with the OnMouseMoved event
 	OnMouseMoved = _PropertyGet("OnMouseMoved")
 End Property	'	SFDialogs.SF_DialogControl.OnMouseMoved (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnMouseMoved(Optional ByVal pvOnMouseMoved As Variant)
-'''	Set the updatable property OnMouseMoved
-	_PropertySet("OnMouseMoved", pvOnMouseMoved)
-End Property	'	SFDialogs.SF_DialogControl.OnMouseMoved (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnMousePressed() As Variant
 '''	Get the script associated with the OnMousePressed event
 	OnMousePressed = _PropertyGet("OnMousePressed")
 End Property	'	SFDialogs.SF_DialogControl.OnMousePressed (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnMousePressed(Optional ByVal pvOnMousePressed As Variant)
-'''	Set the updatable property OnMousePressed
-	_PropertySet("OnMousePressed", pvOnMousePressed)
-End Property	'	SFDialogs.SF_DialogControl.OnMousePressed (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnMouseReleased() As Variant
 '''	Get the script associated with the OnMouseReleased event
 	OnMouseReleased = _PropertyGet("OnMouseReleased")
 End Property	'	SFDialogs.SF_DialogControl.OnMouseReleased (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnMouseReleased(Optional ByVal pvOnMouseReleased As Variant)
-'''	Set the updatable property OnMouseReleased
-	_PropertySet("OnMouseReleased", pvOnMouseReleased)
-End Property	'	SFDialogs.SF_DialogControl.OnMouseReleased (let)
-
 REM -----------------------------------------------------------------------------
 Property Get OnNodeExpanded() As Variant
 '''	Get the script associated with the OnNodeExpanded event
@@ -447,12 +369,6 @@ Property Get OnTextChanged() As Variant
 	OnTextChanged = _PropertyGet("OnTextChanged")
 End Property	'	SFDialogs.SF_DialogControl.OnTextChanged (get)
 
-REM -----------------------------------------------------------------------------
-Property Let OnTextChanged(Optional ByVal pvOnTextChanged As Variant)
-'''	Set the updatable property OnTextChanged
-	_PropertySet("OnTextChanged", pvOnTextChanged)
-End Property	'	SFDialogs.SF_DialogControl.OnTextChanged (let)
-
 REM -----------------------------------------------------------------------------
 Property Get Page() As Variant
 '''	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.
@@ -1660,32 +1576,6 @@ 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("OnNodeExpanded")
 			Select Case _ControlType
 				Case CTLTREECONTROL
diff --git a/wizards/source/sfdialogs/SF_Register.xba b/wizards/source/sfdialogs/SF_Register.xba
index ac19bdebff34..e8348d7e53ec 100644
--- a/wizards/source/sfdialogs/SF_Register.xba
+++ b/wizards/source/sfdialogs/SF_Register.xba
@@ -328,46 +328,5 @@ CatchNotFound:
 	GoTo Finally
 End Function	'	SFDialogs.SF_Register._NewDialog
 
-REM -----------------------------------------------------------------------------
-Public Sub _SetEventScript(poObject As Object _
-							, ByVal psEvent As String _
-							, ByVal psListener As String _
-							, ByVal psScriptCode As String _
-							)
-'''	Set/replace a script event in a Dialog or DialogControl model
-'''	Args:
-'''		poObject: the Dialog or DialogControl model
-'''		psEvent: the name of the event which triggers the script
-'''		psListener: getting/Setting macros triggered by events requires a Listener-EventName pair
-'''		psScriptCode: the script to associate with the event as a string
-'''			If = "", then the event is completely removed
-
-Dim oEvents As Object			'	The set of events of the model
-Dim sEventName As String		'	The full name of the event
-Dim oEvent As Object			'	com.sun.star.script.ScriptEventDescriptor
-
-Check:
-	If Not SF_Session.HasUnoMethod(poObject, "getEvents") Then GoTo Finally
-
-Try:
-	'	Remove existing event, if any, then store the new script code if <> ""
-	Set oEvents = poObject.getEvents()
-	sEventName = "com.sun.star.awt." & psListener & "::" & psEvent
-	If oEvents.hasByName(sEventName) Then oEvents.removeByName(sEventName)
-	If Len(psScriptCode) > 0 Then
-		Set oEvent = CreateUnoStruct("com.sun.star.script.ScriptEventDescriptor")
-		With oEvent
-			.ListenerType = psListener
-			.EventMethod = psEvent
-			.ScriptType = "Script"			'	Better than "Basic"
-			.ScriptCode = psScriptCode
-		End With
-		oEvents.insertByName(sEventName, oEvent)
-	End If
-
-Finally:
-	Exit Sub
-End Sub			'	SFDialogs.SF_Register._SetEventScript
-
 REM ============================================== END OF SFDIALOGS.SF_REGISTER
 </script:module>
\ No newline at end of file


More information about the Libreoffice-commits mailing list