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

(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/inc/userdat.hxx (+3 lines)
Lines 108-113 public: Link Here
108
class ScMacroInfo : public SdrObjUserData
108
class ScMacroInfo : public SdrObjUserData
109
{
109
{
110
	rtl::OUString sMacro;
110
	rtl::OUString sMacro;
111
	rtl::OUString sHlink;
111
public:
112
public:
112
					ScMacroInfo();
113
					ScMacroInfo();
113
	virtual			~ScMacroInfo();
114
	virtual			~ScMacroInfo();
Lines 115-121 public: Link Here
115
	virtual	SdrObjUserData* Clone( SdrObject* pObj ) const;
116
	virtual	SdrObjUserData* Clone( SdrObject* pObj ) const;
116
117
117
	void 	SetMacro( const rtl::OUString& rMacro )	{ sMacro = rMacro; }
118
	void 	SetMacro( const rtl::OUString& rMacro )	{ sMacro = rMacro; }
119
	void 	SetHlink( const rtl::OUString& rHlink )	{ sHlink = rHlink; }
118
	const rtl::OUString&	GetMacro() const				{ return sMacro; }
120
	const rtl::OUString&	GetMacro() const				{ return sMacro; }
121
	const rtl::OUString&	GetHlink() const				{ return sHlink; }
119
};
122
};
120
123
121
#endif
124
#endif
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/filter/excel/xicontent.cxx (-4 / +13 lines)
Lines 281-296 void lclInsertUrl( const XclImpRoot& rRo Link Here
281
void XclImpHyperlink::ReadHlink( XclImpStream& rStrm )
281
void XclImpHyperlink::ReadHlink( XclImpStream& rStrm )
282
{
282
{
283
    const XclImpRoot& rRoot = rStrm.GetRoot();
283
    const XclImpRoot& rRoot = rStrm.GetRoot();
284
    XclRange aXclRange( ScAddress::UNINITIALIZED );
285
    rStrm >> aXclRange; 
286
    String aString =  ReadHlinkRecord( rStrm );
287
288
    if ( aString.Len() )
289
        rRoot.GetXFRangeBuffer().SetHyperlink( aXclRange, aString );
290
}
291
292
String XclImpHyperlink::ReadHlinkRecord( XclImpStream& rStrm )
293
{
284
    DBG_ASSERT_BIFF( rRoot.GetBiff() == EXC_BIFF8 );
294
    DBG_ASSERT_BIFF( rRoot.GetBiff() == EXC_BIFF8 );
285
295
296
    const XclImpRoot& rRoot = rStrm.GetRoot();
286
    ScDocument& rDoc = rRoot.GetDoc();
297
    ScDocument& rDoc = rRoot.GetDoc();
287
    SfxObjectShell* pDocShell = rRoot.GetDocShell();
298
    SfxObjectShell* pDocShell = rRoot.GetDocShell();
288
299
289
    XclRange aXclRange( ScAddress::UNINITIALIZED );
290
    sal_uInt32 nFlags;
300
    sal_uInt32 nFlags;
291
    XclGuid aGuid;
301
    XclGuid aGuid;
292
302
    rStrm >> aGuid;
293
    rStrm >> aXclRange >> aGuid;
294
    rStrm.Ignore( 4 );
303
    rStrm.Ignore( 4 );
295
    rStrm >> nFlags;
304
    rStrm >> nFlags;
296
305
Lines 384-391 void XclImpHyperlink::ReadHlink( XclImpS Link Here
384
            xLongName->Append( '#' );
393
            xLongName->Append( '#' );
385
            xLongName->Append( *xTextMark );
394
            xLongName->Append( *xTextMark );
386
        }
395
        }
387
        rRoot.GetXFRangeBuffer().SetHyperlink( aXclRange, *xLongName );
388
    }
396
    }
397
    return *xLongName;
389
}
398
}
390
399
391
void XclImpHyperlink::InsertUrl( const XclImpRoot& rRoot, const XclRange& rXclRange, const String& rUrl )
400
void XclImpHyperlink::InsertUrl( const XclImpRoot& rRoot, const XclRange& rXclRange, const String& rUrl )
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/filter/excel/xiescher.cxx (+34 lines)
Lines 1402-1407 SdrObject* XclImpDffManager::ProcessObj( Link Here
1402
        // its a drawing object or form control
1402
        // its a drawing object or form control
1403
        if ( pDrawingObj && xSdrObj.get() )
1403
        if ( pDrawingObj && xSdrObj.get() )
1404
        {
1404
        {
1405
            String sHlinkURL =  ReadHlinkProperty( rEscherStrm );
1406
            if ( sHlinkURL.Len() )
1407
            {
1408
1409
                ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( xSdrObj.get(), TRUE );
1410
                if ( pInfo )
1411
                    pInfo->SetHlink( sHlinkURL );
1412
            }
1405
            if ( pDrawingObj->GetMacroName().Len() ) // has associated macro
1413
            if ( pDrawingObj->GetMacroName().Len() ) // has associated macro
1406
            {
1414
            {
1407
                ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( xSdrObj.get(), TRUE );
1415
                ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( xSdrObj.get(), TRUE );
Lines 1479-1484 FASTBOOL XclImpDffManager::GetColorFromP Link Here
1479
}
1489
}
1480
1490
1481
// private --------------------------------------------------------------------
1491
// private --------------------------------------------------------------------
1492
String XclImpDffManager::ReadHlinkProperty( SvStream& rEscherStrm ) const
1493
{
1494
    String aString;
1495
    sal_uInt32 nPropId = DFF_Prop_pihlShape;
1496
    sal_uInt32 nBufferSize = GetPropertyValue( nPropId );
1497
    if( (nBufferSize > 0) && SeekToContent( nPropId, rEscherStrm ) )
1498
    {
1499
        const static sal_uInt16 nDummyId = 9999;
1500
	sal_uInt16 nRecSize = nBufferSize;
1501
        SvMemoryStream memStream;
1502
        
1503
        memStream << nDummyId;
1504
        memStream << nRecSize; 	
1505
        for ( sal_Int32 nByteCount = 0; nByteCount < nRecSize; ++nByteCount )
1506
        {
1507
            sal_uInt8 aByte = 0;
1508
            rEscherStrm >> aByte;
1509
            memStream << aByte;
1510
        }
1511
        XclImpStream aLinkStream( memStream, GetRoot() );
1512
        aLinkStream.StartNextRecord();
1513
        XclImpHyperlink aHlink;
1514
        aString = aHlink.ReadHlinkRecord( aLinkStream );
1515
    }
1516
    return aString;
1517
}
1482
1518
1483
String XclImpDffManager::ReadStringProperty( SvStream& rEscherStrm, sal_uInt32 nPropId ) const
1519
String XclImpDffManager::ReadStringProperty( SvStream& rEscherStrm, sal_uInt32 nPropId ) const
1484
{
1520
{
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/filter/inc/xicontent.hxx (+1 lines)
Lines 98-103 public: Link Here
98
    /** Reads a HLINK record and inserts it into the document.
98
    /** Reads a HLINK record and inserts it into the document.
99
        @descr  Import stream must be located at start of a HLINK record. */
99
        @descr  Import stream must be located at start of a HLINK record. */
100
    static void         ReadHlink( XclImpStream& rStrm );
100
    static void         ReadHlink( XclImpStream& rStrm );
101
    static String       ReadHlinkRecord( XclImpStream& rStrm );
101
102
102
    /** Inserts the URL into a range of cells. Does not modify value or formula cells. */
103
    /** Inserts the URL into a range of cells. Does not modify value or formula cells. */
103
    static void         InsertUrl( const XclImpRoot& rRoot, const XclRange& rXclRange, const String& rUrl );
104
    static void         InsertUrl( const XclImpRoot& rRoot, const XclRange& rXclRange, const String& rUrl );
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/drawfunc/fudraw.cxx (-1 / +2 lines)
Lines 894-900 void FuDraw::ForcePointer(const MouseEve Link Here
894
			SdrObjMacroHitRec aHitRec;	//! muss da noch irgendwas gesetzt werden ????
894
			SdrObjMacroHitRec aHitRec;	//! muss da noch irgendwas gesetzt werden ????
895
			pViewShell->SetActivePointer( pObj->GetMacroPointer(aHitRec) );
895
			pViewShell->SetActivePointer( pObj->GetMacroPointer(aHitRec) );
896
		}
896
		}
897
		else  if ( !bAlt && pInfo && pInfo->GetMacro().getLength() )
897
		else  if ( !bAlt && pInfo && ( pInfo->GetMacro().getLength() |
898
		            pInfo->GetHlink().getLength()  ) )
898
		{
899
		{
899
			pWindow->SetPointer( Pointer( POINTER_REFHAND ) );
900
			pWindow->SetPointer( Pointer( POINTER_REFHAND ) );
900
		}	
901
		}	
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/drawfunc/fusel.cxx (-6 / +20 lines)
Lines 190-202 BOOL __EXPORT FuSelection::MouseButtonDo Link Here
190
			}
190
			}
191
			else
191
			else
192
			{
192
			{
193
				String sURL;
194
				String sTarget;
193
195
194
				if ( !bAlt && pView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_ALSOONMASTER))
196
				if ( !bAlt && pView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_ALSOONMASTER))
195
				{
197
				{
196
					ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
198
					ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
197
					if ( pInfo )
199
					if ( pInfo )
198
					{
200
					{
199
						if ( pInfo->GetMacro().getLength() )
201
						// For interoperability favour links over 
202
						// macros if both are defined
203
						if ( pInfo->GetHlink().getLength() )
204
						{
205
							sURL = pInfo->GetHlink();
206
							sTarget = sURL;
207
						}
208
						else if ( pInfo->GetMacro().getLength() )
200
						{
209
						{
201
							SfxObjectShell* pObjSh = SfxObjectShell::Current();
210
							SfxObjectShell* pObjSh = SfxObjectShell::Current();
202
							if ( pObjSh && SfxApplication::IsXScriptURL( pInfo->GetMacro() ) )
211
							if ( pObjSh && SfxApplication::IsXScriptURL( pInfo->GetMacro() ) )
Lines 230-245 BOOL __EXPORT FuSelection::MouseButtonDo Link Here
230
								ScDrawLayer::GetHitIMapObject( aVEvt.pObj, aMDPos, *pWindow );
239
								ScDrawLayer::GetHitIMapObject( aVEvt.pObj, aMDPos, *pWindow );
231
						if ( pIMapObj && pIMapObj->GetURL().Len() )
240
						if ( pIMapObj && pIMapObj->GetURL().Len() )
232
						{
241
						{
233
							ScGlobal::OpenURL( pIMapObj->GetURL(), pIMapObj->GetTarget() );
242
							sURL = pIMapObj->GetURL();
243
							sTarget =  pIMapObj->GetTarget();
234
244
235
							pViewShell->FakeButtonUp( pViewShell->GetViewData()->GetActivePart() );
236
							return TRUE;		// kein CaptureMouse etc.
237
						}
245
						}
238
					}
246
					}
239
					if ( aVEvt.eEvent == SDREVENT_EXECUTEURL && aVEvt.pURLField )	// URL
247
					if ( aVEvt.eEvent == SDREVENT_EXECUTEURL && aVEvt.pURLField )	// URL
240
					{
248
					{
241
						ScGlobal::OpenURL( aVEvt.pURLField->GetURL(),
249
						sURL = aVEvt.pURLField->GetURL();
242
											aVEvt.pURLField->GetTargetFrame() );
250
						sTarget = aVEvt.pURLField->GetTargetFrame();
251
252
					}
253
254
					if ( sURL.Len() )
255
					{
256
						ScGlobal::OpenURL( sURL, sTarget );
243
257
244
						pViewShell->FakeButtonUp( pViewShell->GetViewData()->GetActivePart() );
258
						pViewShell->FakeButtonUp( pViewShell->GetViewData()->GetActivePart() );
245
						return TRUE;		// kein CaptureMouse etc.
259
						return TRUE;		// kein CaptureMouse etc.
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/unoobj/shapeuno.cxx (-11 / +31 lines)
Lines 1342-1357 SdrObject* ScShapeObj::GetSdrObject() co Link Here
1342
1342
1343
typedef ::cppu::WeakImplHelper1< container::XNameReplace > ShapeUnoEventAcess_BASE;
1343
typedef ::cppu::WeakImplHelper1< container::XNameReplace > ShapeUnoEventAcess_BASE;
1344
const rtl::OUString sOnClick = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OnClick") );
1344
const rtl::OUString sOnClick = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OnClick") );
1345
const rtl::OUString sOnAction = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OnAction") );
1346
const rtl::OUString sURL = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("URL") );
1347
const rtl::OUString sAction = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Action") );
1345
const rtl::OUString sStrScript = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Script") );
1348
const rtl::OUString sStrScript = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Script") );
1346
const rtl::OUString sEventType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("EventType") );
1349
const rtl::OUString sEventType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("EventType") );
1347
1350
1351
const rtl::OUString sEventNames[] = { sOnClick, sOnAction };
1348
class ShapeUnoEventAccessImpl : public ShapeUnoEventAcess_BASE
1352
class ShapeUnoEventAccessImpl : public ShapeUnoEventAcess_BASE
1349
{
1353
{
1350
1354
1351
	ScShapeObj* mpShape;	
1355
	ScShapeObj* mpShape;	
1352
	bool isValidName( const rtl::OUString& aName )
1356
	bool isValidName( const rtl::OUString& aName )
1353
	{
1357
	{
1354
		return ( aName == sOnClick );
1358
		return ( aName == sOnClick | aName == sOnAction );
1355
	}
1359
	}
1356
	
1360
	
1357
	ScMacroInfo* getInfo( BOOL bCreate = false )
1361
	ScMacroInfo* getInfo( BOOL bCreate = false )
Lines 1390-1396 public: Link Here
1390
				isEventType = true;
1394
				isEventType = true;
1391
				continue;
1395
				continue;
1392
			}
1396
			}
1393
			if ( isEventType &&  pProperties->Name == sStrScript )
1397
			if ( isEventType && ( pProperties->Name == sStrScript | pProperties->Name == sURL) )
1394
			{
1398
			{
1395
				rtl::OUString sValue;
1399
				rtl::OUString sValue;
1396
				if ( ! ( pProperties->Value >>= sValue ) )
1400
				if ( ! ( pProperties->Value >>= sValue ) )
Lines 1400-1406 public: Link Here
1400
				
1404
				
1401
				if ( !pInfo )
1405
				if ( !pInfo )
1402
					break;	
1406
					break;	
1403
				pInfo->SetMacro( sValue );	
1407
				if ( pProperties->Name == sStrScript )
1408
					pInfo->SetMacro( sValue );	
1409
				else
1410
					pInfo->SetHlink( sValue );
1404
			}	
1411
			}	
1405
1412
1406
		}
1413
		}
Lines 1415-1435 public: Link Here
1415
		ScMacroInfo* pInfo = getInfo();
1422
		ScMacroInfo* pInfo = getInfo();
1416
		uno::Sequence< beans::PropertyValue > aProperties;
1423
		uno::Sequence< beans::PropertyValue > aProperties;
1417
		if ( pInfo )
1424
		if ( pInfo )
1418
		{
1425
			if ( aName == sOnClick )
1419
			if ( pInfo->GetMacro().getLength() )
1420
			{
1426
			{
1421
				aProperties.realloc(2);
1427
				if ( pInfo->GetMacro().getLength() )
1422
				aProperties[ 0 ].Name = sEventType;
1428
				{
1423
				aProperties[ 0 ].Value <<= sStrScript;
1429
					aProperties.realloc(2);
1424
				aProperties[ 1 ].Name = sStrScript;
1430
					aProperties[ 0 ].Name = sEventType;
1425
				aProperties[ 1 ].Value <<= pInfo->GetMacro();	
1431
					aProperties[ 0 ].Value <<= sStrScript;
1432
					aProperties[ 1 ].Name = sStrScript;
1433
					aProperties[ 1 ].Value <<= pInfo->GetMacro();	
1434
				}
1426
			}
1435
			}
1436
			else
1437
			{
1438
				if ( pInfo->GetHlink().getLength() )	
1439
				{
1440
					aProperties.realloc(2);
1441
					aProperties[ 0 ].Name = sEventType;
1442
					aProperties[ 0 ].Value <<= sAction;
1443
					aProperties[ 1 ].Name = sURL;
1444
					aProperties[ 1 ].Value <<= pInfo->GetHlink();	
1445
				}
1446
				
1427
		}
1447
		}
1428
		return uno::makeAny( aProperties );
1448
		return uno::makeAny( aProperties );
1429
	}
1449
	}
1430
	virtual uno::Sequence< rtl::OUString > SAL_CALL getElementNames(  ) throw(uno::RuntimeException)
1450
	virtual uno::Sequence< rtl::OUString > SAL_CALL getElementNames(  ) throw(uno::RuntimeException)
1431
	{
1451
	{
1432
		uno::Sequence< rtl::OUString > aStr( &sOnClick, 1 );
1452
		uno::Sequence< rtl::OUString > aStr( sEventNames, 2 );
1433
		return aStr;
1453
		return aStr;
1434
	}
1454
	}
1435
1455
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/sc/source/ui/view/gridwin5.cxx (+16 lines)
Lines 84-89 Link Here
84
#include "chgviset.hxx"
84
#include "chgviset.hxx"
85
#include "dbfunc.hxx"
85
#include "dbfunc.hxx"
86
#include "tabvwsh.hxx"
86
#include "tabvwsh.hxx"
87
#include "userdat.hxx"
87
88
88
89
89
// -----------------------------------------------------------------------
90
// -----------------------------------------------------------------------
Lines 340-345 void __EXPORT ScGridWindow::RequestHelp( Link Here
340
						aPixRect = LogicToPixel(aVEvt.pObj->GetLogicRect());
341
						aPixRect = LogicToPixel(aVEvt.pObj->GetLogicRect());
341
					}
342
					}
