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