diff -rup /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
--- /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/core/data/drwlayer.cxx	2006-06-14 17:46:55.000000000 +0100
+++ sc/source/core/data/drwlayer.cxx	2006-06-19 10:54:51.000000000 +0100
@@ -1996,6 +1996,25 @@ ScIMapInfo* ScDrawLayer::GetIMapInfo( Sd
 	return NULL;
 }
 
+ScMacroInfo* ScDrawLayer::GetMacroInfo( SdrObject* pObj, BOOL bCreate )				// static
+{
+	USHORT nCount = pObj->GetUserDataCount();
+	for( USHORT i = 0; i < nCount; i++ )
+	{
+		SdrObjUserData* pData = pObj->GetUserData( i );
+		if( pData && pData->GetInventor() == SC_DRAWLAYER
+					&& pData->GetId() == SC_UD_MACRODATA )
+			return (ScMacroInfo*) pData;
+	}
+	if ( bCreate )
+	{
+		ScMacroInfo* pData = new ScMacroInfo;
+		pObj->InsertUserData( pData, 0 );
+		return pData;
+	}	
+	return NULL;
+}
+
 // static:
 IMapObject*	ScDrawLayer::GetHitIMapObject( SdrObject* pObj,
 										  const Point& rWinPoint, const Window& rCmpWnd )
diff -rup /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/core/data/userdat.cxx sc/source/core/data/userdat.cxx
--- /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/core/data/userdat.cxx	2006-06-14 17:46:55.000000000 +0100
+++ sc/source/core/data/userdat.cxx	2006-06-19 10:54:51.000000000 +0100
@@ -623,6 +623,8 @@ IMPL_LINK_INLINE_START( ScDrawObjFactory
 			pObjFactory->pNewData = new ScDrawObjData;
 		else if ( pObjFactory->nIdentifier == SC_UD_IMAPDATA )
 			pObjFactory->pNewData = new ScIMapInfo;
+		else if ( pObjFactory->nIdentifier == SC_UD_MACRODATA )
+			pObjFactory->pNewData = new ScMacroInfo;
 		else
 			DBG_ERROR("MakeUserData: falsche ID");
 	}
@@ -711,3 +713,17 @@ SdrObjUserData* __EXPORT ScIMapInfo::Clo
 {
 	return new ScIMapInfo( *this );
 }
+
+ScMacroInfo::ScMacroInfo() :
+	SdrObjUserData( SC_DRAWLAYER, SC_UD_MACRODATA, 0 )
+{
+}
+
+ScMacroInfo::~ScMacroInfo()
+{
+}
+
+SdrObjUserData* ScMacroInfo::Clone( SdrObject* pObj ) const
+{
+	return new ScMacroInfo( *this );
+}
diff -rup /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/filter/excel/xiescher.cxx sc/source/filter/excel/xiescher.cxx
--- /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/filter/excel/xiescher.cxx	2006-06-14 17:46:55.000000000 +0100
+++ sc/source/filter/excel/xiescher.cxx	2006-06-19 11:07:24.000000000 +0100
@@ -195,6 +195,9 @@
 #ifndef _SCH_MEMCHRT_HXX
 #include <sch/memchrt.hxx>
 #endif
+
+#include "xicontent.hxx"
+#include "userdat.hxx"
 
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
@@ -403,6 +404,13 @@ XclImpDrawObjRef XclImpDrawObjBase::Read
 
 void XclImpDrawObjBase::ReadSubRecord( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize )
 {
+    switch( nSubRecId )
+    {
+        case EXC_ID_OBJ_FTMACRO:
+            ReadMacro( rStrm );
+        break;
+    }
+
 }
 
 Rectangle XclImpDrawObjBase::ReadClientAnchor( SvStream& rEscherStrm, const DffRecordHeader& rHeader )
@@ -484,6 +492,38 @@ void XclImpDrawObjBase::DoProcessSdrObj(
     if( !IsPrintable() )
         GetTracer().TraceObjectNotPrintable();
 }
+void XclImpDrawObjBase::ReadMacro( XclImpStream& rStrm )
+{
+    maMacroName.Erase();
+    if( rStrm.GetRecLeft() > 6 )
+    {
+        // macro is stored in a tNameXR token containing a link to a defined name
+        sal_uInt16 nFmlaSize;
+        rStrm >> nFmlaSize;
+        rStrm.Ignore( 4 );
+        DBG_ASSERT( nFmlaSize == 7, "XclImpDrawObjBase::ReadMacro - unexpected formula size" );
+        if( nFmlaSize == 7 )
+        {
+            sal_uInt8 nTokenId;
+            sal_uInt16 nExtSheet, nExtName;
+            rStrm >> nTokenId >> nExtSheet >> nExtName;
+            DBG_ASSERT( nTokenId == XclTokenArrayHelper::GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ),
+                "XclImpDrawObjBase::ReadMacro - tNameXR token expected" );
+            if( nTokenId == XclTokenArrayHelper::GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ) )
+            {
+                maMacroName = GetLinkManager().GetMacroName( nExtSheet, nExtName );
+                // #i38718# missing module name - try to find the macro in the imported modules
+                if( maMacroName.Len() && (maMacroName.Search( '.' ) == STRING_NOTFOUND) )
+                    if( SfxObjectShell* pDocShell = GetDocShell() )
+                        if( StarBASIC* pBasic = pDocShell->GetBasic() )
+                            if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( maMacroName, SbxCLASS_METHOD ) ) )
+                                if( SbModule* pModule = pMethod->GetModule() )
+                                    maMacroName.Insert( '.', 0 ).Insert( pModule->GetName(), 0 );
+            }
+        }
+    }
+}
+
 
 // ----------------------------------------------------------------------------
 
@@ -644,9 +684,6 @@ void XclImpTbxControlObj::ReadSubRecord(
         case EXC_ID_OBJ_FTGBODATA:
             ReadGboData( rStrm );
         break;
-        case EXC_ID_OBJ_FTMACRO:
-            ReadMacro( rStrm );
-        break;
         default:
             XclImpDrawObjBase::ReadSubRecord( rStrm, nSubRecId, nSubRecSize );
     }
@@ -823,7 +860,7 @@ void XclImpTbxControlObj::WriteToPropert
 
 bool XclImpTbxControlObj::FillMacroDescriptor( ScriptEventDescriptor& rEvent ) const
 {
-    if( maMacroName.Len() )
+    if( GetMacroName().Len() )
     {
         // type of action is dependent on control type
         rEvent.ListenerType = XclTbxControlHelper::GetListenerType( GetObjType() );
@@ -832,7 +869,7 @@ bool XclImpTbxControlObj::FillMacroDescr
         {
             // set the macro name
             rEvent.ScriptType = XclTbxControlHelper::GetScriptType();
-            rEvent.ScriptCode = XclTbxControlHelper::GetScMacroName( maMacroName );
+            rEvent.ScriptCode = XclTbxControlHelper::GetScMacroName( GetMacroName() );
             return true;
         }
     }
@@ -914,38 +951,6 @@ void XclImpTbxControlObj::ReadGboData( X
     mbFlatBorder = ::get_flag( nStyle, EXC_OBJ_GBO_FLAT );
 }
 
-void XclImpTbxControlObj::ReadMacro( XclImpStream& rStrm )
-{
-    maMacroName.Erase();
-    if( rStrm.GetRecLeft() > 6 )
-    {
-        // macro is stored in a tNameXR token containing a link to a defined name
-        sal_uInt16 nFmlaSize;
-        rStrm >> nFmlaSize;
-        rStrm.Ignore( 4 );
-        DBG_ASSERT( nFmlaSize == 7, "XclImpTbxControlObj::ReadMacro - unexpected formula size" );
-        if( nFmlaSize == 7 )
-        {
-            sal_uInt8 nTokenId;
-            sal_uInt16 nExtSheet, nExtName;
-            rStrm >> nTokenId >> nExtSheet >> nExtName;
-            DBG_ASSERT( nTokenId == XclTokenArrayHelper::GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ),
-                "XclImpTbxControlObj::ReadMacro - tNameXR token expected" );
-            if( nTokenId == XclTokenArrayHelper::GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ) )
-            {
-                maMacroName = GetLinkManager().GetMacroName( nExtSheet, nExtName );
-                // #i38718# missing module name - try to find the macro in the imported modules
-                if( maMacroName.Len() && (maMacroName.Search( '.' ) == STRING_NOTFOUND) )
-                    if( SfxObjectShell* pDocShell = GetDocShell() )
-                        if( StarBASIC* pBasic = pDocShell->GetBasic() )
-                            if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( maMacroName, SbxCLASS_METHOD ) ) )
-                                if( SbModule* pModule = pMethod->GetModule() )
-                                    maMacroName.Insert( '.', 0 ).Insert( pModule->GetName(), 0 );
-            }
-        }
-    }
-}
-
 // ----------------------------------------------------------------------------
 
 XclImpOleObj::XclImpOleObj( const XclImpRoot& rRoot ) :
@@ -1381,7 +1386,8 @@ SdrObject* XclImpDffManager::ProcessObj(
 
     /*  Connect textbox data (string, alignment, text orientation) to object.
         #98132# don't ask for a text-ID, Escher export doesn't set one. */
-    if( XclImpDrawingObj* pDrawingObj = dynamic_cast< XclImpDrawingObj* >( xDrawObj.get() ) )
+    XclImpDrawingObj* pDrawingObj = dynamic_cast< XclImpDrawingObj* >( xDrawObj.get() );
+    if( pDrawingObj )
         pDrawingObj->SetTxoData( mrObjManager.FindTxoData( rObjData.rSpHd ) );
 
     // #118052# import internal name of a control
@@ -1391,6 +1397,21 @@ SdrObject* XclImpDffManager::ProcessObj(
         if( aName.Len() )
             pOleObj->SetControlName( aName );
     }
+    else
+    {
+        // its a drawing object or form control
+        if ( pDrawingObj && xSdrObj.get() )
+        {
+            if ( pDrawingObj->GetMacroName().Len() ) // has associated macro
+            {
+                ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( xSdrObj.get(), TRUE );
+		DBG_ASSERT( pInfo, "shape macro info could not be created!" );
+
+                if ( pInfo )
+                    pInfo->SetMacro( XclTbxControlHelper::GetScMacroName(pDrawingObj->GetMacroName() ) );
+            }
+        }
+    }
 
     // try to create a custom SdrObject that overwrites the passed object
     SdrObjectPtr xNewSdrObj( CreateCustomSdrObject( *xDrawObj, rAnchorRect ) );
diff -rup /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/filter/inc/xiescher.hxx sc/source/filter/inc/xiescher.hxx
--- /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/filter/inc/xiescher.hxx	2006-06-14 17:46:55.000000000 +0100
+++ sc/source/filter/inc/xiescher.hxx	2006-06-19 10:54:51.000000000 +0100
@@ -148,6 +148,8 @@ public:
     sal_uInt32          GetProgressSize() const;
     /** Additional processing for the passed SdrObject (calls virtual DoProcessSdrObj() function). */
     void                ProcessSdrObject( SdrObject& rSdrObj ) const;
+    /** Returns associated macro name ( if set ) otherwise returns zero length string. */
+    const String        GetMacroName() const { return maMacroName; }
 
 protected:
     /** Derived classes may return a progress bar size different from 1. */
@@ -158,8 +160,11 @@ protected:
     /** Creates an Escher anchor from the passed position (used for sheet charts). */
     void                CreateEscherAnchor( const Rectangle& rAnchorRect );
 
+    /** Reads the contents of the ftMacro sub structure in an OBJ record. */
+    void                ReadMacro( XclImpStream& rStrm );
 private:
     typedef ScfRef< XclEscherAnchor > XclEscherAnchorRef;
+    String              maMacroName;    /// Name of an attached macro.
 
     XclEscherAnchorRef  mxAnchor;       /// The position of the object in the containing sheet.
     XclObjId            maObjId;        /// Sheet index and object identifier.
@@ -278,12 +283,10 @@ private:
     void                ReadSbs( XclImpStream& rStrm );
     /** Reads the contents of the ftGboData sub structure in an OBJ record. */
     void                ReadGboData( XclImpStream& rStrm );
-    /** Reads the contents of the ftMacro sub structure in an OBJ record. */
-    void                ReadMacro( XclImpStream& rStrm );
+
 
 private:
     ScfInt16Vec         maMultiSel;     /// Indexes of all selected entries in a multi selection.
-    String              maMacroName;    /// Name of an attached macro.
     sal_uInt16          mnState;        /// Checked/unchecked state.
     sal_Int16           mnSelEntry;     /// Index of selected entry (1-based).
     sal_Int16           mnSelType;      /// Selection type.
@@ -471,6 +474,7 @@ protected:
 private:
     /** Reads a string property from the passed Escher stream. */
     String              ReadStringProperty( SvStream& rEscherStrm, sal_uInt32 nPropId ) const;
+    String      ReadHlinkProperty( SvStream& rEscherStrm ) const;
 
     /** Processes a drawing group container (global drawing data). */
     void                ProcessDggContainer( SvStream& rEscherStrm, const DffRecordHeader& rDggHeader );
diff -rup /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/drawfunc/fudraw.cxx sc/source/ui/drawfunc/fudraw.cxx
--- /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/drawfunc/fudraw.cxx	2006-06-14 17:46:55.000000000 +0100
+++ sc/source/ui/drawfunc/fudraw.cxx	2006-06-19 11:36:02.000000000 +0100
@@ -866,6 +866,17 @@ void FuDraw::ForcePointer(const MouseEve
 		SdrObject* pObj;
 		SdrPageView* pPV;
 
+		ScMacroInfo* pInfo = NULL;
+		if ( pView->PickObj(aPnt, pObj, pPV, SDRSEARCH_ALSOONMASTER) )
+		{
+			if ( pObj->IsGroupObject() )
+			{
+				SdrObject* pHit = NULL;
+				if ( pView->PickObj(aMDPos, pHit, pPV, SDRSEARCH_DEEP ) )
+					pObj = pHit;
+			}
+			pInfo = ScDrawLayer::GetMacroInfo( pObj );
+		}
 		if ( pView->IsTextEdit() )
 		{
 			pViewShell->SetActivePointer(Pointer(POINTER_TEXT));		// kann nicht sein ?
@@ -891,6 +894,10 @@ void FuDraw::ForcePointer(const MouseEve
 			SdrObjMacroHitRec aHitRec;	//! muss da noch irgendwas gesetzt werden ????
 			pViewShell->SetActivePointer( pObj->GetMacroPointer(aHitRec) );
 		}
+		else  if ( !bAlt && pInfo && pInfo->GetMacro().getLength() )
+		{
+			pWindow->SetPointer( Pointer( POINTER_REFHAND ) );
+		}	
 		else if ( IsDetectiveHit( aPnt ) )
 			pViewShell->SetActivePointer( Pointer( POINTER_DETECTIVE ) );
 		else
diff -rup /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/drawfunc/fusel.cxx sc/source/ui/drawfunc/fusel.cxx
--- /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/drawfunc/fusel.cxx	2006-06-14 17:46:55.000000000 +0100
+++ sc/source/ui/drawfunc/fusel.cxx	2006-06-19 11:12:02.000000000 +0100
@@ -55,7 +55,7 @@
 #include <svx/svdpagv.hxx>
 #include <svx/outlobj.hxx>
 #include <svx/svdocapt.hxx>
-
+#include <sfx2/app.hxx>
 
 #ifndef _COM_SUN_STAR_EMBED_EMBEDSTATES_HPP_
 #include <com/sun/star/embed/EmbedStates.hpp>
@@ -70,6 +70,7 @@
 #include "drawpage.hxx"
 #include "globstr.hrc"
 #include "drwlayer.hxx"
+#include "userdat.hxx"
 
 // -----------------------------------------------------------------------
 
@@ -189,6 +190,53 @@ BOOL __EXPORT FuSelection::MouseButtonDo
 			}
 			else
 			{
+
+				if ( !bAlt && pView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_ALSOONMASTER))
+				{
+
+					// Support for imported Excel docs
+					// Excel is of course not consistent and allows
+					// a hyperlink to be assigned for an object group
+					// and even though the hyperlink is exported in the Escher layer
+					// its never used, when dealing with a group object the link
+					// associated with the clicked object is used only
+
+					// additionally you can also select a macro in Excel for a grouped
+					// objects and this results in the macro being set for the elements
+					// in the group and no macro is exported for the group
+
+					// if a macro and hlink are defined favour the hlink
+					
+					// If a group object has no hyperlink use the hyperlink of the 
+					// object clicked 
+
+					if ( pObj->IsGroupObject() )
+					{
+						SdrObject* pHit = NULL;
+						if ( pView->PickObj(aMDPos, pHit, pPV, SDRSEARCH_DEEP ) )
+							pObj = pHit;
+					}
+
+					ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj, TRUE );
+					if ( pInfo->GetMacro().getLength() )
+					{
+						SfxObjectShell* pObjSh = SfxObjectShell::Current();
+						if ( pObjSh && SfxApplication::IsXScriptURL( pInfo->GetMacro() ) )
+						{
+							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);
+							pViewShell->FakeButtonUp( pViewShell->GetViewData()->GetActivePart() );
+							return TRUE;		// kein CaptureMouse etc.
+	
+						}
+					}
+				}
+
 				//	URL / ImageMap
 
 				SdrViewEvent aVEvt;
diff -rup /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/unoobj/shapeuno.cxx sc/source/ui/unoobj/shapeuno.cxx
--- /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/unoobj/shapeuno.cxx	2006-06-14 17:46:55.000000000 +0100
+++ sc/source/ui/unoobj/shapeuno.cxx	2006-06-19 11:30:10.000000000 +0100
@@ -68,6 +68,8 @@
 #include <comphelper/stl_types.hxx>
 #endif
 
+#include <cppuhelper/implbase2.hxx>
+
 using namespace ::com::sun::star;
 
 //------------------------------------------------------------------------
@@ -143,6 +145,7 @@ uno::Any SAL_CALL ScShapeObj::queryInter
 	SC_QUERYINTERFACE( beans::XPropertyState )
 	SC_QUERYINTERFACE( text::XTextContent )
 	SC_QUERYINTERFACE( lang::XComponent )
+	SC_QUERYINTERFACE( document::XEventsSupplier )
 	if ( bIsTextShape )
 	{
 		//	#105585# for text shapes, XText (and parent interfaces) must
@@ -1337,3 +1340,120 @@ SdrObject* ScShapeObj::GetSdrObject() co
 	return NULL;
 }
 
+typedef ::cppu::WeakImplHelper1< container::XNameReplace > ShapeUnoEventAcess_BASE;
+const rtl::OUString sOnClick = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OnClick") );
+const rtl::OUString sStrScript = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Script") );
+const rtl::OUString sEventType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("EventType") );
+
+class ShapeUnoEventAccessImpl : public ShapeUnoEventAcess_BASE
+{
+
+	ScShapeObj* mpShape;	
+	bool isValidName( const rtl::OUString& aName )
+	{
+		return ( aName == sOnClick );
+	}
+	
+	ScMacroInfo* getInfo( BOOL bCreate = false )
+	{
+		ScMacroInfo* pInfo = NULL;
+		SdrObject* pObj = NULL;
+		if ( mpShape )
+		{
+			pObj = mpShape->GetSdrObject(); 
+			if ( pObj )
+				pInfo = ScDrawLayer::GetMacroInfo( pObj, bCreate );
+		}
+		return pInfo;
+	}
+
+public:
+	ShapeUnoEventAccessImpl( ScShapeObj* pShape ): mpShape( pShape )
+	{
+	}
+
+	// XNameReplace
+	virtual void SAL_CALL replaceByName( const rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+	{
+		if ( !hasByName( aName ) )
+			throw container::NoSuchElementException();
+		uno::Sequence< beans::PropertyValue > aProperties;
+		aElement >>= aProperties;
+		const beans::PropertyValue* pProperties = aProperties.getConstArray();
+		const sal_Int32 nCount = aProperties.getLength();
+		sal_Int32 nIndex;
+		bool isEventType = false;
+		for( nIndex = 0; nIndex < nCount; nIndex++, pProperties++ )
+		{			
+			if ( pProperties->Name.equals( sEventType ) )
+			{
+				isEventType = true;
+				continue;
+			}
+			if ( isEventType &&  pProperties->Name == sStrScript )
+			{
+				rtl::OUString sValue;
+				if ( ! ( pProperties->Value >>= sValue ) )
+					continue; 	
+				ScMacroInfo* pInfo = getInfo( TRUE );
+				DBG_ASSERT( pInfo, "shape macro info could not be created!" );
+				
+				if ( !pInfo )
+					break;	
+				pInfo->SetMacro( sValue );	
+			}	
+
+		}
+	}
+    
+	// XNameAccess
+	virtual uno::Any SAL_CALL getByName( const rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+	{
+		if ( !hasByName( aName ) )
+			throw container::NoSuchElementException();
+
+		ScMacroInfo* pInfo = getInfo();
+		uno::Sequence< beans::PropertyValue > aProperties;
+		if ( pInfo )
+		{
+			if ( pInfo->GetMacro().getLength() )
+			{
+				aProperties.realloc(2);
+				aProperties[ 0 ].Name = sEventType;
+				aProperties[ 0 ].Value <<= sStrScript;
+				aProperties[ 1 ].Name = sStrScript;
+				aProperties[ 1 ].Value <<= pInfo->GetMacro();	
+			}
+		}
+		return uno::makeAny( aProperties );
+	}
+	virtual uno::Sequence< rtl::OUString > SAL_CALL getElementNames(  ) throw(uno::RuntimeException)
+	{
+		uno::Sequence< rtl::OUString > aStr( &sOnClick, 1 );
+		return aStr;
+	}
+
+	virtual sal_Bool SAL_CALL hasByName( const rtl::OUString& aName ) throw(uno::RuntimeException)
+	{
+		return isValidName( aName );
+	}
+
+	// XElementAccess
+	virtual uno::Type SAL_CALL getElementType(  ) throw(uno::RuntimeException)
+	{
+		return *SEQTYPE(::getCppuType((const uno::Sequence< beans::PropertyValue >*)0));
+	}
+
+	virtual sal_Bool SAL_CALL hasElements(  ) throw(uno::RuntimeException)
+	{
+		return ( getInfo() != NULL );
+	}
+
+}; 
+
+::uno::Reference< container::XNameReplace > SAL_CALL 
+ScShapeObj::getEvents(  ) throw(uno::RuntimeException)
+{
+	return new ShapeUnoEventAccessImpl( this );
+}
+
diff -rup /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/inc/drwlayer.hxx sc/inc/drwlayer.hxx
--- /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/inc/drwlayer.hxx	2006-06-14 17:46:55.000000000 +0100
+++ sc/inc/drwlayer.hxx	2006-06-19 10:54:51.000000000 +0100
@@ -54,6 +54,7 @@ class SfxViewShell;
 class SfxObjectShell;
 class ScDrawObjData;
 class ScIMapInfo;
+class ScMacroInfo;
 class IMapObject;
 class ScMarkData;
 class SdrOle2Obj;
@@ -193,6 +194,9 @@ public:
 
 	// Image-Map
 	static ScIMapInfo* GetIMapInfo( SdrObject* pObj );
+
+	static ScMacroInfo* GetMacroInfo( SdrObject* pObj, BOOL bCreate=FALSE );
+
 	static IMapObject* GetHitIMapObject( SdrObject* pObject,
 							const Point& rWinPoint, const Window& rCmpWnd );
 
diff -rup /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/inc/shapeuno.hxx sc/inc/shapeuno.hxx
--- /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/inc/shapeuno.hxx	2006-06-14 17:46:55.000000000 +0100
+++ sc/inc/shapeuno.hxx	2006-06-19 10:54:51.000000000 +0100
@@ -56,6 +56,8 @@
 #include <com/sun/star/lang/XTypeProvider.hpp>
 #endif
 
+#include <com/sun/star/document/XEventsSupplier.hpp>
+
 #ifndef _CPPUHELPER_WEAK_HXX_ 
 #include <cppuhelper/weak.hxx>
 #endif
@@ -71,6 +73,7 @@ namespace com { namespace sun { namespac
 
 class SdrObject;
 struct SvEventDescription;
+class ShapeUnoEventAccessImpl;
 
 //------------------------------------------------------------------------
 
@@ -82,7 +85,8 @@ class ScShapeObj : public ::cppu::OWeakO
 					public ::com::sun::star::beans::XPropertyState,
 					public ::com::sun::star::text::XTextContent,
 					public ::com::sun::star::text::XText,
-					public ::com::sun::star::lang::XTypeProvider
+					public ::com::sun::star::lang::XTypeProvider,
+					public ::com::sun::star::document::XEventsSupplier
 {
 private:
 	::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > mxShapeAgg;
@@ -98,6 +102,8 @@ private:
     void                    GetShapePropertySet();
     void                    GetShapePropertyState();
 
+friend class ShapeUnoEventAccessImpl;
+
 public:
 	static const SvEventDescription* GetSupportedMacroItems();
 
@@ -236,6 +242,7 @@ public:
 								throw(::com::sun::star::uno::RuntimeException);
 	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
 								throw(::com::sun::star::uno::RuntimeException);
+	 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents(  ) throw(::com::sun::star::uno::RuntimeException);
 };
 
 #endif
diff -rup /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/inc/userdat.hxx sc/inc/userdat.hxx
--- /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/inc/userdat.hxx	2006-06-14 17:46:55.000000000 +0100
+++ sc/inc/userdat.hxx	2006-06-19 10:59:09.000000000 +0100
@@ -60,6 +60,7 @@
 // Object-Ids fuer UserData
 #define SC_UD_OBJDATA		1
 #define SC_UD_IMAPDATA		2
+#define SC_UD_MACRODATA		3
 
 //-------------------------------------------------------------------------
 
@@ -104,6 +105,18 @@ public:
 	const ImageMap&	GetImageMap() const				{ return aImageMap; }
 };
 
+class ScMacroInfo : public SdrObjUserData
+{
+	rtl::OUString sMacro;
+public:
+					ScMacroInfo();
+	virtual			~ScMacroInfo();
+
+	virtual	SdrObjUserData* Clone( SdrObject* pObj ) const;
+
+	void 	SetMacro( const rtl::OUString& rMacro )	{ sMacro = rMacro; }
+	const rtl::OUString&	GetMacro() const				{ return sMacro; }
+};
 
 #endif
 
diff -rup /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/inc/sc.hrc sc/inc/sc.hrc
--- /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/inc/sc.hrc	2006-06-23 15:46:21.000000000 +0100
+++ sc/inc/sc.hrc	2006-06-23 16:25:26.000000000 +0100
@@ -573,6 +573,7 @@
 
 // additional IDs for list/range validity
 #define FID_VALID_LISTTYPE              (SC_VIEW_START + 93)
+#define SID_ASSIGNMACRO			(SC_VIEW_START + 94)
 
 // Nachrichten -------------------------------------------------------------
 
@@ -1389,7 +1390,9 @@
 // Media shell
 #define SCSTR_MEDIASHELL		(STR_START + 401)
 
-#define STR_END                 (STR_START + 402)
+#define RID_SCSTR_ONCLICK	(STR_START + 402)
+
+#define STR_END                 RID_SCSTR_ONCLICK
 
 #define BMP_START				(STR_END)
 
diff -rup /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/sdi/drawsh.sdi sc/sdi/drawsh.sdi
--- /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/sdi/drawsh.sdi	2006-06-23 15:46:18.000000000 +0100
+++ sc/sdi/drawsh.sdi	2006-06-23 15:58:19.000000000 +0100
@@ -34,6 +34,9 @@
  ************************************************************************/
 interface TableDraw
 {
+	// support assign macro for shape objects
+	SID_ASSIGNMACRO	[ ExecMethod = ExecDrawAttr; StateMethod = NoState; Export = FALSE; ]
+
 	 //	Drawing geht von Basic aus gar nicht, darum alles mit Export = FALSE
 
 	FID_DEFINE_NAME				[ StateMethod = StateDisableItems; Export = FALSE; ]
diff -rup /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/sdi/scalc.sdi sc/sdi/scalc.sdi
--- /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/sdi/scalc.sdi	2006-06-23 15:46:20.000000000 +0100
+++ sc/sdi/scalc.sdi	2006-06-23 16:23:11.000000000 +0100
@@ -6846,6 +6846,32 @@ SfxVoidItem TextAttributes SID_DRAWTEXT_
 	GroupId = GID_DRAWING;
 ]
 
+
+//--------------------------------------------------------------------------
+SfxVoidItem AssignMacro SID_ASSIGNMACRO
+()
+[
+	/* flags: */
+	AutoUpdate = FALSE,
+	Cachable = Cachable,
+	FastCall = TRUE,
+	HasCoreId = FALSE,
+	HasDialog = TRUE,
+	ReadOnlyDoc = TRUE,
+	Toggle = FALSE,
+	Container = FALSE,
+	RecordAbsolute = FALSE,
+	RecordPerSet;
+	Synchron;
+
+	/* config: */
+	AccelConfig = TRUE,
+	MenuConfig = FALSE,
+	StatusBarConfig = FALSE,
+	ToolBoxConfig = FALSE,
+	GroupId = GID_DRAWING;
+]
+
 //--------------------------------------------------------------------------
 SfxVoidItem TextInSpalten SID_TEXT_TO_COLUMNS
 ()
diff -rup /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/drawfunc/drawsh.cxx sc/source/ui/drawfunc/drawsh.cxx
--- /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/drawfunc/drawsh.cxx	2006-06-23 15:46:18.000000000 +0100
+++ sc/source/ui/drawfunc/drawsh.cxx	2006-06-24 10:17:28.000000000 +0100
@@ -316,6 +316,13 @@
 #define ScDrawShell
 #include "scslots.hxx"
 
+#include "userdat.hxx"
+#define ITEMID_MACRO SID_ATTR_MACROITEM
+#include <sfx2/objsh.hxx>
+#include <sfx2/macropg.hxx>
+#include <svtools/macitem.hxx>
+#include <com/sun/star/util/XModifiable.hpp>
+
 //------------------------------------------------------------------
 
 TYPEINIT1( ScDrawShell, SfxShell );
@@ -344,6 +351,17 @@ void ScDrawShell::StateDisableItems( Sfx
 }
 
 
+void lcl_setModified( SfxObjectShell*  pShell )
+{
+	if ( pShell )
+	{
+		com::sun::star::uno::Reference< com::sun::star::util::XModifiable > xModif( pShell->GetModel(), com::sun::star::uno::UNO_QUERY );
+		if ( xModif.is() )
+			xModif->setModified( sal_True );
+	}
+
+}
+
 void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
 {
 	USHORT				nSlot		= rReq.GetSlot();
@@ -353,8 +371,22 @@ void ScDrawShell::ExecDrawAttr( SfxReque
 	ScDrawView* 		pView		= pViewData->GetScDrawView();
 	SdrModel*			pDoc		= pViewData->GetDocument()->GetDrawLayer();
 
+	const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+	ULONG nMarkCount = rMarkList.GetMarkCount();
+	SdrObject* pSingleSelectedObj = NULL;
+	if ( nMarkCount > 0 )
+		pSingleSelectedObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+	
+
 	switch ( nSlot )
 	{
+		case SID_ASSIGNMACRO:
+			{
+				if ( pSingleSelectedObj )
+					ExecuteMacroAssign( pSingleSelectedObj, pWin );
+				break;	
+			}
+
 		case SID_TEXT_STANDARD:	// Harte Textattributierung loeschen
 			{
 				SfxItemSet aEmptyAttr(GetPool(), EE_ITEMS_START, EE_ITEMS_END);
@@ -506,6 +544,57 @@ void ScDrawShell::ExecDrawAttr( SfxReque
 	}
 }
 
+void ScDrawShell::ExecuteMacroAssign( SdrObject* pObj, Window* pWin )
+{
+	SvxMacroItem aItem ( SFX_APP()->GetPool().GetWhich( SID_ATTR_MACROITEM ) );
+	ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj, TRUE );
+	if ( pInfo->GetMacro().getLength() )
+	{
+		SvxMacroTableDtor aTab;
+		String sMacro(  pInfo->GetMacro() );
+		aTab.Insert( SFX_EVENT_MOUSECLICK_OBJECT,  new SvxMacro( sMacro, String() ) );
+		aItem.SetMacroTable( aTab );
+	}
+	// create empty itemset for macro-dlg
+	SfxItemSet* pItemSet = new SfxItemSet(SFX_APP()->GetPool(), SID_ATTR_MACROITEM, SID_ATTR_MACROITEM );
+	pItemSet->Put ( aItem, SID_ATTR_MACROITEM );
+
+	SfxMacroAssignDlg aDlg( pWin, *pItemSet );	
+	SfxMacroTabPage *pMacroPage = (SfxMacroTabPage*) aDlg.GetTabPage();
+	pMacroPage->AddEvent( ScResId(RID_SCSTR_ONCLICK),
+		SFX_EVENT_MOUSECLICK_OBJECT);
+	
+				
+	if ( RET_OK == aDlg.Execute() )
+	{
+		const SfxItemSet* pOutSet = aDlg.GetOutputItemSet();
+		const SfxPoolItem* pItem;
+		if( SFX_ITEM_SET == pOutSet->GetItemState( SID_ATTR_MACROITEM, FALSE, &pItem ))
+		{
+			rtl::OUString sMacro;
+			SvxMacro* pMacro = ((SvxMacroItem*)pItem)->GetMacroTable().Get( SFX_EVENT_MOUSECLICK_OBJECT );
+			if ( pMacro )
+			{
+				if ( pObj->IsGroupObject() )
+				{
+					SdrObjList* pOL = pObj->GetSubList();
+					ULONG nObj = pOL->GetObjCount();
+					for ( ULONG index=0; index<nObj; ++index )
+					{
+						pInfo = ScDrawLayer::GetMacroInfo( pOL->GetObj(index), TRUE );
+						pInfo->SetMacro( pMacro->GetMacName() );
+					}	
+				}
+				else
+					pInfo->SetMacro( pMacro->GetMacName() );
+				lcl_setModified( GetObjectShell() );
+			}
+		}
+	}
+	
+	delete pItemSet;	
+}
+
 void ScDrawShell::ExecuteLineDlg( SfxRequest& rReq, USHORT nTabPage )
 {
 	ScDrawView*			pView		= pViewData->GetScDrawView();
diff -rup /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/drawfunc/objdraw.src sc/source/ui/drawfunc/objdraw.src
--- /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/drawfunc/objdraw.src	2006-06-23 15:46:18.000000000 +0100
+++ sc/source/ui/drawfunc/objdraw.src	2006-06-23 16:09:24.000000000 +0100
@@ -211,6 +211,18 @@
 		Text [ x-comment ] = " ";\
 	};
 
+#define MN_ASSIGNMACRO \
+    MenuItem\
+    {\
+        Identifier = SID_ASSIGNMACRO ; \
+        HelpID = SID_ASSIGNMACRO ; \
+        Text [ de ] = "Assig~n Macro..." ; \
+        Text [ en-US ] = "Assig~n Macro..." ; \
+        Text [ cs ] = "Přiřadit makro..." ; \
+	     Text [ sk ] = "Priradiť makro..."; \
+		Text [ x-comment ] = " ";\
+	};
+
 #define MN_ORIGINALSIZE \
     MenuItem\
     {\
@@ -1266,6 +1276,8 @@ Menu RID_POPUP_DRAW
 		MN_ARRANGESUB
 		MN_ALIGNSUB
 		MN_ANCHORSUB
+		MN_ASSIGNMACRO // Assig~n Macro...
+
 		 //------------------------------
 		MenuItem { Separator = TRUE ; };
 		 //------------------------------
@@ -1331,6 +1343,7 @@ Menu RID_POPUP_GRAPHIC
 		MN_ARRANGESUB
 		MN_ALIGNSUB
 		MN_ANCHORSUB
+		MN_ASSIGNMACRO // Assig~n Macro...
 		 //------------------------------
 		MenuItem { Separator = TRUE ; };
 		 //------------------------------
diff -rup /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/inc/drawsh.hxx sc/source/ui/inc/drawsh.hxx
--- /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/inc/drawsh.hxx	2006-06-23 15:46:18.000000000 +0100
+++ sc/source/ui/inc/drawsh.hxx	2006-06-24 10:16:40.000000000 +0100
@@ -91,6 +91,7 @@ public:
     void    ExecFormatPaintbrush(SfxRequest& rReq);
     void    StateFormatPaintbrush(SfxItemSet& rSet);
 
+	void	ExecuteMacroAssign( SdrObject* pObj, Window* pWin );
 	void	ExecuteLineDlg( SfxRequest& rReq, USHORT nTabPage = 0xffff );
 	void	ExecuteAreaDlg( SfxRequest& rReq, USHORT nTabPage = 0xffff );
 	void	ExecuteTextAttrDlg( SfxRequest& rReq, USHORT nTabPage = 0xffff );
diff -rup /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/src/sc.src sc/source/ui/src/sc.src
--- /data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/src/sc.src	2005-09-08 23:32:59.000000000 +0100
+++ sc/source/ui/src/sc.src	2006-06-23 16:11:25.000000000 +0100
@@ -47,6 +47,14 @@ String RID_APPTITLE
 	Text [ x-comment ] = " ";
 };
 
+String RID_SCSTR_ONCLICK
+{
+	Text [ de ] = "Maustaste gedrückt" ;
+	Text [ en-US ] = "Mouse button pressed" ;
+   Text [ cs ] = "Stisknuto tlačítko myši" ;
+   Text [ sk ] = "Stlačené tlačidlo myši";
+};
+
  // About-Dialog --------------------------------------------------------------
 
  // Icons & Bitmaps: ----------------------------------------------------------
