View | Details | Raw Unified | Return to issue 59082
Collapse All | Expand All

(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/core/data/drwlayer.cxx (+19 lines)
Lines 1996-2001 ScIMapInfo* ScDrawLayer::GetIMapInfo( Sd Link Here
1996
	return NULL;
1996
	return NULL;
1997
}
1997
}
1998
1998
1999
ScMacroInfo* ScDrawLayer::GetMacroInfo( SdrObject* pObj, BOOL bCreate )				// static
2000
{
2001
	USHORT nCount = pObj->GetUserDataCount();
2002
	for( USHORT i = 0; i < nCount; i++ )
2003
	{
2004
		SdrObjUserData* pData = pObj->GetUserData( i );
2005
		if( pData && pData->GetInventor() == SC_DRAWLAYER
2006
					&& pData->GetId() == SC_UD_MACRODATA )
2007
			return (ScMacroInfo*) pData;
2008
	}
2009
	if ( bCreate )
2010
	{
2011
		ScMacroInfo* pData = new ScMacroInfo;
2012
		pObj->InsertUserData( pData, 0 );
2013
		return pData;
2014
	}	
2015
	return NULL;
2016
}
2017
1999
// static:
2018
// static:
2000
IMapObject*	ScDrawLayer::GetHitIMapObject( SdrObject* pObj,
2019
IMapObject*	ScDrawLayer::GetHitIMapObject( SdrObject* pObj,
2001
										  const Point& rWinPoint, const Window& rCmpWnd )
2020
										  const Point& rWinPoint, const Window& rCmpWnd )
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/core/data/userdat.cxx (+16 lines)
Lines 623-628 IMPL_LINK_INLINE_START( ScDrawObjFactory Link Here
623
			pObjFactory->pNewData = new ScDrawObjData;
623
			pObjFactory->pNewData = new ScDrawObjData;
624
		else if ( pObjFactory->nIdentifier == SC_UD_IMAPDATA )
624
		else if ( pObjFactory->nIdentifier == SC_UD_IMAPDATA )
625
			pObjFactory->pNewData = new ScIMapInfo;
625
			pObjFactory->pNewData = new ScIMapInfo;
626
		else if ( pObjFactory->nIdentifier == SC_UD_MACRODATA )
627
			pObjFactory->pNewData = new ScMacroInfo;
626
		else
628
		else
627
			DBG_ERROR("MakeUserData: falsche ID");
629
			DBG_ERROR("MakeUserData: falsche ID");
628
	}
630
	}
Lines 711-713 SdrObjUserData* __EXPORT ScIMapInfo::Clo Link Here
711
{
713
{
712
	return new ScIMapInfo( *this );
714
	return new ScIMapInfo( *this );
713
}
715
}
716
717
ScMacroInfo::ScMacroInfo() :
718
	SdrObjUserData( SC_DRAWLAYER, SC_UD_MACRODATA, 0 )
719
{
720
}
721
722
ScMacroInfo::~ScMacroInfo()
723
{
724
}
725
726
SdrObjUserData* ScMacroInfo::Clone( SdrObject* pObj ) const
727
{
728
	return new ScMacroInfo( *this );
729
}
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/filter/excel/xiescher.cxx (-39 / +60 lines)
Lines 187-194 Link Here
187
#ifndef SC_XICHART_HXX
187
#ifndef SC_XICHART_HXX
188
#include "xichart.hxx"
188
#include "xichart.hxx"
189
#endif
189
#endif
190
190
#include "xicontent.hxx"
191
#include "excform.hxx"
191
#include "excform.hxx"
192
#include "userdat.hxx"
192
193
193
using ::rtl::OUString;
194
using ::rtl::OUString;
194
using ::rtl::OUStringBuffer;
195
using ::rtl::OUStringBuffer;
Lines 403-408 XclImpDrawObjRef XclImpDrawObjBase::Read Link Here
403
404
404
void XclImpDrawObjBase::ReadSubRecord( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize )
405
void XclImpDrawObjBase::ReadSubRecord( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize )
405
{
406
{
407
    switch( nSubRecId )
408
    {
409
        case EXC_ID_OBJ_FTMACRO:
410
            ReadMacro( rStrm );
411
        break;
412
    }
413
406
}
414
}
407
415
408
Rectangle XclImpDrawObjBase::ReadClientAnchor( SvStream& rEscherStrm, const DffRecordHeader& rHeader )
416
Rectangle XclImpDrawObjBase::ReadClientAnchor( SvStream& rEscherStrm, const DffRecordHeader& rHeader )
Lines 484-489 void XclImpDrawObjBase::DoProcessSdrObj( Link Here
484
    if( !IsPrintable() )
492
    if( !IsPrintable() )
485
        GetTracer().TraceObjectNotPrintable();
493
        GetTracer().TraceObjectNotPrintable();
486
}
494
}
495
void XclImpDrawObjBase::ReadMacro( XclImpStream& rStrm )
496
{
497
    maMacroName.Erase();
498
    if( rStrm.GetRecLeft() > 6 )
499
    {
500
        // macro is stored in a tNameXR token containing a link to a defined name
501
        sal_uInt16 nFmlaSize;
502
        rStrm >> nFmlaSize;
503
        rStrm.Ignore( 4 );
504
        DBG_ASSERT( nFmlaSize == 7, "XclImpDrawObjBase::ReadMacro - unexpected formula size" );
505
        if( nFmlaSize == 7 )
506
        {
507
            sal_uInt8 nTokenId;
508
            sal_uInt16 nExtSheet, nExtName;
509
            rStrm >> nTokenId >> nExtSheet >> nExtName;
510
            DBG_ASSERT( nTokenId == XclTokenArrayHelper::GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ),
511
                "XclImpDrawObjBase::ReadMacro - tNameXR token expected" );
512
            if( nTokenId == XclTokenArrayHelper::GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ) )
513
            {
514
                maMacroName = GetLinkManager().GetMacroName( nExtSheet, nExtName );
515
                // #i38718# missing module name - try to find the macro in the imported modules
516
                if( maMacroName.Len() && (maMacroName.Search( '.' ) == STRING_NOTFOUND) )
517
                    if( SfxObjectShell* pDocShell = GetDocShell() )
518
                        if( StarBASIC* pBasic = pDocShell->GetBasic() )
519
                            if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( maMacroName, SbxCLASS_METHOD ) ) )
520
                                if( SbModule* pModule = pMethod->GetModule() )
521
                                    maMacroName.Insert( '.', 0 ).Insert( pModule->GetName(), 0 );
522
            }
523
        }
524
    }
525
}
526
487
527
488
// ----------------------------------------------------------------------------
528
// ----------------------------------------------------------------------------
489
529
Lines 644-652 void XclImpTbxControlObj::ReadSubRecord( Link Here
644
        case EXC_ID_OBJ_FTGBODATA:
684
        case EXC_ID_OBJ_FTGBODATA:
645
            ReadGboData( rStrm );
685
            ReadGboData( rStrm );
646
        break;
686
        break;
647
        case EXC_ID_OBJ_FTMACRO:
648
            ReadMacro( rStrm );
649
        break;
650
        default:
687
        default:
651
            XclImpDrawObjBase::ReadSubRecord( rStrm, nSubRecId, nSubRecSize );
688
            XclImpDrawObjBase::ReadSubRecord( rStrm, nSubRecId, nSubRecSize );
652
    }
689
    }
Lines 823-829 void XclImpTbxControlObj::WriteToPropert Link Here
823
860
824
bool XclImpTbxControlObj::FillMacroDescriptor( ScriptEventDescriptor& rEvent ) const
861
bool XclImpTbxControlObj::FillMacroDescriptor( ScriptEventDescriptor& rEvent ) const
825
{
862
{
826
    if( maMacroName.Len() )
863
    if( GetMacroName().Len() )
827
    {
864
    {
828
        // type of action is dependent on control type
865
        // type of action is dependent on control type
829
        rEvent.ListenerType = XclTbxControlHelper::GetListenerType( GetObjType() );
866
        rEvent.ListenerType = XclTbxControlHelper::GetListenerType( GetObjType() );
Lines 832-838 bool XclImpTbxControlObj::FillMacroDescr Link Here
832
        {
869
        {
833
            // set the macro name
870
            // set the macro name
834
            rEvent.ScriptType = XclTbxControlHelper::GetScriptType();
871
            rEvent.ScriptType = XclTbxControlHelper::GetScriptType();
835
            rEvent.ScriptCode = XclTbxControlHelper::GetScMacroName( maMacroName );
872
            rEvent.ScriptCode = XclTbxControlHelper::GetScMacroName( GetMacroName() );
836
            return true;
873
            return true;
837
        }
874
        }
838
    }
875
    }
Lines 914-951 void XclImpTbxControlObj::ReadGboData( X Link Here
914
    mbFlatBorder = ::get_flag( nStyle, EXC_OBJ_GBO_FLAT );
951
    mbFlatBorder = ::get_flag( nStyle, EXC_OBJ_GBO_FLAT );
915
}
952
}
916
953
917
void XclImpTbxControlObj::ReadMacro( XclImpStream& rStrm )
918
{
919
    maMacroName.Erase();
920
    if( rStrm.GetRecLeft() > 6 )
921
    {
922
        // macro is stored in a tNameXR token containing a link to a defined name
923
        sal_uInt16 nFmlaSize;
924
        rStrm >> nFmlaSize;
925
        rStrm.Ignore( 4 );
926
        DBG_ASSERT( nFmlaSize == 7, "XclImpTbxControlObj::ReadMacro - unexpected formula size" );
927
        if( nFmlaSize == 7 )
928
        {
929
            sal_uInt8 nTokenId;
930
            sal_uInt16 nExtSheet, nExtName;
931
            rStrm >> nTokenId >> nExtSheet >> nExtName;
932
            DBG_ASSERT( nTokenId == XclTokenArrayHelper::GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ),
933
                "XclImpTbxControlObj::ReadMacro - tNameXR token expected" );
934
            if( nTokenId == XclTokenArrayHelper::GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ) )
935
            {
936
                maMacroName = GetLinkManager().GetMacroName( nExtSheet, nExtName );
937
                // #i38718# missing module name - try to find the macro in the imported modules
938
                if( maMacroName.Len() && (maMacroName.Search( '.' ) == STRING_NOTFOUND) )
939
                    if( SfxObjectShell* pDocShell = GetDocShell() )
940
                        if( StarBASIC* pBasic = pDocShell->GetBasic() )
941
                            if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( maMacroName, SbxCLASS_METHOD ) ) )
942
                                if( SbModule* pModule = pMethod->GetModule() )
943
                                    maMacroName.Insert( '.', 0 ).Insert( pModule->GetName(), 0 );
944
            }
945
        }
946
    }
947
}
948
949
// ----------------------------------------------------------------------------
954
// ----------------------------------------------------------------------------
950
955
951
XclImpOleObj::XclImpOleObj( const XclImpRoot& rRoot ) :
956
XclImpOleObj::XclImpOleObj( const XclImpRoot& rRoot ) :
Lines 1381-1387 SdrObject* XclImpDffManager::ProcessObj( Link Here
1381
1386
1382
    /*  Connect textbox data (string, alignment, text orientation) to object.
1387
    /*  Connect textbox data (string, alignment, text orientation) to object.
1383
        #98132# don't ask for a text-ID, Escher export doesn't set one. */
1388
        #98132# don't ask for a text-ID, Escher export doesn't set one. */
1384
    if( XclImpDrawingObj* pDrawingObj = dynamic_cast< XclImpDrawingObj* >( xDrawObj.get() ) )
1389
    XclImpDrawingObj* pDrawingObj = dynamic_cast< XclImpDrawingObj* >( xDrawObj.get() );
1390
    if( pDrawingObj )
1385
        pDrawingObj->SetTxoData( mrObjManager.FindTxoData( rObjData.rSpHd ) );
1391
        pDrawingObj->SetTxoData( mrObjManager.FindTxoData( rObjData.rSpHd ) );
1386
1392
1387
    // #118052# import internal name of a control
1393
    // #118052# import internal name of a control
Lines 1391-1396 SdrObject* XclImpDffManager::ProcessObj( Link Here
1391
        if( aName.Len() )
1397
        if( aName.Len() )
1392
            pOleObj->SetControlName( aName );
1398
            pOleObj->SetControlName( aName );
1393
    }
1399
    }
1400
    else