342
				}
343
				}
344
				SdrObject* pObj = NULL;
345
				SdrPageView* pPV = NULL;
346
				Point aMDPos = PixelToLogic( aPosPixel );
347
				if ( pDrView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_ALSOONMASTER) )
348
				{
349
					ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );	
350
					if ( pInfo && pInfo->GetHlink().getLength() )
351
					{
352
						aPixRect = LogicToPixel(aVEvt.pObj->GetLogicRect());
353
						aHelpText = pInfo->GetHlink();
354
						
355
					}	
356
						
357
358
				}
343
				// URL in Textobjekt
359
				// URL in Textobjekt
344
				if ( !aHelpText.Len() && aVEvt.eEvent == SDREVENT_EXECUTEURL )
360
				if ( !aHelpText.Len() && aVEvt.eEvent == SDREVENT_EXECUTEURL )
345
				{
361
				{
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/xmloff/inc/shapeexport.hxx (+5 lines)
Lines 70-75 Link Here
70
#ifndef _COM_SUN_STAR_AWT_POINT_HPP_
70
#ifndef _COM_SUN_STAR_AWT_POINT_HPP_
71
#include <com/sun/star/awt/Point.hpp>
71
#include <com/sun/star/awt/Point.hpp>
72
#endif
72
#endif
73
#include <com/sun/star/beans/PropertyValue.hpp>
73
74
74
#include <map>
75
#include <map>
75
76
Lines 224-229 private: Link Here
224
	const rtl::OUString							msStartShape;
225
	const rtl::OUString							msStartShape;
225
	const rtl::OUString							msEndShape;
226
	const rtl::OUString							msEndShape;
226
	const rtl::OUString							msOnClick;
227
	const rtl::OUString							msOnClick;
228
	const rtl::OUString							msOnAction;
229
	const rtl::OUString							msAction;
230
	const rtl::OUString							msURL;
227
	const rtl::OUString							msEventType;
231
	const rtl::OUString							msEventType;
228
	const rtl::OUString							msPresentation;
232
	const rtl::OUString							msPresentation;
229
	const rtl::OUString							msMacroName;
233
	const rtl::OUString							msMacroName;
Lines 249-254 private: Link Here
249
	SAL_DLLPRIVATE sal_Bool ImpExportPresentationAttributes( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet, const rtl::OUString& rClass );
253
	SAL_DLLPRIVATE sal_Bool ImpExportPresentationAttributes( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet, const rtl::OUString& rClass );
250
	SAL_DLLPRIVATE void ImpExportText( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
254
	SAL_DLLPRIVATE void ImpExportText( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
251
	SAL_DLLPRIVATE void ImpExportEvents( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
255
	SAL_DLLPRIVATE void ImpExportEvents( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
256
	SAL_DLLPRIVATE void ImpExportEvents( const com::sun::star::beans::PropertyValue* pProps, const sal_Int32 nCount );
252
	SAL_DLLPRIVATE void ImpExportGluePoints( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
257
	SAL_DLLPRIVATE void ImpExportGluePoints( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
253
258
254
	// single shape exporters
259
	// single shape exporters
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/xmloff/source/draw/eventimp.cxx (-172 / +239 lines)
Lines 132-138 class SdXMLEventContext : public SvXMLIm Link Here
132
{
132
{
133
private:
133
private:
134
	com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape;
134
	com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape;
135
135
	void processPresentationEvents( const Reference< XNameReplace >& ); 
136
	// Action & OnClick
137
	void processShapeEvents( const Reference< XNameReplace >& ); 
138
	void fillMacroEventProps( beans::PropertyValue*& ); 
136
public:
139
public:
137
	TYPEINFO();
140
	TYPEINFO();
138
141
Lines 144-153 public: Link Here
144
147
145
	sal_Bool mbValid;
148
	sal_Bool mbValid;
146
	sal_Bool mbScript;
149
	sal_Bool mbScript;
150
	sal_Bool mbShapeAction;
147
	ClickAction meClickAction;
151
	ClickAction meClickAction;
148
	XMLEffect meEffect;
152
	XMLEffect meEffect;
149
	XMLEffectDirection meDirection;
153
	XMLEffectDirection meDirection;
150
	sal_Int16 mnStartScale;
154
	sal_Int16 mnStartScale;
155
	sal_Int16 mnPrfx;
151
	AnimationSpeed meSpeed;
156
	AnimationSpeed meSpeed;
152
	sal_Int32 mnVerb;
157
	sal_Int32 mnVerb;
153
	OUString msSoundURL;
158
	OUString msSoundURL;
Lines 155-160 public: Link Here
155
	OUString msMacroName;
160
	OUString msMacroName;
156
	OUString msBookmark;
161
	OUString msBookmark;
157
	OUString msLanguage;
162
	OUString msLanguage;
163
	OUString msHyperURL;
158
};
164
};
159
165
160
///////////////////////////////////////////////////////////////////////
166
///////////////////////////////////////////////////////////////////////
Lines 207-213 XMLEventSoundContext::~XMLEventSoundCont Link Here
207
{
213
{
208
}
214
}
209
215
210
///////////////////////////////////////////////////////////////////////
216
/////////HyperURL
211
217
212
TYPEINIT1( SdXMLEventContext, SvXMLImportContext );
218
TYPEINIT1( SdXMLEventContext, SvXMLImportContext );
213
219
Lines 215-227 SdXMLEventContext::SdXMLEventContext( Sv Link Here
215
:	SvXMLImportContext(rImp, nPrfx, rLocalName),
221
:	SvXMLImportContext(rImp, nPrfx, rLocalName),
216
	mxShape( rxShape ), mbScript( sal_False ), meClickAction( ClickAction_NONE ),
222
	mxShape( rxShape ), mbScript( sal_False ), meClickAction( ClickAction_NONE ),
217
	meEffect( EK_none ), meDirection( ED_none ), mnStartScale( 100 ),
223
	meEffect( EK_none ), meDirection( ED_none ), mnStartScale( 100 ),
218
	meSpeed( AnimationSpeed_MEDIUM ), mnVerb(0), mbPlayFull( sal_False )
224
	meSpeed( AnimationSpeed_MEDIUM ), mnVerb(0), mbPlayFull( sal_False ), mnPrfx( nPrfx ), mbShapeAction( sal_False )
219
{
225
{
220
	const OUString msXMLEventName( RTL_CONSTASCII_USTRINGPARAM( "click" ) );
226
	static const OUString msXMLEventName( RTL_CONSTASCII_USTRINGPARAM( "click" ) );
227
	static const OUString msXMLShapeAction( RTL_CONSTASCII_USTRINGPARAM( "action" ) );
221
228
222
	if( nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_EVENT_LISTENER ) )
229
	if( nPrfx == XML_NAMESPACE_PRESENTATION  && IsXMLToken( rLocalName, XML_EVENT_LISTENER ) )
230
	{
231
		mbValid = sal_True;
232
	}
233
	else if( nPrfx == XML_NAMESPACE_DRAW  && IsXMLToken( rLocalName, XML_EVENT_LISTENER ) )
223
	{
234
	{
224
		mbValid = sal_True;
235
		mbValid = sal_True;
236
		mbShapeAction = sal_True;
225
	}
237
	}
226
	else if( nPrfx == XML_NAMESPACE_SCRIPT && IsXMLToken( rLocalName, XML_EVENT_LISTENER ) )
238
	else if( nPrfx == XML_NAMESPACE_SCRIPT && IsXMLToken( rLocalName, XML_EVENT_LISTENER ) )
227
	{
239
	{
Lines 288-294 SdXMLEventContext::SdXMLEventContext( Sv Link Here
288
				sEventName = sValue;
300
				sEventName = sValue;
289
				sal_uInt16 nScriptPrefix = 
301
				sal_uInt16 nScriptPrefix = 
290
					GetImport().GetNamespaceMap().GetKeyByAttrName( sValue, &sEventName );
302
					GetImport().GetNamespaceMap().GetKeyByAttrName( sValue, &sEventName );
291
				mbValid = XML_NAMESPACE_DOM == nScriptPrefix && sEventName == msXMLEventName;
303
				mbValid = XML_NAMESPACE_DOM == nScriptPrefix && ( sEventName == msXMLEventName | sEventName == msXMLShapeAction );
292
			}
304
			}
293
			else if( IsXMLToken( aAttrLocalName, XML_LANGUAGE ) )
305
			else if( IsXMLToken( aAttrLocalName, XML_LANGUAGE ) )
294
			{
306
			{
Lines 314-330 SdXMLEventContext::SdXMLEventContext( Sv Link Here
314
			if( IsXMLToken( aAttrLocalName, XML_HREF ) )
326
			if( IsXMLToken( aAttrLocalName, XML_HREF ) )
315
			{
327
			{
316
				if ( mbScript )
328
				if ( mbScript )
317
				{
318
					msMacroName = sValue;
329
					msMacroName = sValue;
319
				}
320
				else
330
				else
321
				{
331
				{
322
					const rtl::OUString &rTmp = 
332
					if ( !mbShapeAction )
323
						rImp.GetAbsoluteReference(sValue);
333
					{
324
					INetURLObject::translateToInternal( rTmp, msBookmark, 
334
						const rtl::OUString &rTmp = 
325
						INetURLObject::WAS_ENCODED, 
335
							rImp.GetAbsoluteReference(sValue);
326
						INetURLObject::DECODE_UNAMBIGUOUS, 
336
						INetURLObject::translateToInternal( rTmp, msBookmark, 
327
						RTL_TEXTENCODING_UTF8 );
337
							INetURLObject::WAS_ENCODED, 
338
							INetURLObject::DECODE_UNAMBIGUOUS, 
339
							RTL_TEXTENCODING_UTF8 );
340
					}
341
					else
342
						msHyperURL = sValue;	
328
				}
343
				}
329
			}
344
			}
330
			break;
345
			break;
Lines 344-374 SvXMLImportContext * SdXMLEventContext:: Link Here
344
	return new XMLEventSoundContext( GetImport(), nPrefix, rLocalName, xAttrList, this );
359
	return new XMLEventSoundContext( GetImport(), nPrefix, rLocalName, xAttrList, this );
345
}
360
}
346
361
347
void SdXMLEventContext::EndElement()
362
void  SdXMLEventContext::fillMacroEventProps( beans::PropertyValue*& pProperties)
348
{
363
{
349
	const OUString msAPIEventName( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) );
364
	pProperties->Name =
365
			OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
366
	pProperties->Handle = -1;
367
	pProperties->Value <<= OUString(
368
		RTL_CONSTASCII_USTRINGPARAM("Script") );
369
	pProperties->State = beans::PropertyState_DIRECT_VALUE;
370
	pProperties++;
371
372
	pProperties->Name = OUString(
373
		RTL_CONSTASCII_USTRINGPARAM( "Script" ) );
374
	pProperties->Handle = -1;
375
	pProperties->Value <<= msMacroName;
376
	pProperties->State = beans::PropertyState_DIRECT_VALUE;
377
}
350
378
351
	if( !mbValid )
379
void  SdXMLEventContext::processShapeEvents( const Reference< XNameReplace >& xEvents )
380
{
381
	OUString sAPIEventName;
382
	if ( mbShapeAction )
383
		sAPIEventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "OnAction" ));
384
	else if ( mbScript )
385
		sAPIEventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ));
386
	else
387
		return;
388
	if( !xEvents->hasByName( sAPIEventName ) )
352
		return;
389
		return;
353
390
354
	do
391
	uno::Sequence< beans::PropertyValue > aProperties( 2 );
392
	beans::PropertyValue* pProperties = aProperties.getArray();
393
394
	if ( mbShapeAction )
355
	{
395
	{
356
		Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY );
396
		pProperties->Name =
357
		if( !xEventsSupplier.is() )
397
			OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
358
			break;
398
		pProperties->Handle = -1;
399
		pProperties->Value <<= OUString(
400
			RTL_CONSTASCII_USTRINGPARAM("Action") );
401
		pProperties->State = beans::PropertyState_DIRECT_VALUE;
402
		pProperties++;
403
404
		pProperties->Name = OUString(
405
			RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
406
		pProperties->Handle = -1;
407
		pProperties->Value <<= msHyperURL;
408
		pProperties->State = beans::PropertyState_DIRECT_VALUE;
409
	}
410
	else
411
		fillMacroEventProps( pProperties );
412
	uno::Any aAny;
413
	aAny <<= aProperties;
414
	xEvents->replaceByName( sAPIEventName, aAny );
415
}
416
void  SdXMLEventContext::processPresentationEvents( const Reference< XNameReplace >& xEvents )
417
{
418
	const OUString sAPIEventName( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) );
419
	if( !xEvents->hasByName( sAPIEventName ) )
420
		return;
359
421
360
		Reference< XNameReplace > xEvents( xEventsSupplier->getEvents() );
422
	sal_Int32 nPropertyCount = 2;
361
		DBG_ASSERT( xEvents.is(), "XEventsSupplier::getEvents() returned NULL" );
423
	switch( meClickAction )
362
		if( !xEvents.is() )
424
	{
363
			break;
425
	case ClickAction_NONE:
426
	case ClickAction_PREVPAGE:
427
	case ClickAction_NEXTPAGE:
428
	case ClickAction_FIRSTPAGE:
429
	case ClickAction_LASTPAGE:
430
	case ClickAction_INVISIBLE:
431
	case ClickAction_STOPPRESENTATION:
432
		break;
433
	case ClickAction_PROGRAM:
434
	case ClickAction_VERB:
435
	case ClickAction_BOOKMARK:
436
	case ClickAction_DOCUMENT:
437
		nPropertyCount += 1;
438
		break;
439
	case ClickAction_MACRO:
440
		if ( msLanguage.equalsIgnoreAsciiCaseAscii("starbasic") )
441
			nPropertyCount += 1;
442
		break;
364
443
365
		if( !xEvents->hasByName( msAPIEventName ) )
444
	case ClickAction_SOUND:
366
			break;
445
		nPropertyCount += 2;
446
		break;
447
448
	case ClickAction_VANISH:
449
		nPropertyCount += 4;
450
		break;
451
	}
367
452
368
		if( mbScript )
453
	uno::Sequence< beans::PropertyValue > aProperties( nPropertyCount );
369
			meClickAction = ClickAction_MACRO;
454
	beans::PropertyValue* pProperties = aProperties.getArray();
455
456
	if( ClickAction_MACRO == meClickAction )
457
	{
458
		if ( msLanguage.equalsIgnoreAsciiCaseAscii("starbasic") )
459
		{
460
			OUString sLibrary;
461
			const OUString& rApp = GetXMLToken( XML_APPLICATION ); 
462
			const OUString& rDoc = GetXMLToken( XML_DOCUMENT ); 
463
			if( msMacroName.getLength() > rApp.getLength()+1 &&
464
				msMacroName.copy(0,rApp.getLength()).equalsIgnoreAsciiCase( rApp ) &&
465
				':' == msMacroName[rApp.getLength()] )
466
			{
467
				sLibrary = OUString(RTL_CONSTASCII_USTRINGPARAM("StarOffice"));
468
				msMacroName = msMacroName.copy( rApp.getLength()+1 );
469
			}
470
			else if( msMacroName.getLength() > rDoc.getLength()+1 &&
471
				msMacroName.copy(0,rDoc.getLength()).equalsIgnoreAsciiCase( rDoc ) &&
472
				':' == msMacroName[rDoc.getLength()] )
473
			{
474
				sLibrary = rDoc;
475
				msMacroName = msMacroName.copy( rDoc.getLength()+1 );
476
			}
477
478
			pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
479
			pProperties->Handle = -1;
480
			pProperties->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("StarBasic") );
481
			pProperties->State = beans::PropertyState_DIRECT_VALUE;
482
			pProperties++;
483
484
			pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "MacroName" ) );
485
			pProperties->Handle = -1;
486
			pProperties->Value <<= msMacroName;
487
			pProperties->State = beans::PropertyState_DIRECT_VALUE;
488
			pProperties++;
489
490
			pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Library" ) );
491
			pProperties->Handle = -1;
492
			pProperties->Value <<= sLibrary;
493
			pProperties->State = beans::PropertyState_DIRECT_VALUE;
494
		}
495
		else
496
			fillMacroEventProps( pProperties );
497
	}
498
	else
499
	{
500
		pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
501
		pProperties->Handle = -1;
502
		pProperties->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("Presentation") );
503
		pProperties->State = beans::PropertyState_DIRECT_VALUE;
504
		pProperties++;
505
506
		// ClickAction_BOOKMARK and ClickAction_DOCUMENT share the same xml event
507
		// so check here if its realy a bookmark or maybe a document
508
		if( meClickAction == ClickAction_BOOKMARK )
509
		{
510
			if( msBookmark.compareToAscii( "#", 1 ) != 0 )
511
				meClickAction = ClickAction_DOCUMENT;
512
		}
513
514
		pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("ClickAction") );
515
		pProperties->Handle = -1;
516
		pProperties->Value <<= meClickAction;
517
		pProperties->State = beans::PropertyState_DIRECT_VALUE;
518
		pProperties++;
370
519
371
		sal_Int32 nPropertyCount = 2;
372
		switch( meClickAction )
520
		switch( meClickAction )
373
		{
521
		{
374
		case ClickAction_NONE:
522
		case ClickAction_NONE:
Lines 379-550 void SdXMLEventContext::EndElement() Link Here
379
		case ClickAction_INVISIBLE:
527
		case ClickAction_INVISIBLE:
380
		case ClickAction_STOPPRESENTATION:
528
		case ClickAction_STOPPRESENTATION:
381
			break;
529
			break;
382
		case ClickAction_PROGRAM:
530
383
		case ClickAction_VERB:
384
		case ClickAction_BOOKMARK:
531
		case ClickAction_BOOKMARK:
385
		case ClickAction_DOCUMENT:
532
			msBookmark = msBookmark.copy(1);
386
			nPropertyCount += 1;
387
			break;
388
		case ClickAction_MACRO:
389
			if ( msLanguage.equalsIgnoreAsciiCaseAscii("starbasic") )
390
				nPropertyCount += 1;
391
			break;
392
533
393
		case ClickAction_SOUND:
534
			// Note: no break here!!!
394
			nPropertyCount += 2;
535
536
		case ClickAction_DOCUMENT:
537
		case ClickAction_PROGRAM:
538
			pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Bookmark") );
539
			pProperties->Handle = -1;
540
			pProperties->Value <<= msBookmark;
541
			pProperties->State = beans::PropertyState_DIRECT_VALUE;
395
			break;
542
			break;
396
543
397
		case ClickAction_VANISH:
544
		case ClickAction_VANISH:
398
			nPropertyCount += 4;
545
			pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Effect") );
399
			break;
546
			pProperties->Handle = -1;
400
		}
547
			pProperties->Value <<= ImplSdXMLgetEffect( meEffect, meDirection, mnStartScale, sal_True );
548
			pProperties->State = beans::PropertyState_DIRECT_VALUE;
549
			pProperties++;
401
550
402
		uno::Sequence< beans::PropertyValue > aProperties( nPropertyCount );
551
			pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Speed") );
403
		beans::PropertyValue* pProperties = aProperties.getArray();
552
			pProperties->Handle = -1;
553
			pProperties->Value <<= meSpeed;
554
			pProperties->State = beans::PropertyState_DIRECT_VALUE;
555
			pProperties++;
404
556
405
		if( ClickAction_MACRO == meClickAction )
557
			// NOTE: no break here!!!
406
		{
407
			if ( msLanguage.equalsIgnoreAsciiCaseAscii("starbasic") )
408
			{
409
				OUString sLibrary;
410
				const OUString& rApp = GetXMLToken( XML_APPLICATION ); 
411
				const OUString& rDoc = GetXMLToken( XML_DOCUMENT ); 
412
				if( msMacroName.getLength() > rApp.getLength()+1 &&
413
					msMacroName.copy(0,rApp.getLength()).equalsIgnoreAsciiCase( rApp ) &&
414
					':' == msMacroName[rApp.getLength()] )
415
				{
416
					sLibrary = OUString(RTL_CONSTASCII_USTRINGPARAM("StarOffice"));
417
					msMacroName = msMacroName.copy( rApp.getLength()+1 );
418
				}
419
				else if( msMacroName.getLength() > rDoc.getLength()+1 &&
420
					msMacroName.copy(0,rDoc.getLength()).equalsIgnoreAsciiCase( rDoc ) &&
421
					':' == msMacroName[rDoc.getLength()] )
422
				{
423
					sLibrary = rDoc;
424
					msMacroName = msMacroName.copy( rDoc.getLength()+1 );
425
				}
426
558
427
				pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
559
		case ClickAction_SOUND:
428
				pProperties->Handle = -1;
560
			pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("SoundURL") );
429
				pProperties->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("StarBasic") );
430
				pProperties->State = beans::PropertyState_DIRECT_VALUE;
431
				pProperties++;
432
433
				pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "MacroName" ) );
434
				pProperties->Handle = -1;
435
				pProperties->Value <<= msMacroName;
436
				pProperties->State = beans::PropertyState_DIRECT_VALUE;
437
				pProperties++;
438
439
				pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Library" ) );
440
				pProperties->Handle = -1;
441
				pProperties->Value <<= sLibrary;
442
				pProperties->State = beans::PropertyState_DIRECT_VALUE;
443
			}
444
			else
445
			{
446
				pProperties->Name =
447
					OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
448
				pProperties->Handle = -1;
449
				pProperties->Value <<= OUString(
450
					RTL_CONSTASCII_USTRINGPARAM("Script") );
451
				pProperties->State = beans::PropertyState_DIRECT_VALUE;
452
				pProperties++;
453
454
				pProperties->Name = OUString(
455
					RTL_CONSTASCII_USTRINGPARAM( "Script" ) );
456
				pProperties->Handle = -1;
457
				pProperties->Value <<= msMacroName;
458
				pProperties->State = beans::PropertyState_DIRECT_VALUE;
459
			}
460
		}
461
		else
462
		{
463
			pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
464
			pProperties->Handle = -1;
561
			pProperties->Handle = -1;
465
			pProperties->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("Presentation") );
562
			pProperties->Value <<= msSoundURL;
466
			pProperties->State = beans::PropertyState_DIRECT_VALUE;
563
			pProperties->State = beans::PropertyState_DIRECT_VALUE;
467
			pProperties++;
564
			pProperties++;
468
565
469
			// ClickAction_BOOKMARK and ClickAction_DOCUMENT share the same xml event
566
			pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("PlayFull") );
470
			// so check here if its realy a bookmark or maybe a document
567
			pProperties->Handle = -1;
471
			if( meClickAction == ClickAction_BOOKMARK )
568
			pProperties->Value = ::cppu::bool2any(mbPlayFull);
472
			{
569
			pProperties->State = beans::PropertyState_DIRECT_VALUE;
473
				if( msBookmark.compareToAscii( "#", 1 ) != 0 )
570
			break;
474
					meClickAction = ClickAction_DOCUMENT;
475
			}
476
571
477
			pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("ClickAction") );
