diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2023-04-23 12:57:11 +0200 |
---|---|---|
committer | Jean-Pierre Ledure <jp@ledure.be> | 2023-04-23 14:54:49 +0200 |
commit | a58017d99c3cea52fe7b37f2379c5306bfa59807 (patch) | |
tree | 149b99b2adb1f204e589665a529116becaf8558d /wizards/source/sfdialogs/SF_DialogControl.xba | |
parent | f7307c6366196940dcdbf6d2bfc23b69b18acb85 (diff) |
ScriptForge (SFDialogs) support hyperlink control types
Controls designated in english as "Hyperlink controls"
in the Basic IDE are from now on accepted as instances
of the SF_DialogControl service.
All generic properties are accepted.
The supported specific properties are:
- Caption (the text that appears in the dialog box)
- URL (the URL to activate when clicked)
The new control type is supported in Basic and Python
user scripts.
The SFDialogs.DialogControl help page needs to be updated.
Change-Id: I4827834ad8ef336c084ee51b5285b85745ceb1b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150824
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Diffstat (limited to 'wizards/source/sfdialogs/SF_DialogControl.xba')
-rw-r--r-- | wizards/source/sfdialogs/SF_DialogControl.xba | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/wizards/source/sfdialogs/SF_DialogControl.xba b/wizards/source/sfdialogs/SF_DialogControl.xba index e7c415f0ba52..ddcd7f4aab99 100644 --- a/wizards/source/sfdialogs/SF_DialogControl.xba +++ b/wizards/source/sfdialogs/SF_DialogControl.xba @@ -142,6 +142,7 @@ Private Const CTLFIXEDLINE = "FixedLine" Private Const CTLFIXEDTEXT = "FixedText" Private Const CTLFORMATTEDFIELD = "FormattedField" Private Const CTLGROUPBOX = "GroupBox" +Private Const CTLHYPERLINK = "Hyperlink" Private Const CTLIMAGECONTROL = "ImageControl" Private Const CTLLISTBOX = "ListBox" Private Const CTLNUMERICFIELD = "NumericField" @@ -649,6 +650,18 @@ Property Let TripleState(Optional ByVal pvTripleState As Variant) End Property ' SFDialogs.SF_DialogControl.TripleState (let) REM ----------------------------------------------------------------------------- +Property Get URL() As Variant +''' The URL property refers to the URL to open when the control is clicked + URL = _PropertyGet("URL", "") +End Property ' SFDialogs.SF_DialogControl.URL (get) + +REM ----------------------------------------------------------------------------- +Property Let URL(Optional ByVal pvURL As Variant) +''' Set the updatable property URL + _PropertySet("URL", pvURL) +End Property ' SFDialogs.SF_DialogControl.URL (let) + +REM ----------------------------------------------------------------------------- Property Get Value() As Variant ''' The Value property specifies the data contained in the control Value = _PropertyGet("Value", Empty) @@ -1132,6 +1145,7 @@ Public Function Properties() As Variant , "Text" _ , "TipText" _ , "TripleState" _ + , "URL" _ , "Value" _ , "Visible" _ , "Width" _ @@ -1673,7 +1687,6 @@ Public Sub _Initialize() Dim vServiceName As Variant ' Split service name Dim sType As String ' Last component of service name -Dim oPosSize As Object ' com.sun.star.awt.Rectangle Try: _ImplementationName = _ControlModel.getImplementationName() @@ -1685,6 +1698,8 @@ Try: Case "UnoControlSpinButtonModel" _ControlType = "" ' Not supported Case "Edit" : _ControlType = CTLTEXTFIELD + Case "UnoControlFixedHyperlinkModel" + _ControlType = CTLHYPERLINK Case "TreeControlModel" ' Initialize the data model _ControlType = CTLTREECONTROL @@ -1698,10 +1713,9 @@ Try: End Select ' Store initial position and dimensions - Set oPosSize = _ControlView.getPosSize() - With oPosSize - _Left = .X - _Top = .Y + With _ControlModel + _Left = .PositionX + _Top = .PositionY _Width = .Width _Height = .Height End With @@ -1758,7 +1772,7 @@ Const cstSubArgs = "" End Select Case UCase("Caption") Select Case _ControlType - Case CTLBUTTON, CTLCHECKBOX, CTLFIXEDLINE, CTLFIXEDTEXT, CTLGROUPBOX, CTLRADIOBUTTON + Case CTLBUTTON, CTLCHECKBOX, CTLFIXEDLINE, CTLFIXEDTEXT, CTLGROUPBOX, CTLHYPERLINK, CTLRADIOBUTTON If oSession.HasUNOProperty(_ControlModel, "Label") Then _PropertyGet = _ControlModel.Label Case Else : GoTo CatchType End Select @@ -1939,6 +1953,12 @@ Const cstSubArgs = "" If oSession.HasUnoProperty(_ControlModel, "TriState") Then _PropertyGet = _ControlModel.TriState Case Else : GoTo CatchType End Select + Case "URL" + Select Case _ControlType + Case CTLHYPERLINK + If oSession.HasUnoProperty(_ControlModel, "URL") Then _PropertyGet = _ControlModel.URL + Case Else : GoTo CatchType + End Select Case UCase("Value") ' Default values are set here by control type, not in the 2nd argument vGet = pvDefault Select Case _ControlType @@ -2032,7 +2052,7 @@ Const cstSubArgs = "" If oSession.HasUNOProperty(_ControlModel, "PositionX") Then _PropertyGet = _ControlModel.PositionX End If Case UCase("Y") - If [_parent]._Displayed Then ' Convert PosSize view property from piYels to APPFONT units + If [_parent]._Displayed Then ' Convert PosSize view property from pixels to APPFONT units _PropertyGet = SF_DialogUtils._ConvertToAppFont(_ControlView, True).Y Else If oSession.HasUNOProperty(_ControlModel, "PositionY") Then _PropertyGet = _ControlModel.PositionY @@ -2105,7 +2125,7 @@ Const cstSubArgs = "Value" End Select Case UCase("Caption") Select Case _ControlType - Case CTLBUTTON, CTLCHECKBOX, CTLFIXEDLINE, CTLFIXEDTEXT, CTLGROUPBOX, CTLRADIOBUTTON + Case CTLBUTTON, CTLCHECKBOX, CTLFIXEDLINE, CTLFIXEDTEXT, CTLGROUPBOX, CTLHYPERLINK, CTLRADIOBUTTON If Not ScriptForge.SF_Utils._Validate(pvValue, "Caption", V_STRING) Then GoTo Finally If oSession.HasUNOProperty(_ControlModel, "Label") Then _ControlModel.Label = pvValue Case Else : GoTo CatchType @@ -2204,7 +2224,7 @@ Const cstSubArgs = "Value" Select Case UCase(psProperty) Case UCase("OnActionPerformed"), UCase("OnItemStateChanged") Select Case _ControlType - Case CTLBUTTON, CTLCHECKBOX, CTLCOMBOBOX, CTLLISTBOX, CTLRADIOBUTTON + Case CTLBUTTON, CTLCHECKBOX, CTLCOMBOBOX, CTLHYPERLINK, CTLLISTBOX, CTLRADIOBUTTON Case Else : GoTo CatchType End Select Case UCase("OnAdjustmentValueChanged") @@ -2286,6 +2306,13 @@ Const cstSubArgs = "Value" If oSession.HasUnoProperty(_ControlModel, "TriState") Then _ControlModel.TriState = pvValue Case Else : GoTo CatchType End Select + Case "URL" + Select Case _ControlType + Case CTLHYPERLINK + If Not ScriptForge.SF_Utils._Validate(pvValue, "URL", V_STRING) Then GoTo Finally + If oSession.HasUnoProperty(_ControlModel, "URL") Then _ControlModel.URL = pvValue + Case Else : GoTo CatchType + End Select Case UCase("Value") Select Case _ControlType Case CTLBUTTON 'Boolean, toggle buttons only @@ -2415,4 +2442,4 @@ Private Function _Repr() As String End Function ' SFDialogs.SF_DialogControl._Repr REM ============================================ END OF SFDIALOGS.SF_DIALOGCONTROL -</script:module> +</script:module>
\ No newline at end of file |