1401
    {
1402
        // its a drawing object or form control
1403
        if ( pDrawingObj && xSdrObj.get() )
1404
        {
1405
            if ( pDrawingObj->GetMacroName().Len() ) // has associated macro
1406
            {
1407
                ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( xSdrObj.get(), TRUE );
1408
		DBG_ASSERT( pInfo, "shape macro info could not be created!" );
1409
1410
                if ( pInfo )
1411
                    pInfo->SetMacro( XclTbxControlHelper::GetScMacroName(pDrawingObj->GetMacroName() ) );
1412
            }
1413
        }
1414
    }
1394
1415
1395
    // try to create a custom SdrObject that overwrites the passed object
1416
    // try to create a custom SdrObject that overwrites the passed object
1396
    SdrObjectPtr xNewSdrObj( CreateCustomSdrObject( *xDrawObj, rAnchorRect ) );
1417
    SdrObjectPtr xNewSdrObj( CreateCustomSdrObject( *xDrawObj, rAnchorRect ) );
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/filter/inc/xiescher.hxx (-3 / +7 lines)
Lines 148-153 public: Link Here
148
    sal_uInt32          GetProgressSize() const;
148
    sal_uInt32          GetProgressSize() const;
149
    /** Additional processing for the passed SdrObject (calls virtual DoProcessSdrObj() function). */
149
    /** Additional processing for the passed SdrObject (calls virtual DoProcessSdrObj() function). */
150
    void                ProcessSdrObject( SdrObject& rSdrObj ) const;
150
    void                ProcessSdrObject( SdrObject& rSdrObj ) const;
151
    /** Returns associated macro name ( if set ) otherwise returns zero length string. */
152
    const String        GetMacroName() const { return maMacroName; }
151
153
152
protected:
154
protected:
153
    /** Derived classes may return a progress bar size different from 1. */
155
    /** Derived classes may return a progress bar size different from 1. */
Lines 158-165 protected: Link Here
158
    /** Creates an Escher anchor from the passed position (used for sheet charts). */
160
    /** Creates an Escher anchor from the passed position (used for sheet charts). */
159
    void                CreateEscherAnchor( const Rectangle& rAnchorRect );
161
    void                CreateEscherAnchor( const Rectangle& rAnchorRect );
160
162
163
    /** Reads the contents of the ftMacro sub structure in an OBJ record. */
164
    void                ReadMacro( XclImpStream& rStrm );
161
private:
165
private:
162
    typedef ScfRef< XclEscherAnchor > XclEscherAnchorRef;
166
    typedef ScfRef< XclEscherAnchor > XclEscherAnchorRef;
167
    String              maMacroName;    /// Name of an attached macro.
163
168
164
    XclEscherAnchorRef  mxAnchor;       /// The position of the object in the containing sheet.
169
    XclEscherAnchorRef  mxAnchor;       /// The position of the object in the containing sheet.
165
    XclObjId            maObjId;        /// Sheet index and object identifier.
170
    XclObjId            maObjId;        /// Sheet index and object identifier.
Lines 278-289 private: Link Here
278
    void                ReadSbs( XclImpStream& rStrm );
283
    void                ReadSbs( XclImpStream& rStrm );
279
    /** Reads the contents of the ftGboData sub structure in an OBJ record. */
284
    /** Reads the contents of the ftGboData sub structure in an OBJ record. */
280
    void                ReadGboData( XclImpStream& rStrm );
285
    void                ReadGboData( XclImpStream& rStrm );
281
    /** Reads the contents of the ftMacro sub structure in an OBJ record. */
286
282
    void                ReadMacro( XclImpStream& rStrm );
283
287
284
private:
288
private:
285
    ScfInt16Vec         maMultiSel;     /// Indexes of all selected entries in a multi selection.
289
    ScfInt16Vec         maMultiSel;     /// Indexes of all selected entries in a multi selection.
286
    String              maMacroName;    /// Name of an attached macro.
287
    sal_uInt16          mnState;        /// Checked/unchecked state.
290
    sal_uInt16          mnState;        /// Checked/unchecked state.
288
    sal_Int16           mnSelEntry;     /// Index of selected entry (1-based).
291
    sal_Int16           mnSelEntry;     /// Index of selected entry (1-based).
