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

(-)sc/source/ui/unoobj/shapeuno.cxx (+126 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 141-146 uno::Any SAL_CALL ScShapeObj::queryInter Link Here
141
	SC_QUERYINTERFACE( beans::XPropertyState )
143
	SC_QUERYINTERFACE( beans::XPropertyState )
142
	SC_QUERYINTERFACE( text::XTextContent )
144
	SC_QUERYINTERFACE( text::XTextContent )
143
	SC_QUERYINTERFACE( lang::XComponent )
145
	SC_QUERYINTERFACE( lang::XComponent )
146
	SC_QUERYINTERFACE( document::XEventsSupplier )
144
	if ( bIsTextShape )
147
	if ( bIsTextShape )
145
	{
148
	{
146
		//	#105585# for text shapes, XText (and parent interfaces) must
149
		//	#105585# for text shapes, XText (and parent interfaces) must
Lines 1320-1322 SdrObject* ScShapeObj::GetSdrObject() co Link Here
1320
	return NULL;
1323
	return NULL;
1321
}
1324
}
1322
1325
1326
typedef ::cppu::WeakImplHelper1< container::XNameReplace > ShapeUnoEventAcess_BASE;
1327
const rtl::OUString sOnClick = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OnClick") );
1328
const rtl::OUString sStrScript = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Script") );
1329
const rtl::OUString sEventType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("EventType") );
1330
class ShapeUnoEventAccessImpl : public ShapeUnoEventAcess_BASE
1331
{
1332
1333
	ScShapeObj* mpShape;	
1334
	bool isValidName( const rtl::OUString& aName )
1335
	{
1336
		if ( !aName.equals( sOnClick ) )
1337
			return false;
1338
		return true;
1339
	}
1340
	
1341
	ScDrawObjData* getInfo( BOOL bCreate = false )
1342
	{
1343
		ScDrawObjData* pInfo = NULL;
1344
		SdrObject* pObj = NULL;
1345
		if ( mpShape )
1346
		{
1347
			pObj = mpShape->GetSdrObject(); 
1348
			if ( pObj )
1349
				pInfo = ScDrawLayer::GetObjData( pObj, bCreate );
1350
		}
1351
		return pInfo;
1352
	}
1353
1354
public:
1355
	ShapeUnoEventAccessImpl( ScShapeObj* pShape ): mpShape( pShape )
1356
	{
1357
	}
1358
1359
	// XNameReplace
1360
	virtual void SAL_CALL replaceByName( const rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
1361
	{
1362
		if ( !isValidName( aName ) )
1363
			throw container::NoSuchElementException();
1364
		uno::Sequence< beans::PropertyValue > aProperties;
1365
		aElement >>= aProperties;
1366
		const beans::PropertyValue* pProperties = aProperties.getConstArray();
1367
		const sal_Int32 nCount = aProperties.getLength();
1368
		sal_Int32 nIndex;
1369
		bool isEventType = false;
1370
		for( nIndex = 0; nIndex < nCount; nIndex++, pProperties++ )
1371
		{
1372
			
1373
			if ( pProperties->Name.equals( sEventType ) )
1374
			{
1375
				isEventType = true;
1376
				continue;
1377
			}
1378
			if ( isEventType && pProperties->Name.equals( sStrScript ) )
1379
			{
1380
				rtl::OUString sMacro;
1381
				if ( ! ( pProperties->Value >>= sMacro ) )
1382
					continue; 	
1383
				ScDrawObjData* pInfo = getInfo();
1384
				if ( !pInfo )
1385
					pInfo = getInfo( TRUE ); 
1386
				DBG_ASSERT( pInfo, "shape animation info could not be created!" );
1387
				
1388
				if ( !pInfo )
1389
					break;	
1390
								
1391
				pInfo->sMacro = sMacro;	
1392
			}	
1393
1394
		}
1395
	}
1396
    
1397
	// XNameAccess
1398
	virtual uno::Any SAL_CALL getByName( const rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
1399
	{
1400
		if ( !isValidName( aName ) )
1401
			throw container::NoSuchElementException();
1402
1403
		ScDrawObjData* pInfo = getInfo();
1404
		uno::Sequence< beans::PropertyValue > aProperties;
1405
		if ( pInfo )
1406
		{
1407
			if ( pInfo->sMacro.getLength() )
1408
			{
1409
				aProperties.realloc(2);
1410
				aProperties[ 0 ].Name = sEventType;
1411
				aProperties[ 0 ].Value <<= sStrScript;
1412
				aProperties[ 1 ].Name = sStrScript;
1413
				aProperties[ 1 ].Value <<= pInfo->sMacro;	
1414
			}
1415
				
1416
		}
1417
		return uno::makeAny( aProperties );
1418
	}
1419
	virtual uno::Sequence< rtl::OUString > SAL_CALL getElementNames(  ) throw(uno::RuntimeException)
1420
	{
1421
		uno::Sequence< rtl::OUString > aStr( &sOnClick, 1 );
1422
		return aStr;
1423
	}
1424
1425
	virtual sal_Bool SAL_CALL hasByName( const rtl::OUString& aName ) throw(uno::RuntimeException)
1426
	{
1427
		return aName.equals( sOnClick );
1428
	}
1429
1430
	// XElementAccess
1431
	virtual uno::Type SAL_CALL getElementType(  ) throw(uno::RuntimeException)
1432
	{
1433
		return *SEQTYPE(::getCppuType((const uno::Sequence< beans::PropertyValue >*)0));
1434
	}
1435
1436
	virtual sal_Bool SAL_CALL hasElements(  ) throw(uno::RuntimeException)
1437
	{
1438
		return ( getInfo() != NULL );
1439
	}
1440
1441
}; 
1442
1443
::uno::Reference< container::XNameReplace > SAL_CALL 
1444
ScShapeObj::getEvents(  ) throw(uno::RuntimeException)
1445
{
1446
	return new ShapeUnoEventAccessImpl( this );
1447
}
1448
(-)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 91-96 private: Link Here
91
95
92
	SdrObject* GetSdrObject() const throw();
96
	SdrObject* GetSdrObject() const throw();
93
97
98
friend class ShapeUnoEventAccessImpl;
99
94
public:
100
public:
95
	static const SvEventDescription* GetSupportedMacroItems();
101
	static const SvEventDescription* GetSupportedMacroItems();
96
102
Lines 229-234 public: Link Here
229
								throw(::com::sun::star::uno::RuntimeException);
235
								throw(::com::sun::star::uno::RuntimeException);
230
	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
236
	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
231
								throw(::com::sun::star::uno::RuntimeException);
237
								throw(::com::sun::star::uno::RuntimeException);
238
	 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents(  ) throw(::com::sun::star::uno::RuntimeException);
232
};
239
};
233
240
234
#endif
241
#endif
(-)sc/inc/userdat.hxx (+1 lines)
Lines 79-84 class ScDrawObjData : public SdrObjUserD Link Here
79
//BFS01	virtual void WriteData(SvStream& rOut);
79
//BFS01	virtual void WriteData(SvStream& rOut);
80
//BFS01	virtual void ReadData(SvStream& rIn);
80
//BFS01	virtual void ReadData(SvStream& rIn);
81
public:
81
public:
82
	rtl::OUString sMacro;
82
	ScAddress aStt, aEnd;
83
	ScAddress aStt, aEnd;
83
	BOOL bValidStart, bValidEnd;
84
	BOOL bValidStart, bValidEnd;
84
	ScDrawObjData();
85
	ScDrawObjData();
(-)sc/source/ui/drawfunc/fusel.cxx (-2 / +29 lines)
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 125-131 BOOL __EXPORT FuSelection::MouseButtonDo Link Here
125
{
126
{
126
	// #95491# remember button state for creation of own MouseEvents
127
	// #95491# remember button state for creation of own MouseEvents
127
	SetMouseButtonCode(rMEvt.GetButtons());
128
	SetMouseButtonCode(rMEvt.GetButtons());
128
129
	const bool bSelectionOnly = rMEvt.IsRight();
129
	if ( pView->IsAction() )
130
	if ( pView->IsAction() )
130
	{
131
	{
131
		if ( rMEvt.IsRight() )
132
		if ( rMEvt.IsRight() )
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
					if ( ! bSelectionOnly)
197
					{
198
						ScDrawObjData* pInfo = ScDrawLayer::GetObjData( pObj );
199
						if ( pInfo && pInfo->sMacro.getLength() )
200
						{
201
							SfxObjectShell* pObjSh = SfxObjectShell::Current();
202
							if ( pObjSh && SfxApplication::IsXScriptURL( pInfo->sMacro ) )
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->sMacro,
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;
Lines 217-223 BOOL __EXPORT FuSelection::MouseButtonDo Link Here
217
						return TRUE;		// kein CaptureMouse etc.
245
						return TRUE;		// kein CaptureMouse etc.
218
					}
246
					}
219
				}
247
				}
220
221
				//	Is another object being edited in this view?
248
				//	Is another object being edited in this view?
222
				//	(Editing is ended in MarkListHasChanged - test before UnmarkAll)
249
				//	(Editing is ended in MarkListHasChanged - test before UnmarkAll)
223
				SfxInPlaceClient* pClient = pViewShell->GetIPClient();
250
				SfxInPlaceClient* pClient = pViewShell->GetIPClient();
(-)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
		ScDrawObjData* pInfo = NULL;
870
		if ( pView->PickObj(aPnt, pObj, pPV, SDRSEARCH_ALSOONMASTER) )
871
			pInfo = ScDrawLayer::GetObjData( 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->sMacro.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
(-)sc/source/filter/inc/xiescher.hxx (-3 / +6 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.
(-)sc/source/filter/excel/xiescher.cxx (-38 / +57 lines)
Lines 189-194 Link Here
189
#endif
189
#endif
190
190
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 413-418 XclImpDrawObjRef XclImpDrawObjBase::Read Link Here
413
414
414
void XclImpDrawObjBase::ReadSubRecord( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize )
415
void XclImpDrawObjBase::ReadSubRecord( XclImpStream& rStrm, sal_uInt16 nSubRecId, sal_uInt16 nSubRecSize )
415
{
416
{
417
    switch( nSubRecId )
418
    {
419
        case EXC_ID_OBJ_FTMACRO:
420
            ReadMacro( rStrm );
421
        break;
422
        default:
423
		;// perhaps an assert here
424
    }
425
416
}
426
}
417
427
418
Rectangle XclImpDrawObjBase::ReadClientAnchor( SvStream& rEscherStrm, const DffRecordHeader& rHeader )
428
Rectangle XclImpDrawObjBase::ReadClientAnchor( SvStream& rEscherStrm, const DffRecordHeader& rHeader )
Lines 494-499 void XclImpDrawObjBase::DoProcessSdrObj( Link Here
494
    if( !IsPrintable() )
504
    if( !IsPrintable() )
495
        GetTracer().TraceObjectNotPrintable();
505
        GetTracer().TraceObjectNotPrintable();
496
}
506
}
507
void XclImpDrawObjBase::ReadMacro( XclImpStream& rStrm )
508
{
509
    maMacroName.Erase();
510
    if( rStrm.GetRecLeft() > 6 )
511
    {
512
        // macro is stored in a tNameXR token containing a link to a defined name
513
        sal_uInt16 nFmlaSize;
514
        rStrm >> nFmlaSize;
515
        rStrm.Ignore( 4 );
516
        DBG_ASSERT( nFmlaSize == 7, "XclImpDrawObjBase::ReadMacro - unexpected formula size" );
517
        if( nFmlaSize == 7 )
518
        {
519
            sal_uInt8 nTokenId;
520
            sal_uInt16 nExtSheet, nExtName;
521
            rStrm >> nTokenId >> nExtSheet >> nExtName;
522
            DBG_ASSERT( nTokenId == XclTokenArrayHelper::GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ),
523
                "XclImpDrawObjBase::ReadMacro - tNameXR token expected" );
524
            if( nTokenId == XclTokenArrayHelper::GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ) )
525
            {
526
                maMacroName = GetLinkManager().GetMacroName( nExtSheet, nExtName );
527
                // #i38718# missing module name - try to find the macro in the imported modules
528
                if( maMacroName.Len() && (maMacroName.Search( '.' ) == STRING_NOTFOUND) )
529
                    if( SfxObjectShell* pDocShell = GetDocShell() )
530
                        if( StarBASIC* pBasic = pDocShell->GetBasic() )
531
                            if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( maMacroName, SbxCLASS_METHOD ) ) )
532
                                if( SbModule* pModule = pMethod->GetModule() )
533
                                    maMacroName.Insert( '.', 0 ).Insert( pModule->GetName(), 0 );
534
            }
535
        }
536
    }
537
}
538
497
539
498
// ----------------------------------------------------------------------------
540
// ----------------------------------------------------------------------------
499
541
Lines 654-662 void XclImpTbxControlObj::ReadSubRecord( Link Here
654
        case EXC_ID_OBJ_FTGBODATA:
696
        case EXC_ID_OBJ_FTGBODATA:
655
            ReadGboData( rStrm );
697
            ReadGboData( rStrm );
656
        break;
698
        break;
657
        case EXC_ID_OBJ_FTMACRO:
658
            ReadMacro( rStrm );
659
        break;
660
        default:
699
        default:
661
            XclImpDrawObjBase::ReadSubRecord( rStrm, nSubRecId, nSubRecSize );
700
            XclImpDrawObjBase::ReadSubRecord( rStrm, nSubRecId, nSubRecSize );
662
    }
701
    }
Lines 833-839 void XclImpTbxControlObj::WriteToPropert Link Here
833
872
834
bool XclImpTbxControlObj::FillMacroDescriptor( ScriptEventDescriptor& rEvent ) const
873
bool XclImpTbxControlObj::FillMacroDescriptor( ScriptEventDescriptor& rEvent ) const
835
{
874
{
836
    if( maMacroName.Len() )
875
    if( GetMacroName().Len() )
837
    {
876
    {
838
        // type of action is dependent on control type
877
        // type of action is dependent on control type
839
        rEvent.ListenerType = XclTbxControlHelper::GetListenerType( GetObjType() );
878
        rEvent.ListenerType = XclTbxControlHelper::GetListenerType( GetObjType() );
Lines 842-848 bool XclImpTbxControlObj::FillMacroDescr Link Here
842
        {
881
        {
843
            // set the macro name
882
            // set the macro name
844
            rEvent.ScriptType = XclTbxControlHelper::GetScriptType();
883
            rEvent.ScriptType = XclTbxControlHelper::GetScriptType();
845
            rEvent.ScriptCode = XclTbxControlHelper::GetScMacroName( maMacroName );
884
            rEvent.ScriptCode = XclTbxControlHelper::GetScMacroName( GetMacroName() );
846
            return true;
885
            return true;
847
        }
886
        }
848
    }
887
    }
Lines 924-961 void XclImpTbxControlObj::ReadGboData( X Link Here
924
    mbFlatBorder = ::get_flag( nStyle, EXC_OBJ_GBO_FLAT );
963
    mbFlatBorder = ::get_flag( nStyle, EXC_OBJ_GBO_FLAT );
925
}
964
}
926
965
927
void XclImpTbxControlObj::ReadMacro( XclImpStream& rStrm )
928
{
929
    maMacroName.Erase();
930
    if( rStrm.GetRecLeft() > 6 )
931
    {
932
        // macro is stored in a tNameXR token containing a link to a defined name
933
        sal_uInt16 nFmlaSize;
934
        rStrm >> nFmlaSize;
935
        rStrm.Ignore( 4 );
936
        DBG_ASSERT( nFmlaSize == 7, "XclImpTbxControlObj::ReadMacro - unexpected formula size" );
937
        if( nFmlaSize == 7 )
938
        {
939
            sal_uInt8 nTokenId;
940
            sal_uInt16 nExtSheet, nExtName;
941
            rStrm >> nTokenId >> nExtSheet >> nExtName;
942
            DBG_ASSERT( nTokenId == XclTokenArrayHelper::GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ),
943
                "XclImpTbxControlObj::ReadMacro - tNameXR token expected" );
944
            if( nTokenId == XclTokenArrayHelper::GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ) )
945
            {
946
                maMacroName = GetLinkManager().GetMacroName( nExtSheet, nExtName );
947
                // #i38718# missing module name - try to find the macro in the imported modules
948
                if( maMacroName.Len() && (maMacroName.Search( '.' ) == STRING_NOTFOUND) )
949
                    if( SfxObjectShell* pDocShell = GetDocShell() )
950
                        if( StarBASIC* pBasic = pDocShell->GetBasic() )
951
                            if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( maMacroName, SbxCLASS_METHOD ) ) )
952
                                if( SbModule* pModule = pMethod->GetModule() )
953
                                    maMacroName.Insert( '.', 0 ).Insert( pModule->GetName(), 0 );
954
            }
955
        }
956
    }
957
}
958
959
// ----------------------------------------------------------------------------
966
// ----------------------------------------------------------------------------
960
967
961
XclImpOleObj::XclImpOleObj( const XclImpRoot& rRoot ) :
968
XclImpOleObj::XclImpOleObj( const XclImpRoot& rRoot ) :
Lines 1386-1392 SdrObject* XclImpDffManager::ProcessObj( Link Here
1386
1393
1387
    /*  Connect textbox data (string, alignment, text orientation) to object.
1394
    /*  Connect textbox data (string, alignment, text orientation) to object.
1388
        #98132# don't ask for a text-ID, Escher export doesn't set one. */
1395
        #98132# don't ask for a text-ID, Escher export doesn't set one. */
1389
    if( XclImpDrawingObj* pDrawingObj = dynamic_cast< XclImpDrawingObj* >( xDrawObj.get() ) )
1396
    XclImpDrawingObj* pDrawingObj = dynamic_cast< XclImpDrawingObj* >( xDrawObj.get() );
1397
    if( pDrawingObj )
1390
        pDrawingObj->SetTxoData( mrObjManager.FindTxoData( rObjData.rSpHd ) );
1398
        pDrawingObj->SetTxoData( mrObjManager.FindTxoData( rObjData.rSpHd ) );
1391
1399
1392
    // #118052# import internal name of a control
1400
    // #118052# import internal name of a control
Lines 1396-1401 SdrObject* XclImpDffManager::ProcessObj( Link Here
1396
        if( aName.Len() )
1404
        if( aName.Len() )
1397
            pOleObj->SetControlName( aName );
1405
            pOleObj->SetControlName( aName );
1398
    }
1406
    }
1407
    else
1408
    {
1409
        // its a drawing object or form control
1410
	if ( pDrawingObj && xSdrObj.get() )
1411
        {
1412
             ScDrawObjData* pInfo = ScDrawLayer::GetObjData( xSdrObj.get(), TRUE );
1413
             if ( pInfo && pDrawingObj->GetMacroName().Len() )
1414
                 pInfo->sMacro = XclTbxControlHelper::GetScMacroName(pDrawingObj->GetMacroName());
1415
1416
        }
1417
    }
1399
1418
1400
    // try to create a custom SdrObject that overwrites the passed object
1419
    // try to create a custom SdrObject that overwrites the passed object
1401
    SdrObjectPtr xNewSdrObj( CreateCustomSdrObject( *xDrawObj, rAnchorRect ) );
1420
    SdrObjectPtr xNewSdrObj( CreateCustomSdrObject( *xDrawObj, rAnchorRect ) );

Return to issue 59082