From Apache OpenOffice Wiki
Jump to: navigation, search

The com.sun.star.lang.XUnoTunnel interface allows access to the this pointer of an object. This interface is used to cast a UNO interface that is coming back to its implementation class through a UNO method. Using this interface is a result of an unsatisfactory interface design, because it indicates that some functionality only works when non-UNO functions are used. In general, these objects cannot be replaced by a different implementation, because they undermine the general UNO interface concept. This interface can be understood as admittance to an already existing code that cannot be split into UNO components easily. If designing new services, do not use this interface.

  interface XUnoTunnel: com::sun::star::uno::XInterface
      hyper getSomething( [in] sequence< byte > aIdentifier );

The byte sequence contains an identifier that both the caller and implementer must know. The implementer returns the this pointer of the object if the byte sequence is equal to the byte sequence previously stored in a static variable. The byte sequence is usually generated once per process per implementation.

Documentation note.png Note that the previously mentioned 'per process' is important because the this pointer of a class you know is useless, if the instance lives in a different process.
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages