diff options
Diffstat (limited to 'basic/source/runtime')
-rw-r--r-- | basic/source/runtime/methods.cxx | 40 | ||||
-rw-r--r-- | basic/source/runtime/methods1.cxx | 11 | ||||
-rw-r--r-- | basic/source/runtime/runtime.cxx | 27 |
3 files changed, 62 insertions, 16 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 9a21e488d4aa..816576d173e8 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -120,6 +120,10 @@ using namespace com::sun::star::io; #include <io.h> #endif +using namespace rtl; + +#include <basic/sbobjmod.hxx> + static void FilterWhiteSpace( String& rStr ) { rStr.EraseAllChars( ' ' ); @@ -4106,12 +4110,20 @@ RTLFUNC(Load) // Diesen Call einfach an das Object weiterreichen SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject(); - if( pObj && pObj->IsA( TYPE( SbxObject ) ) ) + if ( pObj ) { - SbxVariable* pVar = ((SbxObject*)pObj)-> - Find( String( RTL_CONSTASCII_USTRINGPARAM("Load") ), SbxCLASS_METHOD ); - if( pVar ) - pVar->GetInteger(); + if( pObj->IsA( TYPE( SbUserFormModule ) ) ) + { + SbUserFormModule* pFormModule = ( SbUserFormModule* )pObj; + pFormModule->load(); + } + else if( pObj->IsA( TYPE( SbxObject ) ) ) + { + SbxVariable* pVar = ((SbxObject*)pObj)-> + Find( String( RTL_CONSTASCII_USTRINGPARAM("Load") ), SbxCLASS_METHOD ); + if( pVar ) + pVar->GetInteger(); + } } } @@ -4129,12 +4141,20 @@ RTLFUNC(Unload) // Diesen Call einfach an das Object weitereichen SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject(); - if( pObj && pObj->IsA( TYPE( SbxObject ) ) ) + if ( pObj ) { - SbxVariable* pVar = ((SbxObject*)pObj)-> - Find( String( RTL_CONSTASCII_USTRINGPARAM("Unload") ), SbxCLASS_METHOD ); - if( pVar ) - pVar->GetInteger(); + if( pObj->IsA( TYPE( SbUserFormModule ) ) ) + { + SbUserFormModule* pFormModule = ( SbUserFormModule* )pObj; + pFormModule->Unload(); + } + else if( pObj->IsA( TYPE( SbxObject ) ) ) + { + SbxVariable* pVar = ((SbxObject*)pObj)-> + Find( String( RTL_CONSTASCII_USTRINGPARAM("Unload") ), SbxCLASS_METHOD ); + if( pVar ) + pVar->GetInteger(); + } } } diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index e0501e5c0d94..b25c213a493d 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -61,6 +61,7 @@ #endif #include <vcl/jobset.hxx> +#include <basic/sbobjmod.hxx> #include "sbintern.hxx" #include "runtime.hxx" @@ -2594,14 +2595,16 @@ RTLFUNC(Me) SbModule* pActiveModule = pINST->GetActiveModule(); SbClassModuleObject* pClassModuleObject = PTR_CAST(SbClassModuleObject,pActiveModule); + SbxVariableRef refVar = rPar.Get(0); if( pClassModuleObject == NULL ) { - StarBASIC::Error( SbERR_INVALID_USAGE_OBJECT ); + SbObjModule* pMod = PTR_CAST(SbObjModule,pActiveModule); + if ( pMod ) + refVar->PutObject( pMod ); + else + StarBASIC::Error( SbERR_INVALID_USAGE_OBJECT ); } else - { - SbxVariableRef refVar = rPar.Get(0); refVar->PutObject( pClassModuleObject ); - } } diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 52aa76e2f2df..4c80d2683e1c 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -49,7 +49,7 @@ bool SbiRuntime::isVBAEnabled() bool result = false; SbiInstance* pInst = pINST; if ( pInst && pINST->pRun ) - result = pInst->pRun->GetImageFlag( SBIMG_VBASUPPORT ); + result = pInst->pRun->bVBAEnabled; return result; } @@ -60,6 +60,24 @@ void StarBASIC::StaticEnableReschedule( BOOL bReschedule ) { bStaticGlobalEnableReschedule = bReschedule; } +void StarBASIC::SetVBAEnabled( BOOL bEnabled ) +{ + if ( bDocBasic ) + { + bVBAEnabled = bEnabled; + } +} + +BOOL StarBASIC::isVBAEnabled() +{ + if ( bDocBasic ) + { + if( SbiRuntime::isVBAEnabled() ) + return TRUE; + return bVBAEnabled; + } + return FALSE; +} struct SbiArgvStack { // Argv stack: @@ -520,6 +538,7 @@ SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart ) nForLvl = 0; nOps = 0; refExprStk = new SbxArray; + SetVBAEnabled( pMod->IsVBACompat() ); #if defined GCC SetParameters( pe ? pe->GetParameters() : (class SbxArray *)NULL ); #else @@ -527,7 +546,6 @@ SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart ) #endif pRefSaveList = NULL; pItemStoreList = NULL; - bVBAEnabled = isVBAEnabled(); } SbiRuntime::~SbiRuntime() @@ -546,6 +564,11 @@ SbiRuntime::~SbiRuntime() } } +void SbiRuntime::SetVBAEnabled(bool bEnabled ) +{ + bVBAEnabled = bEnabled; +} + // Aufbau der Parameterliste. Alle ByRef-Parameter werden direkt // uebernommen; von ByVal-Parametern werden Kopien angelegt. Falls // ein bestimmter Datentyp verlangt wird, wird konvertiert. |