[feature-request] Highlight a phrase and with keycombo put brackets on both sides

As the headline says.
When you highlight a phrase you can make it bold, italic etc. It would be awesome if you could also decide to get quotationmarks or brackets at both ends with a single click or keycombo.

Hello,

As stated in How to use Ask site, "Feature requests should go directly to Bugzilla as Enhancements

Hello @AndersFrispel,

Pending the enhancement request, you could assign your own Keyboard Shortcut to a macro such as the following:

Sub Writer_Parenthesize( Optional iType )
REM Encloses the current Writer selection within a bracket pair of the specified Type.
	Dim oDocument As Object : oDocument = ThisComponent
	If oDocument.supportsService( "com.sun.star.text.TextDocument" ) Then
		
		Dim aPOpen()  : aPOpen  = Array( "(", "[", "{", "<", """", "'", "`", "|" )	REM Add at will..
		Dim aPClose() : aPClose = Array( ")", "]", "}", ">", """", "'", "`", "|" )
		
		If IsMissing( iType ) Then iType = 0
		If iType < 0 Or iType > uBound( aPOpen ) Then iType = 0
		
		Dim oSelections As Object : oSelections = oDocument.CurrentController.Selection
		If Not oSelections.supportsService( "com.sun.star.text.TextRanges" ) Then Stop
		If oSelections.getCount() = 0 Then Stop
		
		Dim oSelection As Object  : oSelection  = oSelections.getByIndex( 0 )
		oSelection.Start.setString( aPOpen( iType ) )
		oSelection.End.setString(  aPClose( iType ) )
		oDocument.CurrentController.select( oSelection )
	End If
End Sub

Just copy-paste the macro into your Standard Basic Library, and use the menu “Tools : Customize… : Keyboard” to assign your preferred Shortcut to it.
( used in this way by default, it will enclose the current selection in “(” and “)” type parentheses ).

I’ll see if i can make a ContextMenu for use with a Toolbar button, so that the user can select one from the available bracket types.

With Regards, lib