LibreOffice Module extensions (master) 1
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Attributes | List of all members
UnoConversionUtilities< class > Class Template Referenceabstract

All methods are allowed to throw at least a BridgeRuntimeError. More...

#include <unoconversionutilities.hxx>

Inheritance diagram for UnoConversionUtilities< class >:
[legend]
Collaboration diagram for UnoConversionUtilities< class >:
[legend]

Public Member Functions

 UnoConversionUtilities (const Reference< XMultiServiceFactory > &smgr)
 
 UnoConversionUtilities (const Reference< XMultiServiceFactory > &xFactory, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass)
 
virtual ~UnoConversionUtilities ()
 
void anyToVariant (VARIANT *pVariant, const Any &rAny)
 converts only into oleautomation types, that is there is no VT_I1, VT_UI2, VT_UI4 a sal_Unicode character is converted into a BSTR. More...
 
void anyToVariant (VARIANT *pVariant, const Any &rAny, VARTYPE type)
 
SAFEARRAY * createUnoSequenceWrapper (const Any &rSeq)
 
SAFEARRAY * createUnoSequenceWrapper (const Any &rSeq, VARTYPE elemtype)
 
void createUnoObjectWrapper (const Any &rObj, VARIANT *pVar)
 
void variantToAny (const VARIANT *pVariant, Any &rAny, bool bReduceValueRange=true)
 
void variantToAny (const VARIANTARG *pArg, Any &rAny, const Type &ptype, bool bReduceValueRange=true)
 This method converts variants arguments in calls from COM -> UNO. More...
 
Any createOleObjectWrapper (VARIANT *pVar, const Type &aType=Type())
 
bool convertValueObject (const VARIANTARG *var, Any &any)
 
void dispatchExObject2Sequence (const VARIANTARG *pvar, Any &anySeq, const Type &type)
 
Sequence< AnycreateOleArrayWrapperOfDim (SAFEARRAY *pArray, unsigned int dimCount, unsigned int actDim, LONG *index, VARTYPE type, const Type &unotype)
 
Sequence< AnycreateOleArrayWrapper (SAFEARRAY *pArray, VARTYPE type, const Type &unotype=Type())
 
VARTYPE mapTypeClassToVartype (TypeClass type)
 
Reference< XSingleServiceFactory > getInvocationFactory (const Any &anyObject)
 
virtual Reference< XInterfacecreateUnoWrapperInstance ()=0
 
virtual Reference< XInterfacecreateComWrapperInstance ()=0
 
Sequence< TypegetImplementedInterfaces (IUnknown *pUnk)
 

Static Public Member Functions

static bool isJScriptArray (const VARIANT *pvar)
 

Protected Member Functions

Reference< XInterfacecreateAdapter (const Sequence< Type > &types, const Reference< XInterface > &receiver)
 
void getElementCountAndTypeOfSequence (const Any &rSeq, sal_Int32 dim, Sequence< sal_Int32 > &seqElementCounts, TypeDescription &typeDesc)
 
Reference< XTypeConverter > getTypeConverter ()
 

Static Protected Member Functions

static bool incrementMultidimensionalIndex (sal_Int32 dimensions, const sal_Int32 *parDimensionLength, sal_Int32 *parMultidimensionalIndex)
 
static size_t getOleElementSize (VARTYPE type)
 
static Type getElementTypeOfSequence (const Type &seqType)
 

Protected Attributes

const sal_uInt8 m_nUnoWrapperClass
 
const sal_uInt8 m_nComWrapperClass
 
Reference< XMultiServiceFactory > m_smgr
 
Reference< XMultiServiceFactory > m_smgrRemote
 
Reference< XSingleServiceFactory > m_xInvocationFactoryLocal
 
Reference< XSingleServiceFactory > m_xInvocationFactoryRemote
 

Private Attributes

Reference< XTypeConverter > m_typeConverter
 

Detailed Description

template<class>
class UnoConversionUtilities< class >

All methods are allowed to throw at least a BridgeRuntimeError.

