update dev300-m57
[ooovba.git] / applied_patches / 0323-basic-caller-support.diff
blob019ef24e7e695948d13f355ebf5807ec85728896
1 diff -up /data4/Latest/ooo-build/build/ooh680-m1/scripting/source/basprov/basscript.hxx scripting/source/basprov/basscript.hxx
2 --- /data4/Latest/ooo-build/build/ooh680-m1/scripting/source/basprov/basscript.hxx 2005-09-09 03:24:12.000000000 +0100
3 +++ scripting/source/basprov/basscript.hxx 2007-12-19 17:19:58.000000000 +0000
4 @@ -36,11 +36,13 @@
5 #ifndef SCRIPTING_BASSCRIPT_HXX
6 #define SCRIPTING_BASSCRIPT_HXX
8 +#include "bcholder.hxx"
9 #include <com/sun/star/script/provider/XScript.hpp>
10 #include <com/sun/star/document/XScriptInvocationContext.hpp>
11 #include <cppuhelper/implbase1.hxx>
12 +#include <comphelper/proparrhlp.hxx>
13 +#include <comphelper/propertycontainer.hxx>
14 #include <basic/sbmeth.hxx>
17 class BasicManager;
19 @@ -66,7 +68,11 @@ namespace basprov
20 ::com::sun::star::script::provider::XScript > BasicScriptImpl_BASE;
23 - class BasicScriptImpl : public BasicScriptImpl_BASE
24 + class BasicScriptImpl : public BasicScriptImpl_BASE,
25 + public ::scripting_helper::OMutexHolder,
26 + public ::scripting_helper::OBroadcastHelperHolder,
27 + public ::comphelper::OPropertyContainer,
28 + public ::comphelper::OPropertyArrayUsageHelper< BasicScriptImpl >
30 private:
31 SbMethodRef m_xMethod;
32 @@ -74,6 +80,16 @@ namespace basprov
33 BasicManager* m_documentBasicManager;
34 ::com::sun::star::uno::Reference< ::com::sun::star::document::XScriptInvocationContext >
35 m_xDocumentScriptContext;
36 + // hack, OPropertyContainer doesn't allow you to define a property of unknown
37 + // type ( I guess because an Any can't contain an Any... I've always wondered why?
38 + // as its not unusual to do that in corba )
39 + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_caller;
40 + protected:
41 + // OPropertySetHelper
42 + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper( );
44 + // OPropertyArrayUsageHelper
45 + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
47 public:
48 BasicScriptImpl(
49 @@ -88,6 +104,12 @@ namespace basprov
51 virtual ~BasicScriptImpl();
53 + // XInterface
54 + DECLARE_XINTERFACE()
56 + // XTypeProvider
57 + DECLARE_XTYPEPROVIDER()
59 // XScript
60 virtual ::com::sun::star::uno::Any SAL_CALL invoke(
61 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
62 @@ -97,6 +119,9 @@ namespace basprov
63 ::com::sun::star::script::provider::ScriptFrameworkErrorException,
64 ::com::sun::star::reflection::InvocationTargetException,
65 ::com::sun::star::uno::RuntimeException );
66 + // XPropertySet
67 + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( )
68 + throw (::com::sun::star::uno::RuntimeException);
71 //.........................................................................
72 --- /data4/Latest/ooo-build/build/ooh680-m1/basic/inc/basic/sbmeth.hxx 2008-01-08 09:36:28.000000000 +0000
73 +++ basic/inc/basic/sbmeth.hxx 2007-12-20 09:38:21.000000000 +0000
74 @@ -49,6 +49,7 @@
75 friend class SbIfaceMapperMethod;
77 SbMethodImpl* mpSbMethodImpl; // Impl data
78 + SbxVariable* mCaller; // caller
79 SbModule* pMod;
80 USHORT nDebugFlags;
81 USHORT nLine1, nLine2;
82 @@ -75,7 +76,7 @@
83 void GetLineRange( USHORT&, USHORT& );
85 // Schnittstelle zum Ausfuehren einer Methode aus den Applikationen
86 - virtual ErrCode Call( SbxValue* pRet = NULL );
87 + virtual ErrCode Call( SbxValue* pRet = NULL, SbxVariable* pCaller = NULL );
88 virtual void Broadcast( ULONG nHintId );
91 --- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/classes/sbxmod.cxx 2008-01-08 09:36:28.000000000 +0000
92 +++ basic/source/classes/sbxmod.cxx 2007-12-20 11:22:38.000000000 +0000
93 @@ -1936,6 +1936,7 @@ SbMethod::SbMethod( const String& r, Sbx
94 nLine1 =
95 nLine2 = 0;
96 refStatics = new SbxArray;
97 + mCaller = 0;
98 // AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden'
99 SetFlag( SBX_NO_MODIFY );
101 @@ -1950,6 +1951,7 @@ SbMethod::SbMethod( const SbMethod& r )
102 nLine1 = r.nLine1;
103 nLine2 = r.nLine2;
104 refStatics = r.refStatics;
105 + mCaller = r.mCaller;
106 SetFlag( SBX_NO_MODIFY );
109 @@ -2018,8 +2020,13 @@ SbxInfo* SbMethod::GetInfo()
110 // Schnittstelle zum Ausfuehren einer Methode aus den Applikationen
111 // #34191# Mit speziellem RefCounting, damit das Basic nicht durch CloseDocument()
112 // abgeschossen werden kann. Rueckgabewert wird als String geliefert.
113 -ErrCode SbMethod::Call( SbxValue* pRet )
114 +ErrCode SbMethod::Call( SbxValue* pRet, SbxVariable* pCaller )
116 + if ( pCaller )
118 + OSL_TRACE("SbMethod::Call Have been passed a caller 0x%x", pCaller );
119 + mCaller = pCaller;
121 // RefCount vom Modul hochzaehlen
122 SbModule* pMod_ = (SbModule*)GetParent();
123 pMod_->AddRef();
124 @@ -2047,7 +2054,7 @@ ErrCode SbMethod::Call( SbxValue* pRet )
125 // Objekte freigeben
126 pMod_->ReleaseRef();
127 pBasic->ReleaseRef();
129 + mCaller = 0;
130 return nErr;
133 --- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/runtime/runtime.cxx 2008-01-08 09:36:28.000000000 +0000
134 +++ basic/source/runtime/runtime.cxx 2007-12-20 11:23:14.000000000 +0000
135 @@ -491,7 +491,7 @@ SbxArray* SbiInstance::GetLocals( SbMeth
137 SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart )
138 : rBasic( *(StarBASIC*)pm->pParent ), pInst( pINST ),
139 - pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), m_nLastTime(0)
140 + pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), mpExtCaller(0), m_nLastTime(0)
142 nFlags = pe ? pe->GetDebugFlags() : 0;
143 pIosys = pInst->pIosys;
144 @@ -545,6 +545,18 @@ SbiRuntime::~SbiRuntime()
148 +void SbiRuntime::SetVBAEnabled(bool bEnabled )
150 + bVBAEnabled = bEnabled;
151 + if ( bVBAEnabled )
153 + if ( pMeth )
154 + mpExtCaller = pMeth->mCaller;
156 + else
157 + mpExtCaller = 0;
160 // Aufbau der Parameterliste. Alle ByRef-Parameter werden direkt
161 // uebernommen; von ByVal-Parametern werden Kopien angelegt. Falls
162 // ein bestimmter Datentyp verlangt wird, wird konvertiert.
163 --- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/inc/runtime.hxx 2008-01-08 09:36:28.000000000 +0000
164 +++ basic/source/inc/runtime.hxx 2007-12-20 11:21:36.000000000 +0000
165 @@ -338,6 +338,7 @@ class SbiRuntime
166 SbxArrayRef refCaseStk; // CASE expression stack
167 SbxArrayRef refRedimpArray; // Array saved to use for REDIM PRESERVE
168 SbxVariableRef xDummyVar; // Ersatz fuer nicht gefundene Variablen
169 + SbxVariable* mpExtCaller; // Caller ( external - e.g. button name, shape, range object etc. - only in vba mode )
170 SbiArgvStack* pArgvStk; // ARGV-Stack
171 SbiGosubStack* pGosubStk; // GOSUB stack
172 SbiForStack* pForStk; // FOR/NEXT-Stack
173 @@ -479,7 +480,7 @@ class SbiRuntime
174 void StepFIND_CM( UINT32, UINT32 );
175 void StepFIND_STATIC( UINT32, UINT32 );
176 public:
177 - void SetVBAEnabled( bool bEnabled ) { bVBAEnabled = bEnabled; };
178 + void SetVBAEnabled( bool bEnabled );
179 USHORT GetImageFlag( USHORT n ) const;
180 USHORT GetBase();
181 xub_StrLen nLine,nCol1,nCol2; // aktuelle Zeile, Spaltenbereich
182 @@ -502,6 +503,7 @@ public:
183 SbMethod* GetCaller();
184 SbxArray* GetLocals();
185 SbxArray* GetParams();
186 + SbxVariable* GetExternalCaller(){ return mpExtCaller; }
188 SbxBase* FindElementExtern( const String& rName );
189 static bool isVBAEnabled();
190 --- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/runtime/methods.cxx 2008-01-08 09:36:28.000000000 +0000
191 +++ basic/source/runtime/methods.cxx 2007-12-19 16:44:56.000000000 +0000
192 @@ -948,6 +948,26 @@ RTLFUNC(Hex)
196 +RTLFUNC(FuncCaller)
198 + (void)pBasic;
199 + (void)bWrite;
200 + if ( SbiRuntime::isVBAEnabled() && pINST && pINST->pRun )
202 + if ( pINST->pRun->GetExternalCaller() )
203 + *rPar.Get(0) = *pINST->pRun->GetExternalCaller();
204 + else
206 + SbxVariableRef pVar = new SbxVariable(SbxVARIANT);
207 + *rPar.Get(0) = *pVar;
210 + else
212 + StarBASIC::Error( SbERR_NOT_IMPLEMENTED );
216 // InStr( [start],string,string,[compare] )
218 RTLFUNC(InStr)
220 --- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/runtime/stdobj.cxx 2008-01-08 09:36:28.000000000 +0000
221 +++ basic/source/runtime/stdobj.cxx 2007-12-19 16:26:50.000000000 +0000
222 @@ -608,6 +608,7 @@ static Methods aMethods[] = {
224 { "Wait", SbxNULL, 1 | _FUNCTION, RTLNAME(Wait),0 },
225 { "Milliseconds", SbxLONG, 0,NULL,0 },
226 +{ "FuncCaller", SbxVARIANT, _FUNCTION, RTLNAME(FuncCaller),0 },
227 //#i64882#
228 { "WaitUntil", SbxNULL, 1 | _FUNCTION, RTLNAME(WaitUntil),0 },
229 { "Date", SbxDOUBLE, 0,NULL,0 },
230 --- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/runtime/rtlproto.hxx 2008-01-08 09:36:28.000000000 +0000
231 +++ basic/source/runtime/rtlproto.hxx 2007-12-19 16:38:09.000000000 +0000
232 @@ -303,6 +303,7 @@ extern RTLFUNC(Switch);
233 extern RTLFUNC(Wait);
234 //i#64882# add new WaitUntil
235 extern RTLFUNC(WaitUntil);
236 +extern RTLFUNC(FuncCaller);
238 extern RTLFUNC(GetGUIVersion);
239 extern RTLFUNC(Choose);
240 --- /data4/Latest/ooo-build/build/ooh680-m1/sfx2/inc/sfx2/objsh.hxx 2008-01-08 09:36:27.000000000 +0000
241 +++ sfx2/inc/sfx2/objsh.hxx 2008-01-10 11:25:23.000000000 +0000
242 @@ -449,7 +449,8 @@ public:
243 ::com::sun::star::uno::Any& aRet,
244 ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
245 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
246 - bool bRaiseError = true
247 + bool bRaiseError = true,
248 + ::com::sun::star::uno::Any* aCaller = 0
251 static ErrCode CallXScript(
252 @@ -459,7 +460,8 @@ public:
253 ::com::sun::star::uno::Any& aRet,
254 ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
255 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
256 - bool bRaiseError = true
257 + bool bRaiseError = true,
258 + ::com::sun::star::uno::Any* aCaller = 0
261 /** adjusts the internal macro mode, according to the current security settings
262 --- /data4/Latest/ooo-build/build/ooh680-m1/sfx2/source/doc/objmisc.cxx 2008-01-08 09:36:27.000000000 +0000
263 +++ sfx2/source/doc/objmisc.cxx 2008-01-10 15:12:14.000000000 +0000
264 @@ -1515,7 +1515,7 @@ namespace
267 ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const ::rtl::OUString& _rScriptURL,
268 - const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError )
269 + const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError, ::com::sun::star::uno::Any* pCaller )
271 OSL_TRACE( "in CallXScript" );
272 ErrCode nErr = ERRCODE_NONE;
273 @@ -1546,7 +1546,16 @@ ErrCode SfxObjectShell::CallXScript( con
275 // obtain the script, and execute it
276 Reference< provider::XScript > xScript( xScriptProvider->getScript( _rScriptURL ), UNO_QUERY_THROW );
278 + if ( pCaller && pCaller->hasValue() )
280 + Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY );
281 + if ( xProps.is() )
283 + Sequence< uno::Any > aArgs( 1 );
284 + aArgs[ 0 ] = *pCaller;
285 + xProps->setPropertyValue( rtl::OUString::createFromAscii("Caller"), uno::makeAny( aArgs ) );
288 aRet = xScript->invoke( aParams, aOutParamIndex, aOutParam );
290 catch ( const uno::Exception& )
291 @@ -1580,9 +1589,9 @@ ErrCode SfxObjectShell::CallXScript( con
292 ::com::sun::star::uno::Any& aRet,
293 ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
294 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&
295 - aOutParam, bool bRaiseError )
296 + aOutParam, bool bRaiseError, ::com::sun::star::uno::Any* pCaller )
298 - return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError );
299 + return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError, pCaller );
302 //-------------------------------------------------------------------------
303 --- /data4/Latest/ooo-build/build/ooh680-m1/sc/source/ui/drawfunc/fusel.cxx 2008-01-08 09:36:20.000000000 +0000
304 +++ sc/source/ui/drawfunc/fusel.cxx 2008-01-10 15:25:12.000000000 +0000
305 @@ -221,13 +221,23 @@ BOOL __EXPORT FuSelection::MouseButtonDo
306 SfxObjectShell* pObjSh = SfxObjectShell::Current();
307 if ( pObjSh && SfxApplication::IsXScriptURL( pInfo->GetMacro() ) )
309 + uno::Reference< beans::XPropertySet > xProps( pObj->getUnoShape(), uno::UNO_QUERY );
310 + uno::Any aCaller;
311 + if ( xProps.is() )
313 + try
315 + aCaller = xProps->getPropertyValue( rtl::OUString::createFromAscii("Name") );
317 + catch( uno::Exception& ) {}
319 uno::Any aRet;
320 uno::Sequence< sal_Int16 > aOutArgsIndex;
321 uno::Sequence< uno::Any > aOutArgs;
322 uno::Sequence< uno::Any >* pInArgs =
323 new uno::Sequence< uno::Any >(0);
324 pObjSh->CallXScript( pInfo->GetMacro(),
325 - *pInArgs, aRet, aOutArgsIndex, aOutArgs);
326 + *pInArgs, aRet, aOutArgsIndex, aOutArgs, true, &aCaller );
327 pViewShell->FakeButtonUp( pViewShell->GetViewData()->GetActivePart() );
328 return TRUE; // kein CaptureMouse etc.
330 --- /data4/Latest/ooo-build/build/ooh680-m1/sc/source/ui/drawfunc/makefile.mk 2005-09-08 22:00:04.000000000 +0100
331 +++ sc/source/ui/drawfunc/makefile.mk 2008-01-10 15:19:30.000000000 +0000
332 @@ -90,6 +90,7 @@ SLOFILES = \
333 $(SLO)$/mediash.obj
335 EXCEPTIONSFILES= \
336 + $(SLO)$/fusel.obj \
337 $(SLO)$/fuins2.obj
339 NOOPTFILES=\
340 --- /data4/Latest/ooo-build/build/ooh680-m1/svx/source/form/fmscriptingenv.cxx 2008-01-08 09:36:27.000000000 +0000
341 +++ svx/source/form/fmscriptingenv.cxx 2008-01-10 12:10:21.000000000 +0000
342 @@ -59,6 +59,8 @@
343 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
344 #include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
345 #include <com/sun/star/lang/DisposedException.hpp>
346 +#include <com/sun/star/lang/EventObject.hpp>
347 +#include <com/sun/star/awt/XControl.hpp>
348 /** === end UNO includes === **/
349 #include <tools/diagnose_ex.h>
350 #include <cppuhelper/implbase1.hxx>
351 @@ -111,6 +115,9 @@ namespace svxform
352 using ::com::sun::star::uno::Exception;
353 using ::com::sun::star::uno::Sequence;
354 using ::com::sun::star::uno::XInterface;
355 + using ::com::sun::star::lang::EventObject;
356 + using ::com::sun::star::awt::XControl;
357 + using ::com::sun::star::beans::XPropertySet;
358 /** === end UNO using === **/
360 class FormScriptingEnvironment;
361 @@ -453,8 +460,19 @@ namespace svxform
363 Sequence< sal_Int16 > aOutArgsIndex;
364 Sequence< Any > aOutArgs;
366 - m_rObjectShell.CallXScript( m_sScriptCode, _rArguments, _rSynchronousResult, aOutArgsIndex, aOutArgs );
367 + EventObject aEvent;
368 + Any aCaller;
369 + if ( ( _rArguments.getLength() > 0 ) && ( _rArguments[ 0 ] >>= aEvent ) )
371 + try
373 + Reference< XControl > xControl( aEvent.Source, UNO_QUERY_THROW );
374 + Reference< XPropertySet > xProps( xControl->getModel(), UNO_QUERY_THROW );
375 + aCaller = xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) );
377 + catch( Exception& ) {}
379 + m_rObjectShell.CallXScript( m_sScriptCode, _rArguments, _rSynchronousResult, aOutArgsIndex, aOutArgs, true, aCaller.hasValue() ? &aCaller : 0 );
382 //................................................................
383 --- /data4/Latest/ooo-build/build/ooh680-m1/scripting/source/vbaevents/eventhelper.cxx 2008-01-08 09:36:27.000000000 +0000
384 +++ scripting/source/vbaevents/eventhelper.cxx 2008-01-10 14:39:12.000000000 +0000
385 @@ -808,7 +808,16 @@ EventListener::firing_Impl(const ScriptE
387 uno::Reference< script::provider::XScript > xScript = xScriptProvider->getScript( url );
388 if ( xScript.is() )
389 - xScript->invoke( aArguments, aOutArgsIndex, aOutArgs );
391 + uno::Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY );
392 + if ( xProps.is() )
394 + Sequence< Any > aCallerHack(1);
395 + aCallerHack[ 0 ] = uno::makeAny( rtl::OUString::createFromAscii("Error") );
396 + xProps->setPropertyValue( rtl::OUString::createFromAscii( "Caller" ), uno::makeAny( aCallerHack ) );
398 + xScript->invoke( aArguments, aOutArgsIndex, aOutArgs );
401 catch ( uno::Exception& e )
403 --- scripting/source/basprov/basscript.cxx 2008-04-25 18:33:48.000000000 +0100
404 +++ scripting/source/basprov/basscript.cxx 2008-04-25 18:23:29.000000000 +0100
405 @@ -64,7 +64,10 @@
406 #include <basic/sbmeth.hxx>
407 #include <basic/basmgr.hxx>
408 #include <com/sun/star/script/provider/ScriptFrameworkErrorType.hpp>
410 +#include "bcholder.hxx"
411 +#include <comphelper/proparrhlp.hxx>
412 +#include <comphelper/propertycontainer.hxx>
413 +#include <com/sun/star/beans/PropertyAttribute.hpp>
414 #include <map>
417 @@ -73,6 +76,7 @@ using namespace ::com::sun::star::lang;
418 using namespace ::com::sun::star::uno;
419 using namespace ::com::sun::star::script;
420 using namespace ::com::sun::star::document;
421 +using namespace ::com::sun::star::beans;
423 extern ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
424 extern void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue );
425 @@ -82,6 +86,10 @@ extern void unoToSbxValue( SbxVariable*
426 namespace basprov
428 //.........................................................................
429 +#define BASSCRIPT_PROPERTY_ID_CALLER 1
430 +#define BASSCRIPT_PROPERTY_CALLER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Caller" ) )
432 +#define BASSCRIPT_DEFAULT_ATTRIBS() PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT
434 typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap;
436 @@ -92,22 +100,28 @@ namespace basprov
437 // -----------------------------------------------------------------------------
439 BasicScriptImpl::BasicScriptImpl( const ::rtl::OUString& funcName, SbMethodRef xMethod )
440 - :m_xMethod( xMethod )
441 + : ::scripting_helper::OBroadcastHelperHolder( m_aMutex )
442 + ,OPropertyContainer( GetBroadcastHelper() )
443 + ,m_xMethod( xMethod )
444 ,m_funcName( funcName )
445 ,m_documentBasicManager( NULL )
446 ,m_xDocumentScriptContext()
448 + registerProperty( BASSCRIPT_PROPERTY_CALLER, BASSCRIPT_PROPERTY_ID_CALLER, BASSCRIPT_DEFAULT_ATTRIBS(), &m_caller, ::getCppuType( &m_caller ) );
451 // -----------------------------------------------------------------------------
453 BasicScriptImpl::BasicScriptImpl( const ::rtl::OUString& funcName, SbMethodRef xMethod,
454 - BasicManager& documentBasicManager, const Reference< XScriptInvocationContext >& documentScriptContext )
455 - :m_xMethod( xMethod )
456 + BasicManager& documentBasicManager, const Reference< XScriptInvocationContext >& documentScriptContext ) : ::scripting_helper::OBroadcastHelperHolder( m_aMutex )
457 + ,OPropertyContainer( GetBroadcastHelper() )
458 + ,m_xMethod( xMethod )
459 ,m_funcName( funcName )
460 ,m_documentBasicManager( &documentBasicManager )
461 ,m_xDocumentScriptContext( documentScriptContext )
463 + //
464 + registerProperty( BASSCRIPT_PROPERTY_CALLER, BASSCRIPT_PROPERTY_ID_CALLER, BASSCRIPT_DEFAULT_ATTRIBS(), &m_caller, ::getCppuType( &m_caller ) );
467 // -----------------------------------------------------------------------------
468 @@ -116,6 +130,48 @@ namespace basprov
471 // -----------------------------------------------------------------------------
472 + // XInterface
473 + // -----------------------------------------------------------------------------
475 + IMPLEMENT_FORWARD_XINTERFACE2( BasicScriptImpl, BasicScriptImpl_BASE, OPropertyContainer )
477 + // -----------------------------------------------------------------------------
478 + // XTypeProvider
479 + // -----------------------------------------------------------------------------
481 + IMPLEMENT_FORWARD_XTYPEPROVIDER2( BasicScriptImpl, BasicScriptImpl_BASE, OPropertyContainer )
483 + // -----------------------------------------------------------------------------
484 + // OPropertySetHelper
485 + // -----------------------------------------------------------------------------
487 + ::cppu::IPropertyArrayHelper& BasicScriptImpl::getInfoHelper( )
489 + return *getArrayHelper();
492 + // -----------------------------------------------------------------------------
493 + // OPropertyArrayUsageHelper
494 + // -----------------------------------------------------------------------------
496 + ::cppu::IPropertyArrayHelper* BasicScriptImpl::createArrayHelper( ) const
498 + Sequence< Property > aProps;
499 + describeProperties( aProps );
500 + return new ::cppu::OPropertyArrayHelper( aProps );
503 + // -----------------------------------------------------------------------------
504 + // XPropertySet
505 + // -----------------------------------------------------------------------------
507 + Reference< XPropertySetInfo > BasicScriptImpl::getPropertySetInfo( ) throw (RuntimeException)
509 + Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
510 + return xInfo;
513 + // -----------------------------------------------------------------------------
514 // XScript
515 // -----------------------------------------------------------------------------
517 @@ -194,8 +250,14 @@ namespace basprov
518 if ( m_documentBasicManager && m_xDocumentScriptContext.is() )
519 aOldThisComponent = m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( m_xDocumentScriptContext ) );
521 + if ( m_caller.getLength() && m_caller[ 0 ].hasValue() )
523 + SbxVariableRef xCallerVar = new SbxVariable( SbxVARIANT );
524 + unoToSbxValue( static_cast< SbxVariable* >( xCallerVar ), m_caller[ 0 ] );
525 + nErr = m_xMethod->Call( xReturn, xCallerVar );
527 + else
528 nErr = m_xMethod->Call( xReturn );
530 if ( m_documentBasicManager && m_xDocumentScriptContext.is() )
531 m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent );