diff options
author | npower Developer <npower@openoffice.org> | 2010-03-29 09:39:35 +0100 |
---|---|---|
committer | npower Developer <npower@openoffice.org> | 2010-03-29 09:39:35 +0100 |
commit | da50ceb5c035c8b70b4483d32e02851902bd7421 (patch) | |
tree | 91680f16458d073fe07f332c0e4d4db71bc8ef75 /basic/source/runtime/runtime.cxx | |
parent | CWS-TOOLING: integrate CWS kso43 (diff) | |
download | core-da50ceb5c035c8b70b4483d32e02851902bd7421.tar.gz core-da50ceb5c035c8b70b4483d32e02851902bd7421.zip |
ab75: #i110417# initial ( untested ) implementation
Diffstat (limited to 'basic/source/runtime/runtime.cxx')
-rw-r--r-- | basic/source/runtime/runtime.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 52aa76e2f2df..75ff47c73486 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -43,6 +43,7 @@ #include <comphelper/processfactory.hxx> #include <com/sun/star/container/XEnumerationAccess.hpp> #include "sbunoobj.hxx" +#include "errobject.hxx" bool SbiRuntime::isVBAEnabled() { @@ -794,7 +795,38 @@ BOOL SbiRuntime::Step() void SbiRuntime::Error( SbError n ) { if( n ) + { nError = n; + if ( isVBAEnabled() ) + { + String aMsg = pInst->GetErrorMsg(); + // 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 ( !aMsg.Len() ) + { + StarBASIC::MakeErrorText( n, aMsg ); + aMsg = StarBASIC::GetErrorText(); + if ( !aMsg.Len() ) // no message for err no. + // need localized resource here + aMsg = String( RTL_CONSTASCII_USTRINGPARAM("Internal Object Error:") ); + } + // no num? most likely then it *is* really a vba err + SbxErrObject::getUnoErrObject()->setNumber( ( StarBASIC::GetVBErrorCode( n ) == 0 ) ? n : StarBASIC::GetVBErrorCode( n ) ); + SbxErrObject::getUnoErrObject()->setDescription( aMsg ); + + // prepend an error number to the message. + String aTmp = '\''; + aTmp += String::CreateFromInt32( SbxErrObject::getUnoErrObject()->getNumber() ); + aTmp += String( RTL_CONSTASCII_USTRINGPARAM("\'\n") ); + aTmp += aMsg; + + pInst->aErrorMsg = aTmp; + nError = SbERR_BASIC_COMPAT; + } + } } void SbiRuntime::Error( SbError _errCode, const String& _details ) |