diff options
author | Mikhail Voytenko <mav@openoffice.org> | 2010-07-08 21:33:48 +0200 |
---|---|---|
committer | Mikhail Voytenko <mav@openoffice.org> | 2010-07-08 21:33:48 +0200 |
commit | 0dbcd1302d027c2d3e722d7c61208d5a318013ab (patch) | |
tree | 070cc8cb6eb1e461e1cd26a72d1b9c4c125c8cab | |
parent | 914589c59d1151b4f8f8f45cc7a03e23e5eb6e39 (diff) |
mib17: #162917# let basic byte use one byte, let olebridge convert sequence to safearray correctly
-rw-r--r-- | extensions/source/ole/unoconversionutilities.hxx | 58 |
1 files changed, 36 insertions, 22 deletions
diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx index e8eb3ad6f..1fec67353 100644 --- a/extensions/source/ole/unoconversionutilities.hxx +++ b/extensions/source/ole/unoconversionutilities.hxx @@ -1324,33 +1324,47 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq) typelib_TypeDescription* pSeqElementDesc= NULL; TYPELIB_DANGER_GET( &pSeqElementDesc, pSeqElementTypeRef); - 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->elements; - - for (sal_uInt32 i = 0; i < n; i++) + + // try to find VARIANT type that is related to the UNO type of the sequence elements + // the sequence as a sequence element should be handled in a special way + VARTYPE eTargetElementType = VT_EMPTY; + if ( pSeqElementDesc->eTypeClass != TypeClass_SEQUENCE ) + eTargetElementType = mapTypeClassToVartype( static_cast< TypeClass >( pSeqElementDesc->eTypeClass ) ); + + if ( eTargetElementType != VT_EMPTY ) + pArray = createUnoSequenceWrapper( rSeq, eTargetElementType ); + + if ( !pArray ) { - unoElement.setValue( pSeqData + i * nElementSize, pSeqElementDesc); - VariantInit(&oleElement); + sal_Int32 nElementSize= pSeqElementDesc->nSize; + n= punoSeq->nElements; - anyToVariant(&oleElement, unoElement); + SAFEARRAYBOUND rgsabound[1]; + rgsabound[0].lLbound = 0; + rgsabound[0].cElements = n; + VARIANT oleElement; + long safeI[1]; - safeI[0] = i; - SafeArrayPutElement(pArray, safeI, &oleElement); + pArray = SafeArrayCreate(VT_VARIANT, 1, rgsabound); - VariantClear(&oleElement); + Any unoElement; + // 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; |