289
    sal_Int16           mnSelType;      /// Selection type.
292
    sal_Int16           mnSelType;      /// Selection type.
Lines 471-476 protected: Link Here
471
private:
474
private:
472
    /** Reads a string property from the passed Escher stream. */
475
    /** Reads a string property from the passed Escher stream. */
473
    String              ReadStringProperty( SvStream& rEscherStrm, sal_uInt32 nPropId ) const;
476
    String              ReadStringProperty( SvStream& rEscherStrm, sal_uInt32 nPropId ) const;
477
    String      ReadHlinkProperty( SvStream& rEscherStrm ) const;
474
478
475
    /** Processes a drawing group container (global drawing data). */
479
    /** Processes a drawing group container (global drawing data). */
476
    void                ProcessDggContainer( SvStream& rEscherStrm, const DffRecordHeader& rDggHeader );
480
    void                ProcessDggContainer( SvStream& rEscherStrm, const DffRecordHeader& rDggHeader );
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/drawfunc/fudraw.cxx (+7 lines)
Lines 866-871 void FuDraw::ForcePointer(const MouseEve Link Here
866
		SdrObject* pObj;
866
		SdrObject* pObj;
867
		SdrPageView* pPV;
867
		SdrPageView* pPV;
868
868
869
		ScMacroInfo* pInfo = NULL;
870
		if ( pView->PickObj(aPnt, pObj, pPV, SDRSEARCH_ALSOONMASTER) )
871
			pInfo = ScDrawLayer::GetMacroInfo( pObj );
869
		if ( pView->IsTextEdit() )
872
		if ( pView->IsTextEdit() )
870
		{
873
		{
871
			pViewShell->SetActivePointer(Pointer(POINTER_TEXT));		// kann nicht sein ?
874
			pViewShell->SetActivePointer(Pointer(POINTER_TEXT));		// kann nicht sein ?
Lines 891-896 void FuDraw::ForcePointer(const MouseEve Link Here
891
			SdrObjMacroHitRec aHitRec;	//! muss da noch irgendwas gesetzt werden ????
894
			SdrObjMacroHitRec aHitRec;	//! muss da noch irgendwas gesetzt werden ????
892
			pViewShell->SetActivePointer( pObj->GetMacroPointer(aHitRec) );
895
			pViewShell->SetActivePointer( pObj->GetMacroPointer(aHitRec) );
893
		}
896
		}
897
		else  if ( !bAlt && pInfo && pInfo->GetMacro().getLength() )
898
		{
899
			pWindow->SetPointer( Pointer( POINTER_REFHAND ) );
900
		}	
894
		else if ( IsDetectiveHit( aPnt ) )
901
		else if ( IsDetectiveHit( aPnt ) )
895
			pViewShell->SetActivePointer( Pointer( POINTER_DETECTIVE ) );
902
			pViewShell->SetActivePointer( Pointer( POINTER_DETECTIVE ) );
896
		else
903
		else
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/drawfunc/fusel.cxx (-1 / +29 lines)
Lines 55-61 Link Here
55
#include <svx/svdpagv.hxx>
55
#include <svx/svdpagv.hxx>
56
#include <svx/outlobj.hxx>
56
#include <svx/outlobj.hxx>
57
#include <svx/svdocapt.hxx>
57
#include <svx/svdocapt.hxx>
58
58
#include <sfx2/app.hxx>
59
59
60
#ifndef _COM_SUN_STAR_EMBED_EMBEDSTATES_HPP_
60
#ifndef _COM_SUN_STAR_EMBED_EMBEDSTATES_HPP_
61
#include <com/sun/star/embed/EmbedStates.hpp>
61
#include <com/sun/star/embed/EmbedStates.hpp>
Lines 70-75 Link Here
70
#include "drawpage.hxx"
70
#include "drawpage.hxx"
71
#include "globstr.hrc"
71
#include "globstr.hrc"
72
#include "drwlayer.hxx"
72
#include "drwlayer.hxx"
73
#include "userdat.hxx"
73
74
74
// -----------------------------------------------------------------------
75
// -----------------------------------------------------------------------
75
76
Lines 189-194 BOOL __EXPORT FuSelection::MouseButtonDo Link Here
189
			}
190
			}
