I wanted to create a few macros for LibreOffice using BASIC. However I cannot find the API description. It is absent in help as well as in interet. When I try to google it I get masses of examples in C++, Java, Python, but not a single www with BASIC.
For example where from can I get the hierarchy of objects and their methods?
LibreOffice Basic uses essentially the same API as PyUNO and Java. That is, they all use the UNO API. To get started, the OpenOffice development guide helpfully describes the two main ways to step into the object hierarchy, the
Global
variablesThisComponent
and, less commonly,StarDesktop
. There also is a specialty variant in LO Base,ThisDatabaseDocument
. To get the properties and methods of these objects, executeMsgBox oObject.DBG_properties
or.DBG_methods
. It often is easier to copy the longer lists that are returned by this method into a text editor for searching. You will find that all, or nearly all, of the methods and properties you reveal will be described in the LibreOffice UNO IDL API. The documentation for the API is not that descriptive, but you will be able to fill in some essential details using that resource EveryObject
has properties that can be reviewed by.DBG_properties
.The key properties for navigating the object hierarchy are
.Parent
,.Model
,.CurrentController
and occasionally.Source
. The key methods aregetByName()
andgetByIndex()
. It also is helpful that events which trigger macros typically return an event object whose source or parent is the object that initiated the macro, for example, a command button. This object can be accessed by referring to it along with theSub
, i.e.,Sub SubName (oEventObject As Variant)
....