572
		case ClickAction_VERB:
573
			pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Verb") );
478
			pProperties->Handle = -1;
574
			pProperties->Handle = -1;
479
			pProperties->Value <<= meClickAction;
575
			pProperties->Value <<= mnVerb;
480
			pProperties->State = beans::PropertyState_DIRECT_VALUE;
576
			pProperties->State = beans::PropertyState_DIRECT_VALUE;
481
			pProperties++;
577
			break;
578
		}
579
	}
580
	uno::Any aAny;
581
	aAny <<= aProperties;
582
	xEvents->replaceByName( sAPIEventName, aAny );
482
583
483
			switch( meClickAction )
584
}
484
			{
585
void SdXMLEventContext::EndElement()
485
			case ClickAction_NONE:
586
{
486
			case ClickAction_PREVPAGE:
587
487
			case ClickAction_NEXTPAGE:
588
	if( !mbValid )
488
			case ClickAction_FIRSTPAGE:
589
		return;
489
			case ClickAction_LASTPAGE:
490
			case ClickAction_INVISIBLE:
491
			case ClickAction_STOPPRESENTATION:
492
				break;
493
590
494
			case ClickAction_BOOKMARK:
591
	do
495
				msBookmark = msBookmark.copy(1);
592
	{
593
		Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY );
594
		if( !xEventsSupplier.is() )
595
			break;
496
596
497
				// Note: no break here!!!
597
		Reference< XNameReplace > xEvents( xEventsSupplier->getEvents() );
598
		DBG_ASSERT( xEvents.is(), "XEventsSupplier::getEvents() returned NULL" );
599
		if( !xEvents.is() )
600
			break;
498
601
499
			case ClickAction_DOCUMENT:
602
		switch( mnPrfx )
500
			case ClickAction_PROGRAM:
603
		{
501
				pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Bookmark") );
604
			case XML_NAMESPACE_PRESENTATION:
502
				pProperties->Handle = -1;
605
				processPresentationEvents( xEvents );	
503
				pProperties->Value <<= msBookmark;
504
				pProperties->State = beans::PropertyState_DIRECT_VALUE;
505
				break;
606
				break;
506
607
			case XML_NAMESPACE_DRAW:
507
			case ClickAction_VANISH:
608
			case XML_NAMESPACE_SCRIPT:
508
				pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Effect") );
609
				processShapeEvents( xEvents );
509
				pProperties->Handle = -1;
510
				pProperties->Value <<= ImplSdXMLgetEffect( meEffect, meDirection, mnStartScale, sal_True );
511
				pProperties->State = beans::PropertyState_DIRECT_VALUE;
512
				pProperties++;
513
514
				pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Speed") );
515
				pProperties->Handle = -1;
516
				pProperties->Value <<= meSpeed;
517
				pProperties->State = beans::PropertyState_DIRECT_VALUE;
518
				pProperties++;
519
520
				// NOTE: no break here!!!
521
522
			case ClickAction_SOUND:
523
				pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("SoundURL") );
524
				pProperties->Handle = -1;
525
				pProperties->Value <<= msSoundURL;
526
				pProperties->State = beans::PropertyState_DIRECT_VALUE;
527
				pProperties++;
528
529
				pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("PlayFull") );
530
				pProperties->Handle = -1;
531
				pProperties->Value = ::cppu::bool2any(mbPlayFull);
532
				pProperties->State = beans::PropertyState_DIRECT_VALUE;
533
				break;
610
				break;
534
611
			default:
535
			case ClickAction_VERB:
536
				pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Verb") );
537
				pProperties->Handle = -1;
538
				pProperties->Value <<= mnVerb;
539
				pProperties->State = beans::PropertyState_DIRECT_VALUE;
540
				break;
612
				break;
541
			}
