When you program a script within LibreOffice, accessing the XSCRIPTCONTEXT object is the starting point for controlling LibreOffice documents.
SCRIPTCONTEXT is an object of class ‘pythonscript.ScriptContext’.
This object provides connections with running instances of LibreOffice and has four useful methods:
Here pythonscript is the python program that defines the context for Python scripts in . You can find pythonscript.py in /lib/libreoffice/program on Linux, probably in a similar path on MacOs and in C:\Program Files\LibreOffice\program on Windows (standard install).
ScriptContext is a Class inherited from unohelper.base and defined in pythonscript.py.
On linux Mint, unohelper.py is in /lib/python3/dist-packages and MacOS (most likely), and in C:\Program Files\LibreOffice\program on Windows (standard install).
The unohelper.Base itself is a class inherited from XTypeProvider, the latest being imported from com.sun.star.lang and being inherited from XInterface.
If you like this tutorial you could buy me a coffee to help me continue writing add-free tutorials.