190
			else
191
			else
191
			{
192
			{
193
194
				if ( !bAlt && pView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_ALSOONMASTER))
195
				{
196
					ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
197
					if ( pInfo )
198
					{
199
						if ( pInfo->GetMacro().getLength() )
200
						{
201
							SfxObjectShell* pObjSh = SfxObjectShell::Current();
202
							if ( pObjSh && SfxApplication::IsXScriptURL( pInfo->GetMacro() ) )
203
							{
204
								uno::Any aRet;
205
								uno::Sequence< sal_Int16 > aOutArgsIndex;
206
								uno::Sequence< uno::Any > aOutArgs;
207
								uno::Sequence< uno::Any >* pInArgs =
208
									new uno::Sequence< uno::Any >(0);
209
	 							pObjSh->CallXScript( pInfo->GetMacro(),
210
									*pInArgs, aRet, aOutArgsIndex, aOutArgs);
211
								pViewShell->FakeButtonUp( pViewShell->GetViewData()->GetActivePart() );
212
								return TRUE;		// kein CaptureMouse etc.
213
	
214
							}
215
						}
216
					} 	
217
				}
218
219
192
				//	URL / ImageMap
220
				//	URL / ImageMap
193
221
194
				SdrViewEvent aVEvt;
222
				SdrViewEvent aVEvt;
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/unoobj/shapeuno.cxx (+120 lines)
Lines 68-73 Link Here
68
#include <comphelper/stl_types.hxx>
68
#include <comphelper/stl_types.hxx>
69
#endif
69
#endif
70
70
71
#include <cppuhelper/implbase2.hxx>
72
71
using namespace ::com::sun::star;
73
using namespace ::com::sun::star;
72
74
73
//------------------------------------------------------------------------
75
//------------------------------------------------------------------------
Lines 143-148 uno::Any SAL_CALL ScShapeObj::queryInter Link Here
143
	SC_QUERYINTERFACE( beans::XPropertyState )
145
	SC_QUERYINTERFACE( beans::XPropertyState )
144
	SC_QUERYINTERFACE( text::XTextContent )
146
	SC_QUERYINTERFACE( text::XTextContent )
145
	SC_QUERYINTERFACE( lang::XComponent )
147
	SC_QUERYINTERFACE( lang::XComponent )
148
	SC_QUERYINTERFACE( document::XEventsSupplier )
146
	if ( bIsTextShape )
149
	if ( bIsTextShape )
147
	{
150
	{
148
		//	#105585# for text shapes, XText (and parent interfaces) must
151
		//	#105585# for text shapes, XText (and parent interfaces) must
Lines 1337-1339 SdrObject* ScShapeObj::GetSdrObject() co Link Here
1337
	return NULL;
1340
	return NULL;
1338
}
1341
}
1339
1342
1343
typedef ::cppu::WeakImplHelper1< container::XNameReplace > ShapeUnoEventAcess_BASE;
1344
const rtl::OUString sOnClick = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OnClick") );
1345
const rtl::OUString sStrScript = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Script") );
1346
const rtl::OUString sEventType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("EventType") );
1347
1348
class ShapeUnoEventAccessImpl : public ShapeUnoEventAcess_BASE
1349
{
1350
1351
	ScShapeObj* mpShape;	
1352
	bool isValidName( const rtl::OUString& aName )
1353
	{
1354
		return ( aName == sOnClick );
1355
	}
1356
	
1357
	ScMacroInfo* getInfo( BOOL bCreate = false )
1358
	{
1359
		ScMacroInfo* pInfo = NULL;
1360
		SdrObject* pObj = NULL;
1361
		if ( mpShape )
1362
		{
1363
			pObj = mpShape->GetSdrObject(); 
1364
			if ( pObj )
1365
				pInfo = ScDrawLayer::GetMacroInfo( pObj, bCreate );
1366
		}
1367
		return pInfo;
1368
	}
1369
1370
public:
1371
	ShapeUnoEventAccessImpl( ScShapeObj* pShape ): mpShape( pShape )
1372
	{
1373
	}
1374
1375
	// XNameReplace
1376
	virtual void SAL_CALL replaceByName( const rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
1377
	{
1378
		if ( !hasByName( aName ) )
1379
			throw container::NoSuchElementException();
1380
		uno::Sequence< beans::PropertyValue > aProperties;
1381
		aElement >>= aProperties;
1382
		const beans::PropertyValue* pProperties = aProperties.getConstArray();
1383
		const sal_Int32 nCount = aProperties.getLength();
1384
		sal_Int32 nIndex;
1385
		bool isEventType = false;
1386
		for( nIndex = 0; nIndex < nCount; nIndex++, pProperties++ )
1387
		{			
1388
			if ( pProperties->Name.equals( sEventType ) )
1389
			{
1390
				isEventType = true;
1391
				continue;
1392
			}
1393
			if ( isEventType &&  pProperties->Name == sStrScript )
1394
			{
1395
				rtl::OUString sValue;
1396
				if ( ! ( pProperties->Value >>= sValue ) )
1397
					continue; 	
1398
				ScMacroInfo* pInfo = getInfo( TRUE );
1399
				DBG_ASSERT( pInfo, "shape macro info could not be created!" );
1400
				
1401
				if ( !pInfo )
1402
					break;	
1403
				pInfo->SetMacro( sValue );	
1404
			}	
1405
1406
		}
1407
	}
1408
    
1409
	// XNameAccess
1410
	virtual uno::Any SAL_CALL getByName( const rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
1411
	{
1412
		if ( !hasByName( aName ) )
1413
			throw container::NoSuchElementException();
1414
1415
		ScMacroInfo* pInfo = getInfo();
1416
		uno::Sequence< beans::PropertyValue > aProperties;
1417
		if ( pInfo )
1418
		{
1419
			if ( pInfo->GetMacro().getLength() )
1420
			{
1421
				aProperties.realloc(2);
1422
				aProperties[ 0 ].Name = sEventType;
1423
				aProperties[ 0 ].Value <<= sStrScript;
1424
				aProperties[ 1 ].Name = sStrScript;
1425
				aProperties[ 1 ].Value <<= pInfo->GetMacro();	
1426
			}
1427
		}
1428
		return uno::makeAny( aProperties );
1429
	}
1430
	virtual uno::Sequence< rtl::OUString > SAL_CALL getElementNames(  ) throw(uno::RuntimeException)
1431
	{
1432
		uno::Sequence< rtl::OUString > aStr( &sOnClick, 1 );
1433
		return aStr;
1434
	}
1435
1436
	virtual sal_Bool SAL_CALL hasByName( const rtl::OUString& aName ) throw(uno::RuntimeException)
1437
	{
1438
		return isValidName( aName );
1439
	}
1440
1441
	// XElementAccess
1442
	virtual uno::Type SAL_CALL getElementType(  ) throw(uno::RuntimeException)
1443
	{
1444
		return *SEQTYPE(::getCppuType((const uno::Sequence< beans::PropertyValue >*)0));
1445
	}
1446
1447
	virtual sal_Bool SAL_CALL hasElements(  ) throw(uno::RuntimeException)
1448
	{
1449
		return ( getInfo() != NULL );
1450
	}
1451
1452
}; 
1453
1454
::uno::Reference< container::XNameReplace > SAL_CALL 
1455
ScShapeObj::getEvents(  ) throw(uno::RuntimeException)
1456
{
1457
	return new ShapeUnoEventAccessImpl( this );
1458
}
1459
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/inc/drwlayer.hxx (+4 lines)
Lines 54-59 class SfxViewShell; Link Here
54
class SfxObjectShell;
54
class SfxObjectShell;
55
class ScDrawObjData;
55
class ScDrawObjData;
56
class ScIMapInfo;
56
class ScIMapInfo;
57
class ScMacroInfo;
57
class IMapObject;
58
class IMapObject;
58
class ScMarkData;
59
class ScMarkData;
59
class SdrOle2Obj;
60
class SdrOle2Obj;
Lines 193-198 public: Link Here
193
194
194
	// Image-Map
195
	// Image-Map
195
	static ScIMapInfo* GetIMapInfo( SdrObject* pObj );
196
	static ScIMapInfo* GetIMapInfo( SdrObject* pObj );
197
198
	static ScMacroInfo* GetMacroInfo( SdrObject* pObj, BOOL bCreate=FALSE );
199
196
	static IMapObject* GetHitIMapObject( SdrObject* pObject,
200
	static IMapObject* GetHitIMapObject( SdrObject* pObject,
197
							const Point& rWinPoint, const Window& rCmpWnd );
201
							const Point& rWinPoint, const Window& rCmpWnd );
198
202
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/inc/shapeuno.hxx (-1 / +8 lines)
Lines 56-61 Link Here
56
#include <com/sun/star/lang/XTypeProvider.hpp>
56
#include <com/sun/star/lang/XTypeProvider.hpp>
57
#endif
57
#endif
58
58
59
#include <com/sun/star/document/XEventsSupplier.hpp>
60
59
#ifndef _CPPUHELPER_WEAK_HXX_ 
61
#ifndef _CPPUHELPER_WEAK_HXX_ 
60
#include <cppuhelper/weak.hxx>
62
#include <cppuhelper/weak.hxx>
61
#endif
63
#endif
Lines 71-76 namespace com { namespace sun { namespac Link Here
71
73
72
class SdrObject;
74
class SdrObject;
73
struct SvEventDescription;
75
struct SvEventDescription;
76
class ShapeUnoEventAccessImpl;
74
77
75
//------------------------------------------------------------------------
78
//------------------------------------------------------------------------
76
79
Lines 82-88 class ScShapeObj : public ::cppu::OWeakO Link Here
82
					public ::com::sun::star::beans::XPropertyState,
85
					public ::com::sun::star::beans::XPropertyState,
83
					public ::com::sun::star::text::XTextContent,
86
					public ::com::sun::star::text::XTextContent,
84
					public ::com::sun::star::text::XText,
87
					public ::com::sun::star::text::XText,
85
					public ::com::sun::star::lang::XTypeProvider
88
					public ::com::sun::star::lang::XTypeProvider,
89
					public ::com::sun::star::document::XEventsSupplier
86
{
90
{
87
private:
91
private:
88
	::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > mxShapeAgg;
92
	::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > mxShapeAgg;
Lines 98-103 private: Link Here
98
    void                    GetShapePropertySet();
102
    void                    GetShapePropertySet();
99
    void                    GetShapePropertyState();
103
    void                    GetShapePropertyState();
100
104
105
friend class ShapeUnoEventAccessImpl;
106
101
public:
107
public:
102
	static const SvEventDescription* GetSupportedMacroItems();
108
	static const SvEventDescription* GetSupportedMacroItems();
103
109
Lines 236-241 public: Link Here
236
								throw(::com::sun::star::uno::RuntimeException);
242
								throw(::com::sun::star::uno::RuntimeException);
237
	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
243
	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
238
								throw(::com::sun::star::uno::RuntimeException);
244
								throw(::com::sun::star::uno::RuntimeException);
245
	 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents(  ) throw(::com::sun::star::uno::RuntimeException);
239
};
246
};
240
247
241
#endif
248
#endif
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/inc/userdat.hxx (+13 lines)
Lines 60-65 Link Here
60
// Object-Ids fuer UserData
60
// Object-Ids fuer UserData
61
#define SC_UD_OBJDATA		1
61
#define SC_UD_OBJDATA		1
62
#define SC_UD_IMAPDATA		2
62
#define SC_UD_IMAPDATA		2
63
#define SC_UD_MACRODATA		3
63
64
64
//-------------------------------------------------------------------------
65
//-------------------------------------------------------------------------
65
66
Lines 104-109 public: Link Here
104
	const ImageMap&	GetImageMap() const				{ return aImageMap; }
105
	const ImageMap&	GetImageMap() const				{ return aImageMap; }
105
};
106
};
106
107
108
class ScMacroInfo : public SdrObjUserData
109
{
110
	rtl::OUString sMacro;
111
public:
112
					ScMacroInfo();
113
	virtual			~ScMacroInfo();
114
115
	virtual	SdrObjUserData* Clone( SdrObject* pObj ) const;
116
117
	void 	SetMacro( const rtl::OUString& rMacro )	{ sMacro = rMacro; }
118
	const rtl::OUString&	GetMacro() const				{ return sMacro; }
119
};
107
120
108
#endif
121
#endif
109
122

Return to issue 59082