diff options
author | Joachim Lingner <jl@openoffice.org> | 2000-10-12 12:19:04 +0000 |
---|---|---|
committer | Joachim Lingner <jl@openoffice.org> | 2000-10-12 12:19:04 +0000 |
commit | 5f429667b9682c68fb12d3667bd05ed47361c5da (patch) | |
tree | d86548e8603d533f271d4fa1b08091929cb56ac0 /extensions/test/ole | |
parent | 5840ee38df56933c54dcaaa6ec4e4ba01f173f6c (diff) |
*** empty log message ***
Diffstat (limited to 'extensions/test/ole')
-rw-r--r-- | extensions/test/ole/AxTestComponents/AxTestComponents.cpp | 5 | ||||
-rw-r--r-- | extensions/test/ole/AxTestComponents/AxTestComponents.dsp | 8 | ||||
-rw-r--r-- | extensions/test/ole/AxTestComponents/AxTestComponents.idl | 30 | ||||
-rw-r--r-- | extensions/test/ole/AxTestComponents/Basic.cpp | 521 | ||||
-rw-r--r-- | extensions/test/ole/AxTestComponents/Basic.h | 44 | ||||
-rw-r--r-- | extensions/test/ole/OleClient/clientTest.cxx | 1016 |
6 files changed, 1230 insertions, 394 deletions
diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.cpp b/extensions/test/ole/AxTestComponents/AxTestComponents.cpp index e6e98bbe80a5..21313bad4dd1 100644 --- a/extensions/test/ole/AxTestComponents/AxTestComponents.cpp +++ b/extensions/test/ole/AxTestComponents/AxTestComponents.cpp @@ -2,9 +2,9 @@ * * $RCSfile: AxTestComponents.cpp,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $ + * last change: $Author: jl $ $Date: 2000-10-12 13:17:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -129,3 +129,4 @@ STDAPI DllUnregisterServer(void) } +//VT_I4 size_t V_ERROR VARIANT VARIANT_FALSE CComVariant FADF_EMBEDDED
\ No newline at end of file diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.dsp b/extensions/test/ole/AxTestComponents/AxTestComponents.dsp index 77c14a7ddc65..c869f56410de 100644 --- a/extensions/test/ole/AxTestComponents/AxTestComponents.dsp +++ b/extensions/test/ole/AxTestComponents/AxTestComponents.dsp @@ -45,8 +45,8 @@ RSC=rc.exe # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /Yu"stdafx.h" /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -79,8 +79,8 @@ SOURCE="$(InputPath)" # PROP Output_Dir "DebugU" # PROP Intermediate_Dir "DebugU" # PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.idl b/extensions/test/ole/AxTestComponents/AxTestComponents.idl index 3885bc19f1e3..a155f8665d21 100644 --- a/extensions/test/ole/AxTestComponents/AxTestComponents.idl +++ b/extensions/test/ole/AxTestComponents/AxTestComponents.idl @@ -2,9 +2,9 @@ * * $RCSfile: AxTestComponents.idl,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $ + * last change: $Author: jl $ $Date: 2000-10-12 13:17:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -134,6 +134,32 @@ import "ocidl.idl"; [out] IDispatch** outDisp, [in,out] IDispatch** inoutDisp); [id(44), helpstring("method inSequenceLong")] HRESULT inSequenceLong([in] SAFEARRAY(long) ar); + [id(45), helpstring("method inSequenceByte")] HRESULT inSequenceByte([in] SAFEARRAY(byte) ar); + [id(46), helpstring("method inSequenceShort")] HRESULT inSequenceShort([in] SAFEARRAY(short) ar); + [id(47), helpstring("method inSequenceString")] HRESULT inSequenceString([in] SAFEARRAY( BSTR) ar); + [id(48), helpstring("method inSequenceFloat")] HRESULT inSequenceFloat([in] SAFEARRAY(float) ar); + [id(49), helpstring("method inSequenceDouble")] HRESULT inSequenceDouble([in] SAFEARRAY(double) ar); + [id(50), helpstring("method inSequenceObject")] HRESULT inSequenceObject([in] SAFEARRAY(IDispatch*) ar); + [id(51), helpstring("method outSequenceByte")] HRESULT outSequenceByte([out] SAFEARRAY(unsigned char)* val); + [id(52), helpstring("method outSequenceShort")] HRESULT outSequenceShort([out] SAFEARRAY(short)* val); + [id(53), helpstring("method outSequenceLong")] HRESULT outSequenceLong([out] SAFEARRAY(long )*val); + [id(54), helpstring("method outSequenceString")] HRESULT outSequenceString([out] SAFEARRAY(BSTR)* val); + [id(55), helpstring("method outSequenceFloat")] HRESULT outSequenceFloat([out] SAFEARRAY(float)* val); + [id(56), helpstring("method outSequenceDouble")] HRESULT outSequenceDouble([out] SAFEARRAY(double)* val); + [id(57), helpstring("method outSequenceObject")] HRESULT outSequenceObject([out] SAFEARRAY(IDispatch*)* val); + [id(58), helpstring("method inoutSequenceByte")] HRESULT inoutSequenceByte([in,out] SAFEARRAY(unsigned char)* val); + [id(59), helpstring("method inoutSequenceShort")] HRESULT inoutSequenceShort([in,out] SAFEARRAY(short)* val); + [id(60), helpstring("method inoutSequenceLong")] HRESULT inoutSequenceLong([in,out] SAFEARRAY( long)*val); + [id(61), helpstring("method inoutSequenceString")] HRESULT inoutSequenceString([in,out] SAFEARRAY(BSTR)* val); + [id(62), helpstring("method inoutSequenceFloat")] HRESULT inoutSequenceFloat([in,out] SAFEARRAY(float)* val); + [id(63), helpstring("method inoutSequenceDouble")] HRESULT inoutSequenceDouble([in,out] SAFEARRAY(double)* val); + [id(64), helpstring("method inoutSequenceObject")] HRESULT inoutSequenceObject([in,out] SAFEARRAY(IDispatch*)* val); + [id(65), helpstring("method inMulDimArrayLong")] HRESULT inMulDimArrayLong([in] SAFEARRAY(long) val ); + [id(66), helpstring("method inMulDimArrayVariant")] HRESULT inMulDimArrayVariant([in] SAFEARRAY(VARIANT) val); + [id(67), helpstring("method inMulDimArrayLong2")] HRESULT inMulDimArrayLong2([in] SAFEARRAY(long) val); + [id(68), helpstring("method inMulDimArrayVariant2")] HRESULT inMulDimArrayVariant2([in] SAFEARRAY(VARIANT) val); + [id(69), helpstring("method inMulDimArrayByte")] HRESULT inMulDimArrayByte([in] SAFEARRAY(unsigned char) val); + [id(70), helpstring("method inMulDimArrayByte2")] HRESULT inMulDimArrayByte2([in] SAFEARRAY(unsigned char) val); }; diff --git a/extensions/test/ole/AxTestComponents/Basic.cpp b/extensions/test/ole/AxTestComponents/Basic.cpp index 3bff899ccc0e..856db544d93f 100644 --- a/extensions/test/ole/AxTestComponents/Basic.cpp +++ b/extensions/test/ole/AxTestComponents/Basic.cpp @@ -2,9 +2,9 @@ * * $RCSfile: Basic.cpp,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $ + * last change: $Author: jl $ $Date: 2000-10-12 13:18:22 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -283,7 +283,7 @@ STDMETHODIMP CBasic::outString(BSTR *val) STDMETHODIMP CBasic::outFloat(float *val) { - *val= 3.14; + *val= 3.14f; return S_OK; } @@ -337,48 +337,50 @@ STDMETHODIMP CBasic::outObject(IDispatch* *val) STDMETHODIMP CBasic::get_prpByte(unsigned char *pVal) { - // TODO: Add your implementation code here - + if( !pVal) + return E_POINTER; + *pVal= m_cPrpByte; return S_OK; } STDMETHODIMP CBasic::put_prpByte(unsigned char newVal) { - // TODO: Add your implementation code here - + m_cPrpByte= newVal; return S_OK; } STDMETHODIMP CBasic::get_prpShort(short *pVal) { - // TODO: Add your implementation code here - + if( !pVal) + return E_POINTER; + *pVal= m_nPrpShort; return S_OK; } STDMETHODIMP CBasic::put_prpShort(short newVal) { - // TODO: Add your implementation code here - + m_nPrpShort= newVal; return S_OK; } STDMETHODIMP CBasic::get_prpLong(long *pVal) { - // TODO: Add your implementation code here - + if( !pVal) + return E_POINTER; + *pVal= m_lPrpLong; return S_OK; } STDMETHODIMP CBasic::put_prpLong(long newVal) { - // TODO: Add your implementation code here - + m_lPrpLong= newVal; return S_OK; } STDMETHODIMP CBasic::get_prpString(BSTR *pVal) { + if( !pVal) + return E_POINTER; m_bstrPrpString.CopyTo( pVal ); return S_OK; } @@ -391,71 +393,74 @@ STDMETHODIMP CBasic::put_prpString(BSTR newVal) STDMETHODIMP CBasic::get_prpFloat(float *pVal) { - // TODO: Add your implementation code here - + if( !pVal) + return E_POINTER; + *pVal= m_fPrpFloat; return S_OK; } STDMETHODIMP CBasic::put_prpFloat(float newVal) { - // TODO: Add your implementation code here - + m_fPrpFloat= newVal; return S_OK; } STDMETHODIMP CBasic::get_prpDouble(double *pVal) { - // TODO: Add your implementation code here - + if( !pVal) + return E_POINTER; + *pVal= m_dPrpDouble; return S_OK; } STDMETHODIMP CBasic::put_prpDouble(double newVal) { - // TODO: Add your implementation code here - + m_dPrpDouble= newVal; return S_OK; } STDMETHODIMP CBasic::get_prpVariant(VARIANT *pVal) { - // TODO: Add your implementation code here - + if( !pVal) + return E_POINTER; + VariantCopy( pVal, &m_PropVariant); return S_OK; } STDMETHODIMP CBasic::put_prpVariant(VARIANT newVal) { - // TODO: Add your implementation code here - + m_PropVariant= newVal; return S_OK; } STDMETHODIMP CBasic::get_prpArray(LPSAFEARRAY *pVal) { - // TODO: Add your implementation code here - + if( !pVal) + return E_POINTER; + SafeArrayCopy( m_PrpArray, pVal); return S_OK; } STDMETHODIMP CBasic::put_prpArray(LPSAFEARRAY newVal) { - // TODO: Add your implementation code here + SafeArrayDestroy( m_PrpArray); + SafeArrayCopy( newVal, &m_PrpArray); return S_OK; } STDMETHODIMP CBasic::get_prpObject(IDispatch **pVal) { - // TODO: Add your implementation code here - + if( !pVal) + return E_POINTER; + *pVal= m_PrpObject; + (*pVal)->AddRef(); return S_OK; } STDMETHODIMP CBasic::put_prpObject(IDispatch *newVal) { - // TODO: Add your implementation code here - + m_PrpObject= newVal; return S_OK; } @@ -496,7 +501,52 @@ STDMETHODIMP CBasic::mixed1( STDMETHODIMP CBasic::inSequenceLong(LPSAFEARRAY val) { + printArray( val, CComBSTR(L"inSequenceLong\n"), VT_I4); + return S_OK; +} + +STDMETHODIMP CBasic::inSequenceByte( LPSAFEARRAY val) +{ + printArray( val, CComBSTR(L"inSequenceByte\n"), VT_UI1); + return S_OK; +} + +STDMETHODIMP CBasic::inSequenceShort(LPSAFEARRAY val) +{ + printArray( val, CComBSTR(L"inSequenceShort\n"), VT_I2); + return S_OK; +} + +STDMETHODIMP CBasic::inSequenceString(LPSAFEARRAY val) +{ + printArray( val, CComBSTR(L"inSequenceString\n"), VT_BSTR); + return S_OK; + +} + +STDMETHODIMP CBasic::inSequenceFloat(LPSAFEARRAY val) +{ + printArray( val, CComBSTR(L"inSequenceFloat\n"), VT_R4); + return S_OK; +} + +STDMETHODIMP CBasic::inSequenceDouble(LPSAFEARRAY val) +{ + printArray( val, CComBSTR(L"inSequenceDouble\n"), VT_R8); + return S_OK; +} + +STDMETHODIMP CBasic::inSequenceObject(LPSAFEARRAY val) +{ + printArray( val, CComBSTR(L"inSequenceObject\n"), VT_DISPATCH); + return S_OK; +} + +void CBasic::printArray( LPSAFEARRAY val, BSTR message, VARTYPE type) +{ + HRESULT hr= S_OK; + USES_CONVERSION; long lbound=0; long ubound= 0; hr= SafeArrayGetLBound( val, 1, &lbound); @@ -504,20 +554,405 @@ STDMETHODIMP CBasic::inSequenceLong(LPSAFEARRAY val) long length= ubound - lbound +1; CComVariant varElement; - char buf[4096]; - ZeroMemory( buf, 10); + char buf[1024]; + sprintf( buf,"%s", W2A(message)); + for( long i= 0; i < length ; i++) { - varElement.Clear(); - hr= SafeArrayGetElement( val, &i, &varElement); - - if( varElement.vt == VT_BSTR) - { char bufTmp[256]; - sprintf( bufTmp, " %d string: = %d \n", i, varElement.lVal); - strcat( buf, bufTmp); + char tmp[1024]; + long data=0; + CComVariant var; + switch( type) + { + case VT_UI1: + case VT_I2: + case VT_I4: + case VT_ERROR: + hr= SafeArrayGetElement( val, &i, (void*)&data); + sprintf( tmp, "%d \n", *(long*)&data); + break; + case VT_BSTR: + hr= SafeArrayGetElement( val, &i, (void*)&data); + sprintf( tmp, "%S \n", (BSTR)data); + break; + case VT_VARIANT: + hr= SafeArrayGetElement( val, &i, &var); + sprintf( tmp, "%x \n", var.byref); + break; + case VT_R4: + hr= SafeArrayGetElement( val, &i, (void*)&data); + sprintf( tmp, "%f \n", *(float*) &data); + break; + case VT_R8: ; + hr= SafeArrayGetElement( val, &i, (void*)&data); + sprintf( tmp, "%f \n", *(double*) &data); + break; + case VT_DISPATCH: + // we assume the objects are instances of this component and have the + // property prpString set. + hr= SafeArrayGetElement( val, &i, (void*)&data); + IDispatch* pdisp= ( IDispatch*) data; + CComDispatchDriver driver( pdisp); + CComVariant var; + if( pdisp) + { + driver.GetPropertyByName(L"prpString", &var); + sprintf( tmp, "%x : %S \n", *(long*)&data, var.bstrVal); + } + else + sprintf( tmp, "%x\n", *(long*)&data); } + + strcat( buf, tmp); } MessageBox( NULL, _T(A2T(buf)), _T("AxTestComponents.Basic"), MB_OK); +} +// V_ERROR OLECHAR VARIANT VT_UI1 + +STDMETHODIMP CBasic::outSequenceByte(LPSAFEARRAY* val) +{ + HRESULT hr= S_OK; + + SAFEARRAY* ar= SafeArrayCreateVector( VT_UI1, 0, 3); + for( long i=0; i< 3; i++) + { + unsigned char charVal= i +1; + hr= SafeArrayPutElement( ar, &i, &charVal); + } + + *val= ar; + return hr; +} + +STDMETHODIMP CBasic::outSequenceShort(LPSAFEARRAY* val) +{ + HRESULT hr= S_OK; + + SAFEARRAY* ar= SafeArrayCreateVector( VT_I2, 0, 3); + for( long i=0; i< 3; i++) + { + short shortVal= i +1; + hr= SafeArrayPutElement( ar, &i, &shortVal); + } + + *val= ar; + return hr; +} + +STDMETHODIMP CBasic::outSequenceLong(LPSAFEARRAY* val) +{ + HRESULT hr= S_OK; + + SAFEARRAY* ar= SafeArrayCreateVector( VT_I4, 0, 3); + for( long i=0; i< 3; i++) + { + long longVal= i +1; + hr= SafeArrayPutElement( ar, &i, &longVal); + } + + *val= ar; + return hr; +} + +STDMETHODIMP CBasic::outSequenceString(LPSAFEARRAY* val) +{ + HRESULT hr= S_OK; + + SAFEARRAY* ar= SafeArrayCreateVector( VT_BSTR, 0, 3); + BSTR strings[3]; + strings[0]= SysAllocString(L"string 1"); + strings[1]= SysAllocString(L"string 2"); + strings[2]= SysAllocString(L"string 3"); + for( long i=0; i< 3; i++) + { + hr= SafeArrayPutElement( ar, &i, strings[i]); + } + + *val= ar; + return hr; +} + +STDMETHODIMP CBasic::outSequenceFloat(LPSAFEARRAY* val) +{ + HRESULT hr= S_OK; + + SAFEARRAY* ar= SafeArrayCreateVector( VT_R4, 0, 3); + float arfloats[]= { 3.14f, 31.4f, 314.f}; + for( long i=0; i< 3; i++) + { + hr= SafeArrayPutElement( ar, &i, &arfloats[i]); + } + + *val= ar; + return hr; +} + +STDMETHODIMP CBasic::outSequenceDouble(LPSAFEARRAY* val) +{ + HRESULT hr= S_OK; + + SAFEARRAY* ar= SafeArrayCreateVector( VT_R8, 0, 3); + double arDouble[]= { 3.14f, 31.4f, 314.f}; + for( long i=0; i< 3; i++) + { + hr= SafeArrayPutElement( ar, &i, &arDouble[i]); + } + *val= ar; + return hr; +} + +STDMETHODIMP CBasic::outSequenceObject(LPSAFEARRAY* val) +{ + CComPtr<IDispatch> ob1; + CComPtr<IDispatch> ob2; + CComPtr<IDispatch> ob3; + + ob1.CoCreateInstance(L"AxTestComponents.Basic"); + ob2.CoCreateInstance(L"AxTestComponents.Basic"); + ob3.CoCreateInstance(L"AxTestComponents.Basic"); + + CComDispatchDriver disp( ob1); + CComVariant param; + param= L"this property prpString (1)"; + disp.PutPropertyByName(L"prpString", ¶m); + + disp= ob2; + param= L"this property prpString (2)"; + disp.PutPropertyByName(L"prpString", ¶m); + + disp= ob3; + param= L"this property prpString (3)"; + disp.PutPropertyByName(L"prpString", ¶m); + + SAFEARRAY* ar= SafeArrayCreateVector( VT_DISPATCH, 0, 3); + long i= 0; + SafeArrayPutElement( ar, &i, ob1.p); + i++; + SafeArrayPutElement( ar, &i, ob2.p); + i++; + SafeArrayPutElement( ar, &i, ob3.p); + + *val= ar; + return S_OK; +} + +STDMETHODIMP CBasic::inoutSequenceByte(LPSAFEARRAY* val) +{ + inSequenceByte( *val); + SafeArrayDestroy( *val); + outSequenceByte( val); + return S_OK; +} + +STDMETHODIMP CBasic::inoutSequenceShort(LPSAFEARRAY* val) +{ + inSequenceShort( *val); + SafeArrayDestroy( *val); + outSequenceShort( val); + + return S_OK; +} + +STDMETHODIMP CBasic::inoutSequenceLong(LPSAFEARRAY* val) +{ + inSequenceLong( *val); + SafeArrayDestroy( *val); + outSequenceLong( val); + + return S_OK; +} + +STDMETHODIMP CBasic::inoutSequenceString(LPSAFEARRAY* val) +{ + inSequenceString( *val); + SafeArrayDestroy( *val); + outSequenceString( val); + + return S_OK; +} + +STDMETHODIMP CBasic::inoutSequenceFloat(LPSAFEARRAY* val) +{ + inSequenceFloat( *val); + SafeArrayDestroy( *val); + outSequenceFloat( val); + return S_OK; } + +STDMETHODIMP CBasic::inoutSequenceDouble(LPSAFEARRAY* val) +{ + inSequenceDouble( *val); + SafeArrayDestroy( *val); + outSequenceDouble( val); + + return S_OK; +} + +STDMETHODIMP CBasic::inoutSequenceObject(LPSAFEARRAY* val) +{ + inSequenceObject( *val); + SafeArrayDestroy( *val); + outSequenceObject( val); + + return S_OK; +} + +// 2-dimensional Array +STDMETHODIMP CBasic::inMulDimArrayLong(LPSAFEARRAY val) +{ + printMulArray( val, VT_I4); + return S_OK; +} +// 2-dimensional Array +STDMETHODIMP CBasic::inMulDimArrayVariant(LPSAFEARRAY val) +{ + printMulArray( val, VT_VARIANT); + return S_OK; +} +// 3-dimensional Array +STDMETHODIMP CBasic::inMulDimArrayLong2(LPSAFEARRAY val) +{ + printMulArray( val, VT_I4); + return S_OK; +} +// 3-dimensional Array +STDMETHODIMP CBasic::inMulDimArrayVariant2(LPSAFEARRAY val) +{ + return S_OK; +} + + +STDMETHODIMP CBasic::inMulDimArrayByte(LPSAFEARRAY val) +{ + // TODO: Add your implementation code here + + return S_OK; +} +// 3-dimensionales array +STDMETHODIMP CBasic::inMulDimArrayByte2(LPSAFEARRAY val) +{ + // TODO: Add your implementation code here + printMulArray( val, VT_UI1); + return S_OK; +} + +// supports 2 and 3 dimensionals SAFEARRAY with elements of long or VARIANT +void CBasic::printMulArray( SAFEARRAY* val, VARTYPE type) +{ + HRESULT hr= S_OK; + UINT dims= SafeArrayGetDim( val); + long lbound1; + long ubound1; + long lbound2; + long ubound2; + long lbound3; + long ubound3; + long length1; + long length2; + long length3; + + char buff[4096]; + buff[0]=0; + + if( dims == 2) + { + hr= SafeArrayGetLBound( val, 1, &lbound1); + hr= SafeArrayGetUBound( val, 1, &ubound1); + length1= ubound1 - lbound1 +1; + + hr= SafeArrayGetLBound( val, 2, &lbound2); + hr= SafeArrayGetUBound( val, 2, &ubound2); + length2= ubound2 - lbound2 + 1; + char tmpBuf[1024]; + tmpBuf[0]=0; + long index[2]; + for( long i= 0; i< length2; i++) + { + for( long j= 0; j<length1; j++) + { + index[0]= j; + index[1]= i; + long longVal; + CComVariant var; + switch( type) + { + case VT_I4: + hr= SafeArrayGetElement( val, index, &longVal); + sprintf( tmpBuf, "(%d,%d): %d\n", index[1], index[0], longVal); + break; + case VT_UI1: + hr= SafeArrayGetElement( val, index, &longVal); + sprintf( tmpBuf, "(%d,%d): %d\n", index[1], index[0], (unsigned char)longVal); + break; + case VT_VARIANT: + hr= SafeArrayGetElement( val, index, &var ); + sprintf( tmpBuf, "(%d,%d): %d (vartype %d)\n", index[1], index[0], var.byref, var.vt); + break; + } + strcat( buff,tmpBuf); + } + + } + + + } + else if( dims == 3 ) + { + hr= SafeArrayGetLBound( val, 1, &lbound1); + hr= SafeArrayGetUBound( val, 1, &ubound1); + length1= ubound1 - lbound1 +1; + + hr= SafeArrayGetLBound( val, 2, &lbound2); + hr= SafeArrayGetUBound( val, 2, &ubound2); + length2= ubound2 - lbound2 + 1; + + hr= SafeArrayGetLBound( val, 3, &lbound3); + hr= SafeArrayGetUBound( val, 3, &ubound3); + length3= ubound3 - lbound3 +1; + char tmpBuf[1024]; + tmpBuf[0]=0; + long index[3]; + for( long i= 0; i< length3; i++) + { + for( long j= 0; j<length2; j++) + { + for( long k= 0; k<length1; k++) + { + index[0]= k; + index[1]= j; + index[2]= i; + long longVal; + CComVariant var; + switch( type) + { + case VT_I4: + hr= SafeArrayGetElement( val, index, &longVal); + sprintf( tmpBuf, "(%d,%d,%d): %d\n", index[2], index[1], index[0], longVal); + break; + case VT_UI1: + hr= SafeArrayGetElement( val, index, &longVal); + sprintf( tmpBuf, "(%d,%d,%d): %d\n", index[2], index[1], index[0], (unsigned char)longVal); + break; + + case VT_VARIANT: + hr= SafeArrayGetElement( val, index, &var ); + sprintf( tmpBuf, "(%d,%d,%d): %d (vartype %d)\n", index[2], index[1], index[0], var.byref, var.vt); + break; + } + strcat( buff,tmpBuf); + } + } + + } + + } + + MessageBox( NULL, A2T( buff), _T("AxTestControl.Basic"), MB_OK); + + +} + + + diff --git a/extensions/test/ole/AxTestComponents/Basic.h b/extensions/test/ole/AxTestComponents/Basic.h index 97707ea7f246..f32468ac3082 100644 --- a/extensions/test/ole/AxTestComponents/Basic.h +++ b/extensions/test/ole/AxTestComponents/Basic.h @@ -2,9 +2,9 @@ * * $RCSfile: Basic.h,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $ + * last change: $Author: jl $ $Date: 2000-10-12 13:18:22 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,7 +73,7 @@ class ATL_NO_VTABLE CBasic : public IDispatchImpl<IBasic, &IID_IBasic, &LIBID_AXTESTCOMPONENTSLib> { public: - CBasic() + CBasic(): m_cPrpByte(0),m_nPrpShort(0),m_lPrpLong(0),m_fPrpFloat(0), m_dPrpDouble(0),m_PrpArray(0) { } @@ -88,6 +88,32 @@ END_COM_MAP() // IBasic public: + STDMETHOD(inMulDimArrayByte2)(LPSAFEARRAY val); + STDMETHOD(inMulDimArrayByte)(LPSAFEARRAY val); + STDMETHOD(inMulDimArrayVariant2)(LPSAFEARRAY val); + STDMETHOD(inMulDimArrayLong2)(LPSAFEARRAY val); + STDMETHOD(inMulDimArrayVariant)(LPSAFEARRAY val); + STDMETHOD(inMulDimArrayLong)( LPSAFEARRAY val); + STDMETHOD(inoutSequenceObject)(LPSAFEARRAY* val); + STDMETHOD(inoutSequenceDouble)(LPSAFEARRAY * val); + STDMETHOD(inoutSequenceFloat)(LPSAFEARRAY * val); + STDMETHOD(inoutSequenceString)(LPSAFEARRAY* val); + STDMETHOD(inoutSequenceLong)(LPSAFEARRAY * val); + STDMETHOD(inoutSequenceShort)(LPSAFEARRAY * val); + STDMETHOD(inoutSequenceByte)(LPSAFEARRAY * val); + STDMETHOD(outSequenceObject)(/*[out]*/ LPSAFEARRAY* val); + STDMETHOD(outSequenceDouble)(/*[out]*/ LPSAFEARRAY* val); + STDMETHOD(outSequenceFloat)(/*[out]*/ LPSAFEARRAY* val); + STDMETHOD(outSequenceString)(/*[out]*/ LPSAFEARRAY* val); + STDMETHOD(outSequenceLong)(/*[out]*/ LPSAFEARRAY* val); + STDMETHOD(outSequenceShort)(/*[out]*/ LPSAFEARRAY* val); + STDMETHOD(outSequenceByte)(/*[out]*/ LPSAFEARRAY* val); + STDMETHOD(inSequenceObject)(LPSAFEARRAY ar); + STDMETHOD(inSequenceDouble)(LPSAFEARRAY ar); + STDMETHOD(inSequenceFloat)(LPSAFEARRAY ar); + STDMETHOD(inSequenceString)(LPSAFEARRAY ar); + STDMETHOD(inSequenceShort)(LPSAFEARRAY ar); + STDMETHOD(inSequenceByte)(LPSAFEARRAY ar); STDMETHOD(inSequenceLong)(LPSAFEARRAY ar); STDMETHOD(mixed1)( /* [in] */ unsigned char aChar, @@ -153,7 +179,19 @@ public: STDMETHOD(inByte)(/*[in]*/ unsigned char val); +// members for property implementations + unsigned char m_cPrpByte; + short m_nPrpShort; + long m_lPrpLong; + float m_fPrpFloat; + double m_dPrpDouble; + CComPtr<IDispatch> m_PrpObject; CComBSTR m_bstrPrpString; + CComVariant m_PropVariant; + LPSAFEARRAY m_PrpArray; +protected: + static void printArray(LPSAFEARRAY val, BSTR message, VARTYPE type); + static void printMulArray(LPSAFEARRAY val, VARTYPE type); }; #endif //__BASIC_H_ diff --git a/extensions/test/ole/OleClient/clientTest.cxx b/extensions/test/ole/OleClient/clientTest.cxx index 87de5c766518..69af11fde992 100644 --- a/extensions/test/ole/OleClient/clientTest.cxx +++ b/extensions/test/ole/OleClient/clientTest.cxx @@ -2,9 +2,9 @@ * * $RCSfile: clientTest.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $ + * last change: $Author: jl $ $Date: 2000-10-12 13:19:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -95,6 +95,7 @@ Reference<XInvocation> getComObject(OUString& ); HRESULT InitializeParameter(); void printResultVariantArray( VARIANT & var); void printVariant( VARIANT & var); +void printSequence( Sequence<Any>& val); Reference< XMultiServiceFactory > objectFactory; @@ -166,371 +167,706 @@ HRESULT doTest() Any aAny; Any anyOut; char buff[256]; + Any seqAny; //################################################################################### // in parameter //################################################################################### -// aAny <<= ( sal_Int8) 127; -// inv->invoke( OUString(L"inByte"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + aAny <<= ( sal_Int8) 127; + inv->invoke( OUString(L"inByte"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + + aAny <<= ( sal_Int16) 0xffff; + inv->invoke( OUString(L"inShort"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); +// + aAny <<= ( sal_Int32) 1234567; + inv->invoke( OUString(L"inLong"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + + aAny <<= OUString(L" this is clientTest.exe"); + inv->invoke( OUString(L"inString"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + + aAny <<= ( float) 3.14; + inv->invoke( OUString(L"inFloat"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + + aAny <<= ( double) 3.145; + inv->invoke( OUString(L"inDouble"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + + aAny <<= OUString( L" A string in an any"); + inv->invoke( OUString(L"inVariant"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + + OUString arStr[]= {L"string0", L"string1", L"string2"}; + Sequence<OUString> seq( arStr, 3); + Any arAny[1]; + arAny[0] <<= seq; + inv->invoke( OUString(L"inArray"), Sequence< Any > ( arAny, 1), seqIndices, seqOut); + + // same again but this time Sequence<Any> with the Anys containing strings. + OUString arStr1[]= {L"string0", L"string1", L"string2"}; + Any arAnyStr1[3]; + arAnyStr1[0]<<= arStr1[0]; + arAnyStr1[1]<<= arStr1[1]; + arAnyStr1[2]<<= arStr1[2]; + Sequence<Any> seq_1( arAnyStr1, 3); + Any arAny_1[1]; + arAny_1[0] <<= seq_1; + inv->invoke( OUString(L"inArray"), Sequence< Any > ( arAny_1, 1), seqIndices, seqOut); +// + Reference < XInvocation > inv2= getComObject(L"AxTestComponents.Basic"); + Any anyVal; + anyVal <<= OUString(L"this is the value of prpString"); + inv2->setValue( OUString(L"prpString"), anyVal); + aAny <<= inv2; + inv->invoke( OUString(L"inObject"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + //################################################################################### + // out parameter + //################################################################################### +// // outByte + aAny= Any(); + seqIndices.realloc( 0); + seqOut.realloc(0); + inv->invoke( OUString(L"outByte"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); + anyOut <<= seqOut[0]; + sprintf( buff, " out Byte: %d", *( char*)anyOut.getValue()); + MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); + + // outShort + seqIndices.realloc( 0); + seqOut.realloc(0); + inv->invoke( OUString(L"outShort"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); + anyOut <<= seqOut[0]; + sprintf( buff, " out Short: %d", *( sal_Int16*)anyOut.getValue()); + MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); + + // outLong + seqIndices.realloc( 0); + seqOut.realloc(0); + inv->invoke( OUString(L"outLong"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); + anyOut <<= seqOut[0]; + sprintf( buff, " out Long: %d", *( sal_Int32*)anyOut.getValue()); + MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); + + // outString + seqIndices.realloc( 0); + seqOut.realloc(0); + inv->invoke( OUString(L"outString"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); + anyOut <<= seqOut[0]; + sprintf( buff, " out String: %S", (*( OUString*)anyOut.getValue()).getStr()); + MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); + + // outFloat + seqIndices.realloc( 0); + seqOut.realloc(0); + inv->invoke( OUString(L"outFloat"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); + anyOut <<= seqOut[0]; + sprintf( buff, " out float: %f", *( float*)anyOut.getValue()); + MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); + + // outDouble + seqIndices.realloc( 0); + seqOut.realloc(0); + inv->invoke( OUString(L"outDouble"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); + anyOut <<= seqOut[0]; + sprintf( buff, " out double: %g", *( double*)anyOut.getValue()); + MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); // -// aAny <<= ( sal_Int16) 0xffff; -// inv->invoke( OUString(L"inShort"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); +// // outVariant + seqIndices.realloc( 0); + seqOut.realloc(0); + inv->invoke( OUString(L"outVariant"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); + anyOut <<= seqOut[0]; + if( anyOut.getValueTypeClass() == TypeClass_STRING) + { + OUString s; + anyOut >>= s; + sprintf( buff, " out string ( variant): %S", s.getStr()); + MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); + } + + // outArray + seqIndices.realloc( 0); + seqOut.realloc(0); + inv->invoke( OUString(L"outArray"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); + anyOut <<= seqOut[0]; + Sequence<Any> seqOutValue; + anyOut >>= seqOutValue; + + // we assume that the Sequence contains Anys of strings + OUString usMessage; + for( int i=0; i < seqOutValue.getLength(); i++) + { + OUString stemp; + if( seqOutValue[i] >>= stemp) + { + usMessage += OUString(L"\n"); + usMessage += stemp; + } + } + MessageBox( NULL, W2T( usMessage.getStr()), _T("Test Program"), MB_OK); -// aAny <<= ( sal_Int32) 1234567; -// inv->invoke( OUString(L"inLong"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + // outObject + seqIndices.realloc( 0); + seqOut.realloc(0); + inv->invoke( OUString(L"outObject"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); + Reference<XInvocation> invOut; + if( seqOut[0]>>=invOut) + { + Any val= invOut->getValue( L"prpString"); + + if( val.getValueTypeClass() == TypeClass_STRING) + { + OUString s; + val>>=s; + MessageBox( NULL,W2T( s.getStr()), _T("Test Program"), MB_OK); + } + } // -// aAny <<= OUString(L" this is clientTest.exe"); -// inv->invoke( OUString(L"inString"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + //################################################################################### + // in/out parameter + //################################################################################### + seqIndices.realloc( 0); + seqOut.realloc(0); + aAny <<= ( sal_Int8) 127; + inv->invoke( OUString(L"inoutByte"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + anyOut <<= seqOut[0]; + sprintf( buff, " in out Byte: %d", *( char*)anyOut.getValue()); + MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); // -// aAny <<= ( float) 3.14; -// inv->invoke( OUString(L"inFloat"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); +// // in out short + seqIndices.realloc( 0); + seqOut.realloc(0); + aAny <<= ( sal_Int16) 1111; + inv->invoke( OUString(L"inoutShort"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + anyOut <<= seqOut[0]; + sprintf( buff, " in out Short: %d", *( sal_Int16*)anyOut.getValue()); + MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); + + //in out long + seqIndices.realloc( 0); + seqOut.realloc(0); + aAny <<= ( sal_Int32) 111111; + inv->invoke( OUString(L"inoutLong"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + anyOut <<= seqOut[0]; + sprintf( buff, "inout Long: %d", *( sal_Int32*)anyOut.getValue()); + MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); + + //in out string + seqIndices.realloc( 0); + seqOut.realloc(0); + aAny <<= OUString(L" this is clientTest.exe"); + inv->invoke( OUString(L"inoutString"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + anyOut <<= seqOut[0]; + sprintf( buff, " inout String: %S", (*( OUString*)anyOut.getValue()).getStr()); + MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); + + //in out float + seqIndices.realloc( 0); + seqOut.realloc(0); + aAny <<= ( float) 3.14; + inv->invoke( OUString(L"inoutFloat"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + anyOut <<= seqOut[0]; + sprintf( buff, " inout float: %f", *( float*)anyOut.getValue()); + MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); + + // in out double + seqIndices.realloc( 0); + seqOut.realloc(0); + aAny <<= ( double) 3.145; + inv->invoke( OUString(L"inoutDouble"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + anyOut <<= seqOut[0]; + sprintf( buff, " inout double: %g", *( double*)anyOut.getValue()); + MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); + + // in out VARIANT + seqIndices.realloc( 0); + seqOut.realloc(0); + aAny <<= OUString( L" A string in an any"); + inv->invoke( OUString(L"inoutVariant"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + anyOut <<= seqOut[0]; + if( anyOut.getValueTypeClass() == TypeClass_STRING) + { + OUString s; + anyOut >>= s; + sprintf( buff, " in out string ( variant): %S", s.getStr()); + MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); + } // -// aAny <<= ( double) 3.145; -// inv->invoke( OUString(L"inDouble"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + // in out Array + seqIndices.realloc( 0); + seqOut.realloc(0); + OUString arStr2[]= {L"string0", L"string1", L"string2"}; + Sequence<OUString> seq2( arStr2, 3); + Any arAny2[1]; + arAny2[0] <<= seq2; + inv->invoke( OUString(L"inoutArray"), Sequence< Any > ( arAny2, 1), seqIndices, seqOut); + Sequence<Any> seqOutValue2; + seqOut[0]>>= seqOutValue2; + + // we assume that the Sequence contains Anys of strings + OUString usMessage2; + for(int i2=0; i2 < seqOutValue2.getLength(); i2++) + { + OUString stemp; + if( seqOutValue2[i2] >>= stemp) + { + usMessage2 += OUString(L"\n"); + usMessage2 += stemp; + } + } + MessageBox( NULL, W2T( usMessage2.getStr()), _T("Test Program"), MB_OK); // -// aAny <<= OUString( L" A string in an any"); -// inv->invoke( OUString(L"inVariant"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + + seqIndices.realloc( 0); + seqOut.realloc(0); + Reference < XInvocation > inv3= getComObject(L"AxTestComponents.Basic"); + Any anyVal2; + anyVal2 <<= OUString(L"this is the value of prpString"); + inv3->setValue( OUString(L"prpString"), anyVal2); + aAny <<= inv3; + inv->invoke( OUString(L"inoutObject"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); + Reference<XInvocation> invOut2; + if( seqOut[0]>>=invOut2) + { + Any val= invOut2->getValue( L"prpString"); + + if( val.getValueTypeClass() == TypeClass_STRING) + { + OUString s; + val>>=s; + MessageBox( NULL,W2T( s.getStr()), _T("Test Program"), MB_OK); + } + } // -// OUString arStr[]= {L"string0", L"string1", L"string2"}; -// Sequence<OUString> seq( arStr, 3); -// Any arAny[1]; -// arAny[0] <<= seq; -// inv->invoke( OUString(L"inArray"), Sequence< Any > ( arAny, 1), seqIndices, seqOut); - -// Reference < XInvocation > inv2= getComObject(L"AxTestComponents.Basic"); -// Any anyVal; -// anyVal <<= OUString(L"this is the value of prpString"); -// inv2->setValue( OUString(L"prpString"), anyVal); -// aAny <<= inv2; -// inv->invoke( OUString(L"inObject"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); // //################################################################################### -// // out parameter +// // mixed parameter // //################################################################################### - // outByte -// aAny= Any(); -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// inv->invoke( OUString(L"outByte"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); -// anyOut <<= seqOut[0]; -// sprintf( buff, " out Byte: %d", *( char*)anyOut.getValue()); -// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); -// -// // outShort -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// inv->invoke( OUString(L"outShort"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); -// anyOut <<= seqOut[0]; -// sprintf( buff, " out Short: %d", *( sal_Int16*)anyOut.getValue()); -// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); -// -// // outLong -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// inv->invoke( OUString(L"outLong"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); -// anyOut <<= seqOut[0]; -// sprintf( buff, " out Long: %d", *( sal_Int32*)anyOut.getValue()); -// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); -// -// // outString -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// inv->invoke( OUString(L"outString"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); -// anyOut <<= seqOut[0]; -// sprintf( buff, " out String: %S", (*( OUString*)anyOut.getValue()).getStr()); -// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); -// -// // outFloat -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// inv->invoke( OUString(L"outFloat"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); -// anyOut <<= seqOut[0]; -// sprintf( buff, " out float: %f", *( float*)anyOut.getValue()); -// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); -// -// // outDouble -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// inv->invoke( OUString(L"outDouble"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); -// anyOut <<= seqOut[0]; -// sprintf( buff, " out double: %g", *( double*)anyOut.getValue()); -// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); - - // outVariant -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// inv->invoke( OUString(L"outVariant"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); -// anyOut <<= seqOut[0]; -// if( anyOut.getValueTypeClass() == TypeClass_STRING) -// { -// OUString s; -// anyOut >>= s; -// sprintf( buff, " out string ( variant): %S", s.getStr()); -// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); -// } -// -// // outArray -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// inv->invoke( OUString(L"outArray"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); -// anyOut <<= seqOut[0]; -// Sequence<Any> seqOutValue; -// anyOut >>= seqOutValue; -// -// // we assume that the Sequence contains Anys of strings -// OUString usMessage; -// for( int i=0; i < seqOutValue.getLength(); i++) -// { -// OUString stemp; -// if( seqOutValue[i] >>= stemp) -// { -// usMessage += OUString(L"\n"); -// usMessage += stemp; -// } -// } -// MessageBox( NULL, W2T( usMessage.getStr()), _T("Test Program"), MB_OK); -// -// // outObject -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// inv->invoke( OUString(L"outObject"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut); -// Reference<XInvocation> invOut; -// if( seqOut[0]>>=invOut) -// { -// Any val= invOut->getValue( L"prpString"); -// -// if( val.getValueTypeClass() == TypeClass_STRING) -// { -// OUString s; -// val>>=s; -// MessageBox( NULL,W2T( s.getStr()), _T("Test Program"), MB_OK); -// } -// } + // mixed1 + seqIndices.realloc( 0); + seqOut.realloc(0); + Sequence< Any > params(12); + sal_Int8 aByte=111; + OUString aString(L" a string in a VARIANT"); + Any param[12]; + param[0] <<= aByte; + param[2] <<= aByte; //in out + param[3] <<= aString; // in String + param[5] <<= aString; // in out string + + OUString arStr3[]= {L"string0", L"string1", L"string2"}; + Sequence<OUString> seq3( arStr3,3); + param[6] <<= seq3; // in Array + param[8] <<= seq3; // in ou Array + + Reference < XInvocation > inv4= getComObject(L"AxTestComponents.Basic"); + Any anyVal3; + anyVal3 <<= OUString(L"this is the value of prpString"); + inv4->setValue( OUString(L"prpString"), anyVal3); + param[9] <<= inv4; // in dispatch + param[11] <<= inv4; + inv->invoke( OUString(L"mixed1"), Sequence< Any > ( param, 12),seqIndices, seqOut); + + for( int i3=0; i3<seqOut.getLength();i3++) + { + Any any; + any <<= seqOut[i3]; + + } + sal_Int8 outChar= *( char*)seqOut[0].getValue(); + sal_Int8 inoutChar= *( char*)seqOut[1].getValue(); + sprintf( buff, " out Byte: %d \n in out Byte %d", outChar, inoutChar ); + MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); + + OUString outString( *(OUString*)seqOut[2].getValue()); + OUString inoutString( *(OUString*)seqOut[3].getValue()); + sprintf( buff, "out string: %S \n in out string: %S", outString.getStr(), inoutString.getStr()); + MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); + + Sequence< Any > outSeq; + seqOut[4] >>= outSeq; + OUString usMessage3; + for(int i4=0; i4 < outSeq.getLength(); i4++) + { + OUString stemp; + if( outSeq[i4] >>= stemp) + { + usMessage3 += OUString(L"\n"); + usMessage3 += stemp; + } + } + MessageBox( NULL, W2T( usMessage3.getStr()), _T("Test Program. out Sequence"), MB_OK); + + seqOut[5] >>= outSeq; + OUString usMessage4; + for(int i5=0; i5 < outSeq.getLength(); i5++) + { + OUString stemp; + if( outSeq[i5] >>= stemp) + { + usMessage4 += OUString(L"\n"); + usMessage4 += stemp; + } + } + MessageBox( NULL, W2T( usMessage3.getStr()), _T("Test Program. in out Sequence"), MB_OK); + + Reference<XInvocation> invOut3; + seqOut[6] >>= invOut3; + if( seqOut[0]>>=invOut3) + { + Any val= invOut3->getValue( L"prpString"); + + if( val.getValueTypeClass() == TypeClass_STRING) + { + OUString s; + val>>=s; + MessageBox( NULL,W2T( s.getStr()), _T("Test Program, out object"), MB_OK); + } + } + + Reference<XInvocation> invOut4; + seqOut[6] >>= invOut4; + if( seqOut[0]>>=invOut4) + { + Any val= invOut4->getValue( L"prpString"); + if( val.getValueTypeClass() == TypeClass_STRING) + { + OUString s; + val>>=s; + MessageBox( NULL,W2T( s.getStr()), _T("Test Program, in out object"), MB_OK); + } + } +// // //################################################################################### -// // in/out parameter +// // in Sequences // //################################################################################### -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// aAny <<= ( sal_Int8) 127; -// inv->invoke( OUString(L"inoutByte"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); -// anyOut <<= seqOut[0]; -// sprintf( buff, " in out Byte: %d", *( char*)anyOut.getValue()); -// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); - - // in out short -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// aAny <<= ( sal_Int16) 1111; -// inv->invoke( OUString(L"inoutShort"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); -// anyOut <<= seqOut[0]; -// sprintf( buff, " in out Short: %d", *( sal_Int16*)anyOut.getValue()); -// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); -// -// //in out long -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// aAny <<= ( sal_Int32) 111111; -// inv->invoke( OUString(L"inoutLong"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); -// anyOut <<= seqOut[0]; -// sprintf( buff, "inout Long: %d", *( sal_Int32*)anyOut.getValue()); -// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); -// -// //in out string -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// aAny <<= OUString(L" this is clientTest.exe"); -// inv->invoke( OUString(L"inoutString"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); -// anyOut <<= seqOut[0]; -// sprintf( buff, " inout String: %S", (*( OUString*)anyOut.getValue()).getStr()); -// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); -// -// //in out float -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// aAny <<= ( float) 3.14; -// inv->invoke( OUString(L"inoutFloat"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); -// anyOut <<= seqOut[0]; -// sprintf( buff, " inout float: %f", *( float*)anyOut.getValue()); -// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); +// // inSequenceLong + seqIndices.realloc( 0); + seqOut.realloc(0); + sal_Int32 arLong[]={ 1,2,3}; + Sequence< sal_Int32 > seqLong( arLong, 3); +// +// // seqLongAny <<= seqLong; // 1 dimension +// // seqLongAny<<= seq; // 2 dimensions +// // seqLongAny<<= seq1; +// // seqLongAny<<= Sequence<sal_Int32>( arLong, 3); +// + seqAny<<= seqLong; + inv->invoke( OUString(L"inSequenceLong"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); +// +// // inSequenceShort + sal_Int16 arShort[]={1,2,3}; + Sequence<sal_Int16> seqShort(arShort, 3); + seqAny<<= seqShort; + inv->invoke( OUString(L"inSequenceShort"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); +// +// // inSequenceByte + sal_Int8 arByte[]={1,2,3}; + Sequence<sal_Int8> seqByte(arByte, 3); + seqAny<<= seqByte; + inv->invoke( OUString(L"inSequenceByte"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); +// +// // inSequenceString + OUString arString[]={L"string one", L"string two", L"string three"}; + Sequence<OUString> seqString( arString, 3); + seqAny<<= seqString; + inv->invoke( OUString(L"inSequenceString"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); +// +// // inSequenceFloat + float arFloat[]={3.14, 31.4, 314.}; + Sequence<float> seqFloat( arFloat, 3); + seqAny<<=seqFloat; + inv->invoke( OUString(L"inSequenceFloat"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); +// +// // inSequenceDouble + double arDouble[]={3.14, 31.4, 314.}; + Sequence<double> seqDouble( arDouble, 3); + seqAny<<=seqDouble; + inv->invoke( OUString(L"inSequenceDouble"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); +// +// +// // inSequenceObject + Any anyVala; + OUString sVal; + Sequence<Reference<XInvocation> > seqObj(3); + seqObj[0]= getComObject(L"AxTestComponents.Basic"); + sVal= L"this is the property value of prpString (1)"; + anyVala<<= sVal; + seqObj[0]->setValue( OUString( L"prpString"), anyVala); + + seqObj[1]= getComObject(L"AxTestComponents.Basic"); + sVal= L"this is the property valuef of prpString (2)"; + anyVala<<= sVal; + seqObj[1]->setValue( OUString( L"prpString"), anyVala); + + seqObj[2]= getComObject(L"AxTestComponents.Basic"); + sVal= L"this is the property value of prpString (3)"; + anyVala<<= sVal; + seqObj[2]->setValue( OUString( L"prpString"), anyVala); + + seqAny<<=seqObj; + inv->invoke( OUString(L"inSequenceObject"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); // -// // in out double -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// aAny <<= ( double) 3.145; -// inv->invoke( OUString(L"inoutDouble"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); -// anyOut <<= seqOut[0]; -// sprintf( buff, " inout double: %g", *( double*)anyOut.getValue()); -// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); +// //################################################################################### +// // out Sequences +// //################################################################################### // -// // in out VARIANT -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// aAny <<= OUString( L" A string in an any"); -// inv->invoke( OUString(L"inoutVariant"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); -// anyOut <<= seqOut[0]; -// if( anyOut.getValueTypeClass() == TypeClass_STRING) -// { -// OUString s; -// anyOut >>= s; -// sprintf( buff, " in out string ( variant): %S", s.getStr()); -// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); -// } - -// // in out Array -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// OUString arStr2[]= {L"string0", L"string1", L"string2"}; -// Sequence<OUString> seq2( arStr2, 3); -// Any arAny2[1]; -// arAny2[0] <<= seq2; -// inv->invoke( OUString(L"inoutArray"), Sequence< Any > ( arAny2, 1), seqIndices, seqOut); -// Sequence<Any> seqOutValue2; -// seqOut[0]>>= seqOutValue2; +// // outSequenceByte // -// // we assume that the Sequence contains Anys of strings -// OUString usMessage2; -// for(int i2=0; i2 < seqOutValue2.getLength(); i2++) -// { -// OUString stemp; -// if( seqOutValue2[i2] >>= stemp) -// { -// usMessage2 += OUString(L"\n"); -// usMessage2 += stemp; -// } -// } -// MessageBox( NULL, W2T( usMessage2.getStr()), _T("Test Program"), MB_OK); + inv->invoke( OUString(L"outSequenceByte"),Sequence< Any > (), seqIndices, seqOut); + printSequence( *(Sequence<Any>*)seqOut[0].getValue()); -// -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// Reference < XInvocation > inv3= getComObject(L"AxTestComponents.Basic"); -// Any anyVal2; -// anyVal2 <<= OUString(L"this is the value of prpString"); -// inv3->setValue( OUString(L"prpString"), anyVal2); -// aAny <<= inv3; -// inv->invoke( OUString(L"inoutObject"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); -// Reference<XInvocation> invOut2; -// if( seqOut[0]>>=invOut2) -// { -// Any val= invOut2->getValue( L"prpString"); -// -// if( val.getValueTypeClass() == TypeClass_STRING) -// { -// OUString s; -// val>>=s; -// MessageBox( NULL,W2T( s.getStr()), _T("Test Program"), MB_OK); -// } -// } - //################################################################################### - // mixed parameter - //################################################################################### -// // mixed1 -// seqIndices.realloc( 0); -// seqOut.realloc(0); -// Sequence< Any > params(12); -// sal_Int8 aByte=111; -// OUString aString(L" a string in a VARIANT"); -// Any param[12]; -// param[0] <<= aByte; -// param[2] <<= aByte; //in out -// param[3] <<= aString; // in String -// param[5] <<= aString; // in out string -// -// OUString arStr3[]= {L"string0", L"string1", L"string2"}; -// Sequence<OUString> seq3( arStr3,3); -// param[6] <<= seq3; // in Array -// param[8] <<= seq3; // in ou Array -// -// Reference < XInvocation > inv4= getComObject(L"AxTestComponents.Basic"); -// Any anyVal3; -// anyVal3 <<= OUString(L"this is the value of prpString"); -// inv4->setValue( OUString(L"prpString"), anyVal3); -// param[9] <<= inv4; // in dispatch -// param[11] <<= inv4; -// inv->invoke( OUString(L"mixed1"), Sequence< Any > ( param, 12),seqIndices, seqOut); -// -// for( int i3=0; i3<seqOut.getLength();i3++) -// { -// Any any; -// any <<= seqOut[i3]; -// -// } -// sal_Int8 outChar= *( char*)seqOut[0].getValue(); -// sal_Int8 inoutChar= *( char*)seqOut[1].getValue(); -// sprintf( buff, " out Byte: %d \n in out Byte %d", outChar, inoutChar ); -// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); -// -// OUString outString( *(OUString*)seqOut[2].getValue()); -// OUString inoutString( *(OUString*)seqOut[3].getValue()); -// sprintf( buff, "out string: %S \n in out string: %S", outString.getStr(), inoutString.getStr()); -// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK); -// -// Sequence< Any > outSeq; -// seqOut[4] >>= outSeq; -// OUString usMessage3; -// for(int i4=0; i4 < outSeq.getLength(); i4++) -// { -// OUString stemp; -// if( outSeq[i4] >>= stemp) -// { -// usMessage3 += OUString(L"\n"); -// usMessage3 += stemp; -// } -// } -// MessageBox( NULL, W2T( usMessage3.getStr()), _T("Test Program. out Sequence"), MB_OK); -// -// seqOut[5] >>= outSeq; -// OUString usMessage4; -// for(int i5=0; i5 < outSeq.getLength(); i5++) -// { -// OUString stemp; -// if( outSeq[i5] >>= stemp) -// { -// usMessage4 += OUString(L"\n"); -// usMessage4 += stemp; -// } -// } -// MessageBox( NULL, W2T( usMessage3.getStr()), _T("Test Program. in out Sequence"), MB_OK); -// -// Reference<XInvocation> invOut3; -// seqOut[6] >>= invOut3; -// if( seqOut[0]>>=invOut3) -// { -// Any val= invOut3->getValue( L"prpString"); + // outSequenceShort + inv->invoke( OUString(L"outSequenceShort"),Sequence< Any > (), seqIndices, seqOut); + printSequence(*(Sequence<Any>*)seqOut[0].getValue()); + + + // outSequenceLong + inv->invoke( OUString(L"outSequenceLong"),Sequence< Any > (), seqIndices, seqOut); + printSequence(*(Sequence<Any>*)seqOut[0].getValue()); + + // outSequenceString + inv->invoke( OUString(L"outSequenceString"),Sequence< Any > (), seqIndices, seqOut); + printSequence(*(Sequence<Any>*)seqOut[0].getValue()); + + // outSequenceFloat + inv->invoke( OUString(L"outSequenceFloat"),Sequence< Any > (), seqIndices, seqOut); + printSequence( *(Sequence<Any>*)seqOut[0].getValue()); + + + //outSequenceDouble + inv->invoke( OUString(L"outSequenceDouble"),Sequence< Any > (), seqIndices, seqOut); + printSequence(*(Sequence<Any>*)seqOut[0].getValue()); // -// if( val.getValueTypeClass() == TypeClass_STRING) -// { -// OUString s; -// val>>=s; -// MessageBox( NULL,W2T( s.getStr()), _T("Test Program, out object"), MB_OK); -// } -// } +// //outSequenceObject + inv->invoke( OUString(L"outSequenceObject"),Sequence< Any > (), seqIndices, seqOut); + printSequence( *(Sequence<Any>*)seqOut[0].getValue()); // -// Reference<XInvocation> invOut4; -// seqOut[6] >>= invOut4; -// if( seqOut[0]>>=invOut4) -// { -// Any val= invOut4->getValue( L"prpString"); +// // outSequenceVariant (see outArray) +// //################################################################################### +// // in out Sequences +// //################################################################################### +// // inoutSequenceByte + sal_Int8 arByte1[]={1,2,3}; + Sequence<sal_Int8> seqByteIO(arByte1, 3); + seqAny<<= seqByteIO; + inv->invoke( OUString(L"inoutSequenceByte"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); + printSequence( *(Sequence<Any>*)seqOut[0].getValue()); + + // inoutSequenceShort + sal_Int16 arShort1[]={1,2,3}; + Sequence<sal_Int16> seqShortIO(arShort1, 3); + seqAny<<= seqShortIO; + inv->invoke( OUString(L"inoutSequenceShort"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); + printSequence( *(Sequence<Any>*)seqOut[0].getValue()); + + + // inoutSequenceLong + sal_Int32 arLong1[]={ 1,2,3}; + Sequence< sal_Int32 > seqLongIO( arLong1, 3); + seqAny<<= seqLongIO; + inv->invoke( OUString(L"inoutSequenceLong"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); + printSequence( *(Sequence<Any>*)seqOut[0].getValue()); + + // inoutSequenceString + OUString arString1[]={L"string one", L"string two", L"string three"}; + Sequence<OUString> seqStringIO( arString1, 3); + seqAny<<= seqStringIO; + inv->invoke( OUString(L"inoutSequenceString"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); + printSequence( *(Sequence<Any>*)seqOut[0].getValue()); + + // inoutSequenceFloat + float arFloat1[]={3.14, 31.4, 314.}; + Sequence<float> seqFloatIO( arFloat1, 3); + seqAny<<=seqFloatIO; + inv->invoke( OUString(L"inoutSequenceFloat"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); + printSequence( *(Sequence<Any>*)seqOut[0].getValue()); + + // inoutSequenceDouble + double arDouble1[]={3.14, 31.4, 314.}; + Sequence<double> seqDoubleIO( arDouble1, 3); + seqAny<<=seqDoubleIO; + inv->invoke( OUString(L"inoutSequenceDouble"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); + printSequence( *(Sequence<Any>*)seqOut[0].getValue()); +// +// +// // inoutSequenceObject + Any anyValb; + OUString sVala; + Sequence<Reference<XInvocation> > seqObjIO(3); + seqObjIO[0]= getComObject(L"AxTestComponents.Basic"); + sVala= L"this is the property value of prpString (1)"; + anyValb<<= sVala; + seqObjIO[0]->setValue( OUString( L"prpString"), anyValb); + + seqObjIO[1]= getComObject(L"AxTestComponents.Basic"); + sVala= L"this is the property valuef of prpString (2)"; + anyValb<<= sVala; + seqObjIO[1]->setValue( OUString( L"prpString"), anyValb); + + seqObjIO[2]= getComObject(L"AxTestComponents.Basic"); + sVala= L"this is the property value of prpString (3)"; + anyValb<<= sVala; + seqObjIO[2]->setValue( OUString( L"prpString"), anyValb); + + seqAny<<=seqObjIO; + inv->invoke( OUString(L"inoutSequenceObject"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); + printSequence( *(Sequence<Any>*)seqOut[0].getValue()); // -// if( val.getValueTypeClass() == TypeClass_STRING) -// { -// OUString s; -// val>>=s; -// MessageBox( NULL,W2T( s.getStr()), _T("Test Program, in out object"), MB_OK); -// } -// } +// //################################################################################### +// // in multi Sequences +// //################################################################################### +// // inMulDimArrayLong + sal_Int32 arLongi[]={1,2,3}; + sal_Int32 arLongi2[]={4,5,6,7}; + sal_Int32 arLongi3[]={8,9,10,11,12}; + + Sequence<sal_Int32> seqLongi1( arLongi, 3); + Sequence<sal_Int32> seqLongi2( arLongi2, 4); + Sequence<sal_Int32> seqLongi3( arLongi3, 5); + + Sequence< Sequence< sal_Int32 > > seq2i(3); + seq2i[0]= seqLongi1; + seq2i[1]= seqLongi2; + seq2i[2]= seqLongi3; + seqAny<<= seq2i; + // dimension length 3,5 + inv->invoke( OUString(L"inMulDimArrayLong"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); +// + //inMulDimArrayVariant + inv->invoke( OUString(L"inMulDimArrayVariant"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); + + //inMulDimArrayLong2 + sal_Int32 arLongii1[]={1,2,3}; + sal_Int32 arLongii2[]={4,5,6,7}; + sal_Int32 arLongii3[]={8,9,10,11,12}; + sal_Int32 arLongii4[]={13,14,15,16}; + sal_Int32 arLongii5[]={17,18,19}; + + Sequence<sal_Int32> seqLongii1( arLongii1, 3); + Sequence<sal_Int32> seqLongii2( arLongii2, 4); + Sequence<sal_Int32> seqLongii3( arLongii3, 5); + Sequence<sal_Int32> seqLongii4( arLongii4, 4); + Sequence<sal_Int32> seqLongii5( arLongii5, 3); + + Sequence< Sequence< sal_Int32 > > seq2ii(3); + Sequence< Sequence< sal_Int32> > seq2ii2(2); + seq2ii[0]= seqLongii1; + seq2ii[1]= seqLongii2; + seq2ii[2]= seqLongii3; + + seq2ii2[0]= seqLongii4; + seq2ii2[1]= seqLongii5; + + Sequence< Sequence< Sequence< sal_Int32> > > seq3ii(2); + seq3ii[0]=seq2ii; + seq3ii[1]=seq2ii2; + seqAny<<= seq3ii; + inv->invoke( OUString(L"inMulDimArrayLong2"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); + + // inMulDimArrayByte2 + sal_Int8 arByteii1[]={1,2,3}; + sal_Int8 arByteii2[]={4,5,6,7}; + sal_Int8 arByteii3[]={8,9,10,11,12}; + sal_Int8 arByteii4[]={13,14,15,16}; + sal_Int8 arByteii5[]={17,18,19}; + + Sequence<sal_Int8> seqByteii1( arByteii1, 3); + Sequence<sal_Int8> seqByteii2( arByteii2, 4); + Sequence<sal_Int8> seqByteii3( arByteii3, 5); + Sequence<sal_Int8> seqByteii4( arByteii4, 4); + Sequence<sal_Int8> seqByteii5( arByteii5, 3); + + Sequence< Sequence< sal_Int8 > > seq2Byteii(3); + Sequence< Sequence< sal_Int8> > seq2Byteii2(2); + seq2Byteii[0]= seqByteii1; + seq2Byteii[1]= seqByteii2; + seq2Byteii[2]= seqByteii3; + + seq2Byteii2[0]= seqByteii4; + seq2Byteii2[1]= seqByteii5; + + Sequence< Sequence< Sequence< sal_Int8> > > seq3Byteii(2); + seq3Byteii[0]=seq2Byteii; + seq3Byteii[1]=seq2Byteii2; + seqAny<<= seq3Byteii; + inv->invoke( OUString(L"inMulDimArrayByte2"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); //################################################################################### - // Sequences + // Properties //################################################################################### - seqIndices.realloc( 0); - seqOut.realloc(0); - sal_Int32 arLong[]={ 1,2,3}; - Any seqLongAny; - seqLongAny<<= Sequence<sal_Int32>( arLong, 3); - inv->invoke( OUString(L"inSequenceLong"),Sequence< Any > ( &seqLongAny, 1), seqIndices, seqOut); - + // prpByte + Any prpAny; + sal_Int8 aByte1= 111; + prpAny<<= aByte1; + inv->setValue(OUString(L"prpByte"), prpAny); + prpAny= Any(); + aByte1=0; + prpAny= inv->getValue(OUString(L"prpByte")); + prpAny>>= aByte1; + // prpShort + + // prpLong return hr; } + + +void printSequence( Sequence<Any>& val) +{ + +// typelib_TypeDescription* desc; +// val.getValueTypeDescription( &desc); +// typelib_typedescription_release( desc); + + USES_CONVERSION; + char buff[1024]; + buff[0]=0; + char tmpBuf[1024]; + tmpBuf[0]=0; + sal_Int32 i; + + for( i=0; i< val.getLength(); i++) + { + Any& elem= val[i]; + switch ( elem.getValueTypeClass()) + { + case TypeClass_BYTE: + sprintf( tmpBuf, "sal_Int8 %d \n", *(sal_Int8*)elem.getValue()); + break; + case TypeClass_SHORT: + sprintf( tmpBuf, "sal_Int16 %d \n", *(sal_Int16*)elem.getValue()); + break; + case TypeClass_LONG: + sprintf( tmpBuf, "sal_Int32 %d \n", *(sal_Int32*)elem.getValue()); + break; + case TypeClass_DOUBLE: + sprintf( tmpBuf, "double %f \n", *(double*)elem.getValue()); + break; + case TypeClass_FLOAT: + sprintf( tmpBuf, "float %f \n", *(float*)elem.getValue()); + break; + case TypeClass_STRING: + sprintf( tmpBuf, "%S \n", (*(OUString*)elem.getValue()).getStr()); + break; + case TypeClass_INTERFACE: + { + // we assume that the interface is XInvocation of a AxTestControls.Basic component. + Reference<XInvocation> inv; + elem>>= inv; + if( inv.is()) + { + Any prpVal= inv->getValue( OUString( L"prpString")); + sprintf( tmpBuf, "Property prpString: %S \n", (*(OUString*)prpVal.getValue()).getStr()); + } + break; + } + default:break; + } + strcat( buff, tmpBuf); + + } + + MessageBox( NULL, A2T(buff), _T("clientTest: printing Sequence elements"), MB_OK); +} + +//VARIANT VT_UI1 + |