Files
libreoffice/basic/source/runtime/step1.cxx

583 lines
16 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2000-09-18 15:18:56 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 15:18:56 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 15:18:56 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 15:18:56 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 15:18:56 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-09-18 15:18:56 +00:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-09-18 15:18:56 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-09-18 15:18:56 +00:00
*
************************************************************************/
2000-09-18 15:18:56 +00:00
#include <stdlib.h>
#include <rtl/math.hxx>
#include <basic/sbuno.hxx>
2000-09-18 15:18:56 +00:00
#include "runtime.hxx"
#include "sbintern.hxx"
#include "iosys.hxx"
#include "image.hxx"
#include "sbunoobj.hxx"
#include "errobject.hxx"
2000-09-18 15:18:56 +00:00
bool checkUnoObjectType( SbUnoObject* refVal, const ::rtl::OUString& aClass );
// loading a numeric constant (+ID)
2000-09-18 15:18:56 +00:00
void SbiRuntime::StepLOADNC( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
SbxVariable* p = new SbxVariable( SbxDOUBLE );
// #57844 use localized function
2006-11-03 14:11:10 +00:00
String aStr = pImg->GetString( static_cast<short>( nOp1 ) );
// also allow , !!!
sal_uInt16 iComma = aStr.Search( ',' );
2000-09-18 15:18:56 +00:00
if( iComma != STRING_NOTFOUND )
{
String aStr1 = aStr.Copy( 0, iComma );
String aStr2 = aStr.Copy( iComma + 1 );
aStr = aStr1;
aStr += '.';
aStr += aStr2;
}
double n = ::rtl::math::stringToDouble( aStr, '.', ',', NULL, NULL );
2000-09-18 15:18:56 +00:00
p->PutDouble( n );
PushVar( p );
}
// loading a string constant (+ID)
2000-09-18 15:18:56 +00:00
void SbiRuntime::StepLOADSC( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
SbxVariable* p = new SbxVariable;
2006-11-03 14:11:10 +00:00
p->PutString( pImg->GetString( static_cast<short>( nOp1 ) ) );
2000-09-18 15:18:56 +00:00
PushVar( p );
}
// Immediate Load (+Wert)
void SbiRuntime::StepLOADI( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
SbxVariable* p = new SbxVariable;
p->PutInteger( static_cast<sal_Int16>( nOp1 ) );
2000-09-18 15:18:56 +00:00
PushVar( p );
}
// stora a named argument in Argv (+Arg-no. from 1!)
2000-09-18 15:18:56 +00:00
void SbiRuntime::StepARGN( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
if( !refArgv )
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
else
{
2006-11-03 14:11:10 +00:00
String aAlias( pImg->GetString( static_cast<short>( nOp1 ) ) );
2000-09-18 15:18:56 +00:00
SbxVariableRef pVal = PopVar();
if( bVBAEnabled && ( pVal->ISA(SbxMethod) || pVal->ISA(SbUnoProperty) || pVal->ISA(SbProcedureProperty) ) )
{
// named variables ( that are Any especially properties ) can be empty at this point and need a broadcast
if ( pVal->GetType() == SbxEMPTY )
pVal->Broadcast( SBX_HINT_DATAWANTED );
// evaluate methods and properties!
SbxVariable* pRes = new SbxVariable( *pVal );
pVal = pRes;
}
2000-09-18 15:18:56 +00:00
refArgv->Put( pVal, nArgc );
refArgv->PutAlias( aAlias, nArgc++ );
}
}
// converting the type of an argument in Argv for DECLARE-Fkt. (+type)
2000-09-18 15:18:56 +00:00
void SbiRuntime::StepARGTYP( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
if( !refArgv )
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
else
{
sal_Bool bByVal = (nOp1 & 0x8000) != 0; // Ist BYVAL requested?
2000-09-18 15:18:56 +00:00
SbxDataType t = (SbxDataType) (nOp1 & 0x7FFF);
SbxVariable* pVar = refArgv->Get( refArgv->Count() - 1 ); // last Arg
2000-09-18 15:18:56 +00:00
// check BYVAL
if( pVar->GetRefCount() > 2 ) // 2 is normal for BYVAL
2000-09-18 15:18:56 +00:00
{
// parameter is a reference
2000-09-18 15:18:56 +00:00
if( bByVal )
{
// Call by Value is requested -> create a copy
2000-09-18 15:18:56 +00:00
pVar = new SbxVariable( *pVar );
pVar->SetFlag( SBX_READWRITE );
refExprStk->Put( pVar, refArgv->Count() - 1 );
}
else
pVar->SetFlag( SBX_REFERENCE ); // Ref-Flag for DllMgr
2000-09-18 15:18:56 +00:00
}
else
{
// parameter is NO reference
2000-09-18 15:18:56 +00:00
if( bByVal )
pVar->ResetFlag( SBX_REFERENCE ); // no reference -> OK
2000-09-18 15:18:56 +00:00
else
Error( SbERR_BAD_PARAMETERS ); // reference needed
2000-09-18 15:18:56 +00:00
}
if( pVar->GetType() != t )
{
// variant for correct conversion
// besides error, if SbxBYREF
2000-09-18 15:18:56 +00:00
pVar->Convert( SbxVARIANT );
pVar->Convert( t );
}
}
}
// bring string to a definite length (+length)
2000-09-18 15:18:56 +00:00
void SbiRuntime::StepPAD( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
SbxVariable* p = GetTOS();
String& s = (String&)(const String&) *p;
if( s.Len() > nOp1 )
2006-11-03 14:11:10 +00:00
s.Erase( static_cast<xub_StrLen>( nOp1 ) );
2000-09-18 15:18:56 +00:00
else
2006-11-03 14:11:10 +00:00
s.Expand( static_cast<xub_StrLen>( nOp1 ), ' ' );
2000-09-18 15:18:56 +00:00
}
// jump (+target)
2000-09-18 15:18:56 +00:00
void SbiRuntime::StepJUMP( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
#ifdef DBG_UTIL
// #QUESTION shouln't this be
// if( (sal_uInt8*)( nOp1+pImagGetCode() ) >= pImg->GetCodeSize() )
2000-09-18 15:18:56 +00:00
if( nOp1 >= pImg->GetCodeSize() )
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
#endif
pCode = (const sal_uInt8*) pImg->GetCode() + nOp1;
2000-09-18 15:18:56 +00:00
}
// evaluate TOS, conditional jump (+target)
2000-09-18 15:18:56 +00:00
void SbiRuntime::StepJUMPT( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
SbxVariableRef p = PopVar();
if( p->GetBool() )
StepJUMP( nOp1 );
}
// evaluate TOS, conditional jump (+target)
2000-09-18 15:18:56 +00:00
void SbiRuntime::StepJUMPF( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
SbxVariableRef p = PopVar();
// In a test e.g. If Null then
// will evaluate Null will act as if False
if( ( bVBAEnabled && p->IsNull() ) || !p->GetBool() )
2000-09-18 15:18:56 +00:00
StepJUMP( nOp1 );
}
// evaluate TOS, jump into JUMP-table (+MaxVal)
// looks like this:
2000-09-18 15:18:56 +00:00
// ONJUMP 2
// JUMP target1
// JUMP target2
// ...
// if 0x8000 is set in the operand, push the return address (ON..GOSUB)
2000-09-18 15:18:56 +00:00
void SbiRuntime::StepONJUMP( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
SbxVariableRef p = PopVar();
sal_Int16 n = p->GetInteger();
2000-09-18 15:18:56 +00:00
if( nOp1 & 0x8000 )
{
nOp1 &= 0x7FFF;
PushGosub( pCode + 5 * nOp1 );
2000-09-18 15:18:56 +00:00
}
if( n < 1 || static_cast<sal_uInt32>(n) > nOp1 )
n = static_cast<sal_Int16>( nOp1 + 1 );
nOp1 = (sal_uInt32) ( (const char*) pCode - pImg->GetCode() ) + 5 * --n;
2000-09-18 15:18:56 +00:00
StepJUMP( nOp1 );
}
// UP-call (+target)
2000-09-18 15:18:56 +00:00
void SbiRuntime::StepGOSUB( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
PushGosub( pCode );
if( nOp1 >= pImg->GetCodeSize() )
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
pCode = (const sal_uInt8*) pImg->GetCode() + nOp1;
2000-09-18 15:18:56 +00:00
}
// UP-return (+0 or target)
2000-09-18 15:18:56 +00:00
void SbiRuntime::StepRETURN( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
PopGosub();
if( nOp1 )
StepJUMP( nOp1 );
}
// check FOR-variable (+Endlabel)
2000-09-18 15:18:56 +00:00
void SbiRuntime::StepTESTFOR( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
if( !pForStk )
{
2000-09-18 15:18:56 +00:00
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
return;
}
bool bEndLoop = false;
switch( pForStk->eForType )
2000-09-18 15:18:56 +00:00
{
case FOR_TO:
2000-09-18 15:18:56 +00:00
{
SbxOperator eOp = ( pForStk->refInc->GetDouble() < 0 ) ? SbxLT : SbxGT;
if( pForStk->refVar->Compare( eOp, *pForStk->refEnd ) )
bEndLoop = true;
break;
}
case FOR_EACH_ARRAY:
{
SbiForStack* p = pForStk;
if( p->pArrayCurIndices == NULL )
{
bEndLoop = true;
}
else
{
SbxDimArray* pArray = (SbxDimArray*)(SbxVariable*)p->refEnd;
short nDims = pArray->GetDims();
// Empty array?
if( nDims == 1 && p->pArrayLowerBounds[0] > p->pArrayUpperBounds[0] )
{
bEndLoop = true;
break;
}
SbxVariable* pVal = pArray->Get32( p->pArrayCurIndices );
*(p->refVar) = *pVal;
bool bFoundNext = false;
for( short i = 0 ; i < nDims ; i++ )
{
if( p->pArrayCurIndices[i] < p->pArrayUpperBounds[i] )
{
bFoundNext = true;
p->pArrayCurIndices[i]++;
for( short j = i - 1 ; j >= 0 ; j-- )
p->pArrayCurIndices[j] = p->pArrayLowerBounds[j];
break;
}
}
if( !bFoundNext )
{
delete[] p->pArrayCurIndices;
p->pArrayCurIndices = NULL;
}
}
break;
}
case FOR_EACH_COLLECTION:
{
BasicCollection* pCollection = (BasicCollection*)(SbxVariable*)pForStk->refEnd;
SbxArrayRef xItemArray = pCollection->xItemArray;
sal_Int32 nCount = xItemArray->Count32();
if( pForStk->nCurCollectionIndex < nCount )
{
SbxVariable* pRes = xItemArray->Get32( pForStk->nCurCollectionIndex );
pForStk->nCurCollectionIndex++;
(*pForStk->refVar) = *pRes;
}
else
{
bEndLoop = true;
}
break;
2000-09-18 15:18:56 +00:00
}
case FOR_EACH_XENUMERATION:
{
SbiForStack* p = pForStk;
if( p->xEnumeration->hasMoreElements() )
{
Any aElem = p->xEnumeration->nextElement();
SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
unoToSbxValue( (SbxVariable*)xVar, aElem );
(*pForStk->refVar) = *xVar;
}
else
{
bEndLoop = true;
}
break;
}
}
if( bEndLoop )
{
PopFor();
StepJUMP( nOp1 );
2000-09-18 15:18:56 +00:00
}
}
// Tos+1 <= Tos+2 <= Tos, 2xremove (+Target)
void SbiRuntime::StepCASETO( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
if( !refCaseStk || !refCaseStk->Count() )
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
else
{
SbxVariableRef xTo = PopVar();
SbxVariableRef xFrom = PopVar();
SbxVariableRef xCase = refCaseStk->Get( refCaseStk->Count() - 1 );
if( *xCase >= *xFrom && *xCase <= *xTo )
StepJUMP( nOp1 );
}
}
void SbiRuntime::StepERRHDL( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
const sal_uInt8* p = pCode;
2000-09-18 15:18:56 +00:00
StepJUMP( nOp1 );
pError = pCode;
pCode = p;
pInst->aErrorMsg = String();
pInst->nErr = 0;
pInst->nErl = 0;
2000-09-18 15:18:56 +00:00
nError = 0;
SbxErrObject::getUnoErrObject()->Clear();
2000-09-18 15:18:56 +00:00
}
// Resume after errors (+0=statement, 1=next or Label)
2000-09-18 15:18:56 +00:00
void SbiRuntime::StepRESUME( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
// #32714 Resume without error? -> error
2000-09-18 15:18:56 +00:00
if( !bInError )
{
Error( SbERR_BAD_RESUME );
return;
}
if( nOp1 )
{
// set Code-pointer to the next statement
sal_uInt16 n1, n2;
pCode = pMod->FindNextStmnt( pErrCode, n1, n2, sal_True, pImg );
2000-09-18 15:18:56 +00:00
}
else
pCode = pErrStmnt;
if ( pError ) // current in error handler ( and got a Resume Next statment )
SbxErrObject::getUnoErrObject()->Clear();
2000-09-18 15:18:56 +00:00
if( nOp1 > 1 )
StepJUMP( nOp1 );
pInst->aErrorMsg = String();
pInst->nErr = 0;
pInst->nErl = 0;
2000-09-18 15:18:56 +00:00
nError = 0;
bInError = sal_False;
2000-09-18 15:18:56 +00:00
}
// close channel (+channel, 0=all)
void SbiRuntime::StepCLOSE( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
SbError err;
2000-09-18 15:18:56 +00:00
if( !nOp1 )
pIosys->Shutdown();
else
{
err = pIosys->GetError();
if( !err )
{
pIosys->Close();
}
}
err = pIosys->GetError();
Error( err );
}
// output character (+char)
2000-09-18 15:18:56 +00:00
void SbiRuntime::StepPRCHAR( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
2011-09-18 22:35:32 +01:00
rtl::OString s(static_cast<sal_Char>(nOp1));
2000-09-18 15:18:56 +00:00
pIosys->Write( s );
Error( pIosys->GetError() );
}
// check whether TOS is a certain object class (+StringID)
2000-09-18 15:18:56 +00:00
2011-05-04 16:52:03 +02:00
bool SbiRuntime::implIsClass( SbxObject* pObj, const ::rtl::OUString& aClass )
2000-09-18 15:18:56 +00:00
{
bool bRet = true;
2011-05-04 16:52:03 +02:00
if( !aClass.isEmpty() )
{
bRet = pObj->IsClass( aClass );
if( !bRet )
2011-05-04 16:52:03 +02:00
bRet = aClass.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("object") );
if( !bRet )
{
String aObjClass = pObj->GetClassName();
2012-01-15 16:15:08 +01:00
SbModule* pClassMod = GetSbData()->pClassFac->FindClass( aObjClass );
SbClassData* pClassData;
if( pClassMod && (pClassData=pClassMod->pClassData) != NULL )
{
SbxVariable* pClassVar =
pClassData->mxIfaces->Find( aClass, SbxCLASS_DONTCARE );
bRet = (pClassVar != NULL);
}
}
}
return bRet;
}
bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal,
Merge commit 'ooo/DEV300_m106' into integration/dev300_m106 Conflicts: avmedia/source/gstreamer/gstframegrabber.cxx avmedia/source/gstreamer/gstplayer.cxx avmedia/source/gstreamer/gstplayer.hxx basic/inc/basic/sbxdef.hxx basic/source/classes/sbxmod.cxx basic/source/comp/makefile.mk basic/source/comp/sbcomp.cxx basic/source/inc/namecont.hxx basic/source/inc/scriptcont.hxx basic/source/runtime/methods.cxx basic/source/runtime/runtime.cxx basic/source/runtime/stdobj.cxx basic/source/runtime/step1.cxx basic/source/uno/namecont.cxx basic/util/makefile.mk connectivity/source/commontools/predicateinput.cxx connectivity/source/drivers/dbase/DNoException.cxx connectivity/source/drivers/dbase/DTable.cxx connectivity/source/drivers/file/fcomp.cxx connectivity/source/drivers/jdbc/JConnection.cxx connectivity/source/drivers/odbcbase/OResultSet.cxx connectivity/source/drivers/odbcbase/OStatement.cxx connectivity/source/parse/sqlnode.cxx desktop/source/app/app.cxx drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx drawinglayer/source/processor2d/vclprocessor2d.cxx formula/inc/formula/token.hxx formula/source/core/api/token.cxx fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx fpicker/source/win32/filepicker/platform_vista.h framework/source/helper/persistentwindowstate.cxx framework/source/uielement/menubarmanager.cxx oovbaapi/ooo/vba/XFoundFiles.idl oovbaapi/ooo/vba/excel/XApplication.idl oovbaapi/ooo/vba/msforms/XCheckBox.idl oovbaapi/ooo/vba/msforms/XComboBox.idl oovbaapi/ooo/vba/msforms/XControl.idl oovbaapi/ooo/vba/msforms/XGroupBox.idl oovbaapi/ooo/vba/msforms/XLabel.idl oovbaapi/ooo/vba/msforms/XListBox.idl oovbaapi/ooo/vba/msforms/XNewFont.idl oovbaapi/ooo/vba/msforms/XRadioButton.idl oovbaapi/ooo/vba/msforms/XTextBox.idl oovbaapi/ooo/vba/msforms/XToggleButton.idl scripting/source/dlgprov/dlgevtatt.cxx sfx2/source/control/unoctitm.cxx sfx2/source/doc/objstor.cxx sfx2/source/doc/objxtor.cxx svx/inc/svx/svdograf.hxx svx/source/form/fmpage.cxx svx/source/form/fmpgeimp.cxx svx/source/svdraw/svdedtv.cxx svx/source/svdraw/svdfmtf.cxx svx/source/svdraw/svdograf.cxx svx/source/svdraw/svdouno.cxx svx/source/xml/xmlgrhlp.cxx uui/source/iahndl-ssl.cxx vbahelper/Library_msforms.mk vbahelper/Library_vbahelper.mk vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/prj/build.lst vbahelper/source/msforms/vbacombobox.cxx vbahelper/source/msforms/vbacontrol.cxx vbahelper/source/msforms/vbacontrols.cxx vbahelper/source/msforms/vbaframe.cxx vbahelper/source/msforms/vbaframe.hxx vbahelper/source/msforms/vbalabel.cxx vbahelper/source/msforms/vbalabel.hxx vbahelper/source/msforms/vbalistbox.cxx vbahelper/source/msforms/vbalistbox.hxx vbahelper/source/msforms/vbamultipage.cxx vbahelper/source/msforms/vbatogglebutton.cxx vbahelper/source/msforms/vbauserform.cxx vbahelper/source/vbahelper/vbacommandbar.cxx vbahelper/source/vbahelper/vbacommandbarcontrol.cxx vbahelper/source/vbahelper/vbacommandbarcontrols.hxx vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbawindowbase.cxx xmloff/source/meta/xmlmetai.cxx xmloff/source/style/PageMasterExportPropMapper.cxx xmloff/source/style/PageMasterStyleMap.cxx xmloff/source/text/txtexppr.cxx xmloff/source/text/txtprmap.cxx
2011-04-28 00:12:58 +02:00
const ::rtl::OUString& aClass, bool bRaiseErrors, bool bDefault )
{
bool bOk = bDefault;
SbxDataType t = refVal->GetType();
SbxVariable* pVal = (SbxVariable*)refVal;
// we don't know the type of uno properties that are (maybevoid)
if ( t == SbxEMPTY && refVal->ISA(SbUnoProperty) )
{
SbUnoProperty* pProp = (SbUnoProperty*)pVal;
t = pProp->getRealType();
}
if( t == SbxOBJECT )
2000-09-18 15:18:56 +00:00
{
SbxObject* pObj;
if( pVal->IsA( TYPE(SbxObject) ) )
pObj = (SbxObject*) pVal;
2000-09-18 15:18:56 +00:00
else
{
pObj = (SbxObject*) refVal->GetObject();
2000-09-18 15:18:56 +00:00
if( pObj && !pObj->IsA( TYPE(SbxObject) ) )
pObj = NULL;
}
if( pObj )
{
if( !implIsClass( pObj, aClass ) )
{
if ( bVBAEnabled && pObj->IsA( TYPE(SbUnoObject) ) )
{
SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pObj);
bOk = checkUnoObjectType( pUnoObj, aClass );
}
else
bOk = false;
if ( !bOk )
{
if( bRaiseErrors )
Error( SbERR_INVALID_USAGE_OBJECT );
}
}
else
{
bOk = true;
SbClassModuleObject* pClassModuleObject = PTR_CAST(SbClassModuleObject,pObj);
if( pClassModuleObject != NULL )
pClassModuleObject->triggerInitializeEvent();
}
}
2000-09-18 15:18:56 +00:00
}
else
{
if ( !bVBAEnabled )
{
if( bRaiseErrors )
Error( SbERR_NEEDS_OBJECT );
bOk = false;
}
}
return bOk;
}
void SbiRuntime::StepSETCLASS_impl( sal_uInt32 nOp1, bool bHandleDflt )
{
SbxVariableRef refVal = PopVar();
SbxVariableRef refVar = PopVar();
2006-11-03 14:11:10 +00:00
String aClass( pImg->GetString( static_cast<short>( nOp1 ) ) );
bool bOk = checkClass_Impl( refVal, aClass, true );
if( bOk )
StepSET_Impl( refVal, refVar, bHandleDflt ); // don't do handle dflt prop for a "proper" set
}
void SbiRuntime::StepVBASETCLASS( sal_uInt32 nOp1 )
{
StepSETCLASS_impl( nOp1, false );
}
void SbiRuntime::StepSETCLASS( sal_uInt32 nOp1 )
{
StepSETCLASS_impl( nOp1, true );
}
void SbiRuntime::StepTESTCLASS( sal_uInt32 nOp1 )
{
SbxVariableRef xObjVal = PopVar();
2006-11-03 14:11:10 +00:00
String aClass( pImg->GetString( static_cast<short>( nOp1 ) ) );
bool bDefault = !bVBAEnabled;
bool bOk = checkClass_Impl( xObjVal, aClass, false, bDefault );
SbxVariable* pRet = new SbxVariable;
pRet->PutBool( bOk );
PushVar( pRet );
2000-09-18 15:18:56 +00:00
}
// define library for following declare-call
2000-09-18 15:18:56 +00:00
void SbiRuntime::StepLIB( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
2006-11-03 14:11:10 +00:00
aLibName = pImg->GetString( static_cast<short>( nOp1 ) );
2000-09-18 15:18:56 +00:00
}
// TOS is incremented by BASE, BASE is pushed before (+BASE)
// This opcode is pushed before DIM/REDIM-commands,
// if there's been only one index named.
2000-09-18 15:18:56 +00:00
void SbiRuntime::StepBASED( sal_uInt32 nOp1 )
2000-09-18 15:18:56 +00:00
{
SbxVariable* p1 = new SbxVariable;
SbxVariableRef x2 = PopVar();
// #109275 Check compatiblity mode
bool bCompatible = ((nOp1 & 0x8000) != 0);
sal_uInt16 uBase = static_cast<sal_uInt16>(nOp1 & 1); // Can only be 0 or 1
p1->PutInteger( uBase );
if( !bCompatible )
x2->Compute( SbxPLUS, *p1 );
PushVar( x2 ); // first the Expr
PushVar( p1 ); // then the Base
2000-09-18 15:18:56 +00:00
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */