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 
32 #include <sax/tools/converter.hxx>
33 #include <sal/log.hxx>
34 #include <tools/diagnose_ex.h>
35 
36 #include <xmloff/xmltoken.hxx>
37 #include <xmloff/xmlimp.hxx>
38 #include <xmloff/xmlnamespace.hxx>
39 #include <xmloff/xmluconv.hxx>
40 #include <xmloff/namespacemap.hxx>
41 #include <anim.hxx>
42 #include <animimp.hxx>
43 
44 using namespace ::std;
45 using namespace ::cppu;
46 using namespace ::com::sun::star;
47 using namespace ::com::sun::star::xml;
48 using namespace ::com::sun::star::xml::sax;
49 using namespace ::com::sun::star::uno;
50 using namespace ::com::sun::star::drawing;
51 using namespace ::com::sun::star::beans;
52 using namespace ::com::sun::star::lang;
53 using namespace ::com::sun::star::presentation;
54 using 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 },
63  { XML_CLOSE, EK_close },
66  { XML_RANDOM, EK_random },
67  { XML_LINES, EK_lines },
68  { XML_LASER, EK_laser },
69  { XML_APPEAR, EK_appear },
70  { XML_HIDE, EK_hide },
73  { XML_ROTATE, EK_rotate },
76 };
77 
79 {
80  { XML_NONE, ED_none },
91  { XML_TO_TOP, ED_to_top },
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 
119 AnimationEffect 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 
323 namespace
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 
339 namespace {
340 
342 {
343  XMLE_SHOW,
344  XMLE_HIDE,
345  XMLE_DIM,
346  XMLE_PLAY
347 };
348 
349 class XMLAnimationsEffectContext : public SvXMLImportContext
350 {
351 public:
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 
368 public:
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 
381 class XMLAnimationsSoundContext : public SvXMLImportContext
382 {
383 public:
384 
385  XMLAnimationsSoundContext( SvXMLImport& rImport, sal_Int32 nElement, const Reference< XFastAttributeList >& xAttrList, XMLAnimationsEffectContext* pParent );
386 };
387 
388 }
389 
390 XMLAnimationsSoundContext::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 
412 XMLAnimationsEffectContext::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.toString());
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 
486 css::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 
493 void XMLAnimationsEffectContext::endFastElement(sal_Int32 )
494 {
495  // set effect on shape
496 
497  try
498  {
499  if( !maShapeId.isEmpty() )
500  {
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, makeAny( eEffect ) );
551  else
552  xSet->setPropertyValue( gsEffect, makeAny( eEffect ) );
553  xSet->setPropertyValue( gsSpeed, makeAny( 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, makeAny( 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 
592 css::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: */
Definition: anim.hxx:32
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
Definition: xmluconv.hxx:80
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:59
XMLEffectDirection
Definition: anim.hxx:49
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
Definition: xmltoken.cxx:3480
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
const SvXMLEnumMapEntry< XMLEffectDirection > aXML_AnimationDirection_EnumMap[]
Definition: animimp.cxx:78
const SvXMLEnumMapEntry< XMLEffect > aXML_AnimationEffect_EnumMap[]
Definition: animimp.cxx:56
XMLAnimationsContext(SvXMLImport &rImport)
Definition: animimp.cxx:587
constexpr OUStringLiteral gsSpeed(u"Speed")
#define XMLOFF_WARN_UNKNOWN(area, rIter)
Definition: xmlictxt.hxx:113
XMLActionKind
Definition: animexp.cxx:195
#define TOOLS_WARN_EXCEPTION(area, stream)
Definition: anim.hxx:71
constexpr OUStringLiteral gsPlayFull(u"PlayFull")
float u
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
Definition: anim.hxx:30
static bool convertPercent(sal_Int32 &rValue, std::u16string_view rString)
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:44
Map an XMLTokenEnum to an enum value.
Definition: ximpshap.hxx:39
const SvXMLEnumMapEntry< AnimationSpeed > aXML_AnimationSpeed_EnumMap[]
Definition: animimp.cxx:111
XMLEffect
Definition: anim.hxx:26
Definition: anim.hxx:51
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
Handling of tokens in XML:
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
Definition: anim.hxx:28
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:96
Definition: anim.hxx:29
constexpr sal_Int32 TOKEN_MASK
Definition: xmlimp.hxx:93
#define XMLOFF_WARN_UNKNOWN_ELEMENT(area, token)
Definition: xmlictxt.hxx:119
AnimationEffect ImplSdXMLgetEffect(XMLEffect eKind, XMLEffectDirection eDirection, sal_Int16 nStartScale, bool)
Definition: animimp.cxx:119
Definition: anim.hxx:40
OUString toString(OptionInfo const *info)
constexpr OUStringLiteral gsEffect(u"Effect")
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)