INTEGRATION: CWS ab13fixes (1.14.14); FILE MERGED
2005/01/20 16:50:34 ab 1.14.14.2: #111897# SbiRuntime::StepParam(): Adapted DefaultId handling to UserData usage for ParamArray 2005/01/17 16:59:13 ab 1.14.14.1: #118116# SbiRuntime::CheckArray() extended to collection objects
This commit is contained in:
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: step2.cxx,v $
|
* $RCSfile: step2.cxx,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.14 $
|
* $Revision: 1.15 $
|
||||||
*
|
*
|
||||||
* last change: $Author: rt $ $Date: 2004-11-15 16:38:03 $
|
* last change: $Author: rt $ $Date: 2005-01-28 16:10:01 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -462,65 +462,74 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
|
|||||||
{
|
{
|
||||||
// Ist es ein Uno-Objekt?
|
// Ist es ein Uno-Objekt?
|
||||||
SbxBaseRef pObj = (SbxBase*)pElem->GetObject();
|
SbxBaseRef pObj = (SbxBase*)pElem->GetObject();
|
||||||
if( pObj && pObj->ISA(SbUnoObject) )
|
if( pObj )
|
||||||
{
|
{
|
||||||
SbUnoObject* pUnoObj = (SbUnoObject*)(SbxBase*)pObj;
|
if( pObj->ISA(SbUnoObject) )
|
||||||
Any aAny = pUnoObj->getUnoAny();
|
|
||||||
|
|
||||||
if( aAny.getValueType().getTypeClass() == TypeClass_INTERFACE )
|
|
||||||
{
|
{
|
||||||
Reference< XInterface > x = *(Reference< XInterface >*)aAny.getValue();
|
SbUnoObject* pUnoObj = (SbUnoObject*)(SbxBase*)pObj;
|
||||||
Reference< XIndexAccess > xIndexAccess( x, UNO_QUERY );
|
Any aAny = pUnoObj->getUnoAny();
|
||||||
|
|
||||||
// Haben wir Index-Access?
|
if( aAny.getValueType().getTypeClass() == TypeClass_INTERFACE )
|
||||||
if( xIndexAccess.is() )
|
|
||||||
{
|
{
|
||||||
UINT32 nParamCount = (UINT32)pPar->Count() - 1;
|
Reference< XInterface > x = *(Reference< XInterface >*)aAny.getValue();
|
||||||
if( nParamCount != 1 )
|
Reference< XIndexAccess > xIndexAccess( x, UNO_QUERY );
|
||||||
{
|
|
||||||
StarBASIC::Error( SbERR_BAD_ARGUMENT );
|
|
||||||
return pElem;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Index holen
|
// Haben wir Index-Access?
|
||||||
INT32 nIndex = pPar->Get( 1 )->GetLong();
|
if( xIndexAccess.is() )
|
||||||
Reference< XInterface > xRet;
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
Any aAny = xIndexAccess->getByIndex( nIndex );
|
UINT32 nParamCount = (UINT32)pPar->Count() - 1;
|
||||||
TypeClass eType = aAny.getValueType().getTypeClass();
|
if( nParamCount != 1 )
|
||||||
if( eType == TypeClass_INTERFACE )
|
{
|
||||||
xRet = *(Reference< XInterface >*)aAny.getValue();
|
StarBASIC::Error( SbERR_BAD_ARGUMENT );
|
||||||
}
|
return pElem;
|
||||||
catch (IndexOutOfBoundsException& e1)
|
}
|
||||||
{
|
|
||||||
// Bei Exception erstmal immer von Konvertierungs-Problem ausgehen
|
|
||||||
StarBASIC::Error( SbERR_OUT_OF_RANGE );
|
|
||||||
}
|
|
||||||
|
|
||||||
// #57847 Immer neue Variable anlegen, sonst Fehler
|
// Index holen
|
||||||
// durch PutObject(NULL) bei ReadOnly-Properties.
|
INT32 nIndex = pPar->Get( 1 )->GetLong();
|
||||||
pElem = new SbxVariable( SbxVARIANT );
|
Reference< XInterface > xRet;
|
||||||
if( xRet.is() )
|
try
|
||||||
{
|
{
|
||||||
aAny <<= xRet;
|
Any aAny = xIndexAccess->getByIndex( nIndex );
|
||||||
|
TypeClass eType = aAny.getValueType().getTypeClass();
|
||||||
|
if( eType == TypeClass_INTERFACE )
|
||||||
|
xRet = *(Reference< XInterface >*)aAny.getValue();
|
||||||
|
}
|
||||||
|
catch (IndexOutOfBoundsException& e1)
|
||||||
|
{
|
||||||
|
// Bei Exception erstmal immer von Konvertierungs-Problem ausgehen
|
||||||
|
StarBASIC::Error( SbERR_OUT_OF_RANGE );
|
||||||
|
}
|
||||||
|
|
||||||
// #67173 Kein Namen angeben, damit echter Klassen-Namen eintragen wird
|
// #57847 Immer neue Variable anlegen, sonst Fehler
|
||||||
String aName;
|
// durch PutObject(NULL) bei ReadOnly-Properties.
|
||||||
SbxObjectRef xWrapper = (SbxObject*)new SbUnoObject( aName, aAny );
|
pElem = new SbxVariable( SbxVARIANT );
|
||||||
pElem->PutObject( xWrapper );
|
if( xRet.is() )
|
||||||
}
|
{
|
||||||
else
|
aAny <<= xRet;
|
||||||
{
|
|
||||||
pElem->PutObject( NULL );
|
// #67173 Kein Namen angeben, damit echter Klassen-Namen eintragen wird
|
||||||
|
String aName;
|
||||||
|
SbxObjectRef xWrapper = (SbxObject*)new SbUnoObject( aName, aAny );
|
||||||
|
pElem->PutObject( xWrapper );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pElem->PutObject( NULL );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #42940, 0.Parameter zu NULL setzen, damit sich Var nicht selbst haelt
|
||||||
|
pPar->Put( NULL, 0 );
|
||||||
|
}
|
||||||
|
else if( pObj->ISA(BasicCollection) )
|
||||||
|
{
|
||||||
|
BasicCollection* pCol = (BasicCollection*)(SbxBase*)pObj;
|
||||||
|
pElem = new SbxVariable( SbxVARIANT );
|
||||||
|
pPar->Put( pElem, 0 );
|
||||||
|
pCol->CollItem( pPar );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// #42940, 0.Parameter zu NULL setzen, damit sich Var nicht selbst haelt
|
|
||||||
if( pPar )
|
|
||||||
pPar->Put( NULL, 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pElem;
|
return pElem;
|
||||||
@@ -617,9 +626,10 @@ void SbiRuntime::StepPARAM( USHORT nOp1, USHORT nOp2 )
|
|||||||
if( pParam && ( (pParam->nFlags & SBX_OPTIONAL) != 0 ) )
|
if( pParam && ( (pParam->nFlags & SBX_OPTIONAL) != 0 ) )
|
||||||
{
|
{
|
||||||
// Default value?
|
// Default value?
|
||||||
if( pParam->nUserData > 0 )
|
USHORT nDefaultId = (pParam->nUserData & 0xffff );
|
||||||
|
if( nDefaultId > 0 )
|
||||||
{
|
{
|
||||||
String aDefaultStr = pImg->GetString( pParam->nUserData );
|
String aDefaultStr = pImg->GetString( nDefaultId );
|
||||||
p = new SbxVariable();
|
p = new SbxVariable();
|
||||||
p->PutString( aDefaultStr );
|
p->PutString( aDefaultStr );
|
||||||
refParams->Put( p, i );
|
refParams->Put( p, i );
|
||||||
|
Reference in New Issue
Block a user