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