542
		}
613
		}
543
614
544
		uno::Any aAny;
545
		aAny <<= aProperties;
546
		xEvents->replaceByName( msAPIEventName, aAny );
547
548
	} while(0);
615
	} while(0);
549
}
616
}
550
617
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/xmloff/source/draw/shapeexport2.cxx (-212 / +242 lines)
Lines 352-625 void XMLShapeExport::ImpExportText( cons Link Here
352
#define FOUND_EVENTTYPE		0x0080
352
#define FOUND_EVENTTYPE		0x0080
353
#define FOUND_MACRO			0x0100
353
#define FOUND_MACRO			0x0100
354
#define FOUND_LIBRARY		0x0200
354
#define FOUND_LIBRARY		0x0200
355
#define FOUND_ACTION		0x0400
355
356
356
void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& xShape )
357
void XMLShapeExport::ImpExportEvents( const beans::PropertyValue* pProperties, const sal_Int32 nCount )
357
{
358
{
358
	do
359
	sal_Int32 nFound = 0;
360
	OUString aStrEventType;
361
	presentation::ClickAction eClickAction;
362
	presentation::AnimationEffect eEffect;
363
	presentation::AnimationSpeed eSpeed;
364
	OUString aStrSoundURL;
365
	sal_Bool bPlayFull;
366
	sal_Int32 nVerb;
367
	OUString aStrMacro;
368
	OUString aStrLibrary;
369
	OUString aStrBookmark;
370
	OUString aHyperURL;
371
	sal_Int32 nIndex;
372
	for( nIndex = 0; nIndex < nCount; nIndex++, pProperties++ )
359
	{
373
	{
360
		uno::Reference< document::XEventsSupplier > xEventsSupplier( xShape, uno::UNO_QUERY );
374
		if( ( ( nFound & FOUND_EVENTTYPE ) == 0 ) && pProperties->Name == msEventType )
361
		if( !xEventsSupplier.is() )
375
		{
362
			break;
376
			if( pProperties->Value >>= aStrEventType )
377
				nFound |= FOUND_EVENTTYPE;
378
		}
379
		else if( ( ( nFound & FOUND_CLICKACTION ) == 0 ) && pProperties->Name == msClickAction )
380
		{
381
			if( pProperties->Value >>= eClickAction )
382
				nFound |= FOUND_CLICKACTION;
383
		}
384
		else if( ( ( nFound & FOUND_MACRO ) == 0 ) && ( pProperties->Name == msMacroName || pProperties->Name == msScript ) )
385
		{
386
			if( pProperties->Value >>= aStrMacro )
387
				nFound |= FOUND_MACRO;
388
		}
389
		else if( ( ( nFound & FOUND_ACTION ) == 0 ) && ( pProperties->Name == msURL  ) )
390
		{
391
			if( pProperties->Value >>= aHyperURL )
392
				nFound |= FOUND_ACTION;
393
		}
394
		else if( ( ( nFound & FOUND_LIBRARY ) == 0 ) && pProperties->Name == msLibrary )
395
		{
396
			if( pProperties->Value >>= aStrLibrary )
397
				nFound |= FOUND_LIBRARY;
398
		}
399
		else if( ( ( nFound & FOUND_EFFECT ) == 0 ) && pProperties->Name == msEffect )
400
		{
401
			if( pProperties->Value >>= eEffect )
402
				nFound |= FOUND_EFFECT;
403
		}
404
		else if( ( ( nFound & FOUND_BOOKMARK ) == 0 ) && pProperties->Name == msBookmark )
405
		{
406
			if( pProperties->Value >>= aStrBookmark )
407
				nFound |= FOUND_BOOKMARK;
408
		}
409
		else if( ( ( nFound & FOUND_SPEED ) == 0 ) && pProperties->Name == msSpeed )
410
		{
411
			if( pProperties->Value >>= eSpeed )
412
				nFound |= FOUND_SPEED;
413
		}
414
		else if( ( ( nFound & FOUND_SOUNDURL ) == 0 ) && pProperties->Name == msSoundURL )
415
		{
416
			if( pProperties->Value >>= aStrSoundURL )
417
				nFound |= FOUND_SOUNDURL;
418
		}
419
		else if( ( ( nFound & FOUND_PLAYFULL ) == 0 ) && pProperties->Name == msPlayFull )
420
		{
421
			if( pProperties->Value >>= bPlayFull )
422
				nFound |= FOUND_PLAYFULL;
423
		}
424
		else if( ( ( nFound & FOUND_VERB ) == 0 ) && pProperties->Name == msVerb )
425
		{
426
			if( pProperties->Value >>= nVerb )
427
				nFound |= FOUND_VERB;
428
		}
429
	}
363
430
364
		uno::Reference< container::XNameReplace > xEvents( xEventsSupplier->getEvents() );
431
	if( ( nFound & FOUND_EVENTTYPE ) == 0 )
365
		DBG_ASSERT( xEvents.is(), "XEventsSupplier::getEvents() returned NULL" );
432
		return;
366
		if( !xEvents.is() )
367
			break;
368
433
369
		uno::Sequence< beans::PropertyValue > aProperties;
434
	if( aStrEventType == msPresentation )
370
		if( !xEvents->hasByName( msOnClick ) )
435
	{
371
			break;
436
		if( ( nFound & FOUND_CLICKACTION ) == 0 )
437
			return;
372
438
373
		if( !(xEvents->getByName( msOnClick ) >>= aProperties) )
439
		if( eClickAction == presentation::ClickAction_NONE )
374
			break;
440
			return;
375
441
376
		sal_Int32 nFound = 0;
442
		SvXMLElementExport aEventsElemt(rExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
377
		const beans::PropertyValue* pProperties = aProperties.getConstArray();
378
443
379
		OUString aStrEventType;
444
		enum XMLTokenEnum eStrAction;
380
		presentation::ClickAction eClickAction;
381
		presentation::AnimationEffect eEffect;
382
		presentation::AnimationSpeed eSpeed;
383
		OUString aStrSoundURL;
384
		sal_Bool bPlayFull;
385
		sal_Int32 nVerb;
386
		OUString aStrMacro;
387
		OUString aStrLibrary;
388
		OUString aStrBookmark;
389
445
390
		const sal_Int32 nCount = aProperties.getLength();
446
		switch( eClickAction )
391
		sal_Int32 nIndex;
392
		for( nIndex = 0; nIndex < nCount; nIndex++, pProperties++ )
393
		{
447
		{
394
			if( ( ( nFound & FOUND_EVENTTYPE ) == 0 ) && pProperties->Name == msEventType )
448
		case presentation::ClickAction_PREVPAGE:		eStrAction = XML_PREVIOUS_PAGE; break;
395
			{
449
		case presentation::ClickAction_NEXTPAGE:		eStrAction = XML_NEXT_PAGE; break;
396
				if( pProperties->Value >>= aStrEventType )
450
		case presentation::ClickAction_FIRSTPAGE:		eStrAction = XML_FIRST_PAGE; break;
397
					nFound |= FOUND_EVENTTYPE;
451
		case presentation::ClickAction_LASTPAGE:		eStrAction = XML_LAST_PAGE; break;
398
			}
452
		case presentation::ClickAction_INVISIBLE:		eStrAction = XML_HIDE; break;
399
			else if( ( ( nFound & FOUND_CLICKACTION ) == 0 ) && pProperties->Name == msClickAction )
453
		case presentation::ClickAction_STOPPRESENTATION:eStrAction = XML_STOP; break;
400
			{
454
		case presentation::ClickAction_PROGRAM:			eStrAction = XML_EXECUTE; break;
401
				if( pProperties->Value >>= eClickAction )
455
		case presentation::ClickAction_BOOKMARK:		eStrAction = XML_SHOW; break;
402
					nFound |= FOUND_CLICKACTION;
456
		case presentation::ClickAction_DOCUMENT:		eStrAction = XML_SHOW; break;
403
			}
457
		case presentation::ClickAction_MACRO:			eStrAction = XML_EXECUTE_MACRO; break;
404
			else if( ( ( nFound & FOUND_MACRO ) == 0 ) && ( pProperties->Name == msMacroName || pProperties->Name == msScript ) )
458
		case presentation::ClickAction_VERB:			eStrAction = XML_VERB; break;
405
			{
459
		case presentation::ClickAction_VANISH:			eStrAction = XML_FADE_OUT; break;
406
				if( pProperties->Value >>= aStrMacro )
460
		case presentation::ClickAction_SOUND:			eStrAction = XML_SOUND; break;
407
					nFound |= FOUND_MACRO;
461
		default:
408
			}
462
			DBG_ERROR( "unknown presentation::ClickAction found!" );
409
			else if( ( ( nFound & FOUND_LIBRARY ) == 0 ) && pProperties->Name == msLibrary )
463
			eStrAction = XML_UNKNOWN;
410
			{
411
				if( pProperties->Value >>= aStrLibrary )
412
					nFound |= FOUND_LIBRARY;
413
			}
414
			else if( ( ( nFound & FOUND_EFFECT ) == 0 ) && pProperties->Name == msEffect )
415
			{
416
				if( pProperties->Value >>= eEffect )
417
					nFound |= FOUND_EFFECT;
418
			}
419
			else if( ( ( nFound & FOUND_BOOKMARK ) == 0 ) && pProperties->Name == msBookmark )
420
			{
421
				if( pProperties->Value >>= aStrBookmark )
422
					nFound |= FOUND_BOOKMARK;
423
			}
424
			else if( ( ( nFound & FOUND_SPEED ) == 0 ) && pProperties->Name == msSpeed )
425
			{
426
				if( pProperties->Value >>= eSpeed )
427
					nFound |= FOUND_SPEED;
428
			}
429
			else if( ( ( nFound & FOUND_SOUNDURL ) == 0 ) && pProperties->Name == msSoundURL )
430
			{
431
				if( pProperties->Value >>= aStrSoundURL )
432
					nFound |= FOUND_SOUNDURL;
433
			}
434
			else if( ( ( nFound & FOUND_PLAYFULL ) == 0 ) && pProperties->Name == msPlayFull )
435
			{
436
				if( pProperties->Value >>= bPlayFull )
437
					nFound |= FOUND_PLAYFULL;
438
			}
439
			else if( ( ( nFound & FOUND_VERB ) == 0 ) && pProperties->Name == msVerb )
440
			{
441
				if( pProperties->Value >>= nVerb )
442
					nFound |= FOUND_VERB;
443
			}
444
		}
464
		}
445
465
446
		if( ( nFound & FOUND_EVENTTYPE ) == 0 )
466
		OUString aEventQName(
447
			break;
467
			rExport.GetNamespaceMap().GetQNameByKey(
468
					XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) );
469
		rExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
470
		rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_ACTION, eStrAction );
448
471
449
		if( aStrEventType == msPresentation )
472
		if( eClickAction == presentation::ClickAction_VANISH )
450
		{
473
		{
451
			if( ( nFound & FOUND_CLICKACTION ) == 0 )
474
			if( nFound & FOUND_EFFECT )
452
				break;
475
			{
476
				XMLEffect eKind;
477
				XMLEffectDirection eDirection;
478
				sal_Int16 nStartScale;
479
				sal_Bool bIn;
453
480
454
			if( eClickAction == presentation::ClickAction_NONE )
481
				SdXMLImplSetEffect( eEffect, eKind, eDirection, nStartScale, bIn );
455
				break;
456
482
457
			SvXMLElementExport aEventsElemt(rExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
483
				if( eEffect != EK_none )
484
				{
485
					SvXMLUnitConverter::convertEnum( msBuffer, eKind, aXML_AnimationEffect_EnumMap );
486
					rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_EFFECT, msBuffer.makeStringAndClear() );
487
				}
458
488
459
			enum XMLTokenEnum eStrAction;
489
				if( eDirection != ED_none )
490
				{
491
					SvXMLUnitConverter::convertEnum( msBuffer, eDirection, aXML_AnimationDirection_EnumMap );
492
					rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_DIRECTION, msBuffer.makeStringAndClear() );
493
				}
460
494
461
			switch( eClickAction )
495
				if( nStartScale != -1 )
462
			{
496
				{
463
			case presentation::ClickAction_PREVPAGE:		eStrAction = XML_PREVIOUS_PAGE; break;
497
					SvXMLUnitConverter::convertPercent( msBuffer, nStartScale );
464
			case presentation::ClickAction_NEXTPAGE:		eStrAction = XML_NEXT_PAGE; break;
498
					rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_START_SCALE, msBuffer.makeStringAndClear() );
465
			case presentation::ClickAction_FIRSTPAGE:		eStrAction = XML_FIRST_PAGE; break;
499
				}
466
			case presentation::ClickAction_LASTPAGE:		eStrAction = XML_LAST_PAGE; break;
467
			case presentation::ClickAction_INVISIBLE:		eStrAction = XML_HIDE; break;
468
			case presentation::ClickAction_STOPPRESENTATION:eStrAction = XML_STOP; break;
469
			case presentation::ClickAction_PROGRAM:			eStrAction = XML_EXECUTE; break;
470
			case presentation::ClickAction_BOOKMARK:		eStrAction = XML_SHOW; break;
471
			case presentation::ClickAction_DOCUMENT:		eStrAction = XML_SHOW; break;
472
			case presentation::ClickAction_MACRO:			eStrAction = XML_EXECUTE_MACRO; break;
473
			case presentation::ClickAction_VERB:			eStrAction = XML_VERB; break;
474
			case presentation::ClickAction_VANISH:			eStrAction = XML_FADE_OUT; break;
475
			case presentation::ClickAction_SOUND:			eStrAction = XML_SOUND; break;
476
			default:
477
				DBG_ERROR( "unknown presentation::ClickAction found!" );
478
				eStrAction = XML_UNKNOWN;
479
			}
500
			}
480
501
481
			OUString aEventQName(
502
			if( nFound & FOUND_SPEED && eEffect != presentation::AnimationEffect_NONE )
482
				rExport.GetNamespaceMap().GetQNameByKey(
483
						XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) );
484
			rExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
485
			rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_ACTION, eStrAction );
486
487
			if( eClickAction == presentation::ClickAction_VANISH )
488
			{
503
			{
489
				if( nFound & FOUND_EFFECT )
504
				if( eSpeed != presentation::AnimationSpeed_MEDIUM )
490
				{
505
				{
491
					XMLEffect eKind;
506
					SvXMLUnitConverter::convertEnum( msBuffer, eSpeed, aXML_AnimationSpeed_EnumMap );
492
					XMLEffectDirection eDirection;
507
					rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SPEED, msBuffer.makeStringAndClear() );
493
					sal_Int16 nStartScale;
508
				}
494
					sal_Bool bIn;
509
			}
495
510
		}
496
					SdXMLImplSetEffect( eEffect, eKind, eDirection, nStartScale, bIn );
497
511
498
					if( eEffect != EK_none )
512
		if( eClickAction == presentation::ClickAction_PROGRAM ||
499
					{
513
			eClickAction == presentation::ClickAction_BOOKMARK ||
500
						SvXMLUnitConverter::convertEnum( msBuffer, eKind, aXML_AnimationEffect_EnumMap );
514
			eClickAction == presentation::ClickAction_DOCUMENT )
501
						rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_EFFECT, msBuffer.makeStringAndClear() );
515
		{
502
					}
516
			if( eClickAction == presentation::ClickAction_BOOKMARK )
517
				msBuffer.append( sal_Unicode('#') );
503
518
504
					if( eDirection != ED_none )
519
			msBuffer.append( aStrBookmark );
505
					{
520
			rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(msBuffer.makeStringAndClear()) );
506
						SvXMLUnitConverter::convertEnum( msBuffer, eDirection, aXML_AnimationDirection_EnumMap );
521
			rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
507
						rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_DIRECTION, msBuffer.makeStringAndClear() );
522
			rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_NEW );
508
					}
