unoobjw.cxx (2a97ec55) | unoobjw.cxx (07a3d7f1) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 312 unchanged lines hidden (view full) --- 321// parameter (JavaScript Array object) 322// Because all those VT_DISPATCH objects need a different conversion 323// we have to find out what the object is supposed to be. The function does this 324// by either using type information or by help of a specialized ValueObject object. 325 326// A. Type Information 327// ----------------------------------------------------------------------------- 328// With the help of type information the kind of parameter can be exactly determined | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 312 unchanged lines hidden (view full) --- 321// parameter (JavaScript Array object) 322// Because all those VT_DISPATCH objects need a different conversion 323// we have to find out what the object is supposed to be. The function does this 324// by either using type information or by help of a specialized ValueObject object. 325 326// A. Type Information 327// ----------------------------------------------------------------------------- 328// With the help of type information the kind of parameter can be exactly determined |
329// and an appropriate conversion can be choosen. A problem arises if a method expects | 329// and an appropriate conversion can be chosen. A problem arises if a method expects |
330// an Any. Then the type info does not tell what the type of the value, that is kept 331// by the any, should be. In this situation the decision wheter the param is a 332// sequence or an object is made upon the fact if the object has a property "0" 333// ( see function "isJScriptArray"). Since this is unsafe it is recommended to use 334// the JScript value objects within a JScript script on such an occasion. 335 336// B. JavaScript Value Object ( class JScriptValue ) 337// ----------------------------------------------------------------------------- 338// A JScriptValue (ValueObject) object is a COM object in that it implements IDispatch and the 339// IJScriptValue object interface. Such objects are provided by all UNO wrapper 340// objects used within a JScript script. To obtain an instance one has to call 341// "_GetValueObject() or Bridge_GetValueObject()" on an UNO wrapper object (class InterfaceOleWrapper_Impl). 342// A value object is appropriately initialized within the script and passed as 343// parameter to an UNO object method or property. The convertDispparamsArgs function 344// can easily find out that a param is such an object by queriing for the 345// IJScriptValue interface. By this interface one the type and kind ( out, in/out) 346// can be determined and the right conversion can be applied. | 330// an Any. Then the type info does not tell what the type of the value, that is kept 331// by the any, should be. In this situation the decision wheter the param is a 332// sequence or an object is made upon the fact if the object has a property "0" 333// ( see function "isJScriptArray"). Since this is unsafe it is recommended to use 334// the JScript value objects within a JScript script on such an occasion. 335 336// B. JavaScript Value Object ( class JScriptValue ) 337// ----------------------------------------------------------------------------- 338// A JScriptValue (ValueObject) object is a COM object in that it implements IDispatch and the 339// IJScriptValue object interface. Such objects are provided by all UNO wrapper 340// objects used within a JScript script. To obtain an instance one has to call 341// "_GetValueObject() or Bridge_GetValueObject()" on an UNO wrapper object (class InterfaceOleWrapper_Impl). 342// A value object is appropriately initialized within the script and passed as 343// parameter to an UNO object method or property. The convertDispparamsArgs function 344// can easily find out that a param is such an object by queriing for the 345// IJScriptValue interface. By this interface one the type and kind ( out, in/out) 346// can be determined and the right conversion can be applied. |
347// Using ValueObjects we spare us the effort of aquiring and examining type information | 347// Using ValueObjects we spare us the effort of acquiring and examining type information |
348// in order to figure out what the an IDispatch parameter is meant for. 349 350// Normal JScript object parameter can be mixed with JScriptValue object. If an 351// VARIANT contains an VT_DISPATCH that is no JScriptValue than the type information 352// is used to find out about the reqired type. 353void InterfaceOleWrapper_Impl::convertDispparamsArgs(DISPID id, 354 unsigned short /*wFlags*/, DISPPARAMS* pdispparams, Sequence<Any>& rSeq) 355{ --- 1301 unchanged lines hidden (view full) --- 1657 return ret; 1658} 1659 1660// The function maps the TypeClass of the any to VARTYPE: If 1661// the Any contains STRUCT or INTERFACE then the return value 1662// is VT_DISPATCH. The function is used from o2u_createUnoObjectWrapper 1663// and the result is put into the constructor of the uno - wrapper 1664// object. If a client asks the object for DISPID_VALUE and this | 348// in order to figure out what the an IDispatch parameter is meant for. 349 350// Normal JScript object parameter can be mixed with JScriptValue object. If an 351// VARIANT contains an VT_DISPATCH that is no JScriptValue than the type information 352// is used to find out about the reqired type. 353void InterfaceOleWrapper_Impl::convertDispparamsArgs(DISPID id, 354 unsigned short /*wFlags*/, DISPPARAMS* pdispparams, Sequence<Any>& rSeq) 355{ --- 1301 unchanged lines hidden (view full) --- 1657 return ret; 1658} 1659 1660// The function maps the TypeClass of the any to VARTYPE: If 1661// the Any contains STRUCT or INTERFACE then the return value 1662// is VT_DISPATCH. The function is used from o2u_createUnoObjectWrapper 1663// and the result is put into the constructor of the uno - wrapper 1664// object. If a client asks the object for DISPID_VALUE and this |
1665// funtion returned VT_DISPATCH then the IDispatch of the same | 1665// function returned VT_DISPATCH then the IDispatch of the same |
1666// object is being returned. 1667// See InterfaceOleWrapper_Impl::Invoke, InterfaceOleWrapper_Impl::m_defaultValueType 1668const VARTYPE getVarType( const Any& value) 1669{ 1670 VARTYPE ret= VT_EMPTY; 1671 1672 switch ( value.getValueTypeClass()) 1673 { 1674 case TypeClass_STRUCT: ret= VT_DISPATCH; break; 1675 case TypeClass_INTERFACE: ret= VT_DISPATCH; break; 1676 default: break; 1677 } 1678 return ret; 1679} 1680 1681 1682 1683 1684} // end namespace | 1666// object is being returned. 1667// See InterfaceOleWrapper_Impl::Invoke, InterfaceOleWrapper_Impl::m_defaultValueType 1668const VARTYPE getVarType( const Any& value) 1669{ 1670 VARTYPE ret= VT_EMPTY; 1671 1672 switch ( value.getValueTypeClass()) 1673 { 1674 case TypeClass_STRUCT: ret= VT_DISPATCH; break; 1675 case TypeClass_INTERFACE: ret= VT_DISPATCH; break; 1676 default: break; 1677 } 1678 return ret; 1679} 1680 1681 1682 1683 1684} // end namespace |