xref: /aoo42x/main/xmloff/source/draw/eventimp.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_xmloff.hxx"
30 
31 #include <tools/debug.hxx>
32 #include <com/sun/star/document/XEventsSupplier.hpp>
33 #include <com/sun/star/container/XNameReplace.hpp>
34 #include <com/sun/star/presentation/AnimationSpeed.hpp>
35 #include <com/sun/star/beans/XPropertySet.hpp>
36 #include <com/sun/star/xml/sax/XAttributeList.hpp>
37 #include <com/sun/star/presentation/ClickAction.hpp>
38 #include <tools/urlobj.hxx>
39 #include <comphelper/extract.hxx>
40 #include <xmloff/xmltoken.hxx>
41 #include <xmloff/xmlimp.hxx>
42 #include "xmloff/xmlnmspe.hxx"
43 #include <xmloff/xmluconv.hxx>
44 #include <xmloff/nmspmap.hxx>
45 #include "eventimp.hxx"
46 #include "anim.hxx"
47 
48 using ::rtl::OUString;
49 using ::rtl::OUStringBuffer;
50 
51 using namespace ::std;
52 using namespace ::cppu;
53 using namespace ::com::sun::star;
54 using namespace ::com::sun::star::xml;
55 using namespace ::com::sun::star::xml::sax;
56 using namespace ::com::sun::star::uno;
57 using namespace ::com::sun::star::drawing;
58 using namespace ::com::sun::star::beans;
59 using namespace ::com::sun::star::lang;
60 using namespace ::com::sun::star::document;
61 using namespace ::com::sun::star::container;
62 using namespace ::com::sun::star::presentation;
63 using namespace ::xmloff::token;
64 
65 ///////////////////////////////////////////////////////////////////////
66 
67 SvXMLEnumMapEntry __READONLY_DATA aXML_EventActions_EnumMap[] =
68 {
69 	{ XML_NONE,			    ClickAction_NONE	},
70 	{ XML_PREVIOUS_PAGE,	ClickAction_PREVPAGE },
71 	{ XML_NEXT_PAGE,		ClickAction_NEXTPAGE },
72 	{ XML_FIRST_PAGE,		ClickAction_FIRSTPAGE },
73 	{ XML_LAST_PAGE,		ClickAction_LASTPAGE },
74 	{ XML_HIDE,			    ClickAction_INVISIBLE },
75 	{ XML_STOP,			    ClickAction_STOPPRESENTATION },
76 	{ XML_EXECUTE,			ClickAction_PROGRAM },
77 	{ XML_SHOW,			    ClickAction_BOOKMARK },
78 	{ XML_SHOW,			    ClickAction_DOCUMENT },
79 	{ XML_EXECUTE_MACRO,	ClickAction_MACRO },
80 	{ XML_VERB,			    ClickAction_VERB },
81 	{ XML_FADE_OUT,		    ClickAction_VANISH },
82 	{ XML_SOUND,			ClickAction_SOUND },
83 	{ XML_TOKEN_INVALID, 0 }
84 };
85 
86 ///////////////////////////////////////////////////////////////////////
87 
88 class SdXMLEventContext : public SvXMLImportContext
89 {
90 private:
91 	com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape;
92 
93 public:
94 	TYPEINFO();
95 
96 	SdXMLEventContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList, const Reference< XShape >& rxShape );
97 	virtual ~SdXMLEventContext();
98 
99 	virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName,	const Reference< XAttributeList>& xAttrList );
100 	virtual void EndElement();
101 
102 	sal_Bool mbValid;
103 	sal_Bool mbScript;
104 #ifdef ISSUE66550_HLINK_FOR_SHAPES
105     sal_Bool mbActionEvent;
106 #endif
107 	ClickAction meClickAction;
108 	XMLEffect meEffect;
109 	XMLEffectDirection meDirection;
110 	sal_Int16 mnStartScale;
111 	AnimationSpeed meSpeed;
112 	sal_Int32 mnVerb;
113 	OUString msSoundURL;
114 	sal_Bool mbPlayFull;
115 	OUString msMacroName;
116 	OUString msBookmark;
117 	OUString msLanguage;
118 #ifdef ISSUE66550_HLINK_FOR_SHAPES
119     OUString msHyperURL;
120 #endif
121 };
122 
123 ///////////////////////////////////////////////////////////////////////
124 
125 class XMLEventSoundContext : public SvXMLImportContext
126 {
127 	SdXMLEventContext*	mpParent;
128 
129 public:
130 	TYPEINFO();
131 
132 	XMLEventSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, SdXMLEventContext* pParent );
133 	virtual ~XMLEventSoundContext();
134 };
135 
136 TYPEINIT1( XMLEventSoundContext, SvXMLImportContext );
137 
138 XMLEventSoundContext::XMLEventSoundContext( SvXMLImport& rImp, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, SdXMLEventContext* pParent )
139 : SvXMLImportContext( rImp, nPrfx, rLocalName ), mpParent( pParent )
140 {
141 	if( mpParent && nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_SOUND ) )
142 	{
143 		const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
144 		for(sal_Int16 i=0; i < nAttrCount; i++)
145 		{
146 			OUString sAttrName = xAttrList->getNameByIndex( i );
147 			OUString aAttrLocalName;
148 			sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aAttrLocalName );
149 			OUString sValue = xAttrList->getValueByIndex( i );
150 
151 			switch( nAttrPrefix )
152 			{
153 			case XML_NAMESPACE_XLINK:
154 				if( IsXMLToken( aAttrLocalName, XML_HREF ) )
155 				{
156 					mpParent->msSoundURL = rImp.GetAbsoluteReference(sValue);
157 				}
158 				break;
159 			case XML_NAMESPACE_PRESENTATION:
160 				if( IsXMLToken( aAttrLocalName, XML_PLAY_FULL ) )
161 				{
162 					mpParent->mbPlayFull = IsXMLToken( sValue, XML_TRUE );
163 				}
164 			}
165 		}
166 	}
167 }
168 
169 XMLEventSoundContext::~XMLEventSoundContext()
170 {
171 }
172 
173 ///////////////////////////////////////////////////////////////////////
174 
175 TYPEINIT1( SdXMLEventContext, SvXMLImportContext );
176 
177 SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp,  sal_uInt16 nPrfx, const OUString& rLocalName,  const Reference< XAttributeList >& xAttrList, const Reference< XShape >& rxShape )
178 :	SvXMLImportContext(rImp, nPrfx, rLocalName),
179 #ifdef ISSUE66550_HLINK_FOR_SHAPES
180     mxShape( rxShape ), mbScript( sal_False ), mbActionEvent( sal_False ), meClickAction( ClickAction_NONE ),
181 #else
182     mxShape( rxShape ), mbScript( sal_False ), meClickAction( ClickAction_NONE ),
183 #endif
184 	meEffect( EK_none ), meDirection( ED_none ), mnStartScale( 100 ),
185 	meSpeed( AnimationSpeed_MEDIUM ), mnVerb(0), mbPlayFull( sal_False )
186 {
187     static const OUString sXMLClickName( RTL_CONSTASCII_USTRINGPARAM( "click" ) );
188 #ifdef ISSUE66550_HLINK_FOR_SHAPES
189     static const OUString sXMLActionName( RTL_CONSTASCII_USTRINGPARAM( "action" ) );
190 #endif
191 
192     if( nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_EVENT_LISTENER ) )
193 	{
194 		mbValid = sal_True;
195 	}
196 	else if( nPrfx == XML_NAMESPACE_SCRIPT && IsXMLToken( rLocalName, XML_EVENT_LISTENER ) )
197 	{
198         mbScript = sal_True;
199 		mbValid = sal_True;
200 	}
201 	else
202 	{
203 		return;
204 	}
205 
206 	// read attributes
207 	OUString sEventName;
208 	const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
209 	for(sal_Int16 i=0; (i < nAttrCount) && mbValid; i++)
210 	{
211 		OUString sAttrName = xAttrList->getNameByIndex( i );
212 		OUString aAttrLocalName;
213 		sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aAttrLocalName );
214 		OUString sValue = xAttrList->getValueByIndex( i );
215 
216 		switch( nAttrPrefix )
217 		{
218 		case XML_NAMESPACE_PRESENTATION:
219 			if( IsXMLToken( aAttrLocalName, XML_ACTION ) )
220 			{
221 				sal_uInt16 eEnum;
222 				if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_EventActions_EnumMap ) )
223 					meClickAction = (ClickAction)eEnum;
224 			}
225 			if( IsXMLToken( aAttrLocalName, XML_EFFECT ) )
226 			{
227 				sal_uInt16 eEnum;
228 				if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationEffect_EnumMap ) )
229 					meEffect = (XMLEffect)eEnum;
230 			}
231 			else if( IsXMLToken( aAttrLocalName, XML_DIRECTION ) )
232 			{
233 				sal_uInt16 eEnum;
234 				if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationDirection_EnumMap ) )
235 					meDirection = (XMLEffectDirection)eEnum;
236 			}
237 			else if( IsXMLToken( aAttrLocalName, XML_START_SCALE ) )
238 			{
239 				sal_Int32 nScale;
240 				if( SvXMLUnitConverter::convertPercent( nScale, sValue ) )
241 					mnStartScale = (sal_Int16)nScale;
242 			}
243 			else if( IsXMLToken( aAttrLocalName, XML_SPEED ) )
244 			{
245 				sal_uInt16 eEnum;
246 				if( SvXMLUnitConverter::convertEnum( eEnum, sValue, aXML_AnimationSpeed_EnumMap ) )
247 					meSpeed = (AnimationSpeed)eEnum;
248 			}
249 			else if( IsXMLToken( aAttrLocalName, XML_VERB ) )
250 			{
251 				SvXMLUnitConverter::convertNumber( mnVerb, sValue );
252 			}
253 			break;
254 
255 		case XML_NAMESPACE_SCRIPT:
256 			if( IsXMLToken( aAttrLocalName, XML_EVENT_NAME ) )
257 			{
258 				sEventName = sValue;
259 				sal_uInt16 nScriptPrefix =
260 					GetImport().GetNamespaceMap().GetKeyByAttrName( sValue, &sEventName );
261 #ifdef ISSUE66550_HLINK_FOR_SHAPES
262                 mbValid = XML_NAMESPACE_DOM == nScriptPrefix && ( sEventName == sXMLClickName || sEventName == sXMLActionName );
263                 mbActionEvent = mbValid && (sEventName == sXMLActionName);
264 #else
265                 mbValid = XML_NAMESPACE_DOM == nScriptPrefix && sEventName == sXMLClickName;
266 #endif
267 			}
268 			else if( IsXMLToken( aAttrLocalName, XML_LANGUAGE ) )
269 			{
270 				// language is not evaluated!
271 				OUString aScriptLanguage;
272 				msLanguage = sValue;
273 				sal_uInt16 nScriptPrefix = rImp.GetNamespaceMap().
274 					GetKeyByAttrName( msLanguage, &aScriptLanguage );
275 				if( XML_NAMESPACE_OOO == nScriptPrefix )
276 					msLanguage = aScriptLanguage;
277 			}
278 			else if( IsXMLToken( aAttrLocalName, XML_MACRO_NAME ) )
279 			{
280 				msMacroName = sValue;
281 			}
282 //			else if( IsXMLToken( aLocalName, XML_LIBRARY ) )
283 //			{
284 //				msLibrary = sValue;
285 //			}
286 			break;
287 
288 		case XML_NAMESPACE_XLINK:
289 			if( IsXMLToken( aAttrLocalName, XML_HREF ) )
290 			{
291 				if ( mbScript )
292 				{
293 					msMacroName = sValue;
294 				}
295 #ifdef ISSUE66550_HLINK_FOR_SHAPES
296                 else if ( mbActionEvent )
297                 {
298                     msHyperURL = sValue;
299                 }
300 #endif
301 				else
302 				{
303 					const rtl::OUString &rTmp =
304 						rImp.GetAbsoluteReference(sValue);
305 					INetURLObject::translateToInternal( rTmp, msBookmark,
306 						INetURLObject::DECODE_UNAMBIGUOUS,
307 						RTL_TEXTENCODING_UTF8 );
308 				}
309 			}
310 			break;
311 		}
312 	}
313 
314 	if( mbValid )
315 		mbValid = sEventName.getLength() != 0;
316 }
317 
318 SdXMLEventContext::~SdXMLEventContext()
319 {
320 }
321 
322 SvXMLImportContext * SdXMLEventContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList )
323 {
324 	return new XMLEventSoundContext( GetImport(), nPrefix, rLocalName, xAttrList, this );
325 }
326 
327 void SdXMLEventContext::EndElement()
328 {
329     if( !mbValid )
330         return;
331 
332     do
333     {
334         Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY );
335         if( !xEventsSupplier.is() )
336             break;
337 
338         Reference< XNameReplace > xEvents( xEventsSupplier->getEvents() );
339         DBG_ASSERT( xEvents.is(), "XEventsSupplier::getEvents() returned NULL" );
340         if( !xEvents.is() )
341             break;
342 
343         OUString sAPIEventName;
344         uno::Sequence< beans::PropertyValue > aProperties;
345 
346 #ifdef ISSUE66550_HLINK_FOR_SHAPES
347         if( mbActionEvent )
348         {
349             sAPIEventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "OnAction" ) );
350             aProperties.realloc( 2 );
351             beans::PropertyValue* pProperty = aProperties.getArray();
352 
353             pProperty->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
354             pProperty->Handle = -1;
355             pProperty->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "Action" ) );
356             pProperty->State = beans::PropertyState_DIRECT_VALUE;
357             ++pProperty;
358             pProperty->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
359             pProperty->Handle = -1;
360             pProperty->Value <<= msHyperURL;
361             pProperty->State = beans::PropertyState_DIRECT_VALUE;
362         }
363         else
364 #endif
365         {
366             sAPIEventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) );
367 
368             if( mbScript )
369                 meClickAction = ClickAction_MACRO;
370 
371             sal_Int32 nPropertyCount = 2;
372             switch( meClickAction )
373             {
374                 case ClickAction_NONE:
375                 case ClickAction_PREVPAGE:
376                 case ClickAction_NEXTPAGE:
377                 case ClickAction_FIRSTPAGE:
378                 case ClickAction_LASTPAGE:
379                 case ClickAction_INVISIBLE:
380                 case ClickAction_STOPPRESENTATION:
381                     break;
382                 case ClickAction_PROGRAM:
383                 case ClickAction_VERB:
384                 case ClickAction_BOOKMARK:
385                 case ClickAction_DOCUMENT:
386                     nPropertyCount += 1;
387                     break;
388                 case ClickAction_MACRO:
389                     if ( msLanguage.equalsIgnoreAsciiCaseAscii("starbasic") )
390                         nPropertyCount += 1;
391                     break;
392 
393                 case ClickAction_SOUND:
394                     nPropertyCount += 2;
395                     break;
396 
397                 case ClickAction_VANISH:
398                     nPropertyCount += 4;
399                     break;
400                 default:
401                     break;
402             }
403 
404             aProperties.realloc( nPropertyCount );
405             beans::PropertyValue* pProperties = aProperties.getArray();
406 
407             if( ClickAction_MACRO == meClickAction )
408             {
409                 if ( msLanguage.equalsIgnoreAsciiCaseAscii("starbasic") )
410                 {
411                     OUString sLibrary;
412                     const OUString& rApp = GetXMLToken( XML_APPLICATION );
413                     const OUString& rDoc = GetXMLToken( XML_DOCUMENT );
414                     if( msMacroName.getLength() > rApp.getLength()+1 &&
415                         msMacroName.copy(0,rApp.getLength()).equalsIgnoreAsciiCase( rApp ) &&
416                         ':' == msMacroName[rApp.getLength()] )
417                     {
418                         sLibrary = OUString(RTL_CONSTASCII_USTRINGPARAM("StarOffice"));
419                         msMacroName = msMacroName.copy( rApp.getLength()+1 );
420                     }
421                     else if( msMacroName.getLength() > rDoc.getLength()+1 &&
422                         msMacroName.copy(0,rDoc.getLength()).equalsIgnoreAsciiCase( rDoc ) &&
423                         ':' == msMacroName[rDoc.getLength()] )
424                     {
425                         sLibrary = rDoc;
426                         msMacroName = msMacroName.copy( rDoc.getLength()+1 );
427                     }
428 
429                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
430                     pProperties->Handle = -1;
431                     pProperties->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("StarBasic") );
432                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
433                     pProperties++;
434 
435                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "MacroName" ) );
436                     pProperties->Handle = -1;
437                     pProperties->Value <<= msMacroName;
438                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
439                     pProperties++;
440 
441                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Library" ) );
442                     pProperties->Handle = -1;
443                     pProperties->Value <<= sLibrary;
444                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
445                 }
446                 else
447                 {
448                     pProperties->Name =
449                         OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
450                     pProperties->Handle = -1;
451                     pProperties->Value <<= OUString(
452                         RTL_CONSTASCII_USTRINGPARAM("Script") );
453                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
454                     pProperties++;
455 
456                     pProperties->Name = OUString(
457                         RTL_CONSTASCII_USTRINGPARAM( "Script" ) );
458                     pProperties->Handle = -1;
459                     pProperties->Value <<= msMacroName;
460                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
461                 }
462             }
463             else
464             {
465                 pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
466                 pProperties->Handle = -1;
467                 pProperties->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("Presentation") );
468                 pProperties->State = beans::PropertyState_DIRECT_VALUE;
469                 pProperties++;
470 
471                 // ClickAction_BOOKMARK and ClickAction_DOCUMENT share the same xml event
472                 // so check here if its realy a bookmark or maybe a document
473                 if( meClickAction == ClickAction_BOOKMARK )
474                 {
475                     if( msBookmark.compareToAscii( "#", 1 ) != 0 )
476                         meClickAction = ClickAction_DOCUMENT;
477                 }
478 
479                 pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("ClickAction") );
480                 pProperties->Handle = -1;
481                 pProperties->Value <<= meClickAction;
482                 pProperties->State = beans::PropertyState_DIRECT_VALUE;
483                 pProperties++;
484 
485                 switch( meClickAction )
486                 {
487                 case ClickAction_NONE:
488                 case ClickAction_PREVPAGE:
489                 case ClickAction_NEXTPAGE:
490                 case ClickAction_FIRSTPAGE:
491                 case ClickAction_LASTPAGE:
492                 case ClickAction_INVISIBLE:
493                 case ClickAction_STOPPRESENTATION:
494                     break;
495 
496                 case ClickAction_BOOKMARK:
497                     msBookmark = msBookmark.copy(1);
498 
499                     // Note: no break here!!!
500 
501                 case ClickAction_DOCUMENT:
502                 case ClickAction_PROGRAM:
503                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Bookmark") );
504                     pProperties->Handle = -1;
505                     pProperties->Value <<= msBookmark;
506                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
507                     break;
508 
509                 case ClickAction_VANISH:
510                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Effect") );
511                     pProperties->Handle = -1;
512                     pProperties->Value <<= ImplSdXMLgetEffect( meEffect, meDirection, mnStartScale, sal_True );
513                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
514                     pProperties++;
515 
516                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Speed") );
517                     pProperties->Handle = -1;
518                     pProperties->Value <<= meSpeed;
519                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
520                     pProperties++;
521 
522                     // NOTE: no break here!!!
523 
524                 case ClickAction_SOUND:
525                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("SoundURL") );
526                     pProperties->Handle = -1;
527                     pProperties->Value <<= msSoundURL;
528                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
529                     pProperties++;
530 
531                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("PlayFull") );
532                     pProperties->Handle = -1;
533                     pProperties->Value = ::cppu::bool2any(mbPlayFull);
534                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
535                     break;
536 
537                 case ClickAction_VERB:
538                     pProperties->Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Verb") );
539                     pProperties->Handle = -1;
540                     pProperties->Value <<= mnVerb;
541                     pProperties->State = beans::PropertyState_DIRECT_VALUE;
542                     break;
543                 case ClickAction_MACRO:
544                     DBG_ERROR("xmloff::SdXMLEventContext::EndElement(), ClickAction_MACRO must be handled in different if case");
545                     break;
546                 default:
547                     break;
548                 }
549             }
550         }
551 
552         xEvents->replaceByName( sAPIEventName, uno::Any( aProperties ) );
553 
554     } while(0);
555 }
556 
557 ///////////////////////////////////////////////////////////////////////
558 
559 TYPEINIT1( SdXMLEventsContext, SvXMLImportContext );
560 
561 SdXMLEventsContext::SdXMLEventsContext( SvXMLImport& rImport, sal_uInt16 nPrfx,	const OUString& rLocalName,
562 		const Reference< XAttributeList>&, const Reference< XShape >& rxShape)
563 : SvXMLImportContext(rImport, nPrfx, rLocalName), mxShape( rxShape )
564 {
565 }
566 
567 SdXMLEventsContext::~SdXMLEventsContext()
568 {
569 }
570 
571 SvXMLImportContext * SdXMLEventsContext::CreateChildContext( sal_uInt16 nPrfx, const ::rtl::OUString& rLocalName,
572 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
573 {
574 	return new SdXMLEventContext( GetImport(), nPrfx, rLocalName,  xAttrList, mxShape );
575 }
576