Difference between revisions of "Documentation/DevGuide/ProUNO/Bridge/Mapping of Type"
From Apache OpenOffice Wiki
< Documentation | DevGuide
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: | ||
− | < | + | <syntaxhighlight 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”) | ||
− | </ | + | </syntaxhighlight> |
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. | ||
− | < | + | <syntaxhighlight lang="idl"> |
//UNOIDL | //UNOIDL | ||
type foo([out] type t) | type foo([out] type t) | ||
− | </ | + | </syntaxhighlight> |
− | < | + | |
+ | <syntaxhighlight lang="vb"> | ||
'Visual Basic | 'Visual Basic | ||
Line 30: | Line 31: | ||
Dim objReturn As Object | Dim objReturn As Object | ||
Set objReturn = object.foo(objParam) | Set objReturn = object.foo(objParam) | ||
− | </ | + | </syntaxhighlight> |
{{PDL1}} | {{PDL1}} | ||
[[Category:Documentation/Developer's Guide/Professional UNO]] | [[Category:Documentation/Developer's Guide/Professional UNO]] |
Latest revision as of 15:08, 23 December 2020
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). |