LibreOffice Module extensions (master) 1
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
IUnknownWrapper Class Reference

#include <oleobjw.hxx>

Inheritance diagram for IUnknownWrapper:
[legend]
Collaboration diagram for IUnknownWrapper:
[legend]

Public Member Functions

 IUnknownWrapper (Reference< XMultiServiceFactory > const &xFactory, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass)
 
 ~IUnknownWrapper () override
 
Any SAL_CALL queryInterface (const Type &t) override
 
virtual Reference< XIntrospectionAccess > SAL_CALL getIntrospection () override
 
virtual Any SAL_CALL invoke (const OUString &aFunctionName, const Sequence< Any > &aParams, Sequence< sal_Int16 > &aOutParamIndex, Sequence< Any > &aOutParam) override
 
virtual void SAL_CALL setValue (const OUString &aPropertyName, const Any &aValue) override
 
virtual Any SAL_CALL getValue (const OUString &aPropertyName) override
 
virtual sal_Bool SAL_CALL hasMethod (const OUString &aName) override
 
virtual sal_Bool SAL_CALL hasProperty (const OUString &aName) override
 
virtual Any SAL_CALL createBridge (const Any &modelDepObject, const Sequence< sal_Int8 > &aProcessId, sal_Int16 sourceModelType, sal_Int16 destModelType) override
 
virtual void SAL_CALL initialize (const Sequence< Any > &aArguments) override
 
virtual OUString SAL_CALL getDefaultPropertyName () override
 
virtual OUString SAL_CALL getDefaultMethodName () override
 
virtual css::uno::Any SAL_CALL invokeGetProperty (const OUString &aFunctionName, const css::uno::Sequence< css::uno::Any > &aParams, css::uno::Sequence< ::sal_Int16 > &aOutParamIndex, css::uno::Sequence< css::uno::Any > &aOutParam) override
 
virtual css::uno::Any SAL_CALL invokePutProperty (const OUString &aFunctionName, const css::uno::Sequence< css::uno::Any > &aParams, css::uno::Sequence< ::sal_Int16 > &aOutParamIndex, css::uno::Sequence< css::uno::Any > &aOutParam) override
 
virtual css::uno::Any SAL_CALL directInvoke (const OUString &aName, const css::uno::Sequence< css::uno::Any > &aParams) override
 
virtual sal_Bool SAL_CALL hasMember (const OUString &aName) override
 
Any invokeWithDispIdComTlb (FuncDesc &aFuncDesc, const OUString &sFuncName, const Sequence< Any > &Params, Sequence< sal_Int16 > &OutParamIndex, Sequence< Any > &OutParam)
 
- Public Member Functions inherited from UnoConversionUtilities< IUnknownWrapper >
 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)
 

Protected Types

enum  JScriptDetermination {
  JScriptUndefined =0 ,
  NoJScript ,
  IsJScript
}
 

Protected Member Functions

virtual Any invokeWithDispIdUnoTlb (const OUString &sFunctionName, const Sequence< Any > &Params, Sequence< sal_Int16 > &OutParamIndex, Sequence< Any > &OutParam)
 
virtual Any invokeWithDispIdComTlb (const OUString &sFuncName, const Sequence< Any > &Params, Sequence< sal_Int16 > &OutParamIndex, Sequence< Any > &OutParam)
 
virtual Reference< XInterfacecreateUnoWrapperInstance () override
 
virtual Reference< XInterfacecreateComWrapperInstance () override
 
void getFuncDesc (const OUString &sFuncName, FUNCDESC **pFuncDesc)
 Obtains a FUNCDESC structure for a function. More...
 
void getPropDesc (const OUString &sFuncName, FUNCDESC **pFuncDescGet, FUNCDESC **pFuncDescPut, VARDESC **pVarDesc)
 Obtains a FUNCDESC structures or a VARDESC structure for a property. More...
 
void getMethodInfo (std::u16string_view sName, TypeDescription &methodDescription)
 
void getAttributeInfo (std::u16string_view sName, TypeDescription &attributeInfo)
 
TypeDescription getInterfaceMemberDescOfCurrentCall (std::u16string_view sName)
 
ITypeInfo * getTypeInfo ()
 Returns always a valid ITypeInfo interface or throws a BridgeRuntimeError. More...
 
bool getDispid (const OUString &sFuncName, DISPID *id)
 Returns the DISPID for a function or property name. More...
 
VARTYPE getUserDefinedElementType (ITypeInfo *pTypeInfo, const DWORD nHrefType)
 
VARTYPE getElementTypeDesc (const TYPEDESC *desc)
 Gets the element type in a VARIANT like style. More...
 
void buildComTlbIndex ()
 Iterates over all functions and put the names and indices into the map m_mapComFunc of type TLBFuncIndexMap. More...
 
void getFuncDescForInvoke (const OUString &sFuncName, const Sequence< Any > &seqArgs, FUNCDESC **pFuncDesc)
 Returns a FUNCDESC structure which contains type information about the current XInvocation::invoke call. More...
 
bool isJScriptObject ()
 
- Protected Member Functions inherited from UnoConversionUtilities< IUnknownWrapper >
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 ()
 

Protected Attributes

Sequence< Typem_seqTypes
 
CComPtr< IUnknown > m_spUnknown
 
CComPtr< IDispatch > m_spDispatch
 
OUString m_sTypeName
 
bool m_bOriginalDispatch
 This value is set during XInitialization::initialize. More...
 
DispIdMap m_dispIdMap
 
Reference< XIdlClass > * m_pxIdlClass
 
JScriptDetermination m_eJScript
 
TLBFuncIndexMap m_mapComFunc
 
bool m_bComTlbIndexInit
 
CComPtr< ITypeInfo > m_spTypeInfo
 
OUString m_sDefaultMember
 
bool m_bHasDfltMethod
 
bool m_bHasDfltProperty
 
- Protected Attributes inherited from UnoConversionUtilities< IUnknownWrapper >
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
 

Additional Inherited Members

- Static Public Member Functions inherited from UnoConversionUtilities< IUnknownWrapper >
static bool isJScriptArray (const VARIANT *pvar)
 
- Static Protected Member Functions inherited from UnoConversionUtilities< IUnknownWrapper >
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)
 

Detailed Description

Definition at line 55 of file oleobjw.hxx.

Member Enumeration Documentation

◆ JScriptDetermination

Enumerator
JScriptUndefined 
NoJScript 
IsJScript 

Definition at line 230 of file oleobjw.hxx.

Constructor & Destructor Documentation

◆ IUnknownWrapper()

IUnknownWrapper::IUnknownWrapper ( Reference< XMultiServiceFactory > const &  xFactory,
sal_uInt8  unoWrapperClass,
sal_uInt8  comWrapperClass 
)

Definition at line 82 of file oleobjw.cxx.

References xFactory.

Referenced by createComWrapperInstance().

◆ ~IUnknownWrapper()

IUnknownWrapper::~IUnknownWrapper ( )
override

Member Function Documentation

◆ buildComTlbIndex()

void IUnknownWrapper::buildComTlbIndex ( )
protected

Iterates over all functions and put the names and indices into the map m_mapComFunc of type TLBFuncIndexMap.

Call the function every time before accessing the map. Throws a BridgeRuntimeError on failure.

Definition at line 2377 of file oleobjw.cxx.

References getBridgeMutex(), getTypeInfo(), i, m_bComTlbIndexInit, and m_mapComFunc.

Referenced by getFuncDesc(), and getPropDesc().

◆ createBridge()

Any SAL_CALL IUnknownWrapper::createBridge ( const Any modelDepObject,
const Sequence< sal_Int8 > &  aProcessId,
sal_Int16  sourceModelType,
sal_Int16  destModelType 
)
overridevirtual

Definition at line 679 of file oleobjw.cxx.

References Any, m_bOriginalDispatch, m_spDispatch, m_spUnknown, o2u_attachCurrentThread(), OLE, and UNO.

◆ createComWrapperInstance()

Reference< XInterface > IUnknownWrapper::createComWrapperInstance ( )
overrideprotectedvirtual

◆ createUnoWrapperInstance()

Reference< XInterface > IUnknownWrapper::createUnoWrapperInstance ( )
overrideprotectedvirtual

◆ directInvoke()

uno::Any SAL_CALL IUnknownWrapper::directInvoke ( const OUString &  aName,
const css::uno::Sequence< css::uno::Any > &  aParams 
)
overridevirtual

◆ getAttributeInfo()

void IUnknownWrapper::getAttributeInfo ( std::u16string_view  sName,
TypeDescription &  attributeInfo 
)
protected

Definition at line 1537 of file oleobjw.cxx.