Definition at line 125 of file unoconversionutilities.hxx.

Constructor & Destructor Documentation

◆ UnoConversionUtilities() [1/2]

template<class >
UnoConversionUtilities< class >::UnoConversionUtilities ( const Reference< XMultiServiceFactory > &  smgr)
inlineexplicit

Definition at line 128 of file unoconversionutilities.hxx.

◆ UnoConversionUtilities() [2/2]

template<class >
UnoConversionUtilities< class >::UnoConversionUtilities ( const Reference< XMultiServiceFactory > &  xFactory,
sal_uInt8  unoWrapperClass,
sal_uInt8  comWrapperClass 
)
inline

Definition at line 134 of file unoconversionutilities.hxx.

References xFactory.

◆ ~UnoConversionUtilities()

template<class >
virtual UnoConversionUtilities< class >::~UnoConversionUtilities ( )
inlinevirtual

Definition at line 139 of file unoconversionutilities.hxx.

Member Function Documentation

◆ anyToVariant() [1/2]

template<class T >
void UnoConversionUtilities< T >::anyToVariant ( VARIANT *  pVariant,
const Any rAny 
)

converts only into oleautomation types, that is there is no VT_I1, VT_UI2, VT_UI4 a sal_Unicode character is converted into a BSTR.

Exceptions
com.sun.star.lang.IllegalArgumentExceptionIf the any was inappropriate for conversion.
com.sun.star.script.CannotConvertExceptionThe any contains a type class for which no conversion is provided.

Definition at line 715 of file unoconversionutilities.hxx.

References createUnoTypeWrapper(), Currency, d, Decimal, Exception, hr, type, value, VT_ARRAY, VT_BOOL, VT_BSTR, VT_CY, VT_DATE, VT_DECIMAL, VT_ERROR, VT_I2, VT_I4, VT_R4, VT_R8, VT_UI1, and VT_VARIANT.

◆ anyToVariant() [2/2]

template<class T >
void UnoConversionUtilities< T >::anyToVariant ( VARIANT *  pVariant,
const Any rAny,
VARTYPE  type 
)

Definition at line 635 of file unoconversionutilities.hxx.

References Exception, hr, type, VT_ARRAY, VT_BYREF, and VT_VARIANT.

◆ convertValueObject()

template<class T >
bool UnoConversionUtilities< T >::convertValueObject ( const VARIANTARG *  var,
Any any 
)

Definition at line 1895 of file unoconversionutilities.hxx.

References any, Exception, getType(), hr, and type.

◆ createAdapter()

template<class T >
Reference< XInterface > UnoConversionUtilities< T >::createAdapter ( const Sequence< Type > &  types,
const Reference< XInterface > &  receiver 
)
protected

◆ createComWrapperInstance()

template<class >
virtual Reference< XInterface > UnoConversionUtilities< class >::createComWrapperInstance ( )
pure virtual

◆ createOleArrayWrapper()

template<class T >
Sequence< Any > UnoConversionUtilities< T >::createOleArrayWrapper ( SAFEARRAY *  pArray,
VARTYPE  type,
const Type unotype = Type() 
)

Definition at line 2221 of file unoconversionutilities.hxx.

References i, index, LONG, and type.

◆ createOleArrayWrapperOfDim()

template<class T >
Sequence< Any > UnoConversionUtilities< T >::createOleArrayWrapperOfDim ( SAFEARRAY *  pArray,
unsigned int  dimCount,
unsigned int  actDim,
LONG index,
VARTYPE  type,
const Type unotype 
)

◆ createOleObjectWrapper()

template<class T >
Any UnoConversionUtilities< T >::createOleObjectWrapper ( VARIANT *  pVar,
const Type aType = Type() 
)
Exceptions
IllegalArgumentException-if pVar does not contain VT_UNKNOWN or VT_DISPATCH or pVar is used for a particular UNO type which is not supported by pVar

Definition at line 1678 of file unoconversionutilities.hxx.

