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