summaryrefslogtreecommitdiff
path: root/basic/source/runtime
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-18 14:35:43 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-19 08:30:49 +0200
commit8b0a69498b025e13d9772689e9e4fa3d6b05e609 (patch)
tree5fce654b3e02cd08d85dc95655c97d7181517687 /basic/source/runtime
parent5dccf84b14ed0e09262411295c5880f787342d59 (diff)
loplugin:flatten in basic
Change-Id: Icb8e3cda312b50c9a9f12f96bec1c746f41c8979 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92483 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic/source/runtime')
-rw-r--r--basic/source/runtime/basrdll.cxx30
-rw-r--r--basic/source/runtime/iosys.cxx124
-rw-r--r--basic/source/runtime/methods.cxx82
-rw-r--r--basic/source/runtime/runtime.cxx181
-rw-r--r--basic/source/runtime/stdobj.cxx46
-rw-r--r--basic/source/runtime/stdobj1.cxx126
6 files changed, 295 insertions, 294 deletions
diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx
index b18284607b01..6da6ed9e2e2d 100644
--- a/basic/source/runtime/basrdll.cxx
+++ b/basic/source/runtime/basrdll.cxx
@@ -98,22 +98,22 @@ void BasicDLL::BasicBreak()
{
DBG_ASSERT( BasicDLLImpl::BASIC_DLL, "BasicDLL::EnableBreak: No instance yet!" );
#if HAVE_FEATURE_SCRIPTING
- if (BasicDLLImpl::BASIC_DLL)
+ if (!BasicDLLImpl::BASIC_DLL)
+ return;
+
+ // bJustStopping: if there's someone pressing STOP like crazy umpteen times,
+ // but the Basic doesn't stop early enough, the box might appear more often...
+ static bool bJustStopping = false;
+ if (StarBASIC::IsRunning() && !bJustStopping
+ && (BasicDLLImpl::BASIC_DLL->bBreakEnabled || BasicDLLImpl::BASIC_DLL->bDebugMode))
{
- // bJustStopping: if there's someone pressing STOP like crazy umpteen times,
- // but the Basic doesn't stop early enough, the box might appear more often...
- static bool bJustStopping = false;
- if (StarBASIC::IsRunning() && !bJustStopping
- && (BasicDLLImpl::BASIC_DLL->bBreakEnabled || BasicDLLImpl::BASIC_DLL->bDebugMode))
- {
- bJustStopping = true;
- StarBASIC::Stop();
- std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr,
- VclMessageType::Info, VclButtonsType::Ok,
- BasResId(IDS_SBERR_TERMINATED)));
- xInfoBox->run();
- bJustStopping = false;
- }
+ bJustStopping = true;
+ StarBASIC::Stop();
+ std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Info, VclButtonsType::Ok,
+ BasResId(IDS_SBERR_TERMINATED)));
+ xInfoBox->run();
+ bJustStopping = false;
}
#endif
}
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 533ee4f4d6a4..d525d1a13801 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -106,26 +106,26 @@ SbiStream::~SbiStream()
void SbiStream::MapError()
{
- if( pStrm )
- {
- ErrCode nEC = pStrm->GetError();
- if (nEC == ERRCODE_NONE)
- nError = ERRCODE_NONE;
- else if (nEC == SVSTREAM_FILE_NOT_FOUND)
- nError = ERRCODE_BASIC_FILE_NOT_FOUND;
- else if (nEC ==SVSTREAM_PATH_NOT_FOUND)
- nError = ERRCODE_BASIC_PATH_NOT_FOUND;
- else if (nEC ==SVSTREAM_TOO_MANY_OPEN_FILES)
- nError = ERRCODE_BASIC_TOO_MANY_FILES;
- else if (nEC ==SVSTREAM_ACCESS_DENIED)
- nError = ERRCODE_BASIC_ACCESS_DENIED;
- else if (nEC ==SVSTREAM_INVALID_PARAMETER)
- nError = ERRCODE_BASIC_BAD_ARGUMENT;
- else if (nEC ==SVSTREAM_OUTOFMEMORY)
- nError = ERRCODE_BASIC_NO_MEMORY;
- else
- nError = ERRCODE_BASIC_IO_ERROR;
- }
+ if( !pStrm )
+ return;
+
+ ErrCode nEC = pStrm->GetError();
+ if (nEC == ERRCODE_NONE)
+ nError = ERRCODE_NONE;
+ else if (nEC == SVSTREAM_FILE_NOT_FOUND)
+ nError = ERRCODE_BASIC_FILE_NOT_FOUND;
+ else if (nEC ==SVSTREAM_PATH_NOT_FOUND)
+ nError = ERRCODE_BASIC_PATH_NOT_FOUND;
+ else if (nEC ==SVSTREAM_TOO_MANY_OPEN_FILES)
+ nError = ERRCODE_BASIC_TOO_MANY_FILES;
+ else if (nEC ==SVSTREAM_ACCESS_DENIED)
+ nError = ERRCODE_BASIC_ACCESS_DENIED;
+ else if (nEC ==SVSTREAM_INVALID_PARAMETER)
+ nError = ERRCODE_BASIC_BAD_ARGUMENT;
+ else if (nEC ==SVSTREAM_OUTOFMEMORY)
+ nError = ERRCODE_BASIC_NO_MEMORY;
+ else
+ nError = ERRCODE_BASIC_IO_ERROR;
}
// Returns sal_True if UNO is available, otherwise the old file
@@ -543,23 +543,23 @@ ErrCode const & SbiStream::Read( char& ch )
void SbiStream::ExpandFile()
{
- if ( nExpandOnWriteTo )
+ if ( !nExpandOnWriteTo )
+ return;
+
+ sal_uInt64 nCur = pStrm->Seek(STREAM_SEEK_TO_END);
+ if( nCur < nExpandOnWriteTo )
{
- sal_uInt64 nCur = pStrm->Seek(STREAM_SEEK_TO_END);
- if( nCur < nExpandOnWriteTo )
- {
- sal_uInt64 nDiff = nExpandOnWriteTo - nCur;
- while( nDiff-- )
- {
- pStrm->WriteChar( 0 );
- }
- }
- else
+ sal_uInt64 nDiff = nExpandOnWriteTo - nCur;
+ while( nDiff-- )
{
- pStrm->Seek( nExpandOnWriteTo );
+ pStrm->WriteChar( 0 );
}
- nExpandOnWriteTo = 0;
}
+ else
+ {
+ pStrm->Seek( nExpandOnWriteTo );
+ }
+ nExpandOnWriteTo = 0;
}
namespace
@@ -811,37 +811,37 @@ void SbiIoSystem::WriteCon(const OUString& rText)
aOut += rText;
sal_Int32 n1 = aOut.indexOf('\n');
sal_Int32 n2 = aOut.indexOf('\r');
- if( n1 != -1 || n2 != -1 )
+ if( n1 == -1 && n2 == -1 )
+ return;
+
+ if( n1 == -1 )
{
- if( n1 == -1 )
- {
- n1 = n2;
- }
- else if( n2 == -1 )
- {
- n2 = n1;
- }
- if( n1 > n2 )
- {
- n1 = n2;
- }
- OUString s(aOut.copy(0, n1));
- aOut = aOut.copy(n1);
- while ( !aOut.isEmpty() && (aOut[0] == '\n' || aOut[0] == '\r') )
- {
- aOut = aOut.copy(1);
- }
- {
- SolarMutexGuard aSolarGuard;
+ n1 = n2;
+ }
+ else if( n2 == -1 )
+ {
+ n2 = n1;
+ }
+ if( n1 > n2 )
+ {
+ n1 = n2;
+ }
+ OUString s(aOut.copy(0, n1));
+ aOut = aOut.copy(n1);
+ while ( !aOut.isEmpty() && (aOut[0] == '\n' || aOut[0] == '\r') )
+ {
+ aOut = aOut.copy(1);
+ }
+ {
+ SolarMutexGuard aSolarGuard;
- vcl::Window* pParent = Application::GetDefDialogParent();
- std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, VclMessageType::Warning,
- VclButtonsType::OkCancel, s));
- xBox->set_default_response(RET_OK);
- if (!xBox->run())
- {
- nError = ERRCODE_BASIC_USER_ABORT;
- }
+ vcl::Window* pParent = Application::GetDefDialogParent();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, VclMessageType::Warning,
+ VclButtonsType::OkCancel, s));
+ xBox->set_default_response(RET_OK);
+ if (!xBox->run())
+ {
+ nError = ERRCODE_BASIC_USER_ABORT;
}
}
}
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 3214dd28602c..df177d334166 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -478,32 +478,32 @@ void SbRtl_ChDrive(StarBASIC *, SbxArray & rPar, bool)
void implStepRenameUCB( const OUString& aSource, const OUString& aDest )
{
const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
- if( xSFI.is() )
+ if( !xSFI.is() )
+ return;
+
+ try
{
- try
+ OUString aSourceFullPath = getFullPath( aSource );
+ if( !xSFI->exists( aSourceFullPath ) )
{
- OUString aSourceFullPath = getFullPath( aSource );
- if( !xSFI->exists( aSourceFullPath ) )
- {
- StarBASIC::Error( ERRCODE_BASIC_FILE_NOT_FOUND );
- return;
- }
+ StarBASIC::Error( ERRCODE_BASIC_FILE_NOT_FOUND );
+ return;
+ }
- OUString aDestFullPath = getFullPath( aDest );
- if( xSFI->exists( aDestFullPath ) )
- {
- StarBASIC::Error( ERRCODE_BASIC_FILE_EXISTS );
- }
- else
- {
- xSFI->move( aSourceFullPath, aDestFullPath );
- }
+ OUString aDestFullPath = getFullPath( aDest );
+ if( xSFI->exists( aDestFullPath ) )
+ {
+ StarBASIC::Error( ERRCODE_BASIC_FILE_EXISTS );
}
- catch(const Exception & )
+ else
{
- StarBASIC::Error( ERRCODE_BASIC_FILE_NOT_FOUND );
+ xSFI->move( aSourceFullPath, aDestFullPath );
}
}
+ catch(const Exception & )
+ {
+ StarBASIC::Error( ERRCODE_BASIC_FILE_NOT_FOUND );
+ }
}
// Implementation of StepRENAME with OSL
@@ -4241,19 +4241,19 @@ void SbRtl_Load(StarBASIC *, SbxArray & rPar, bool)
SbxBase* pObj = rPar.Get32(1)->GetObject();
- if ( pObj )
+ if ( !pObj )
+ return;
+
+ if (SbUserFormModule* pModule = dynamic_cast<SbUserFormModule*>(pObj))
{
- if (SbUserFormModule* pModule = dynamic_cast<SbUserFormModule*>(pObj))
- {
- pModule->Load();
- }
- else if (SbxObject* pSbxObj = dynamic_cast<SbxObject*>(pObj))
+ pModule->Load();
+ }
+ else if (SbxObject* pSbxObj = dynamic_cast<SbxObject*>(pObj))
+ {
+ SbxVariable* pVar = pSbxObj->Find("Load", SbxClassType::Method);
+ if( pVar )
{
- SbxVariable* pVar = pSbxObj->Find("Load", SbxClassType::Method);
- if( pVar )
- {
- pVar->GetInteger();
- }
+ pVar->GetInteger();
}
}
}
@@ -4269,19 +4269,19 @@ void SbRtl_Unload(StarBASIC *, SbxArray & rPar, bool)
SbxBase* pObj = rPar.Get32(1)->GetObject();
- if ( pObj )
+ if ( !pObj )
+ return;
+
+ if (SbUserFormModule* pFormModule = dynamic_cast<SbUserFormModule*>(pObj))
{
- if (SbUserFormModule* pFormModule = dynamic_cast<SbUserFormModule*>(pObj))
- {
- pFormModule->Unload();
- }
- else if (SbxObject *pSbxObj = dynamic_cast<SbxObject*>(pObj))
+ pFormModule->Unload();
+ }
+ else if (SbxObject *pSbxObj = dynamic_cast<SbxObject*>(pObj))
+ {
+ SbxVariable* pVar = pSbxObj->Find("Unload", SbxClassType::Method);
+ if( pVar )
{
- SbxVariable* pVar = pSbxObj->Find("Unload", SbxClassType::Method);
- if( pVar )
- {
- pVar->GetInteger();
- }
+ pVar->GetInteger();
}
}
}
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 9d81ea52c62d..afe6c21790a1 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -740,19 +740,19 @@ void SbiRuntime::SetParameters( SbxArray* pParams )
}
// ParamArray for missing parameter
- if( pInfo )
+ if( !pInfo )
+ return;
+
+ // #111897 Check first missing parameter for ParamArray
+ const SbxParamInfo* p = pInfo->GetParam(sal::static_int_cast<sal_uInt16>(nParamCount));
+ if( p && (p->nUserData & PARAM_INFO_PARAMARRAY) != 0 )
{
- // #111897 Check first missing parameter for ParamArray
- const SbxParamInfo* p = pInfo->GetParam(sal::static_int_cast<sal_uInt16>(nParamCount));
- if( p && (p->nUserData & PARAM_INFO_PARAMARRAY) != 0 )
- {
- SbxDimArray* pArray = new SbxDimArray( SbxVARIANT );
- pArray->unoAddDim32( 0, -1 );
- SbxVariable* pArrayVar = new SbxVariable( SbxVARIANT );
- pArrayVar->SetFlag( SbxFlagBits::ReadWrite );
- pArrayVar->PutObject( pArray );
- refParams->Put32( pArrayVar, nParamCount );
- }
+ SbxDimArray* pArray = new SbxDimArray( SbxVARIANT );
+ pArray->unoAddDim32( 0, -1 );
+ SbxVariable* pArrayVar = new SbxVariable( SbxVARIANT );
+ pArrayVar->SetFlag( SbxFlagBits::ReadWrite );
+ pArrayVar->PutObject( pArray );
+ refParams->Put32( pArrayVar, nParamCount );
}
}
@@ -907,40 +907,40 @@ bool SbiRuntime::Step()
void SbiRuntime::Error( ErrCode n, bool bVBATranslationAlreadyDone )
{
- if( n )
+ if( !n )
+ return;
+
+ nError = n;
+ if( !(isVBAEnabled() && !bVBATranslationAlreadyDone) )
+ return;
+
+ OUString aMsg = pInst->GetErrorMsg();
+ sal_Int32 nVBAErrorNumber = translateErrorToVba( nError, aMsg );
+ SbxVariable* pSbxErrObjVar = SbxErrObject::getErrObject().get();
+ SbxErrObject* pGlobErr = static_cast< SbxErrObject* >( pSbxErrObjVar );
+ if( pGlobErr != nullptr )
{
- nError = n;
- if( isVBAEnabled() && !bVBATranslationAlreadyDone )
- {
- OUString aMsg = pInst->GetErrorMsg();
- sal_Int32 nVBAErrorNumber = translateErrorToVba( nError, aMsg );
- SbxVariable* pSbxErrObjVar = SbxErrObject::getErrObject().get();
- SbxErrObject* pGlobErr = static_cast< SbxErrObject* >( pSbxErrObjVar );
- if( pGlobErr != nullptr )
- {
- pGlobErr->setNumberAndDescription( nVBAErrorNumber, aMsg );
- }
- pInst->aErrorMsg = aMsg;
- nError = ERRCODE_BASIC_COMPAT;
- }
+ pGlobErr->setNumberAndDescription( nVBAErrorNumber, aMsg );
}
+ pInst->aErrorMsg = aMsg;
+ nError = ERRCODE_BASIC_COMPAT;
}
void SbiRuntime::Error( ErrCode _errCode, const OUString& _details )
{
- if ( _errCode )
+ if ( !_errCode )
+ return;
+
+ // Not correct for class module usage, remove for now
+ //OSL_WARN_IF( pInst->pRun != this, "basic", "SbiRuntime::Error: can't propagate the error message details!" );
+ if ( pInst->pRun == this )
{
- // Not correct for class module usage, remove for now
- //OSL_WARN_IF( pInst->pRun != this, "basic", "SbiRuntime::Error: can't propagate the error message details!" );
- if ( pInst->pRun == this )
- {
- pInst->Error( _errCode, _details );
- //OSL_WARN_IF( nError != _errCode, "basic", "SbiRuntime::Error: the instance is expected to propagate the error code back to me!" );
- }
- else
- {
- nError = _errCode;
- }
+ pInst->Error( _errCode, _details );
+ //OSL_WARN_IF( nError != _errCode, "basic", "SbiRuntime::Error: the instance is expected to propagate the error code back to me!" );
+ }
+ else
+ {
+ nError = _errCode;
}
}
@@ -2928,19 +2928,19 @@ void SbiRuntime::StepPAD( sal_uInt32 nOp1 )
SbxVariable* p = GetTOS();
OUString s = p->GetOUString();
sal_Int32 nLen(nOp1);
- if( s.getLength() != nLen )
+ if( s.getLength() == nLen )
+ return;
+
+ OUStringBuffer aBuf(s);
+ if (aBuf.getLength() > nLen)
{
- OUStringBuffer aBuf(s);
- if (aBuf.getLength() > nLen)
- {
- comphelper::string::truncateToLength(aBuf, nLen);
- }
- else
- {
- comphelper::string::padToLength(aBuf, nLen, ' ');
- }
- s = aBuf.makeStringAndClear();
+ comphelper::string::truncateToLength(aBuf, nLen);
+ }
+ else
+ {
+ comphelper::string::padToLength(aBuf, nLen, ' ');
}
+ s = aBuf.makeStringAndClear();
}
// jump (+target)
@@ -4355,52 +4355,53 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
return;
}
- if (SbxDimArray* pArray = dynamic_cast<SbxDimArray*>(pObj))
- {
- const sal_Int32 nDims = pArray->GetDims32();
- sal_Int32 nTotalSize = nDims > 0 ? 1 : 0;
+ SbxDimArray* pArray = dynamic_cast<SbxDimArray*>(pObj);
+ if (!pArray)
+ return;
- // must be a one-dimensional array
- sal_Int32 nLower, nUpper;
- for( sal_Int32 i = 0 ; i < nDims ; ++i )
- {
- pArray->GetDim32( i+1, nLower, nUpper );
- const sal_Int32 nSize = nUpper - nLower + 1;
- nTotalSize *= nSize;
- }
+ const sal_Int32 nDims = pArray->GetDims32();
+ sal_Int32 nTotalSize = nDims > 0 ? 1 : 0;
- // Optimization: pre-allocate underlying container
- if (nTotalSize > 0)
- pArray->SbxArray::GetRef32(nTotalSize - 1);
+ // must be a one-dimensional array
+ sal_Int32 nLower, nUpper;
+ for( sal_Int32 i = 0 ; i < nDims ; ++i )
+ {
+ pArray->GetDim32( i+1, nLower, nUpper );
+ const sal_Int32 nSize = nUpper - nLower + 1;
+ nTotalSize *= nSize;
+ }
- // First, fill those parts of the array that are preserved
- bool bWasError = false;
- const bool bRestored = implRestorePreservedArray(pArray, refRedimpArray, &bWasError);
- if (bWasError)
- nTotalSize = 0; // on error, don't create objects
+ // Optimization: pre-allocate underlying container
+ if (nTotalSize > 0)
+ pArray->SbxArray::GetRef32(nTotalSize - 1);
- // create objects and insert them into the array
- OUString aClass( pImg->GetString( static_cast<short>( nOp2 ) ) );
- OUString aName;
- for( sal_Int32 i = 0 ; i < nTotalSize ; ++i )
+ // First, fill those parts of the array that are preserved
+ bool bWasError = false;
+ const bool bRestored = implRestorePreservedArray(pArray, refRedimpArray, &bWasError);
+ if (bWasError)
+ nTotalSize = 0; // on error, don't create objects
+
+ // create objects and insert them into the array
+ OUString aClass( pImg->GetString( static_cast<short>( nOp2 ) ) );
+ OUString aName;
+ for( sal_Int32 i = 0 ; i < nTotalSize ; ++i )
+ {
+ if (!bRestored || !pArray->SbxArray::GetRef32(i)) // For those left unset after preserve
{
- if (!bRestored || !pArray->SbxArray::GetRef32(i)) // For those left unset after preserve
+ SbxObject* pClassObj = SbxBase::CreateObject(aClass);
+ if (!pClassObj)
{
- SbxObject* pClassObj = SbxBase::CreateObject(aClass);
- if (!pClassObj)
- {
- Error(ERRCODE_BASIC_INVALID_OBJECT);
- break;
- }
- else
- {
- if (aName.isEmpty())
- aName = pImg->GetString(static_cast<short>(nOp1));
- pClassObj->SetName(aName);
- // the object must be able to call the basic
- pClassObj->SetParent(&rBasic);
- pArray->SbxArray::Put32(pClassObj, i);
- }
+ Error(ERRCODE_BASIC_INVALID_OBJECT);
+ break;
+ }
+ else
+ {
+ if (aName.isEmpty())
+ aName = pImg->GetString(static_cast<short>(nOp1));
+ pClassObj->SetName(aName);
+ // the object must be able to call the basic
+ pClassObj->SetParent(&rBasic);
+ pArray->SbxArray::Put32(pClassObj, i);
}
}
}
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index 708c09649a84..8a9513e81e0e 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -838,37 +838,37 @@ void SbiStdObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
const SbxHint* pHint = dynamic_cast<const SbxHint*>(&rHint);
- if( pHint )
+ if( !pHint )
+ return;
+
+ SbxVariable* pVar = pHint->GetVar();
+ SbxArray* pPar_ = pVar->GetParameters();
+ const sal_uInt16 nCallId = static_cast<sal_uInt16>(pVar->GetUserData());
+ if( nCallId )
{
- SbxVariable* pVar = pHint->GetVar();
- SbxArray* pPar_ = pVar->GetParameters();
- const sal_uInt16 nCallId = static_cast<sal_uInt16>(pVar->GetUserData());
- if( nCallId )
+ const SfxHintId t = pHint->GetId();
+ if( t == SfxHintId::BasicInfoWanted )
+ pVar->SetInfo( GetInfo( static_cast<short>(pVar->GetUserData()) ) );
+ else
{
- const SfxHintId t = pHint->GetId();
- if( t == SfxHintId::BasicInfoWanted )
- pVar->SetInfo( GetInfo( static_cast<short>(pVar->GetUserData()) ) );
- else
+ bool bWrite = false;
+ if( t == SfxHintId::BasicDataChanged )
+ bWrite = true;
+ if( t == SfxHintId::BasicDataWanted || bWrite )
{
- bool bWrite = false;
- if( t == SfxHintId::BasicDataChanged )
- bWrite = true;
- if( t == SfxHintId::BasicDataWanted || bWrite )
+ RtlCall p = aMethods[ nCallId-1 ].pFunc;
+ SbxArrayRef rPar( pPar_ );
+ if( !pPar_ )
{
- RtlCall p = aMethods[ nCallId-1 ].pFunc;
- SbxArrayRef rPar( pPar_ );
- if( !pPar_ )
- {
- rPar = pPar_ = new SbxArray;
- pPar_->Put32( pVar, 0 );
- }
- p( static_cast<StarBASIC*>(GetParent()), *pPar_, bWrite );
- return;
+ rPar = pPar_ = new SbxArray;
+ pPar_->Put32( pVar, 0 );
}
+ p( static_cast<StarBASIC*>(GetParent()), *pPar_, bWrite );
+ return;
}
}
- SbxObject::Notify( rBC, rHint );
}
+ SbxObject::Notify( rBC, rHint );
}
// building the info-structure for single elements
diff --git a/basic/source/runtime/stdobj1.cxx b/basic/source/runtime/stdobj1.cxx
index aad42547a58e..20268bfbf44b 100644
--- a/basic/source/runtime/stdobj1.cxx
+++ b/basic/source/runtime/stdobj1.cxx
@@ -126,28 +126,28 @@ void SbStdPicture::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
const SbxHint* pHint = dynamic_cast<const SbxHint*>(&rHint);
- if( pHint )
- {
- if( pHint->GetId() == SfxHintId::BasicInfoWanted )
- {
- SbxObject::Notify( rBC, rHint );
- return;
- }
-
- SbxVariable* pVar = pHint->GetVar();
- const sal_uInt32 nWhich = pVar->GetUserData();
- bool bWrite = pHint->GetId() == SfxHintId::BasicDataChanged;
-
- // Properties
- switch( nWhich )
- {
- case ATTR_IMP_TYPE: PropType( pVar, bWrite ); return;
- case ATTR_IMP_WIDTH: PropWidth( pVar, bWrite ); return;
- case ATTR_IMP_HEIGHT: PropHeight( pVar, bWrite ); return;
- }
+ if( !pHint )
+ return;
+ if( pHint->GetId() == SfxHintId::BasicInfoWanted )
+ {
SbxObject::Notify( rBC, rHint );
+ return;
}
+
+ SbxVariable* pVar = pHint->GetVar();
+ const sal_uInt32 nWhich = pVar->GetUserData();
+ bool bWrite = pHint->GetId() == SfxHintId::BasicDataChanged;
+
+ // Properties
+ switch( nWhich )
+ {
+ case ATTR_IMP_TYPE: PropType( pVar, bWrite ); return;
+ case ATTR_IMP_WIDTH: PropWidth( pVar, bWrite ); return;
+ case ATTR_IMP_HEIGHT: PropHeight( pVar, bWrite ); return;
+ }
+
+ SbxObject::Notify( rBC, rHint );
}
@@ -243,31 +243,31 @@ void SbStdFont::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
const SbxHint* pHint = dynamic_cast<const SbxHint*>(&rHint);
- if( pHint )
- {
- if( pHint->GetId() == SfxHintId::BasicInfoWanted )
- {
- SbxObject::Notify( rBC, rHint );
- return;
- }
-
- SbxVariable* pVar = pHint->GetVar();
- const sal_uInt32 nWhich = pVar->GetUserData();
- bool bWrite = pHint->GetId() == SfxHintId::BasicDataChanged;
-
- // Properties
- switch( nWhich )
- {
- case ATTR_IMP_BOLD: PropBold( pVar, bWrite ); return;
- case ATTR_IMP_ITALIC: PropItalic( pVar, bWrite ); return;
- case ATTR_IMP_STRIKETHROUGH:PropStrikeThrough( pVar, bWrite ); return;
- case ATTR_IMP_UNDERLINE: PropUnderline( pVar, bWrite ); return;
- case ATTR_IMP_SIZE: PropSize( pVar, bWrite ); return;
- case ATTR_IMP_NAME: PropName( pVar, bWrite ); return;
- }
+ if( !pHint )
+ return;
+ if( pHint->GetId() == SfxHintId::BasicInfoWanted )
+ {
SbxObject::Notify( rBC, rHint );
+ return;
}
+
+ SbxVariable* pVar = pHint->GetVar();
+ const sal_uInt32 nWhich = pVar->GetUserData();
+ bool bWrite = pHint->GetId() == SfxHintId::BasicDataChanged;
+
+ // Properties
+ switch( nWhich )
+ {
+ case ATTR_IMP_BOLD: PropBold( pVar, bWrite ); return;
+ case ATTR_IMP_ITALIC: PropItalic( pVar, bWrite ); return;
+ case ATTR_IMP_STRIKETHROUGH:PropStrikeThrough( pVar, bWrite ); return;
+ case ATTR_IMP_UNDERLINE: PropUnderline( pVar, bWrite ); return;
+ case ATTR_IMP_SIZE: PropSize( pVar, bWrite ); return;
+ case ATTR_IMP_NAME: PropName( pVar, bWrite ); return;
+ }
+
+ SbxObject::Notify( rBC, rHint );
}
@@ -391,31 +391,31 @@ void SbStdClipboard::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
const SbxHint* pHint = dynamic_cast<const SbxHint*>(&rHint);
- if( pHint )
- {
- if( pHint->GetId() == SfxHintId::BasicInfoWanted )
- {
- SbxObject::Notify( rBC, rHint );
- return;
- }
-
- SbxVariable* pVar = pHint->GetVar();
- SbxArray* pPar_ = pVar->GetParameters();
- const sal_uInt32 nWhich = pVar->GetUserData();
-
- // Methods
- switch( nWhich )
- {
- case METH_CLEAR: MethClear( pPar_ ); return;
- case METH_GETDATA: MethGetData( pPar_ ); return;
- case METH_GETFORMAT: MethGetFormat( pVar, pPar_ ); return;
- case METH_GETTEXT: MethGetText( pVar, pPar_ ); return;
- case METH_SETDATA: MethSetData( pPar_ ); return;
- case METH_SETTEXT: MethSetText( pPar_ ); return;
- }
+ if( !pHint )
+ return;
+ if( pHint->GetId() == SfxHintId::BasicInfoWanted )
+ {
SbxObject::Notify( rBC, rHint );
+ return;
}
+
+ SbxVariable* pVar = pHint->GetVar();
+ SbxArray* pPar_ = pVar->GetParameters();
+ const sal_uInt32 nWhich = pVar->GetUserData();
+
+ // Methods
+ switch( nWhich )
+ {
+ case METH_CLEAR: MethClear( pPar_ ); return;
+ case METH_GETDATA: MethGetData( pPar_ ); return;
+ case METH_GETFORMAT: MethGetFormat( pVar, pPar_ ); return;
+ case METH_GETTEXT: MethGetText( pVar, pPar_ ); return;
+ case METH_SETDATA: MethSetData( pPar_ ); return;
+ case METH_SETTEXT: MethSetText( pPar_ ); return;
+ }
+
+ SbxObject::Notify( rBC, rHint );
}