References any, Any, ComPtrToWrapperMap, cppu::UnoType< typename T >::get(), getBridgeMutex(), VT_EMPTY, and WrapperToAdapterMap.

◆ createUnoObjectWrapper()

template<class T >
void UnoConversionUtilities< T >::createUnoObjectWrapper ( const Any rObj,
VARIANT *  pVar 
)
Exceptions
com.sun.star.lang.IllegalArgumentExceptionIf rObj does not contain a struct or interface

Definition at line 1375 of file unoconversionutilities.hxx.

References AdapterToWrapperMap, Any, convertSelfToCom(), getBridgeMutex(), getVarType(), and UnoObjToWrapperMap.

◆ createUnoSequenceWrapper() [1/2]

template<class T >
SAFEARRAY * UnoConversionUtilities< T >::createUnoSequenceWrapper ( const Any rSeq)
Exceptions
com.sun.star.lang.IllegalArgumentExceptionIf rSeq does not contain a sequence then the exception is thrown.

Definition at line 1312 of file unoconversionutilities.hxx.

References Any, i, LONG, n, and VT_VARIANT.

◆ createUnoSequenceWrapper() [2/2]

template<class T >
SAFEARRAY * UnoConversionUtilities< T >::createUnoSequenceWrapper ( const Any rSeq,
VARTYPE  elemtype 
)
Exceptions
com.sun.star.lang.IllegalArgumentExceptionIf rSeq does not contain a sequence or elemtype has no proper value then the exception is thrown.

Definition at line 1044 of file unoconversionutilities.hxx.

References Any, i, VT_EMPTY, VT_NULL, and VT_VARIANT.

◆ createUnoWrapperInstance()

template<class >
virtual Reference< XInterface > UnoConversionUtilities< class >::createUnoWrapperInstance ( )
pure virtual

◆ dispatchExObject2Sequence()

template<class T >
void UnoConversionUtilities< T >::dispatchExObject2Sequence ( const VARIANTARG *  pvar,
Any anySeq,
const Type type 
)

◆ getElementCountAndTypeOfSequence()

template<class T >
void UnoConversionUtilities< T >::getElementCountAndTypeOfSequence ( const Any rSeq,
sal_Int32  dim,
Sequence< sal_Int32 > &  seqElementCounts,
TypeDescription &  typeDesc 
)
protected

Definition at line 1278 of file unoconversionutilities.hxx.

References Any, i, and typelib_typedescription_release().

◆ getElementTypeOfSequence()

template<class T >
Type UnoConversionUtilities< T >::getElementTypeOfSequence ( const Type seqType)
staticprotected

Definition at line 2207 of file unoconversionutilities.hxx.

References typelib_typedescription_release().

◆ getImplementedInterfaces()

template<class T >
Sequence< Type > UnoConversionUtilities< T >::getImplementedInterfaces ( IUnknown *  pUnk)

◆ getInvocationFactory()

template<class T >
Reference< XSingleServiceFactory > UnoConversionUtilities< T >::getInvocationFactory ( const Any anyObject)

Definition at line 305 of file unoconversionutilities.hxx.

References getBridgeMutex(), and INVOCATION_SERVICE.

◆ getOleElementSize()

template<class T >
size_t UnoConversionUtilities< T >::getOleElementSize ( VARTYPE  type)
staticprotected

Definition at line 1237 of file unoconversionutilities.hxx.

References size, type, VT_BOOL, VT_BSTR, VT_ERROR, VT_I2, VT_I4, VT_R4, VT_R8, VT_UI1, and VT_VARIANT.

◆ getTypeConverter()

template<class T >
Reference< XTypeConverter > UnoConversionUtilities< T >::getTypeConverter
protected

Definition at line 2347 of file unoconversionutilities.hxx.

References getBridgeMutex().

◆ incrementMultidimensionalIndex()

template<class T >
bool UnoConversionUtilities< T >::incrementMultidimensionalIndex ( sal_Int32  dimensions,
const sal_Int32 *  parDimensionLength,
sal_Int32 *  parMultidimensionalIndex 
)
staticprotected

