Where can I find the descriptin of LibreOffice API for BASIC

2k views Asked by At

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?

1

There are 1 answers

0
Doug0 On BEST ANSWER

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 variables ThisComponent and, less commonly, StarDesktop. There also is a specialty variant in LO Base, ThisDatabaseDocument. To get the properties and methods of these objects, execute MsgBox 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 Every Object 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 are getByName() and getByIndex(). 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 the Sub, i.e., Sub SubName (oEventObject As Variant)....