Conversion Mappings

From Apache OpenOffice Wiki
< Documentation‎ | DevGuide
Revision as of 15:09, 23 December 2020 by DiGro (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



As shown in the previous section, Automation types have a UNO counterpart according to the mapping tables. If a UNO function expects a particular type as an argument, then supply the corresponding Automation type. This is not always necessary as the bridge also accepts similar types. For example:

  //UNO IDL
  void func( long value);
  ' VB
  Dim value As Byte
  value = 2
  obj.func valLong

The following table shows the various Automation types, and how they are converted to UNO IDL types if the expected UNO IDL type has not been passed.

Automation IDL Types (source) UNO IDL Types (target)
boolean (true, false) unsigned char, short, long, float, double: 0 = false, > 0 = true

string: "true" = true, "false" = false

boolean
boolean, unsigned char, short, long, float, double, string byte
double, boolean, unsigned char, short, long, float, string double
float, boolean, unsigned char, short, string float
short, unsigned char, long, float, double, string short
long, unsigned char, long, float, double, string long
BSTR, boolean, unsigned char, short, long, float, double string
short, boolean, unsigned char, long, float, double, string (1 character long) char
long, boolean, unsigned char, short, float, double, string enum

When you use a string for a numeric value, it must contain an appropriate string representation of that value.

Floating point values are rounded if they are used for integer values.

Be careful using types that have a greater value space than the UNO type. Do not provide an argument that exceeds the value space which would result in an error. For example:

  // UNO IDL
  void func([in] byte value);
  ' VB 
  Dim value as Integer
  value= 1000
  obj.func value 'causes an error

The conversion mappings only work with in parameters, that is, during calls from an Automation environment to a UNO function, as far as the UNO function takes in parameters.

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