diff options
Diffstat (limited to 'extensions/source/ole')
-rw-r--r-- | extensions/source/ole/comifaces.hxx | 2 | ||||
-rw-r--r-- | extensions/source/ole/jscriptclasses.cxx | 26 | ||||
-rw-r--r-- | extensions/source/ole/jscriptclasses.hxx | 2 | ||||
-rw-r--r-- | extensions/source/ole/ole2uno.cxx | 24 | ||||
-rw-r--r-- | extensions/source/ole/ole2uno.hxx | 2 | ||||
-rw-r--r-- | extensions/source/ole/oledll.cxx | 2 | ||||
-rw-r--r-- | extensions/source/ole/oleobjw.cxx | 28 | ||||
-rw-r--r-- | extensions/source/ole/oleobjw.hxx | 24 | ||||
-rw-r--r-- | extensions/source/ole/olethread.cxx | 2 | ||||
-rw-r--r-- | extensions/source/ole/servprov.cxx | 28 | ||||
-rw-r--r-- | extensions/source/ole/servprov.hxx | 80 | ||||
-rw-r--r-- | extensions/source/ole/servreg.cxx | 26 | ||||
-rw-r--r-- | extensions/source/ole/unoconversionutilities.hxx | 462 | ||||
-rw-r--r-- | extensions/source/ole/unoobjw.cxx | 468 | ||||
-rw-r--r-- | extensions/source/ole/unoobjw.hxx | 98 | ||||
-rw-r--r-- | extensions/source/ole/unotypewrapper.cxx | 14 | ||||
-rw-r--r-- | extensions/source/ole/unotypewrapper.hxx | 2 | ||||
-rw-r--r-- | extensions/source/ole/windata.cxx | 2 | ||||
-rw-r--r-- | extensions/source/ole/windata.hxx | 6 |
19 files changed, 649 insertions, 649 deletions
diff --git a/extensions/source/ole/comifaces.hxx b/extensions/source/ole/comifaces.hxx index 70308715ef4d..d33f350b8f70 100644 --- a/extensions/source/ole/comifaces.hxx +++ b/extensions/source/ole/comifaces.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/extensions/source/ole/jscriptclasses.cxx b/extensions/source/ole/jscriptclasses.cxx index b2f75f1e667c..5b5083a0c848 100644 --- a/extensions/source/ole/jscriptclasses.cxx +++ b/extensions/source/ole/jscriptclasses.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -59,13 +59,13 @@ STDMETHODIMP JScriptValue::GetTypeInfo( UINT /*iTInfo*/, // JScriptValue, IDispatch -------------------------------------------- STDMETHODIMP JScriptValue::GetIDsOfNames( REFIID /*riid*/, LPOLESTR *rgszNames, - UINT /*cNames*/, + UINT /*cNames*/, LCID /*lcid*/, DISPID *rgDispId) { if( !rgDispId) return E_POINTER; - + HRESULT ret= S_OK; CComBSTR name(*rgszNames); @@ -99,7 +99,7 @@ STDMETHODIMP JScriptValue::Invoke( DISPID dispIdMember, return DISP_E_NONAMEDARGS; - HRESULT ret= S_OK; + HRESULT ret= S_OK; switch( dispIdMember) { case 0: // DISPID_VALUE @@ -113,13 +113,13 @@ STDMETHODIMP JScriptValue::Invoke( DISPID dispIdMember, break; case 1: if( wFlags & DISPATCH_METHOD) - ret= Set( pDispParams->rgvarg[1], pDispParams->rgvarg[0]); + ret= Set( pDispParams->rgvarg[1], pDispParams->rgvarg[0]); if( FAILED( ret)) ret= DISP_E_EXCEPTION; break; - case 2: + case 2: if( wFlags & DISPATCH_METHOD) - ret= Get( pVarResult); + ret= Get( pVarResult); if( FAILED( ret)) ret= DISP_E_EXCEPTION; break; @@ -145,7 +145,7 @@ STDMETHODIMP JScriptValue::Invoke( DISPID dispIdMember, // JScriptValue, IScriptOutParam----------------------- STDMETHODIMP JScriptValue::Set( VARIANT type, VARIANT value) -{ +{ Lock(); HRESULT hr= S_OK; m_varValue.Clear(); @@ -213,7 +213,7 @@ STDMETHODIMP JScriptValue::GetValue( BSTR* type, VARIANT *value) if( !type || !value) return E_POINTER; HRESULT hr; - if( SUCCEEDED( hr= m_bstrType.CopyTo( type))) + if( SUCCEEDED( hr= m_bstrType.CopyTo( type))) hr= VariantCopy( value, &m_varValue); Unlock(); return hr; @@ -249,13 +249,13 @@ STDMETHODIMP JScriptOutParam::GetTypeInfo( UINT /*iTInfo*/, // JScriptOutParam, IDispatch -------------------------------------------- STDMETHODIMP JScriptOutParam::GetIDsOfNames( REFIID /*riid*/, LPOLESTR *rgszNames, - UINT /*cNames*/, + UINT /*cNames*/, LCID /*lcid*/, DISPID *rgDispId) { if( !rgDispId) return E_POINTER; - + HRESULT ret= S_OK; CComBSTR name(*rgszNames); @@ -279,7 +279,7 @@ STDMETHODIMP JScriptOutParam::Invoke( DISPID dispIdMember, EXCEPINFO* /*pExcepInfo*/, UINT* /*puArgErr*/) { - HRESULT ret= S_OK; + HRESULT ret= S_OK; switch( dispIdMember) { case 0: // DISPID_VALUE @@ -297,7 +297,7 @@ STDMETHODIMP JScriptOutParam::Invoke( DISPID dispIdMember, else ret= E_POINTER; break; - case 1: // + case 1: // if( wFlags & DISPATCH_PROPERTYGET && pVarResult) { if( FAILED( VariantCopy( pVarResult, &m_varValue))) diff --git a/extensions/source/ole/jscriptclasses.hxx b/extensions/source/ole/jscriptclasses.hxx index b881e94419dd..7eab4bd8c8aa 100644 --- a/extensions/source/ole/jscriptclasses.hxx +++ b/extensions/source/ole/jscriptclasses.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/extensions/source/ole/ole2uno.cxx b/extensions/source/ole/ole2uno.cxx index 203c6b4d3b8b..16060432ac75 100644 --- a/extensions/source/ole/ole2uno.cxx +++ b/extensions/source/ole/ole2uno.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -57,18 +57,18 @@ Mutex * getBridgeMutex() // Mutex* getBridgeMutex() // { -// static Mutex* pMutex= NULL; +// static Mutex* pMutex= NULL; -// if( ! pMutex) -// { -// MutexGuard guard( Mutex::getGlobalMutex() ); -// if( !pMutex) -// { -// static Mutex aMutex; -// pMutex= &aMutex; -// } -// } -// return pMutex; +// if( ! pMutex) +// { +// MutexGuard guard( Mutex::getGlobalMutex() ); +// if( !pMutex) +// { +// static Mutex aMutex; +// pMutex= &aMutex; +// } +// } +// return pMutex; // } } diff --git a/extensions/source/ole/ole2uno.hxx b/extensions/source/ole/ole2uno.hxx index 2cd8c75d3857..fc3ad87ce0b5 100644 --- a/extensions/source/ole/ole2uno.hxx +++ b/extensions/source/ole/ole2uno.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/extensions/source/ole/oledll.cxx b/extensions/source/ole/oledll.cxx index 6c80487ffcb4..5346aa940cf7 100644 --- a/extensions/source/ole/oledll.cxx +++ b/extensions/source/ole/oledll.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx index 847ce89ce4f9..20359a21901b 100644 --- a/extensions/source/ole/oleobjw.cxx +++ b/extensions/source/ole/oleobjw.cxx @@ -78,7 +78,7 @@ using namespace com::sun::star::bridge::oleautomation; using namespace com::sun::star::bridge::ModelDependent; #define JSCRIPT_ID_PROPERTY L"_environment" -#define JSCRIPT_ID L"jscript" +#define JSCRIPT_ID L"jscript" namespace ole_adapter { @@ -128,7 +128,7 @@ IUnknownWrapper_Impl::~IUnknownWrapper_Impl() // remove entries in global maps typedef hash_map<sal_uInt32, sal_uInt32>::iterator _IT; - _IT it= WrapperToAdapterMap.find( (sal_uInt32) xIntRoot); + _IT it= WrapperToAdapterMap.find( (sal_uInt32) xIntRoot); if( it != WrapperToAdapterMap.end()) { sal_uInt32 adapter= it->second; @@ -1078,9 +1078,9 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName, } - CComVariant varResult; - ExcepInfo excepinfo; - unsigned int uArgErr; + CComVariant varResult; + ExcepInfo excepinfo; + unsigned int uArgErr; DISPPARAMS dispparams= { pVarParams, NULL, parameterCount, 0}; // Get the DISPID FuncDesc aDesc(getTypeInfo()); @@ -1161,7 +1161,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName, { try { - if( pMethod ) + if( pMethod ) variantToAny(&varResult, ret, Type( pMethod->pReturnTypeRef), sal_False); else variantToAny(&varResult, ret, sal_False); @@ -1185,7 +1185,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName, if( !bConvRet) // conversion of return or out parameter failed throw CannotConvertException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Call to COM object failed. Conversion of return or out value failed")), - Reference<XInterface>( static_cast<XWeak*>(this), UNO_QUERY ), TypeClass_UNKNOWN, + Reference<XInterface>( static_cast<XWeak*>(this), UNO_QUERY ), TypeClass_UNKNOWN, FailReason::UNKNOWN, 0);// lookup error code // conversion of return or out parameter failed switch (hr) @@ -1421,7 +1421,7 @@ sal_Bool IUnknownWrapper_Impl::isJScriptObject() if( disp) { CComVariant result; - if( SUCCEEDED( disp.GetPropertyByName( JSCRIPT_ID_PROPERTY, &result))) + if( SUCCEEDED( disp.GetPropertyByName( JSCRIPT_ID_PROPERTY, &result))) { if(result.vt == VT_BSTR) { @@ -1473,10 +1473,10 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, Any ret; HRESULT result; - DISPPARAMS dispparams = {NULL, NULL, 0, 0}; - CComVariant varResult; - ExcepInfo excepinfo; - unsigned int uArgErr; + DISPPARAMS dispparams = {NULL, NULL, 0, 0}; + CComVariant varResult; + ExcepInfo excepinfo; + unsigned int uArgErr; sal_Int32 i = 0; sal_Int32 nUnoArgs = Params.getLength(); DISPID idPropertyPut = DISPID_PROPERTYPUT; @@ -1779,7 +1779,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, } // in parameter no VT_BYREF except for array, interfaces else - { // void any stands for optional param + { // void any stands for optional param if (i < nUnoArgs && anyArg.getValueTypeClass() != TypeClass_VOID) { anyToVariant( & arArgs[revIndex], anyArg, varType); @@ -2029,7 +2029,7 @@ bool IUnknownWrapper_Impl::getDispid(const OUString& sFuncName, DISPID * id) { OSL_ASSERT(m_spDispatch); LPOLESTR lpsz = const_cast<LPOLESTR> (reinterpret_cast<LPCOLESTR>(sFuncName.getStr())); - HRESULT hr = m_spDispatch->GetIDsOfNames(IID_NULL, &lpsz, 1, LOCALE_USER_DEFAULT, id); + HRESULT hr = m_spDispatch->GetIDsOfNames(IID_NULL, &lpsz, 1, LOCALE_USER_DEFAULT, id); return hr == S_OK ? true : false; } void IUnknownWrapper_Impl::getFuncDesc(const OUString & sFuncName, FUNCDESC ** pFuncDesc) diff --git a/extensions/source/ole/oleobjw.hxx b/extensions/source/ole/oleobjw.hxx index 733d25f1d78b..0f926695eaab 100644 --- a/extensions/source/ole/oleobjw.hxx +++ b/extensions/source/ole/oleobjw.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -145,7 +145,7 @@ protected: Sequence<sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam); // Is used for OleObjectFactory service - virtual Any invokeWithDispIdComTlb(const OUString& sFuncName, + virtual Any invokeWithDispIdComTlb(const OUString& sFuncName, const Sequence< Any >& Params, Sequence< sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam); @@ -162,7 +162,7 @@ protected: // UnoConversionUtilities ------------------------------------------------------------------------------- - virtual Reference<XInterface> createUnoWrapperInstance(); + virtual Reference<XInterface> createUnoWrapperInstance(); virtual Reference<XInterface> createComWrapperInstance(); /**Obtains a FUNCDESC structure for a function. @@ -189,13 +189,13 @@ protected: // After return attributInfo contains typelib_InterfaceAttributeTypeDescription::pAttributeTypeRef void getAttributeInfo(const OUString& sName, TypeDescription& attributeInfo); // used by get MethodInfo - TypeDescription getInterfaceMemberDescOfCurrentCall(const OUString& sName); + TypeDescription getInterfaceMemberDescOfCurrentCall(const OUString& sName); /** Returns alway 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. */ - ITypeInfo* getTypeInfo(); - + ITypeInfo* getTypeInfo(); + /** Returns the DISPID for a function or property name. If true is returned then id contains a valid DISPID. */ @@ -203,10 +203,10 @@ protected: bool getDispid(const OUString& sFuncName, DISPID * id); VARTYPE getUserDefinedElementType( ITypeInfo* pTypeInfo, const DWORD nHrefType ); - + /** 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 + 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. @@ -221,10 +221,10 @@ 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. + 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 + 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. @@ -259,8 +259,8 @@ protected: was transported as VT_DISPATCH in a VARIANT rather then a VT_UNKNOWN */ sal_Bool m_bOriginalDispatch; - DispIdMap m_dispIdMap; - Reference<XIdlClass>* m_pxIdlClass; + DispIdMap m_dispIdMap; + Reference<XIdlClass>* m_pxIdlClass; // used by isJScriptObject diff --git a/extensions/source/ole/olethread.cxx b/extensions/source/ole/olethread.cxx index bd17dff2b90e..bd6f5fbceeec 100644 --- a/extensions/source/ole/olethread.cxx +++ b/extensions/source/ole/olethread.cxx @@ -54,7 +54,7 @@ void o2u_attachCurrentThread() if ((sal_Bool)(sal_IntPtr)oleThreadData.getData() != sal_True) { - HINSTANCE inst= LoadLibrary( _T("ole32.dll")); + HINSTANCE inst= LoadLibrary( _T("ole32.dll")); if( inst ) { HRESULT hr; diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx index 82c5170a075a..ecf45a4ce074 100644 --- a/extensions/source/ole/servprov.cxx +++ b/extensions/source/ole/servprov.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -82,7 +82,7 @@ DEFINE_GUID(OID_ServiceManager, 0x82154420, 0xfbf, 0x11d4, 0x83, 0x13, 0x0, 0x50 DEFINE_GUID(OID_ServiceManager, 0xd9bb9d1d, 0xbfa9, 0x4357, 0x9f, 0x11, 0x9a, 0x2e, 0x90, 0x61, 0xf0, 0x6e); #endif -extern rtl_StandardModuleCount globalModuleCount; +extern rtl_StandardModuleCount globalModuleCount; /***************************************************************************** @@ -544,7 +544,7 @@ OleClient_Impl::~OleClient_Impl() globalModuleCount.modCnt.release( &globalModuleCount.modCnt); } -Sequence< OUString > SAL_CALL OleClient_Impl::getAvailableServiceNames() throw( RuntimeException ) +Sequence< OUString > SAL_CALL OleClient_Impl::getAvailableServiceNames() throw( RuntimeException ) { Sequence< OUString > ret; @@ -559,23 +559,23 @@ OUString OleClient_Impl::getImplementationName() Reference<XInterface> SAL_CALL OleClient_Impl::createInstance(const OUString& ServiceSpecifier) throw (Exception, RuntimeException ) { - Reference<XInterface> ret; - HRESULT result; - IUnknown* pUnknown = NULL; - CLSID classId; + Reference<XInterface> ret; + HRESULT result; + IUnknown* pUnknown = NULL; + CLSID classId; o2u_attachCurrentThread(); result = CLSIDFromProgID( - reinterpret_cast<LPCWSTR>(ServiceSpecifier.getStr()), //Pointer to the ProgID - &classId); //Pointer to the CLSID + reinterpret_cast<LPCWSTR>(ServiceSpecifier.getStr()), //Pointer to the ProgID + &classId); //Pointer to the CLSID if (result == NOERROR) { result = CoCreateInstance( - classId, //Class identifier (CLSID) of the object - NULL, //Pointer to whether object is or isn't part of an aggregate + classId, //Class identifier (CLSID) of the object + NULL, //Pointer to whether object is or isn't part of an aggregate CLSCTX_SERVER, //Context for running executable code IID_IUnknown, //Reference to the identifier of the interface (void**)&pUnknown); //Address of output variable that receives @@ -584,11 +584,11 @@ Reference<XInterface> SAL_CALL OleClient_Impl::createInstance(const OUString& Se if (pUnknown != NULL) { - Any any; + Any any; CComVariant variant; V_VT(&variant) = VT_UNKNOWN; - V_UNKNOWN(&variant) = pUnknown; + V_UNKNOWN(&variant) = pUnknown; // AddRef for Variant pUnknown->AddRef(); @@ -661,7 +661,7 @@ OleServer_Impl::OleServer_Impl( const Reference<XMultiServiceFactory>& smgr): sal_Bool bOLERegister = sal_False; #else sal_Bool bOLERegister = sal_True; -#endif +#endif sal_Bool ret = provideInstance( m_smgr, (GUID*)&OID_ServiceManager, bOLERegister ); (void)ret; } diff --git a/extensions/source/ole/servprov.hxx b/extensions/source/ole/servprov.hxx index d9c47cdbd7eb..49091b1fcd38 100644 --- a/extensions/source/ole/servprov.hxx +++ b/extensions/source/ole/servprov.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,11 +42,11 @@ using namespace std; namespace ole_adapter { -Reference< XInterface> SAL_CALL ConverterProvider_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr) +Reference< XInterface> SAL_CALL ConverterProvider_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr) throw( Exception); -Reference< XInterface> SAL_CALL ConverterProvider_CreateInstance2( const Reference<XMultiServiceFactory> & xSMgr) +Reference< XInterface> SAL_CALL ConverterProvider_CreateInstance2( const Reference<XMultiServiceFactory> & xSMgr) throw( Exception); -Reference< XInterface> SAL_CALL ConverterProvider_CreateInstanceVar1( const Reference<XMultiServiceFactory> & xSMgr) +Reference< XInterface> SAL_CALL ConverterProvider_CreateInstanceVar1( const Reference<XMultiServiceFactory> & xSMgr) throw( Exception); Reference<XInterface> SAL_CALL OleClient_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr) throw( Exception); @@ -56,10 +56,10 @@ Reference<XInterface> SAL_CALL OleServer_CreateInstance( const Reference<XMultiS class declaration IClassFactoryWrapper - Specify abstract helper methods on class factories, which provide + Specify abstract helper methods on class factories, which provide UNO objects. These methods are used by objects of class OleServer_Impl, to handle the OLE registration of different class factories. - + *****************************************************************************/ class IClassFactoryWrapper : public IClassFactory @@ -74,14 +74,14 @@ public: class declaration ProviderOleWrapper_Impl - Provides an UNO service provider as OLE class factory. Handle the - OLE registration by overloading the abstract methods from + Provides an UNO service provider as OLE class factory. Handle the + OLE registration by overloading the abstract methods from IClassFactoryWrapper. Acts as a COM class factory. When IClassFactory::CreateInstance is being called then it creates an service by help of the XSingleServiceFactory member and maps maps it to a COM object. - + *****************************************************************************/ class ProviderOleWrapper_Impl : public IClassFactoryWrapper @@ -94,7 +94,7 @@ public: sal_Bool registerClass(); sal_Bool deregisterClass(); - + /* IUnknown methods */ STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj); STDMETHOD_(ULONG, AddRef)(); @@ -108,9 +108,9 @@ protected: oslInterlockedCount m_refCount; Reference<XSingleServiceFactory> m_xSingleServiceFactory; - GUID m_guid; - DWORD m_factoryHandle; - Reference<XBridgeSupplier2> m_bridgeSupplier; + GUID m_guid; + DWORD m_factoryHandle; + Reference<XBridgeSupplier2> m_bridgeSupplier; Reference<XMultiServiceFactory> m_smgr; }; @@ -118,10 +118,10 @@ protected: class declaration OneInstanceOleWrapper_Impl - Provides an single UNO object as OLE object. Handle the - OLE registration by overloading the abstract methods from + Provides an single UNO object as OLE object. Handle the + OLE registration by overloading the abstract methods from IClassFactoryWrapper. - + Acts as a COM class factory. When IClassFactory::CreateInstance is being called then it maps the XInstance member it to a COM object. @@ -136,7 +136,7 @@ public: sal_Bool registerClass(); sal_Bool deregisterClass(); - + /* IUnknown methods */ STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj); STDMETHOD_(ULONG, AddRef)(); @@ -149,10 +149,10 @@ public: protected: oslInterlockedCount m_refCount; - Reference<XInterface> m_xInst; - GUID m_guid; - DWORD m_factoryHandle; - Reference<XBridgeSupplier2> m_bridgeSupplier; + Reference<XInterface> m_xInst; + GUID m_guid; + DWORD m_factoryHandle; + Reference<XBridgeSupplier2> m_bridgeSupplier; Reference<XMultiServiceFactory> m_smgr; unsigned long m_nApplRegHandle; sal_Bool m_bAsApplication; @@ -163,17 +163,17 @@ protected: class declaration OleConverter_Impl2 Implementation of the UNO service com.sun.star.bridge.OleBridgeSupplier2. - + *****************************************************************************/ -// This class realizes the service com.sun.star.bridge.OleBridgeSupplier2 and +// This class realizes the service com.sun.star.bridge.OleBridgeSupplier2 and // com.sun.star.bridge.OleBridgeSupplierVar1. The class implements XBridgeSupplier2 // instead of XBridgeSuppplier as done by class OleConverter_Impl. The XBridgeSupplier2 // interface does not need a Maschine Id in its createBridge function anymore, // If an UNO interface is to be converted then the member m_nUnoWrapperClass determines -// what wrapper class is to be used. There are currently InterfaceOleWrapper_Impl and -// UnoObjectWrapperRemoteOpt. The first is used for the OleBridgeSupplier2 and the -// latter for OleBridgeSupplierVar1. +// what wrapper class is to be used. There are currently InterfaceOleWrapper_Impl and +// UnoObjectWrapperRemoteOpt. The first is used for the OleBridgeSupplier2 and the +// latter for OleBridgeSupplierVar1. // The m_nComWrapperClass specifies the class which is used as wrapper for COM interfaces. // Currently there is only one class available ( IUnknownWrapper_Impl). class OleConverter_Impl2 : public WeakImplHelper2<XBridgeSupplier2, XInitialization>, @@ -182,14 +182,14 @@ class OleConverter_Impl2 : public WeakImplHelper2<XBridgeSupplier2, XInitializat public: OleConverter_Impl2( const Reference<XMultiServiceFactory>& smgr); OleConverter_Impl2( const Reference<XMultiServiceFactory>& smgr, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass ); - virtual ~OleConverter_Impl2(); + virtual ~OleConverter_Impl2(); // XBridgeSupplier2 --------------------------------------------------- - virtual Any SAL_CALL createBridge(const Any& modelDepObject, - const Sequence<sal_Int8>& ProcessId, - sal_Int16 sourceModelType, - sal_Int16 destModelType) + virtual Any SAL_CALL createBridge(const Any& modelDepObject, + const Sequence<sal_Int8>& ProcessId, + sal_Int16 sourceModelType, + sal_Int16 destModelType) throw (IllegalArgumentException, RuntimeException); // XInitialization @@ -208,7 +208,7 @@ protected: class declaration OleClient_Impl Implementation of the UNO service com.sun.star.bridge.OleObjectFactory. - + *****************************************************************************/ @@ -222,8 +222,8 @@ public: // XMultiServiceFactory virtual Reference<XInterface> SAL_CALL createInstance(const OUString& ServiceSpecifier) throw( Exception, RuntimeException); virtual Reference<XInterface> SAL_CALL createInstanceWithArguments(const OUString& ServiceSpecifier, const Sequence< Any >& Arguments) throw (Exception, RuntimeException); - Sequence< OUString > SAL_CALL getAvailableServiceNames() throw (RuntimeException); - + Sequence< OUString > SAL_CALL getAvailableServiceNames() throw (RuntimeException); + // Abstract struct UnoConversionUtilities virtual Reference< XInterface > createUnoWrapperInstance(); virtual Reference< XInterface > createComWrapperInstance(); @@ -231,7 +231,7 @@ public: OUString getImplementationName(); protected: - Reference<XBridgeSupplier2> m_bridgeSupplier; + Reference<XBridgeSupplier2> m_bridgeSupplier; }; /***************************************************************************** @@ -239,10 +239,10 @@ protected: class declaration OleServer_Impl Implementation of the UNO service com.sun.star.bridge.OleApplicationRegistration. - Register the calling application as OLE automation server for - standard OLE object. The objects will be registered while instanciating - this implementation and deregistrated, if this implementation is destroyed. - + Register the calling application as OLE automation server for + standard OLE object. The objects will be registered while instanciating + this implementation and deregistrated, if this implementation is destroyed. + *****************************************************************************/ class OleServer_Impl : public OWeakObject, XTypeProvider @@ -266,7 +266,7 @@ protected: sal_Bool provideInstance(const Reference<XInterface>& xInst, GUID* guid, sal_Bool bAsApplication ); list< IClassFactoryWrapper* > m_wrapperList; - Reference< XBridgeSupplier2 > m_bridgeSupplier; + Reference< XBridgeSupplier2 > m_bridgeSupplier; Reference<XMultiServiceFactory> m_smgr; }; diff --git a/extensions/source/ole/servreg.cxx b/extensions/source/ole/servreg.cxx index 7311f965ca8d..16a99df48fa4 100644 --- a/extensions/source/ole/servreg.cxx +++ b/extensions/source/ole/servreg.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -44,14 +44,14 @@ rtl_StandardModuleCount globalModuleCount= MODULE_COUNT_INIT; -Reference<XInterface> SAL_CALL ConverterProvider_CreateInstance2( const Reference<XMultiServiceFactory> & xSMgr) +Reference<XInterface> SAL_CALL ConverterProvider_CreateInstance2( const Reference<XMultiServiceFactory> & xSMgr) throw(Exception) { Reference<XInterface> xService = *new OleConverter_Impl2( xSMgr); return xService; } -Reference<XInterface> SAL_CALL ConverterProvider_CreateInstanceVar1( const Reference<XMultiServiceFactory> & xSMgr) +Reference<XInterface> SAL_CALL ConverterProvider_CreateInstanceVar1( const Reference<XMultiServiceFactory> & xSMgr) throw(Exception) { Reference<XInterface> xService = *new OleConverter_Impl2( xSMgr, UNO_OBJECT_WRAPPER_REMOTE_OPT, IUNKNOWN_WRAPPER_IMPL); @@ -77,50 +77,50 @@ extern "C" void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { void * pRet = 0; - + OUString aImplName( OUString::createFromAscii( pImplName ) ); Reference< XSingleServiceFactory > xFactory; Sequence<OUString> seqServiceNames; if (pServiceManager && aImplName.equals( reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleConverter2") )) { xFactory= createSingleFactory( reinterpret_cast< XMultiServiceFactory*>(pServiceManager), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleConverter2")), + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleConverter2")), ConverterProvider_CreateInstance2, seqServiceNames, &globalModuleCount.modCnt ); } else if (pServiceManager && aImplName.equals( reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleConverterVar1") )) { xFactory= createSingleFactory( reinterpret_cast<XMultiServiceFactory*>(pServiceManager), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleConverterVar1")), + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleConverterVar1")), ConverterProvider_CreateInstanceVar1, seqServiceNames, &globalModuleCount.modCnt ); } else if(pServiceManager && aImplName.equals(reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleClient"))) { xFactory= createSingleFactory( reinterpret_cast< XMultiServiceFactory*>(pServiceManager), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleClient")), + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleClient")), OleClient_CreateInstance, seqServiceNames, &globalModuleCount.modCnt); } else if(pServiceManager && aImplName.equals(reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleServer"))) { xFactory= createOneInstanceFactory( reinterpret_cast< XMultiServiceFactory*>(pServiceManager), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleServer")), + OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleServer")), OleServer_CreateInstance, seqServiceNames, &globalModuleCount.modCnt); } - + if (xFactory.is()) { xFactory->acquire(); pRet = xFactory.get(); } - + return pRet; } -extern "C" sal_Bool SAL_CALL component_writeInfo( void * /*pServiceManager*/, void * pRegistryKey ) +extern "C" sal_Bool SAL_CALL component_writeInfo( void * /*pServiceManager*/, void * pRegistryKey ) { if (pRegistryKey) { @@ -150,7 +150,7 @@ extern "C" sal_Bool SAL_CALL component_writeInfo( void * /*pServiceManager*/, xNewKey->createKey(reinterpret_cast<const sal_Unicode*>(L"com.sun.star.bridge.OleApplicationRegistration")); xNewKey->createKey(reinterpret_cast<const sal_Unicode*>(L"com.sun.star.bridge.oleautomation.ApplicationRegistration")); - + return sal_True; } catch (InvalidRegistryException &) @@ -168,7 +168,7 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( } -extern "C" sal_Bool component_canUnload( TimeValue* libUnused) +extern "C" sal_Bool component_canUnload( TimeValue* libUnused) { return globalModuleCount.canUnload( &globalModuleCount, libUnused); } diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx index a220bd5d1578..1970b08fd843 100644 --- a/extensions/source/ole/unoconversionutilities.hxx +++ b/extensions/source/ole/unoconversionutilities.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -46,14 +46,14 @@ // for some reason DECIMAL_NEG (wtypes.h) which contains BYTE is not resolved. typedef unsigned char BYTE; // classes for wrapping uno objects -#define INTERFACE_OLE_WRAPPER_IMPL 1 -#define UNO_OBJECT_WRAPPER_REMOTE_OPT 2 +#define INTERFACE_OLE_WRAPPER_IMPL 1 +#define UNO_OBJECT_WRAPPER_REMOTE_OPT 2 #define INVOCATION_SERVICE reinterpret_cast<const sal_Unicode*>(L"com.sun.star.script.Invocation") // classes for wrapping ole objects -#define IUNKNOWN_WRAPPER_IMPL 1 +#define IUNKNOWN_WRAPPER_IMPL 1 #define INTERFACE_ADAPTER_FACTORY reinterpret_cast<const sal_Unicode*>(L"com.sun.star.script.InvocationAdapterFactory") // COM or JScript objects implementing UNO interfaces have to implement this property @@ -75,14 +75,14 @@ namespace ole_adapter extern hash_map<sal_uInt32, sal_uInt32> AdapterToWrapperMap; extern hash_map<sal_uInt32, sal_uInt32> WrapperToAdapterMap; typedef hash_map<sal_uInt32, sal_uInt32>::iterator IT_Wrap; -typedef hash_map<sal_uInt32, sal_uInt32>::iterator CIT_Wrap; +typedef hash_map<sal_uInt32, sal_uInt32>::iterator CIT_Wrap; //Maps IUnknown pointers to a weak reference of the respective wrapper class (e.g. // IUnknownWrapperImpl. It is the responsibility of the wrapper to remove the entry when // it is being destroyed. // Used to ensure that an Automation object is always mapped to the same UNO objects. extern hash_map<sal_uInt32, WeakReference<XInterface> > ComPtrToWrapperMap; typedef hash_map<sal_uInt32, WeakReference<XInterface> >::iterator IT_Com; -typedef hash_map<sal_uInt32, WeakReference<XInterface> >::const_iterator CIT_Com; +typedef hash_map<sal_uInt32, WeakReference<XInterface> >::const_iterator CIT_Com; // Maps XInterface pointers to a weak reference of its wrapper class (i.e. // InterfaceOleWrapper_Impl). It is the responsibility of the wrapper to remove the entry when @@ -134,11 +134,11 @@ public: /** @exception com.sun.star.lang.IllegalArgumentException If rSeq does not contain a sequence then the exception is thrown. */ - SAFEARRAY* createUnoSequenceWrapper(const Any& rSeq); + SAFEARRAY* createUnoSequenceWrapper(const Any& rSeq); /** @exception com.sun.star.lang.IllegalArgumentException If rSeq does not contain a sequence or elemtype has no proper value then the exception is thrown. - */ + */ SAFEARRAY* createUnoSequenceWrapper(const Any& rSeq, VARTYPE elemtype); /** @exception com.sun.star.lang.IllegalArgumentException @@ -191,15 +191,15 @@ public: static sal_Bool isJScriptArray(const VARIANT* pvar); Sequence<Type> getImplementedInterfaces(IUnknown* pUnk); - + protected: Reference<XInterface> createAdapter(const Sequence<Type>& types, const Reference<XInterface>& receiver); - + // helper function for Sequence conversion void getElementCountAndTypeOfSequence( const Any& rSeq, sal_Int32 dim, Sequence< sal_Int32 >& seqElementCounts, TypeDescription& typeDesc); // helper function for Sequence conversion - sal_Bool incrementMultidimensionalIndex(sal_Int32 dimensions, const sal_Int32 * parDimensionLength, - sal_Int32 * parMultidimensionalIndex); + sal_Bool incrementMultidimensionalIndex(sal_Int32 dimensions, const sal_Int32 * parDimensionLength, + sal_Int32 * parMultidimensionalIndex); // helper function for Sequence conversion size_t getOleElementSize( VARTYPE type); @@ -209,7 +209,7 @@ protected: Reference<XTypeConverter> getTypeConverter(); // This member determines what class is used to convert a UNO object - // or struct to a COM object. It is passed along to the o2u_anyToVariant + // or struct to a COM object. It is passed along to the o2u_anyToVariant // function in the createBridge function implementation sal_uInt8 m_nUnoWrapperClass; sal_uInt8 m_nComWrapperClass; @@ -254,7 +254,7 @@ bool convertSelfToCom( T& unoInterface, VARIANT * pVar) Sequence<sal_Int8> seqId( arId, 16); Any anySource; anySource <<= xInt; - Any anyDisp= xSupplier->createBridge( anySource, seqId, UNO, OLE); + Any anyDisp= xSupplier->createBridge( anySource, seqId, UNO, OLE); if( anyDisp.getValueTypeClass() == TypeClass_UNSIGNED_LONG) { VARIANT* pvariant= *(VARIANT**)anyDisp.getValue(); @@ -277,11 +277,11 @@ bool convertSelfToCom( T& unoInterface, VARIANT * pVar) // Gets the invocation factory depending on the Type in the Any. // The factory can be created by a local or remote multi service factory. -// In case there is a remote multi service factory available there are +// In case there is a remote multi service factory available there are // some services or types for which the local factory is used. The exceptions // are: all structs. // Param anyObject - contains the object ( interface, struct) for what we need an invocation object. -// +// template<class T> Reference< XSingleServiceFactory > UnoConversionUtilities<T>::getInvocationFactory(const Any& anyObject) { @@ -291,14 +291,14 @@ Reference< XSingleServiceFactory > UnoConversionUtilities<T>::getInvocationFacto m_smgrRemote.is() ) { if( ! m_xInvocationFactoryRemote.is() ) - m_xInvocationFactoryRemote= Reference<XSingleServiceFactory>( + m_xInvocationFactoryRemote= Reference<XSingleServiceFactory>( m_smgrRemote->createInstance( INVOCATION_SERVICE), UNO_QUERY); retVal= m_xInvocationFactoryRemote; } else { if( ! m_xInvocationFactoryLocal.is() ) - m_xInvocationFactoryLocal= Reference<XSingleServiceFactory>( + m_xInvocationFactoryLocal= Reference<XSingleServiceFactory>( m_smgr->createInstance(INVOCATION_SERVICE ), UNO_QUERY); retVal= m_xInvocationFactoryLocal; } @@ -314,7 +314,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, bool bFail = false; bool bCannotConvert = false; CComVariant var; - + // There is no need to support indirect values, since they're not supported by UNO if( FAILED(hr= VariantCopyInd( &var, const_cast<VARIANTARG*>(pArg)))) // remove VT_BYREF throw BridgeRuntimeError( @@ -322,14 +322,14 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, "VariantCopyInd failed for reason : ") + OUString::valueOf(hr)); bool bHandled = convertValueObject( & var, rAny); if( bHandled) - OSL_ENSURE( rAny.getValueType() == ptype, "type in Value Object must match the type parameter"); - + OSL_ENSURE( rAny.getValueType() == ptype, "type in Value Object must match the type parameter"); + if( ! bHandled) { // convert into a variant type that is the equivalent to the type // the sequence expects. Thus variantToAny produces the correct type // E.g. An Array object contains VT_I4 and the sequence expects shorts - // than the vartype must be changed. The reason is, you can't specify the + // than the vartype must be changed. The reason is, you can't specify the // type in JavaScript and the script engine determines the type beeing used. switch( ptype.getTypeClass()) { @@ -354,12 +354,12 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, } break; case TypeClass_INTERFACE: // could also be an IUnknown - case TypeClass_STRUCT: - { + case TypeClass_STRUCT: + { rAny = createOleObjectWrapper( & var, ptype); break; } - case TypeClass_ENUM: + case TypeClass_ENUM: if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_I4))) rAny.setValue((void*) & var.lVal, ptype); else if (hr == DISP_E_TYPEMISMATCH) @@ -367,11 +367,11 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, else bFail = true; break; - case TypeClass_SEQUENCE: + case TypeClass_SEQUENCE: // There are different ways of receiving a sequence: // 1: JScript, VARTYPE: VT_DISPATCH // 2. VBScript simple arraysVT_VARIANT|VT_BYREF the referenced VARIANT contains - // a VT_ARRAY| <type> + // a VT_ARRAY| <type> // 3. VBSrcript multi dimensional arrays: VT_ARRAY|VT_BYREF if( pArg->vt == VT_DISPATCH) { @@ -386,7 +386,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, Reference<XTypeConverter> conv = getTypeConverter(); if (conv.is()) { - try + try { Any anySeq = makeAny(unoSeq); Any convAny = conv->convertTo(anySeq, ptype); @@ -409,16 +409,16 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, } } } - break; - case TypeClass_VOID: + break; + case TypeClass_VOID: rAny.setValue(NULL,Type()); break; - case TypeClass_ANY: // Any + case TypeClass_ANY: // Any // There could be a JScript Array that needs special handling // If an Any is expected and this Any must contain a Sequence // then we cannot figure out what element type is required. // Therefore we convert to Sequence< Any > - if( pArg->vt == VT_DISPATCH && isJScriptArray( pArg)) + if( pArg->vt == VT_DISPATCH && isJScriptArray( pArg)) { dispatchExObject2Sequence( pArg, rAny, getCppuType((Sequence<Any>*) 0)); @@ -435,11 +435,11 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, variantToAny( & var, rAny, getCppuType( (sal_uInt64*) 0), bReduceValueRange); } - else + else { //negative value variantToAny( & var, rAny, getCppuType( (sal_Int64*) 0), - bReduceValueRange); + bReduceValueRange); } } else @@ -447,7 +447,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, variantToAny( & var, rAny); } break; - case TypeClass_BOOLEAN: // VARIANT could be VARIANT_BOOL or other + case TypeClass_BOOLEAN: // VARIANT could be VARIANT_BOOL or other if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_BOOL))) variantToAny( & var, rAny); else if (hr == DISP_E_TYPEMISMATCH) @@ -455,7 +455,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, else bFail = true; break; - case TypeClass_STRING: // UString + case TypeClass_STRING: // UString if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_BSTR))) variantToAny( & var, rAny); else if (hr == DISP_E_TYPEMISMATCH) @@ -463,7 +463,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, else bFail = true; break; - case TypeClass_FLOAT: // float + case TypeClass_FLOAT: // float if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_R4))) variantToAny( & var, rAny); else if (hr == DISP_E_TYPEMISMATCH) @@ -471,7 +471,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, else bFail = true; break; - case TypeClass_DOUBLE: // double + case TypeClass_DOUBLE: // double if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_R8))) variantToAny(& var, rAny); else if (hr == DISP_E_TYPEMISMATCH) @@ -479,7 +479,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, else bFail = true; break; - case TypeClass_BYTE: // BYTE + case TypeClass_BYTE: // BYTE if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_I1))) variantToAny( & var, rAny); else if (hr == DISP_E_TYPEMISMATCH) @@ -487,11 +487,11 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, else bFail = true; break; - case TypeClass_SHORT: // INT16 + case TypeClass_SHORT: // INT16 if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_I2))) variantToAny( & var, rAny); else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; + bCannotConvert = true; else bFail = true; break; @@ -499,7 +499,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, if(SUCCEEDED(hr = VariantChangeType(& var, &var, 0, VT_I4))) variantToAny( & var, rAny, bReduceValueRange); else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; + bCannotConvert = true; else bFail = true; break; @@ -519,15 +519,15 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, rAny <<= value; } else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; + bCannotConvert = true; else bFail = true; break; - case TypeClass_UNSIGNED_SHORT: // UINT16 + case TypeClass_UNSIGNED_SHORT: // UINT16 if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_UI2))) variantToAny( & var, rAny); else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; + bCannotConvert = true; else bFail = true; break; @@ -535,11 +535,11 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_UI4))) variantToAny( & var, rAny, bReduceValueRange); else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; + bCannotConvert = true; else bFail = true; break; - case TypeClass_UNSIGNED_HYPER: + case TypeClass_UNSIGNED_HYPER: if(SUCCEEDED(hr = VariantChangeType(& var, &var, 0, VT_DECIMAL))) { if (var.decVal.Hi32 > 0 || var.decVal.scale > 0) @@ -550,7 +550,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, rAny <<= var.decVal.Lo64; } else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; + bCannotConvert = true; else bFail = true; break; @@ -563,13 +563,13 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, bFail = true; break; default: -// case TypeClass_SERVICE: break; // meta construct +// case TypeClass_SERVICE: break; // meta construct // case TypeClass_TYPEDEF: break; -// case TypeClass_UNION: break; -// case TypeClass_MODULE: break; // module -// case TypeClass_EXCEPTION: break; +// case TypeClass_UNION: break; +// case TypeClass_MODULE: break; // module +// case TypeClass_EXCEPTION: break; // case TypeClass_ARRAY: break; // there's no Array at the moment -// case TypeClass_UNKNOWN: break; +// case TypeClass_UNKNOWN: break; bCannotConvert = true; break; } @@ -582,7 +582,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, OUSTR("\" to the expected UNO type of type class: ") + OUString::valueOf((sal_Int32) ptype.getTypeClass()), 0, TypeClass_UNKNOWN, FailReason::TYPE_NOT_SUPPORTED,0); - + if (bFail) throw IllegalArgumentException( OUSTR("[automation bridge]UnoConversionUtilities<T>:variantToAny\n" @@ -614,9 +614,9 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, "UnoConversionUtilities<T>::variantToAny !")); } } - + // The function only converts Sequences to SAFEARRAYS with elements of the type -// specified by the parameter type. Everything else is forwarded to +// specified by the parameter type. Everything else is forwarded to // anyToVariant(VARIANT* pVariant, const Any& rAny) // Param type must not be VT_BYREF template<class T> @@ -638,7 +638,7 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny, pVariant->byref= ar; } } - else if(type == VT_VARIANT) + else if(type == VT_VARIANT) { anyToVariant(pVariant, rAny); } @@ -656,14 +656,14 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny, OUSTR("\" to the expected Automation type of VARTYPE: ") + OUString::valueOf((sal_Int32)type), 0, TypeClass_UNKNOWN, FailReason::TYPE_NOT_SUPPORTED,0); - + throw BridgeRuntimeError( OUSTR("[automation bridge]UnoConversionUtilities<T>::anyToVariant \n" "Conversion of any with ") + rAny.getValueType().getTypeName() + OUSTR(" to VARIANT with type: ") + OUString::valueOf((sal_Int32) type) + OUSTR(" failed! Error code: ") + OUString::valueOf(hr)); - + } if(FAILED(hr = VariantCopy(pVariant, &var))) { @@ -671,7 +671,7 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny, OUSTR("[automation bridge]UnoConversionUtilities<T>::anyToVariant \n" "VariantCopy failed for reason: ") + OUString::valueOf(hr)); } - } + } } catch (IllegalArgumentException &) { @@ -689,7 +689,7 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny, { throw BridgeRuntimeError( OUSTR("[automation bridge]UnoConversionUtilities<T>::anyToVariant \n" - "Unexpected exception occurred. Message: ") + e.Message); + "Unexpected exception occurred. Message: ") + e.Message); } catch(...) { @@ -707,7 +707,7 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny) { switch (rAny.getValueTypeClass()) { - case TypeClass_INTERFACE: + case TypeClass_INTERFACE: { Reference<XInterface> xInt; if (rAny >>= xInt) @@ -784,7 +784,7 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny) } break; } - case TypeClass_SEQUENCE: // sequence ??? SafeArray descriptor + case TypeClass_SEQUENCE: // sequence ??? SafeArray descriptor { SAFEARRAY* pArray = createUnoSequenceWrapper(rAny); if (pArray) @@ -809,7 +809,7 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny) } break; } - case TypeClass_BOOLEAN: + case TypeClass_BOOLEAN: { sal_Bool value; if (rAny >>= value) @@ -849,7 +849,7 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny) { float value; if (rAny >>= value) - { + { pVariant->vt = VT_R4; pVariant->fltVal = value; } @@ -888,8 +888,8 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny) } break; } - case TypeClass_SHORT: // INT16 - case TypeClass_UNSIGNED_SHORT: // UINT16 + case TypeClass_SHORT: // INT16 + case TypeClass_UNSIGNED_SHORT: // UINT16 { sal_Int16 value; if (rAny >>= value) @@ -927,15 +927,15 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny) } case TypeClass_HYPER: { - + pVariant->vt = VT_DECIMAL; pVariant->decVal.scale = 0; pVariant->decVal.sign = 0; pVariant->decVal.Hi32 = 0; - + sal_Int64 value; rAny >>= value; - + if (value & SAL_CONST_UINT64(0x8000000000000000)) pVariant->decVal.sign = DECIMAL_NEG; @@ -971,7 +971,7 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny) break; } default: - //TypeClass_SERVICE: + //TypeClass_SERVICE: //TypeClass_EXCEPTION: //When a InvocationTargetException is thrown when calling XInvocation::invoke //on a UNO object, then the target exception is directly used to create a @@ -980,8 +980,8 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny) //TypeClass_ANY: //TypeClass_UNKNOWN: //TypeClass_UNSIGNED_OCTET: - // TypeClass_UNION: - // TypeClass_ARRAY: + // TypeClass_UNION: + // TypeClass_ARRAY: // TypeClass_UNSIGNED_INT: // TypeClass_UNSIGNED_BYTE: // TypeClass_MODULE: @@ -1000,8 +1000,8 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny) throw IllegalArgumentException( OUSTR("[automation bridge]UnoConversionUtilities<T>::anyToVariant\n" "The provided any of type\" ") + rAny.getValueType().getTypeName() + - OUSTR("\" is unappropriate for conversion!"), Reference<XInterface>(), -1); - + OUSTR("\" is unappropriate for conversion!"), Reference<XInterface>(), -1); + } } catch (CannotConvertException & ) @@ -1020,18 +1020,18 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny) { throw BridgeRuntimeError( OUSTR("[automation bridge]UnoConversionUtilities<T>::anyToVariant \n" - "Unexpected exception occurred. Message: ") + e.Message); + "Unexpected exception occurred. Message: ") + e.Message); } catch(...) { throw BridgeRuntimeError( OUSTR("[automation bridge]UnoConversionUtilities<T>::anyToVariant \n" - "Unexpected exception occurred. ") ); + "Unexpected exception occurred. ") ); } } // Creates an SAFEARRAY of the specified element and if necessary -// creates a SAFEARRAY whith multiple dimensions. +// creates a SAFEARRAY whith multiple dimensions. // Used by sal_Bool anyToVariant(VARIANT* pVariant, const Any& rAny, VARTYPE type); template<class T> SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq, VARTYPE elemtype) @@ -1042,9 +1042,9 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq, "The any does not contain a sequence!"), 0, 0); if (elemtype == VT_NULL || elemtype == VT_EMPTY) throw IllegalArgumentException( - OUSTR("[automation bridge]UnoConversionUtilities<T>::createUnoSequenceWrapper \n" + OUSTR("[automation bridge]UnoConversionUtilities<T>::createUnoSequenceWrapper \n" "No element type supplied!"),0, -1); - SAFEARRAY* pArray= NULL; + SAFEARRAY* pArray= NULL; // Get the dimensions. This is done by examining the type name string // The count of brackets determines the dimensions. OUString sTypeName= rSeq.getValueType().getTypeName(); @@ -1073,7 +1073,7 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq, size_t oleElementSize= getOleElementSize( elemtype); // SafeArrayCreate clears the memory for the data itself. pArray = SafeArrayCreate(elemtype, dims, prgsabound); - + // convert the Sequence's elements and populate the SAFEARRAY if( pArray) { @@ -1084,7 +1084,7 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq, const sal_Int32* parElementCount= seqElementCounts.getConstArray(); uno_Sequence * pMultiSeq= *(uno_Sequence* const*) rSeq.getValue(); sal_Int32 dimsSeq= dims - 1; - + // arDimSeqIndizes contains the current index of a block of data. // E.g. Sequence<Sequence<sal_Int32>> , the index would refer to Sequence<sal_Int32> // In this case arDimSeqIndices would have the size 1. That is the elements are not counted @@ -1096,11 +1096,11 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq, { sarDimsSeqIndices.reset(new sal_Int32[dimsSeq]); arDimsSeqIndices = sarDimsSeqIndices.get(); - memset( arDimsSeqIndices, 0, sizeof( sal_Int32 ) * dimsSeq); + memset( arDimsSeqIndices, 0, sizeof( sal_Int32 ) * dimsSeq); } - + char* psaCurrentData= (char*)pSAData; - + do { // Get the Sequence at the current index , see arDimsSeqIndices @@ -1127,17 +1127,17 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq, if( skipSeq) continue; - + // Calculate the current position within the datablock of the SAFEARRAY - // for the next Sequence. - sal_Int32 memOffset= 0; + // for the next Sequence. + sal_Int32 memOffset= 0; sal_Int32 dimWeight= parElementCount[ dims - 1]; // size of the rightmost dimension for(sal_Int16 idims=0; idims < dimsSeq; idims++ ) { memOffset+= arDimsSeqIndices[dimsSeq - 1 - idims] * dimWeight; // now determine the weight of the dimension to the left of the current. if( dims - 2 - idims >=0) - dimWeight*= parElementCount[dims - 2 - idims]; + dimWeight*= parElementCount[dims - 2 - idims]; } psaCurrentData= (char*)pSAData + memOffset * oleElementSize; // convert the Sequence and put the elements into the Safearray @@ -1157,22 +1157,22 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq, anyToVariant( &var, unoElement); if( elemtype == VT_VARIANT ) { - VariantCopy( ( VARIANT*)psaCurrentData, &var); + VariantCopy( ( VARIANT*)psaCurrentData, &var); VariantClear( &var); } else - memcpy( psaCurrentData, &var.byref, oleElementSize); - + memcpy( psaCurrentData, &var.byref, oleElementSize); + psaCurrentData+= oleElementSize; } } while( incrementMultidimensionalIndex( dimsSeq, parElementCount, arDimsSeqIndices)); - + SafeArrayUnaccessData( pArray); - } + } } } - return pArray; + return pArray; } // Increments a multi dimensional index. @@ -1180,17 +1180,17 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq, // False is also returned if an overflow of the most significant dimension occurs. E.g. // assume an array with the dimensions (2,2), then the lowest index is (0,0) and the highest // index is (1,1). If the function is being called with the index (1,1) then the overflow would -// occur, with the result (0,0) and a sal_False as return value. +// occur, with the result (0,0) and a sal_False as return value. // Param dimensions - number of dimensions -// Param parDimensionsLength - The array contains the size of each dimension, that is the -// size of the array equals the parameter dimensions. -// The rightmost dimensions is the least significant one -// ( parDimensionsLengths[ dimensions -1 ] ). -// Param parMultiDimensionalIndex - The array contains the index. Each dimension index is -// 0 based. +// Param parDimensionsLength - The array contains the size of each dimension, that is the +// size of the array equals the parameter dimensions. +// The rightmost dimensions is the least significant one +// ( parDimensionsLengths[ dimensions -1 ] ). +// Param parMultiDimensionalIndex - The array contains the index. Each dimension index is +// 0 based. template<class T> -sal_Bool UnoConversionUtilities<T>::incrementMultidimensionalIndex(sal_Int32 dimensions, - const sal_Int32 * parDimensionLengths, +sal_Bool UnoConversionUtilities<T>::incrementMultidimensionalIndex(sal_Int32 dimensions, + const sal_Int32 * parDimensionLengths, sal_Int32 * parMultidimensionalIndex) { if( dimensions < 1) @@ -1198,7 +1198,7 @@ sal_Bool UnoConversionUtilities<T>::incrementMultidimensionalIndex(sal_Int32 dim sal_Bool ret= sal_True; sal_Bool carry= sal_True; // to get into the while loop - + sal_Int32 currentDimension= dimensions; //most significant is 1 while( carry) { @@ -1222,7 +1222,7 @@ sal_Bool UnoConversionUtilities<T>::incrementMultidimensionalIndex(sal_Int32 dim } // Determines the size of a certain OLE type. The function takes -// only those types into account which are oleautomation types and +// only those types into account which are oleautomation types and // can have a value ( unless VT_NULL, VT_EMPTY, VT_ARRAY, VT_BYREF). // Currently used in createUnoSequenceWrapper to calculate addresses // for data within a SAFEARRAY. @@ -1248,34 +1248,34 @@ size_t UnoConversionUtilities<T>::getOleElementSize( VARTYPE type) return size; } -//If a Sequence is being converted into a SAFEARRAY then we possibly have +//If a Sequence is being converted into a SAFEARRAY then we possibly have // to create a SAFEARRAY with multiple dimensions. This is the case when a // Sequence contains Sequences ( Sequence< Sequence < XXX > > ). The leftmost // Sequence in the declaration is assumed to represent dimension 1. Because -// all Sequence elements of a Sequence can have different length, we have to +// all Sequence elements of a Sequence can have different length, we have to // determine the maximum length which is then the length of the respective // dimension. // getElementCountAndTypeOfSequence determines the length of each dimension and calls itself recursively // in the process. // param rSeq - an Any that has to contain a Sequence // param dim - the dimension for which the number of elements is being determined, -// must be one. -// param seqElementCounts - countains the maximum number of elements for each -// dimension. Index 0 contains the number of dimension one. -// After return the Sequence contains the maximum number of -// elements for each dimension. -// The length of the Sequence must equal the number of dimensions. -// param typeClass - TypeClass of the element type that is no Sequence, e.g. -// Sequence< Sequence <Sequence <sal_Int32> > > - type is sal_Int32) +// must be one. +// param seqElementCounts - countains the maximum number of elements for each +// dimension. Index 0 contains the number of dimension one. +// After return the Sequence contains the maximum number of +// elements for each dimension. +// The length of the Sequence must equal the number of dimensions. +// param typeClass - TypeClass of the element type that is no Sequence, e.g. +// Sequence< Sequence <Sequence <sal_Int32> > > - type is sal_Int32) template<class T> -void UnoConversionUtilities<T>::getElementCountAndTypeOfSequence( const Any& rSeq, sal_Int32 dim, +void UnoConversionUtilities<T>::getElementCountAndTypeOfSequence( const Any& rSeq, sal_Int32 dim, Sequence< sal_Int32 >& seqElementCounts, TypeDescription& typeDesc) { sal_Int32 dimCount= (*(uno_Sequence* const *) rSeq.getValue())->nElements; if( dimCount > seqElementCounts[ dim-1]) seqElementCounts[ dim-1]= dimCount; - // we need the element type to construct the any that is + // we need the element type to construct the any that is // passed into getElementCountAndTypeOfSequence again typelib_TypeDescription* pSeqDesc= NULL; rSeq.getValueTypeDescription( &pSeqDesc); @@ -1283,7 +1283,7 @@ void UnoConversionUtilities<T>::getElementCountAndTypeOfSequence( const Any& rS // if the elements are Sequences than do recursion if( dim < seqElementCounts.getLength() ) - { + { uno_Sequence* pSeq = *(uno_Sequence* const*) rSeq.getValue(); uno_Sequence** arSequences= (uno_Sequence**)pSeq->elements; for( sal_Int32 i=0; i < dimCount; i++) @@ -1302,27 +1302,27 @@ void UnoConversionUtilities<T>::getElementCountAndTypeOfSequence( const Any& rS template<class T> -SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq) +SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq) { SAFEARRAY* pArray = NULL; sal_uInt32 n = 0; - + if( rSeq.getValueTypeClass() != TypeClass_SEQUENCE ) throw IllegalArgumentException( OUSTR("[automation bridge]UnoConversionUtilities<T>::createUnoSequenceWrapper\n" "The UNO argument is not a sequence"), 0, -1); - + uno_Sequence * punoSeq= *(uno_Sequence**) rSeq.getValue(); - + typelib_TypeDescriptionReference* pSeqTypeRef= rSeq.getValueTypeRef(); typelib_TypeDescription* pSeqType= NULL; TYPELIB_DANGER_GET( &pSeqType, pSeqTypeRef); - typelib_IndirectTypeDescription * pSeqIndDec= (typelib_IndirectTypeDescription*) pSeqType; - - + typelib_IndirectTypeDescription * pSeqIndDec= (typelib_IndirectTypeDescription*) pSeqType; + + typelib_TypeDescriptionReference * pSeqElementTypeRef= pSeqIndDec->pType; TYPELIB_DANGER_RELEASE( pSeqType); - + typelib_TypeDescription* pSeqElementDesc= NULL; TYPELIB_DANGER_GET( &pSeqElementDesc, pSeqElementTypeRef); @@ -1339,36 +1339,36 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq) { sal_Int32 nElementSize= pSeqElementDesc->nSize; n= punoSeq->nElements; - + SAFEARRAYBOUND rgsabound[1]; rgsabound[0].lLbound = 0; rgsabound[0].cElements = n; VARIANT oleElement; long safeI[1]; - + pArray = SafeArrayCreate(VT_VARIANT, 1, rgsabound); - + Any unoElement; - // sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->pElements; + // sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->pElements; sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->elements; - + for (sal_uInt32 i = 0; i < n; i++) { unoElement.setValue( pSeqData + i * nElementSize, pSeqElementDesc); VariantInit(&oleElement); - + anyToVariant(&oleElement, unoElement); - + safeI[0] = i; SafeArrayPutElement(pArray, safeI, &oleElement); - + VariantClear(&oleElement); } } TYPELIB_DANGER_RELEASE( pSeqElementDesc); - - return pArray; + + return pArray; } /* The argument rObj can contain @@ -1383,7 +1383,7 @@ template<class T> void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT * pVar) { MutexGuard guard(getBridgeMutex()); - + Reference<XInterface> xInt; TypeClass tc = rObj.getValueTypeClass(); @@ -1392,7 +1392,7 @@ void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT OUSTR("[automation bridge]UnoConversionUtilities<T>::createUnoObjectWrapper \n" "Cannot create an Automation interface for a UNO type which is not " "a struct or interface!"), 0, -1); - + if (rObj.getValueTypeClass() == TypeClass_INTERFACE) { if (! (rObj >>= xInt)) @@ -1409,7 +1409,7 @@ void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT //make sure we have the main XInterface which is used with a map xInt = Reference<XInterface>(xInt, UNO_QUERY); //If there is already a wrapper for the UNO object then use it - + Reference<XInterface> xIntWrapper; // Does a UNO wrapper exist already ? IT_Uno it_uno = UnoObjToWrapperMap.find( (sal_uInt32) xInt.get()); @@ -1422,7 +1422,7 @@ void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT return; } } - // Is the object a COM wrapper ( either XInvocation, or Adapter object) + // Is the object a COM wrapper ( either XInvocation, or Adapter object) // or does it suppy an IDispatch by its own ? else { @@ -1453,15 +1453,15 @@ void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT xInv= Reference<XInvocation>(xInt, UNO_QUERY); } } - + if (xInv.is()) - { + { Reference<XInterface> xNewWrapper = createUnoWrapperInstance(); Reference<XInitialization> xInitWrapper(xNewWrapper, UNO_QUERY); if (xInitWrapper.is()) { VARTYPE vartype= getVarType( rObj); - + if (xInt.is()) { Any params[3]; @@ -1477,7 +1477,7 @@ void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT params[1] <<= vartype; xInitWrapper->initialize( Sequence<Any>(params, 2)); } - + // put the newly created object into a map. If the same object will // be mapped again and there is already a wrapper then the old wrapper // will be used. @@ -1488,9 +1488,9 @@ void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT } } } - + template<class T> -void UnoConversionUtilities<T>::variantToAny( const VARIANT* pVariant, Any& rAny, +void UnoConversionUtilities<T>::variantToAny( const VARIANT* pVariant, Any& rAny, sal_Bool bReduceValueRange /* = sal_True */) { HRESULT hr = S_OK; @@ -1503,21 +1503,21 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANT* pVariant, Any& rAny throw BridgeRuntimeError( OUSTR("[automation bridge] UnoConversionUtilities<T>::variantToAny \n" "VariantCopyInd failed for reason : ") + OUString::valueOf(hr)); - + if ( ! convertValueObject( & var, rAny)) { if ((var.vt & VT_ARRAY) > 0) { VARTYPE oleTypeFlags = ::sal::static_int_cast< VARTYPE, int >( var.vt ^ VT_ARRAY ); - + Sequence<Any> unoSeq = createOleArrayWrapper(var.parray, oleTypeFlags); rAny.setValue( &unoSeq, getCppuType( &unoSeq)); } else { - switch (var.vt) + switch (var.vt) { - case VT_EMPTY: + case VT_EMPTY: rAny.setValue(NULL, Type()); break; case VT_NULL: @@ -1633,7 +1633,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANT* pVariant, Any& rAny rAny <<= dec; break; } - + default: break; } @@ -1665,7 +1665,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANT* pVariant, Any& rAny "UnoConversionUtilities<T>::variantToAny !")); } -} +} // The function converts an IUnknown* into an UNO interface or struct. The // IUnknown pointer can constitute different kind of objects: // 1. a wrapper of an UNO struct (the wrapper was created by this bridge) @@ -1673,27 +1673,27 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANT* pVariant, Any& rAny // 3. a dispatch object that implements UNO interfaces // 4. a dispatch object. -// If the parameter "aType" has a value then the COM object ( pUnknown) is supposed to -// implement the interface described by "aType". Moreover it ( pUnknown) can implement +// If the parameter "aType" has a value then the COM object ( pUnknown) is supposed to +// implement the interface described by "aType". Moreover it ( pUnknown) can implement // several other // UNO interfaces in which case it has to support the SUPPORTED_INTERFACES_PROP (see // #define) property. That property contains all names of interfaces. -// "pUnknown" is wrapped by a COM wrapper object that implements XInvocation, e.g. +// "pUnknown" is wrapped by a COM wrapper object that implements XInvocation, e.g. // IUnknownWrapper_Impl. Additionally an object of type "aType" is created by help // of the INTERFACE_ADAPTER_FACTORY (see #define) service. The implementation of // "aType" calls on the COM wrapper's XInvocation::invoke. If the COM object supports -// more then one UNO interfaces, as can be determined by the property +// more then one UNO interfaces, as can be determined by the property // SUPPORTED_INTERFACES_PROP, then the INTERFACE_ADAPTER_FACTORY creates an object that // implements all these interfaces. -// This is only done if "pUnknown" is not already a UNO wrapper, +// This is only done if "pUnknown" is not already a UNO wrapper, // that is it is actually NOT an UNO object that was converted to a COM object. If it is an // UNO wrapper than the original UNO object is being extracted, queried for "aType" (if // it is no struct) and returned. template<class T> #ifdef __MINGW32__ -Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type& aType) +Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type& aType) #else -Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type& aType= Type()) +Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type& aType= Type()) #endif { //To allow passing "Nothing" in VS 2008 we need to accept VT_EMPTY @@ -1706,7 +1706,7 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type& CComPtr<IUnknown> spUnknown; CComPtr<IDispatch> spDispatch; - + if (pVar->vt == VT_UNKNOWN) { spUnknown = pVar->punkVal; @@ -1727,7 +1727,7 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type& spDispatch.QueryInterface( & spUnknown.p); #endif } - + static Type VOID_TYPE= Type(); Any ret; //If no Type is provided and pVar contains IUnknown then we return a XInterface. @@ -1747,12 +1747,12 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type& break; default: desiredType = aType; - } + } } // COM pointer are NULL, no wrapper required if (spUnknown == NULL) - { + { Reference<XInterface> xInt; if( aType.getTypeClass() == TypeClass_INTERFACE) ret.setValue( &xInt, aType); @@ -1762,8 +1762,8 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type& ret <<= xInt; return ret; } - - + + // Check if "spUnknown" is a UNO wrapper, that is an UNO object that has been // passed to COM. Then it supports IUnoObjectWrapper // and we extract the original UNO object. @@ -1787,7 +1787,7 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type& } return ret; } - + // "spUnknown" is a real COM object. // Before we create a new wrapper object we check if there is an existing wrapper // There can be two kinds of wrappers, those who wrap dispatch - UNO objects, and those who @@ -1814,7 +1814,7 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type& if (seqTypes.getLength() > 0) { //It is a COM UNO object - xIntAdapter = createAdapter(seqTypes, xIntWrapper); + xIntAdapter = createAdapter(seqTypes, xIntWrapper); } else { @@ -1840,7 +1840,7 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type& "The COM object is not suitable for the UNO type: ") + desiredType.getTypeName(), 0, -1); } - + return ret; } // No existing wrapper. Therefore create a new proxy. @@ -1859,7 +1859,7 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type& OUSTR("[automation bridge]UnoConversionUtilities<T>::createOleObjectWrapper \n" "Could not create proxy object for COM object!")); - // initialize the COM wrapper + // initialize the COM wrapper Reference<XInitialization> xInit( xIntNewProxy, UNO_QUERY); OSL_ASSERT( xInit.is()); @@ -1872,29 +1872,29 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type& sal_Bool bDisp = pVar->vt == VT_DISPATCH ? sal_True : sal_False; params[1].setValue( & bDisp, getBooleanCppuType()); params[2] <<= seqTypes; - + xInit->initialize( Sequence<Any>( params, 3)); #ifdef __MINGW32__ - ComPtrToWrapperMap[reinterpret_cast<sal_uInt32>( spUnknown.p )]= xIntNewProxy; + ComPtrToWrapperMap[reinterpret_cast<sal_uInt32>( spUnknown.p )]= xIntNewProxy; #else - ComPtrToWrapperMap[reinterpret_cast<sal_uInt32>(spUnknown.p)]= xIntNewProxy; + ComPtrToWrapperMap[reinterpret_cast<sal_uInt32>(spUnknown.p)]= xIntNewProxy; #endif - + // we have a wrapper object //The wrapper implements already XInvocation and XInterface. If - //param aType is void then the object is supposed to have XInvocation. + //param aType is void then the object is supposed to have XInvocation. if (aType == getCppuType((Reference<XInvocation>*)0) || (aType == VOID_TYPE && seqTypes.getLength() == 0 )) { ret = xIntNewProxy->queryInterface(desiredType); } - else + else { Reference<XInterface> xIntAdapter = createAdapter(seqTypes, xIntNewProxy); ret = xIntAdapter->queryInterface(desiredType); } - return ret; + return ret; } template<class T> Reference<XInterface> UnoConversionUtilities<T>::createAdapter(const Sequence<Type>& seqTypes, @@ -1903,18 +1903,18 @@ Reference<XInterface> UnoConversionUtilities<T>::createAdapter(const Sequence<Ty Reference< XInterface> xIntAdapterFac; xIntAdapterFac= m_smgr->createInstance(INTERFACE_ADAPTER_FACTORY); // We create an adapter object that does not only implement the required type but also - // all types that the COM object pretends to implement. An COM object must therefore - // support the property "_implementedInterfaces". + // all types that the COM object pretends to implement. An COM object must therefore + // support the property "_implementedInterfaces". Reference<XInterface> xIntAdapted; Reference<XInvocation> xInv(receiver, UNO_QUERY); Reference<XInvocationAdapterFactory2> xAdapterFac( xIntAdapterFac, UNO_QUERY); if( xAdapterFac.is()) xIntAdapted= xAdapterFac->createAdapter( xInv, seqTypes); - + if( xIntAdapted.is()) { // Put the pointer to the wrapper object and the interface pointer of the adapted interface - // in a global map. Thus we can determine in a call to createUnoObjectWrapper whether the UNO + // in a global map. Thus we can determine in a call to createUnoObjectWrapper whether the UNO // object is a wrapped COM object. In that case we extract the original COM object rather than // creating a wrapper around the UNO object. typedef hash_map<sal_uInt32,sal_uInt32>::value_type VALUE; @@ -1929,8 +1929,8 @@ Reference<XInterface> UnoConversionUtilities<T>::createAdapter(const Sequence<Ty } return xIntAdapted; } -// "convertValueObject" converts a JScriptValue object contained in "var" into -// an any. The type contained in the any is stipulated by a "type value" thas +// "convertValueObject" converts a JScriptValue object contained in "var" into +// an any. The type contained in the any is stipulated by a "type value" thas // was set within the JScript script on the value object ( see JScriptValue). template<class T> bool UnoConversionUtilities<T>::convertValueObject( const VARIANTARG *var, Any& any) @@ -1941,7 +1941,7 @@ bool UnoConversionUtilities<T>::convertValueObject( const VARIANTARG *var, Any& bool bFail = false; HRESULT hr= S_OK; CComVariant varDisp; - + if(SUCCEEDED(hr = varDisp.ChangeType( VT_DISPATCH, var))) { CComPtr <IJScriptValueObject> spValue; @@ -1951,7 +1951,7 @@ bool UnoConversionUtilities<T>::convertValueObject( const VARIANTARG *var, Any& CComPtr<IDispatch> spDisp( varDisp.pdispVal); if(spDisp) { - if(SUCCEEDED( spDisp->QueryInterface( __uuidof( IJScriptValueObject), + if(SUCCEEDED( spDisp->QueryInterface( __uuidof( IJScriptValueObject), reinterpret_cast<void**> (&spValue)))) { ret = true; // is is a ValueObject @@ -1975,13 +1975,13 @@ bool UnoConversionUtilities<T>::convertValueObject( const VARIANTARG *var, Any& } } else - bFail = true;; + bFail = true;; } } } else if( hr != DISP_E_TYPEMISMATCH && hr != E_NOINTERFACE) bFail = true; - + if (bFail) throw BridgeRuntimeError( OUSTR("[automation bridge] Conversion of ValueObject failed ")); @@ -2016,19 +2016,19 @@ void UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pva "Conversion of dispatch object to Sequence failed!")); IDispatchEx* pdispEx; HRESULT hr; - if( FAILED( hr= pvar->pdispVal->QueryInterface( IID_IDispatchEx, + if( FAILED( hr= pvar->pdispVal->QueryInterface( IID_IDispatchEx, reinterpret_cast<void**>( &pdispEx)))) throw BridgeRuntimeError(OUSTR("[automation bridge] UnoConversionUtilities<T>::dispatchExObject2Sequence \n" "Conversion of dispatch object to Sequence failed!")); - + DISPID dispid; OUString sindex; DISPPARAMS param= {0,0,0,0}; CComVariant result; - + OLECHAR* sLength= L"length"; - - // Get the length of the array. Can also be obtained throu GetNextDispID. The + + // Get the length of the array. Can also be obtained throu GetNextDispID. The // method only returns DISPIDs of the array data. Their names are like "0", "1" etc. if( FAILED( hr= pdispEx->GetIDsOfNames(IID_NULL, &sLength , 1, LOCALE_USER_DEFAULT, &dispid))) throw BridgeRuntimeError(OUSTR("[automation bridge] UnoConversionUtilities<T>::dispatchExObject2Sequence \n" @@ -2036,20 +2036,20 @@ void UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pva if( FAILED( hr= pdispEx->InvokeEx(dispid, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, ¶m, &result, NULL, NULL))) throw BridgeRuntimeError(OUSTR("[automation bridge] UnoConversionUtilities<T>::dispatchExObject2Sequence \n" - "Conversion of dispatch object to Sequence failed!")); + "Conversion of dispatch object to Sequence failed!")); if( FAILED( VariantChangeType( &result, &result, 0, VT_I4))) throw BridgeRuntimeError(OUSTR("[automation bridge] UnoConversionUtilities<T>::dispatchExObject2Sequence \n" - "Conversion of dispatch object to Sequence failed!")); + "Conversion of dispatch object to Sequence failed!")); long length= result.lVal; result.Clear(); - + // get a few basic facts about the sequence, and reallocate: // create the Sequences // get the size of the elements typelib_TypeDescription *pDesc= NULL; type.getDescription( &pDesc); - + typelib_IndirectTypeDescription *pSeqDesc= reinterpret_cast<typelib_IndirectTypeDescription*>(pDesc); typelib_TypeDescriptionReference *pSeqElemDescRef= pSeqDesc->pType; // type of the Sequence' elements Type elemType( pSeqElemDescRef); @@ -2057,41 +2057,41 @@ void UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pva TYPELIB_DANGER_GET( &pSeqElemDesc, pSeqElemDescRef) sal_uInt32 nelementSize= pSeqElemDesc->nSize; TYPELIB_DANGER_RELEASE( pSeqElemDesc) - + uno_Sequence *p_uno_Seq; uno_sequence_construct( &p_uno_Seq, pDesc, NULL, length, cpp_acquire); - + typelib_TypeClass typeElement= pSeqDesc->pType->eTypeClass; char *pArray= p_uno_Seq->elements; - + // Get All properties in the object, convert their values to the expected type and // put them into the passed in sequence for( sal_Int32 i= 0; i< length; i++) { OUString ousIndex=OUString::valueOf( i); OLECHAR* sindex = (OLECHAR*)ousIndex.getStr(); - + if( FAILED( hr= pdispEx->GetIDsOfNames(IID_NULL, &sindex , 1, LOCALE_USER_DEFAULT, &dispid))) { throw BridgeRuntimeError(OUSTR("[automation bridge] UnoConversionUtilities<T>::dispatchExObject2Sequence \n" - "Conversion of dispatch object to Sequence failed!")); + "Conversion of dispatch object to Sequence failed!")); } if( FAILED( hr= pdispEx->InvokeEx(dispid, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, ¶m, &result, NULL, NULL))) { throw BridgeRuntimeError(OUSTR("[automation bridge] UnoConversionUtilities<T>::dispatchExObject2Sequence \n" "Conversion of dispatch object to Sequence failed!")); - } - + } + // If the result is VT_DISPATCH than the Sequence's element type could be Sequence // Look that up in the CoreReflection to make clear. // That requires a recursiv conversion - Any any; + Any any; // Destination address within the out-Sequence "anySeq" where to copy the next converted element void* pDest= (void*)(pArray + (i * nelementSize)); - + if( result.vt & VT_DISPATCH && typeElement == typelib_TypeClass_SEQUENCE) - { + { variantToAny( &result, any, elemType, sal_False); // copy the converted VARIANT, that is a Sequence to the Sequence uno_Sequence * p_unoSeq= *(uno_Sequence**)any.getValue(); @@ -2100,7 +2100,7 @@ void UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pva memcpy( pDest, &p_unoSeq, nelementSize); osl_incrementInterlockedCount( &p_unoSeq->nRefCount); } - else // Element type is no Sequence -> do one conversion + else // Element type is no Sequence -> do one conversion { variantToAny( &result, any, elemType, sal_False); if( typeElement == typelib_TypeClass_ANY) @@ -2122,7 +2122,7 @@ void UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pva anySeq.setValue( &p_uno_Seq, pDesc); uno_destructData( &p_uno_Seq, pDesc, cpp_release); typelib_typedescription_release( pDesc); - + if (bFail) throw BridgeRuntimeError( OUSTR("[automation bridge] Conversion of ValueObject failed ")); @@ -2148,7 +2148,7 @@ void UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pva /* The argument unotype is the type that is expected by the currently called UNO function. For example: []long, [][]long. If the function calls itself recursively then the element type is passed on. For example a two dimensional SAFEARRAY of type VT_I4 is to be converted. Then - unotype has to be either void or [][]long. When the function calls itself recursivly then + unotype has to be either void or [][]long. When the function calls itself recursivly then it passes the element type which is []long. */ template<class T> @@ -2164,14 +2164,14 @@ Sequence<Any> UnoConversionUtilities<T>::createOleArrayWrapperOfDim(SAFEARRAY* p SafeArrayGetUBound(pArray, actDim, &uBound); nCountElements= uBound - lBound +1; - Sequence<Any> anySeq(nCountElements); - Any* pUnoArray = anySeq.getArray(); - + Sequence<Any> anySeq(nCountElements); + Any* pUnoArray = anySeq.getArray(); + for (index[actDim - 1] = lBound; index[actDim - 1] <= uBound; index[actDim - 1]++) { if (actDim > 1 ) { - Sequence<Any> element = createOleArrayWrapperOfDim(pArray, dimCount, + Sequence<Any> element = createOleArrayWrapperOfDim(pArray, dimCount, actDim - 1, index, type, getElementTypeOfSequence(unotype)); pUnoArray[index[actDim - 1] - lBound].setValue(&element, getCppuType(&element)); @@ -2179,7 +2179,7 @@ Sequence<Any> UnoConversionUtilities<T>::createOleArrayWrapperOfDim(SAFEARRAY* p else { VARIANT variant; - + VariantInit(&variant); V_VT(&variant) = type; @@ -2236,18 +2236,18 @@ Sequence<Any> UnoConversionUtilities<T>::createOleArrayWrapperOfDim(SAFEARRAY* p break; default: break; - } + } if( unotype.getTypeClass() == TypeClass_VOID) // the function was called without specifying the destination type variantToAny(&variant, pUnoArray[index[actDim - 1] - lBound], sal_False); else - variantToAny(&variant, pUnoArray[index[actDim - 1] - lBound], + variantToAny(&variant, pUnoArray[index[actDim - 1] - lBound], getElementTypeOfSequence(unotype), sal_False); VariantClear(&variant); } - } + } return anySeq; } @@ -2280,12 +2280,12 @@ Sequence<Any> UnoConversionUtilities<T>::createOleArrayWrapper(SAFEARRAY* pArray for (unsigned int i = 0; i < dim; i++) { index[i] = 0; - } - - ret = createOleArrayWrapperOfDim(pArray, dim, dim, index, type, unoType); + } + + ret = createOleArrayWrapperOfDim(pArray, dim, dim, index, type, unoType); } - - return ret; + + return ret; } // If an VARIANT has the type VT_DISPATCH it can either be an JScript Array @@ -2303,15 +2303,15 @@ sal_Bool UnoConversionUtilities<T>::isJScriptArray(const VARIANT* rvar) DISPID id; if ( rvar->vt == VT_DISPATCH && rvar->pdispVal ) { - hr= rvar->pdispVal->GetIDsOfNames( IID_NULL, &sindex, 1, + hr= rvar->pdispVal->GetIDsOfNames( IID_NULL, &sindex, 1, LOCALE_USER_DEFAULT, &id); - + if( SUCCEEDED ( hr) ) return sal_True; } return sal_False; -} +} template<class T> VARTYPE UnoConversionUtilities<T>::mapTypeClassToVartype( TypeClass type) @@ -2331,7 +2331,7 @@ VARTYPE UnoConversionUtilities<T>::mapTypeClassToVartype( TypeClass type) break; case TypeClass_BOOLEAN: ret= VT_BOOL; break; - case TypeClass_CHAR: ret= VT_I2; + case TypeClass_CHAR: ret= VT_I2; break; case TypeClass_STRING: ret= VT_BSTR; break; @@ -2365,13 +2365,13 @@ Sequence<Type> UnoConversionUtilities<T>::getImplementedInterfaces(IUnknown* pUn CComVariant var; HRESULT hr= S_OK; // There are two different property names possible. - if( FAILED( hr= disp.GetPropertyByName( SUPPORTED_INTERFACES_PROP, &var))) + if( FAILED( hr= disp.GetPropertyByName( SUPPORTED_INTERFACES_PROP, &var))) { hr= disp.GetPropertyByName( SUPPORTED_INTERFACES_PROP2, &var); } if (SUCCEEDED( hr)) { - // we exspect an array( SafeArray or IDispatch) of Strings. + // we exspect an array( SafeArray or IDispatch) of Strings. Any anyNames; variantToAny( &var, anyNames, getCppuType( (Sequence<Any>*) 0)); Sequence<Any> seqAny; @@ -2409,12 +2409,12 @@ Reference<XTypeConverter> UnoConversionUtilities<T>::getTypeConverter() // This function tries to the change the type of a value (contained in the Any) // to the smallest possible that can hold the value. This is actually done only // for types of VT_I4 (see o2u_variantToAny). The reason is the following: -// JavaScript passes integer values always as VT_I4. If there is a parameter or +// JavaScript passes integer values always as VT_I4. If there is a parameter or // property of type any then the bridge converts the any's content according // to "o2u_variantToAny". Because the VARTYPE is VT_I4 the value would be converted // to TypeClass_LONG. Say the method XPropertySet::setPropertyValue( string name, any value) -// would be called on an object and the property actually is of TypeClass_SHORT. -// After conversion of the VARIANT parameter the Any would contain type +// would be called on an object and the property actually is of TypeClass_SHORT. +// After conversion of the VARIANT parameter the Any would contain type // TypeClass_LONG. Because the corereflection does not cast from long to short // the "setPropertValue" would fail as the value has not the right type. diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index cae9ecb5caa3..9cd131487dc4 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -90,7 +90,7 @@ hash_map<sal_uInt32, WeakReference<XInterface> > UnoObjToWrapperMap; static sal_Bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource); static sal_Bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource); static HRESULT mapCannotConvertException( CannotConvertException e, unsigned int * puArgErr); - + /* Does not throw any exceptions. Param pInfo can be NULL. @@ -108,7 +108,7 @@ static void writeExcepinfo(EXCEPINFO * pInfo, const OUString& message) /***************************************************************************** class implementation: InterfaceOleWrapper_Impl - + *****************************************************************************/ InterfaceOleWrapper_Impl::InterfaceOleWrapper_Impl( Reference<XMultiServiceFactory>& xFactory, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass): @@ -127,9 +127,9 @@ InterfaceOleWrapper_Impl::~InterfaceOleWrapper_Impl() #if OSL_DEBUG_LEVEL > 0 fprintf(stderr,"[automation bridge] UnoObjToWrapperMap contains: %i \n", UnoObjToWrapperMap.size()); -#endif - -} +#endif + +} STDMETHODIMP InterfaceOleWrapper_Impl::QueryInterface(REFIID riid, LPVOID FAR * ppv) { @@ -142,7 +142,7 @@ STDMETHODIMP InterfaceOleWrapper_Impl::QueryInterface(REFIID riid, LPVOID FAR * { AddRef(); *ppv = (IUnknown*) (IDispatch*) this; - } + } else if (IsEqualIID(riid, IID_IDispatch)) { AddRef(); @@ -156,7 +156,7 @@ STDMETHODIMP InterfaceOleWrapper_Impl::QueryInterface(REFIID riid, LPVOID FAR * else ret= E_NOINTERFACE; return ret; -} +} STDMETHODIMP_(ULONG) InterfaceOleWrapper_Impl::AddRef() { @@ -164,14 +164,14 @@ STDMETHODIMP_(ULONG) InterfaceOleWrapper_Impl::AddRef() // does not need to guard because one should not rely on the return value of // AddRef anyway return m_refCount; -} +} STDMETHODIMP_(ULONG) InterfaceOleWrapper_Impl::Release() { ULONG n= m_refCount; release(); return n - 1; -} +} // IUnoObjectWrapper -------------------------------------------------------- STDMETHODIMP InterfaceOleWrapper_Impl::getWrapperXInterface( Reference<XInterface>* pXInt) @@ -206,17 +206,17 @@ STDMETHODIMP InterfaceOleWrapper_Impl::getOriginalUnoStruct( Any * pStruct) STDMETHODIMP InterfaceOleWrapper_Impl::GetTypeInfoCount( unsigned int * /*pctinfo*/ ) { return E_NOTIMPL ; -} +} STDMETHODIMP InterfaceOleWrapper_Impl::GetTypeInfo(unsigned int /*itinfo*/, LCID /*lcid*/, ITypeInfo ** /*pptinfo*/) { return E_NOTIMPL; -} +} -STDMETHODIMP InterfaceOleWrapper_Impl::GetIDsOfNames(REFIID /*riid*/, - OLECHAR ** rgszNames, +STDMETHODIMP InterfaceOleWrapper_Impl::GetIDsOfNames(REFIID /*riid*/, + OLECHAR ** rgszNames, unsigned int cNames, - LCID /*lcid*/, + LCID /*lcid*/, DISPID * rgdispid ) { HRESULT ret = DISP_E_UNKNOWNNAME; @@ -227,7 +227,7 @@ STDMETHODIMP InterfaceOleWrapper_Impl::GetIDsOfNames(REFIID /*riid*/, return E_POINTER; // ---------------------------------------- - if( ! _wcsicmp( *rgszNames, JSCRIPT_VALUE_FUNC) || + if( ! _wcsicmp( *rgszNames, JSCRIPT_VALUE_FUNC) || ! _wcsicmp( *rgszNames, BRIDGE_VALUE_FUNC)) { *rgdispid= DISPID_JSCRIPT_VALUE_FUNC; @@ -250,46 +250,46 @@ STDMETHODIMP InterfaceOleWrapper_Impl::GetIDsOfNames(REFIID /*riid*/, { OUString name(reinterpret_cast<const sal_Unicode*>(rgszNames[0])); NameToIdMap::iterator iter = m_nameToDispIdMap.find(name); - + if (iter == m_nameToDispIdMap.end()) { OUString exactName; - + if (m_xExactName.is()) { exactName = m_xExactName->getExactName(name); } else - { + { exactName = name; } - + MemberInfo d(0, exactName); - + if (m_xInvocation->hasProperty(exactName)) { - d.flags |= DISPATCH_PROPERTYGET; + d.flags |= DISPATCH_PROPERTYGET; d.flags |= DISPATCH_PROPERTYPUT; d.flags |= DISPATCH_PROPERTYPUTREF; } - + if (m_xInvocation->hasMethod(exactName)) { - d.flags |= DISPATCH_METHOD; + d.flags |= DISPATCH_METHOD; } - + if (d.flags != 0) { m_MemberInfos.push_back(d); iter = m_nameToDispIdMap.insert(NameToIdMap::value_type(exactName, (DISPID)m_MemberInfos.size())).first; - + if (exactName != name) { iter = m_nameToDispIdMap.insert(NameToIdMap::value_type(name, (DISPID)m_MemberInfos.size())).first; } - } + } } - + if (iter == m_nameToDispIdMap.end()) { ret = DISP_E_UNKNOWNNAME; @@ -299,7 +299,7 @@ STDMETHODIMP InterfaceOleWrapper_Impl::GetIDsOfNames(REFIID /*riid*/, *rgdispid = (*iter).second; ret = S_OK; } - } + } } catch(BridgeRuntimeError& ) { @@ -315,12 +315,12 @@ STDMETHODIMP InterfaceOleWrapper_Impl::GetIDsOfNames(REFIID /*riid*/, } return ret; -} - +} + // "convertDispparamsArgs" converts VARIANTS to their respecting Any counterparts -// The parameters "id", "wFlags" and "pdispparams" equal those as used in -// IDispatch::Invoke. The function handles special JavaScript -// cases where a VARIANT of type VT_DISPATCH is ambiguous and could represent +// The parameters "id", "wFlags" and "pdispparams" equal those as used in +// IDispatch::Invoke. The function handles special JavaScript +// cases where a VARIANT of type VT_DISPATCH is ambiguous and could represent // an object, array ( JavaScript Array object), out parameter and in/out ( JavaScript Array object) // parameter (JavaScript Array object) // Because all those VT_DISPATCH objects need a different conversion @@ -329,10 +329,10 @@ STDMETHODIMP InterfaceOleWrapper_Impl::GetIDsOfNames(REFIID /*riid*/, // A. Type Information // ----------------------------------------------------------------------------- -// With the help of type information the kind of parameter can be exactly determined -// and an appropriate conversion can be choosen. A problem arises if a method expects -// an Any. Then the type info does not tell what the type of the value, that is kept -// by the any, should be. In this situation the decision wheter the param is a +// With the help of type information the kind of parameter can be exactly determined +// and an appropriate conversion can be choosen. A problem arises if a method expects +// an Any. Then the type info does not tell what the type of the value, that is kept +// by the any, should be. In this situation the decision wheter the param is a // sequence or an object is made upon the fact if the object has a property "0" // ( see function "isJScriptArray"). Since this is unsafe it is recommended to use // the JScript value objects within a JScript script on such an occasion. @@ -340,18 +340,18 @@ STDMETHODIMP InterfaceOleWrapper_Impl::GetIDsOfNames(REFIID /*riid*/, // B. JavaScript Value Object ( class JScriptValue ) // ----------------------------------------------------------------------------- // A JScriptValue (ValueObject) object is a COM object in that it implements IDispatch and the -// IJScriptValue object interface. Such objects are provided by all UNO wrapper +// IJScriptValue object interface. Such objects are provided by all UNO wrapper // objects used within a JScript script. To obtain an instance one has to call // "_GetValueObject() or Bridge_GetValueObject()" on an UNO wrapper object (class InterfaceOleWrapper_Impl). -// A value object is appropriately initialized within the script and passed as +// A value object is appropriately initialized within the script and passed as // parameter to an UNO object method or property. The convertDispparamsArgs function -// can easily find out that a param is such an object by queriing for the +// can easily find out that a param is such an object by queriing for the // IJScriptValue interface. By this interface one the type and kind ( out, in/out) -// can be determined and the right conversion can be applied. +// can be determined and the right conversion can be applied. // Using ValueObjects we spare us the effort of aquiring and examining type information // in order to figure out what the an IDispatch parameter is meant for. -// Normal JScript object parameter can be mixed with JScriptValue object. If an +// Normal JScript object parameter can be mixed with JScriptValue object. If an // VARIANT contains an VT_DISPATCH that is no JScriptValue than the type information // is used to find out about the reqired type. void InterfaceOleWrapper_Impl::convertDispparamsArgs(DISPID id, @@ -359,11 +359,11 @@ void InterfaceOleWrapper_Impl::convertDispparamsArgs(DISPID id, { HRESULT hr= S_OK; sal_Int32 countArgs= pdispparams->cArgs; - if( countArgs == 0) + if( countArgs == 0) return; - + rSeq.realloc( countArgs); - Any* pParams = rSeq.getArray(); + Any* pParams = rSeq.getArray(); Any anyParam; @@ -373,14 +373,14 @@ void InterfaceOleWrapper_Impl::convertDispparamsArgs(DISPID id, throw BridgeRuntimeError( OUSTR("[automation bridge]InterfaceOleWrapper_Impl::convertDispparamsArgs \n" "Could not obtain type information for current call.")); - + for (int i = 0; i < countArgs; i++) { if (info.eMemberType == MemberType_METHOD && info.aParamModes[ countArgs - i -1 ] == ParamMode_OUT) continue; - if(convertValueObject( & pdispparams->rgvarg[i], anyParam)) + if(convertValueObject( & pdispparams->rgvarg[i], anyParam)) { //a param is a ValueObject and could be converted pParams[countArgs - (i + 1)] = anyParam; continue; @@ -389,13 +389,13 @@ void InterfaceOleWrapper_Impl::convertDispparamsArgs(DISPID id, // If the param is an out, in/out parameter in // JScript (Array object, with value at index 0) then we // extract Array[0] and put the value into varParam. At the end of the loop varParam - // is converted if it contains a value otherwise the VARIANT from + // is converted if it contains a value otherwise the VARIANT from // DISPPARAMS is converted. CComVariant varParam; // Check for JScript out and in/out paramsobjects (VT_DISPATCH). // To find them out we use typeinformation of the function being called. - if( pdispparams->rgvarg[i].vt == VT_DISPATCH ) + if( pdispparams->rgvarg[i].vt == VT_DISPATCH ) { if( info.eMemberType == MemberType_METHOD && info.aParamModes[ countArgs - i -1 ] == ParamMode_INOUT) { @@ -404,12 +404,12 @@ void InterfaceOleWrapper_Impl::convertDispparamsArgs(DISPID id, // Array object. // Get the IN-param at index "0" IDispatch* pdisp= pdispparams->rgvarg[i].pdispVal; - + OLECHAR* sindex= L"0"; DISPID id; DISPPARAMS noParams= {0,0,0,0}; if(SUCCEEDED( hr= pdisp->GetIDsOfNames( IID_NULL, &sindex, 1, LOCALE_USER_DEFAULT, &id))) - hr= pdisp->Invoke( id, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, + hr= pdisp->Invoke( id, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, & noParams, & varParam, NULL, NULL); if( FAILED( hr)) { @@ -431,27 +431,27 @@ void InterfaceOleWrapper_Impl::convertDispparamsArgs(DISPID id, variantToAny( & varParam, anyParam, info.aType); else OSL_ASSERT(0); - + pParams[countArgs - (i + 1)]= anyParam; }// end for / iterating over all parameters } sal_Bool InterfaceOleWrapper_Impl::getInvocationInfoForCall( DISPID id, InvocationInfo& info) { - sal_Bool bTypesAvailable= sal_False; - + sal_Bool bTypesAvailable= sal_False; + if( !m_xInvocation.is() )return false; Reference<XInvocation2> inv2( m_xInvocation, UNO_QUERY); if( inv2.is()) { - // We need the name of the property or method to get its type information. + // We need the name of the property or method to get its type information. // The name can be identified through the param "id" - // that is kept as value in the map m_nameToDispIdMap. - // Proplem: the Windows JScript engine sometimes changes small letters to capital + // that is kept as value in the map m_nameToDispIdMap. + // Proplem: the Windows JScript engine sometimes changes small letters to capital // letters as happens in xidlclass_obj.createObject( var) // in JScript. // IDispatch::GetIdsOfNames is then called with "CreateObject" !!! // m_nameToDispIdMap can contain several names for one DISPID but only one is - // the exact one. If there's no m_xExactName and therefore no exact name then + // the exact one. If there's no m_xExactName and therefore no exact name then // there's only one entry in the map. typedef NameToIdMap::const_iterator cit; OUString sMemberName; @@ -463,7 +463,7 @@ sal_Bool InterfaceOleWrapper_Impl::getInvocationInfoForCall( DISPID id, Invocat sMemberName= (*ci1).first; break; } - } + } // Get information for the current call ( property or method). // There could be similar names which only differ in the cases // of letters. First we assume that the name which was passed into @@ -478,7 +478,7 @@ sal_Bool InterfaceOleWrapper_Impl::getInvocationInfoForCall( DISPID id, Invocat { validInfo= sal_False; } - + if( ! validInfo) { invInfo= inv2->getInfoForName( sMemberName, sal_True); @@ -496,20 +496,20 @@ sal_Bool InterfaceOleWrapper_Impl::getInvocationInfoForCall( DISPID id, Invocat // If sourceModelType is UNO than any UNO interface implemented by InterfaceOleWrapper_Impl // can bridged to IDispatch ( if destModelType == OLE). The IDispatch is // implemented by this class. -Any SAL_CALL InterfaceOleWrapper_Impl::createBridge(const Any& modelDepObject, - const Sequence<sal_Int8>& /*ProcessId*/, - sal_Int16 sourceModelType, - sal_Int16 destModelType) +Any SAL_CALL InterfaceOleWrapper_Impl::createBridge(const Any& modelDepObject, + const Sequence<sal_Int8>& /*ProcessId*/, + sal_Int16 sourceModelType, + sal_Int16 destModelType) throw (IllegalArgumentException, RuntimeException) { Any retAny; - if( sourceModelType == UNO && destModelType == OLE && + if( sourceModelType == UNO && destModelType == OLE && modelDepObject.getValueTypeClass() == TypeClass_INTERFACE ) { Reference<XInterface> xInt; if( modelDepObject >>= xInt ) - { + { if( xInt == Reference<XInterface>( static_cast<XWeak*>( this), UNO_QUERY)) { VARIANT *pVar= (VARIANT*)CoTaskMemAlloc( sizeof( VARIANT)); @@ -530,7 +530,7 @@ Any SAL_CALL InterfaceOleWrapper_Impl::createBridge(const Any& modelDepObject, // XInitialization -------------------------------------------------- -void SAL_CALL InterfaceOleWrapper_Impl::initialize( const Sequence< Any >& aArguments ) +void SAL_CALL InterfaceOleWrapper_Impl::initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException) { switch( aArguments.getLength() ) @@ -558,7 +558,7 @@ Reference< XInterface > InterfaceOleWrapper_Impl::createUnoWrapperInstance() Reference<XInterface> InterfaceOleWrapper_Impl::createComWrapperInstance() { - Reference<XWeak> xWeak= static_cast<XWeak*>( new IUnknownWrapper_Impl( + Reference<XWeak> xWeak= static_cast<XWeak*>( new IUnknownWrapper_Impl( m_smgr, m_nUnoWrapperClass, m_nComWrapperClass)); return Reference<XInterface>( xWeak, UNO_QUERY); } @@ -571,7 +571,7 @@ bool getType( const BSTR name, Type & type) { Type retType; bool ret = false; - typelib_TypeDescription * pDesc= NULL; + typelib_TypeDescription * pDesc= NULL; OUString str( reinterpret_cast<const sal_Unicode*>(name)); typelib_typedescription_getByName( &pDesc, str.pData ); if( pDesc) @@ -585,12 +585,12 @@ bool getType( const BSTR name, Type & type) static sal_Bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource) { - sal_Bool ret = sal_False; + sal_Bool ret = sal_False; HRESULT hr; // Handle JScriptValue objects and JScript out params ( Array object ) CComVariant varDest( *pDest); - + if( SUCCEEDED( varDest.ChangeType(VT_DISPATCH))) { CComPtr<IDispatch> spDispDest(varDest.pdispVal); @@ -604,9 +604,9 @@ static sal_Bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource) if (spValueDest) { VARIANT_BOOL varBool= VARIANT_FALSE; - if( SUCCEEDED( hr= spValueDest->IsOutParam( &varBool) ) - && varBool == VARIANT_TRUE || - SUCCEEDED(hr= spValueDest->IsInOutParam( &varBool) ) + if( SUCCEEDED( hr= spValueDest->IsOutParam( &varBool) ) + && varBool == VARIANT_TRUE || + SUCCEEDED(hr= spValueDest->IsInOutParam( &varBool) ) && varBool == VARIANT_TRUE ) { if( SUCCEEDED( spValueDest->Set( CComVariant(), *pSource))) @@ -635,7 +635,7 @@ static sal_Bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource) DISPID dispidPut = DISPID_PROPERTYPUT; dispparams.rgdispidNamedArgs = &dispidPut; - if (pSource->vt == VT_UNKNOWN || pSource->vt == VT_DISPATCH || + if (pSource->vt == VT_UNKNOWN || pSource->vt == VT_DISPATCH || (pSource->vt & VT_ARRAY) || (pSource->vt & VT_BYREF)) hr = spDispEx->InvokeEx(dwDispID, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPUTREF, &dispparams, NULL, NULL, NULL); @@ -651,7 +651,7 @@ static sal_Bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource) ret= writeBackOutParameter( pDest, pSource); } else // The param can't be a JScript out-parameter ( an Array object), it could be a VBScript - { // param. The function checks itself for correct VBScript params + { // param. The function checks itself for correct VBScript params ret= writeBackOutParameter( pDest, pSource); } return ret; @@ -663,13 +663,13 @@ static sal_Bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource) static sal_Bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource) { HRESULT hr; - sal_Bool ret = FALSE; + sal_Bool ret = FALSE; // Out parameter must be VT_BYREF if ((V_VT(pDest) & VT_BYREF) != 0 ) { VARTYPE oleTypeFlags = V_VT(pSource); - // if caller accept VARIANT as out parameter, any value must be converted + // if caller accept VARIANT as out parameter, any value must be converted if (V_VT(pDest) == (VT_VARIANT | VT_BYREF)) { // When the user provides a VARIANT rather then a concrete type @@ -677,11 +677,11 @@ static sal_Bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource) // VT_DISPATCH, VT_UNKNOWN, VT_ARRAY, VT_BSTR in the VARIANT that // is contained in pDest are released by VariantCopy VariantCopy(V_VARIANTREF(pDest), pSource); - ret = sal_True; + ret = sal_True; } - else + else { - // variantarg and variant must have same type + // variantarg and variant must have same type if ((V_VT(pDest) & oleTypeFlags) == oleTypeFlags) { if ((oleTypeFlags & VT_ARRAY) != 0) @@ -693,7 +693,7 @@ static sal_Bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource) // Out Param hr= SafeArrayCopy(V_ARRAY(pSource), V_ARRAYREF(pDest)) == NOERROR; if( SUCCEEDED( hr)) - ret = sal_True; + ret = sal_True; } else { @@ -703,88 +703,88 @@ static sal_Bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource) case VT_I2: { *V_I2REF(pDest) = V_I2(pSource); - ret = sal_True; + ret = sal_True; break; } case VT_I4: *V_I4REF(pDest) = V_I4(pSource); - ret = sal_True; + ret = sal_True; break; case VT_R4: *V_R4REF(pDest) = V_R4(pSource); - ret = sal_True; + ret = sal_True; break; case VT_R8: *V_R8REF(pDest) = V_R8(pSource); - ret = sal_True; + ret = sal_True; break; case VT_CY: *V_CYREF(pDest) = V_CY(pSource); - ret = sal_True; + ret = sal_True; break; case VT_DATE: *V_DATEREF(pDest) = V_DATE(pSource); - ret = sal_True; + ret = sal_True; break; case VT_BSTR: SysFreeString( *pDest->pbstrVal); - + *V_BSTRREF(pDest) = SysAllocString(V_BSTR(pSource)); - ret = sal_True; + ret = sal_True; break; case VT_DISPATCH: - if (*V_DISPATCHREF(pDest) != NULL) + if (*V_DISPATCHREF(pDest) != NULL) (*V_DISPATCHREF(pDest))->Release(); - + *V_DISPATCHREF(pDest) = V_DISPATCH(pSource); - - if (*V_DISPATCHREF(pDest) != NULL) + + if (*V_DISPATCHREF(pDest) != NULL) (*V_DISPATCHREF(pDest))->AddRef(); - - ret = sal_True; + + ret = sal_True; break; case VT_ERROR: *V_ERRORREF(pDest) = V_ERROR(pSource); - ret = sal_True; + ret = sal_True; break; case VT_BOOL: *V_BOOLREF(pDest) = V_BOOL(pSource); - ret = sal_True; + ret = sal_True; break; case VT_UNKNOWN: - if (*V_UNKNOWNREF(pDest) != NULL) + if (*V_UNKNOWNREF(pDest) != NULL) (*V_UNKNOWNREF(pDest))->Release(); - + *V_UNKNOWNREF(pDest) = V_UNKNOWN(pSource); - - if (*V_UNKNOWNREF(pDest) != NULL) + + if (*V_UNKNOWNREF(pDest) != NULL) (*V_UNKNOWNREF(pDest))->AddRef(); - - ret = sal_True; + + ret = sal_True; break; case VT_I1: *V_I1REF(pDest) = V_I1(pSource); - ret = sal_True; + ret = sal_True; break; case VT_UI1: *V_UI1REF(pDest) = V_UI1(pSource); - ret = sal_True; + ret = sal_True; break; case VT_UI2: *V_UI2REF(pDest) = V_UI2(pSource); - ret = sal_True; + ret = sal_True; break; case VT_UI4: *V_UI4REF(pDest) = V_UI4(pSource); - ret = sal_True; + ret = sal_True; break; case VT_INT: *V_INTREF(pDest) = V_INT(pSource); - ret = sal_True; + ret = sal_True; break; case VT_UINT: *V_UINTREF(pDest) = V_UINT(pSource); - ret = sal_True; + ret = sal_True; break; case VT_DECIMAL: memcpy(pDest->pdecVal, pSource, sizeof(DECIMAL)); @@ -816,14 +816,14 @@ static sal_Bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource) } } return ret; -} +} -STDMETHODIMP InterfaceOleWrapper_Impl::Invoke(DISPID dispidMember, - REFIID /*riid*/, - LCID /*lcid*/, +STDMETHODIMP InterfaceOleWrapper_Impl::Invoke(DISPID dispidMember, + REFIID /*riid*/, + LCID /*lcid*/, unsigned short wFlags, - DISPPARAMS * pdispparams, - VARIANT * pvarResult, + DISPPARAMS * pdispparams, + VARIANT * pvarResult, EXCEPINFO * pexcepinfo, unsigned int * puArgErr ) { @@ -841,33 +841,33 @@ STDMETHODIMP InterfaceOleWrapper_Impl::Invoke(DISPID dispidMember, { MemberInfo d = m_MemberInfos[dispidMember - 1]; DWORD flags = wFlags & d.flags; - + if (flags != 0) { if ((flags & DISPATCH_METHOD) != 0) { - if (pdispparams->cNamedArgs > 0) - ret = DISP_E_NONAMEDARGS; + if (pdispparams->cNamedArgs > 0) + ret = DISP_E_NONAMEDARGS; else { Sequence<Any> params; - + convertDispparamsArgs(dispidMember, wFlags, pdispparams , params ); - - ret= doInvoke(pdispparams, pvarResult, + + ret= doInvoke(pdispparams, pvarResult, pexcepinfo, puArgErr, d.name, params); } } else if ((flags & DISPATCH_PROPERTYGET) != 0) { - ret= doGetProperty( pdispparams, pvarResult, + ret= doGetProperty( pdispparams, pvarResult, pexcepinfo, d.name); } else if ((flags & DISPATCH_PROPERTYPUT || flags & DISPATCH_PROPERTYPUTREF) != 0) { if (pdispparams->cArgs != 1) ret = DISP_E_BADPARAMCOUNT; - else + else { Sequence<Any> params; convertDispparamsArgs(dispidMember, wFlags, pdispparams, params ); @@ -880,7 +880,7 @@ STDMETHODIMP InterfaceOleWrapper_Impl::Invoke(DISPID dispidMember, } else ret= DISP_E_MEMBERNOTFOUND; - } + } else ret = DISP_E_MEMBERNOTFOUND; } @@ -898,59 +898,59 @@ STDMETHODIMP InterfaceOleWrapper_Impl::Invoke(DISPID dispidMember, } catch(...) { - OUString message= OUSTR("InterfaceOleWrapper_Impl::Invoke : \n" + OUString message= OUSTR("InterfaceOleWrapper_Impl::Invoke : \n" "Unexpected exception"); writeExcepinfo(pexcepinfo, message); ret = DISP_E_EXCEPTION; } return ret; -} +} -HRESULT InterfaceOleWrapper_Impl::doInvoke( DISPPARAMS * pdispparams, VARIANT * pvarResult, +HRESULT InterfaceOleWrapper_Impl::doInvoke( DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString& name, Sequence<Any>& params) { - + HRESULT ret= S_OK; try { - Sequence<INT16> outIndex; - Sequence<Any> outParams; - Any returnValue; - - if (pdispparams->cNamedArgs > 0) - return DISP_E_NONAMEDARGS; + Sequence<INT16> outIndex; + Sequence<Any> outParams; + Any returnValue; + + if (pdispparams->cNamedArgs > 0) + return DISP_E_NONAMEDARGS; // invoke method and take care of exceptions - returnValue = m_xInvocation->invoke(name, + returnValue = m_xInvocation->invoke(name, params, outIndex, - outParams); + outParams); - // try to write back out parameter + // try to write back out parameter if (outIndex.getLength() > 0) { const INT16* pOutIndex = outIndex.getConstArray(); const Any* pOutParams = outParams.getConstArray(); - + for (sal_Int32 i = 0; i < outIndex.getLength(); i++) { CComVariant variant; // Currently a Sequence is converted to an SafeArray of VARIANTs. anyToVariant( &variant, pOutParams[i]); - + // out parameter need special handling if they are VT_DISPATCH // and used in JScript int outindex= pOutIndex[i]; - writeBackOutParameter2(&(pdispparams->rgvarg[pdispparams->cArgs - 1 - outindex]), - &variant ); + writeBackOutParameter2(&(pdispparams->rgvarg[pdispparams->cArgs - 1 - outindex]), + &variant ); } } - + // write back return value - if (pvarResult != NULL) - anyToVariant(pvarResult, returnValue); + if (pvarResult != NULL) + anyToVariant(pvarResult, returnValue); } catch(IllegalArgumentException & e) //XInvocation::invoke { @@ -967,7 +967,7 @@ HRESULT InterfaceOleWrapper_Impl::doInvoke( DISPPARAMS * pdispparams, VARIANT * const Any& org = e.TargetException; Exception excTarget; org >>= excTarget; - OUString message= + OUString message= org.getValueType().getTypeName() + OUSTR(": ") + excTarget.Message; writeExcepinfo(pexcepinfo, message); ret = DISP_E_EXCEPTION; @@ -991,7 +991,7 @@ HRESULT InterfaceOleWrapper_Impl::doInvoke( DISPPARAMS * pdispparams, VARIANT * } catch( ... ) { - OUString message= OUSTR("InterfaceOleWrapper_Impl::doInvoke : \n" + OUString message= OUSTR("InterfaceOleWrapper_Impl::doInvoke : \n" "Unexpected exception"); writeExcepinfo(pexcepinfo, message); ret = DISP_E_EXCEPTION; @@ -999,7 +999,7 @@ HRESULT InterfaceOleWrapper_Impl::doInvoke( DISPPARAMS * pdispparams, VARIANT * return ret; } -HRESULT InterfaceOleWrapper_Impl::doGetProperty( DISPPARAMS * /*pdispparams*/, VARIANT * pvarResult, +HRESULT InterfaceOleWrapper_Impl::doGetProperty( DISPPARAMS * /*pdispparams*/, VARIANT * pvarResult, EXCEPINFO * pexcepinfo, OUString& name) { HRESULT ret= S_OK; @@ -1030,7 +1030,7 @@ HRESULT InterfaceOleWrapper_Impl::doGetProperty( DISPPARAMS * /*pdispparams*/, V } catch( ... ) { - OUString message= OUSTR("InterfaceOleWrapper_Impl::doInvoke : \n" + OUString message= OUSTR("InterfaceOleWrapper_Impl::doInvoke : \n" "Unexpected exception"); writeExcepinfo(pexcepinfo, message); ret = DISP_E_EXCEPTION; @@ -1038,15 +1038,15 @@ HRESULT InterfaceOleWrapper_Impl::doGetProperty( DISPPARAMS * /*pdispparams*/, V return ret; } -HRESULT InterfaceOleWrapper_Impl::doSetProperty( DISPPARAMS * /*pdispparams*/, VARIANT * /*pvarResult*/, +HRESULT InterfaceOleWrapper_Impl::doSetProperty( DISPPARAMS * /*pdispparams*/, VARIANT * /*pvarResult*/, EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString& name, Sequence<Any> params) { HRESULT ret= S_OK; - + try { m_xInvocation->setValue( name, params.getConstArray()[0]); - } + } catch(UnknownPropertyException ) { ret = DISP_E_MEMBERNOTFOUND; @@ -1060,7 +1060,7 @@ HRESULT InterfaceOleWrapper_Impl::doSetProperty( DISPPARAMS * /*pdispparams*/, V if (pexcepinfo != NULL) { Any org = e.TargetException; - + pexcepinfo->wCode = UNO_2_OLE_EXCEPTIONCODE; pexcepinfo->bstrSource = SysAllocString(L"any ONE component"); pexcepinfo->bstrDescription = SysAllocString( @@ -1089,7 +1089,7 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s && m_defaultValueType != VT_EMPTY && pvarResult != NULL) { bHandled= sal_True; - if( m_defaultValueType == VT_DISPATCH) + if( m_defaultValueType == VT_DISPATCH) { pvarResult->vt= VT_DISPATCH; pvarResult->pdispVal= static_cast<IDispatch*>( this); @@ -1123,9 +1123,9 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s { bHandled= sal_True; sal_Bool bStruct= sal_False; - - - Reference<XInterface> xIntCore= m_smgr->createInstance( OUString::createFromAscii("com.sun.star.reflection.CoreReflection")); + + + Reference<XInterface> xIntCore= m_smgr->createInstance( OUString::createFromAscii("com.sun.star.reflection.CoreReflection")); Reference<XIdlReflection> xRefl( xIntCore, UNO_QUERY); if( xRefl.is() ) { @@ -1140,7 +1140,7 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s classStruct->createObject( anyStruct); CComVariant var; anyToVariant( &var, anyStruct ); - + if( var.vt == VT_DISPATCH) { VariantCopy( pvarResult, & var); @@ -1148,7 +1148,7 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s } } } - } + } ret= bStruct == sal_True ? S_OK : DISP_E_EXCEPTION; } else if (dispidMember == DISPID_CREATE_TYPE_FUNC) @@ -1162,7 +1162,7 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s return DISP_E_BADPARAMCOUNT; if (FAILED( arg.ChangeType( VT_BSTR, &pdispparams->rgvarg[0]))) return DISP_E_BADVARTYPE; - + //check if the provided name represents a valid type Type type; if (getType(arg.bstrVal, type) == false) @@ -1195,7 +1195,7 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s } catch( ... ) { - OUString message= OUSTR("InterfaceOleWrapper_Impl::InvokeGeneral : \n" + OUString message= OUSTR("InterfaceOleWrapper_Impl::InvokeGeneral : \n" "Unexpected exception"); writeExcepinfo(pexcepinfo, message); ret = DISP_E_EXCEPTION; @@ -1208,12 +1208,12 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s STDMETHODIMP InterfaceOleWrapper_Impl::GetDispID(BSTR /*bstrName*/, DWORD /*grfdex*/, DISPID __RPC_FAR* /*pid*/) { - HRESULT ret = ResultFromScode(E_NOTIMPL); + HRESULT ret = ResultFromScode(E_NOTIMPL); return ret; } -STDMETHODIMP InterfaceOleWrapper_Impl::InvokeEx( +STDMETHODIMP InterfaceOleWrapper_Impl::InvokeEx( /* [in] */ DISPID /*id*/, /* [in] */ LCID /*lcid*/, /* [in] */ WORD /*wFlags*/, @@ -1222,61 +1222,61 @@ STDMETHODIMP InterfaceOleWrapper_Impl::InvokeEx( /* [out] */ EXCEPINFO __RPC_FAR* /*pei*/, /* [unique][in] */ IServiceProvider __RPC_FAR* /*pspCaller*/) { - HRESULT ret = ResultFromScode(E_NOTIMPL); + HRESULT ret = ResultFromScode(E_NOTIMPL); return ret; } -STDMETHODIMP InterfaceOleWrapper_Impl::DeleteMemberByName( +STDMETHODIMP InterfaceOleWrapper_Impl::DeleteMemberByName( /* [in] */ BSTR /*bstr*/, /* [in] */ DWORD /*grfdex*/) { - HRESULT ret = ResultFromScode(E_NOTIMPL); + HRESULT ret = ResultFromScode(E_NOTIMPL); return ret; } STDMETHODIMP InterfaceOleWrapper_Impl::DeleteMemberByDispID(DISPID /*id*/) { - HRESULT ret = ResultFromScode(E_NOTIMPL); + HRESULT ret = ResultFromScode(E_NOTIMPL); return ret; } -STDMETHODIMP InterfaceOleWrapper_Impl::GetMemberProperties( +STDMETHODIMP InterfaceOleWrapper_Impl::GetMemberProperties( /* [in] */ DISPID /*id*/, /* [in] */ DWORD /*grfdexFetch*/, /* [out] */ DWORD __RPC_FAR* /*pgrfdex*/) { - HRESULT ret = ResultFromScode(E_NOTIMPL); + HRESULT ret = ResultFromScode(E_NOTIMPL); return ret; } -STDMETHODIMP InterfaceOleWrapper_Impl::GetMemberName( +STDMETHODIMP InterfaceOleWrapper_Impl::GetMemberName( /* [in] */ DISPID /*id*/, /* [out] */ BSTR __RPC_FAR* /*pbstrName*/) { - HRESULT ret = ResultFromScode(E_NOTIMPL); + HRESULT ret = ResultFromScode(E_NOTIMPL); return ret; } -STDMETHODIMP InterfaceOleWrapper_Impl::GetNextDispID( +STDMETHODIMP InterfaceOleWrapper_Impl::GetNextDispID( /* [in] */ DWORD /*grfdex*/, /* [in] */ DISPID /*id*/, /* [out] */ DISPID __RPC_FAR* /*pid*/) { - HRESULT ret = ResultFromScode(E_NOTIMPL); + HRESULT ret = ResultFromScode(E_NOTIMPL); return ret; } -STDMETHODIMP InterfaceOleWrapper_Impl::GetNameSpaceParent( +STDMETHODIMP InterfaceOleWrapper_Impl::GetNameSpaceParent( /* [out] */ IUnknown __RPC_FAR *__RPC_FAR* /*ppunk*/) { - HRESULT ret = ResultFromScode(E_NOTIMPL); + HRESULT ret = ResultFromScode(E_NOTIMPL); return ret; } @@ -1366,27 +1366,27 @@ STDMETHODIMP UnoObjectWrapperRemoteOpt::Invoke ( DISPID dispidMember, REFIID /* puArgErr, bHandled); if( bHandled) return ret; - + if ( dispidMember > 0 && m_xInvocation.is()) { - + IdToMemberInfoMap::iterator it_MemberInfo= m_idToMemberInfoMap.find( dispidMember); if( it_MemberInfo != m_idToMemberInfoMap.end() ) { MemberInfo& info= it_MemberInfo->second; - + Sequence<Any> params; // holds converted any s if( ! info.flags ) { // DISPID called for the first time if( wFlags == DISPATCH_METHOD ) - { + { convertDispparamsArgs(dispidMember, wFlags, pdispparams, params ); - - if( FAILED( ret= doInvoke( pdispparams, pvarResult, + + if( FAILED( ret= doInvoke( pdispparams, pvarResult, pexcepinfo, puArgErr, info.name, params)) && ret == DISP_E_MEMBERNOTFOUND) { - // try to get the exact name + // try to get the exact name OUString exactName; if (m_xExactName.is()) { @@ -1394,24 +1394,24 @@ STDMETHODIMP UnoObjectWrapperRemoteOpt::Invoke ( DISPID dispidMember, REFIID /* // invoke again if( exactName.getLength() != 0) { - if( SUCCEEDED( ret= doInvoke( pdispparams, pvarResult, + if( SUCCEEDED( ret= doInvoke( pdispparams, pvarResult, pexcepinfo, puArgErr, exactName, params))) info.name= exactName; - } + } } - } + } if( SUCCEEDED( ret ) ) info.flags= DISPATCH_METHOD; } //if( wFlags == DISPATCH_METHOD ) - + else if( wFlags == DISPATCH_PROPERTYPUT || wFlags == DISPATCH_PROPERTYPUTREF) { convertDispparamsArgs(dispidMember, wFlags, pdispparams, params ); - if( FAILED( ret= doSetProperty( pdispparams, pvarResult, + if( FAILED( ret= doSetProperty( pdispparams, pvarResult, pexcepinfo, puArgErr, info.name, params)) && ret == DISP_E_MEMBERNOTFOUND) { - // try to get the exact name + // try to get the exact name OUString exactName; if (m_xExactName.is()) { @@ -1419,23 +1419,23 @@ STDMETHODIMP UnoObjectWrapperRemoteOpt::Invoke ( DISPID dispidMember, REFIID /* // invoke again if( exactName.getLength() != 0) { - if( SUCCEEDED( ret= doSetProperty( pdispparams, pvarResult, + if( SUCCEEDED( ret= doSetProperty( pdispparams, pvarResult, pexcepinfo, puArgErr, exactName, params))) info.name= exactName; - } + } } - } + } if( SUCCEEDED( ret ) ) info.flags= DISPATCH_PROPERTYPUT | DISPATCH_PROPERTYGET; } - + else if( wFlags == DISPATCH_PROPERTYGET) { - if( FAILED( ret= doGetProperty( pdispparams, pvarResult, + if( FAILED( ret= doGetProperty( pdispparams, pvarResult, pexcepinfo, info.name)) && ret == DISP_E_MEMBERNOTFOUND) { - // try to get the exact name + // try to get the exact name OUString exactName; if (m_xExactName.is()) { @@ -1443,107 +1443,107 @@ STDMETHODIMP UnoObjectWrapperRemoteOpt::Invoke ( DISPID dispidMember, REFIID /* // invoke again if( exactName.getLength() != 0) { - if( SUCCEEDED( ret= doGetProperty( pdispparams, pvarResult, + if( SUCCEEDED( ret= doGetProperty( pdispparams, pvarResult, pexcepinfo, exactName))) info.name= exactName; - } + } } - } + } if( SUCCEEDED( ret ) ) info.flags= DISPATCH_PROPERTYGET | DISPATCH_PROPERTYPUT; } - else if( wFlags & DISPATCH_METHOD && + else if( wFlags & DISPATCH_METHOD && (wFlags & DISPATCH_PROPERTYPUT || wFlags & DISPATCH_PROPERTYPUTREF)) { - + OUString exactName; // convert params for DISPATCH_METHOD or DISPATCH_PROPERTYPUT convertDispparamsArgs(dispidMember, wFlags, pdispparams, params ); // try first as method - if( FAILED( ret= doInvoke( pdispparams, pvarResult, + if( FAILED( ret= doInvoke( pdispparams, pvarResult, pexcepinfo, puArgErr, info.name, params)) && ret == DISP_E_MEMBERNOTFOUND) { - // try to get the exact name + // try to get the exact name if (m_xExactName.is()) { exactName = m_xExactName->getExactName( info.name); // invoke again if( exactName.getLength() != 0) { - if( SUCCEEDED( ret= doInvoke( pdispparams, pvarResult, + if( SUCCEEDED( ret= doInvoke( pdispparams, pvarResult, pexcepinfo, puArgErr, exactName, params))) info.name= exactName; - } + } } - } + } if( SUCCEEDED( ret ) ) info.flags= DISPATCH_METHOD; - + // try as property if( FAILED( ret) && pdispparams->cArgs == 1) { - if( FAILED( ret= doSetProperty( pdispparams, pvarResult, + if( FAILED( ret= doSetProperty( pdispparams, pvarResult, pexcepinfo, puArgErr, info.name, params)) && ret == DISP_E_MEMBERNOTFOUND) { - // try to get the exact name + // try to get the exact name if( exactName.getLength() != 0) { - if( SUCCEEDED( ret= doSetProperty( pdispparams, pvarResult, + if( SUCCEEDED( ret= doSetProperty( pdispparams, pvarResult, pexcepinfo, puArgErr, exactName, params))) info.name= exactName; - } - } + } + } if( SUCCEEDED( ret ) ) - info.flags= DISPATCH_PROPERTYPUT | DISPATCH_PROPERTYGET; + info.flags= DISPATCH_PROPERTYPUT | DISPATCH_PROPERTYGET; } } else if( wFlags & DISPATCH_METHOD && wFlags & DISPATCH_PROPERTYGET) { OUString exactName; convertDispparamsArgs(dispidMember, wFlags, pdispparams, params ); - - if( FAILED( ret= doInvoke( pdispparams, pvarResult, + + if( FAILED( ret= doInvoke( pdispparams, pvarResult, pexcepinfo, puArgErr, info.name, params)) && ret == DISP_E_MEMBERNOTFOUND) { - // try to get the exact name + // try to get the exact name if (m_xExactName.is()) { exactName = m_xExactName->getExactName( info.name); // invoke again if( exactName.getLength() != 0) { - if( SUCCEEDED( ret= doInvoke( pdispparams, pvarResult, + if( SUCCEEDED( ret= doInvoke( pdispparams, pvarResult, pexcepinfo, puArgErr, exactName, params))) info.name= exactName; - } + } } - } + } if( SUCCEEDED( ret ) ) info.flags= DISPATCH_METHOD; - + // try as property if( FAILED( ret) && pdispparams->cArgs == 1) { - if( FAILED( ret= doGetProperty( pdispparams, pvarResult, + if( FAILED( ret= doGetProperty( pdispparams, pvarResult, pexcepinfo, info.name)) && ret == DISP_E_MEMBERNOTFOUND) { if( exactName.getLength() != 0) { - if( SUCCEEDED( ret= doSetProperty( pdispparams, pvarResult, + if( SUCCEEDED( ret= doSetProperty( pdispparams, pvarResult, pexcepinfo, puArgErr, exactName, params))) info.name= exactName; - } - } + } + } if( SUCCEEDED( ret ) ) info.flags= DISPATCH_PROPERTYGET; } } - - // update ínformation about this member + + // update ínformation about this member if( ret == DISP_E_MEMBERNOTFOUND) { // Remember the name as not existing @@ -1557,19 +1557,19 @@ STDMETHODIMP UnoObjectWrapperRemoteOpt::Invoke ( DISPID dispidMember, REFIID /* if( wFlags & DISPATCH_METHOD && info.flags == DISPATCH_METHOD) { convertDispparamsArgs(dispidMember, wFlags, pdispparams, params ); - ret= doInvoke( pdispparams, pvarResult, + ret= doInvoke( pdispparams, pvarResult, pexcepinfo, puArgErr, info.name, params); } else if( (wFlags & DISPATCH_PROPERTYPUT || wFlags & DISPATCH_PROPERTYPUTREF ) && info.flags & DISPATCH_PROPERTYPUT) { convertDispparamsArgs(dispidMember, wFlags, pdispparams, params ); - ret= doSetProperty( pdispparams, pvarResult, + ret= doSetProperty( pdispparams, pvarResult, pexcepinfo, puArgErr, info.name, params); } else if( (wFlags & DISPATCH_PROPERTYGET) && ( info.flags & DISPATCH_PROPERTYGET)) { - ret= doGetProperty( pdispparams, pvarResult, + ret= doGetProperty( pdispparams, pvarResult, pexcepinfo, info.name); } else @@ -1577,7 +1577,7 @@ STDMETHODIMP UnoObjectWrapperRemoteOpt::Invoke ( DISPID dispidMember, REFIID /* ret= DISP_E_MEMBERNOTFOUND; } } - }// if( it_MemberInfo != m_idToMemberInfoMap.end() ) + }// if( it_MemberInfo != m_idToMemberInfoMap.end() ) else ret= DISP_E_MEMBERNOTFOUND; } @@ -1596,16 +1596,16 @@ STDMETHODIMP UnoObjectWrapperRemoteOpt::Invoke ( DISPID dispidMember, REFIID /* } catch(...) { - OUString message= OUSTR("UnoObjectWrapperRemoteOpt::Invoke : \n" + OUString message= OUSTR("UnoObjectWrapperRemoteOpt::Invoke : \n" "Unexpected exception"); writeExcepinfo(pexcepinfo, message); ret = DISP_E_EXCEPTION; } - + return ret; } -HRESULT UnoObjectWrapperRemoteOpt::methodInvoke( DISPID /*dispidMember*/, DISPPARAMS * /*pdispparams*/, VARIANT * /*pvarResult*/, +HRESULT UnoObjectWrapperRemoteOpt::methodInvoke( DISPID /*dispidMember*/, DISPPARAMS * /*pdispparams*/, VARIANT * /*pvarResult*/, EXCEPINFO * /*pexcepinfo*/, unsigned int * /*puArgErr*/, Sequence<Any> params) { return S_OK; @@ -1661,12 +1661,12 @@ static HRESULT mapCannotConvertException( CannotConvertException e, unsigned int return ret; } -// The function maps the TypeClass of the any to VARTYPE: If +// The function maps the TypeClass of the any to VARTYPE: If // the Any contains STRUCT or INTERFACE then the return value // is VT_DISPATCH. The function is used from o2u_createUnoObjectWrapper // and the result is put into the constructor of the uno - wrapper // object. If a client asks the object for DISPID_VALUE and this -// funtion returned VT_DISPATCH then the IDispatch of the same +// funtion returned VT_DISPATCH then the IDispatch of the same // object is being returned. // See InterfaceOleWrapper_Impl::Invoke, InterfaceOleWrapper_Impl::m_defaultValueType const VARTYPE getVarType( const Any& value) diff --git a/extensions/source/ole/unoobjw.hxx b/extensions/source/ole/unoobjw.hxx index e57421fc9286..e007dd662883 100644 --- a/extensions/source/ole/unoobjw.hxx +++ b/extensions/source/ole/unoobjw.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,16 +42,16 @@ #include "ole2uno.hxx" #include "unoconversionutilities.hxx" -//#define INVOCATION_SERVICE L"com.sun.star.script.Invocation" -#define JSCRIPT_VALUE_FUNC L"_GetValueObject" -#define GET_STRUCT_FUNC L"_GetStruct" +//#define INVOCATION_SERVICE L"com.sun.star.script.Invocation" +#define JSCRIPT_VALUE_FUNC L"_GetValueObject" +#define GET_STRUCT_FUNC L"_GetStruct" #define BRIDGE_VALUE_FUNC L"Bridge_GetValueObject" #define BRIDGE_GET_STRUCT_FUNC L"Bridge_GetStruct" #define BRIDGE_CREATE_TYPE_FUNC L"Bridge_CreateType" #define DISPID_JSCRIPT_VALUE_FUNC -10l -#define DISPID_GET_STRUCT_FUNC -102 -#define DISPID_CREATE_TYPE_FUNC -103 +#define DISPID_GET_STRUCT_FUNC -102 +#define DISPID_CREATE_TYPE_FUNC -103 using namespace std; using namespace cppu; @@ -84,8 +84,8 @@ struct MemberInfo { MemberInfo() : flags(0), name() {} MemberInfo(WORD f, const OUString& n) : flags(f), name(n) {} - - WORD flags; + + WORD flags; OUString name; }; @@ -114,10 +114,10 @@ typedef hash_map /***************************************************************************** class declaration: InterfaceOleWrapper_Impl - + *****************************************************************************/ -class InterfaceOleWrapper_Impl : public WeakImplHelper2<XBridgeSupplier2, XInitialization>, +class InterfaceOleWrapper_Impl : public WeakImplHelper2<XBridgeSupplier2, XInitialization>, public IDispatchEx, public UnoConversionUtilities<InterfaceOleWrapper_Impl>, public IUnoObjectWrapper @@ -144,12 +144,12 @@ public: /* IDispatchEx methods */ - virtual HRESULT STDMETHODCALLTYPE GetDispID( + virtual HRESULT STDMETHODCALLTYPE GetDispID( /* [in] */ BSTR bstrName, /* [in] */ DWORD grfdex, /* [out] */ DISPID __RPC_FAR *pid); - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE InvokeEx( + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE InvokeEx( /* [in] */ DISPID id, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, @@ -157,36 +157,36 @@ public: /* [out] */ VARIANT __RPC_FAR *pvarRes, /* [out] */ EXCEPINFO __RPC_FAR *pei, /* [unique][in] */ IServiceProvider __RPC_FAR *pspCaller); - - virtual HRESULT STDMETHODCALLTYPE DeleteMemberByName( + + virtual HRESULT STDMETHODCALLTYPE DeleteMemberByName( /* [in] */ BSTR bstr, /* [in] */ DWORD grfdex); - - virtual HRESULT STDMETHODCALLTYPE DeleteMemberByDispID( + + virtual HRESULT STDMETHODCALLTYPE DeleteMemberByDispID( /* [in] */ DISPID id); - - virtual HRESULT STDMETHODCALLTYPE GetMemberProperties( + + virtual HRESULT STDMETHODCALLTYPE GetMemberProperties( /* [in] */ DISPID id, /* [in] */ DWORD grfdexFetch, /* [out] */ DWORD __RPC_FAR *pgrfdex); - - virtual HRESULT STDMETHODCALLTYPE GetMemberName( + + virtual HRESULT STDMETHODCALLTYPE GetMemberName( /* [in] */ DISPID id, /* [out] */ BSTR __RPC_FAR *pbstrName); - - virtual HRESULT STDMETHODCALLTYPE GetNextDispID( + + virtual HRESULT STDMETHODCALLTYPE GetNextDispID( /* [in] */ DWORD grfdex, /* [in] */ DISPID id, /* [out] */ DISPID __RPC_FAR *pid); - - virtual HRESULT STDMETHODCALLTYPE GetNameSpaceParent( + + virtual HRESULT STDMETHODCALLTYPE GetNameSpaceParent( /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunk); - + // XBridgeSupplier2 --------------------------------------------------- - virtual Any SAL_CALL createBridge(const Any& modelDepObject, - const Sequence<sal_Int8>& ProcessId, - sal_Int16 sourceModelType, - sal_Int16 destModelType) + virtual Any SAL_CALL createBridge(const Any& modelDepObject, + const Sequence<sal_Int8>& ProcessId, + sal_Int16 sourceModelType, + sal_Int16 destModelType) throw (IllegalArgumentException, RuntimeException); //XInitialization ----------------------------------------------------- @@ -198,34 +198,34 @@ public: STDMETHOD( getOriginalUnoStruct)( Any * pStruct); // UnoConversionUtility - virtual Reference< XInterface > createUnoWrapperInstance(); + virtual Reference< XInterface > createUnoWrapperInstance(); virtual Reference< XInterface > createComWrapperInstance(); protected: - virtual HRESULT doInvoke( DISPPARAMS * pdispparams, VARIANT * pvarResult, + virtual HRESULT doInvoke( DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString & name, Sequence<Any>& params); - virtual HRESULT doGetProperty( DISPPARAMS * pdispparams, VARIANT * pvarResult, + virtual HRESULT doGetProperty( DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo, OUString & name ); - virtual HRESULT doSetProperty( DISPPARAMS * pdispparams, VARIANT * pvarResult, + virtual HRESULT doSetProperty( DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString & name, Sequence<Any> params); virtual HRESULT InvokeGeneral( DISPID dispidMember, unsigned short wFlags, DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo, unsigned int * puArgErr, sal_Bool& bHandled); - void convertDispparamsArgs( DISPID id, unsigned short wFlags, DISPPARAMS* pdispparams, + void convertDispparamsArgs( DISPID id, unsigned short wFlags, DISPPARAMS* pdispparams, Sequence<Any>& rSeq); sal_Bool getInvocationInfoForCall(DISPID id, InvocationInfo& info); - Reference<XInvocation> m_xInvocation; - Reference<XExactName> m_xExactName; - Reference<XInterface> m_xOrigin; - NameToIdMap m_nameToDispIdMap; - vector<MemberInfo> m_MemberInfos; + Reference<XInvocation> m_xInvocation; + Reference<XExactName> m_xExactName; + Reference<XInterface> m_xOrigin; + NameToIdMap m_nameToDispIdMap; + vector<MemberInfo> m_MemberInfos; // This member is used to determine the default value // denoted by DISPID_VALUE (0). For proper results in JavaScript // we have to return the default value when we write an object @@ -234,13 +234,13 @@ protected: // to detect the default value. The wrapped object must then return // its own IDispatch* otherwise we cannot access it within the script. // see InterfaceOleWrapper_Impl::Invoke - VARTYPE m_defaultValueType; + VARTYPE m_defaultValueType; }; /***************************************************************************** - class declaration: UnoObjectWrapperRemoteOpt + class declaration: UnoObjectWrapperRemoteOpt ( Uno Object Wrapper Remote Optimized) This is the UNO wrapper used in the service com.sun.star.bridge.OleBridgeSupplierVar1. Key features: @@ -249,7 +249,7 @@ protected: if a call is made to a property or method if the flags are DISPATCH_METHOD | DISPATCH_PROPERTYPUT. If something has been found out about a property or member than it is saved in a MemberInfo structure hold by a IdToMemberInfoMap stl map. - + *****************************************************************************/ class UnoObjectWrapperRemoteOpt: public InterfaceOleWrapper_Impl { @@ -270,20 +270,20 @@ public: protected: - HRESULT methodInvoke( DISPID dispidMember, DISPPARAMS * pdispparams, VARIANT * pvarResult, + HRESULT methodInvoke( DISPID dispidMember, DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo, unsigned int * puArgErr, Sequence<Any> params); // In GetIDsOfNames are blindly passed out, that is without verifying - // the name. If two names are passed in during different calls to + // the name. If two names are passed in during different calls to // GetIDsOfNames and the names differ only in their cases then different // id's are passed out ( e.g. "doSomethingMethod" or "dosomethingmethod"). - // In Invoke the DISPID is remapped to the name passed to GetIDsOfNames + // In Invoke the DISPID is remapped to the name passed to GetIDsOfNames // and the name is used as parameter for XInvocation::invoke. If invoke // fails because of a wrong name, then m_xExactName ( XExactName) is used // to verify the name. The correct name is then inserted to m_MemberInfos - // ( vector<MemberInfo> ). During the next call to Invoke the right name - // is used. . - + // ( vector<MemberInfo> ). During the next call to Invoke the right name + // is used. . + BadNameMap m_badNameMap; IdToMemberInfoMap m_idToMemberInfoMap; diff --git a/extensions/source/ole/unotypewrapper.cxx b/extensions/source/ole/unotypewrapper.cxx index ea0393d55ee9..7461d7d0e62f 100644 --- a/extensions/source/ole/unotypewrapper.cxx +++ b/extensions/source/ole/unotypewrapper.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -95,7 +95,7 @@ STDMETHODIMP UnoTypeWrapper::GetTypeInfo( UINT /*iTInfo*/, // UnoTypeWrapper, IDispatch -------------------------------------------- STDMETHODIMP UnoTypeWrapper::GetIDsOfNames( REFIID /*riid*/, LPOLESTR *rgszNames, - UINT /*cNames*/, + UINT /*cNames*/, LCID /*lcid*/, DISPID *rgDispId) { @@ -126,12 +126,12 @@ STDMETHODIMP UnoTypeWrapper::Invoke( DISPID dispIdMember, { if (pDispParams == NULL) return DISP_E_EXCEPTION; - + if( pDispParams->cNamedArgs) return DISP_E_NONAMEDARGS; - - - HRESULT ret= S_OK; + + + HRESULT ret= S_OK; switch( dispIdMember) { case DISPID_VALUE: // DISPID_VALUE @@ -156,7 +156,7 @@ STDMETHODIMP UnoTypeWrapper::Invoke( DISPID dispIdMember, // IUnoTypeWrapper----------------------- STDMETHODIMP UnoTypeWrapper::put_Name(BSTR val) -{ +{ Lock(); HRESULT hr = S_OK; m_sName = val; diff --git a/extensions/source/ole/unotypewrapper.hxx b/extensions/source/ole/unotypewrapper.hxx index 748d7a59da58..f09fd9bfbbb2 100644 --- a/extensions/source/ole/unotypewrapper.hxx +++ b/extensions/source/ole/unotypewrapper.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/extensions/source/ole/windata.cxx b/extensions/source/ole/windata.cxx index 267478b8eb5c..e4047e3b184c 100644 --- a/extensions/source/ole/windata.cxx +++ b/extensions/source/ole/windata.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/extensions/source/ole/windata.hxx b/extensions/source/ole/windata.hxx index ed951f248ea2..fce3d4af5e9c 100644 --- a/extensions/source/ole/windata.hxx +++ b/extensions/source/ole/windata.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -39,7 +39,7 @@ namespace ole_adapter { -//Wrapper for VARDESC +//Wrapper for VARDESC class VarDesc { VARDESC* operator = (const VarDesc*); @@ -88,7 +88,7 @@ class FuncDesc FUNCDESC * m_pFuncDesc; public: - + FuncDesc(ITypeInfo * pTypeInfo) : m_pFuncDesc(NULL), m_pTypeInfo(pTypeInfo) |