523
			rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
524
		}
509
525
510
					if( nStartScale != -1 )
526
		if( ( nFound & FOUND_VERB ) && eClickAction == presentation::ClickAction_VERB )
511
					{
527
		{
512
						SvXMLUnitConverter::convertPercent( msBuffer, nStartScale );
528
			msBuffer.append( nVerb );
513
						rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_START_SCALE, msBuffer.makeStringAndClear() );
529
			rExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_VERB, msBuffer.makeStringAndClear());
514
					}
530
		}
515
				}
516
531
517
				if( nFound & FOUND_SPEED && eEffect != presentation::AnimationEffect_NONE )
532
		SvXMLElementExport aEventElemt(rExport, XML_NAMESPACE_PRESENTATION, XML_EVENT_LISTENER, sal_True, sal_True);
518
				{
519
					if( eSpeed != presentation::AnimationSpeed_MEDIUM )
520
					{
521
						SvXMLUnitConverter::convertEnum( msBuffer, eSpeed, aXML_AnimationSpeed_EnumMap );
522
						rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SPEED, msBuffer.makeStringAndClear() );
523
					}
524
				}
525
			}
526
533
527
			if( eClickAction == presentation::ClickAction_PROGRAM ||
534
		if( eClickAction == presentation::ClickAction_VANISH || eClickAction == presentation::ClickAction_SOUND )
528
				eClickAction == presentation::ClickAction_BOOKMARK ||
535
		{
529
				eClickAction == presentation::ClickAction_DOCUMENT )
536
			if( ( nFound & FOUND_SOUNDURL ) && aStrSoundURL.getLength() != 0 )
530
			{
537
			{
531
				if( eClickAction == presentation::ClickAction_BOOKMARK )
538
				rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStrSoundURL) );
532
					msBuffer.append( sal_Unicode('#') );
533
534
				msBuffer.append( aStrBookmark );
535
				rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(msBuffer.makeStringAndClear()) );
