summaryrefslogtreecommitdiff
path: root/basic/source/classes/sb.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source/classes/sb.cxx')
-rw-r--r--basic/source/classes/sb.cxx98
1 files changed, 70 insertions, 28 deletions
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index af056b884826..80fa3c6bb836 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -65,7 +65,29 @@ SV_IMPL_VARARR(SbTextPortions,SbTextPortion)
TYPEINIT1(StarBASIC,SbxObject)
#define RTLNAME "@SBRTL"
+// i#i68894#
+const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") );
+const static String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
+
+SbxObject* StarBASIC::getVBAGlobals( )
+{
+ if ( !pVBAGlobals )
+ pVBAGlobals = (SbUnoObject*)Find( aVBAHook , SbxCLASS_DONTCARE );
+ return pVBAGlobals;
+}
+
+// i#i68894#
+SbxVariable* StarBASIC::VBAFind( const String& rName, SbxClassType t )
+{
+ if( rName == aThisComponent )
+ return NULL;
+ // rename to init globals
+ if ( getVBAGlobals( ) )
+ return pVBAGlobals->Find( rName, t );
+ return NULL;
+
+}
// Create array for conversion SFX <-> VB error code
struct SFX_VB_ErrorItem
{
@@ -303,32 +325,32 @@ SbxObject* SbTypeFactory::cloneTypeObjectImpl( const SbxObject& rTypeObj )
if( pProp )
{
SbxProperty* pNewProp = new SbxProperty( *pProp );
- if( pVar->GetType() & SbxARRAY )
- {
- SbxBase* pParObj = pVar->GetObject();
- SbxDimArray* pSource = PTR_CAST(SbxDimArray,pParObj);
- SbxDimArray* pDest = new SbxDimArray( pVar->GetType() );
- INT32 lb = 0;
- INT32 ub = 0;
-
- pDest->setHasFixedSize( pSource->hasFixedSize() );
- if ( pSource->GetDims() && pSource->hasFixedSize() )
- {
- for ( INT32 j = 1 ; j <= pSource->GetDims(); ++j )
- {
- pSource->GetDim32( (INT32)j, lb, ub );
- pDest->AddDim32( lb, ub );
- }
- }
- else
- pDest->unoAddDim( 0, -1 ); // variant array
-
- USHORT nSavFlags = pVar->GetFlags();
- pNewProp->ResetFlag( SBX_FIXED );
- // need to reset the FIXED flag
- // when calling PutObject ( because the type will not match Object )
- pNewProp->PutObject( pDest );
- pNewProp->SetFlags( nSavFlags );
+ if( pVar->GetType() & SbxARRAY )
+ {
+ SbxBase* pParObj = pVar->GetObject();
+ SbxDimArray* pSource = PTR_CAST(SbxDimArray,pParObj);
+ SbxDimArray* pDest = new SbxDimArray( pVar->GetType() );
+ INT32 lb = 0;
+ INT32 ub = 0;
+
+ pDest->setHasFixedSize( pSource->hasFixedSize() );
+ if ( pSource->GetDims() && pSource->hasFixedSize() )
+ {
+ for ( INT32 j = 1 ; j <= pSource->GetDims(); ++j )
+ {
+ pSource->GetDim32( (INT32)j, lb, ub );
+ pDest->AddDim32( lb, ub );
+ }
+ }
+ else
+ pDest->unoAddDim( 0, -1 ); // variant array
+
+ USHORT nSavFlags = pVar->GetFlags();
+ pNewProp->ResetFlag( SBX_FIXED );
+ // need to reset the FIXED flag
+ // when calling PutObject ( because the type will not match Object )
+ pNewProp->PutObject( pDest );
+ pNewProp->SetFlags( nSavFlags );
}
pProps->PutDirect( pNewProp, i );
}
@@ -445,8 +467,8 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
SbProcedureProperty* pNewProp = new SbProcedureProperty
( pProcedureProp->GetName(), pProcedureProp->GetType() );
// ( pProcedureProp->GetName(), pProcedureProp->GetType(), this );
- pNewProp->SetFlags( nFlags_ ); // Copy flags
- pNewProp->ResetFlag( SBX_NO_BROADCAST ); // except the Broadcast if it was set
+ pNewProp->SetFlags( nFlags_ ); // Copy flags
+ pNewProp->ResetFlag( SBX_NO_BROADCAST ); // except the Broadcast if it was set
pProcedureProp->SetFlags( nFlags_ );
pProps->PutDirect( pNewProp, i );
StartListening( pNewProp->GetBroadcaster(), TRUE );
@@ -681,6 +703,8 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic )
pRtl = new SbiStdObject( String( RTL_CONSTASCII_USTRINGPARAM(RTLNAME) ), this );
// Search via StarBasic is always global
SetFlag( SBX_GBLSEARCH );
+ pVBAGlobals = NULL;
+ bQuit = FALSE;
}
// #51727 Override SetModified so that the modified state
@@ -995,6 +1019,12 @@ SbxVariable* StarBASIC::FindVarInCurrentScopy
return pVar;
}
+void StarBASIC::QuitAndExitApplication()
+{
+ Stop();
+ bQuit = TRUE;
+}
+
void StarBASIC::Stop()
{
SbiInstance* p = pINST;
@@ -1533,6 +1563,18 @@ BOOL StarBASIC::LoadOldModules( SvStream& )
return FALSE;
}
+bool StarBASIC::GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut )
+{
+ bool bRes = false;
+ ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) );
+ SbUnoObject* pGlobs = dynamic_cast<SbUnoObject*>( Find( sVarName, SbxCLASS_DONTCARE ) );
+ if ( pGlobs )
+ {
+ aOut = pGlobs->getUnoAny();
+ bRes = true;
+ }
+ return bRes;
+}
//========================================================================
// #118116 Implementation Collection object