From 6f978fa97760206baa9f78b917a9e20c7a489929 Mon Sep 17 00:00:00 2001 From: Norbert Thiebaud Date: Mon, 22 Oct 2012 21:01:14 +0200 Subject: basic: use OUString internaly for error messages Change-Id: I9ea243f93b7477814037deca2f332c3359ce527d --- basic/source/inc/runtime.hxx | 18 +++++++++--------- basic/source/runtime/runtime.cxx | 22 +++++++++++----------- 2 files changed, 20 insertions(+), 20 deletions(-) (limited to 'basic') diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx index e2c795718736..86e2828db131 100644 --- a/basic/source/inc/runtime.hxx +++ b/basic/source/inc/runtime.hxx @@ -148,7 +148,7 @@ class SbiInstance sal_uInt32 nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx; SbError nErr; - String aErrorMsg; // last error message for $ARG + OUString aErrorMsg; // last error message for $ARG sal_uInt16 nErl; // current error line sal_Bool bReschedule; // Flag: sal_True = Reschedule in main loop sal_Bool bCompatibility; // Flag: sal_True = VBA runtime compatibility mode @@ -168,16 +168,16 @@ public: ~SbiInstance(); void Error( SbError ); // trappable Error - void Error( SbError, const String& rMsg ); // trappable Error with message - void ErrorVB( sal_Int32 nVBNumber, const String& rMsg ); - void setErrorVB( sal_Int32 nVBNumber, const String& rMsg ); + void Error( SbError, const OUString& rMsg ); // trappable Error with message + void ErrorVB( sal_Int32 nVBNumber, const OUString& rMsg ); + void setErrorVB( sal_Int32 nVBNumber, const OUString& rMsg ); void FatalError( SbError ); // non-trappable Error - void FatalError( SbError, const String& ); // non-trappable Error + void FatalError( SbError, const OUString& ); // non-trappable Error void Abort(); // with current error code void Stop(); SbError GetErr() { return nErr; } - String GetErrorMsg() { return aErrorMsg; } + OUString GetErrorMsg() { return aErrorMsg; } xub_StrLen GetErl() { return nErl; } void EnableReschedule( sal_Bool bEnable ) { bReschedule = bEnable; } sal_Bool IsReschedule( void ) { return bReschedule; } @@ -395,10 +395,10 @@ public: SbiRuntime( SbModule*, SbMethod*, sal_uInt32 ); ~SbiRuntime(); void Error( SbError, bool bVBATranslationAlreadyDone = false ); // set error if != 0 - void Error( SbError, const String& ); // set error if != 0 + void Error( SbError, const OUString& ); // set error if != 0 void FatalError( SbError ); // error handling = standard, set error - void FatalError( SbError, const String& ); // error handling = standard, set error - static sal_Int32 translateErrorToVba( SbError nError, String& rMsg ); + void FatalError( SbError, const OUString& ); // error handling = standard, set error + static sal_Int32 translateErrorToVba( SbError nError, OUString& rMsg ); void DumpPCode(); bool Step(); // single step (one opcode) void Stop() { bRun = false; } diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 0b780c1e919b..552313163d2a 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -427,7 +427,7 @@ void SbiInstance::Error( SbError n ) Error( n, String() ); } -void SbiInstance::Error( SbError n, const String& rMsg ) +void SbiInstance::Error( SbError n, const OUString& rMsg ) { if( !bWatchMode ) { @@ -436,7 +436,7 @@ void SbiInstance::Error( SbError n, const String& rMsg ) } } -void SbiInstance::ErrorVB( sal_Int32 nVBNumber, const String& rMsg ) +void SbiInstance::ErrorVB( sal_Int32 nVBNumber, const OUString& rMsg ) { if( !bWatchMode ) { @@ -453,7 +453,7 @@ void SbiInstance::ErrorVB( sal_Int32 nVBNumber, const String& rMsg ) } } -void SbiInstance::setErrorVB( sal_Int32 nVBNumber, const String& rMsg ) +void SbiInstance::setErrorVB( sal_Int32 nVBNumber, const OUString& rMsg ) { SbError n = StarBASIC::GetSfxFromVBError( static_cast< sal_uInt16 >( nVBNumber ) ); if( !n ) @@ -472,7 +472,7 @@ void SbiInstance::FatalError( SbError n ) pRun->FatalError( n ); } -void SbiInstance::FatalError( SbError _errCode, const String& _details ) +void SbiInstance::FatalError( SbError _errCode, const OUString& _details ) { pRun->FatalError( _errCode, _details ); } @@ -862,7 +862,7 @@ void SbiRuntime::Error( SbError n, bool bVBATranslationAlreadyDone ) nError = n; if( isVBAEnabled() && !bVBATranslationAlreadyDone ) { - String aMsg = pInst->GetErrorMsg(); + OUString aMsg = pInst->GetErrorMsg(); sal_Int32 nVBAErrorNumber = translateErrorToVba( nError, aMsg ); SbxVariable* pSbxErrObjVar = SbxErrObject::getErrObject(); SbxErrObject* pGlobErr = static_cast< SbxErrObject* >( pSbxErrObjVar ); @@ -876,7 +876,7 @@ void SbiRuntime::Error( SbError n, bool bVBATranslationAlreadyDone ) } } -void SbiRuntime::Error( SbError _errCode, const String& _details ) +void SbiRuntime::Error( SbError _errCode, const OUString& _details ) { if ( _errCode ) { @@ -900,20 +900,20 @@ void SbiRuntime::FatalError( SbError n ) Error( n ); } -void SbiRuntime::FatalError( SbError _errCode, const String& _details ) +void SbiRuntime::FatalError( SbError _errCode, const OUString& _details ) { StepSTDERROR(); Error( _errCode, _details ); } -sal_Int32 SbiRuntime::translateErrorToVba( SbError nError, String& rMsg ) +sal_Int32 SbiRuntime::translateErrorToVba( SbError nError, OUString& rMsg ) { // If a message is defined use that ( in preference to // the defined one for the error ) NB #TODO // if there is an error defined it more than likely // is not the one you want ( some are the same though ) // we really need a new vba compatible error list - if ( !rMsg.Len() ) + if ( rMsg.isEmpty() ) { // TEST, has to be vb here always #ifdef DBG_UTIL @@ -923,9 +923,9 @@ sal_Int32 SbiRuntime::translateErrorToVba( SbError nError, String& rMsg ) StarBASIC::MakeErrorText( nError, rMsg ); rMsg = StarBASIC::GetErrorText(); - if ( !rMsg.Len() ) // no message for err no, need localized resource here + if ( rMsg.isEmpty() ) // no message for err no, need localized resource here { - rMsg = String( RTL_CONSTASCII_USTRINGPARAM("Internal Object Error:") ); + rMsg = "Internal Object Error:"; } } // no num? most likely then it *is* really a vba err -- cgit