summaryrefslogtreecommitdiff
path: root/basic/source/classes
diff options
context:
space:
mode:
authornpower Developer <npower@openoffice.org>2010-04-20 13:11:25 +0100
committernpower Developer <npower@openoffice.org>2010-04-20 13:11:25 +0100
commite39d95068185a34abbf2de7e2e81ecc1f61eddc7 (patch)
treec4c9ad81d7856db067c13b7b6cf721d3cc0f3eae /basic/source/classes
parentac8249029a8b49d49463adb3086c0b154bfc0bb1 (diff)
ab75: #i110417# improve ErrObj behaviour
Diffstat (limited to 'basic/source/classes')
-rw-r--r--basic/source/classes/errobject.cxx12
-rw-r--r--basic/source/classes/sb.cxx32
-rw-r--r--basic/source/classes/sb.src4
3 files changed, 42 insertions, 6 deletions
diff --git a/basic/source/classes/errobject.cxx b/basic/source/classes/errobject.cxx
index 86b9d9289c..3d00824e24 100644
--- a/basic/source/classes/errobject.cxx
+++ b/basic/source/classes/errobject.cxx
@@ -19,6 +19,7 @@ class ErrObject : public ErrObjectImpl_BASE
rtl::OUString m_sDescription;
sal_Int32 m_nNumber;
sal_Int32 m_nHelpContext;
+ bool mbIsInError;
public:
ErrObject();
@@ -47,7 +48,7 @@ ErrObject::~ErrObject()
{
}
-ErrObject::ErrObject() : m_nNumber(0), m_nHelpContext(0)
+ErrObject::ErrObject() : m_nNumber(0), m_nHelpContext(0), mbIsInError(false)
{
}
@@ -60,9 +61,9 @@ ErrObject::getNumber() throw (uno::RuntimeException)
void SAL_CALL
ErrObject::setNumber( ::sal_Int32 _number ) throw (uno::RuntimeException)
{
- m_nNumber = _number;
-
-
+// m_nNumber = _number;
+ if ( !mbIsInError )
+ Raise( uno::makeAny( _number ), uno::Any(), uno::Any(), uno::Any(), uno::Any() );
}
::sal_Int32 SAL_CALL
@@ -128,6 +129,8 @@ ErrObject::Raise( const uno::Any& Number, const uno::Any& Source, const uno::Any
{
if ( !Number.hasValue() )
throw uno::RuntimeException( rtl::OUString::createFromAscii("Missing Required Paramater"), uno::Reference< uno::XInterface >() );
+ mbIsInError = true;
+ Clear();
Description >>= m_sDescription;
Source >>= m_sSource;
HelpFile >>= m_sHelpFile;
@@ -140,6 +143,7 @@ ErrObject::Raise( const uno::Any& Number, const uno::Any& Source, const uno::Any
n = m_nNumber; // force orig number, probably should have a specific table of vb ( localized ) errors
pINST->Error( n, m_sDescription );
}
+ mbIsInError = false;
}
// XDefaultProperty
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index d8a1947610..519d738b2d 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -54,6 +54,7 @@
#include "sb.hrc"
#include <basrid.hxx>
#include <vos/mutex.hxx>
+#include "errobject.hxx"
// #pragma SW_SEGMENT_CLASS( SBASIC, SBASIC_CODE )
@@ -1330,6 +1331,7 @@ void StarBASIC::MakeErrorText( SbError nId, const String& aMsg )
}
else
GetSbData()->aErrMsg = String::EmptyString();
+
}
BOOL StarBASIC::CError
@@ -1356,7 +1358,22 @@ BOOL StarBASIC::CError
// Umsetzung des Codes fuer String-Transport in SFX-Error
if( rMsg.Len() )
+ {
+ // very confusing, even though MakeErrorText sets up the error text
+ // seems that this is not used ( if rMsg already has content )
+ // In the case of VBA MakeErrorText also formats the error to be alittle more
+ // like vba ( adds an error number etc )
+ if ( SbiRuntime::isVBAEnabled() && ( code == SbERR_BASIC_COMPAT ) )
+ {
+ String aTmp = '\'';
+ aTmp += String::CreateFromInt32( SbxErrObject::getUnoErrObject()->getNumber() );
+ aTmp += String( RTL_CONSTASCII_USTRINGPARAM("\'\n") );
+ aTmp += GetSbData()->aErrMsg.Len() ? GetSbData()->aErrMsg : rMsg;
+ code = (ULONG)*new StringErrorInfo( code, aTmp );
+ }
+ else
code = (ULONG)*new StringErrorInfo( code, String(rMsg) );
+ }
SetErrorData( code, l, c1, c2 );
GetSbData()->bCompiler = TRUE;
@@ -1386,7 +1403,22 @@ BOOL StarBASIC::RTError( SbError code, const String& rMsg, USHORT l, USHORT c1,
// Umsetzung des Codes fuer String-Transport in SFX-Error
if( rMsg.Len() )
+ {
+ // very confusing, even though MakeErrorText sets up the error text
+ // seems that this is not used ( if rMsg already has content )
+ // In the case of VBA MakeErrorText also formats the error to be alittle more
+ // like vba ( adds an error number etc )
+ if ( SbiRuntime::isVBAEnabled() && ( code == SbERR_BASIC_COMPAT ) )
+ {
+ String aTmp = '\'';
+ aTmp += String::CreateFromInt32( SbxErrObject::getUnoErrObject()->getNumber() );
+ aTmp += String( RTL_CONSTASCII_USTRINGPARAM("\'\n") );
+ aTmp += GetSbData()->aErrMsg.Len() ? GetSbData()->aErrMsg : rMsg;
+ code = (ULONG)*new StringErrorInfo( code, aTmp );
+ }
+ else
code = (ULONG)*new StringErrorInfo( code, String(rMsg) );
+ }
SetErrorData( code, l, c1, c2 );
if( GetSbData()->aErrHdl.IsSet() )
diff --git a/basic/source/classes/sb.src b/basic/source/classes/sb.src
index bac3a3babe..286b4a4da8 100644
--- a/basic/source/classes/sb.src
+++ b/basic/source/classes/sb.src
@@ -590,8 +590,8 @@ Resource RID_BASIC_START
};
String ERRCODE_BASIC_COMPAT & ERRCODE_RES_MASK
{
- Text [ de ] = "$(ARG1)." ;
- Text [ en-US ] = "$(ARG1)." ;
+ Text [ de ] = "$(ARG1)" ;
+ Text [ en-US ] = "$(ARG1)" ;
Text [ x-comment ] = " ";
};
};