ooo-build r11248 - in trunk: . patches/src680 patches/vba



Author: noelpwer
Date: Fri Jan 11 16:33:50 2008
New Revision: 11248
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11248&view=rev

Log:
2008-01-11  Noel Power  <noel power novell com>

        * patches/src680/apply: limited fix for n#339941
        * patches/vba/api-application-caller.diff:
        * patches/vba/basic-caller-support.diff:



Added:
   trunk/patches/vba/api-application-caller.diff
   trunk/patches/vba/basic-caller-support.diff
Modified:
   trunk/ChangeLog
   trunk/patches/src680/apply

Modified: trunk/patches/src680/apply
==============================================================================
--- trunk/patches/src680/apply	(original)
+++ trunk/patches/src680/apply	Fri Jan 11 16:33:50 2008
@@ -1279,6 +1279,12 @@
 # Fomat function enhancement for VBA 
 vba-format-function.diff, n#294187, Fong
 
+# Application.Caller
+api-application-caller.diff, noelpwer
+# add support for passing a caller to basic when calling a script
+# via the scripting framework - note depends on vbaevents-services-sources.diff
+basic-caller-support.diff
+
 # fix --disable-vba build
 oovbaapi-disable-vba.diff
 

Added: trunk/patches/vba/api-application-caller.diff
==============================================================================
--- (empty file)
+++ trunk/patches/vba/api-application-caller.diff	Fri Jan 11 16:33:50 2008
@@ -0,0 +1,58 @@
+--- /data4/Latest/ooo-build/build/ooh680-m1/oovbaapi/org/openoffice/excel/XApplication.idl	2007-12-07 11:21:12.000000000 +0000
++++ oovbaapi/org/openoffice/excel/XApplication.idl	2008-01-11 12:10:02.000000000 +0000
+@@ -103,6 +103,7 @@ interface XApplication
+         raises(com::sun::star::script::BasicErrorException);
+ 	void Volatile([in] any Volatile);
+ 	void DoEvents();
++	any Caller( [in] any aIndex );
+ };
+ 
+ }; }; };
+--- /data4/Latest/ooo-build/build/ooh680-m1/sc/source/ui/vba/vbaapplication.hxx	2007-12-07 10:43:17.000000000 +0000
++++ sc/source/ui/vba/vbaapplication.hxx	2008-01-11 12:14:50.000000000 +0000
+@@ -105,6 +105,7 @@ public:
+ 	virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Intersect( const css::uno::Reference< oo::excel::XRange >& Arg1, const css::uno::Reference< oo::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorEx
 ception, css::uno::RuntimeException);
+ 	virtual void SAL_CALL Volatile( const css::uno::Any& Volatile ) throw (css::uno::RuntimeException );
+ 	virtual void SAL_CALL DoEvents() throw (css::uno::RuntimeException);
++	virtual css::uno::Any SAL_CALL Caller( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ 	// XHelperInterface
+ 	virtual rtl::OUString& getServiceImplName();
+ 	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+--- /data4/Latest/ooo-build/build/ooh680-m1/sc/source/ui/vba/vbaapplication.cxx	2007-12-07 10:43:04.000000000 +0000
++++ sc/source/ui/vba/vbaapplication.cxx	2008-01-11 12:34:20.000000000 +0000
+@@ -95,6 +95,8 @@ using namespace ::com::sun::star;
+ 
+ #define EXCELVERSION "11.0"
+ 
++uno::Any sbxToUnoValue( SbxVariable* pVar );
++
+ class ActiveWorkbook : public ScVbaWorkbook
+ {
+ protected:
+@@ -904,6 +906,26 @@ ScVbaApplication::setDisplayFormulaBar( 
+ 	}	
+ }
+ 
++
++uno::Any SAL_CALL 
++ScVbaApplication::Caller( const uno::Any& /*aIndex*/ ) throw ( uno::RuntimeException )
++{
++	StarBASIC* pBasic = SFX_APP()->GetBasic();
++	SFX_APP()->EnterBasicCall();
++	SbMethod* pMeth = (SbMethod*)pBasic->GetRtl()->Find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FuncCaller") ), SbxCLASS_METHOD );
++	uno::Any aRet;	
++	if ( pMeth )
++	{
++		SbxVariableRef refTemp = pMeth;
++		// forces a broadcast
++		SbxVariableRef pNew = new  SbxMethod( *((SbxMethod*)pMeth));
++                OSL_TRACE("pNew has type %d and string value %s", pNew->GetType(), rtl::OUStringToOString( pNew->GetString(), RTL_TEXTENCODING_UTF8 ).getStr() );
++		aRet = sbxToUnoValue( pNew );
++	}
++	SFX_APP()->LeaveBasicCall();
++	return aRet;
++}
++
+ rtl::OUString& 
+ ScVbaApplication::getServiceImplName()
+ {

Added: trunk/patches/vba/basic-caller-support.diff
==============================================================================
--- (empty file)
+++ trunk/patches/vba/basic-caller-support.diff	Fri Jan 11 16:33:50 2008
@@ -0,0 +1,496 @@
+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
+@@ -61,6 +61,9 @@
+ #ifndef _COM_SUN_STAR_SCRIPT_PROVIDER_SCRIPTFRAMEWORKERRORTYPE_HPP_
+ #include <com/sun/star/script/provider/ScriptFrameworkErrorType.hpp>
+ #endif
++#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
++#include <com/sun/star/beans/PropertyAttribute.hpp>
++#endif
+ #include <map>
+ 
+ 
+@@ -68,7 +71,7 @@ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::script;
+-
++using namespace ::com::sun::star::beans;
+ 
+ extern ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
+ extern void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue );
+@@ -78,6 +81,10 @@ extern void unoToSbxValue( SbxVariable* 
+ namespace basprov
+ {
+ //.........................................................................
++#define BASSCRIPT_PROPERTY_ID_CALLER         1
++#define BASSCRIPT_PROPERTY_CALLER            ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Caller" ) )
++
++#define BASSCRIPT_DEFAULT_ATTRIBS()       PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT
+ 
+     typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap;
+ 
+@@ -86,8 +93,10 @@ namespace basprov
+     // =============================================================================
+ 
+     BasicScriptImpl::BasicScriptImpl( const ::rtl::OUString& funcName, SbMethodRef xMethod )
+-        :m_xMethod( xMethod ), m_funcName( funcName )
++        : ::scripting_helper::OBroadcastHelperHolder( m_aMutex )
++        ,OPropertyContainer( GetBroadcastHelper() ), m_xMethod( xMethod ), m_funcName( funcName )
+     {
++        registerProperty( BASSCRIPT_PROPERTY_CALLER, BASSCRIPT_PROPERTY_ID_CALLER, BASSCRIPT_DEFAULT_ATTRIBS(), &m_caller, ::getCppuType( &m_caller ) );
+     }
+ 
+     // -----------------------------------------------------------------------------
+@@ -97,6 +106,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
+     // -----------------------------------------------------------------------------
+ 
+@@ -168,7 +219,15 @@ namespace basprov
+ 
+             // call method
+             SbxVariableRef xReturn = new SbxVariable;
+-            ErrCode nErr = m_xMethod->Call( xReturn );
++            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 ( nErr != SbxERR_OK )
+             {
+                 // TODO: throw InvocationTargetException ?
+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
+@@ -35,14 +35,21 @@
+ 
+ #ifndef SCRIPTING_BASSCRIPT_HXX
+ #define SCRIPTING_BASSCRIPT_HXX
+-
++#ifndef SCRIPTING_BCHOLDER_HXX
++#include "bcholder.hxx"
++#endif
+ #ifndef _COM_SUN_STAR_SCRIPT_PROVIDER_XSCRIPT_HPP_
+ #include <com/sun/star/script/provider/XScript.hpp>
+ #endif
+ #ifndef _CPPUHELPER_IMPLBASE1_HXX_
+ #include <cppuhelper/implbase1.hxx>
+ #endif
+-
++#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
++#include <comphelper/proparrhlp.hxx>
++#endif
++#ifndef _COMPHELPER_PROPERTYCONTAINER_HXX_
++#include <comphelper/propertycontainer.hxx>
++#endif
+ #ifndef _SB_SBMETH_HXX
+ #include <basic/sbmeth.hxx>
+ #endif
+@@ -61,15 +68,35 @@ 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;
+         ::rtl::OUString m_funcName;
++        // 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( const ::rtl::OUString& funcName, SbMethodRef xMethod );
+         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,
+@@ -79,6 +106,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
+@@ -1316,7 +1316,7 @@ ErrCode SfxObjectShell::CallXScript( con
+         ::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 )
++            aOutParam, bool bRaiseError, ::com::sun::star::uno::Any* pCaller )
+ {
+     OSL_TRACE( "in CallXScript" );
+ 	ErrCode nErr = ERRCODE_NONE;
+@@ -1359,6 +1359,17 @@ ErrCode SfxObjectShell::CallXScript( con
+         }
+         OSL_TRACE( "CallXScript, got Script, about to invoke");
+         OSL_TRACE( "CallXScript, number of params is: %d", aParams.getLength() );
++        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 );
+         OSL_TRACE( "CallXScript, invoke is finished");
+     }
+--- /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]