536
				rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
539
				rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
537
				rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_NEW );
540
				rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_NEW );
538
				rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
541
				rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
539
			}
542
				if( nFound & FOUND_PLAYFULL && bPlayFull )
543
					rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PLAY_FULL, XML_TRUE );
540
544
541
			if( ( nFound & FOUND_VERB ) && eClickAction == presentation::ClickAction_VERB )
545
				SvXMLElementExport aElem( rExport, XML_NAMESPACE_PRESENTATION, XML_SOUND, sal_True, sal_True );
542
			{
543
				msBuffer.append( nVerb );
544
				rExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_VERB, msBuffer.makeStringAndClear());
545
			}
546
			}
547
		}
548
	}
549
	else if( aStrEventType == msStarBasic )
550
	{
551
		if( nFound & FOUND_MACRO )
552
		{
553
			SvXMLElementExport aEventsElemt(rExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
546
554
547
			SvXMLElementExport aEventElemt(rExport, XML_NAMESPACE_PRESENTATION, XML_EVENT_LISTENER, sal_True, sal_True);
555
			rExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE, 
556
						rExport.GetNamespaceMap().GetQNameByKey(
557
						 	XML_NAMESPACE_OOO, 
558
						 	OUString( RTL_CONSTASCII_USTRINGPARAM( 
559
											"starbasic" ) ) ) );
560
			OUString aEventQName(
561
				rExport.GetNamespaceMap().GetQNameByKey(
562
						XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) );
563
			rExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
548
564
549
			if( eClickAction == presentation::ClickAction_VANISH || eClickAction == presentation::ClickAction_SOUND )
565
			if( nFound & FOUND_LIBRARY )
550
			{
566
			{
551
				if( ( nFound & FOUND_SOUNDURL ) && aStrSoundURL.getLength() != 0 )
567
				const OUString& rApp = GetXMLToken( XML_APPLICATION );
552
				{
568
				const OUString& rDoc = GetXMLToken( XML_DOCUMENT );
553
					rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStrSoundURL) );
569
				OUString sLocation( GetXMLToken(
554
					rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
570
					(aStrLibrary.equalsIgnoreAsciiCaseAscii("StarOffice") ||
555
					rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_NEW );
571
				 	 aStrLibrary.equalsIgnoreAsciiCaseAscii("application") ) ? XML_APPLICATION
556
					rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
572
														   			   : XML_DOCUMENT ) );
557
					if( nFound & FOUND_PLAYFULL && bPlayFull )
573
				OUStringBuffer sTmp( sLocation.getLength() + aStrMacro.getLength() + 1 );
558
						rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PLAY_FULL, XML_TRUE );
574
				sTmp = sLocation;
559
575
				sTmp.append( sal_Unicode( ':' ) );
560
					SvXMLElementExport aElem( rExport, XML_NAMESPACE_PRESENTATION, XML_SOUND, sal_True, sal_True );
576
				sTmp.append( aStrMacro );
561
				}