References getInterfaceMemberDescOfCurrentCall(), and sName.

Referenced by getValue().

◆ getDefaultMethodName()

virtual OUString SAL_CALL IUnknownWrapper::getDefaultMethodName ( )
inlineoverridevirtual

Definition at line 98 of file oleobjw.hxx.

References m_sDefaultMember.

◆ getDefaultPropertyName()

virtual OUString SAL_CALL IUnknownWrapper::getDefaultPropertyName ( )
inlineoverridevirtual

Definition at line 95 of file oleobjw.hxx.

References m_sDefaultMember.

◆ getDispid()

bool IUnknownWrapper::getDispid ( const OUString &  sFuncName,
DISPID *  id 
)
protected

Returns the DISPID for a function or property name.

If true is returned then id contains a valid DISPID.

Definition at line 2163 of file oleobjw.cxx.

References hr, and m_spDispatch.

Referenced by directInvoke(), getFuncDesc(), getPropDesc(), and hasMember().

◆ getElementTypeDesc()

VARTYPE IUnknownWrapper::getElementTypeDesc ( const TYPEDESC *  desc)
protected

Gets the element type in a VARIANT like style.

E.g. if desc->lptdesc contains a VT_PTR than it is replaced by VT_BYREF and VT_SAFEARRAY is replaced by VT_ARRAY If the TYPEDESC describes an SAFEARRAY then varType is a combination of VT_ARRAY and the element type. The argument desc must be obtained from FUNCDESC::lprgelemdescParam[i].tdesc where FUNCDESC was obtained from the ITypeInfo belonging to wrapped IDispatch.

Definition at line 2351 of file oleobjw.cxx.

References getElementTypeDesc(), getTypeInfo(), getUserDefinedElementType(), VT_ARRAY, VT_BYREF, and VT_NULL.

Referenced by getElementTypeDesc(), invokeWithDispIdComTlb(), and setValue().

◆ getFuncDesc()

void IUnknownWrapper::getFuncDesc ( const OUString &  sFuncName,
FUNCDESC **  pFuncDesc 
)
protected

Obtains a FUNCDESC structure for a function.

Fills the FUNCDESC structure if ITypeInfo provides information for the function of name sFuncName or pFuncDesc will not be filled in. May throw a BridgeRuntimeError.

Definition at line 2170 of file oleobjw.cxx.

References buildComTlbIndex(), getDispid(), getTypeInfo(), m_mapComFunc, and p.

Referenced by getFuncDescForInvoke(), hasMethod(), initialize(), and invokeWithDispIdUnoTlb().

◆ getFuncDescForInvoke()

void IUnknownWrapper::getFuncDescForInvoke ( const OUString &  sFuncName,
const Sequence< Any > &  seqArgs,
FUNCDESC **  pFuncDesc 
)
protected

Returns a FUNCDESC structure which contains type information about the current XInvocation::invoke call.

The FUNCDESC either describes a method, a property put or a property get operation. It uses the types com.sun.star.bridge.oleautomation.PropertyPutArgument which can be contained in the sequence of in-arguments of invoke to determine if the call is a property put or property get operation. If no adequate FUNCDESC was found, an IllegalArgumentException is thrown. Therefore it is safe to assume that the returned FUNCDESC* is not NULL.

Exceptions
IllegalArgumentExceptionThrown if no adequate FUNCDESC could be found.

Definition at line 2110 of file oleobjw.cxx.

References Any, FuncDesc::Detach(), getFuncDesc(), getPropDesc(), and getTypeInfo().

Referenced by invokeWithDispIdComTlb().

◆ getInterfaceMemberDescOfCurrentCall()

TypeDescription IUnknownWrapper::getInterfaceMemberDescOfCurrentCall ( std::u16string_view  sName)
protected

Definition at line 1549 of file oleobjw.cxx.

References m_seqTypes, and sName.

Referenced by getAttributeInfo(), and getMethodInfo().

◆ getIntrospection()

Reference< XIntrospectionAccess > SAL_CALL IUnknownWrapper::getIntrospection ( )
overridevirtual

Definition at line 134 of file oleobjw.cxx.

◆ getMethodInfo()

void IUnknownWrapper::getMethodInfo ( std::u16string_view  sName,
TypeDescription &  methodDescription 
)
protected

Definition at line 1526 of file oleobjw.cxx.

References getInterfaceMemberDescOfCurrentCall(), and sName.

