<The previous article in this series | The table of contents of this series | The next article in this series>
To Know How to Handle (Read or Write) LibreOffice or Apache OpenOffice Writer or Calc Documents via Extensions from Java or Macro Programs
We should understand basic concepts of UNO accurately so that we can make good use of UNO.
Yes. About anything, unless we understand basics accurately, we can't make good use of it.
As a note, sometimes, I can't understand well the usage of terms in the reference documents. For example, does a 'UNO object' mean a class instance or a class? Does a 'UNO component' mean a class, a Jar, or a UNO extension? Does the term, 'service', always represent a same concept in various appearances? . . . What we aim to do is to clarify every concept distinguished from other concepts, and to use every term only in one meaning. Accordingly, our usage of terms is a bit different from the reference documents'. We aren't trying to be different, but it's inescapable to describe things as we can understand them ourselves.
Ah-ha, let's see what we can do.
Let's start with UNO objects. The UNO object is a class instance that performs the UNO protocol. I mean, just a plain Java class instance isn't a UNO object because it doesn't observe the UNO protocol. And note that when we use the term, UNO object, it always means a class instance, not a class.
What do you mean by 'performs the UNO protocol'?
What's important about UNO is that the UNO object can be handled in a predetermined way even from different programming language environments. For that to happen, there must be a protocol that is observed by all the UNO objects. I called the protocol 'the UNO protocol'.
Ah-ha.
About the sample UNO extension we built in the previous article, the object referred by the variable, l_hiUnoExtensions, in the LibreOffice Basic macro is a UNO object.
I see.
And we will call the class from which UNO objects are instantiated a 'UNO component'. So, a UNO component is always a class, not a class instance, not a Jar, not a UNO extension. That way, the distinction between the UNO object and the UNO component will be clear.
Yes, it's clear.
Although the reference documents seem to use the term, component, wantonly, we will use the term, UNO component, in that strict one meaning.
All right.
In the sample UNO extension, HiUnoExtensionsImplementation is a UNO component.
I see.
The UNO interface is an abstract outward manifestation of an aspect of a UNO component. By 'abstract', I mean, not including implementations.
The UNO interface is to the UNO component as the Java interface is to the Java class?
Yes. A UNO component implements UNO interfaces as a Java class implements Java interfaces. In fact, in Java, a UNO component is a Java class that implements UNO interfaces, which are Java interfaces. I used the term, aspect, above, because a UNO component can implement multiple UNO interfaces, and a UNO interface doesn't always represent the whole of the UNO component, but an aspect of the UNO component.
What's important is that any UNO component has to implement at least one UNO interface. Rather, I should say, a Java class becomes a UNO component by implementing a UNO interface.
Is any Java class that implements a UNO interface a UNO component?
Yes, it is. In our terms, 'UNO component' and 'UNO interface implementation' mean the same thing.
I see.
There is a root UNO interface, 'com.sun.star.uno.XInterface', and every other UNO interface is a descendant interface of the root UNO interface. A UNO interface can inherit multiple UNO interfaces, . . . now.
Now?
I mean, in old specifications, it couldn't, and that is a cause of some complications, but we will talk about it later.
OK.
In the sample UNO extension, XHiUnoExtensions is a UNO interface.
I see.
- Apache OpenOffice Wiki. (2014/01/02). Apache OpenOffice Developer's Guide. Retrieved from https://wiki.openoffice.org/wiki/Documentation/DevGuide/OpenOffice.org_Developers_Guide
<The previous article in this series | The table of contents of this series | The next article in this series>