577
				rExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_MACRO_NAME,
578
									 sTmp.makeStringAndClear());
562
			}
579
			}
563
			break;
580
			else
581
			{
582
				rExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_MACRO_NAME, aStrMacro );
583
			}
584
585
586
			SvXMLElementExport aEventElemt(rExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
564
		}
587
		}
565
		else if( aStrEventType == msStarBasic )
588
	}
589
	else if( aStrEventType == msScript || aStrEventType == msAction )
590
	{
591
		if( nFound & ( FOUND_MACRO | FOUND_ACTION ) )
566
		{
592
		{
567
			if( nFound & FOUND_MACRO )
593
			SvXMLElementExport aEventsElemt(rExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
594
			if ( nFound & FOUND_MACRO )
568
			{
595
			{
569
				SvXMLElementExport aEventsElemt(rExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
596
				rExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE, rExport.GetNamespaceMap().GetQNameByKey(
570
597
						 XML_NAMESPACE_OOO, GetXMLToken(XML_SCRIPT) ) );
571
				rExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE, 
572
							rExport.GetNamespaceMap().GetQNameByKey(
573
							 	XML_NAMESPACE_OOO, 
574
							 	OUString( RTL_CONSTASCII_USTRINGPARAM( 
575
												"starbasic" ) ) ) );
576
				OUString aEventQName(
598
				OUString aEventQName(
577
					rExport.GetNamespaceMap().GetQNameByKey(
599
					rExport.GetNamespaceMap().GetQNameByKey(
578
							XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) );
600
							XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) );
579
				rExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
601
				rExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
580
602
				rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aStrMacro );
581
				if( nFound & FOUND_LIBRARY )
582
				{
583
					const OUString& rApp = GetXMLToken( XML_APPLICATION );
584
					const OUString& rDoc = GetXMLToken( XML_DOCUMENT );
585
					OUString sLocation( GetXMLToken(
586
						(aStrLibrary.equalsIgnoreAsciiCaseAscii("StarOffice") ||
587
					 	 aStrLibrary.equalsIgnoreAsciiCaseAscii("application") ) ? XML_APPLICATION
588
															   			   : XML_DOCUMENT ) );
589
					OUStringBuffer sTmp( sLocation.getLength() + aStrMacro.getLength() + 1 );
590
					sTmp = sLocation;
591
					sTmp.append( sal_Unicode( ':' ) );
592
					sTmp.append( aStrMacro );
593
					rExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_MACRO_NAME,
594
										 sTmp.makeStringAndClear());
595
				}
596
				else
597
				{
598
					rExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_MACRO_NAME, aStrMacro );
599
				}
600
601
603
602
				SvXMLElementExport aEventElemt(rExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
604
				SvXMLElementExport aEventElemt(rExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
603
			}
605
			}
604
		}
606
			if ( nFound & FOUND_ACTION )
605
		else if( aStrEventType == msScript )
606
		{
607
			if( nFound & FOUND_MACRO )
608
			{
607
			{
609
				SvXMLElementExport aEventsElemt(rExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
610
611
				rExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE, rExport.GetNamespaceMap().GetQNameByKey(
608
				rExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE, rExport.GetNamespaceMap().GetQNameByKey(
612
							 XML_NAMESPACE_OOO, GetXMLToken(XML_SCRIPT) ) );
609
						 XML_NAMESPACE_OOO, GetXMLToken(XML_SCRIPT) ) );
613
				OUString aEventQName(
610
				OUString aEventQName(
614
					rExport.GetNamespaceMap().GetQNameByKey(
611
					rExport.GetNamespaceMap().GetQNameByKey(
615
							XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) );
612
							XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "action" ) ) ) );
616
				rExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
613
				rExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
617
				rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aStrMacro );
