summaryrefslogtreecommitdiff
path: root/wizards/source/sfdialogs/SF_DialogControl.xba
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2023-04-23 12:57:11 +0200
committerJean-Pierre Ledure <jp@ledure.be>2023-04-23 14:54:49 +0200
commita58017d99c3cea52fe7b37f2379c5306bfa59807 (patch)
tree149b99b2adb1f204e589665a529116becaf8558d /wizards/source/sfdialogs/SF_DialogControl.xba
parentf7307c6366196940dcdbf6d2bfc23b69b18acb85 (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.xba47
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 = &quot;FixedLine&quot;
Private Const CTLFIXEDTEXT = &quot;FixedText&quot;
Private Const CTLFORMATTEDFIELD = &quot;FormattedField&quot;
Private Const CTLGROUPBOX = &quot;GroupBox&quot;
+Private Const CTLHYPERLINK = &quot;Hyperlink&quot;
Private Const CTLIMAGECONTROL = &quot;ImageControl&quot;
Private Const CTLLISTBOX = &quot;ListBox&quot;
Private Const CTLNUMERICFIELD = &quot;NumericField&quot;
@@ -649,6 +650,18 @@ Property Let TripleState(Optional ByVal pvTripleState As Variant)
End Property &apos; SFDialogs.SF_DialogControl.TripleState (let)
REM -----------------------------------------------------------------------------
+Property Get URL() As Variant
+&apos;&apos;&apos; The URL property refers to the URL to open when the control is clicked
+ URL = _PropertyGet(&quot;URL&quot;, &quot;&quot;)
+End Property &apos; SFDialogs.SF_DialogControl.URL (get)
+
+REM -----------------------------------------------------------------------------
+Property Let URL(Optional ByVal pvURL As Variant)
+&apos;&apos;&apos; Set the updatable property URL
+ _PropertySet(&quot;URL&quot;, pvURL)
+End Property &apos; SFDialogs.SF_DialogControl.URL (let)
+
+REM -----------------------------------------------------------------------------
Property Get Value() As Variant
&apos;&apos;&apos; The Value property specifies the data contained in the control
Value = _PropertyGet(&quot;Value&quot;, Empty)
@@ -1132,6 +1145,7 @@ Public Function Properties() As Variant
, &quot;Text&quot; _
, &quot;TipText&quot; _
, &quot;TripleState&quot; _
+ , &quot;URL&quot; _
, &quot;Value&quot; _
, &quot;Visible&quot; _
, &quot;Width&quot; _
@@ -1673,7 +1687,6 @@ Public Sub _Initialize()
Dim vServiceName As Variant &apos; Split service name
Dim sType As String &apos; Last component of service name
-Dim oPosSize As Object &apos; com.sun.star.awt.Rectangle
Try:
_ImplementationName = _ControlModel.getImplementationName()
@@ -1685,6 +1698,8 @@ Try:
Case &quot;UnoControlSpinButtonModel&quot;
_ControlType = &quot;&quot; &apos; Not supported
Case &quot;Edit&quot; : _ControlType = CTLTEXTFIELD
+ Case &quot;UnoControlFixedHyperlinkModel&quot;
+ _ControlType = CTLHYPERLINK
Case &quot;TreeControlModel&quot;
&apos; Initialize the data model
_ControlType = CTLTREECONTROL
@@ -1698,10 +1713,9 @@ Try:
End Select
&apos; 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 = &quot;&quot;
End Select
Case UCase(&quot;Caption&quot;)
Select Case _ControlType
- Case CTLBUTTON, CTLCHECKBOX, CTLFIXEDLINE, CTLFIXEDTEXT, CTLGROUPBOX, CTLRADIOBUTTON
+ Case CTLBUTTON, CTLCHECKBOX, CTLFIXEDLINE, CTLFIXEDTEXT, CTLGROUPBOX, CTLHYPERLINK, CTLRADIOBUTTON
If oSession.HasUNOProperty(_ControlModel, &quot;Label&quot;) Then _PropertyGet = _ControlModel.Label
Case Else : GoTo CatchType
End Select
@@ -1939,6 +1953,12 @@ Const cstSubArgs = &quot;&quot;
If oSession.HasUnoProperty(_ControlModel, &quot;TriState&quot;) Then _PropertyGet = _ControlModel.TriState
Case Else : GoTo CatchType
End Select
+ Case &quot;URL&quot;
+ Select Case _ControlType
+ Case CTLHYPERLINK
+ If oSession.HasUnoProperty(_ControlModel, &quot;URL&quot;) Then _PropertyGet = _ControlModel.URL
+ Case Else : GoTo CatchType
+ End Select
Case UCase(&quot;Value&quot;) &apos; Default values are set here by control type, not in the 2nd argument
vGet = pvDefault
Select Case _ControlType
@@ -2032,7 +2052,7 @@ Const cstSubArgs = &quot;&quot;
If oSession.HasUNOProperty(_ControlModel, &quot;PositionX&quot;) Then _PropertyGet = _ControlModel.PositionX
End If
Case UCase(&quot;Y&quot;)
- If [_parent]._Displayed Then &apos; Convert PosSize view property from piYels to APPFONT units
+ If [_parent]._Displayed Then &apos; Convert PosSize view property from pixels to APPFONT units
_PropertyGet = SF_DialogUtils._ConvertToAppFont(_ControlView, True).Y
Else
If oSession.HasUNOProperty(_ControlModel, &quot;PositionY&quot;) Then _PropertyGet = _ControlModel.PositionY
@@ -2105,7 +2125,7 @@ Const cstSubArgs = &quot;Value&quot;
End Select
Case UCase(&quot;Caption&quot;)
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, &quot;Caption&quot;, V_STRING) Then GoTo Finally
If oSession.HasUNOProperty(_ControlModel, &quot;Label&quot;) Then _ControlModel.Label = pvValue
Case Else : GoTo CatchType
@@ -2204,7 +2224,7 @@ Const cstSubArgs = &quot;Value&quot;
Select Case UCase(psProperty)
Case UCase(&quot;OnActionPerformed&quot;), UCase(&quot;OnItemStateChanged&quot;)
Select Case _ControlType
- Case CTLBUTTON, CTLCHECKBOX, CTLCOMBOBOX, CTLLISTBOX, CTLRADIOBUTTON
+ Case CTLBUTTON, CTLCHECKBOX, CTLCOMBOBOX, CTLHYPERLINK, CTLLISTBOX, CTLRADIOBUTTON
Case Else : GoTo CatchType
End Select
Case UCase(&quot;OnAdjustmentValueChanged&quot;)
@@ -2286,6 +2306,13 @@ Const cstSubArgs = &quot;Value&quot;
If oSession.HasUnoProperty(_ControlModel, &quot;TriState&quot;) Then _ControlModel.TriState = pvValue
Case Else : GoTo CatchType
End Select
+ Case &quot;URL&quot;
+ Select Case _ControlType
+ Case CTLHYPERLINK
+ If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;URL&quot;, V_STRING) Then GoTo Finally
+ If oSession.HasUnoProperty(_ControlModel, &quot;URL&quot;) Then _ControlModel.URL = pvValue
+ Case Else : GoTo CatchType
+ End Select
Case UCase(&quot;Value&quot;)
Select Case _ControlType
Case CTLBUTTON &apos;Boolean, toggle buttons only
@@ -2415,4 +2442,4 @@ Private Function _Repr() As String
End Function &apos; SFDialogs.SF_DialogControl._Repr
REM ============================================ END OF SFDIALOGS.SF_DIALOGCONTROL
-</script:module>
+</script:module> \ No newline at end of file