View | Details | Raw Unified | Return to issue 117010
Collapse All | Expand All

(-)a/extensions/source/ole/unoconversionutilities.hxx (-36 / +21 lines)
Lines 1324-1370 Link Here
1324
        
1324
        
1325
    typelib_TypeDescription* pSeqElementDesc= NULL;
1325
    typelib_TypeDescription* pSeqElementDesc= NULL;
1326
    TYPELIB_DANGER_GET( &pSeqElementDesc, pSeqElementTypeRef);
1326
    TYPELIB_DANGER_GET( &pSeqElementDesc, pSeqElementTypeRef);
1327
1327
    sal_Int32 nElementSize= pSeqElementDesc->nSize;
1328
    // try to find VARIANT type that is related to the UNO type of the sequence elements
1328
    n= punoSeq->nElements;
1329
    // the sequence as a sequence element should be handled in a special way
1329
        
1330
    VARTYPE eTargetElementType = VT_EMPTY;
1330
    SAFEARRAYBOUND rgsabound[1];
1331
    if ( pSeqElementDesc->eTypeClass != TypeClass_SEQUENCE )
1331
    rgsabound[0].lLbound = 0;
1332
        eTargetElementType = mapTypeClassToVartype( static_cast< TypeClass >( pSeqElementDesc->eTypeClass ) );
1332
    rgsabound[0].cElements = n;
1333
1333
    VARIANT oleElement;
1334
    if ( eTargetElementType != VT_EMPTY )
1334
    long safeI[1];
1335
        pArray = createUnoSequenceWrapper( rSeq, eTargetElementType );
1335
    
1336
1336
    pArray = SafeArrayCreate(VT_VARIANT, 1, rgsabound);
1337
    if ( !pArray )
1337
    
1338
    Any unoElement;
1339
    sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->elements;
1340
    
1341
    for (sal_uInt32 i = 0; i < n; i++)
1338
    {
1342
    {
1339
        sal_Int32 nElementSize= pSeqElementDesc->nSize;
1343
        unoElement.setValue( pSeqData + i * nElementSize, pSeqElementDesc);
1340
        n= punoSeq->nElements;
1344
        VariantInit(&oleElement);
1341
        
1345
        
1342
        SAFEARRAYBOUND rgsabound[1];
1346
        anyToVariant(&oleElement, unoElement);
1343
        rgsabound[0].lLbound = 0;
1344
        rgsabound[0].cElements = n;
1345
        VARIANT oleElement;
1346
        long safeI[1];
1347
        
1347
        
1348
        pArray = SafeArrayCreate(VT_VARIANT, 1, rgsabound);
1348
        safeI[0] = i;
1349
        SafeArrayPutElement(pArray, safeI, &oleElement);
1349
        
1350
        
1350
        Any unoElement;
1351
        VariantClear(&oleElement);
1351
        //		sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->pElements;
1352
        sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->elements;
1353
        
1354
        for (sal_uInt32 i = 0; i < n; i++)
1355
        {
1356
            unoElement.setValue( pSeqData + i * nElementSize, pSeqElementDesc);
1357
            VariantInit(&oleElement);
1358
            
1359
            anyToVariant(&oleElement, unoElement);
1360
            
1361
            safeI[0] = i;
1362
            SafeArrayPutElement(pArray, safeI, &oleElement);
1363
            
1364
            VariantClear(&oleElement);
1365
        }
1366
    }
1352
    }
1367
1368
    TYPELIB_DANGER_RELEASE( pSeqElementDesc);
1353
    TYPELIB_DANGER_RELEASE( pSeqElementDesc);
1369
        
1354
        
1370
    return pArray;	
1355
    return pArray;	

Return to issue 117010