tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / xmloff / source / draw / animimp.cxx
blobafd1fffd2f13e51a0f51141c2f4190cb534a76b7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
22 #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <com/sun/star/presentation/AnimationEffect.hpp>
25 #include <com/sun/star/presentation/AnimationSpeed.hpp>
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <com/sun/star/drawing/XShape.hpp>
29 #include <sax/tools/converter.hxx>
30 #include <sal/log.hxx>
31 #include <comphelper/diagnose_ex.hxx>
33 #include <xmloff/xmltoken.hxx>
34 #include <xmloff/xmlimp.hxx>
35 #include <xmloff/xmlnamespace.hxx>
36 #include <xmloff/xmluconv.hxx>
37 #include <anim.hxx>
38 #include <animimp.hxx>
40 using namespace ::com::sun::star;
41 using namespace ::com::sun::star::xml;
42 using namespace ::com::sun::star::xml::sax;
43 using namespace ::com::sun::star::uno;
44 using namespace ::com::sun::star::drawing;
45 using namespace ::com::sun::star::beans;
46 using namespace ::com::sun::star::lang;
47 using namespace ::com::sun::star::presentation;
48 using namespace ::xmloff::token;
50 const SvXMLEnumMapEntry<XMLEffect> aXML_AnimationEffect_EnumMap[] =
52 { XML_NONE, EK_none },
53 { XML_FADE, EK_fade },
54 { XML_MOVE, EK_move },
55 { XML_STRIPES, EK_stripes },
56 { XML_OPEN, EK_open },
57 { XML_CLOSE, EK_close },
58 { XML_DISSOLVE, EK_dissolve },
59 { XML_WAVYLINE, EK_wavyline },
60 { XML_RANDOM, EK_random },
61 { XML_LINES, EK_lines },
62 { XML_LASER, EK_laser },
63 { XML_APPEAR, EK_appear },
64 { XML_HIDE, EK_hide },
65 { XML_MOVE_SHORT, EK_move_short },
66 { XML_CHECKERBOARD, EK_checkerboard },
67 { XML_ROTATE, EK_rotate },
68 { XML_STRETCH, EK_stretch },
69 { XML_TOKEN_INVALID, XMLEffect(0) }
72 const SvXMLEnumMapEntry<XMLEffectDirection> aXML_AnimationDirection_EnumMap[] =
74 { XML_NONE, ED_none },
75 { XML_FROM_LEFT, ED_from_left },
76 { XML_FROM_TOP, ED_from_top },
77 { XML_FROM_RIGHT, ED_from_right },
78 { XML_FROM_BOTTOM, ED_from_bottom },
79 { XML_FROM_CENTER, ED_from_center },
80 { XML_FROM_UPPER_LEFT, ED_from_upperleft },
81 { XML_FROM_UPPER_RIGHT, ED_from_upperright },
82 { XML_FROM_LOWER_LEFT, ED_from_lowerleft },
83 { XML_FROM_LOWER_RIGHT, ED_from_lowerright },
84 { XML_TO_LEFT, ED_to_left },
85 { XML_TO_TOP, ED_to_top },
86 { XML_TO_RIGHT, ED_to_right },
87 { XML_TO_BOTTOM, ED_to_bottom },
88 { XML_TO_UPPER_LEFT, ED_to_upperleft },
89 { XML_TO_UPPER_RIGHT, ED_to_upperright },
90 { XML_TO_LOWER_RIGHT, ED_to_lowerright },
91 { XML_TO_LOWER_LEFT, ED_to_lowerleft },
92 { XML_PATH, ED_path },
93 { XML_SPIRAL_INWARD_LEFT, ED_spiral_inward_left },
94 { XML_SPIRAL_INWARD_RIGHT,ED_spiral_inward_right },
95 { XML_SPIRAL_OUTWARD_LEFT, ED_spiral_outward_left },
96 { XML_SPIRAL_OUTWARD_RIGHT, ED_spiral_outward_right },
97 { XML_VERTICAL, ED_vertical },
98 { XML_HORIZONTAL, ED_horizontal },
99 { XML_TO_CENTER, ED_to_center },
100 { XML_CLOCKWISE, ED_clockwise },
101 { XML_COUNTER_CLOCKWISE,ED_cclockwise },
102 { XML_TOKEN_INVALID, XMLEffectDirection(0) }
105 const SvXMLEnumMapEntry<AnimationSpeed> aXML_AnimationSpeed_EnumMap[] =
107 { XML_SLOW, AnimationSpeed_SLOW },
108 { XML_MEDIUM, AnimationSpeed_MEDIUM },
109 { XML_FAST, AnimationSpeed_FAST },
110 { XML_TOKEN_INVALID, AnimationSpeed(0) }
113 AnimationEffect ImplSdXMLgetEffect( XMLEffect eKind, XMLEffectDirection eDirection, sal_Int16 nStartScale, bool /*bIn*/ )
115 switch( eKind )
117 case EK_fade:
118 switch( eDirection )
120 case ED_from_left: return AnimationEffect_FADE_FROM_LEFT;
121 case ED_from_top: return AnimationEffect_FADE_FROM_TOP;
122 case ED_from_right: return AnimationEffect_FADE_FROM_RIGHT;
123 case ED_from_bottom: return AnimationEffect_FADE_FROM_BOTTOM;
124 case ED_from_center: return AnimationEffect_FADE_FROM_CENTER;
125 case ED_from_upperleft: return AnimationEffect_FADE_FROM_UPPERLEFT;
126 case ED_from_upperright: return AnimationEffect_FADE_FROM_UPPERRIGHT;
127 case ED_from_lowerleft: return AnimationEffect_FADE_FROM_LOWERLEFT;
128 case ED_from_lowerright: return AnimationEffect_FADE_FROM_LOWERRIGHT;
129 case ED_to_center: return AnimationEffect_FADE_TO_CENTER;
130 case ED_clockwise: return AnimationEffect_CLOCKWISE;
131 case ED_cclockwise: return AnimationEffect_COUNTERCLOCKWISE;
132 case ED_spiral_inward_left: return AnimationEffect_SPIRALIN_LEFT;
133 case ED_spiral_inward_right:return AnimationEffect_SPIRALIN_RIGHT;
134 case ED_spiral_outward_left:return AnimationEffect_SPIRALOUT_LEFT;
135 case ED_spiral_outward_right:return AnimationEffect_SPIRALOUT_RIGHT;
136 default: return AnimationEffect_FADE_FROM_LEFT;
138 case EK_move:
139 if( nStartScale == 200 )
141 return AnimationEffect_ZOOM_OUT_SMALL;
143 else if( nStartScale == 50 )
145 return AnimationEffect_ZOOM_IN_SMALL;
147 else if( nStartScale < 100 )
149 switch( eDirection )
151 case ED_from_left: return AnimationEffect_ZOOM_IN_FROM_LEFT;
152 case ED_from_top: return AnimationEffect_ZOOM_IN_FROM_TOP;
153 case ED_from_right: return AnimationEffect_ZOOM_IN_FROM_RIGHT;
154 case ED_from_bottom: return AnimationEffect_ZOOM_IN_FROM_BOTTOM;
155 case ED_from_upperleft: return AnimationEffect_ZOOM_IN_FROM_UPPERLEFT;
156 case ED_from_upperright: return AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT;
157 case ED_from_lowerleft: return AnimationEffect_ZOOM_IN_FROM_LOWERLEFT;
158 case ED_from_lowerright: return AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT;
159 case ED_from_center: return AnimationEffect_ZOOM_IN_FROM_CENTER;
160 case ED_spiral_inward_left: return AnimationEffect_ZOOM_IN_SPIRAL;
161 case ED_to_left: return AnimationEffect_MOVE_TO_LEFT;
162 case ED_to_top: return AnimationEffect_MOVE_TO_TOP;
163 case ED_to_right: return AnimationEffect_MOVE_TO_RIGHT;
164 case ED_to_bottom: return AnimationEffect_MOVE_TO_BOTTOM;
165 case ED_to_upperleft: return AnimationEffect_MOVE_TO_UPPERLEFT;
166 case ED_to_upperright: return AnimationEffect_MOVE_TO_UPPERRIGHT;
167 case ED_to_lowerright: return AnimationEffect_MOVE_TO_LOWERRIGHT;
168 case ED_to_lowerleft: return AnimationEffect_MOVE_TO_LOWERLEFT;
169 default: return AnimationEffect_ZOOM_IN;
172 else if( nStartScale > 100 )
174 switch( eDirection )
176 case ED_from_left: return AnimationEffect_ZOOM_OUT_FROM_LEFT;
177 case ED_from_top: return AnimationEffect_ZOOM_OUT_FROM_TOP;
178 case ED_from_right: return AnimationEffect_ZOOM_OUT_FROM_RIGHT;
179 case ED_from_bottom: return AnimationEffect_ZOOM_OUT_FROM_BOTTOM;
180 case ED_from_upperleft: return AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT;
181 case ED_from_upperright: return AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT;
182 case ED_from_lowerleft: return AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT;
183 case ED_from_lowerright: return AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT;
184 case ED_from_center: return AnimationEffect_ZOOM_OUT_FROM_CENTER;
185 case ED_spiral_inward_left: return AnimationEffect_ZOOM_OUT_SPIRAL;
186 default: return AnimationEffect_ZOOM_OUT;
189 else
191 switch( eDirection )
193 case ED_from_left: return AnimationEffect_MOVE_FROM_LEFT;
194 case ED_from_top: return AnimationEffect_MOVE_FROM_TOP;
195 case ED_from_right: return AnimationEffect_MOVE_FROM_RIGHT;
196 case ED_from_bottom: return AnimationEffect_MOVE_FROM_BOTTOM;
197 case ED_from_upperleft: return AnimationEffect_MOVE_FROM_UPPERLEFT;
198 case ED_from_upperright: return AnimationEffect_MOVE_FROM_UPPERRIGHT;
199 case ED_from_lowerleft: return AnimationEffect_MOVE_FROM_LOWERLEFT;
200 case ED_from_lowerright: return AnimationEffect_MOVE_FROM_LOWERRIGHT;
201 case ED_path: return AnimationEffect_PATH;
202 case ED_to_top: return AnimationEffect_MOVE_TO_TOP;
203 case ED_to_right: return AnimationEffect_MOVE_TO_RIGHT;
204 case ED_to_bottom: return AnimationEffect_MOVE_TO_BOTTOM;
205 case ED_to_upperleft: return AnimationEffect_MOVE_TO_UPPERLEFT;
206 case ED_to_upperright: return AnimationEffect_MOVE_TO_UPPERRIGHT;
207 case ED_to_lowerright: return AnimationEffect_MOVE_TO_LOWERRIGHT;
208 case ED_to_lowerleft: return AnimationEffect_MOVE_TO_LOWERLEFT;
209 default:
210 break;
213 return AnimationEffect_MOVE_FROM_LEFT;
214 case EK_stripes:
215 if( eDirection == ED_vertical )
216 return AnimationEffect_VERTICAL_STRIPES;
217 else
218 return AnimationEffect_HORIZONTAL_STRIPES;
219 case EK_open:
220 if( eDirection == ED_vertical )
221 return AnimationEffect_OPEN_VERTICAL;
222 else
223 return AnimationEffect_OPEN_HORIZONTAL;
224 case EK_close:
225 if( eDirection == ED_vertical )
226 return AnimationEffect_CLOSE_VERTICAL;
227 else
228 return AnimationEffect_CLOSE_HORIZONTAL;
229 case EK_dissolve:
230 return AnimationEffect_DISSOLVE;
231 case EK_wavyline:
232 switch( eDirection )
234 case ED_from_left: return AnimationEffect_WAVYLINE_FROM_LEFT;
235 case ED_from_top: return AnimationEffect_WAVYLINE_FROM_TOP;
236 case ED_from_right: return AnimationEffect_WAVYLINE_FROM_RIGHT;
237 case ED_from_bottom: return AnimationEffect_WAVYLINE_FROM_BOTTOM;
238 default: return AnimationEffect_WAVYLINE_FROM_LEFT;
240 case EK_random:
241 return AnimationEffect_RANDOM;
242 case EK_lines:
243 if( eDirection == ED_vertical )
244 return AnimationEffect_VERTICAL_LINES;
245 else
246 return AnimationEffect_HORIZONTAL_LINES;
247 case EK_laser:
248 switch( eDirection )
250 case ED_from_left: return AnimationEffect_LASER_FROM_LEFT;
251 case ED_from_top: return AnimationEffect_LASER_FROM_TOP;
252 case ED_from_right: return AnimationEffect_LASER_FROM_RIGHT;
253 case ED_from_bottom: return AnimationEffect_LASER_FROM_BOTTOM;
254 case ED_from_upperleft: return AnimationEffect_LASER_FROM_UPPERLEFT;
255 case ED_from_upperright: return AnimationEffect_LASER_FROM_UPPERRIGHT;
256 case ED_from_lowerleft: return AnimationEffect_LASER_FROM_LOWERLEFT;
257 case ED_from_lowerright: return AnimationEffect_LASER_FROM_LOWERRIGHT;
258 default: return AnimationEffect_LASER_FROM_LEFT;
260 case EK_appear:
261 return AnimationEffect_APPEAR;
262 case EK_hide:
263 return AnimationEffect_HIDE;
264 case EK_move_short:
265 switch( eDirection )
267 case ED_from_left: return AnimationEffect_MOVE_SHORT_FROM_LEFT;
268 case ED_from_top: return AnimationEffect_MOVE_SHORT_FROM_TOP;
269 case ED_from_right: return AnimationEffect_MOVE_SHORT_FROM_RIGHT;
270 case ED_from_bottom: return AnimationEffect_MOVE_SHORT_FROM_BOTTOM;
271 case ED_from_upperleft: return AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT;
272 case ED_from_upperright: return AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT;
273 case ED_from_lowerleft: return AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT;
274 case ED_from_lowerright: return AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT;
275 case ED_to_left: return AnimationEffect_MOVE_SHORT_TO_LEFT;
276 case ED_to_upperleft: return AnimationEffect_MOVE_SHORT_TO_UPPERLEFT;
277 case ED_to_top: return AnimationEffect_MOVE_SHORT_TO_TOP;
278 case ED_to_upperright: return AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT;
279 case ED_to_right: return AnimationEffect_MOVE_SHORT_TO_RIGHT;
280 case ED_to_lowerright: return AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT;
281 case ED_to_bottom: return AnimationEffect_MOVE_SHORT_TO_BOTTOM;
282 case ED_to_lowerleft: return AnimationEffect_MOVE_SHORT_TO_LOWERLEFT;
283 default: return AnimationEffect_MOVE_SHORT_FROM_LEFT;
285 case EK_checkerboard:
286 if( eDirection == ED_vertical )
287 return AnimationEffect_VERTICAL_CHECKERBOARD;
288 else
289 return AnimationEffect_HORIZONTAL_CHECKERBOARD;
290 case EK_rotate:
291 if( eDirection == ED_vertical )
292 return AnimationEffect_VERTICAL_ROTATE;
293 else
294 return AnimationEffect_HORIZONTAL_ROTATE;
295 case EK_stretch:
296 switch( eDirection )
298 case ED_from_left: return AnimationEffect_STRETCH_FROM_LEFT;
299 case ED_from_top: return AnimationEffect_STRETCH_FROM_TOP;
300 case ED_from_right: return AnimationEffect_STRETCH_FROM_RIGHT;
301 case ED_from_bottom: return AnimationEffect_STRETCH_FROM_BOTTOM;
302 case ED_from_upperleft: return AnimationEffect_STRETCH_FROM_UPPERLEFT;
303 case ED_from_upperright: return AnimationEffect_STRETCH_FROM_UPPERRIGHT;
304 case ED_from_lowerleft: return AnimationEffect_STRETCH_FROM_LOWERLEFT;
305 case ED_from_lowerright: return AnimationEffect_STRETCH_FROM_LOWERRIGHT;
306 case ED_vertical: return AnimationEffect_VERTICAL_STRETCH;
307 case ED_horizontal: return AnimationEffect_HORIZONTAL_STRETCH;
308 default:
309 break;
311 return AnimationEffect_STRETCH_FROM_LEFT;
312 default:
313 return AnimationEffect_NONE;
317 namespace {
319 enum XMLActionKind
321 XMLE_SHOW,
322 XMLE_HIDE,
323 XMLE_DIM,
324 XMLE_PLAY
327 class XMLAnimationsEffectContext : public SvXMLImportContext
329 public:
330 rtl::Reference<XMLAnimationsContext> mxAnimationsContext;
332 XMLActionKind meKind;
333 bool mbTextEffect;
334 OUString maShapeId;
336 XMLEffect meEffect;
337 XMLEffectDirection meDirection;
338 sal_Int16 mnStartScale;
340 AnimationSpeed meSpeed;
341 sal_Int32 maDimColor;
342 OUString maSoundURL;
343 bool mbPlayFull;
344 OUString maPathShapeId;
346 public:
348 XMLAnimationsEffectContext( SvXMLImport& rImport,
349 sal_Int32 nElement,
350 const Reference< XFastAttributeList >& xAttrList,
351 XMLAnimationsContext& rAnimationsContext);
353 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
355 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
356 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
359 class XMLAnimationsSoundContext : public SvXMLImportContext
361 public:
363 XMLAnimationsSoundContext( SvXMLImport& rImport, sal_Int32 nElement, const Reference< XFastAttributeList >& xAttrList, XMLAnimationsEffectContext* pParent );
368 XMLAnimationsSoundContext::XMLAnimationsSoundContext( SvXMLImport& rImport, sal_Int32 nElement, const Reference< XFastAttributeList >& xAttrList, XMLAnimationsEffectContext* pParent )
369 : SvXMLImportContext( rImport )
371 if( !pParent || nElement != XML_ELEMENT(PRESENTATION, XML_SOUND) )
372 return;
374 for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
376 switch( aIter.getToken() )
378 case XML_ELEMENT(XLINK, XML_HREF):
379 pParent->maSoundURL = rImport.GetAbsoluteReference(aIter.toString());
380 break;
381 case XML_ELEMENT(PRESENTATION, XML_PLAY_FULL):
382 pParent->mbPlayFull = IsXMLToken( aIter, XML_TRUE );
383 break;
384 default:
385 XMLOFF_WARN_UNKNOWN("xmloff", aIter);
390 XMLAnimationsEffectContext::XMLAnimationsEffectContext( SvXMLImport& rImport,
391 sal_Int32 nElement,
392 const Reference< XFastAttributeList >& xAttrList,
393 XMLAnimationsContext& rAnimationsContext )
394 : SvXMLImportContext(rImport),
395 mxAnimationsContext( &rAnimationsContext ),
396 meKind( XMLE_SHOW ), mbTextEffect( false ),
397 meEffect( EK_none ), meDirection( ED_none ), mnStartScale( 100 ),
398 meSpeed( AnimationSpeed_MEDIUM ), maDimColor(0), mbPlayFull( false )
400 switch(nElement & TOKEN_MASK)
402 case XML_SHOW_SHAPE:
403 meKind = XMLE_SHOW;
404 break;
405 case XML_SHOW_TEXT:
406 meKind = XMLE_SHOW;
407 mbTextEffect = true;
408 break;
409 case XML_HIDE_SHAPE:
410 meKind = XMLE_HIDE;
411 break;
412 case XML_HIDE_TEXT:
413 meKind = XMLE_HIDE;
414 mbTextEffect = true;
415 break;
416 case XML_DIM:
417 meKind = XMLE_DIM;
418 break;
419 case XML_PLAY:
420 meKind = XMLE_PLAY;
421 break;
422 default:
423 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
424 // unknown action, overread
425 return;
428 for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
430 switch( aIter.getToken() )
432 case XML_ELEMENT(DRAW, XML_SHAPE_ID):
433 maShapeId = aIter.toString();
434 break;
435 case XML_ELEMENT(DRAW, XML_COLOR):
436 ::sax::Converter::convertColor(maDimColor, aIter.toView());
437 break;
439 case XML_ELEMENT(PRESENTATION, XML_EFFECT):
440 SvXMLUnitConverter::convertEnum( meEffect, aIter.toView(), aXML_AnimationEffect_EnumMap );
441 break;
442 case XML_ELEMENT(PRESENTATION, XML_DIRECTION):
443 SvXMLUnitConverter::convertEnum( meDirection, aIter.toView(), aXML_AnimationDirection_EnumMap );
444 break;
445 case XML_ELEMENT(PRESENTATION, XML_START_SCALE):
447 sal_Int32 nScale;
448 if (::sax::Converter::convertPercent( nScale, aIter.toView() ))
449 mnStartScale = static_cast<sal_Int16>(nScale);
450 break;
452 case XML_ELEMENT(PRESENTATION, XML_SPEED):
453 SvXMLUnitConverter::convertEnum( meSpeed, aIter.toView(), aXML_AnimationSpeed_EnumMap );
454 break;
455 case XML_ELEMENT(PRESENTATION, XML_PATH_ID):
456 maPathShapeId = aIter.toString();
457 break;
458 default:
459 XMLOFF_WARN_UNKNOWN("xmloff", aIter);
464 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLAnimationsEffectContext::createFastChildContext(
465 sal_Int32 nElement,
466 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
468 return new XMLAnimationsSoundContext( GetImport(), nElement, xAttrList, this );
471 void XMLAnimationsEffectContext::endFastElement(sal_Int32 )
473 // set effect on shape
477 if( !maShapeId.isEmpty() )
479 Reference< XPropertySet > xSet;
480 if( mxAnimationsContext->maLastShapeId != maShapeId )
482 xSet.set( GetImport().getInterfaceToIdentifierMapper().getReference( maShapeId ), UNO_QUERY );
483 if( xSet.is() )
485 // check for presentation shape service
487 Reference< XServiceInfo > xServiceInfo( xSet, UNO_QUERY );
488 if( !xServiceInfo.is() || !xServiceInfo->supportsService( u"com.sun.star.presentation.Shape"_ustr ) )
489 return;
492 mxAnimationsContext->maLastShapeId = maShapeId;
493 mxAnimationsContext->mxLastShape = xSet;
496 else
498 xSet = mxAnimationsContext->mxLastShape;
501 if( xSet.is() )
503 if( meKind == XMLE_DIM )
505 xSet->setPropertyValue( u"DimPrevious"_ustr, Any(true) );
507 xSet->setPropertyValue( u"DimColor"_ustr, Any(maDimColor) );
509 else if( meKind == XMLE_PLAY )
511 xSet->setPropertyValue( u"IsAnimation"_ustr, Any(true) );
513 // #i42894# speed is not supported for the old group animation fallback, so no need to set it
514 // aAny <<= meSpeed;
515 // xSet->setPropertyValue( mpImpl->msSpeed, aAny );
517 else
519 if( meKind == XMLE_HIDE && !mbTextEffect && meEffect == EK_none )
521 xSet->setPropertyValue( u"DimHide"_ustr, Any(true) );
523 else
525 const AnimationEffect eEffect = ImplSdXMLgetEffect( meEffect, meDirection, mnStartScale, meKind == XMLE_SHOW );
527 if (mbTextEffect)
528 xSet->setPropertyValue( u"TextEffect"_ustr, Any( eEffect ) );
529 else
530 xSet->setPropertyValue( u"Effect"_ustr, Any( eEffect ) );
531 xSet->setPropertyValue( u"Speed"_ustr, Any( meSpeed ) );
533 if( eEffect == AnimationEffect_PATH && !maPathShapeId.isEmpty() )
535 Reference< XShape > xPath( GetImport().getInterfaceToIdentifierMapper().getReference( maPathShapeId ), UNO_QUERY );
536 if( xPath.is() )
537 xSet->setPropertyValue( u"AnimationPath"_ustr, Any( xPath ) );
542 if( !maSoundURL.isEmpty() )
544 if( xSet.is() )
546 xSet->setPropertyValue( u"Sound"_ustr, Any(maSoundURL) );
547 xSet->setPropertyValue( u"PlayFull"_ustr, Any(mbPlayFull) );
548 xSet->setPropertyValue( u"SoundOn"_ustr, Any(true) );
550 else
552 OSL_FAIL("XMLAnimationsEffectContext::EndElement - Sound URL without a XPropertySet!");
557 catch (const Exception&)
559 TOOLS_WARN_EXCEPTION("xmloff.draw",
560 "exception caught while importing animation information!");
565 XMLAnimationsContext::XMLAnimationsContext( SvXMLImport& rImport )
566 : SvXMLImportContext(rImport)
570 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLAnimationsContext::createFastChildContext(
571 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
573 return new XMLAnimationsEffectContext( GetImport(), nElement, xAttrList, *this );
576 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */