~ubuntu-branches/ubuntu/karmic/openoffice.org-l10n/karmic

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
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: ----------------------------------------------------------