Difference between revisions of "Documentation/DevGuide/WritingUNO/XTypeProvider"
Line 11: | Line 11: | ||
Some applications need to know which interfaces an UNO object supports, for example, the {{AOo}} Basic engine or debugging tools, such as the InstanceInspector. The <idl>com.sun.star.lang.XTypeProvider</idl> interface was introduced to avoid going through all known interfaces calling <code>queryInterface()</code> repetitively. The <code>XTypeProvider</code> interface is implemented by Java and C++ helper classes. If the <code>XTypeProvider</code> must be implemented manually, use the following methods: | Some applications need to know which interfaces an UNO object supports, for example, the {{AOo}} Basic engine or debugging tools, such as the InstanceInspector. The <idl>com.sun.star.lang.XTypeProvider</idl> interface was introduced to avoid going through all known interfaces calling <code>queryInterface()</code> repetitively. The <code>XTypeProvider</code> interface is implemented by Java and C++ helper classes. If the <code>XTypeProvider</code> must be implemented manually, use the following methods: | ||
− | < | + | <syntaxhighlight lang="idl"> |
// module com::sun::star::lang | // module com::sun::star::lang | ||
interface XTypeProvider: com::sun::star::uno::XInterface | interface XTypeProvider: com::sun::star::uno::XInterface | ||
Line 18: | Line 18: | ||
sequence<byte> getImplementationId(); | sequence<byte> getImplementationId(); | ||
}; | }; | ||
− | </ | + | </syntaxhighlight> |
The sections about Java and C++ components below show examples of <code>XTypeProvider</code> implementations. | The sections about Java and C++ components below show examples of <code>XTypeProvider</code> implementations. | ||
Latest revision as of 17:18, 23 December 2020
- XInterface
- XTypeProvider
- XServiceInfo
- XWeak
- XComponent
- XInitialization
- XMain
- XAggregation
- XUnoTunnel
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). |