2017-03-12

12: Let's Learn Basic Concepts of UNO, Part Three

<The previous article in this series | The table of contents of this series | The next article in this series>

Main body START

To Know How to Handle (Read or Write) LibreOffice or Apache OpenOffice Writer or Calc Documents via Extensions from Java or Macro Programs

There Are Things Called UNO Old-Style Services, but . . .

-Hypothesizer

Because of historical complications, in the reference documents, the usage of the term, UNO service, is twisted . . .

-Rebutter

That isn't good. Twists of usage of terms will most likely lead to twists of understandings.

-Hypothesizer

Yes. Our intention is to remove twists of usage of terms from our explanations.

Well, there are things called 'UNO old-style services', but they aren't UNO services as we discussed in the previous article.

-Rebutter

Then, what are they?

-Hypothesizer

The 'UNO old-style service' is a thing that, I think, should be called an 'interfaces-and-properties container' that can contain multiple interfaces and properties.

-Rebutter

Hmm.

-Hypothesizer

As the UNO interface couldn't inherit multiple UNO interfaces in old UNO specification, the 'UNO old-style service' was used to realize inheritance of multiple UNO interfaces.

-Rebutter

Why is it given a term as 'service'?

-Hypothesizer

In a typical use case of 'UNO old-style service', a UNO component directly implements the 'UNO old-style service' and is registered as a UNO service with the name of the 'UNO old-style service' used as the service name. So, the 'UNO old-style service' and the UNO service were equated.

-Rebutter

Hmm, even if the 'UNO old-style service' is used in order to register the UNO service, the 'UNO old-style service' as something that is implemented by the UNO component isn't the UNO service, but a kind of interface. . . . And that's just a typical case, isn't it?

-Hypothesizer

Yes. In another case, the 'UNO old-style service' is used in the middle of the inheritances-implementations hierarchy of the UNO component to gather together multiple UNO interfaces. Calling that 'UNO old-style service' a service confuses the concept of what are UNO services in our terms.

And note, from the Java perspective, it' a phantom.

-Rebutter

What do you mean by 'phantom'?

-Hypothesizer

The 'UNO old-style service' isn't mapped to anything in Java.

-Rebutter

Huh? Is it OK to just say 'isn't mapped to anything'? What should we do when we have to handle a UNO component that has 'UNO old-style services' in its inheritances-implementations hierarchy?

-Hypothesizer

Actually, there is no harm. For example, suppose that there is a 'UNO old-style service', OldStyleServiceA, that contains interfaces, InterfaceA and InterfaceB, and there is a 'UNO old-style service', OldStyleServiceB, that contains the 'UNO old-style service', OldStyleServiceA, and an interface, InterfaceC; a UNO component, ComponentA, implements OldStyleServiceB.

-Rebutter

A 'UNO old-style service' can contain other 'UNO old-style services'?

-Hypothesizer

Yes. In that case, what counts is only that ComponentA implements InterfaceA, InterfaceB, and InterfaceC.

-Rebutter

Oh? . . . Oh. So, we don't have any occasion to access OldStyleServiceA?

-Hypothesizer

No, we don't have any such occasion. OldStyleServiceA doesn't exist from the Java perspective.

-Rebutter

So, from the Java perspective, 'UNO old-style services' exist only as documentation from which we can know what interfaces a UNO component implements.

-Hypothesizer

Yes. That understanding will make clear what 'UNO old-style services' are, for Java programmers.

-Rebutter

But what happens to the properties contained in the 'UNO old-style service'?

-Hypothesizer

A property contained in the 'UNO old-style service' reflects on the fact that the UNO component implements certain interfaces like 'XPropertySet' and has codes that handle that property.

-Rebutter

So, also in that case, 'UNO old-style services' exist only as documentation from which we can know how a UNO component is implemented.

There Are Also Things Called 'UNO New-style Services', but . . .

-Hypothesizer

As you may guess, there are also things called 'UNO new-style services'. The 'UNO new-style service' seems to mean a UNO service of a UNO component that implements only one UNO interface. However, from the Java perspective, that distinction doesn't have much significance.

-Rebutter

Ah, as it isn't special at all for the Java class to implement multiple interfaces, the number of interfaces implemented isn't a special concern for Java programmers.

-Hypothesizer

The reference documents claim that we can create 'UNO new-style service constructors' only for 'UNO new-style services', but that isn't true: we can create them also for UNO services of UNO components that implement multiple UNO interfaces. We will demonstrate it in a future article.

-Rebutter

As we are looking at things only from the Java perspective, there may be some intentions unknown to us. However, at least in mechanism, there is nothing that makes being 'UNO new-style service' special.

-Hypothesizer

And note, our UNO service in the sample UNO extension is a 'UNO new-style service', but its implementation class actually implements three UNO interfaces, 'XHiUnoExtensions', 'XServiceInfo', and 'XInitialization'. 'XServiceInfo' and 'XInitialization' aren't counted, I guess, because they aren't what UNO service users are supposed to directly use, but from the perspective of mechanism, a 'UNO new-style service' isn't particularly a UNO service of a UNO component that implements only one UNO interface.

-Rebutter

Ah-ha.

Main body END

References

  • 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>