xref: /aoo42x/main/sd/source/ui/unoidl/unoobj.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_sd.hxx"
30 
31 #include <com/sun/star/style/XStyle.hpp>
32 #include <com/sun/star/presentation/ClickAction.hpp>
33 #include <com/sun/star/beans/PropertyAttribute.hpp>
34 #include <com/sun/star/text/XText.hpp>
35 #include <com/sun/star/beans/PropertyState.hpp>
36 #include <com/sun/star/beans/PropertyValues.hpp>
37 #include <rtl/ustrbuf.hxx>
38 #include <comphelper/stl_types.hxx>
39 #include <vos/mutex.hxx>
40 #include <svl/itemprop.hxx>
41 #include <svl/style.hxx>
42 #include <svx/svdpool.hxx>
43 #include <sfx2/viewfrm.hxx>
44 #include <sfx2/app.hxx>
45 #include <svtools/unoimap.hxx>
46 #include <svtools/unoevent.hxx>
47 #include <sfx2/bindings.hxx>
48 #include <sfx2/sfxsids.hrc>
49 #include <comphelper/extract.hxx>
50 #include <svx/unoprov.hxx>
51 #include <svx/unoshape.hxx>
52 #include <svx/svditer.hxx>
53 #include <svx/svdotext.hxx>
54 #include <svx/unoapi.hxx>
55 #include <svx/svdopath.hxx>
56 #include <svx/svdoole2.hxx>
57 #include <svx/svdograf.hxx>
58 #include <editeng/outlobj.hxx>
59 #include "CustomAnimationPreset.hxx"
60 #include "Outliner.hxx"
61 #include "sdresid.hxx"
62 #include <comphelper/serviceinfohelper.hxx>
63 
64 #include "anminfo.hxx"
65 #include "unohelp.hxx"
66 #include "unoobj.hxx"
67 #include "unoprnms.hxx"
68 #include "unomodel.hxx"
69 #include "drawdoc.hxx"
70 #include "sdpage.hxx"
71 #include "ViewShell.hxx"
72 #include "unokywds.hxx"
73 #include "unopage.hxx"
74 #ifndef SVX_LIGHT
75 #ifndef SD_DRAW_DOC_SHELL_HXX
76 #include "DrawDocShell.hxx"
77 #endif
78 #endif
79 #include "helpids.h"
80 #include "glob.hxx"
81 #include "glob.hrc"
82 #include "unolayer.hxx"
83 #include "imapinfo.hxx"
84 #include "EffectMigration.hxx"
85 
86 #ifndef SEQTYPE
87  #if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)
88   #define SEQTYPE(x) (new ::com::sun::star::uno::Type( x ))
89  #else
90   #define SEQTYPE(x) &(x)
91  #endif
92 #endif
93 
94 using ::rtl::OUString;
95 using ::rtl::OUStringBuffer;
96 using namespace ::vos;
97 using namespace ::sd;
98 using namespace ::com::sun::star;
99 using namespace ::com::sun::star::presentation;
100 using namespace ::com::sun::star::animations;
101 
102 using ::com::sun::star::uno::makeAny;
103 using ::com::sun::star::uno::Any;
104 using ::com::sun::star::uno::Reference;
105 using ::com::sun::star::drawing::XShape;
106 
107 extern OUString getPageApiNameFromUiName( const String& rUIName );
108 extern String getUiNameFromPageApiNameImpl( const ::rtl::OUString& rApiName );
109 
110 ///////////////////////////////////////////////////////////////////////
111 
112 DECLARE_STL_STDKEY_MAP(sal_uIntPtr, SfxExtItemPropertySetInfo*, SdExtPropertySetInfoCache);
113 static SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache;
114 static SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache;
115 
116 DECLARE_STL_STDKEY_MAP(sal_uInt32, uno::Sequence< uno::Type >*, SdTypesCache);
117 static SdTypesCache gImplTypesCache;
118 
119 ///////////////////////////////////////////////////////////////////////
120 
121 
122 #define WID_EFFECT			1
123 #define WID_SPEED			2
124 #define WID_TEXTEFFECT		3
125 #define WID_BOOKMARK		4
126 #define WID_CLICKACTION		5
127 #define WID_PLAYFULL		6
128 #define WID_SOUNDFILE		7
129 #define WID_SOUNDON			8
130 #define WID_BLUESCREEN		9
131 #define WID_VERB			10
132 #define WID_DIMCOLOR		11
133 #define WID_DIMHIDE			12
134 #define WID_DIMPREV			13
135 #define WID_PRESORDER		14
136 #define WID_STYLE			15
137 #define WID_ANIMPATH		16
138 #define WID_IMAGEMAP		17
139 #define WID_ISANIMATION		18
140 
141 #define WID_ISEMPTYPRESOBJ	20
142 #define WID_ISPRESOBJ		21
143 #define WID_MASTERDEPEND	22
144 
145 #define WID_NAVORDER		23
146 
147 #define WID_THAT_NEED_ANIMINFO 19
148 
149 
150 
151         #define IMPRESS_MAP_ENTRIES \
152         { MAP_CHAR_LEN(UNO_NAME_OBJ_ANIMATIONPATH),	WID_ANIMPATH,		 &ITYPE(drawing::XShape),									0, 0},\
153 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_BOOKMARK),		WID_BOOKMARK,		 &::getCppuType((const OUString*)0),						0, 0},\
154 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_DIMCOLOR),		WID_DIMCOLOR,		 &::getCppuType((const sal_Int32*)0),						0, 0},\
155 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_DIMHIDE),		WID_DIMHIDE,		 &::getBooleanCppuType(),									0, 0},\
156 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_DIMPREV),		WID_DIMPREV,		 &::getBooleanCppuType(),									0, 0},\
157 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_EFFECT),		WID_EFFECT,			 &::getCppuType((const presentation::AnimationEffect*)0),	0, 0},\
158 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_ISEMPTYPRESOBJ),WID_ISEMPTYPRESOBJ,  &::getBooleanCppuType(),									0, 0},\
159 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_ISPRESOBJ),		WID_ISPRESOBJ,		 &::getBooleanCppuType(),								    ::com::sun::star::beans::PropertyAttribute::READONLY, 0},\
160 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_MASTERDEPENDENT),WID_MASTERDEPEND,	 &::getBooleanCppuType(),								    0, 0},\
161 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_CLICKACTION),	WID_CLICKACTION,	 &::getCppuType((const presentation::ClickAction*)0),		0, 0},\
162 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_PLAYFULL),		WID_PLAYFULL,		 &::getBooleanCppuType(),									0, 0},\
163 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_PRESORDER),		WID_PRESORDER,		 &::getCppuType((const sal_Int32*)0),						0, 0},\
164 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_STYLE),			WID_STYLE,			 &ITYPE( style::XStyle),									::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},\
165 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_SOUNDFILE),		WID_SOUNDFILE,		 &::getCppuType((const OUString*)0),						0, 0},\
166 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_SOUNDON),		WID_SOUNDON,		 &::getBooleanCppuType(),									0, 0},\
167 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_SPEED),			WID_SPEED,			 &::getCppuType((const presentation::AnimationSpeed*)0),	0, 0},\
168 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_TEXTEFFECT),	WID_TEXTEFFECT,		 &::getCppuType((const presentation::AnimationEffect*)0),	0, 0},\
169 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_BLUESCREEN),	WID_BLUESCREEN,		 &::getCppuType((const sal_Int32*)0),						0, 0},\
170 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_VERB),			WID_VERB,			 &::getCppuType((const sal_Int32*)0),						0, 0},\
171 		{ MAP_CHAR_LEN("IsAnimation"),				WID_ISANIMATION,	 &::getBooleanCppuType(),									0, 0},\
172 		{ MAP_CHAR_LEN("NavigationOrder"),			WID_NAVORDER,		 &::getCppuType((const sal_Int32*)0),						0, 0},\
173 		{ 0,0,0,0,0,0}
174 
175 
176     const SfxItemPropertyMapEntry* lcl_GetImpress_SdXShapePropertyGraphicMap_Impl()
177     {
178 
179         static const SfxItemPropertyMapEntry aImpress_SdXShapePropertyGraphicMap_Impl[] =
180         {
181             { MAP_CHAR_LEN("ImageMap"),				WID_IMAGEMAP,		 &::getCppuType((const uno::Reference< container::XIndexContainer >*)0),	0, 0 },
182             IMPRESS_MAP_ENTRIES
183         };
184         return aImpress_SdXShapePropertyGraphicMap_Impl;
185     }
186 
187     const SfxItemPropertyMapEntry* lcl_GetImpress_SdXShapePropertySimpleMap_Impl()
188     {
189 
190         static const SfxItemPropertyMapEntry aImpress_SdXShapePropertySimpleMap_Impl[] =
191         {
192             IMPRESS_MAP_ENTRIES
193         };
194         return aImpress_SdXShapePropertySimpleMap_Impl;
195     }
196 
197 	#define DRAW_MAP_ENTRIES\
198 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_BOOKMARK),		WID_BOOKMARK,		&::getCppuType((const OUString*)0),					0, 0},\
199 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_CLICKACTION),	WID_CLICKACTION,	&::getCppuType((const presentation::ClickAction*)0),0, 0},\
200 		{ MAP_CHAR_LEN(UNO_NAME_OBJ_STYLE),			WID_STYLE,			&ITYPE(style::XStyle),								::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},\
201 		{ MAP_CHAR_LEN("NavigationOrder"),			WID_NAVORDER,		 &::getCppuType((const sal_Int32*)0),						0, 0},\
202 		{ 0,0,0,0,0,0}
203 
204     const SfxItemPropertyMapEntry* lcl_GetDraw_SdXShapePropertySimpleMap_Impl()
205     {
206         static const SfxItemPropertyMapEntry aDraw_SdXShapePropertyMap_Impl[] =
207         {
208             DRAW_MAP_ENTRIES
209         };
210         return aDraw_SdXShapePropertyMap_Impl;
211     }
212     const SfxItemPropertyMapEntry* lcl_GetDraw_SdXShapePropertyGraphicMap_Impl()
213     {
214         static const SfxItemPropertyMapEntry aDraw_SdXShapePropertyGraphicMap_Impl[] =
215         {
216             { MAP_CHAR_LEN("ImageMap"),				WID_IMAGEMAP,		 &::getCppuType((const uno::Reference< container::XIndexContainer >*)0),	0, 0 },
217             DRAW_MAP_ENTRIES
218         };
219         return aDraw_SdXShapePropertyGraphicMap_Impl;
220     }
221     const SfxItemPropertyMapEntry* lcl_ImplGetShapePropertyMap( sal_Bool bImpress, sal_Bool bGraphicObj )
222     {
223         const SfxItemPropertyMapEntry* pRet = 0;
224         if( bImpress )
225         {
226             if( bGraphicObj )
227                 pRet = lcl_GetImpress_SdXShapePropertyGraphicMap_Impl();
228             else
229                 pRet = lcl_GetImpress_SdXShapePropertySimpleMap_Impl();
230         }
231         else
232         {
233             if( bGraphicObj )
234                 pRet = lcl_GetDraw_SdXShapePropertyGraphicMap_Impl();
235             else
236                 pRet = lcl_GetDraw_SdXShapePropertySimpleMap_Impl();
237         }
238         return pRet;
239 
240     }
241     const SvxItemPropertySet* lcl_ImplGetShapePropertySet( sal_Bool bImpress, sal_Bool bGraphicObj )
242     {
243         const SvxItemPropertySet* pRet = 0;
244         if( bImpress )
245         {
246             if( bGraphicObj )
247             {
248                 static SvxItemPropertySet aImpress_SdXShapePropertyGraphicSet_Impl( lcl_GetImpress_SdXShapePropertyGraphicMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
249                 pRet = &aImpress_SdXShapePropertyGraphicSet_Impl;
250             }
251             else
252             {
253                 static SvxItemPropertySet aImpress_SdXShapePropertySet_Impl(lcl_GetImpress_SdXShapePropertySimpleMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
254                 pRet = &aImpress_SdXShapePropertySet_Impl;
255             }
256         }
257         else
258         {
259             if( bGraphicObj )
260             {
261                 static SvxItemPropertySet aDraw_SdXShapePropertyGraphicSet_Impl(lcl_GetDraw_SdXShapePropertyGraphicMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
262                 pRet = &aDraw_SdXShapePropertyGraphicSet_Impl;
263             }
264             else
265             {
266                 static SvxItemPropertySet aDraw_SdXShapePropertySet_Impl( lcl_GetDraw_SdXShapePropertySimpleMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
267                 pRet = &aDraw_SdXShapePropertySet_Impl;
268             }
269         }
270         return pRet;
271     }
272     const SfxItemPropertyMapEntry* lcl_GetEmpty_SdXShapePropertyMap_Impl()
273     {
274         static SfxItemPropertyMapEntry aEmpty_SdXShapePropertyMap_Impl[] =
275         {
276             { 0,0,0,0,0,0}
277         };
278         return aEmpty_SdXShapePropertyMap_Impl;
279     }
280 
281     static const SvxItemPropertySet* lcl_GetEmpty_SdXShapePropertySet_Impl()
282     {
283         static SvxItemPropertySet aEmptyPropSet( lcl_GetEmpty_SdXShapePropertyMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool() );
284         return &aEmptyPropSet;
285     }
286 const SvEventDescription* ImplGetSupportedMacroItems()
287 {
288 	static const SvEventDescription aMacroDescriptionsImpl[] =
289 	{
290 		{ SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
291 		{ SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
292 		{ 0, NULL }
293 	};
294 
295 	return aMacroDescriptionsImpl;
296 }
297 
298 /*************************************************************************
299 |*
300 |*    Vergleichsfkt. fuer QSort
301 |*
302 \************************************************************************/
303 struct SortStruct
304 {
305 	SdrObject*	pObj;
306 	sal_uInt32		nOrder;
307 };
308 
309 typedef SortStruct	SORT;
310 typedef SORT*		PSORT;
311 
312 extern "C" int __LOADONCALLAPI SortFunc( const void* p1, const void* p2 );
313 
314 SdXShape::SdXShape( SvxShape* pShape, SdXImpressDocument* pModel) throw()
315 :	mpShape( pShape ),
316 	mpPropSet( pModel?
317 					lcl_ImplGetShapePropertySet(pModel->IsImpressDocument(), pShape->getShapeKind() == OBJ_GRAF )
318 				:	lcl_GetEmpty_SdXShapePropertySet_Impl() ),
319 	mpMap( pModel?
320 					lcl_ImplGetShapePropertyMap(pModel->IsImpressDocument(), pShape->getShapeKind() == OBJ_GRAF )
321 				:	lcl_GetEmpty_SdXShapePropertyMap_Impl() ),
322 	mpModel(pModel),
323 	mpImplementationId( NULL )
324 
325 {
326 
327     pShape->setMaster( this );
328 }
329 
330 SdXShape::~SdXShape() throw()
331 {
332 }
333 
334 void SdXShape::dispose()
335 {
336 	mpShape->setMaster( NULL );
337 	delete this;
338 }
339 
340 // XInterface
341 uno::Any SAL_CALL SdXShape::queryAggregation( const uno::Type & rType )
342 	throw(uno::RuntimeException)
343 {
344 	return mpShape->queryAggregation( rType );
345 }
346 
347 uno::Any SAL_CALL SdXShape::queryInterface( const uno::Type & rType )
348 	throw(uno::RuntimeException)
349 {
350 	return mpShape->queryInterface( rType );
351 }
352 
353 void SAL_CALL SdXShape::acquire() throw()
354 {
355 	mpShape->acquire();
356 }
357 
358 void SAL_CALL SdXShape::release() throw()
359 {
360 	mpShape->release();
361 }
362 
363 sal_Bool SdXShape::queryAggregation( const com::sun::star::uno::Type & rType, com::sun::star::uno::Any& aAny )
364 {
365 	if( mpModel && mpModel ->IsImpressDocument() )
366 	{
367 		if( rType == ::getCppuType(( const uno::Reference< document::XEventsSupplier >*)0) )
368 		{
369 			aAny <<= uno::Reference< document::XEventsSupplier >(this);
370 			return sal_True;
371 		}
372 	}
373 
374 	return sal_False;
375 }
376 
377 uno::Sequence< uno::Type > SAL_CALL SdXShape::getTypes()
378 	throw (uno::RuntimeException)
379 {
380 	if( mpModel && !mpModel->IsImpressDocument() )
381 	{
382 		return mpShape->_getTypes();
383 	}
384 	else
385 	{
386 		const sal_uInt32 nObjId = mpShape->getShapeKind();
387 		uno::Sequence< uno::Type >* pTypes;
388 		SdTypesCache::iterator aIter( gImplTypesCache.find( nObjId ) );
389 		if( aIter == gImplTypesCache.end() )
390 		{
391 			pTypes = new uno::Sequence< uno::Type >( mpShape->_getTypes() );
392 			sal_uInt32 nCount = pTypes->getLength();
393 			pTypes->realloc( nCount+1 );
394 			(*pTypes)[nCount] = ::getCppuType((const uno::Reference< lang::XTypeProvider>*)0);
395 
396 			gImplTypesCache[ nObjId ] = pTypes;
397 		}
398 		else
399 		{
400 			// use the already computed implementation id
401 			pTypes = (*aIter).second;
402 		}
403 		return *pTypes;
404 	}
405 }
406 
407 // XPropertyState
408 beans::PropertyState SAL_CALL SdXShape::getPropertyState( const OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException)
409 {
410 	OGuard aGuard( Application::GetSolarMutex() );
411 
412 	if( mpPropSet->getPropertyMapEntry(PropertyName) )
413 	{
414 		return beans::PropertyState_DIRECT_VALUE;
415 	}
416 	else
417 	{
418 		SdrObject* pObj = mpShape->GetSdrObject();
419 		if( pObj == NULL || ( pObj->GetPage()->IsMasterPage() && pObj->IsEmptyPresObj() ) )
420 			return beans::PropertyState_DEFAULT_VALUE;
421 
422 		return mpShape->_getPropertyState( PropertyName );
423 	}
424 }
425 
426 void SAL_CALL SdXShape::setPropertyToDefault( const OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException)
427 {
428 	OGuard aGuard( Application::GetSolarMutex() );
429 
430 	if( mpPropSet->getPropertyMapEntry(PropertyName) )
431 	{
432 		return;
433 	}
434 	else
435 	{
436 		mpShape->_setPropertyToDefault(PropertyName);
437 	}
438 }
439 
440 uno::Any SAL_CALL SdXShape::getPropertyDefault( const OUString& aPropertyName ) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
441 {
442 	OGuard aGuard( Application::GetSolarMutex() );
443 
444 	if( mpPropSet->getPropertyMapEntry(aPropertyName) )
445 	{
446 		return getPropertyValue( aPropertyName );
447 	}
448 	else
449 	{
450 		uno::Any aRet( mpShape->_getPropertyDefault(aPropertyName) );
451 
452 		if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_shape_layername ) ) )
453 		{
454 			OUString aName;
455 			if( aRet >>= aName )
456 			{
457 				aName = SdLayer::convertToExternalName( aName );
458 				aRet <<= aName;
459 			}
460 		}
461 		return aRet;
462 	}
463 }
464 
465 //XPropertySet
466 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL SdXShape::getPropertySetInfo()
467 	throw(::com::sun::star::uno::RuntimeException)
468 {
469 	sal_uIntPtr nObjId = (sal_uIntPtr)mpShape->getPropertyMapEntries();
470 	SfxExtItemPropertySetInfo* pInfo = NULL;
471 
472 	SdExtPropertySetInfoCache* pCache = (mpModel && mpModel->IsImpressDocument()) ?
473 		&gImplImpressPropertySetInfoCache : &gImplDrawPropertySetInfoCache;
474 
475 	SdExtPropertySetInfoCache::iterator aIter( pCache->find( nObjId ) );
476 	if( aIter == pCache->end() )
477 	{
478 		uno::Reference< beans::XPropertySetInfo > xInfo( mpShape->_getPropertySetInfo() );
479 		pInfo = new SfxExtItemPropertySetInfo( mpMap, xInfo->getProperties() );
480 		pInfo->acquire();
481 
482 		(*pCache)[ nObjId ] = pInfo;
483 	}
484 	else
485 	{
486 		// use the already computed implementation id
487 		pInfo = (*aIter).second;
488 	}
489 
490 	uno::Reference< beans::XPropertySetInfo > xInfo( pInfo );
491 	return pInfo;
492 }
493 
494 void SAL_CALL SdXShape::setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
495 	throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
496 {
497 	OGuard aGuard( Application::GetSolarMutex() );
498 
499 	const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
500 
501 	if( pEntry )
502 	{
503 		SdrObject* pObj = mpShape->GetSdrObject();
504 		if( pObj )
505 		{
506 			SdAnimationInfo* pInfo = GetAnimationInfo((pEntry->nWID <= WID_THAT_NEED_ANIMINFO)?sal_True:sal_False);
507 
508 			switch(pEntry->nWID)
509 			{
510 				case WID_NAVORDER:
511 				{
512 					sal_Int32 nNavOrder = 0;
513 					if(!(aValue >>= nNavOrder))
514 						throw lang::IllegalArgumentException();
515 
516 					SdrObjList* pObjList = pObj->GetObjList();
517 					if( pObjList )
518 						pObjList->SetObjectNavigationPosition( *pObj, (nNavOrder < 0) ? SAL_MAX_UINT32 : static_cast< sal_uInt32 >( nNavOrder ) );
519 					break;
520 				}
521 
522 				case WID_EFFECT:
523 				{
524 					AnimationEffect	eEffect;
525 					if(!(aValue >>= eEffect))
526 						throw lang::IllegalArgumentException();
527 
528 					EffectMigration::SetAnimationEffect( mpShape, eEffect );
529 					break;
530 				}
531 				case WID_TEXTEFFECT:
532 				{
533 					AnimationEffect	eEffect;
534 					if(!(aValue >>= eEffect))
535 						throw lang::IllegalArgumentException();
536 
537 					EffectMigration::SetTextAnimationEffect( mpShape, eEffect );
538 					break;
539 				}
540 				case WID_SPEED:
541 				{
542 					AnimationSpeed eSpeed;
543 					if(!(aValue>>=eSpeed))
544 						throw lang::IllegalArgumentException();
545 
546 					EffectMigration::SetAnimationSpeed( mpShape, eSpeed );
547 					break;
548 				}
549 /* TODO??		case WID_ISANIMATION:
550 				{
551 
552 					sal_Bool bIsAnimation;
553 					if(!(aValue >>= bIsAnimation))
554 						throw lang::IllegalArgumentException();
555 
556 					pInfo->mbIsMovie = bIsAnimation;
557 					break;
558 				}
559 */
560 				case WID_BOOKMARK:
561 				{
562 					OUString aString;
563 					if(!(aValue >>= aString))
564 						throw lang::IllegalArgumentException();
565 
566 					pInfo->SetBookmark( SdDrawPage::getUiNameFromPageApiName( aString ) );
567 					break;
568 				}
569 				case WID_CLICKACTION:
570 					::cppu::any2enum< presentation::ClickAction >( pInfo->meClickAction, aValue);
571 					break;
572 
573 /* todo?
574 				case WID_PLAYFULL:
575 					pInfo->mbPlayFull = ::cppu::any2bool(aValue);
576 					break;
577 */
578 				case WID_SOUNDFILE:
579 				{
580 					OUString aString;
581 					if(!(aValue >>= aString))
582 						throw lang::IllegalArgumentException();
583 					pInfo->maSoundFile = aString;
584 					EffectMigration::UpdateSoundEffect( mpShape, pInfo );
585 					break;
586 				}
587 
588 				case WID_SOUNDON:
589 				{
590 					if( !(aValue >>= pInfo->mbSoundOn) )
591 						throw lang::IllegalArgumentException();
592 					EffectMigration::UpdateSoundEffect( mpShape, pInfo );
593 					break;
594 				}
595 /*
596 				case WID_BLUESCREEN:
597 				{
598 					sal_Int32 nColor;
599 					if(!(aValue >>= nColor))
600 						throw lang::IllegalArgumentException();
601 
602 					pInfo->maBlueScreen.SetColor( nColor );
603 					break;
604 				}
605 */
606 				case WID_VERB:
607 				{
608 					sal_Int32 nVerb = 0;
609 					if(!(aValue >>= nVerb))
610 						throw lang::IllegalArgumentException();
611 
612 					pInfo->mnVerb = (sal_uInt16)nVerb;
613 					break;
614 				}
615 				case WID_DIMCOLOR:
616 				{
617 					sal_Int32 nColor = 0;
618 
619 					if( !(aValue >>= nColor) )
620 						throw lang::IllegalArgumentException();
621 
622 					EffectMigration::SetDimColor( mpShape, nColor );
623 					break;
624 				}
625 				case WID_DIMHIDE:
626 				{
627 					sal_Bool bDimHide = sal_False;
628 					if( !(aValue >>= bDimHide) )
629 						lang::IllegalArgumentException();
630 
631 					EffectMigration::SetDimHide( mpShape, bDimHide );
632 					break;
633 				}
634 				case WID_DIMPREV:
635 				{
636 					sal_Bool bDimPrevious = sal_False;
637 					if( !(aValue >>= bDimPrevious) )
638 						lang::IllegalArgumentException();
639 
640 					EffectMigration::SetDimPrevious( mpShape, bDimPrevious );
641 					break;
642 				}
643 				case WID_PRESORDER:
644 				{
645 					sal_Int32 nNewPos = 0;
646 					if( !(aValue >>= nNewPos) )
647 						lang::IllegalArgumentException();
648 
649 					EffectMigration::SetPresentationOrder( mpShape, nNewPos );
650 					break;
651 				}
652 				case WID_STYLE:
653 					SetStyleSheet( aValue );
654 					break;
655 				case WID_ISEMPTYPRESOBJ:
656 					SetEmptyPresObj( ::cppu::any2bool(aValue) );
657 					break;
658 				case WID_MASTERDEPEND:
659 					SetMasterDepend( ::cppu::any2bool(aValue) );
660 					break;
661 				case WID_ANIMPATH:
662 				{
663 					uno::Reference< drawing::XShape > xShape( aValue, uno::UNO_QUERY );
664 					SdrPathObj* pObj2 = xShape.is() ? dynamic_cast< SdrPathObj* >( GetSdrObjectFromXShape( xShape ) ) : NULL;
665 
666 					if( pObj2 == NULL )
667 						throw lang::IllegalArgumentException();
668 
669 					EffectMigration::SetAnimationPath( mpShape, pObj2 );
670 					break;
671 				}
672 				case WID_IMAGEMAP:
673 				{
674 					SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
675 					if( pDoc )
676 					{
677 						ImageMap aImageMap;
678 						uno::Reference< uno::XInterface > xImageMap;
679 						aValue >>= xImageMap;
680 
681 						if( !xImageMap.is() || !SvUnoImageMap_fillImageMap( xImageMap, aImageMap ) )
682 							throw lang::IllegalArgumentException();
683 
684 						SdIMapInfo* pIMapInfo = pDoc->GetIMapInfo(pObj);
685 						if( pIMapInfo )
686 						{
687 							// replace existing image map
688 							pIMapInfo->SetImageMap( aImageMap );
689 						}
690 						else
691 						{
692 							// insert new user data with image map
693 							pObj->InsertUserData(new SdIMapInfo(aImageMap) );
694 						}
695 					}
696 				}
697 			}
698 		}
699 	}
700 	else
701 	{
702 		uno::Any aAny( aValue );
703 
704 		if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_shape_layername ) ) )
705 		{
706 			OUString aName;
707 			if( aAny >>= aName )
708 			{
709 				aName = SdLayer::convertToInternalName( aName );
710 				aAny <<= aName;
711 			}
712 		}
713 
714 		mpShape->_setPropertyValue(aPropertyName, aAny);
715 	}
716 
717 	if( mpModel )
718 		mpModel->SetModified();
719 }
720 
721 ::com::sun::star::uno::Any SAL_CALL SdXShape::getPropertyValue( const ::rtl::OUString& PropertyName )
722 	throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
723 {
724 	OGuard aGuard( Application::GetSolarMutex() );
725 
726 	uno::Any aRet;
727 
728 	const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
729 
730 	if( pEntry && mpShape->GetSdrObject() )
731 	{
732 		SdAnimationInfo* pInfo = GetAnimationInfo(sal_False);
733 
734 		switch(pEntry->nWID)
735 		{
736 		case WID_NAVORDER:
737 			{
738 				const sal_uInt32 nNavOrder = mpShape->GetSdrObject()->GetNavigationPosition();
739 				aRet <<= nNavOrder == SAL_MAX_UINT32 ? static_cast<sal_Int32>(-1) : static_cast< sal_Int32 >(nNavOrder);
740 			}
741 			break;
742 		case WID_EFFECT:
743 			aRet <<= EffectMigration::GetAnimationEffect( mpShape );
744 			break;
745 		case WID_TEXTEFFECT:
746 			aRet <<= EffectMigration::GetTextAnimationEffect( mpShape );
747 			break;
748 		case WID_ISPRESOBJ:
749 			aRet <<= (sal_Bool)IsPresObj();
750 			break;
751 		case WID_ISEMPTYPRESOBJ:
752 			aRet <<= (sal_Bool)IsEmptyPresObj();
753 			break;
754 		case WID_MASTERDEPEND:
755 			aRet <<= (sal_Bool)IsMasterDepend();
756 			break;
757 		case WID_SPEED:
758 			aRet <<= EffectMigration::GetAnimationSpeed( mpShape );
759 			break;
760 		case WID_ISANIMATION:
761 			aRet <<= (sal_Bool)( pInfo && pInfo->mbIsMovie);
762 			break;
763 		case WID_BOOKMARK:
764 		{
765 			OUString aString;
766 			if( pInfo )
767 			{
768 				SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
769 				// is the bookmark a page?
770 				sal_Bool bIsMasterPage;
771 				if(pDoc->GetPageByName( pInfo->GetBookmark(), bIsMasterPage ) != SDRPAGE_NOTFOUND)
772 				{
773 					aString = SdDrawPage::getPageApiNameFromUiName( pInfo->GetBookmark() );
774 				}
775 				else
776 				{
777 					aString = pInfo->GetBookmark() ;
778 					sal_Int32 nPos = aString.lastIndexOf( sal_Unicode('#') );
779 					if( nPos >= 0 )
780 					{
781 						OUString aURL( aString.copy( 0, nPos+1 ) );
782 						OUString aName( aString.copy( nPos+1 ) );
783 						if(pDoc->GetPageByName( aName, bIsMasterPage ) != SDRPAGE_NOTFOUND)
784 						{
785 							aURL += SdDrawPage::getPageApiNameFromUiName( aName );
786 							aString = aURL;
787 						}
788 					}
789 				}
790 			}
791 
792 			aRet <<= aString;
793 			break;
794 		}
795 		case WID_CLICKACTION:
796 			aRet = ::cppu::enum2any< presentation::ClickAction >( pInfo?pInfo->meClickAction:presentation::ClickAction_NONE );
797 			break;
798 		case WID_PLAYFULL:
799 			aRet <<= (sal_Bool)( pInfo && pInfo->mbPlayFull );
800 			break;
801 		case WID_SOUNDFILE:
802 			aRet <<= EffectMigration::GetSoundFile( mpShape );
803 			break;
804 		case WID_SOUNDON:
805 			aRet <<= EffectMigration::GetSoundOn( mpShape );
806 			break;
807 		case WID_BLUESCREEN:
808 			aRet <<= (sal_Int32)( pInfo?pInfo->maBlueScreen.GetColor():0x00ffffff );
809 			break;
810 		case WID_VERB:
811 			aRet <<= (sal_Int32)( pInfo?pInfo->mnVerb:0 );
812 			break;
813 		case WID_DIMCOLOR:
814 			aRet <<= EffectMigration::GetDimColor( mpShape );
815 			break;
816 		case WID_DIMHIDE:
817 			aRet <<= EffectMigration::GetDimHide( mpShape );
818 			break;
819 		case WID_DIMPREV:
820 			aRet <<= EffectMigration::GetDimPrevious( mpShape );
821 			break;
822 		case WID_PRESORDER:
823 			aRet <<= EffectMigration::GetPresentationOrder( mpShape );
824 			break;
825 		case WID_STYLE:
826 			aRet = GetStyleSheet();
827 			break;
828 		case WID_ANIMPATH:
829 			if( pInfo && pInfo->mpPathObj )
830 				aRet <<= pInfo->mpPathObj->getUnoShape();
831 			break;
832 		case WID_IMAGEMAP:
833 			{
834 				uno::Reference< uno::XInterface > xImageMap;
835 
836 				SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
837 				if( pDoc )
838 				{
839 
840 					SdIMapInfo* pIMapInfo = pDoc->GetIMapInfo(mpShape->GetSdrObject());
841 					if( pIMapInfo )
842 					{
843 						const ImageMap& rIMap = pIMapInfo->GetImageMap();
844 						xImageMap = SvUnoImageMap_createInstance( rIMap, ImplGetSupportedMacroItems() );
845 					}
846 					else
847 					{
848 						xImageMap = SvUnoImageMap_createInstance(ImplGetSupportedMacroItems() );
849 					}
850 				}
851 
852 				aRet <<= uno::Reference< container::XIndexContainer >::query( xImageMap );
853 				break;
854 			}
855 		}
856 	}
857 	else
858 	{
859 		aRet = mpShape->_getPropertyValue(PropertyName);
860 
861 		if( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_shape_layername ) ) )
862 		{
863 			OUString aName;
864 			if( aRet >>= aName )
865 			{
866 				aName = SdLayer::convertToExternalName( aName );
867 				aRet <<= aName;
868 			}
869 		}
870 	}
871 
872 	return aRet;
873 }
874 
875 /** */
876 SdAnimationInfo* SdXShape::GetAnimationInfo( sal_Bool bCreate ) const throw()
877 {
878 	SdAnimationInfo* pInfo = NULL;
879 
880 	SdrObject* pObj = mpShape->GetSdrObject();
881 	if(pObj)
882 		pInfo = SdDrawDocument::GetShapeUserData(*pObj, bCreate ? true : false);
883 
884 	return pInfo;
885 }
886 
887 uno::Sequence< ::rtl::OUString > SAL_CALL SdXShape::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException)
888 {
889 	uno::Sequence< OUString > aSeq( mpShape->_getSupportedServiceNames() );
890 
891 	comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.presentation.Shape",
892 												  "com.sun.star.document.LinkTarget" );
893 
894 	SdrObject* pObj = mpShape->GetSdrObject();
895 	if(pObj && pObj->GetObjInventor() == SdrInventor )
896 	{
897 		sal_uInt32 nInventor = pObj->GetObjIdentifier();
898 		switch( nInventor )
899 		{
900 		case OBJ_TITLETEXT:
901 			comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.TitleTextShape" );
902 			break;
903 		case OBJ_OUTLINETEXT:
904 			comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.OutlinerShape" );
905 			break;
906 		}
907 	}
908 	return aSeq;
909 }
910 
911 /** checks if this is a presentation object
912  */
913 sal_Bool SdXShape::IsPresObj() const throw()
914 {
915 	SdrObject* pObj = mpShape->GetSdrObject();
916 	if(pObj)
917 	{
918 		SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage());
919 		if(pPage)
920 			return pPage->GetPresObjKind(pObj) != PRESOBJ_NONE;
921 	}
922 	return sal_False;
923 }
924 
925 /** checks if this presentation object is empty
926  */
927 sal_Bool SdXShape::IsEmptyPresObj() const throw()
928 {
929 	SdrObject* pObj = mpShape->GetSdrObject();
930 	if( (pObj != NULL) && pObj->IsEmptyPresObj() )
931     {
932 	    // check if the object is in edit, than its temporarely not empty
933 	    SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
934         if( pTextObj == 0 )
935             return sal_True;
936 
937         OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
938         if( pParaObj )
939         {
940             delete pParaObj;
941         }
942         else
943         {
944             return sal_True;
945         }
946     }
947 
948     return sal_False;
949 }
950 
951 /** sets/reset the empty status of a presentation object
952 */
953 void SdXShape::SetEmptyPresObj( sal_Bool bEmpty ) throw()
954 {
955 	// only possible if this actually *is* a presentation object
956 	if( !IsPresObj() )
957 		return;
958 
959 	SdrObject* pObj = mpShape->GetSdrObject();
960 	if( pObj == NULL )
961 		return;
962 
963 	if( pObj->IsEmptyPresObj() != bEmpty )
964 	{
965 		if(!bEmpty)
966 		{
967 			OutlinerParaObject* pOutlinerParaObject = pObj->GetOutlinerParaObject();
968 			const sal_Bool bVertical = pOutlinerParaObject ? pOutlinerParaObject->IsVertical() : sal_False;
969 
970 			// really delete SdrOutlinerObj at pObj
971 			pObj->NbcSetOutlinerParaObject(0L);
972 			if( bVertical && PTR_CAST( SdrTextObj, pObj ) )
973 				((SdrTextObj*)pObj)->SetVerticalWriting( sal_True );
974 
975 			SdrGrafObj* pGraphicObj = PTR_CAST( SdrGrafObj, pObj );
976 			if( pGraphicObj )
977 			{
978 				Graphic aEmpty;
979 				pGraphicObj->SetGraphic(aEmpty);
980 			}
981 			else
982 			{
983 				SdrOle2Obj* pOleObj = PTR_CAST( SdrOle2Obj, pObj );
984 				if( pOleObj )
985 				{
986 					pOleObj->SetGraphic( NULL );
987 				}
988 			}
989 		}
990 		else
991 		{
992 			// now set an empty OutlinerParaObject at pObj without
993 			// any content but with the style of the old OutlinerParaObjects
994 			// first paragraph
995 			do
996 			{
997 				SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
998 				DBG_ASSERT( pDoc, "no document?" );
999 				if( pDoc == NULL)
1000 					break;
1001 
1002 				::sd::Outliner* pOutliner = pDoc->GetInternalOutliner();
1003 				DBG_ASSERT( pOutliner, "no outliner?" );
1004 				if( pOutliner == NULL )
1005 					break;
1006 
1007 				SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage());
1008 				DBG_ASSERT( pPage, "no page?" );
1009 				if( pPage == NULL )
1010 					break;
1011 
1012 				OutlinerParaObject* pOutlinerParaObject = pObj->GetOutlinerParaObject();
1013 				pOutliner->SetText( *pOutlinerParaObject );
1014 				const sal_Bool bVertical = pOutliner->IsVertical();
1015 
1016 				pOutliner->Clear();
1017 				pOutliner->SetVertical( bVertical );
1018 				pOutliner->SetStyleSheetPool( (SfxStyleSheetPool*)pDoc->GetStyleSheetPool() );
1019 				pOutliner->SetStyleSheet( 0, pPage->GetTextStyleSheetForObject( pObj ) );
1020 				pOutliner->Insert( pPage->GetPresObjText( pPage->GetPresObjKind(pObj) ) );
1021 				pObj->SetOutlinerParaObject( pOutliner->CreateParaObject() );
1022 				pOutliner->Clear();
1023 			}
1024 			while(0);
1025 		}
1026 
1027 		pObj->SetEmptyPresObj(bEmpty);
1028 	}
1029 }
1030 
1031 sal_Bool SdXShape::IsMasterDepend() const throw()
1032 {
1033 	SdrObject* pObj = mpShape->GetSdrObject();
1034 	return pObj && pObj->GetUserCall() != NULL;
1035 }
1036 
1037 void SdXShape::SetMasterDepend( sal_Bool bDepend ) throw()
1038 {
1039 	if( IsMasterDepend() != bDepend )
1040 	{
1041 		SdrObject* pObj = mpShape->GetSdrObject();
1042 		if( pObj )
1043 		{
1044 			if( bDepend )
1045 			{
1046 				SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage());
1047 				pObj->SetUserCall( pPage );
1048 			}
1049 			else
1050 			{
1051 				pObj->SetUserCall( NULL );
1052 			}
1053 		}
1054 	}
1055 }
1056 
1057 void SdXShape::SetStyleSheet( const uno::Any& rAny ) throw( lang::IllegalArgumentException )
1058 {
1059 	SdrObject* pObj = mpShape->GetSdrObject();
1060 	if( pObj == NULL )
1061 		throw beans::UnknownPropertyException();
1062 
1063 	uno::Reference< style::XStyle > xStyle( rAny, uno::UNO_QUERY );
1064 	SfxStyleSheet* pStyleSheet = SfxUnoStyleSheet::getUnoStyleSheet( xStyle );
1065 
1066 	const SfxStyleSheet* pOldStyleSheet = pObj->GetStyleSheet();
1067 	if( pOldStyleSheet != pStyleSheet )
1068 	{
1069 		if( pStyleSheet == 0 || (pStyleSheet->GetFamily() != SD_STYLE_FAMILY_GRAPHICS && pStyleSheet->GetFamily() != SD_STYLE_FAMILY_MASTERPAGE) )
1070 			throw lang::IllegalArgumentException();
1071 
1072 		pObj->SetStyleSheet( pStyleSheet, sal_False );
1073 
1074 		SdDrawDocument* pDoc = mpModel? mpModel->GetDoc() : NULL;
1075 		if( pDoc )
1076 		{
1077 			::sd::DrawDocShell* pDocSh = pDoc->GetDocSh();
1078 			::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : NULL;
1079 
1080 			if( pViewSh )
1081 				pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
1082 		}
1083 	}
1084 }
1085 
1086 uno::Any SdXShape::GetStyleSheet() const throw( beans::UnknownPropertyException  )
1087 {
1088 	SdrObject* pObj = mpShape->GetSdrObject();
1089 	if( pObj == NULL )
1090 		throw beans::UnknownPropertyException();
1091 
1092 	SfxStyleSheet* pStyleSheet = pObj->GetStyleSheet();
1093 	// it is possible for shapes inside a draw to have a presentation style
1094 	// but we don't want this for the api
1095 	if( (pStyleSheet == NULL) || ((pStyleSheet->GetFamily() != SD_STYLE_FAMILY_GRAPHICS) && !mpModel->IsImpressDocument()) )
1096 		return Any();
1097 
1098 	return Any( uno::Reference< style::XStyle >( dynamic_cast< SfxUnoStyleSheet* >( pStyleSheet ) ) );
1099 }
1100 
1101 class SdUnoEventsAccess : public cppu::WeakImplHelper2< com::sun::star::container::XNameReplace, com::sun::star::lang::XServiceInfo >
1102 {
1103 private:
1104 	const OUString		maStrOnClick;
1105 	const OUString		maStrServiceName;
1106 	const OUString		maStrEventType;
1107 	const OUString		maStrPresentation;
1108 	const OUString		maStrLibrary;
1109 	const OUString		maStrMacroName;
1110 	const OUString		maStrClickAction;
1111 	const OUString		maStrBookmark;
1112 	const OUString		maStrEffect;
1113 	const OUString		maStrPlayFull;
1114 	const OUString		maStrVerb;
1115 	const OUString		maStrSoundURL;
1116 	const OUString		maStrSpeed;
1117 	const OUString		maStrStarBasic;
1118 	const OUString		maStrScript;
1119 
1120 	SdXShape*	mpShape;
1121 	uno::Reference< document::XEventsSupplier > mxShape;
1122 
1123 public:
1124 	SdUnoEventsAccess( SdXShape* pShape ) throw();
1125 
1126     // XNameReplace
1127     virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1128 
1129     // XNameAccess
1130     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1131     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw(::com::sun::star::uno::RuntimeException);
1132     virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
1133 
1134     // XElementAccess
1135     virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw(::com::sun::star::uno::RuntimeException);
1136     virtual sal_Bool SAL_CALL hasElements(  ) throw(::com::sun::star::uno::RuntimeException);
1137 
1138 	// XServiceInfo
1139     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
1140     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
1141     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
1142 };
1143 
1144 // XEventsSupplier
1145 uno::Reference< container::XNameReplace > SAL_CALL SdXShape::getEvents(  ) throw(::com::sun::star::uno::RuntimeException)
1146 {
1147 	return new SdUnoEventsAccess( this );
1148 }
1149 
1150 SdUnoEventsAccess::SdUnoEventsAccess( SdXShape* pShape ) throw()
1151 : maStrOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ),
1152   maStrServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.documents.Events") ),
1153   maStrEventType( RTL_CONSTASCII_USTRINGPARAM("EventType") ),
1154   maStrPresentation( RTL_CONSTASCII_USTRINGPARAM("Presentation") ),
1155   maStrLibrary(RTL_CONSTASCII_USTRINGPARAM("Library")),
1156   maStrMacroName(RTL_CONSTASCII_USTRINGPARAM("MacroName")),
1157   maStrClickAction( RTL_CONSTASCII_USTRINGPARAM("ClickAction") ),
1158   maStrBookmark( RTL_CONSTASCII_USTRINGPARAM("Bookmark") ),
1159   maStrEffect( RTL_CONSTASCII_USTRINGPARAM("Effect") ),
1160   maStrPlayFull( RTL_CONSTASCII_USTRINGPARAM("PlayFull") ),
1161   maStrVerb( RTL_CONSTASCII_USTRINGPARAM("Verb") ),
1162   maStrSoundURL( RTL_CONSTASCII_USTRINGPARAM("SoundURL") ),
1163   maStrSpeed( RTL_CONSTASCII_USTRINGPARAM("Speed") ),
1164   maStrStarBasic( RTL_CONSTASCII_USTRINGPARAM("StarBasic") ),
1165   maStrScript( RTL_CONSTASCII_USTRINGPARAM("Script") ),
1166   mpShape( pShape ), mxShape( pShape )
1167 {
1168 }
1169 
1170 #define FOUND_CLICKACTION	0x0001
1171 #define FOUND_BOOKMARK		0x0002
1172 #define FOUND_EFFECT		0x0004
1173 #define FOUND_PLAYFULL		0x0008
1174 #define FOUND_VERB			0x0010
1175 #define FOUND_SOUNDURL		0x0020
1176 #define FOUND_SPEED			0x0040
1177 #define FOUND_EVENTTYPE		0x0080
1178 #define FOUND_MACRO			0x0100
1179 #define FOUND_LIBRARY		0x0200
1180 
1181 static void clearEventsInAnimationInfo( SdAnimationInfo* pInfo )
1182 {
1183 	const String aEmpty;
1184 	pInfo->SetBookmark( aEmpty );
1185 	pInfo->mbSecondSoundOn = sal_False;
1186 	pInfo->mbSecondPlayFull = sal_False;
1187 	pInfo->meClickAction = presentation::ClickAction_NONE;
1188 	pInfo->meSecondEffect = presentation::AnimationEffect_NONE;
1189 	pInfo->meSecondSpeed = presentation::AnimationSpeed_MEDIUM;
1190 	pInfo->mnVerb = 0;
1191 }
1192 
1193 // XNameReplace
1194 void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno::Any& aElement )
1195 	throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
1196 {
1197 	if( mpShape == NULL || aName != maStrOnClick )
1198 		throw container::NoSuchElementException();
1199 
1200 	uno::Sequence< beans::PropertyValue > aProperties;
1201 	if( !aElement.hasValue() || aElement.getValueType() != getElementType() || !(aElement >>= aProperties) )
1202 		throw lang::IllegalArgumentException();
1203 
1204 	sal_Int32 nFound = 0;
1205 	const beans::PropertyValue* pProperties = aProperties.getConstArray();
1206 
1207 	OUString aStrEventType;
1208 	presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
1209 	presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE;
1210 	presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_MEDIUM;
1211 	OUString aStrSoundURL;
1212 	sal_Bool bPlayFull = sal_False;
1213 	sal_Int32 nVerb = 0;
1214 	OUString aStrMacro;
1215 	OUString aStrLibrary;
1216 	OUString aStrBookmark;
1217 
1218 	const sal_Int32 nCount = aProperties.getLength();
1219 	sal_Int32 nIndex;
1220 	for( nIndex = 0; nIndex < nCount; nIndex++, pProperties++ )
1221 	{
1222 		if( ( ( nFound & FOUND_EVENTTYPE ) == 0 ) && pProperties->Name == maStrEventType )
1223 		{
1224 			if( pProperties->Value >>= aStrEventType )
1225 			{
1226 				nFound |= FOUND_EVENTTYPE;
1227 				continue;
1228 			}
1229 		}
1230 		else if( ( ( nFound & FOUND_CLICKACTION ) == 0 ) && pProperties->Name == maStrClickAction )
1231 		{
1232 			if( pProperties->Value >>= eClickAction )
1233 			{
1234 				nFound |= FOUND_CLICKACTION;
1235 				continue;
1236 			}
1237 		}
1238 		else if( ( ( nFound & FOUND_MACRO ) == 0 ) && ( pProperties->Name == maStrMacroName || pProperties->Name == maStrScript ) )
1239 		{
1240 			if( pProperties->Value >>= aStrMacro )
1241 			{
1242 				nFound |= FOUND_MACRO;
1243 				continue;
1244 			}
1245 		}
1246 		else if( ( ( nFound & FOUND_LIBRARY ) == 0 ) && pProperties->Name == maStrLibrary )
1247 		{
1248 			if( pProperties->Value >>= aStrLibrary )
1249 			{
1250 				nFound |= FOUND_LIBRARY;
1251 				continue;
1252 			}
1253 		}
1254 		else if( ( ( nFound & FOUND_EFFECT ) == 0 ) && pProperties->Name == maStrEffect )
1255 		{
1256 			if( pProperties->Value >>= eEffect )
1257 			{
1258 				nFound |= FOUND_EFFECT;
1259 				continue;
1260 			}
1261 		}
1262 		else if( ( ( nFound & FOUND_BOOKMARK ) == 0 ) && pProperties->Name == maStrBookmark )
1263 		{
1264 			if( pProperties->Value >>= aStrBookmark )
1265 			{
1266 				nFound |= FOUND_BOOKMARK;
1267 				continue;
1268 			}
1269 		}
1270 		else if( ( ( nFound & FOUND_SPEED ) == 0 ) && pProperties->Name == maStrSpeed )
1271 		{
1272 			if( pProperties->Value >>= eSpeed )
1273 			{
1274 				nFound |= FOUND_SPEED;
1275 				continue;
1276 			}
1277 		}
1278 		else if( ( ( nFound & FOUND_SOUNDURL ) == 0 ) && pProperties->Name == maStrSoundURL )
1279 		{
1280 			if( pProperties->Value >>= aStrSoundURL )
1281 			{
1282 				nFound |= FOUND_SOUNDURL;
1283 				continue;
1284 			}
1285 		}
1286 		else if( ( ( nFound & FOUND_PLAYFULL ) == 0 ) && pProperties->Name == maStrPlayFull )
1287 		{
1288 			if( pProperties->Value >>= bPlayFull )
1289 			{
1290 				nFound |= FOUND_PLAYFULL;
1291 				continue;
1292 			}
1293 		}
1294 		else if( ( ( nFound & FOUND_VERB ) == 0 ) && pProperties->Name == maStrVerb )
1295 		{
1296 			if( pProperties->Value >>= nVerb )
1297 			{
1298 				nFound |= FOUND_VERB;
1299 				continue;
1300 			}
1301 		}
1302 
1303 		throw lang::IllegalArgumentException();
1304 	}
1305 
1306 	sal_Bool bOk = sal_False;
1307 	do
1308 	{
1309 		if( ( nFound & FOUND_EVENTTYPE ) == 0 )
1310 			break;
1311 
1312 		if( aStrEventType == maStrPresentation )
1313 		{
1314 			if( ( nFound & FOUND_CLICKACTION ) == 0 )
1315 				break;
1316 
1317 			SdAnimationInfo* pInfo = mpShape->GetAnimationInfo( sal_False );
1318 			if( presentation::ClickAction_NONE == eClickAction && NULL == pInfo )
1319 			{
1320 				bOk = sal_True;
1321 				break;
1322 			}
1323 
1324 			if( NULL == pInfo )
1325 				pInfo = mpShape->GetAnimationInfo( sal_True );
1326 
1327 			DBG_ASSERT( pInfo, "shape animation info could not be created!" );
1328 			if( NULL == pInfo )
1329 				break;
1330 
1331 			clearEventsInAnimationInfo( pInfo );
1332 			pInfo->meClickAction = eClickAction;
1333 
1334 			switch( eClickAction )
1335 			{
1336 			case presentation::ClickAction_NONE:
1337 			case presentation::ClickAction_PREVPAGE:
1338 			case presentation::ClickAction_NEXTPAGE:
1339 			case presentation::ClickAction_FIRSTPAGE:
1340 			case presentation::ClickAction_LASTPAGE:
1341 			case presentation::ClickAction_INVISIBLE:
1342 			case presentation::ClickAction_STOPPRESENTATION:
1343 				{
1344 					bOk = sal_True;
1345 				}
1346 				break;
1347 
1348 			case presentation::ClickAction_PROGRAM:
1349 			case presentation::ClickAction_BOOKMARK:
1350 			case presentation::ClickAction_DOCUMENT:
1351 				if( nFound & FOUND_BOOKMARK )
1352 				{
1353 					if( eClickAction == presentation::ClickAction_BOOKMARK )
1354 					{
1355 						aStrBookmark = getUiNameFromPageApiNameImpl( aStrBookmark );
1356 					}
1357 					else if( eClickAction == presentation::ClickAction_DOCUMENT )
1358 					{
1359 						sal_Int32 nPos = aStrBookmark.lastIndexOf( sal_Unicode('#') );
1360 						if( nPos >= 0 )
1361 						{
1362 							OUString aURL( aStrBookmark.copy( 0, nPos+1 ) );
1363 							aURL += getUiNameFromPageApiNameImpl( aStrBookmark.copy( nPos+1 ) );
1364 							aStrBookmark = aURL;
1365 						}
1366 					}
1367 
1368 					pInfo->SetBookmark( aStrBookmark );
1369 					bOk = sal_True;
1370 				}
1371 				break;
1372 
1373 			case presentation::ClickAction_MACRO:
1374 				if( nFound & FOUND_MACRO )
1375 				{
1376 					pInfo->SetBookmark( aStrMacro );
1377 					bOk = sal_True;
1378 				}
1379 				break;
1380 
1381 			case presentation::ClickAction_VERB:
1382 				if( nFound & FOUND_VERB )
1383 				{
1384 					pInfo->mnVerb = (sal_uInt16)nVerb;
1385 					bOk = sal_True;
1386 				}
1387 				break;
1388 
1389 			case presentation::ClickAction_VANISH:
1390 				if( ( nFound & FOUND_EFFECT ) == 0 )
1391 					break;
1392 
1393 				pInfo->meSecondEffect = eEffect;
1394 				pInfo->meSecondSpeed = nFound & FOUND_SPEED ? eSpeed : presentation::AnimationSpeed_MEDIUM;
1395 
1396 				bOk = sal_True;
1397 
1398 				// NOTE: No break here!!!
1399 
1400 			case presentation::ClickAction_SOUND:
1401 				if( nFound & FOUND_SOUNDURL )
1402 				{
1403 					pInfo->SetBookmark( aStrSoundURL );
1404 					if( eClickAction != presentation::ClickAction_SOUND )
1405 						pInfo->mbSecondSoundOn = aStrSoundURL.getLength() != 0;
1406 					pInfo->mbSecondPlayFull = nFound & FOUND_PLAYFULL ? bPlayFull : sal_False;
1407 
1408 					bOk = sal_True;
1409 				}
1410 				break;
1411 			case presentation::ClickAction_MAKE_FIXED_SIZE:
1412 				break;
1413 			}
1414 		}
1415 		else
1416 		{
1417 			SdAnimationInfo* pInfo = mpShape->GetAnimationInfo( sal_True );
1418 
1419 			DBG_ASSERT( pInfo, "shape animation info could not be created!" );
1420 			if( NULL == pInfo )
1421 				break;
1422 
1423 			clearEventsInAnimationInfo( pInfo );
1424 			pInfo->meClickAction = presentation::ClickAction_MACRO;
1425 
1426 			if ( SfxApplication::IsXScriptURL( aStrMacro ) )
1427 			{
1428 				pInfo->SetBookmark( aStrMacro );
1429 			}
1430 			else
1431 			{
1432 				String aMacro = aStrMacro;
1433 
1434 				String aLibName   = aMacro.GetToken(0, sal_Unicode('.'));
1435 				String aModulName = aMacro.GetToken(1, sal_Unicode('.'));
1436 				String aMacroName = aMacro.GetToken(2, sal_Unicode('.'));
1437 
1438 				OUStringBuffer sBuffer;
1439 				sBuffer.append( aMacroName );
1440 				sBuffer.append( sal_Unicode('.') );
1441 				sBuffer.append( aModulName );
1442 				sBuffer.append( sal_Unicode('.') );
1443 				sBuffer.append( aLibName );
1444 				sBuffer.append( sal_Unicode('.') );
1445 
1446 				if( aStrLibrary.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StarOffice" ) ) )
1447 				{
1448 					sBuffer.append( OUString( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ) );
1449 				}
1450 				else
1451 				{
1452 					sBuffer.append( aStrLibrary );
1453 				}
1454 
1455 				pInfo->SetBookmark( sBuffer.makeStringAndClear() );
1456 			}
1457 			bOk = sal_True;
1458 		}
1459 	}
1460 	while(0);
1461 
1462 	if( !bOk )
1463 		throw lang::IllegalArgumentException();
1464 }
1465 
1466 // XNameAccess
1467 uno::Any SAL_CALL SdUnoEventsAccess::getByName( const OUString& aName )
1468 	throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
1469 {
1470 	if( mpShape == NULL || aName != maStrOnClick )
1471 		throw container::NoSuchElementException();
1472 
1473 	SdAnimationInfo* pInfo = mpShape->GetAnimationInfo( sal_False );
1474 
1475 	presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
1476 	if( pInfo )
1477 		eClickAction = pInfo->meClickAction;
1478 
1479 	sal_Int32 nPropertyCount = 2;
1480 	switch( eClickAction )
1481 	{
1482 	case presentation::ClickAction_NONE:
1483 	case presentation::ClickAction_PREVPAGE:
1484 	case presentation::ClickAction_NEXTPAGE:
1485 	case presentation::ClickAction_FIRSTPAGE:
1486 	case presentation::ClickAction_LASTPAGE:
1487 	case presentation::ClickAction_INVISIBLE:
1488 	case presentation::ClickAction_STOPPRESENTATION:
1489 		break;
1490 	case presentation::ClickAction_PROGRAM:
1491 	case presentation::ClickAction_VERB:
1492 	case presentation::ClickAction_BOOKMARK:
1493 	case presentation::ClickAction_DOCUMENT:
1494 	case presentation::ClickAction_MACRO:
1495 		if ( !SfxApplication::IsXScriptURL( pInfo->GetBookmark() ) )
1496 			nPropertyCount += 1;
1497 		break;
1498 
1499 	case presentation::ClickAction_SOUND:
1500 		nPropertyCount += 2;
1501 		break;
1502 
1503 	case presentation::ClickAction_VANISH:
1504 		nPropertyCount += 4;
1505 		break;
1506 	default:
1507 		break;
1508 	}
1509 
1510 	uno::Sequence< beans::PropertyValue > aProperties( nPropertyCount );
1511 	beans::PropertyValue* pProperties = aProperties.getArray();
1512 
1513 	uno::Any aAny;
1514 
1515 	if( eClickAction == presentation::ClickAction_MACRO )
1516 	{
1517 		if ( SfxApplication::IsXScriptURL( pInfo->GetBookmark() ) )
1518 		{
1519 			// Scripting Framework URL
1520 			aAny <<= maStrScript;;
1521 			pProperties->Name = maStrEventType;
1522 			pProperties->Handle = -1;
1523 			pProperties->Value = aAny;
1524 			pProperties->State = beans::PropertyState_DIRECT_VALUE;
1525 			pProperties++;
1526 
1527 			aAny <<= OUString( pInfo->GetBookmark() );
1528 			pProperties->Name = maStrScript;
1529 			pProperties->Handle = -1;
1530 			pProperties->Value = aAny;
1531 			pProperties->State = beans::PropertyState_DIRECT_VALUE;
1532 			pProperties++;
1533 		}
1534 		else
1535 		{
1536 			// Old Basic macro URL
1537 			aAny <<= maStrStarBasic;;
1538 			pProperties->Name = maStrEventType;
1539 			pProperties->Handle = -1;
1540 			pProperties->Value = aAny;
1541 			pProperties->State = beans::PropertyState_DIRECT_VALUE;
1542 			pProperties++;
1543 
1544 			String aMacro = pInfo->GetBookmark();
1545 
1546 			// aMacro has got following format:
1547 			// "Macroname.Modulname.Libname.Documentname" or
1548 			// "Macroname.Modulname.Libname.Applicationsname"
1549 			String aMacroName = aMacro.GetToken(0, sal_Unicode('.'));
1550 			String aModulName = aMacro.GetToken(1, sal_Unicode('.'));
1551 			String aLibName   = aMacro.GetToken(2, sal_Unicode('.'));
1552 			String aDocName   = aMacro.GetToken(3, sal_Unicode('.'));
1553 
1554 			OUStringBuffer sBuffer;
1555 			sBuffer.append( aLibName );
1556 			sBuffer.append( sal_Unicode('.') );
1557 			sBuffer.append( aModulName );
1558 			sBuffer.append( sal_Unicode('.') );
1559 			sBuffer.append( aMacroName );
1560 
1561 			aAny <<= OUString( sBuffer.makeStringAndClear() );
1562 			pProperties->Name = maStrMacroName;
1563 			pProperties->Handle = -1;
1564 			pProperties->Value = aAny;
1565 			pProperties->State = beans::PropertyState_DIRECT_VALUE;
1566 			pProperties++;
1567 
1568 			aAny <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "StarOffice" ) );
1569 			pProperties->Name = maStrLibrary;
1570 			pProperties->Handle = -1;
1571 			pProperties->Value = aAny;
1572 			pProperties->State = beans::PropertyState_DIRECT_VALUE;
1573 		}
1574 	}
1575 	else
1576 	{
1577 		aAny <<= maStrPresentation;
1578 		pProperties->Name = maStrEventType;
1579 		pProperties->Handle = -1;
1580 		pProperties->Value = aAny;
1581 		pProperties->State = beans::PropertyState_DIRECT_VALUE;
1582 		pProperties++;
1583 
1584 		aAny <<= eClickAction;
1585 		pProperties->Name = maStrClickAction;
1586 		pProperties->Handle = -1;
1587 		pProperties->Value = aAny;
1588 		pProperties->State = beans::PropertyState_DIRECT_VALUE;
1589 		pProperties++;
1590 
1591 		switch( eClickAction )
1592 		{
1593 		case presentation::ClickAction_NONE:
1594 		case presentation::ClickAction_PREVPAGE:
1595 		case presentation::ClickAction_NEXTPAGE:
1596 		case presentation::ClickAction_FIRSTPAGE:
1597 		case presentation::ClickAction_LASTPAGE:
1598 		case presentation::ClickAction_INVISIBLE:
1599 		case presentation::ClickAction_STOPPRESENTATION:
1600 			break;
1601 		case presentation::ClickAction_BOOKMARK:
1602 			{
1603 				const OUString aStrBookmark( getPageApiNameFromUiName( pInfo->GetBookmark()) );
1604 				pProperties->Name = maStrBookmark;
1605 				pProperties->Handle = -1;
1606 				pProperties->Value <<= aStrBookmark;
1607 				pProperties->State = beans::PropertyState_DIRECT_VALUE;
1608 			}
1609 			break;
1610 
1611 		case presentation::ClickAction_DOCUMENT:
1612 		case presentation::ClickAction_PROGRAM:
1613 			{
1614 				OUString aString( pInfo->GetBookmark());
1615 				sal_Int32 nPos = aString.lastIndexOf( sal_Unicode('#') );
1616 				if( nPos >= 0 )
1617 				{
1618 					OUString aURL( aString.copy( 0, nPos+1 ) );
1619 					aURL += getPageApiNameFromUiName( aString.copy( nPos+1 ) );
1620 					aString = aURL;
1621 				}
1622 				pProperties->Name = maStrBookmark;
1623 				pProperties->Handle = -1;
1624 				pProperties->Value <<= aString;
1625 				pProperties->State = beans::PropertyState_DIRECT_VALUE;
1626 			}
1627 			break;
1628 
1629 		case presentation::ClickAction_VANISH:
1630 			aAny <<= pInfo->meSecondEffect;
1631 			pProperties->Name = maStrEffect;
1632 			pProperties->Handle = -1;
1633 			pProperties->Value = aAny;
1634 			pProperties->State = beans::PropertyState_DIRECT_VALUE;
1635 			pProperties++;
1636 
1637 			aAny <<= pInfo->meSecondSpeed;
1638 			pProperties->Name = maStrSpeed;
1639 			pProperties->Handle = -1;
1640 			pProperties->Value = aAny;
1641 			pProperties->State = beans::PropertyState_DIRECT_VALUE;
1642 			pProperties++;
1643 
1644 			// NOTE: no break here!!!
1645 
1646 		case presentation::ClickAction_SOUND:
1647 			if( eClickAction == presentation::ClickAction_SOUND || pInfo->mbSecondSoundOn )
1648 			{
1649 				aAny <<= OUString( pInfo->GetBookmark());
1650 				pProperties->Name = maStrSoundURL;
1651 				pProperties->Handle = -1;
1652 				pProperties->Value = aAny;
1653 				pProperties->State = beans::PropertyState_DIRECT_VALUE;
1654 				pProperties++;
1655 
1656 				pProperties->Name = maStrPlayFull;
1657 				pProperties->Handle = -1;
1658 				pProperties->Value = ::cppu::bool2any(pInfo->mbSecondPlayFull);
1659 				pProperties->State = beans::PropertyState_DIRECT_VALUE;
1660 			}
1661 			break;
1662 
1663 		case presentation::ClickAction_VERB:
1664 			aAny <<= (sal_Int32)pInfo->mnVerb;
1665 			pProperties->Name = maStrVerb;
1666 			pProperties->Handle = -1;
1667 			pProperties->Value = aAny;
1668 			pProperties->State = beans::PropertyState_DIRECT_VALUE;
1669 			break;
1670 		default:
1671 			break;
1672 		}
1673 	}
1674 
1675 	aAny <<= aProperties;
1676 	return aAny;
1677 }
1678 
1679 uno::Sequence< OUString > SAL_CALL SdUnoEventsAccess::getElementNames(  )
1680 	throw(uno::RuntimeException)
1681 {
1682 	uno::Sequence< OUString > aStr( &maStrOnClick, 1 );
1683 	return aStr;
1684 }
1685 
1686 sal_Bool SAL_CALL SdUnoEventsAccess::hasByName( const OUString& aName )
1687 	throw(uno::RuntimeException)
1688 {
1689 	return aName == maStrOnClick;
1690 }
1691 
1692 // XElementAccess
1693 uno::Type SAL_CALL SdUnoEventsAccess::getElementType(  )
1694 	throw(uno::RuntimeException)
1695 {
1696 	return *SEQTYPE(::getCppuType((const uno::Sequence< beans::PropertyValue >*)0));
1697 }
1698 
1699 sal_Bool SAL_CALL SdUnoEventsAccess::hasElements(  ) throw(uno::RuntimeException)
1700 {
1701 	return sal_True;
1702 }
1703 
1704 // XServiceInfo
1705 OUString SAL_CALL SdUnoEventsAccess::getImplementationName(  )
1706 	throw(uno::RuntimeException)
1707 {
1708 	return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdUnoEventsAccess" ) );
1709 }
1710 
1711 sal_Bool SAL_CALL SdUnoEventsAccess::supportsService( const OUString& ServiceName )
1712 	throw(uno::RuntimeException)
1713 {
1714 	return ServiceName == maStrServiceName;
1715 }
1716 
1717 uno::Sequence< OUString > SAL_CALL SdUnoEventsAccess::getSupportedServiceNames(  )
1718 	throw(uno::RuntimeException)
1719 {
1720 	uno::Sequence< OUString > aStr( &maStrServiceName, 1 );
1721 	return aStr;
1722 }
1723 
1724 void SdXShape::modelChanged( SdrModel* pNewModel )
1725 {
1726 	if( pNewModel )
1727 	{
1728 		uno::Reference< uno::XInterface > xModel( pNewModel->getUnoModel() );
1729 		mpModel = SdXImpressDocument::getImplementation( xModel );
1730 	}
1731 	else
1732 	{
1733 		mpModel = 0;
1734 	}
1735 }
1736 
1737 void SdXShape::pageChanged( SdrPage*  )
1738 {
1739 }
1740 
1741 void SdXShape::objectChanged( SdrObject*  )
1742 {
1743 }
1744 
1745