614
				rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aHyperURL );
618
615
619
				SvXMLElementExport aEventElemt(rExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
616
				SvXMLElementExport aEventElemt(rExport, XML_NAMESPACE_DRAW, XML_EVENT_LISTENER, sal_True, sal_True);
620
			}
617
			}
621
		}
618
		}
622
	}
619
	}
620
}
621
622
void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& xShape )
623
{
624
	do
625
	{
626
		uno::Reference< document::XEventsSupplier > xEventsSupplier( xShape, uno::UNO_QUERY );
627
		if( !xEventsSupplier.is() )
628
			break;
629
630
		uno::Reference< container::XNameReplace > xEvents( xEventsSupplier->getEvents() );
631
		DBG_ASSERT( xEvents.is(), "XEventsSupplier::getEvents() returned NULL" );
632
		if( !xEvents.is() )
633
			break;
634
635
		static uno::Sequence< OUString > aEvents = xEvents->getElementNames();
636
		const OUString* pEvt = aEvents.getConstArray();
637
		const OUString* pEnd = aEvents.getConstArray() + aEvents.getLength();
638
639
		for ( ; pEvt != pEnd; ++pEvt )
640
		{
641
			uno::Sequence< beans::PropertyValue > aProperties;
642
			if( !xEvents->hasByName( *pEvt ) )
643
				break;
644
645
			if( !(xEvents->getByName( *pEvt ) >>= aProperties) )
646
				break;
647
			const beans::PropertyValue* pProperties = aProperties.getConstArray();
648
			const sal_Int32 nCount = aProperties.getLength();
649
			ImpExportEvents( pProperties, nCount );
650
		}
651
652
	}
623
	while(0);
653
	while(0);
624
}
654
}
625
655
(-)/data4/sles/ooo-buildNow/ooo-build/build/ooc680-m5/xmloff/source/draw/shapeexport.cxx (+3 lines)
Lines 158-163 XMLShapeExport::XMLShapeExport(SvXMLExpo Link Here
158
	msStartShape( RTL_CONSTASCII_USTRINGPARAM("StartShape") ),
158
	msStartShape( RTL_CONSTASCII_USTRINGPARAM("StartShape") ),
159
	msEndShape( RTL_CONSTASCII_USTRINGPARAM("EndShape") ),
159
	msEndShape( RTL_CONSTASCII_USTRINGPARAM("EndShape") ),
160
	msOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ),
160
	msOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ),
161
	msOnAction( RTL_CONSTASCII_USTRINGPARAM("OnAction") ),
162
	msAction( RTL_CONSTASCII_USTRINGPARAM("Action") ),
163
	msURL( RTL_CONSTASCII_USTRINGPARAM("URL") ),
161
	msEventType( RTL_CONSTASCII_USTRINGPARAM("EventType") ),
164
	msEventType( RTL_CONSTASCII_USTRINGPARAM("EventType") ),
162
	msPresentation( RTL_CONSTASCII_USTRINGPARAM("Presentation") ),
165
	msPresentation( RTL_CONSTASCII_USTRINGPARAM("Presentation") ),
163
	msMacroName( RTL_CONSTASCII_USTRINGPARAM("MacroName") ),
166
	msMacroName( RTL_CONSTASCII_USTRINGPARAM("MacroName") ),

Return to issue 66550