Universal Network Objects (UNO)
OpenOffice.org provides a programming interface in the form of the Universal Network Objects (UNO). This is an object-oriented programming interface which OpenOffice.org sub-divides into various objects which for their part ensure program-controlled access to the Office package.
Since OpenOffice.org Basic is a procedural programming language, several linguistic constructs have had to be added to it which enable the use of UNO.
To use a Universal Network Object in OpenOffice.org Basic, you will need a variable declaration for the associated object. The declaration is made using the Dim instruction (see The Language of OpenOffice.org Basic). The Object type designation should be used to declare an object variable:
Dim Obj As Object
The call declares an object variable named Obj.
The object variable created must then be initialized so that it can be used. This can be done using the createUnoService function:
Obj = createUnoService("com.sun.star.frame.Desktop")
This call assigns to the Obj variable a reference to the newly created object. com.sun.star.frame.Desktop resembles an object type; however in UNO terminology it is called a service rather than a type. In accordance with UNO philosophy, an Obj is described as a reference to an object which supports the com.sun.star.frame.Desktop service. The service term used in OpenOffice.org Basic therefore corresponds to the type and class terms used in other programming languages.
There is, however, one main difference: a Universal Network Object may support several services at the same time. Some UNO services in turn support other services so that, through one object, you are provided with a whole range of services. For example, that the aforementioned object, which is based on the com.sun.star.frame.Desktop service, can also include other services for loading documents and for ending the program.
|Content on this page is licensed under the Public Documentation License (PDL).|