XTypeProvider

From Apache OpenOffice Wiki
Jump to: navigation, search



Every UNO object should implement the com.sun.star.lang.XTypeProvider interface.

Some applications need to know which interfaces an UNO object supports, for example, the Apache OpenOffice Basic engine or debugging tools, such as the InstanceInspector. The com.sun.star.lang.XTypeProvider interface was introduced to avoid going through all known interfaces calling queryInterface() repetitively. The XTypeProvider interface is implemented by Java and C++ helper classes. If the XTypeProvider must be implemented manually, use the following methods:

  // module com::sun::star::lang
  interface XTypeProvider: com::sun::star::uno::XInterface
  { 
      sequence<type> getTypes(); 
      sequence<byte> getImplementationId(); 
  };

The sections about Java and C++ components below show examples of XTypeProvider implementations.

Provided Types

The getTypes() method must return a list of types for all interfaces that queryInterface() provides. The Apache OpenOffice Basic engine depends on this information to establish a list of method signatures that can be used with an object.

ImplementationID

For caching purposes, the getImplementationId() method has been introduced. The method must return a byte array containing an identifier for the implemented set of interfaces in this implementation class. It is important that one ID maps to one set of interfaces, but one set of interfaces can be known under multiple IDs. Every implementation class should generate a static ID.

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