Referenced by invoke(), and invokeWithDispIdUnoTlb().

◆ getPropDesc()

void IUnknownWrapper::getPropDesc ( const OUString &  sFuncName,
FUNCDESC **  pFuncDescGet,
FUNCDESC **  pFuncDescPut,
VARDESC **  pVarDesc 
)
protected

Obtains a FUNCDESC structures or a VARDESC structure for a property.

pFuncDescPut may also contain a structure for a "propertyputref" operation. If pFuncDesc contains a "put ref" or "put" FUNCDESC depends on what was found first in the type description. Fills the FUNCDESC structure if ITypeInfo provides information for the respective property functions or the structures will not be filled in. May throw a BridgeRuntimeError.

Definition at line 2237 of file oleobjw.cxx.

References buildComTlbIndex(), getDispid(), getTypeInfo(), i, m_mapComFunc, and p.

Referenced by getFuncDescForInvoke(), getValue(), hasMethod(), hasProperty(), initialize(), invokeGetProperty(), invokePutProperty(), and setValue().

◆ getTypeInfo()

ITypeInfo * IUnknownWrapper::getTypeInfo ( )
protected

Returns always a valid ITypeInfo interface or throws a BridgeRuntimeError.

The returned interface does not need to be AddRef'ed as long as it is locally used. The interface is kept in the instance of this class.

Definition at line 2457 of file oleobjw.cxx.

References getBridgeMutex(), m_spDispatch, and m_spTypeInfo.

Referenced by buildComTlbIndex(), directInvoke(), getElementTypeDesc(), getFuncDesc(), getFuncDescForInvoke(), getPropDesc(), getValue(), hasMethod(), hasProperty(), initialize(), invokeGetProperty(), invokePutProperty(), invokeWithDispIdComTlb(), invokeWithDispIdUnoTlb(), and setValue().

◆ getUserDefinedElementType()

VARTYPE IUnknownWrapper::getUserDefinedElementType ( ITypeInfo *  pTypeInfo,
const DWORD  nHrefType 
)
protected

Definition at line 2307 of file oleobjw.cxx.

References getUserDefinedElementType(), and VT_NULL.

Referenced by getElementTypeDesc(), and getUserDefinedElementType().

◆ getValue()

Any SAL_CALL IUnknownWrapper::getValue ( const OUString &  aPropertyName)
overridevirtual

◆ hasMember()

sal_Bool SAL_CALL IUnknownWrapper::hasMember ( const OUString &  aName)
overridevirtual

Definition at line 1486 of file oleobjw.cxx.

References aName, getDispid(), m_spDispatch, and o2u_attachCurrentThread().

◆ hasMethod()

sal_Bool SAL_CALL IUnknownWrapper::hasMethod ( const OUString &  aName)
overridevirtual

◆ hasProperty()

sal_Bool SAL_CALL IUnknownWrapper::hasProperty ( const OUString &  aName)
overridevirtual

◆ initialize()

void SAL_CALL IUnknownWrapper::initialize ( const Sequence< Any > &  aArguments)
overridevirtual

◆ invoke()

Any SAL_CALL IUnknownWrapper::invoke ( const OUString &  aFunctionName,
const Sequence< Any > &  aParams,
Sequence< sal_Int16 > &  aOutParamIndex,
Sequence< Any > &  aOutParam 
)
overridevirtual

◆ invokeGetProperty()

Any SAL_CALL IUnknownWrapper::invokeGetProperty ( const OUString &  aFunctionName,
const css::uno::Sequence< css::uno::Any > &  aParams,
css::uno::Sequence< ::sal_Int16 > &  aOutParamIndex,
css::uno::Sequence< css::uno::Any > &  aOutParam 
)
overridevirtual

◆ invokePutProperty()

Any SAL_CALL IUnknownWrapper::invokePutProperty ( const OUString &  aFunctionName,
const css::uno::Sequence< css::uno::Any > &  aParams,
css::uno::Sequence< ::sal_Int16 > &  aOutParamIndex,
css::uno::Sequence< css::uno::Any > &  aOutParam 
)
overridevirtual

◆ invokeWithDispIdComTlb() [1/2]

Any IUnknownWrapper::invokeWithDispIdComTlb ( const OUString &  sFuncName,
const Sequence< Any > &  Params,
Sequence< sal_Int16 > &  OutParamIndex,
Sequence< Any > &  OutParam 
)
protectedvirtual

