For Writer, the macro in this question works -> Macro that launches a Google search of the string selected in LibreOffice with only a change to which browser you are using (browser name in Shell statement near end of Sub).
You can assign the macro to a Context Menu item (Text) or a Toolbar item using Tools->Customize.