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