Tools for Working With UNO

From Apache OpenOffice Wiki
< Documentation‎ | BASIC Guide
Revision as of 08:59, 13 September 2009 by BMarcelly (Talk | contribs)

Jump to: navigation, search

The question remains as to which objects — or services if we are going to remain with UNO terminology — support which properties, methods and interfaces and how these can be determined. In addition to this guide, you can get more information about objects from the following sources: the supportsService method, the debug methods as well as the Developer's Guide, and the API reference.

The supportsService Method

A number of UNO objects support the supportsService method, with which you can establish whether an object supports a particular service. The following call, for example, determines whether the TextElement object supports the service.

Ok = TextElement.supportsService("")

Debug Properties

Every UNO object in Apache OpenOffice Basic knows what properties, methods and interfaces it already contains. It provides properties that return these in the form of a list. The corresponding properties are:

returns a string containing all properties of an object
returns a string containing all methods of an object
returns a string containing all interfaces which support an object.

The following program code shows how DBG_properties and DBG_methods can be used in real-life applications. It first creates the service and then displays the supported properties and methods in message boxes.

Dim Obj As Object
Obj = createUnoService("")
MsgBox Obj.DBG_Properties
MsgBox Obj.DBG_methods

When using DBG_properties, note that the function returns all properties that one particular service can theoretically support. No assurances are, however, provided for whether these can also be used by the object in question. Before calling up properties, you must therefore use the IsEmpty function to check whether this is actually available.

Debugging tools

Using these DBG properties is a very crude method to discover the contents of an API objects. Use instead Xray tool or MRI tool.

API Reference

More information about the available services, and their interfaces, methods and properties can be found in the reference for the Apache OpenOffice API.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools