LibreOffice Module xmloff (master) 1
animimp.cxx
Go to the documentation of this file.
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 <string_view>
23
25#include <com/sun/star/lang/XServiceInfo.hpp>
26#include <com/sun/star/presentation/AnimationEffect.hpp>
27#include <com/sun/star/presentation/AnimationSpeed.hpp>
28#include <com/sun/star/beans/XPropertySet.hpp>
29#include <com/sun/star/drawing/XShape.hpp>
30#include <com/sun/star/xml/sax/XAttributeList.hpp>
31
33#include <sal/log.hxx>
35
36#include <xmloff/xmltoken.hxx>
37#include <xmloff/xmlimp.hxx>
39#include <xmloff/xmluconv.hxx>
41#include <anim.hxx>
42#include <animimp.hxx>
43
44using namespace ::std;
45using namespace ::cppu;
46using namespace ::com::sun::star;
47using namespace ::com::sun::star::xml;
48using namespace ::com::sun::star::xml::sax;
49using namespace ::com::sun::star::uno;
50using namespace ::com::sun::star::drawing;
51using namespace ::com::sun::star::beans;
52using namespace ::com::sun::star::lang;
53using namespace ::com::sun::star::presentation;
54using namespace ::xmloff::token;
55
57{
58 { XML_NONE, EK_none },
59 { XML_FADE, EK_fade },
60 { XML_MOVE, EK_move },
62 { XML_OPEN, EK_open },
70 { XML_HIDE, EK_hide },
76};
77
79{
80 { XML_NONE, ED_none },
98 { XML_PATH, ED_path },
109};
110
112{
113 { XML_SLOW, AnimationSpeed_SLOW },
114 { XML_MEDIUM, AnimationSpeed_MEDIUM },
115 { XML_FAST, AnimationSpeed_FAST },
116 { XML_TOKEN_INVALID, AnimationSpeed(0) }
117};
118
119AnimationEffect ImplSdXMLgetEffect( XMLEffect eKind, XMLEffectDirection eDirection, sal_Int16 nStartScale, bool /*bIn*/ )
120{
121 switch( eKind )
122 {
123 case EK_fade:
124 switch( eDirection )
125 {
126 case ED_from_left: return AnimationEffect_FADE_FROM_LEFT;
127 case ED_from_top: return AnimationEffect_FADE_FROM_TOP;
128 case ED_from_right: return AnimationEffect_FADE_FROM_RIGHT;
129 case ED_from_bottom: return AnimationEffect_FADE_FROM_BOTTOM;
130 case ED_from_center: return AnimationEffect_FADE_FROM_CENTER;
131 case ED_from_upperleft: return AnimationEffect_FADE_FROM_UPPERLEFT;
132 case ED_from_upperright: return AnimationEffect_FADE_FROM_UPPERRIGHT;
133 case ED_from_lowerleft: return AnimationEffect_FADE_FROM_LOWERLEFT;
134 case ED_from_lowerright: return AnimationEffect_FADE_FROM_LOWERRIGHT;
135 case ED_to_center: return AnimationEffect_FADE_TO_CENTER;
136 case ED_clockwise: return AnimationEffect_CLOCKWISE;
137 case ED_cclockwise: return AnimationEffect_COUNTERCLOCKWISE;
138 case ED_spiral_inward_left: return AnimationEffect_SPIRALIN_LEFT;
139 case ED_spiral_inward_right:return AnimationEffect_SPIRALIN_RIGHT;
140 case ED_spiral_outward_left:return AnimationEffect_SPIRALOUT_LEFT;
141 case ED_spiral_outward_right:return AnimationEffect_SPIRALOUT_RIGHT;
142 default: return AnimationEffect_FADE_FROM_LEFT;
143 }
144 case EK_move:
145 if( nStartScale == 200 )
146 {
147 return AnimationEffect_ZOOM_OUT_SMALL;
148 }
149 else if( nStartScale == 50 )
150 {
151 return AnimationEffect_ZOOM_IN_SMALL;
152 }
153 else if( nStartScale < 100 )
154 {
155 switch( eDirection )
156 {
157 case ED_from_left: return AnimationEffect_ZOOM_IN_FROM_LEFT;
158 case ED_from_top: return AnimationEffect_ZOOM_IN_FROM_TOP;
159 case ED_from_right: return AnimationEffect_ZOOM_IN_FROM_RIGHT;
160 case ED_from_bottom: return AnimationEffect_ZOOM_IN_FROM_BOTTOM;
161 case ED_from_upperleft: return AnimationEffect_ZOOM_IN_FROM_UPPERLEFT;
162 case ED_from_upperright: return AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT;
163 case ED_from_lowerleft: return AnimationEffect_ZOOM_IN_FROM_LOWERLEFT;
164 case ED_from_lowerright: return AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT;
165 case ED_from_center: return AnimationEffect_ZOOM_IN_FROM_CENTER;
166 case ED_spiral_inward_left: return AnimationEffect_ZOOM_IN_SPIRAL;
167 case ED_to_left: return AnimationEffect_MOVE_TO_LEFT;
168 case ED_to_top: return AnimationEffect_MOVE_TO_TOP;
169 case ED_to_right: return AnimationEffect_MOVE_TO_RIGHT;
170 case ED_to_bottom: return AnimationEffect_MOVE_TO_BOTTOM;
171 case ED_to_upperleft: return AnimationEffect_MOVE_TO_UPPERLEFT;
172 case ED_to_upperright: return AnimationEffect_MOVE_TO_UPPERRIGHT;
173 case ED_to_lowerright: return AnimationEffect_MOVE_TO_LOWERRIGHT;
174 case ED_to_lowerleft: return AnimationEffect_MOVE_TO_LOWERLEFT;
175 default: return AnimationEffect_ZOOM_IN;
176 }
177 }
178 else if( nStartScale > 100 )
179 {
180 switch( eDirection )
181 {
182 case ED_from_left: return AnimationEffect_ZOOM_OUT_FROM_LEFT;
183 case ED_from_top: return AnimationEffect_ZOOM_OUT_FROM_TOP;
184 case ED_from_right: return AnimationEffect_ZOOM_OUT_FROM_RIGHT;
185 case ED_from_bottom: return AnimationEffect_ZOOM_OUT_FROM_BOTTOM;
186 case ED_from_upperleft: return AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT;
187 case ED_from_upperright: return AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT;
188 case ED_from_lowerleft: return AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT;
189 case ED_from_lowerright: return AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT;
190 case ED_from_center: return AnimationEffect_ZOOM_OUT_FROM_CENTER;
191 case ED_spiral_inward_left: return AnimationEffect_ZOOM_OUT_SPIRAL;
192 default: return AnimationEffect_ZOOM_OUT;
193 }
194 }
195 else
196 {
197 switch( eDirection )
198 {
199 case ED_from_left: return AnimationEffect_MOVE_FROM_LEFT;
200 case ED_from_top: return AnimationEffect_MOVE_FROM_TOP;
201 case ED_from_right: return AnimationEffect_MOVE_FROM_RIGHT;
202 case ED_from_bottom: return AnimationEffect_MOVE_FROM_BOTTOM;
203 case ED_from_upperleft: return AnimationEffect_MOVE_FROM_UPPERLEFT;
204 case ED_from_upperright: return AnimationEffect_MOVE_FROM_UPPERRIGHT;
205 case ED_from_lowerleft: return AnimationEffect_MOVE_FROM_LOWERLEFT;
206 case ED_from_lowerright: return AnimationEffect_MOVE_FROM_LOWERRIGHT;
207 case ED_path: return AnimationEffect_PATH;
208 case ED_to_top: return AnimationEffect_MOVE_TO_TOP;
209 case ED_to_right: return AnimationEffect_MOVE_TO_RIGHT;
210 case ED_to_bottom: return AnimationEffect_MOVE_TO_BOTTOM;
211 case ED_to_upperleft: return AnimationEffect_MOVE_TO_UPPERLEFT;
212 case ED_to_upperright: return AnimationEffect_MOVE_TO_UPPERRIGHT;
213 case ED_to_lowerright: return AnimationEffect_MOVE_TO_LOWERRIGHT;
214 case ED_to_lowerleft: return AnimationEffect_MOVE_TO_LOWERLEFT;
215 default:
216 break;
217 }
218 }
219 return AnimationEffect_MOVE_FROM_LEFT;
220 case EK_stripes:
221 if( eDirection == ED_vertical )
222 return AnimationEffect_VERTICAL_STRIPES;
223 else
224 return AnimationEffect_HORIZONTAL_STRIPES;
225 case EK_open:
226 if( eDirection == ED_vertical )
227 return AnimationEffect_OPEN_VERTICAL;
228 else
229 return AnimationEffect_OPEN_HORIZONTAL;
230 case EK_close:
231 if( eDirection == ED_vertical )
232 return AnimationEffect_CLOSE_VERTICAL;
233 else
234 return AnimationEffect_CLOSE_HORIZONTAL;
235 case EK_dissolve:
236 return AnimationEffect_DISSOLVE;
237 case EK_wavyline:
238 switch( eDirection )
239 {
240 case ED_from_left: return AnimationEffect_WAVYLINE_FROM_LEFT;
241 case ED_from_top: return AnimationEffect_WAVYLINE_FROM_TOP;
242 case ED_from_right: return AnimationEffect_WAVYLINE_FROM_RIGHT;
243 case ED_from_bottom: return AnimationEffect_WAVYLINE_FROM_BOTTOM;
244 default: return AnimationEffect_WAVYLINE_FROM_LEFT;
245 }
246 case EK_random:
247 return AnimationEffect_RANDOM;
248 case EK_lines:
249 if( eDirection == ED_vertical )
250 return AnimationEffect_VERTICAL_LINES;
251 else
252 return AnimationEffect_HORIZONTAL_LINES;
253 case EK_laser:
254 switch( eDirection )
255 {
256 case ED_from_left: return AnimationEffect_LASER_FROM_LEFT;
257 case ED_from_top: return AnimationEffect_LASER_FROM_TOP;
258 case ED_from_right: return AnimationEffect_LASER_FROM_RIGHT;
259 case ED_from_bottom: return AnimationEffect_LASER_FROM_BOTTOM;
260 case ED_from_upperleft: return AnimationEffect_LASER_FROM_UPPERLEFT;
261 case ED_from_upperright: return AnimationEffect_LASER_FROM_UPPERRIGHT;
262 case ED_from_lowerleft: return AnimationEffect_LASER_FROM_LOWERLEFT;
263 case ED_from_lowerright: return AnimationEffect_LASER_FROM_LOWERRIGHT;
264 default: return AnimationEffect_LASER_FROM_LEFT;
265 }
266 case EK_appear:
267 return AnimationEffect_APPEAR;
268 case EK_hide:
269 return AnimationEffect_HIDE;
270 case EK_move_short:
271 switch( eDirection )
272 {
273 case ED_from_left: return AnimationEffect_MOVE_SHORT_FROM_LEFT;
274 case ED_from_top: return AnimationEffect_MOVE_SHORT_FROM_TOP;
275 case ED_from_right: return AnimationEffect_MOVE_SHORT_FROM_RIGHT;
276 case ED_from_bottom: return AnimationEffect_MOVE_SHORT_FROM_BOTTOM;
277 case ED_from_upperleft: return AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT;
278 case ED_from_upperright: return AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT;
279 case ED_from_lowerleft: return AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT;
280 case ED_from_lowerright: return AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT;
281 case ED_to_left: return AnimationEffect_MOVE_SHORT_TO_LEFT;
282 case ED_to_upperleft: return AnimationEffect_MOVE_SHORT_TO_UPPERLEFT;
283 case ED_to_top: return AnimationEffect_MOVE_SHORT_TO_TOP;
284 case ED_to_upperright: return AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT;
285 case ED_to_right: return AnimationEffect_MOVE_SHORT_TO_RIGHT;
286 case ED_to_lowerright: return AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT;
287 case ED_to_bottom: return AnimationEffect_MOVE_SHORT_TO_BOTTOM;
288 case ED_to_lowerleft: return AnimationEffect_MOVE_SHORT_TO_LOWERLEFT;
289 default: return AnimationEffect_MOVE_SHORT_FROM_LEFT;
290 }
291 case EK_checkerboard:
292 if( eDirection == ED_vertical )
293 return AnimationEffect_VERTICAL_CHECKERBOARD;
294 else
295 return AnimationEffect_HORIZONTAL_CHECKERBOARD;
296 case EK_rotate:
297 if( eDirection == ED_vertical )
298 return AnimationEffect_VERTICAL_ROTATE;
299 else
300 return AnimationEffect_HORIZONTAL_ROTATE;
301 case EK_stretch:
302 switch( eDirection )
303 {
304 case ED_from_left: return AnimationEffect_STRETCH_FROM_LEFT;
305 case ED_from_top: return AnimationEffect_STRETCH_FROM_TOP;
306 case ED_from_right: return AnimationEffect_STRETCH_FROM_RIGHT;
307 case ED_from_bottom: return AnimationEffect_STRETCH_FROM_BOTTOM;
308 case ED_from_upperleft: return AnimationEffect_STRETCH_FROM_UPPERLEFT;
309 case ED_from_upperright: return AnimationEffect_STRETCH_FROM_UPPERRIGHT;
310 case ED_from_lowerleft: return AnimationEffect_STRETCH_FROM_LOWERLEFT;
311 case ED_from_lowerright: return AnimationEffect_STRETCH_FROM_LOWERRIGHT;
312 case ED_vertical: return AnimationEffect_VERTICAL_STRETCH;
313 case ED_horizontal: return AnimationEffect_HORIZONTAL_STRETCH;
314 default:
315 break;
316 }
317 return AnimationEffect_STRETCH_FROM_LEFT;
318 default:
319 return AnimationEffect_NONE;
320 }
321}
322
323namespace
324{
325 constexpr OUStringLiteral gsDimColor = u"DimColor";
326 constexpr OUStringLiteral gsDimHide = u"DimHide";
327 constexpr OUStringLiteral gsDimPrev = u"DimPrevious";
328 constexpr OUStringLiteral gsEffect = u"Effect";
329 constexpr OUStringLiteral gsPlayFull = u"PlayFull";
330 constexpr OUStringLiteral gsSound = u"Sound";
331 constexpr OUStringLiteral gsSoundOn = u"SoundOn";
332 constexpr OUStringLiteral gsSpeed = u"Speed";
333 constexpr OUStringLiteral gsTextEffect = u"TextEffect";
334 constexpr OUStringLiteral gsPresShapeService = u"com.sun.star.presentation.Shape";
335 constexpr OUStringLiteral gsAnimPath = u"AnimationPath";
336 constexpr OUStringLiteral gsIsAnimation = u"IsAnimation";
337};
338
339namespace {
340
341enum XMLActionKind
342{
343 XMLE_SHOW,
344 XMLE_HIDE,
345 XMLE_DIM,
346 XMLE_PLAY
347};
348
349class XMLAnimationsEffectContext : public SvXMLImportContext
350{
351public:
352 rtl::Reference<XMLAnimationsContext> mxAnimationsContext;
353
354 XMLActionKind meKind;
355 bool mbTextEffect;
356 OUString maShapeId;
357
358 XMLEffect meEffect;
359 XMLEffectDirection meDirection;
360 sal_Int16 mnStartScale;
361
362 AnimationSpeed meSpeed;
363 sal_Int32 maDimColor;
364 OUString maSoundURL;
365 bool mbPlayFull;
366 OUString maPathShapeId;
367
368public:
369
370 XMLAnimationsEffectContext( SvXMLImport& rImport,
371 sal_Int32 nElement,
372 const Reference< XFastAttributeList >& xAttrList,
373 XMLAnimationsContext& rAnimationsContext);
374
375 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
376
377 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
378 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
379};
380
381class XMLAnimationsSoundContext : public SvXMLImportContext
382{
383public:
384
385 XMLAnimationsSoundContext( SvXMLImport& rImport, sal_Int32 nElement, const Reference< XFastAttributeList >& xAttrList, XMLAnimationsEffectContext* pParent );
386};
387
388}
389
390XMLAnimationsSoundContext::XMLAnimationsSoundContext( SvXMLImport& rImport, sal_Int32 nElement, const Reference< XFastAttributeList >& xAttrList, XMLAnimationsEffectContext* pParent )
391: SvXMLImportContext( rImport )
392{
393 if( !pParent || nElement != XML_ELEMENT(PRESENTATION, XML_SOUND) )
394 return;
395
396 for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
397 {
398 switch( aIter.getToken() )
399 {
400 case XML_ELEMENT(XLINK, XML_HREF):
401 pParent->maSoundURL = rImport.GetAbsoluteReference(aIter.toString());
402 break;
403 case XML_ELEMENT(PRESENTATION, XML_PLAY_FULL):
404 pParent->mbPlayFull = IsXMLToken( aIter, XML_TRUE );
405 break;
406 default:
407 XMLOFF_WARN_UNKNOWN("xmloff", aIter);
408 }
409 }
410}
411
412XMLAnimationsEffectContext::XMLAnimationsEffectContext( SvXMLImport& rImport,
413 sal_Int32 nElement,
414 const Reference< XFastAttributeList >& xAttrList,
415 XMLAnimationsContext& rAnimationsContext )
416: SvXMLImportContext(rImport),
417 mxAnimationsContext( &rAnimationsContext ),
418 meKind( XMLE_SHOW ), mbTextEffect( false ),
419 meEffect( EK_none ), meDirection( ED_none ), mnStartScale( 100 ),
420 meSpeed( AnimationSpeed_MEDIUM ), maDimColor(0), mbPlayFull( false )
421{
422 switch(nElement & TOKEN_MASK)
423 {
424 case XML_SHOW_SHAPE:
425 meKind = XMLE_SHOW;
426 break;
427 case XML_SHOW_TEXT:
428 meKind = XMLE_SHOW;
429 mbTextEffect = true;
430 break;
431 case XML_HIDE_SHAPE:
432 meKind = XMLE_HIDE;
433 break;
434 case XML_HIDE_TEXT:
435 meKind = XMLE_HIDE;
436 mbTextEffect = true;
437 break;
438 case XML_DIM:
439 meKind = XMLE_DIM;
440 break;
441 case XML_PLAY:
442 meKind = XMLE_PLAY;
443 break;
444 default:
445 XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
446 // unknown action, overread
447 return;
448 }
449
450 for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
451 {
452 switch( aIter.getToken() )
453 {
454 case XML_ELEMENT(DRAW, XML_SHAPE_ID):
455 maShapeId = aIter.toString();
456 break;
457 case XML_ELEMENT(DRAW, XML_COLOR):
458 ::sax::Converter::convertColor(maDimColor, aIter.toView());
459 break;
460
461 case XML_ELEMENT(PRESENTATION, XML_EFFECT):
462 SvXMLUnitConverter::convertEnum( meEffect, aIter.toView(), aXML_AnimationEffect_EnumMap );
463 break;
464 case XML_ELEMENT(PRESENTATION, XML_DIRECTION):
465 SvXMLUnitConverter::convertEnum( meDirection, aIter.toView(), aXML_AnimationDirection_EnumMap );
466 break;
467 case XML_ELEMENT(PRESENTATION, XML_START_SCALE):
468 {
469 sal_Int32 nScale;
470 if (::sax::Converter::convertPercent( nScale, aIter.toView() ))
471 mnStartScale = static_cast<sal_Int16>(nScale);
472 break;
473 }
474 case XML_ELEMENT(PRESENTATION, XML_SPEED):
475 SvXMLUnitConverter::convertEnum( meSpeed, aIter.toView(), aXML_AnimationSpeed_EnumMap );
476 break;
477 case XML_ELEMENT(PRESENTATION, XML_PATH_ID):
478 maPathShapeId = aIter.toString();
479 break;
480 default:
481 XMLOFF_WARN_UNKNOWN("xmloff", aIter);
482 }
483 }
484}
485
486css::uno::Reference< css::xml::sax::XFastContextHandler > XMLAnimationsEffectContext::createFastChildContext(
487 sal_Int32 nElement,
488 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
489{
490 return new XMLAnimationsSoundContext( GetImport(), nElement, xAttrList, this );
491}
492
493void XMLAnimationsEffectContext::endFastElement(sal_Int32 )
494{
495 // set effect on shape
496
497 try
498 {
499 if( !maShapeId.isEmpty() )
500 {
501 Reference< XPropertySet > xSet;
502 if( mxAnimationsContext->maLastShapeId != maShapeId )
503 {
504 xSet.set( GetImport().getInterfaceToIdentifierMapper().getReference( maShapeId ), UNO_QUERY );
505 if( xSet.is() )
506 {
507 // check for presentation shape service
508 {
509 Reference< XServiceInfo > xServiceInfo( xSet, UNO_QUERY );
510 if( !xServiceInfo.is() || !xServiceInfo->supportsService( gsPresShapeService ) )
511 return;
512 }
513
514 mxAnimationsContext->maLastShapeId = maShapeId;
515 mxAnimationsContext->mxLastShape = xSet;
516 }
517 }
518 else
519 {
520 xSet = mxAnimationsContext->mxLastShape;
521 }
522
523 if( xSet.is() )
524 {
525 if( meKind == XMLE_DIM )
526 {
527 xSet->setPropertyValue( gsDimPrev, Any(true) );
528
529 xSet->setPropertyValue( gsDimColor, Any(maDimColor) );
530 }
531 else if( meKind == XMLE_PLAY )
532 {
533 xSet->setPropertyValue( gsIsAnimation, Any(true) );
534
535 // #i42894# speed is not supported for the old group animation fallback, so no need to set it
536 // aAny <<= meSpeed;
537 // xSet->setPropertyValue( mpImpl->msSpeed, aAny );
538 }
539 else
540 {
541 if( meKind == XMLE_HIDE && !mbTextEffect && meEffect == EK_none )
542 {
543 xSet->setPropertyValue( gsDimHide, Any(true) );
544 }
545 else
546 {
547 const AnimationEffect eEffect = ImplSdXMLgetEffect( meEffect, meDirection, mnStartScale, meKind == XMLE_SHOW );
548
549 if (mbTextEffect)
550 xSet->setPropertyValue( gsTextEffect, Any( eEffect ) );
551 else
552 xSet->setPropertyValue( gsEffect, Any( eEffect ) );
553 xSet->setPropertyValue( gsSpeed, Any( meSpeed ) );
554
555 if( eEffect == AnimationEffect_PATH && !maPathShapeId.isEmpty() )
556 {
557 Reference< XShape > xPath( GetImport().getInterfaceToIdentifierMapper().getReference( maPathShapeId ), UNO_QUERY );
558 if( xPath.is() )
559 xSet->setPropertyValue( gsAnimPath, Any( xPath ) );
560 }
561 }
562 }
563 }
564 if( !maSoundURL.isEmpty() )
565 {
566 if( xSet.is() )
567 {
568 xSet->setPropertyValue( gsSound, Any(maSoundURL) );
569 xSet->setPropertyValue( gsPlayFull, Any(mbPlayFull) );
570 xSet->setPropertyValue( gsSoundOn, Any(true) );
571 }
572 else
573 {
574 OSL_FAIL("XMLAnimationsEffectContext::EndElement - Sound URL without a XPropertySet!");
575 }
576 }
577 }
578 }
579 catch (const Exception&)
580 {
581 TOOLS_WARN_EXCEPTION("xmloff.draw",
582 "exception caught while importing animation information!");
583 }
584}
585
586
588: SvXMLImportContext(rImport)
589{
590}
591
592css::uno::Reference< css::xml::sax::XFastContextHandler > XMLAnimationsContext::createFastChildContext(
593 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
594{
595 return new XMLAnimationsEffectContext( GetImport(), nElement, xAttrList, *this );
596}
597
598/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XMLEffectDirection
Definition: anim.hxx:50
@ ED_to_right
Definition: anim.hxx:64
@ ED_from_lowerleft
Definition: anim.hxx:59
@ ED_to_top
Definition: anim.hxx:63
@ ED_spiral_outward_left
Definition: anim.hxx:74
@ ED_from_upperright
Definition: anim.hxx:58
@ ED_clockwise
Definition: anim.hxx:82
@ ED_none
Definition: anim.hxx:51
@ ED_vertical
Definition: anim.hxx:77
@ ED_to_bottom
Definition: anim.hxx:65
@ ED_spiral_inward_left
Definition: anim.hxx:72
@ ED_to_lowerright
Definition: anim.hxx:68
@ ED_to_upperright
Definition: anim.hxx:67
@ ED_from_lowerright
Definition: anim.hxx:60
@ ED_cclockwise
Definition: anim.hxx:83
@ ED_spiral_inward_right
Definition: anim.hxx:73
@ ED_spiral_outward_right
Definition: anim.hxx:75
@ ED_to_upperleft
Definition: anim.hxx:66
@ ED_to_left
Definition: anim.hxx:62
@ ED_to_center
Definition: anim.hxx:80
@ ED_from_upperleft
Definition: anim.hxx:57
@ ED_from_bottom
Definition: anim.hxx:55
@ ED_horizontal
Definition: anim.hxx:78
@ ED_from_top
Definition: anim.hxx:53
@ ED_path
Definition: anim.hxx:71
@ ED_from_right
Definition: anim.hxx:54
@ ED_to_lowerleft
Definition: anim.hxx:69
@ ED_from_center
Definition: anim.hxx:56
@ ED_from_left
Definition: anim.hxx:52
XMLEffect
Definition: anim.hxx:27
@ EK_rotate
Definition: anim.hxx:43
@ EK_fade
Definition: anim.hxx:29
@ EK_laser
Definition: anim.hxx:38
@ EK_stretch
Definition: anim.hxx:44
@ EK_none
Definition: anim.hxx:28
@ EK_appear
Definition: anim.hxx:39
@ EK_close
Definition: anim.hxx:33
@ EK_random
Definition: anim.hxx:36
@ EK_open
Definition: anim.hxx:32
@ EK_checkerboard
Definition: anim.hxx:42
@ EK_lines
Definition: anim.hxx:37
@ EK_dissolve
Definition: anim.hxx:34
@ EK_move
Definition: anim.hxx:30
@ EK_hide
Definition: anim.hxx:40
@ EK_wavyline
Definition: anim.hxx:35
@ EK_stripes
Definition: anim.hxx:31
@ EK_move_short
Definition: anim.hxx:41
AnimationEffect ImplSdXMLgetEffect(XMLEffect eKind, XMLEffectDirection eDirection, sal_Int16 nStartScale, bool)
Definition: animimp.cxx:119
const SvXMLEnumMapEntry< XMLEffectDirection > aXML_AnimationDirection_EnumMap[]
Definition: animimp.cxx:78
const SvXMLEnumMapEntry< AnimationSpeed > aXML_AnimationSpeed_EnumMap[]
Definition: animimp.cxx:111
const SvXMLEnumMapEntry< XMLEffect > aXML_AnimationEffect_EnumMap[]
Definition: animimp.cxx:56
This class deliberately does not support XWeak, to improve performance when loading large documents.
Definition: xmlictxt.hxx:48
virtual void SAL_CALL endFastElement(sal_Int32 Element) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: xmlictxt.cxx:40
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:60
virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
Definition: xmlictxt.cxx:59
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
Definition: xmluconv.hxx:83
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: animimp.cxx:592
XMLAnimationsContext(SvXMLImport &rImport)
Definition: animimp.cxx:587
static bool convertPercent(sal_Int32 &rValue, std::u16string_view rString)
#define TOOLS_WARN_EXCEPTION(area, stream)
float u
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
OUString toString(OptionInfo const *info)
Handling of tokens in XML:
@ XML_SPIRAL_INWARD_LEFT
Definition: xmltoken.hxx:1804
@ XML_FROM_LOWER_RIGHT
Definition: xmltoken.hxx:954
@ XML_FROM_UPPER_RIGHT
Definition: xmltoken.hxx:959
@ XML_COUNTER_CLOCKWISE
Definition: xmltoken.hxx:533
@ XML_SPIRAL_OUTWARD_RIGHT
Definition: xmltoken.hxx:1808
@ XML_SPIRAL_OUTWARD_LEFT
Definition: xmltoken.hxx:1807
@ XML_SPIRAL_INWARD_RIGHT
Definition: xmltoken.hxx:1805
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
Definition: xmltoken.cxx:3581
constexpr OUStringLiteral gsPlayFull(u"PlayFull")
constexpr OUStringLiteral gsEffect(u"Effect")
constexpr OUStringLiteral gsSpeed(u"Speed")
#define XMLOFF_WARN_UNKNOWN_ELEMENT(area, token)
Definition: xmlictxt.hxx:120
#define XMLOFF_WARN_UNKNOWN(area, rIter)
Definition: xmlictxt.hxx:114
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:98
constexpr sal_Int32 TOKEN_MASK
Definition: xmlimp.hxx:95