Definition at line 1628 of file oleobjw.cxx.

References Any, getFuncDescForInvoke(), getTypeInfo(), and invokeWithDispIdComTlb().

◆ invokeWithDispIdComTlb() [2/2]

Any IUnknownWrapper::invokeWithDispIdComTlb ( FuncDesc aFuncDesc,
const OUString &  sFuncName,
const Sequence< Any > &  Params,
Sequence< sal_Int16 > &  OutParamIndex,
Sequence< Any > &  OutParam 
)

◆ invokeWithDispIdUnoTlb()

Any IUnknownWrapper::invokeWithDispIdUnoTlb ( const OUString &  sFunctionName,
const Sequence< Any > &  Params,
Sequence< sal_Int16 > &  OutParamIndex,
Sequence< Any > &  OutParam 
)
protectedvirtual

◆ isJScriptObject()

bool IUnknownWrapper::isJScriptObject ( )
protected

◆ queryInterface()

Any IUnknownWrapper::queryInterface ( const Type t)
override

Definition at line 116 of file oleobjw.cxx.

References Any, m_bHasDfltMethod, m_bHasDfltProperty, m_spDispatch, queryInterface(), and t.

Referenced by queryInterface().

◆ setValue()

void SAL_CALL IUnknownWrapper::setValue ( const OUString &  aPropertyName,
const Any aValue 
)
overridevirtual

Member Data Documentation

◆ m_bComTlbIndexInit

bool IUnknownWrapper::m_bComTlbIndexInit
protected

Definition at line 236 of file oleobjw.hxx.

Referenced by buildComTlbIndex().

◆ m_bHasDfltMethod

bool IUnknownWrapper::m_bHasDfltMethod
protected

Definition at line 240 of file oleobjw.hxx.

Referenced by initialize(), and queryInterface().

◆ m_bHasDfltProperty

bool IUnknownWrapper::m_bHasDfltProperty
protected

Definition at line 241 of file oleobjw.hxx.

Referenced by initialize(), and queryInterface().

◆ m_bOriginalDispatch

bool IUnknownWrapper::m_bOriginalDispatch
protected

This value is set during XInitialization::initialize.

It indicates that the COM interface was transported as VT_DISPATCH in a VARIANT rather than a VT_UNKNOWN

Definition at line 224 of file oleobjw.hxx.

Referenced by createBridge(), and initialize().

◆ m_dispIdMap

DispIdMap IUnknownWrapper::m_dispIdMap
protected

Definition at line 225 of file oleobjw.hxx.

◆ m_eJScript

JScriptDetermination IUnknownWrapper::m_eJScript
protected

Definition at line 231 of file oleobjw.hxx.

Referenced by isJScriptObject().

◆ m_mapComFunc

TLBFuncIndexMap IUnknownWrapper::m_mapComFunc
protected

Definition at line 234 of file oleobjw.hxx.

Referenced by buildComTlbIndex(), getFuncDesc(), and getPropDesc().

◆ m_pxIdlClass

Reference<XIdlClass>* IUnknownWrapper::m_pxIdlClass
protected

Definition at line 226 of file oleobjw.hxx.

◆ m_sDefaultMember

OUString IUnknownWrapper::m_sDefaultMember
protected

Definition at line 239 of file oleobjw.hxx.

Referenced by getDefaultMethodName(), getDefaultPropertyName(), and initialize().

◆ m_seqTypes

Sequence<Type> IUnknownWrapper::m_seqTypes
protected

Definition at line 217 of file oleobjw.hxx.

Referenced by getInterfaceMemberDescOfCurrentCall(), and initialize().

◆ m_spDispatch

CComPtr<IDispatch> IUnknownWrapper::m_spDispatch
protected

◆ m_spTypeInfo

CComPtr< ITypeInfo > IUnknownWrapper::m_spTypeInfo
protected

Definition at line 238 of file oleobjw.hxx.

Referenced by getTypeInfo().

◆ m_spUnknown

CComPtr<IUnknown> IUnknownWrapper::m_spUnknown
protected

Definition at line 218 of file oleobjw.hxx.

Referenced by createBridge(), initialize(), and ~IUnknownWrapper().

◆ m_sTypeName

OUString IUnknownWrapper::m_sTypeName
protected

Definition at line 220 of file oleobjw.hxx.

Referenced by getValue().


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