1 --- sc/source/ui/vba/vbawsfunction.cxx 2009-02-02 15:33:32.000000000 +0000
2 +++ sc/source/ui/vba/vbawsfunction.cxx.patched 2009-02-02 16:18:58.000000000 +0000
3 @@ -88,12 +88,13 @@ ScVbaWSFunction::invoke(const rtl::OUStr
4 count, rtl::OUStringToOString( comphelper::anyToString( aParamTemp[count] ), RTL_TEXTENCODING_UTF8 ).getStr() );
6 uno::Any aRet = xFunctionAccess->callFunction(FunctionName,aParamTemp);
8 // MATCH function should alwayse return a double value, but currently if the first argument is XCellRange, MATCH function returns an array instead of a double value. Don't know why?
9 // To fix this issue in safe, current solution is to convert this array to a double value just for MATCH function.
10 String aUpper( FunctionName );
11 ScCompiler aCompiler( NULL, ScAddress() );
12 OpCode eOp = aCompiler.GetEnglishOpCode( aUpper.ToUpperAscii() );
13 - if( eOp == ocMatch )
14 + if( eOp == ocMatch || eOp == ocIsError )
18 diff --git basic/source/runtime/methods.cxx basic/source/runtime/methods.cxx
19 index 8a9d408..0a7a30e 100644
20 --- basic/source/runtime/methods.cxx
21 +++ basic/source/runtime/methods.cxx
23 #include <com/sun/star/io/XOutputStream.hpp>
24 #include <com/sun/star/io/XStream.hpp>
25 #include <com/sun/star/io/XSeekable.hpp>
26 +#include <com/sun/star/script/XErrorQuery.hpp>
28 using namespace comphelper;
30 @@ -85,6 +86,7 @@ using namespace com::sun::star::uno;
31 using namespace com::sun::star::lang;
32 using namespace com::sun::star::ucb;
33 using namespace com::sun::star::io;
34 +using namespace com::sun::star::script;
38 @@ -2426,7 +2428,22 @@ RTLFUNC(IsError)
39 if ( rPar.Count() < 2 )
40 StarBASIC::Error( SbERR_BAD_ARGUMENT );
42 - rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
44 + SbxVariable* pVar =rPar.Get( 1 );
45 + SbUnoObject* pObj = PTR_CAST(SbUnoObject,pVar );
48 + if ( SbxBase* pBaseObj = pVar->GetObject() )
49 + pObj = PTR_CAST(SbUnoObject, pBaseObj );
51 + Reference< XErrorQuery > xError;
53 + xError.set( pObj->getUnoAny(), UNO_QUERY );
55 + rPar.Get( 0 )->PutBool( xError->hasError() );
57 + rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
62 diff --git oovbaapi/ooo/vba/excel/XRange.idl oovbaapi/ooo/vba/excel/XRange.idl
63 index d84dcae..8062497 100644
64 --- oovbaapi/ooo/vba/excel/XRange.idl
65 +++ oovbaapi/ooo/vba/excel/XRange.idl
67 #ifndef __com_sun_star_script_XDefaultMethod_idl__
68 #include <com/sun/star/script/XDefaultMethod.idl>
70 +#ifndef __com_sun_star_script_XErrorQuery_idl__
71 +#include <com/sun/star/script/XErrorQuery.idl>
73 #ifndef __ooo_vba_XCollection_idl__
74 #include <ooo/vba/XCollection.idl>
76 @@ -77,6 +80,7 @@ interface XRange
77 interface com::sun::star::container::XEnumerationAccess;
78 interface com::sun::star::script::XDefaultMethod;
79 interface com::sun::star::script::XDefaultProperty;
80 + interface com::sun::star::script::XErrorQuery;
81 interface ::ooo::vba::excel::XFormat;
82 //interface ::ooo::vba::XHelperInterface;
84 diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
85 index d7e20e5..a052262 100644
86 --- sc/source/ui/vba/vbarange.cxx
87 +++ sc/source/ui/vba/vbarange.cxx
88 @@ -5358,6 +5358,24 @@ ScVbaRange::getServiceNames()
93 +ScVbaRange::hasError() throw (uno::RuntimeException)
95 + double dResult = sal_False;
96 + uno::Reference< script::XInvocation > xInvoc( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication()->WorksheetFunction(), uno::UNO_QUERY_THROW );
98 + static rtl::OUString FunctionName( RTL_CONSTASCII_USTRINGPARAM("IsError" ) );
99 + uno::Sequence< uno::Any > Params(1);
100 + uno::Reference< excel::XRange > aRange( this );
101 + Params[0] = uno::makeAny( aRange );
102 + uno::Sequence< sal_Int16 > OutParamIndex;
103 + uno::Sequence< uno::Any > OutParam;
104 + xInvoc->invoke( FunctionName, Params, OutParamIndex, OutParam ) >>= dResult;
105 + if ( dResult > 0.0 )
112 namespace sdecl = comphelper::service_decl;
113 diff --git sc/source/ui/vba/vbarange.hxx sc/source/ui/vba/vbarange.hxx
114 index ce902f1..0df668c 100644
115 --- sc/source/ui/vba/vbarange.hxx
116 +++ sc/source/ui/vba/vbarange.hxx
117 @@ -274,6 +274,8 @@ public:
118 static css::uno::Reference< ov::excel::XRange > ApplicationRange( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Any &Cell1, const css::uno::Any &Cell2 ) throw (css::uno::RuntimeException);
119 virtual sal_Bool SAL_CALL GoalSeek( const css::uno::Any& Goal, const css::uno::Reference< ov::excel::XRange >& ChangingCell ) throw (css::uno::RuntimeException);
120 virtual css::uno::Reference< ov::excel::XRange > SAL_CALL SpecialCells( const css::uno::Any& _oType, const css::uno::Any& _oValue) throw ( css::script::BasicErrorException );
122 + virtual ::sal_Bool SAL_CALL hasError( ) throw (css::uno::RuntimeException);
124 virtual rtl::OUString& getServiceImplName();
125 virtual css::uno::Sequence<rtl::OUString> getServiceNames();
126 diff --git udkapi/com/sun/star/script/XErrorQuery.idl udkapi/com/sun/star/script/XErrorQuery.idl
128 index 0000000..9a1860e
130 +++ udkapi/com/sun/star/script/XErrorQuery.idl
132 +#ifndef __com_sun_star_script_XErrorQuery_idl__
133 +#define __com_sun_star_script_XErrorQuery_idl__
135 +#ifndef __com_sun_star_uno_XInterface_idl__
136 +#include <com/sun/star/uno/XInterface.idl>
139 +module com { module sun { module star { module script {
140 +//==============================================================================
142 +interface XErrorQuery : ::com::sun::star::uno::XInterface
144 + //-----------------------------------------------------------------------
146 + Returns whether this object has an error
149 + <atom>boolean</atom> indicating an error or not
151 + boolean hasError();
157 diff --git udkapi/com/sun/star/script/makefile.mk udkapi/com/sun/star/script/makefile.mk
158 index 69e06dd..250b5cc 100644
159 --- udkapi/com/sun/star/script/makefile.mk
160 +++ udkapi/com/sun/star/script/makefile.mk
161 @@ -87,6 +87,7 @@ IDLFILES=\
162 XDefaultProperty.idl\
167 # ------------------------------------------------------------------