summaryrefslogtreecommitdiffstats
path: root/basic/source/runtime/runtime.cxx
diff options
context:
space:
mode:
authornpower Developer <npower@openoffice.org>2010-03-29 09:39:35 +0100
committernpower Developer <npower@openoffice.org>2010-03-29 09:39:35 +0100
commitda50ceb5c035c8b70b4483d32e02851902bd7421 (patch)
tree91680f16458d073fe07f332c0e4d4db71bc8ef75 /basic/source/runtime/runtime.cxx
parentCWS-TOOLING: integrate CWS kso43 (diff)
downloadcore-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.cxx32
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 )