Karolus suggested trying the MRI extension.
One way to invoke MRI in Basic is like this:
Sub PushButton(oEvent As Object)
	Globalscope.BasicLibraries.LoadLibrary("MRILib")
	mri(oEvent)
   ...
End Sub
Now LO has these old versions available.  But I suggest you try this newer version which I got to work with LO 5.2.3.3.  Presently there is a problem installing it, which has been reported, but here’s how to get around that until it’s fixed:
After you download MRI-1.3.3.oxt, make a copy of it called MRI-1.3.3_no_help.oxt.  (Tip: don’t use spaces in your filename as it won’t like it later.)   Then open MRI-1.3.3_no_help.oxt with your archive manager (file-roller in Linux Debian) and
- delete the /help subdirectory and
- edit /META-INF/manifest.xml with a text editor and delete the line for help, save, and update the archive,
and then install MRI using LO | Tools | Extension Manager | Add | Select MRI-1.3.3_no_help.oxt | Scroll down and Accept the license.
(Bug: Without removing and unhooking /help it hangs on install, but if installed a 2nd time it works.)
For temporary help:  get help here.