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