diff options
author | RĂ¼diger Timm <rt@openoffice.org> | 2008-07-02 09:14:41 +0000 |
---|---|---|
committer | RĂ¼diger Timm <rt@openoffice.org> | 2008-07-02 09:14:41 +0000 |
commit | cbcb1bf387be60fe45d2354ae0dfaa0e58f68274 (patch) | |
tree | 9f8b38d0aa306cd8b5b261c7c22b5970c10d12ef /basic | |
parent | 3bd31dea3f5d2c110a660ea8f5da220d299cb019 (diff) |
INTEGRATION: CWS npower10 (1.32.40); FILE MERGED
2008/05/07 07:11:05 pflin 1.32.40.4: RESYNC: (1.32-1.33); FILE MERGED
2008/03/12 06:32:51 pflin 1.32.40.3: Issue number: i85039
Submitted by: pflin
Reviewed by: npower, ab
Fix some issues found by code review
2008/03/03 20:08:37 npower 1.32.40.2: #i58089#
2007/12/20 21:23:02 npower 1.32.40.1: #58089
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/runtime/step2.cxx | 83 |
1 files changed, 58 insertions, 25 deletions
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx index 207af0f6c9..acec14f133 100644 --- a/basic/source/runtime/step2.cxx +++ b/basic/source/runtime/step2.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: step2.cxx,v $ - * $Revision: 1.34 $ + * $Revision: 1.35 $ * * This file is part of OpenOffice.org. * @@ -112,7 +112,7 @@ SbxVariable* VBAFind( const String& rName, SbxClassType t ) // 0x8000 - Argv ist belegt SbxVariable* SbiRuntime::FindElement - ( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError nNotFound, BOOL bLocal ) + ( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError nNotFound, BOOL bLocal, BOOL bStatic ) { bool bIsVBAInterOp = SbiRuntime::isVBAEnabled(); if( bIsVBAInterOp ) @@ -149,9 +149,17 @@ SbxVariable* SbiRuntime::FindElement nOp1 = nOp1 | 0x8000; // indicate params are present aName = String::CreateFromAscii("Evaluate"); } - if( bLocal ) - pElem = refLocals->Find( aName, SbxCLASS_DONTCARE ); + { + if ( bStatic ) + { + if ( pMeth ) + pElem = pMeth->GetStatics()->Find( aName, SbxCLASS_DONTCARE ); + } + + if ( !pElem ) + pElem = refLocals->Find( aName, SbxCLASS_DONTCARE ); + } if( !pElem ) { // Die RTL brauchen wir nicht mehr zu durchsuchen! @@ -251,12 +259,17 @@ SbxVariable* SbiRuntime::FindElement } else { - // Sonst Variable neu anlegen - pElem = new SbxVariable( t ); - if( t != SbxVARIANT ) - pElem->SetFlag( SBX_FIXED ); - pElem->SetName( aName ); - refLocals->Put( pElem, refLocals->Count() ); + if ( bStatic ) + pElem = StepSTATIC_Impl( aName, t ); + if ( !pElem ) + { + // Sonst Variable neu anlegen + pElem = new SbxVariable( t ); + if( t != SbxVARIANT ) + pElem->SetFlag( SBX_FIXED ); + pElem->SetName( aName ); + refLocals->Put( pElem, refLocals->Count() ); + } } } } @@ -641,29 +654,39 @@ void SbiRuntime::StepRTL( UINT32 nOp1, UINT32 nOp2 ) PushVar( FindElement( rBasic.pRtl, nOp1, nOp2, SbERR_PROC_UNDEFINED, FALSE ) ); } +void +SbiRuntime::StepFIND_Impl( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError nNotFound, BOOL bLocal, BOOL bStatic ) +{ + if( !refLocals ) + refLocals = new SbxArray; + PushVar( FindElement( pObj, nOp1, nOp2, nNotFound, bLocal, bStatic ) ); +} // Laden einer lokalen/globalen Variablen (+StringID+Typ) void SbiRuntime::StepFIND( UINT32 nOp1, UINT32 nOp2 ) { - if( !refLocals ) - refLocals = new SbxArray; - PushVar( FindElement( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, TRUE ) ); + StepFIND_Impl( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, TRUE ); } // Search inside a class module (CM) to enable global search in time void SbiRuntime::StepFIND_CM( UINT32 nOp1, UINT32 nOp2 ) { - if( !refLocals ) - refLocals = new SbxArray; SbClassModuleObject* pClassModuleObject = PTR_CAST(SbClassModuleObject,pMod); if( pClassModuleObject ) pMod->SetFlag( SBX_GBLSEARCH ); - PushVar( FindElement( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, TRUE ) ); + + StepFIND_Impl( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, TRUE ); + if( pClassModuleObject ) pMod->ResetFlag( SBX_GBLSEARCH ); } +void SbiRuntime::StepFIND_STATIC( UINT32 nOp1, UINT32 nOp2 ) +{ + StepFIND_Impl( pMod, nOp1, nOp2, SbERR_PROC_UNDEFINED, TRUE, TRUE ); +} + // Laden eines Objekt-Elements (+StringID+Typ) // Das Objekt liegt auf TOS @@ -1213,18 +1236,28 @@ void SbiRuntime::StepFIND_G( UINT32 nOp1, UINT32 nOp2 ) } +SbxVariable* SbiRuntime::StepSTATIC_Impl( String& aName, SbxDataType& t ) +{ + SbxVariable* p = NULL; + if ( pMeth ) + { + SbxArray* pStatics = pMeth->GetStatics(); + if( pStatics && ( pStatics->Find( aName, SbxCLASS_DONTCARE ) == NULL ) ) + { + p = new SbxVariable( t ); + if( t != SbxVARIANT ) + p->SetFlag( SBX_FIXED ); + p->SetName( aName ); + pStatics->Put( p, pStatics->Count() ); + } + } + return p; +} // Einrichten einer statischen Variablen (+StringID+Typ) - void SbiRuntime::StepSTATIC( UINT32 nOp1, UINT32 nOp2 ) { - (void)nOp1; - (void)nOp2; - /* AB #40689, wird nicht mehr verwendet - String aName( pImg->GetString( nOp1 ) ); + String aName( pImg->GetString( static_cast<short>( nOp1 ) ) ); SbxDataType t = (SbxDataType) nOp2; - SbxVariable* p = new SbxVariable( t ); - p->SetName( aName ); - pInst -> GetStatics()->Put( p, pInst->GetStatics()->Count() ); - */ + StepSTATIC_Impl( aName, t ); } |