Difference between revisions of "Documentation/DevGuide/ProUNO/Bridge/Mapping of Type"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (FINAL VERSION FOR L10N)
m
Line 11: Line 11:
 
{{DISPLAYTITLE:Mapping of Type}}
 
{{DISPLAYTITLE:Mapping of Type}}
 
Since there is no counterpart to the UNO type among the Automation types, it is mapped to an object. The object implements <code>IDispatch</code> and a private tagging interface that is known to the bridge. Therefore, whenever an object is passed in a call to a UNO object the bridge can determine whether it represents a type. To obtain a type one calls <code>Bridge_CreateType</code> on the service manager object and provides the name of the type. For example:
 
Since there is no counterpart to the UNO type among the Automation types, it is mapped to an object. The object implements <code>IDispatch</code> and a private tagging interface that is known to the bridge. Therefore, whenever an object is passed in a call to a UNO object the bridge can determine whether it represents a type. To obtain a type one calls <code>Bridge_CreateType</code> on the service manager object and provides the name of the type. For example:
 
+
<source lang="vb">
 
   'Visual Basic
 
   'Visual Basic
 
   Dim objType
 
   Dim objType
 
   Set objType = objServiceManager.Bridge_CreateType(“com.sun.star.uno.XInterface”)
 
   Set objType = objServiceManager.Bridge_CreateType(“com.sun.star.uno.XInterface”)
 +
</source>
  
 
In case the provided argument does not represent a valid type, the call produces an error.
 
In case the provided argument does not represent a valid type, the call produces an error.
  
 
If a UNO method returns a type, either as return value or out - parameter, then it is automatically converted to an object.
 
If a UNO method returns a type, either as return value or out - parameter, then it is automatically converted to an object.
 
+
<source lang="idl">
 
   //UNOIDL
 
   //UNOIDL
 
   type foo([out] type t)
 
   type foo([out] type t)
 
+
</source>
 +
<source lang="vb"> 
 
   'Visual Basic
 
   'Visual Basic
 
    
 
    
Line 28: Line 30:
 
   Dim objReturn As Object
 
   Dim objReturn As Object
 
   Set objReturn = object.foo(objParam)
 
   Set objReturn = object.foo(objParam)
 
+
</source>
  
 
{{PDL1}}
 
{{PDL1}}
  
 
[[Category:Documentation/Developer's Guide/Professional UNO]]
 
[[Category:Documentation/Developer's Guide/Professional UNO]]

Revision as of 12:52, 22 October 2009



Since there is no counterpart to the UNO type among the Automation types, it is mapped to an object. The object implements IDispatch and a private tagging interface that is known to the bridge. Therefore, whenever an object is passed in a call to a UNO object the bridge can determine whether it represents a type. To obtain a type one calls Bridge_CreateType on the service manager object and provides the name of the type. For example:

  'Visual Basic
  Dim objType
  Set objType = objServiceManager.Bridge_CreateType(“com.sun.star.uno.XInterface”)

In case the provided argument does not represent a valid type, the call produces an error.

If a UNO method returns a type, either as return value or out - parameter, then it is automatically converted to an object.

  //UNOIDL
  type foo([out] type t)
 
  'Visual Basic
  
  Dim objParam As Object
  Dim objReturn As Object
  Set objReturn = object.foo(objParam)
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages