If location="document" Then
sp = ThisComponent.getScriptProvider()
Else
mspf = CreateUNOService("com.sun.star.script.provider.MasterScriptProviderFactory")
sp = mspf.createScriptProvider("")
End If
That's a fairly standard example from the documentation: there is an example here: https://help.libreoffice.org/7.1/en-US/text/sbasic/guide/basic_2_python.html, and it's been around for a while: there is a /6.4/ example at the same place.
Any idea why it written like that, with getScriptProvider and createScriptProvider? The construct suggest that in some circumstances you have to Create a script provider, because you can't Get an existing one. But in my checks, getScriptProvider also works for 'user' and 'share' (which are just different locations for finding scripts).
It's not important to me, since I am only using location="document", but has anyone ever documented a situation where getScriptProvider fails?