Definition at line 1199 of file unoconversionutilities.hxx.

◆ isJScriptArray()

template<class T >
bool UnoConversionUtilities< T >::isJScriptArray ( const VARIANT *  pvar)
static

Definition at line 2250 of file unoconversionutilities.hxx.

References hr.

◆ mapTypeClassToVartype()

template<class T >
VARTYPE UnoConversionUtilities< T >::mapTypeClassToVartype ( TypeClass  type)

◆ variantToAny() [1/2]

template<class T >
void UnoConversionUtilities< T >::variantToAny ( const VARIANT *  pVariant,
Any rAny,
bool  bReduceValueRange = true 
)
Exceptions
CannotConvertExceptionThrown if the VARIANT contains a type that cannot be coerced in the expected Any. ArgumentIndex is 0. @IllegalArgumentException Thrown if the VARIANT is inappropriate for conversion. ArgumentPosition is -1,

Definition at line 1483 of file unoconversionutilities.hxx.

References Currency, d, Decimal, Exception, getType(), hr, reduceRange(), sName, type, VT_ARRAY, VT_BOOL, VT_BSTR, VT_CY, VT_DATE, VT_DECIMAL, VT_EMPTY, VT_ERROR, VT_I1, VT_I2, VT_I4, VT_INT, VT_NULL, VT_R4, VT_R8, VT_UI1, VT_UI2, VT_UI4, and VT_UINT.

◆ variantToAny() [2/2]

template<class T >
void UnoConversionUtilities< T >::variantToAny ( const VARIANTARG *  pArg,
Any rAny,
const Type ptype,
bool  bReduceValueRange = true 
)

This method converts variants arguments in calls from COM -> UNO.

Only then the expected UNO type is known.

Exceptions
CannotConvertExceptionThrown if the VARIANT contains a type that cannot be coerced in the expected Any. ArgumentIndex is 0. @IllegalArgumentException Thrown if the VARIANT is inappropriate for conversion. ArgumentPosition is -1,

Definition at line 326 of file unoconversionutilities.hxx.

References Any, Exception, getTypeConverter(), hr, value, VT_ARRAY, VT_BOOL, VT_BSTR, VT_DECIMAL, VT_I1, VT_I2, VT_I4, VT_NULL, VT_R4, VT_R8, VT_UI2, and VT_UI4.

Member Data Documentation

◆ m_nComWrapperClass

template<class >
const sal_uInt8 UnoConversionUtilities< class >::m_nComWrapperClass
protected

Definition at line 231 of file unoconversionutilities.hxx.

◆ m_nUnoWrapperClass

template<class >
const sal_uInt8 UnoConversionUtilities< class >::m_nUnoWrapperClass
protected

Definition at line 230 of file unoconversionutilities.hxx.

◆ m_smgr

template<class >
Reference<XMultiServiceFactory> UnoConversionUtilities< class >::m_smgr
protected

Definition at line 239 of file unoconversionutilities.hxx.

◆ m_smgrRemote

template<class >
Reference<XMultiServiceFactory> UnoConversionUtilities< class >::m_smgrRemote
protected

Definition at line 243 of file unoconversionutilities.hxx.

◆ m_typeConverter

template<class >
Reference<XTypeConverter> UnoConversionUtilities< class >::m_typeConverter
private

Definition at line 250 of file unoconversionutilities.hxx.

◆ m_xInvocationFactoryLocal

template<class >
Reference<XSingleServiceFactory> UnoConversionUtilities< class >::m_xInvocationFactoryLocal
protected

Definition at line 244 of file unoconversionutilities.hxx.

◆ m_xInvocationFactoryRemote

template<class >
Reference<XSingleServiceFactory> UnoConversionUtilities< class >::m_xInvocationFactoryRemote
protected

Definition at line 245 of file unoconversionutilities.hxx.


The documentation for this class was generated from the following file: