ooo-build r12258 - in trunk: . patches/dev300 patches/vba



Author: noelpwer
Date: Mon Apr 21 16:05:57 2008
New Revision: 12258
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12258&view=rev

Log:
2008-04-21  Noel Power  <noel power novell com>

        * patches/dev300/apply: create and apply dev300 specific version of
        basic-caller-support.diff
        * patches/vba/basic-caller-support-dev300.diff:


Added:
   trunk/patches/vba/basic-caller-support-dev300.diff
Modified:
   trunk/ChangeLog
   trunk/patches/dev300/apply

Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply	(original)
+++ trunk/patches/dev300/apply	Mon Apr 21 16:05:57 2008
@@ -1427,7 +1427,7 @@
 
 # add support for passing a caller to basic when calling a script
 # via the scripting framework - note depends on vbaevents-services-sources.diff
-#FIXME dev300: basic-caller-support.diff
+basic-caller-support-dev300.diff
 
 # fix --disable-vba build
 oovbaapi-disable-vba.diff

Added: trunk/patches/vba/basic-caller-support-dev300.diff
==============================================================================
--- (empty file)
+++ trunk/patches/vba/basic-caller-support-dev300.diff	Mon Apr 21 16:05:57 2008
@@ -0,0 +1,470 @@
+diff -up /data4/Latest/ooo-build/build/ooh680-m1/scripting/source/basprov/basscript.cxx scripting/source/basprov/basscript.cxx
+--- /data4/Latest/ooo-build/build/ooh680-m1/scripting/source/basprov/basscript.cxx	2006-09-16 13:26:29.000000000 +0100
++++ scripting/source/basprov/basscript.cxx	2007-12-20 13:23:23.000000000 +0000
+@@ -92,11 +92,14 @@ namespace basprov
+     // -----------------------------------------------------------------------------
+ 
+     BasicScriptImpl::BasicScriptImpl( const ::rtl::OUString& funcName, SbMethodRef xMethod )
+-        :m_xMethod( xMethod )
++        : ::scripting_helper::OBroadcastHelperHolder( m_aMutex )
++        ,OPropertyContainer( GetBroadcastHelper() ),
++        ,m_xMethod( xMethod )
+         ,m_funcName( funcName )
+         ,m_documentBasicManager( NULL )
+         ,m_xDocumentScriptContext()
+     {
++        registerProperty( BASSCRIPT_PROPERTY_CALLER, BASSCRIPT_PROPERTY_ID_CALLER, BASSCRIPT_DEFAULT_ATTRIBS(), &m_caller, ::getCppuType( &m_caller ) );
+     }
+ 
+     // -----------------------------------------------------------------------------
+@@ -116,6 +119,48 @@ namespace basprov
+     }
+ 
+     // -----------------------------------------------------------------------------
++    // XInterface
++    // -----------------------------------------------------------------------------
++
++    IMPLEMENT_FORWARD_XINTERFACE2( BasicScriptImpl, BasicScriptImpl_BASE, OPropertyContainer )
++
++    // -----------------------------------------------------------------------------
++    // XTypeProvider
++    // -----------------------------------------------------------------------------
++
++    IMPLEMENT_FORWARD_XTYPEPROVIDER2( BasicScriptImpl, BasicScriptImpl_BASE, OPropertyContainer )
++
++    // -----------------------------------------------------------------------------
++    // OPropertySetHelper
++    // -----------------------------------------------------------------------------
++
++    ::cppu::IPropertyArrayHelper& BasicScriptImpl::getInfoHelper(  )
++    {
++        return *getArrayHelper();
++    }
++
++    // -----------------------------------------------------------------------------
++    // OPropertyArrayUsageHelper
++    // -----------------------------------------------------------------------------
++
++    ::cppu::IPropertyArrayHelper* BasicScriptImpl::createArrayHelper(  ) const
++    {
++        Sequence< Property > aProps;
++        describeProperties( aProps );
++        return new ::cppu::OPropertyArrayHelper( aProps );
++    }
++
++    // -----------------------------------------------------------------------------
++    // XPropertySet
++    // -----------------------------------------------------------------------------
++
++    Reference< XPropertySetInfo > BasicScriptImpl::getPropertySetInfo(  ) throw (RuntimeException)
++    {
++        Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
++        return xInfo;
++    }
++
++    // -----------------------------------------------------------------------------
+     // XScript
+     // -----------------------------------------------------------------------------
+ 
+@@ -194,8 +239,15 @@ namespace basprov
+                 if ( m_documentBasicManager && m_xDocumentScriptContext.is() )
+                     aOldThisComponent = m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( m_xDocumentScriptContext ) );
+ 
++            ErrCode nErr = SbxERR_OK;
++            if ( m_caller.getLength() && m_caller[ 0 ].hasValue()  )
++            {
++                SbxVariableRef xCallerVar = new SbxVariable( SbxVARIANT );
++                unoToSbxValue( static_cast< SbxVariable* >( xCallerVar ), m_caller[ 0 ] );
++                nErr = m_xMethod->Call( xReturn, xCallerVar );
++            }
++            else
+                 nErr = m_xMethod->Call( xReturn );
+-
+                 if ( m_documentBasicManager && m_xDocumentScriptContext.is() )
+                     m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent );
+             }
+diff -up /data4/Latest/ooo-build/build/ooh680-m1/scripting/source/basprov/basscript.hxx scripting/source/basprov/basscript.hxx
+--- /data4/Latest/ooo-build/build/ooh680-m1/scripting/source/basprov/basscript.hxx	2005-09-09 03:24:12.000000000 +0100
++++ scripting/source/basprov/basscript.hxx	2007-12-19 17:19:58.000000000 +0000
+@@ -36,6 +36,7 @@
+ #ifndef SCRIPTING_BASSCRIPT_HXX
+ #define SCRIPTING_BASSCRIPT_HXX
+ 
++#include "bcholder.hxx"
+ #ifndef _COM_SUN_STAR_SCRIPT_PROVIDER_XSCRIPT_HPP_
+ #include <com/sun/star/script/provider/XScript.hpp>
+ #endif
+@@ -45,7 +46,8 @@
+ #ifndef _CPPUHELPER_IMPLBASE1_HXX_
+ #include <cppuhelper/implbase1.hxx>
+ #endif
+-
++#include <comphelper/proparrhlp.hxx>
++#include <comphelper/propertycontainer.hxx>
+ #ifndef _SB_SBMETH_HXX
+ #include <basic/sbmeth.hxx>
+ #endif
+@@ -66,7 +68,11 @@ namespace basprov
+         ::com::sun::star::script::provider::XScript > BasicScriptImpl_BASE;
+ 
+ 
+-    class BasicScriptImpl : public BasicScriptImpl_BASE
++    class BasicScriptImpl : public BasicScriptImpl_BASE,
++                                public ::scripting_helper::OMutexHolder,
++                                public ::scripting_helper::OBroadcastHelperHolder,
++                                public ::comphelper::OPropertyContainer,
++                                public ::comphelper::OPropertyArrayUsageHelper< BasicScriptImpl >
+     {
+     private:
+         SbMethodRef         m_xMethod;
+@@ -74,6 +80,16 @@ namespace basprov
+         BasicManager*       m_documentBasicManager;
+         ::com::sun::star::uno::Reference< ::com::sun::star::document::XScriptInvocationContext >
+                             m_xDocumentScriptContext;
++        // hack, OPropertyContainer doesn't allow you to define a property of unknown
++        // type ( I guess because an Any can't contain an Any... I've always wondered why?
++	// as its not unusual to do that in corba )
++        ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_caller;
++    protected:
++        // OPropertySetHelper
++        virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(  );
++
++        // OPropertyArrayUsageHelper
++        virtual ::cppu::IPropertyArrayHelper* createArrayHelper(  ) const;
+ 
+     public:
+         BasicScriptImpl(
+@@ -88,6 +104,12 @@ namespace basprov
+         );
+         virtual ~BasicScriptImpl();
+ 
++        // XInterface
++        DECLARE_XINTERFACE()
++
++        // XTypeProvider
++        DECLARE_XTYPEPROVIDER()
++
+         // XScript
+         virtual ::com::sun::star::uno::Any SAL_CALL invoke(
+             const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
+@@ -97,6 +119,9 @@ namespace basprov
+                     ::com::sun::star::script::provider::ScriptFrameworkErrorException, 
+                     ::com::sun::star::reflection::InvocationTargetException,
+                     ::com::sun::star::uno::RuntimeException );               
++        // XPropertySet
++        virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) 
++            throw (::com::sun::star::uno::RuntimeException);
+     };
+ 
+ //.........................................................................
+--- /data4/Latest/ooo-build/build/ooh680-m1/basic/inc/basic/sbmeth.hxx	2008-01-08 09:36:28.000000000 +0000
++++ basic/inc/basic/sbmeth.hxx	2007-12-20 09:38:21.000000000 +0000
+@@ -58,6 +58,7 @@ class SbMethod : public SbxMethod
+ 	friend class SbIfaceMapperMethod;
+ 
+ 	SbMethodImpl* mpSbMethodImpl;			// Impl data
++	SbxVariable* mCaller;			// caller
+ 	SbxArrayRef refStatics;
+ 	SbModule* pMod;
+ 	USHORT    nDebugFlags;
+@@ -84,7 +85,7 @@ public:
+ 	void 	  GetLineRange( USHORT&, USHORT& );
+ 
+ 	// Schnittstelle zum Ausfuehren einer Methode aus den Applikationen
+-	virtual ErrCode Call( SbxValue* pRet = NULL );
++	virtual ErrCode Call( SbxValue* pRet = NULL, SbxVariable* pCaller = NULL );
+ 	virtual void Broadcast( ULONG nHintId );
+ };
+ 
+--- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/classes/sbxmod.cxx	2008-01-08 09:36:28.000000000 +0000
++++ basic/source/classes/sbxmod.cxx	2007-12-20 11:22:38.000000000 +0000
+@@ -1950,6 +1950,7 @@ SbMethod::SbMethod( const String& r, Sbx
+ 	nDebugFlags  =
+ 	nLine1		 =
+ 	nLine2		 = 0;
++        mCaller          = 0;
+ 	// AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden'
+ 	SetFlag( SBX_NO_MODIFY );
+ }
+@@ -1963,6 +1964,7 @@ SbMethod::SbMethod( const SbMethod& r )
+ 	nDebugFlags  = r.nDebugFlags;
+ 	nLine1		 = r.nLine1;
+ 	nLine2		 = r.nLine2;
++	mCaller          = r.mCaller; 
+ 	SetFlag( SBX_NO_MODIFY );
+ }
+ 
+@@ -2034,8 +2036,13 @@ SbxInfo* SbMethod::GetInfo()
+ // Schnittstelle zum Ausfuehren einer Methode aus den Applikationen
+ // #34191# Mit speziellem RefCounting, damit das Basic nicht durch CloseDocument()
+ // abgeschossen werden kann. Rueckgabewert wird als String geliefert.
+-ErrCode SbMethod::Call( SbxValue* pRet )
++ErrCode SbMethod::Call( SbxValue* pRet, SbxVariable* pCaller )
+ {
++	if ( pCaller )
++	{
++ 		OSL_TRACE("SbMethod::Call Have been passed a caller 0x%x", pCaller );
++		mCaller = pCaller;
++	}
+ 	// RefCount vom Modul hochzaehlen
+ 	SbModule* pMod_ = (SbModule*)GetParent();
+ 	pMod_->AddRef();
+@@ -2063,7 +2070,7 @@ ErrCode SbMethod::Call( SbxValue* pRet )
+ 	// Objekte freigeben
+ 	pMod_->ReleaseRef();
+ 	pBasic->ReleaseRef();
+-
++	mCaller = 0;
+ 	return nErr;
+ }
+ 
+--- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/runtime/runtime.cxx	2008-01-08 09:36:28.000000000 +0000
++++ basic/source/runtime/runtime.cxx	2007-12-20 11:23:14.000000000 +0000
+@@ -509,7 +509,7 @@ SbxArray* SbiInstance::GetLocals( SbMeth
+ 
+ SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart )
+ 		 : rBasic( *(StarBASIC*)pm->pParent ), pInst( pINST ), 
+-		   pMod( pm ), pMeth( pe ), pRealMeth(0), pImg( pMod->pImage ), m_nLastTime(0)
++		   pMod( pm ), pMeth( pe ), pRealMeth(0), pImg( pMod->pImage ), mpExtCaller(0), m_nLastTime(0)
+ {
+ 	nFlags	  = pe ? pe->GetDebugFlags() : 0;
+ 	pIosys	  = pInst->pIosys;
+@@ -570,6 +570,18 @@ SbiRuntime::~SbiRuntime()
+ 	}
+ }
+ 
++void SbiRuntime::SetVBAEnabled(bool bEnabled )
++{
++	bVBAEnabled = bEnabled; 
++	if ( bVBAEnabled )
++	{
++		if ( pMeth )
++			mpExtCaller = pMeth->mCaller;
++	}
++	else
++		mpExtCaller = 0;
++}
++
+ // Aufbau der Parameterliste. Alle ByRef-Parameter werden direkt
+ // uebernommen; von ByVal-Parametern werden Kopien angelegt. Falls
+ // ein bestimmter Datentyp verlangt wird, wird konvertiert.
+--- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/inc/runtime.hxx	2008-01-08 09:36:28.000000000 +0000
++++ basic/source/inc/runtime.hxx	2007-12-20 11:21:36.000000000 +0000
+@@ -338,6 +338,7 @@ class SbiRuntime
+ 	SbxArrayRef   refCaseStk;       // CASE expression stack
+ 	SbxArrayRef   refRedimpArray;   // Array saved to use for REDIM PRESERVE
+ 	SbxVariableRef xDummyVar;		// Ersatz fuer nicht gefundene Variablen
++	SbxVariable* mpExtCaller;		// Caller ( external - e.g. button name, shape, range object etc. - only in vba mode )
+ 	SbiArgvStack*  pArgvStk;		// ARGV-Stack
+ 	SbiGosubStack* pGosubStk;		// GOSUB stack
+ 	SbiForStack*   pForStk;			// FOR/NEXT-Stack
+@@ -479,7 +480,7 @@ class SbiRuntime
+ 	void StepFIND_CM( UINT32, UINT32 );
+ 	void StepFIND_STATIC( UINT32, UINT32 );
+ public:
+-	void          SetVBAEnabled( bool bEnabled ) { bVBAEnabled = bEnabled; };            
++	void          SetVBAEnabled( bool bEnabled );           
+ 	USHORT		GetImageFlag( USHORT n ) const;
+ 	USHORT		GetBase();
+ 	xub_StrLen  nLine,nCol1,nCol2;	// aktuelle Zeile, Spaltenbereich
+@@ -502,6 +503,7 @@ public:
+ 	SbMethod* GetCaller();
+ 	SbxArray* GetLocals();
+ 	SbxArray* GetParams();
++	SbxVariable* GetExternalCaller(){ return mpExtCaller; }
+ 
+ 	SbxBase* FindElementExtern( const String& rName );
+ 	static bool isVBAEnabled();
+--- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/runtime/methods.cxx	2008-01-08 09:36:28.000000000 +0000
++++ basic/source/runtime/methods.cxx	2007-12-19 16:44:56.000000000 +0000
+@@ -948,6 +948,26 @@ RTLFUNC(Hex)
+ 	}
+ }
+ 
++RTLFUNC(FuncCaller)
++{
++    (void)pBasic;
++    (void)bWrite;
++    if ( SbiRuntime::isVBAEnabled() &&  pINST && pINST->pRun )
++    {
++        if ( pINST->pRun->GetExternalCaller() )
++            *rPar.Get(0) =  *pINST->pRun->GetExternalCaller();
++        else
++        {
++            SbxVariableRef pVar = new SbxVariable(SbxVARIANT);
++            *rPar.Get(0) = *pVar;
++        }
++    }
++    else
++    {
++        StarBASIC::Error( SbERR_NOT_IMPLEMENTED );
++    }
++
++}
+ // InStr( [start],string,string,[compare] )
+ 
+ RTLFUNC(InStr)
+
+--- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/runtime/stdobj.cxx	2008-01-08 09:36:28.000000000 +0000
++++ basic/source/runtime/stdobj.cxx	2007-12-19 16:26:50.000000000 +0000
+@@ -608,6 +608,7 @@ static Methods aMethods[] = {
+ 
+ { "Wait",        	SbxNULL,      1 | _FUNCTION, RTLNAME(Wait),0            },
+   { "Milliseconds", SbxLONG, 0,NULL,0 },
++{ "FuncCaller",          SbxVARIANT,      _FUNCTION, RTLNAME(FuncCaller),0      },
+ //#i64882#
+ { "WaitUntil",          SbxNULL,      1 | _FUNCTION, RTLNAME(WaitUntil),0      },
+   { "Date", SbxDOUBLE, 0,NULL,0 },
+--- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/runtime/rtlproto.hxx	2008-01-08 09:36:28.000000000 +0000
++++ basic/source/runtime/rtlproto.hxx	2007-12-19 16:38:09.000000000 +0000
+@@ -303,6 +303,7 @@ extern RTLFUNC(Switch);
+ extern RTLFUNC(Wait);
+ //i#64882# add new WaitUntil
+ extern RTLFUNC(WaitUntil);
++extern RTLFUNC(FuncCaller);
+ 
+ extern RTLFUNC(GetGUIVersion);
+ extern RTLFUNC(Choose);
+--- /data4/Latest/ooo-build/build/ooh680-m1/sfx2/inc/sfx2/objsh.hxx	2008-01-08 09:36:27.000000000 +0000
++++ sfx2/inc/sfx2/objsh.hxx	2008-01-10 11:25:23.000000000 +0000
+@@ -426,7 +426,8 @@ public:
+         ::com::sun::star::uno::Any& aRet,
+         ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
+         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
+-        bool bRaiseError = true
++        bool bRaiseError = true,
++        ::com::sun::star::uno::Any* aCaller = 0 
+     );
+ 
+     /** adjusts the internal macro mode, according to the current security settings
+--- /data4/Latest/ooo-build/build/ooh680-m1/sfx2/source/doc/objmisc.cxx	2008-01-08 09:36:27.000000000 +0000
++++ sfx2/source/doc/objmisc.cxx	2008-01-10 15:12:14.000000000 +0000
+@@ -1515,7 +1515,7 @@ namespace
+ }
+ 
+ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const ::rtl::OUString& _rScriptURL,
+-    const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError )
++    const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError, ::com::sun::star::uno::Any* pCaller )
+ {
+     OSL_TRACE( "in CallXScript" );
+ 	ErrCode nErr = ERRCODE_NONE;
+@@ -1546,7 +1546,16 @@ ErrCode SfxObjectShell::CallXScript( con
+ 
+         // obtain the script, and execute it
+         Reference< provider::XScript > xScript( xScriptProvider->getScript( _rScriptURL ), UNO_QUERY_THROW );
+-
++        if ( pCaller && pCaller->hasValue() )
++        {
++            Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY ); 
++            if ( xProps.is() )
++            {
++                Sequence< uno::Any > aArgs( 1 );
++                aArgs[ 0 ] = *pCaller;
++                xProps->setPropertyValue( rtl::OUString::createFromAscii("Caller"), uno::makeAny( aArgs ) );
++            }
++        }
+         aRet = xScript->invoke( aParams, aOutParamIndex, aOutParam );
+     }
+     catch ( const uno::Exception& )
+--- /data4/Latest/ooo-build/build/ooh680-m1/sc/source/ui/drawfunc/fusel.cxx	2008-01-08 09:36:20.000000000 +0000
++++ sc/source/ui/drawfunc/fusel.cxx	2008-01-10 15:25:12.000000000 +0000
+@@ -221,13 +221,23 @@ BOOL __EXPORT FuSelection::MouseButtonDo
+                        SfxObjectShell* pObjSh = SfxObjectShell::Current();
+                        if ( pObjSh && SfxApplication::IsXScriptURL( pInfo->GetMacro() ) )
+                        {
++                           uno::Reference< beans::XPropertySet > xProps( pObj->getUnoShape(), uno::UNO_QUERY );
++                           uno::Any aCaller;
++                           if ( xProps.is() )
++                           {
++                               try
++                               {
++                                   aCaller = xProps->getPropertyValue( rtl::OUString::createFromAscii("Name") );
++                               }
++                               catch( uno::Exception& ) {}
++                           }
+                            uno::Any aRet;
+                            uno::Sequence< sal_Int16 > aOutArgsIndex;
+                            uno::Sequence< uno::Any > aOutArgs;
+                            uno::Sequence< uno::Any >* pInArgs =
+                                new uno::Sequence< uno::Any >(0);
+                            pObjSh->CallXScript( pInfo->GetMacro(),
+-                               *pInArgs, aRet, aOutArgsIndex, aOutArgs);
++                               *pInArgs, aRet, aOutArgsIndex, aOutArgs, true, &aCaller );
+                            pViewShell->FakeButtonUp( pViewShell->GetViewData()->GetActivePart() );
+                            return TRUE;        // kein CaptureMouse etc.
+                        }
+--- /data4/Latest/ooo-build/build/ooh680-m1/sc/source/ui/drawfunc/makefile.mk	2005-09-08 22:00:04.000000000 +0100
++++ sc/source/ui/drawfunc/makefile.mk	2008-01-10 15:19:30.000000000 +0000
+@@ -90,6 +90,7 @@ SLOFILES =  \
+         $(SLO)$/mediash.obj
+ 
+ EXCEPTIONSFILES= \
++        $(SLO)$/fusel.obj \
+         $(SLO)$/fuins2.obj
+ 
+ NOOPTFILES=\
+--- /data4/Latest/ooo-build/build/ooh680-m1/svx/source/form/fmscriptingenv.cxx	2008-01-08 09:36:27.000000000 +0000
++++ svx/source/form/fmscriptingenv.cxx	2008-01-10 12:10:21.000000000 +0000
+@@ -59,6 +59,10 @@
+ #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
+ #include <com/sun/star/lang/DisposedException.hpp>
+ #endif
++
++#include <com/sun/star/lang/EventObject.hpp>
++#include <com/sun/star/awt/XControl.hpp>
++
+ /** === end UNO includes === **/
+ 
+ #ifndef TOOLS_DIAGNOSE_EX_H
+@@ -111,6 +115,9 @@ namespace svxform
+     using ::com::sun::star::uno::Exception;
+     using ::com::sun::star::uno::Sequence;
+     using ::com::sun::star::uno::XInterface;
++    using ::com::sun::star::lang::EventObject;
++    using ::com::sun::star::awt::XControl;
++    using ::com::sun::star::beans::XPropertySet;
+ 	/** === end UNO using === **/
+ 
+     class FormScriptingEnvironment;
+@@ -453,8 +460,19 @@ namespace svxform
+         {
+             Sequence< sal_Int16 > aOutArgsIndex;
+             Sequence< Any > aOutArgs;
+-
+-            m_rObjectShell.CallXScript( m_sScriptCode, _rArguments, _rSynchronousResult, aOutArgsIndex, aOutArgs );
++            EventObject aEvent;
++            Any aCaller;
++            if ( ( _rArguments.getLength() > 0 ) && ( _rArguments[ 0 ] >>= aEvent ) )
++            {
++                try
++                {
++                    Reference< XControl > xControl( aEvent.Source, UNO_QUERY_THROW );
++                    Reference< XPropertySet > xProps( xControl->getModel(), UNO_QUERY_THROW );
++                    aCaller = xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) );
++                }
++                catch( Exception& ) {}
++            }
++            m_rObjectShell.CallXScript( m_sScriptCode, _rArguments, _rSynchronousResult, aOutArgsIndex, aOutArgs, true, aCaller.hasValue() ? &aCaller : 0 );
+         }
+ 
+         //................................................................
+--- /data4/Latest/ooo-build/build/ooh680-m1/scripting/source/vbaevents/eventhelper.cxx	2008-01-08 09:36:27.000000000 +0000
++++ scripting/source/vbaevents/eventhelper.cxx	2008-01-10 14:39:12.000000000 +0000
+@@ -893,7 +900,16 @@ EventListener::firing_Impl(const ScriptE
+                     {
+                         uno::Reference< script::provider::XScript > xScript = xScriptProvider->getScript( url );
+                         if ( xScript.is() )
+-                           xScript->invoke( aArguments, aOutArgsIndex, aOutArgs );
++                        {
++                           uno::Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY );
++                           if ( xProps.is() )
++                           {
++                               Sequence< Any > aCallerHack(1);
++                               aCallerHack[ 0 ] = uno::makeAny( rtl::OUString::createFromAscii("Error") );
++                               xProps->setPropertyValue( rtl::OUString::createFromAscii( "Caller" ), uno::makeAny( aCallerHack ) );
++                           }
++                           xScript->invoke( aArguments, aOutArgsIndex, aOutArgs  );
++                        }
+                     }
+                     catch ( uno::Exception& e )
+                     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]