LCOV - code coverage report
Current view: top level - xmloff/source/draw - animationexport.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 77 641 12.0 %
Date: 2015-06-13 12:38:46 Functions: 13 25 52.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      21             : #include <com/sun/star/animations/XAnimateColor.hpp>
      22             : #include <com/sun/star/animations/XAnimateSet.hpp>
      23             : #include <com/sun/star/animations/XCommand.hpp>
      24             : #include <com/sun/star/animations/Timing.hpp>
      25             : #include <com/sun/star/animations/Event.hpp>
      26             : #include <com/sun/star/animations/XAnimateMotion.hpp>
      27             : #include <com/sun/star/animations/XAnimateTransform.hpp>
      28             : #include <com/sun/star/animations/XTransitionFilter.hpp>
      29             : #include <com/sun/star/animations/XIterateContainer.hpp>
      30             : #include <com/sun/star/animations/XAudio.hpp>
      31             : #include <com/sun/star/animations/AnimationColorSpace.hpp>
      32             : #include <com/sun/star/animations/AnimationNodeType.hpp>
      33             : #include <com/sun/star/animations/AnimationRestart.hpp>
      34             : #include <com/sun/star/animations/EventTrigger.hpp>
      35             : #include <com/sun/star/animations/AnimationFill.hpp>
      36             : #include <com/sun/star/animations/AnimationEndSync.hpp>
      37             : #include <com/sun/star/animations/AnimationCalcMode.hpp>
      38             : #include <com/sun/star/animations/AnimationAdditiveMode.hpp>
      39             : #include <com/sun/star/animations/AnimationTransformType.hpp>
      40             : #include <com/sun/star/animations/TransitionType.hpp>
      41             : #include <com/sun/star/animations/TransitionSubType.hpp>
      42             : #include <com/sun/star/animations/ValuePair.hpp>
      43             : #include <com/sun/star/container/XEnumerationAccess.hpp>
      44             : #include <com/sun/star/beans/NamedValue.hpp>
      45             : #include <com/sun/star/presentation/EffectNodeType.hpp>
      46             : #include <com/sun/star/presentation/EffectPresetClass.hpp>
      47             : #include <com/sun/star/presentation/ParagraphTarget.hpp>
      48             : #include <com/sun/star/presentation/TextAnimationType.hpp>
      49             : #include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
      50             : #include <com/sun/star/presentation/EffectCommands.hpp>
      51             : #include <com/sun/star/drawing/XShape.hpp>
      52             : 
      53             : #include <sax/tools/converter.hxx>
      54             : 
      55             : #include <tools/debug.hxx>
      56             : #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
      57             : #include "sdxmlexp_impl.hxx"
      58             : #include "sdpropls.hxx"
      59             : #include <xmloff/xmltoken.hxx>
      60             : #include <xmloff/xmlnmspe.hxx>
      61             : #include <xmloff/xmluconv.hxx>
      62             : #include <xmloff/xmlexp.hxx>
      63             : #include <xmloff/xmlement.hxx>
      64             : #include <xmloff/nmspmap.hxx>
      65             : #include <xmloff/shapeexport.hxx>
      66             : #include <xmloff/xmlprhdl.hxx>
      67             : 
      68             : #include "animations.hxx"
      69             : #include <xmloff/animationexport.hxx>
      70             : 
      71             : 
      72             : using namespace ::std;
      73             : using namespace ::cppu;
      74             : using namespace ::com::sun::star::animations;
      75             : using namespace ::com::sun::star::presentation;
      76             : using namespace ::com::sun::star::drawing;
      77             : using namespace ::com::sun::star::beans;
      78             : using namespace ::xmloff::token;
      79             : 
      80             : using ::com::sun::star::uno::Any;
      81             : using ::com::sun::star::uno::UNO_QUERY;
      82             : using ::com::sun::star::uno::UNO_QUERY_THROW;
      83             : using ::com::sun::star::uno::Reference;
      84             : using ::com::sun::star::uno::Sequence;
      85             : using ::com::sun::star::uno::Exception;
      86             : using ::com::sun::star::uno::RuntimeException;
      87             : using ::com::sun::star::uno::XInterface;
      88             : using ::com::sun::star::beans::NamedValue;
      89             : using ::com::sun::star::container::XEnumerationAccess;
      90             : using ::com::sun::star::container::XEnumeration;
      91             : 
      92             : namespace xmloff
      93             : {
      94             : 
      95        3243 : const SvXMLEnumMapEntry* getAnimationsEnumMap( sal_uInt16 nMap )
      96             : {
      97        3243 :     switch( nMap )
      98             :     {
      99             :     case Animations_EnumMap_Fill:
     100             :         {
     101             :             static const SvXMLEnumMapEntry aAnimations_EnumMap_Fill[] =
     102             :             {
     103             :                 { XML_DEFAULT,      AnimationFill::DEFAULT },
     104             :                 { XML_REMOVE,       AnimationFill::REMOVE },
     105             :                 { XML_FREEZE,       AnimationFill::FREEZE },
     106             :                 { XML_HOLD,         AnimationFill::HOLD },
     107             :                 { XML_TRANSITION,   AnimationFill::TRANSITION },
     108             :                 { XML_AUTO,         AnimationFill::AUTO },
     109             :                 { XML_TOKEN_INVALID, 0 }
     110             :             };
     111           4 :             return aAnimations_EnumMap_Fill;
     112             :         }
     113             :     case Animations_EnumMap_FillDefault:
     114             :         {
     115             :             static const SvXMLEnumMapEntry aAnimations_EnumMap_Fill[] =
     116             :             {
     117             :                 { XML_INHERIT,      AnimationFill::INHERIT },
     118             :                 { XML_REMOVE,       AnimationFill::REMOVE },
     119             :                 { XML_FREEZE,       AnimationFill::FREEZE },
     120             :                 { XML_HOLD,         AnimationFill::HOLD },
     121             :                 { XML_TRANSITION,   AnimationFill::TRANSITION },
     122             :                 { XML_AUTO,         AnimationFill::AUTO },
     123             :                 { XML_TOKEN_INVALID, 0 }
     124             :             };
     125           0 :             return aAnimations_EnumMap_Fill;
     126             :         }
     127             :     case Animations_EnumMap_Restart:
     128             :         {
     129             :             static const SvXMLEnumMapEntry aAnimations_EnumMap_Restart[] =
     130             :             {
     131             :                 { XML_DEFAULT,      AnimationRestart::DEFAULT },
     132             :                 { XML_ALWAYS,       AnimationRestart::ALWAYS },
     133             :                 { XML_WHENNOTACTIVE,AnimationRestart::WHEN_NOT_ACTIVE },
     134             :                 { XML_NEVER,        AnimationRestart::NEVER },
     135             :                 { XML_TOKEN_INVALID, 0 }
     136             :             };
     137           0 :             return aAnimations_EnumMap_Restart;
     138             :         }
     139             :     case Animations_EnumMap_RestartDefault:
     140             :         {
     141             :             static const SvXMLEnumMapEntry aAnimations_EnumMap_RestartDefault[] =
     142             :             {
     143             :                 { XML_INHERIT,      AnimationRestart::INHERIT },
     144             :                 { XML_ALWAYS,       AnimationRestart::ALWAYS },
     145             :                 { XML_WHENNOTACTIVE,AnimationRestart::WHEN_NOT_ACTIVE },
     146             :                 { XML_NEVER,        AnimationRestart::NEVER },
     147             :                 { XML_TOKEN_INVALID, 0 }
     148             :             };
     149           0 :             return aAnimations_EnumMap_RestartDefault;
     150             :         }
     151             :     case Animations_EnumMap_Endsync:
     152             :         {
     153             :             static const SvXMLEnumMapEntry aAnimations_EnumMap_Endsync[] =
     154             :             {
     155             :                 { XML_FIRST,        AnimationEndSync::FIRST },
     156             :                 { XML_LAST,         AnimationEndSync::LAST },
     157             :                 { XML_ALL,          AnimationEndSync::ALL },
     158             :                 { XML_MEDIA,        AnimationEndSync::MEDIA },
     159             :                 { XML_TOKEN_INVALID, 0 }
     160             :             };
     161           0 :             return aAnimations_EnumMap_Endsync;
     162             :         }
     163             :     case Animations_EnumMap_CalcMode:
     164             :         {
     165             :             static const SvXMLEnumMapEntry aAnimations_EnumMap_CalcMode[] =
     166             :             {
     167             :                 { XML_DISCRETE,     AnimationCalcMode::DISCRETE },
     168             :                 { XML_LINEAR,       AnimationCalcMode::LINEAR },
     169             :                 { XML_PACED,        AnimationCalcMode::PACED },
     170             :                 { XML_SPLINE,       AnimationCalcMode::SPLINE },
     171             :                 { XML_TOKEN_INVALID, 0 }
     172             :             };
     173           0 :             return aAnimations_EnumMap_CalcMode;
     174             :         }
     175             :     case Animations_EnumMap_AdditiveMode:
     176             :         {
     177             :             static const SvXMLEnumMapEntry aAnimations_EnumMap_AdditiveMode[] =
     178             :             {
     179             :                 { XML_BASE,         AnimationAdditiveMode::BASE },
     180             :                 { XML_SUM,          AnimationAdditiveMode::SUM },
     181             :                 { XML_REPLACE,      AnimationAdditiveMode::REPLACE },
     182             :                 { XML_MULTIPLY,     AnimationAdditiveMode::MULTIPLY },
     183             :                 { XML_NONE,         AnimationAdditiveMode::NONE },
     184             :                 { XML_TOKEN_INVALID, 0 }
     185             :             };
     186           0 :             return aAnimations_EnumMap_AdditiveMode;
     187             :         }
     188             :     case Animations_EnumMap_TransformType:
     189             :         {
     190             :             static const SvXMLEnumMapEntry aAnimations_EnumMap_TransformType[] =
     191             :             {
     192             :                 { XML_TRANSLATE,    AnimationTransformType::TRANSLATE },
     193             :                 { XML_SCALE,        AnimationTransformType::SCALE },
     194             :                 { XML_ROTATE,       AnimationTransformType::ROTATE },
     195             :                 { XML_SKEWX,        AnimationTransformType::SKEWX },
     196             :                 { XML_SKEWY,        AnimationTransformType::SKEWY },
     197             :                 { XML_TOKEN_INVALID, 0 }
     198             :             };
     199           0 :             return aAnimations_EnumMap_TransformType;
     200             :         }
     201             :     case Animations_EnumMap_TransitionType:
     202             :         {
     203             :             static const SvXMLEnumMapEntry aAnimations_EnumMap_TransitionType[] =
     204             :             {
     205             :                 { XML_BARWIPE,          TransitionType::BARWIPE },
     206             :                 { XML_BOXWIPE,          TransitionType::BOXWIPE },
     207             :                 { XML_FOURBOXWIPE,      TransitionType::FOURBOXWIPE },
     208             :                 { XML_BARNDOORWIPE,     TransitionType::BARNDOORWIPE },
     209             :                 { XML_DIAGONALWIPE,     TransitionType::DIAGONALWIPE },
     210             :                 { XML_BOWTIEWIPE,       TransitionType::BOWTIEWIPE },
     211             :                 { XML_MISCDIAGONALWIPE, TransitionType::MISCDIAGONALWIPE },
     212             :                 { XML_VEEWIPE,          TransitionType::VEEWIPE },
     213             :                 { XML_BARNVEEWIPE,      TransitionType::BARNVEEWIPE },
     214             :                 { XML_ZIGZAGWIPE,       TransitionType::ZIGZAGWIPE },
     215             :                 { XML_BARNZIGZAGWIPE,   TransitionType::BARNZIGZAGWIPE },
     216             :                 { XML_IRISWIPE,         TransitionType::IRISWIPE },
     217             :                 { XML_TRIANGLEWIPE,     TransitionType::TRIANGLEWIPE },
     218             :                 { XML_ARROWHEADWIPE,    TransitionType::ARROWHEADWIPE },
     219             :                 { XML_PENTAGONWIPE,     TransitionType::PENTAGONWIPE },
     220             :                 { XML_HEXAGONWIPE,      TransitionType::HEXAGONWIPE },
     221             :                 { XML_ELLIPSEWIPE,      TransitionType::ELLIPSEWIPE },
     222             :                 { XML_EYEWIPE,          TransitionType::EYEWIPE },
     223             :                 { XML_ROUNDRECTWIPE,    TransitionType::ROUNDRECTWIPE },
     224             :                 { XML_STARWIPE,         TransitionType::STARWIPE },
     225             :                 { XML_MISCSHAPEWIPE,    TransitionType::MISCSHAPEWIPE },
     226             :                 { XML_CLOCKWIPE,        TransitionType::CLOCKWIPE },
     227             :                 { XML_PINWHEELWIPE,     TransitionType::PINWHEELWIPE },
     228             :                 { XML_SINGLESWEEPWIPE,  TransitionType::SINGLESWEEPWIPE },
     229             :                 { XML_FANWIPE,          TransitionType::FANWIPE },
     230             :                 { XML_DOUBLEFANWIPE,    TransitionType::DOUBLEFANWIPE },
     231             :                 { XML_DOUBLESWEEPWIPE,  TransitionType::DOUBLESWEEPWIPE },
     232             :                 { XML_SALOONDOORWIPE,   TransitionType::SALOONDOORWIPE },
     233             :                 { XML_WINDSHIELDWIPE,   TransitionType::WINDSHIELDWIPE },
     234             :                 { XML_SNAKEWIPE,        TransitionType::SNAKEWIPE },
     235             :                 { XML_SPIRALWIPE,       TransitionType::SPIRALWIPE },
     236             :                 { XML_PARALLELSNAKESWIPE,TransitionType::PARALLELSNAKESWIPE },
     237             :                 { XML_BOXSNAKESWIPE,    TransitionType::BOXSNAKESWIPE },
     238             :                 { XML_WATERFALLWIPE,    TransitionType::WATERFALLWIPE },
     239             :                 { XML_PUSHWIPE,         TransitionType::PUSHWIPE },
     240             :                 { XML_SLIDEWIPE,        TransitionType::SLIDEWIPE },
     241             :                 { XML_FADE,             TransitionType::FADE },
     242             :                 { XML_RANDOMBARWIPE,    TransitionType::RANDOMBARWIPE },
     243             :                 { XML_CHECKERBOARDWIPE, TransitionType::CHECKERBOARDWIPE },
     244             :                 { XML_DISSOLVE,         TransitionType::DISSOLVE },
     245             :                 { XML_BLINDSWIPE,       TransitionType::BLINDSWIPE },
     246             :                 { XML_RANDOM,           TransitionType::RANDOM },
     247             :                 { XML_ZOOM,             TransitionType::ZOOM },
     248             :                 { XML_TOKEN_INVALID, 0 }
     249             :             };
     250        1619 :             return aAnimations_EnumMap_TransitionType;
     251             :         }
     252             :     case Animations_EnumMap_TransitionSubType:
     253             :         {
     254             :             static const SvXMLEnumMapEntry aAnimations_EnumMap_TransitionSubType[] =
     255             :             {
     256             :                 { XML_DEFAULT,              TransitionSubType::DEFAULT },
     257             :                 { XML_LEFTTORIGHT,          TransitionSubType::LEFTTORIGHT },
     258             :                 { XML_TOPTOBOTTOM,          TransitionSubType::TOPTOBOTTOM },
     259             :                 { XML_TOPLEFT,              TransitionSubType::TOPLEFT },
     260             :                 { XML_TOPRIGHT,             TransitionSubType::TOPRIGHT },
     261             :                 { XML_BOTTOMRIGHT,          TransitionSubType::BOTTOMRIGHT },
     262             :                 { XML_BOTTOMLEFT,           TransitionSubType::BOTTOMLEFT },
     263             :                 { XML_TOPCENTER,            TransitionSubType::TOPCENTER },
     264             :                 { XML_RIGHTCENTER,          TransitionSubType::RIGHTCENTER },
     265             :                 { XML_BOTTOMCENTER,         TransitionSubType::BOTTOMCENTER },
     266             :                 { XML_LEFTCENTER,           TransitionSubType::LEFTCENTER },
     267             :                 { XML_CORNERSIN,            TransitionSubType::CORNERSIN },
     268             :                 { XML_CORNERSOUT,           TransitionSubType::CORNERSOUT },
     269             :                 { XML_VERTICAL,             TransitionSubType::VERTICAL },
     270             :                 { XML_HORIZONTAL,           TransitionSubType::HORIZONTAL },
     271             :                 { XML_DIAGONALBOTTOMLEFT,   TransitionSubType::DIAGONALBOTTOMLEFT },
     272             :                 { XML_DIAGONALTOPLEFT,      TransitionSubType::DIAGONALTOPLEFT },
     273             :                 { XML_DOUBLEBARNDOOR,       TransitionSubType::DOUBLEBARNDOOR },
     274             :                 { XML_DOUBLEDIAMOND,        TransitionSubType::DOUBLEDIAMOND },
     275             :                 { XML_DOWN,                 TransitionSubType::DOWN },
     276             :                 { XML_LEFT,                 TransitionSubType::LEFT },
     277             :                 { XML_UP,                   TransitionSubType::UP },
     278             :                 { XML_RIGHT,                TransitionSubType::RIGHT },
     279             :                 { XML_RECTANGLE,            TransitionSubType::RECTANGLE },
     280             :                 { XML_DIAMOND,              TransitionSubType::DIAMOND },
     281             :                 { XML_CIRCLE,               TransitionSubType::CIRCLE },
     282             :                 { XML_FOURPOINT,            TransitionSubType::FOURPOINT },
     283             :                 { XML_FIVEPOINT,            TransitionSubType::FIVEPOINT },
     284             :                 { XML_SIXPOINT,             TransitionSubType::SIXPOINT },
     285             :                 { XML_HEART,                TransitionSubType::HEART },
     286             :                 { XML_KEYHOLE,              TransitionSubType::KEYHOLE },
     287             :                 { XML_CLOCKWISETWELVE,      TransitionSubType::CLOCKWISETWELVE },
     288             :                 { XML_CLOCKWISETHREE,       TransitionSubType::CLOCKWISETHREE },
     289             :                 { XML_CLOCKWISESIX,         TransitionSubType::CLOCKWISESIX },
     290             :                 { XML_CLOCKWISENINE,        TransitionSubType::CLOCKWISENINE },
     291             :                 { XML_TWOBLADEVERTICAL,     TransitionSubType::TWOBLADEVERTICAL },
     292             :                 { XML_TWOBLADEHORIZONTAL,   TransitionSubType::TWOBLADEHORIZONTAL },
     293             :                 { XML_FOURBLADE,            TransitionSubType::FOURBLADE },
     294             :                 { XML_CLOCKWISETOP,         TransitionSubType::CLOCKWISETOP },
     295             :                 { XML_CLOCKWISERIGHT,       TransitionSubType::CLOCKWISERIGHT },
     296             :                 { XML_CLOCKWISEBOTTOM,      TransitionSubType::CLOCKWISEBOTTOM },
     297             :                 { XML_CLOCKWISELEFT,        TransitionSubType::CLOCKWISELEFT },
     298             :                 { XML_CLOCKWISETOPLEFT,     TransitionSubType::CLOCKWISETOPLEFT },
     299             :                 { XML_COUNTERCLOCKWISEBOTTOMLEFT,TransitionSubType::COUNTERCLOCKWISEBOTTOMLEFT },
     300             :                 { XML_CLOCKWISEBOTTOMRIGHT, TransitionSubType::CLOCKWISEBOTTOMRIGHT },
     301             :                 { XML_COUNTERCLOCKWISETOPRIGHT,TransitionSubType::COUNTERCLOCKWISETOPRIGHT },
     302             :                 { XML_CENTERTOP,            TransitionSubType::CENTERTOP },
     303             :                 { XML_CENTERRIGHT,          TransitionSubType::CENTERRIGHT },
     304             :                 { XML_TOP,                  TransitionSubType::TOP },
     305             :                 { XML_BOTTOM,               TransitionSubType::BOTTOM },
     306             :                 { XML_FANOUTVERTICAL,       TransitionSubType::FANOUTVERTICAL },
     307             :                 { XML_FANOUTHORIZONTAL,     TransitionSubType::FANOUTHORIZONTAL },
     308             :                 { XML_FANINVERTICAL,        TransitionSubType::FANINVERTICAL },
     309             :                 { XML_FANINHORIZONTAL,      TransitionSubType::FANINHORIZONTAL },
     310             :                 { XML_PARALLELVERTICAL,     TransitionSubType::PARALLELVERTICAL },
     311             :                 { XML_PARALLELDIAGONAL,     TransitionSubType::PARALLELDIAGONAL },
     312             :                 { XML_OPPOSITEVERTICAL,     TransitionSubType::OPPOSITEVERTICAL },
     313             :                 { XML_OPPOSITEHORIZONTAL,   TransitionSubType::OPPOSITEHORIZONTAL },
     314             :                 { XML_PARALLELDIAGONALTOPLEFT,TransitionSubType::PARALLELDIAGONALTOPLEFT },
     315             :                 { XML_PARALLELDIAGONALBOTTOMLEFT,TransitionSubType::PARALLELDIAGONALBOTTOMLEFT },
     316             :                 { XML_TOPLEFTHORIZONTAL,    TransitionSubType::TOPLEFTHORIZONTAL },
     317             :                 { XML_TOPLEFTDIAGONAL,      TransitionSubType::TOPLEFTDIAGONAL },
     318             :                 { XML_TOPRIGHTDIAGONAL,     TransitionSubType::TOPRIGHTDIAGONAL },
     319             :                 { XML_BOTTOMRIGHTDIAGONAL,  TransitionSubType::BOTTOMRIGHTDIAGONAL },
     320             :                 { XML_BOTTOMLEFTDIAGONAL,   TransitionSubType::BOTTOMLEFTDIAGONAL },
     321             :                 { XML_TOPLEFTCLOCKWISE,     TransitionSubType::TOPLEFTCLOCKWISE },
     322             :                 { XML_TOPRIGHTCLOCKWISE,    TransitionSubType::TOPRIGHTCLOCKWISE },
     323             :                 { XML_BOTTOMRIGHTCLOCKWISE, TransitionSubType::BOTTOMRIGHTCLOCKWISE },
     324             :                 { XML_BOTTOMLEFTCLOCKWISE,  TransitionSubType::BOTTOMLEFTCLOCKWISE },
     325             :                 { XML_TOPLEFTCOUNTERCLOCKWISE,TransitionSubType::TOPLEFTCOUNTERCLOCKWISE },
     326             :                 { XML_TOPRIGHTCOUNTERCLOCKWISE,TransitionSubType::TOPRIGHTCOUNTERCLOCKWISE },
     327             :                 { XML_BOTTOMRIGHTCOUNTERCLOCKWISE,TransitionSubType::BOTTOMRIGHTCOUNTERCLOCKWISE },
     328             :                 { XML_BOTTOMLEFTCOUNTERCLOCKWISE,TransitionSubType::BOTTOMLEFTCOUNTERCLOCKWISE },
     329             :                 { XML_VERTICALTOPSAME,      TransitionSubType::VERTICALTOPSAME },
     330             :                 { XML_VERTICALBOTTOMSAME,   TransitionSubType::VERTICALBOTTOMSAME },
     331             :                 { XML_VERTICALTOPLEFTOPPOSITE,TransitionSubType::VERTICALTOPLEFTOPPOSITE },
     332             :                 { XML_VERTICALBOTTOMLEFTOPPOSITE,TransitionSubType::VERTICALBOTTOMLEFTOPPOSITE },
     333             :                 { XML_HORIZONTALLEFTSAME,   TransitionSubType::HORIZONTALLEFTSAME },
     334             :                 { XML_HORIZONTALRIGHTSAME,  TransitionSubType::HORIZONTALRIGHTSAME },
     335             :                 { XML_HORIZONTALTOPLEFTOPPOSITE,TransitionSubType::HORIZONTALTOPLEFTOPPOSITE },
     336             :                 { XML_HORIZONTALTOPRIGHTOPPOSITE,TransitionSubType::HORIZONTALTOPRIGHTOPPOSITE },
     337             :                 { XML_DIAGONALBOTTOMLEFTOPPOSITE,TransitionSubType::DIAGONALBOTTOMLEFTOPPOSITE },
     338             :                 { XML_DIAGONALTOPLEFTOPPOSITE,TransitionSubType::DIAGONALTOPLEFTOPPOSITE },
     339             :                 { XML_TWOBOXTOP,            TransitionSubType::TWOBOXTOP },
     340             :                 { XML_TWOBOXBOTTOM,         TransitionSubType::TWOBOXBOTTOM },
     341             :                 { XML_TWOBOXLEFT,           TransitionSubType::TWOBOXLEFT },
     342             :                 { XML_TWOBOXRIGHT,          TransitionSubType::TWOBOXRIGHT },
     343             :                 { XML_FOURBOXVERTICAL,      TransitionSubType::FOURBOXVERTICAL },
     344             :                 { XML_FOURBOXHORIZONTAL,    TransitionSubType::FOURBOXHORIZONTAL },
     345             :                 { XML_VERTICALLEFT,         TransitionSubType::VERTICALLEFT },
     346             :                 { XML_VERTICALRIGHT,        TransitionSubType::VERTICALRIGHT },
     347             :                 { XML_HORIZONTALLEFT,       TransitionSubType::HORIZONTALLEFT },
     348             :                 { XML_HORIZONTALRIGHT,      TransitionSubType::HORIZONTALRIGHT },
     349             :                 { XML_FROMLEFT,             TransitionSubType::FROMLEFT },
     350             :                 { XML_FROMTOP,              TransitionSubType::FROMTOP },
     351             :                 { XML_FROMRIGHT,            TransitionSubType::FROMRIGHT },
     352             :                 { XML_FROMBOTTOM,           TransitionSubType::FROMBOTTOM },
     353             :                 { XML_CROSSFADE,            TransitionSubType::CROSSFADE },
     354             :                 { XML_FADETOCOLOR,          TransitionSubType::FADETOCOLOR },
     355             :                 { XML_FADEFROMCOLOR,        TransitionSubType::FADEFROMCOLOR },
     356             :                 { XML_FADEOVERCOLOR,        TransitionSubType::FADEOVERCOLOR },
     357             :                 { XML_THREEBLADE,           TransitionSubType::THREEBLADE },
     358             :                 { XML_EIGHTBLADE,           TransitionSubType::EIGHTBLADE },
     359             :                 { XML_ONEBLADE,             TransitionSubType::ONEBLADE },
     360             :                 { XML_ACROSS,               TransitionSubType::ACROSS },
     361             :                 { XML_TOPLEFTVERTICAL,      TransitionSubType::TOPLEFTVERTICAL },
     362             :                 { XML_COMBHORIZONTAL,       TransitionSubType::COMBHORIZONTAL },
     363             :                 { XML_COMBVERTICAL,         TransitionSubType::COMBVERTICAL },
     364             :                 { XML_IN,                   TransitionSubType::IN },
     365             :                 { XML_OUT,                  TransitionSubType::OUT },
     366             :                 { XML_ROTATEIN,             TransitionSubType::ROTATEIN },
     367             :                 { XML_ROTATEOUT,            TransitionSubType::ROTATEOUT },
     368             :                 { XML_FROMTOPLEFT,          TransitionSubType::FROMTOPLEFT },
     369             :                 { XML_FROMTOPRIGHT,         TransitionSubType::FROMTOPRIGHT },
     370             :                 { XML_FROMBOTTOMLEFT,       TransitionSubType::FROMBOTTOMLEFT },
     371             :                 { XML_FROMBOTTOMRIGHT,      TransitionSubType::FROMBOTTOMRIGHT },
     372             : 
     373             :                 { XML_TOKEN_INVALID, 0 }
     374             :             };
     375        1616 :             return aAnimations_EnumMap_TransitionSubType;
     376             :         }
     377             :     case Animations_EnumMap_EventTrigger:
     378             :         {
     379             :             static const SvXMLEnumMapEntry aAnimations_EnumMap_EventTrigger[] =
     380             :             {
     381             :                 { XML_ONBEGIN,          EventTrigger::ON_BEGIN },
     382             :                 { XML_ONEND,            EventTrigger::ON_END },
     383             :                 { XML_BEGIN,            EventTrigger::BEGIN_EVENT },
     384             :                 { XML_END,              EventTrigger::END_EVENT },
     385             :                 { XML_CLICK,            EventTrigger::ON_CLICK },
     386             :                 { XML_DOUBLECLICK,      EventTrigger::ON_DBL_CLICK },
     387             :                 { XML_MOUSEOVER,        EventTrigger::ON_MOUSE_ENTER },
     388             :                 { XML_MOUSEOUT,         EventTrigger::ON_MOUSE_LEAVE },
     389             :                 { XML_NEXT,             EventTrigger::ON_NEXT },
     390             :                 { XML_PREVIOUS,         EventTrigger::ON_PREV },
     391             :                 { XML_STOP_AUDIO,       EventTrigger::ON_STOP_AUDIO },
     392             :                 { XML_REPEAT,           EventTrigger::REPEAT },
     393             :                 { XML_TOKEN_INVALID, 0 }
     394             :             };
     395           1 :             return aAnimations_EnumMap_EventTrigger;
     396             :         }
     397             : 
     398             :     case Animations_EnumMap_EffectPresetClass:
     399             :         {
     400             :             static const SvXMLEnumMapEntry aAnimations_EnumMap_EffectPresetClass[] =
     401             :             {
     402             :                 { XML_CUSTOM,       EffectPresetClass::CUSTOM },
     403             :                 { XML_ENTRANCE,     EffectPresetClass::ENTRANCE },
     404             :                 { XML_EXIT,         EffectPresetClass::EXIT },
     405             :                 { XML_EMPHASIS,     EffectPresetClass::EMPHASIS },
     406             :                 { XML_MOTION_PATH,  EffectPresetClass::MOTIONPATH },
     407             :                 { XML_OLE_ACTION,   EffectPresetClass::OLEACTION },
     408             :                 { XML_MEDIA_CALL,   EffectPresetClass::MEDIACALL },
     409             :                 { XML_TOKEN_INVALID, 0 }
     410             :             };
     411           1 :             return aAnimations_EnumMap_EffectPresetClass;
     412             :         }
     413             : 
     414             :     case Animations_EnumMap_EffectNodeType:
     415             :         {
     416             :             static const SvXMLEnumMapEntry aAnimations_EnumMap_EffectNodeType[] =
     417             :             {
     418             :                 { XML_DEFAULT,                  EffectNodeType::DEFAULT },
     419             :                 { XML_ON_CLICK,                 EffectNodeType::ON_CLICK },
     420             :                 { XML_WITH_PREVIOUS,            EffectNodeType::WITH_PREVIOUS },
     421             :                 { XML_AFTER_PREVIOUS,           EffectNodeType::AFTER_PREVIOUS },
     422             :                 { XML_MAIN_SEQUENCE,            EffectNodeType::MAIN_SEQUENCE },
     423             :                 { XML_TIMING_ROOT,              EffectNodeType::TIMING_ROOT },
     424             :                 { XML_INTERACTIVE_SEQUENCE,     EffectNodeType::INTERACTIVE_SEQUENCE },
     425             :                 { XML_TOKEN_INVALID, 0 }
     426             :             };
     427           2 :             return aAnimations_EnumMap_EffectNodeType;
     428             :         }
     429             :     case Animations_EnumMap_SubItem:
     430             :         {
     431             :             static const SvXMLEnumMapEntry aAnimations_EnumMap_SubItem[] =
     432             :             {
     433             :                 { XML_WHOLE,                    ShapeAnimationSubType::AS_WHOLE },
     434             :                 { XML_BACKGROUND,               ShapeAnimationSubType::ONLY_BACKGROUND },
     435             :                 { XML_TEXT,                     ShapeAnimationSubType::ONLY_TEXT },
     436             :                 { XML_TOKEN_INVALID, 0 }
     437             :             };
     438           0 :             return aAnimations_EnumMap_SubItem;
     439             :         }
     440             :     case Animations_EnumMap_IterateType:
     441             :         {
     442             :             static const SvXMLEnumMapEntry aAnimations_EnumMap_IterateType[] =
     443             :             {
     444             :                 { XML_BY_PARAGRAPH,             TextAnimationType::BY_PARAGRAPH },
     445             :                 { XML_BY_WORD,                  TextAnimationType::BY_WORD },
     446             :                 { XML_BY_LETTER,                TextAnimationType::BY_LETTER },
     447             :                 { XML_TOKEN_INVALID, 0 }
     448             :             };
     449           0 :             return aAnimations_EnumMap_IterateType;
     450             :         }
     451             :     case Animations_EnumMap_Command:
     452             :         {
     453             :             static const SvXMLEnumMapEntry aAnimations_EnumMap_Command[] =
     454             :             {
     455             :                 { XML_CUSTOM,                   EffectCommands::CUSTOM },
     456             :                 { XML_VERB,                     EffectCommands::VERB },
     457             :                 { XML_PLAY,                     EffectCommands::PLAY },
     458             :                 { XML_TOGGLE_PAUSE,             EffectCommands::TOGGLEPAUSE },
     459             :                 { XML_STOP,                     EffectCommands::STOP },
     460             :                 { XML_STOP_AUDIO,               EffectCommands::STOPAUDIO },
     461             :                 { XML_TOKEN_INVALID, 0 }
     462             :             };
     463           0 :             return aAnimations_EnumMap_Command;
     464             :         }
     465             :     }
     466             : 
     467             :     OSL_FAIL( "xmloff::getAnimationsEnumMap(), invalid map!" );
     468           0 :     return NULL;
     469             : }
     470             : 
     471           3 : const struct ImplAttributeNameConversion* getAnimationAttributeNamesConversionList()
     472             : {
     473             :     static const struct ImplAttributeNameConversion gImplConversionList[] =
     474             :     {
     475             :         { XML_X,                        "X" },
     476             :         { XML_Y,                        "Y" },
     477             :         { XML_WIDTH,                    "Width" },
     478             :         { XML_HEIGHT,                   "Height" },
     479             :         { XML_ROTATE,                   "Rotate" },
     480             :         { XML_SKEWX,                    "SkewX" },
     481             :         { XML_FILL_COLOR,               "FillColor" },
     482             :         { XML_FILL,                     "FillStyle" },
     483             :         { XML_STROKE_COLOR,             "LineColor" },
     484             :         { XML_STROKE,                   "LineStyle" },
     485             :         { XML_COLOR,                    "CharColor" },
     486             :         { XML_TEXT_ROTATION_ANGLE,      "CharRotation" },
     487             :         { XML_FONT_WEIGHT,              "CharWeight" },
     488             :         { XML_TEXT_UNDERLINE,           "CharUnderline" },
     489             :         { XML_FONT_FAMILY,              "CharFontName" },
     490             :         { XML_FONT_SIZE,                "CharHeight" },
     491             :         { XML_FONT_STYLE,               "CharPosture" },
     492             :         { XML_VISIBILITY,               "Visibility" },
     493             :         { XML_OPACITY,                  "Opacity" },
     494             :         { XML_DIM,                      "DimColor" },
     495             :         { XML_TOKEN_INVALID,            NULL }
     496             :     };
     497             : 
     498           3 :     return gImplConversionList;
     499             : }
     500             : 
     501             : 
     502             : class AnimationsExporterImpl
     503             : {
     504             : public:
     505             :     AnimationsExporterImpl( SvXMLExport& rExport, const Reference< XPropertySet >& xPageProps );
     506             :     virtual ~AnimationsExporterImpl();
     507             : 
     508             :     void prepareNode( const Reference< XAnimationNode >& xNode );
     509             :     void exportNode( const Reference< XAnimationNode >& xNode );
     510             : 
     511             :     void exportContainer( const Reference< XTimeContainer >& xNode, sal_Int16 nContainerNodeType );
     512             :     void exportAnimate( const Reference< XAnimate >& xNode );
     513             :     void exportAudio( const Reference< XAudio >& xAudio );
     514             :     void exportCommand( const Reference< XCommand >& xCommand );
     515             : 
     516             :     static Reference< XInterface > getParagraphTarget( const ParagraphTarget* pTarget );
     517             : 
     518             :     static void convertPath( OUStringBuffer& sTmp, const Any& rPath );
     519             :     void convertValue( XMLTokenEnum eAttributeName, OUStringBuffer& sTmp, const Any& rValue ) const;
     520             :     void convertTiming( OUStringBuffer& sTmp, const Any& rTiming ) const;
     521             :     void convertSource( OUStringBuffer& sTmp, const Any& rSource ) const;
     522             :     void convertTarget( OUStringBuffer& sTmp, const Any& rTarget ) const;
     523             : 
     524             :     void prepareValue( const Any& rValue );
     525             : 
     526             :     void exportTransitionNode();
     527             :     void prepareTransitionNode();
     528             : 
     529             :     bool mbHasTransition;
     530             : private:
     531             :     SvXMLExport& mrExport;
     532             :     Reference< XInterface > mxExport;
     533             :     Reference< XPropertySet > mxPageProps;
     534             :     XMLSdPropHdlFactory* mpSdPropHdlFactory;
     535             : };
     536             : 
     537           9 : AnimationsExporterImpl::AnimationsExporterImpl( SvXMLExport& rExport, const Reference< XPropertySet >& xPageProps )
     538             : : mbHasTransition(false)
     539             : , mrExport( rExport )
     540           9 : , mxPageProps( xPageProps )
     541             : {
     542             :     try
     543             :     {
     544           9 :         mxExport = static_cast< ::com::sun::star::document::XFilter *>(&rExport);
     545             :     }
     546           0 :     catch (const RuntimeException&)
     547             :     {
     548             :         OSL_FAIL( "xmloff::AnimationsExporterImpl::AnimationsExporterImpl(), RuntimeException caught!" );
     549             :     }
     550             : 
     551           9 :     mpSdPropHdlFactory = new XMLSdPropHdlFactory( mrExport.GetModel(), mrExport );
     552             :     // set lock to avoid deletion
     553           9 :     mpSdPropHdlFactory->acquire();
     554           9 : }
     555             : 
     556          27 : AnimationsExporterImpl::~AnimationsExporterImpl()
     557             : {
     558             :     // cleanup factory, decrease refcount. Should lead to destruction.
     559           9 :     if(mpSdPropHdlFactory)
     560             :     {
     561           9 :         mpSdPropHdlFactory->release();
     562           9 :         mpSdPropHdlFactory = 0L;
     563             :     }
     564          18 : }
     565             : 
     566           0 : void AnimationsExporterImpl::exportTransitionNode()
     567             : {
     568           0 :     if( mbHasTransition && mxPageProps.is() )
     569             :     {
     570           0 :         sal_Int16 nTransition = 0;
     571           0 :         mxPageProps->getPropertyValue("TransitionType") >>= nTransition;
     572             : 
     573           0 :         Any aSound( mxPageProps->getPropertyValue("Sound") );
     574           0 :         OUString sSoundURL;
     575           0 :         aSound >>= sSoundURL;
     576           0 :         bool bStopSound = false;
     577           0 :         if( !(aSound >>= bStopSound) )
     578           0 :             bStopSound = false;
     579             : 
     580             : 
     581           0 :         OUStringBuffer sTmp;
     582           0 :         if( (nTransition != 0) || !sSoundURL.isEmpty() || bStopSound )
     583             :         {
     584           0 :             Reference< XInterface > xSource( mxPageProps.get() );
     585           0 :             Event aEvent;
     586           0 :             aEvent.Source <<= xSource;
     587           0 :             aEvent.Trigger = EventTrigger::BEGIN_EVENT;
     588           0 :             aEvent.Repeat = 0;
     589             : 
     590           0 :             convertTiming( sTmp, Any( aEvent ) );
     591           0 :             mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_BEGIN, sTmp.makeStringAndClear() );
     592             : 
     593           0 :             SvXMLElementExport aElement( mrExport, XML_NAMESPACE_ANIMATION, XML_PAR, true, true );
     594             : 
     595           0 :             if( nTransition != 0 )
     596             :             {
     597           0 :                 sal_Int16 nSubtype = 0;
     598           0 :                 bool bDirection = false;
     599           0 :                 sal_Int32 nFadeColor = 0;
     600           0 :                 double fDuration = 0.0;
     601           0 :                 mxPageProps->getPropertyValue("TransitionSubtype") >>= nSubtype;
     602           0 :                 mxPageProps->getPropertyValue("TransitionDirection") >>= bDirection;
     603           0 :                 mxPageProps->getPropertyValue("TransitionFadeColor") >>= nFadeColor;
     604           0 :                 mxPageProps->getPropertyValue("TransitionDuration") >>= fDuration;
     605             : 
     606           0 :                 ::sax::Converter::convertDouble( sTmp, fDuration );
     607           0 :                 sTmp.append( 's');
     608           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DUR, sTmp.makeStringAndClear() );
     609             : 
     610           0 :                 SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTransition, getAnimationsEnumMap(Animations_EnumMap_TransitionType) );
     611           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TYPE, sTmp.makeStringAndClear() );
     612             : 
     613           0 :                 if( nSubtype != TransitionSubType::DEFAULT )
     614             :                 {
     615           0 :                     SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nSubtype, getAnimationsEnumMap(Animations_EnumMap_TransitionSubType) );
     616           0 :                     mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_SUBTYPE, sTmp.makeStringAndClear() );
     617             :                 }
     618             : 
     619           0 :                 if( !bDirection )
     620           0 :                     mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DIRECTION, XML_REVERSE );
     621             : 
     622           0 :                 if( (nTransition == TransitionType::FADE) && ((nSubtype == TransitionSubType::FADETOCOLOR) || (nSubtype == TransitionSubType::FADEFROMCOLOR) ))
     623             :                 {
     624           0 :                     ::sax::Converter::convertColor( sTmp, nFadeColor );
     625           0 :                     mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_FADECOLOR, sTmp.makeStringAndClear() );
     626             :                 }
     627           0 :                 SvXMLElementExport aElement2( mrExport, XML_NAMESPACE_ANIMATION, XML_TRANSITIONFILTER, true, true );
     628             :             }
     629             : 
     630           0 :             if( bStopSound )
     631             :             {
     632           0 :                 mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_COMMAND, XML_STOP_AUDIO );
     633           0 :                 SvXMLElementExport aElement2( mrExport, XML_NAMESPACE_ANIMATION, XML_COMMAND, true, true );
     634             :             }
     635           0 :             else if( !sSoundURL.isEmpty())
     636             :             {
     637           0 :                 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, mrExport.GetRelativeReference( sSoundURL ) );
     638             : 
     639           0 :                 bool bLoopSound = false;
     640           0 :                 mxPageProps->getPropertyValue("LoopSound") >>= bLoopSound;
     641             : 
     642           0 :                 if( bLoopSound )
     643           0 :                     mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATCOUNT, XML_INDEFINITE );
     644           0 :                 SvXMLElementExport aElement2( mrExport, XML_NAMESPACE_ANIMATION, XML_AUDIO, true, true );
     645           0 :             }
     646           0 :         }
     647             :     }
     648           0 : }
     649             : 
     650           9 : void AnimationsExporterImpl::prepareTransitionNode()
     651             : {
     652           9 :     if( mxPageProps.is() ) try
     653             :     {
     654           9 :         sal_Int16 nTransition = 0;
     655           9 :         mxPageProps->getPropertyValue("TransitionType") >>= nTransition;
     656             : 
     657           9 :         bool bStopSound = false;
     658           9 :         OUString sSoundURL;
     659             : 
     660           9 :         if( nTransition == 0 )
     661             :         {
     662           9 :             Any aSound( mxPageProps->getPropertyValue("Sound") );
     663           9 :             aSound >>= sSoundURL;
     664             : 
     665           9 :             if( !(aSound >>= bStopSound) )
     666           9 :                 bStopSound = false;
     667             :         }
     668             : 
     669           9 :         if( (nTransition != 0) || !sSoundURL.isEmpty() || bStopSound )
     670             :         {
     671           0 :             mbHasTransition = true;
     672           0 :             Reference< XInterface > xInt( mxPageProps.get() );
     673           0 :             mrExport.getInterfaceToIdentifierMapper().registerReference( xInt );
     674           9 :         }
     675             :     }
     676           0 :     catch (const Exception&)
     677             :     {
     678             :         OSL_FAIL( "xmloff::AnimationsExporterImpl::prepareNode(), Exception caught!" );
     679             :     }
     680             : 
     681           9 : }
     682             : 
     683           9 : void AnimationsExporterImpl::prepareNode( const Reference< XAnimationNode >& xNode )
     684             : {
     685             :     try
     686             :     {
     687           9 :         prepareValue( xNode->getBegin() );
     688           9 :         prepareValue( xNode->getEnd() );
     689             : 
     690           9 :         sal_Int16 nNodeType = xNode->getType();
     691           9 :         switch( nNodeType )
     692             :         {
     693             :         case AnimationNodeType::ITERATE:
     694             :         {
     695           0 :             Reference< XIterateContainer > xIter( xNode, UNO_QUERY_THROW );
     696           0 :             prepareValue( xIter->getTarget() );
     697             :         }
     698             :         // its intended that here is no break!
     699             :         case AnimationNodeType::PAR:
     700             :         case AnimationNodeType::SEQ:
     701             :         {
     702           9 :             Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY_THROW );
     703          18 :             Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
     704          18 :             while( xEnumeration->hasMoreElements() )
     705             :             {
     706           0 :                 Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
     707           0 :                 prepareNode( xChildNode );
     708           9 :             }
     709             :         }
     710           9 :         break;
     711             : 
     712             :         case AnimationNodeType::ANIMATE:
     713             :         case AnimationNodeType::SET:
     714             :         case AnimationNodeType::ANIMATEMOTION:
     715             :         case AnimationNodeType::ANIMATECOLOR:
     716             :         case AnimationNodeType::ANIMATETRANSFORM:
     717             :         case AnimationNodeType::TRANSITIONFILTER:
     718             :         {
     719           0 :             Reference< XAnimate > xAnimate( xNode, UNO_QUERY_THROW );
     720           0 :             prepareValue( xAnimate->getTarget() );
     721             :         }
     722           0 :         break;
     723             : 
     724             :         case AnimationNodeType::COMMAND:
     725             :         {
     726           0 :             Reference< XCommand > xCommand( xNode, UNO_QUERY_THROW );
     727           0 :             prepareValue( xCommand->getTarget() );
     728             :         }
     729           0 :         break;
     730             : 
     731             :         case AnimationNodeType::AUDIO:
     732             :         {
     733           0 :             Reference< XAudio > xAudio( xNode, UNO_QUERY_THROW );
     734           0 :             prepareValue( xAudio->getSource() );
     735             :         }
     736           0 :         break;
     737             :         }
     738             : 
     739           9 :         Sequence< NamedValue > aUserData( xNode->getUserData() );
     740           9 :         if( aUserData.hasElements() )
     741             :         {
     742           9 :             const NamedValue* pValue = aUserData.getConstArray();
     743           9 :             const sal_Int32 nLength = aUserData.getLength();
     744             :             sal_Int32 nElement;
     745          18 :             for( nElement = 0; nElement < nLength; nElement++, pValue++ )
     746             :             {
     747           9 :                 if( IsXMLToken( pValue->Name, XML_MASTER_ELEMENT ) )
     748             :                 {
     749           0 :                     Reference< XInterface > xMaster;
     750           0 :                     pValue->Value >>= xMaster;
     751           0 :                     if( xMaster.is() )
     752           0 :                         mrExport.getInterfaceToIdentifierMapper().registerReference( xMaster );
     753             :                 }
     754             :             }
     755           9 :         }
     756             :     }
     757           0 :     catch (const Exception&)
     758             :     {
     759             :         OSL_FAIL( "xmloff::AnimationsExporterImpl::prepareNode(), RuntimeException caught!" );
     760             :     }
     761           9 : }
     762             : 
     763           0 : void AnimationsExporterImpl::exportNode( const Reference< XAnimationNode >& xNode )
     764             : {
     765             :     try
     766             :     {
     767           0 :         OUStringBuffer sTmp;
     768             : 
     769           0 :         const OUString& rExportIdentifier = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xNode );
     770           0 :         if( !rExportIdentifier.isEmpty() )
     771             :         {
     772             :             mrExport.AddAttributeIdLegacy(
     773           0 :                 XML_NAMESPACE_ANIMATION, rExportIdentifier);
     774             :         }
     775             : 
     776           0 :         Any aTemp( xNode->getBegin() );
     777           0 :         if( aTemp.hasValue() )
     778             :         {
     779           0 :             convertTiming( sTmp, aTemp );
     780           0 :             mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_BEGIN, sTmp.makeStringAndClear() );
     781             :         }
     782             : 
     783           0 :         double fTemp = 0;
     784             :         sal_Int32 nTemp;
     785             : 
     786           0 :         aTemp = xNode->getDuration();
     787           0 :         if( aTemp.hasValue() )
     788             :         {
     789           0 :             if( aTemp >>= fTemp )
     790             :             {
     791           0 :                 ::sax::Converter::convertDouble( sTmp, fTemp );
     792           0 :                 sTmp.append( 's');
     793           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DUR, sTmp.makeStringAndClear() );
     794             :             }
     795             :             else
     796             :             {
     797             :                 Timing eTiming;
     798           0 :                 if( aTemp >>= eTiming )
     799           0 :                     mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DUR, eTiming == Timing_INDEFINITE ? XML_INDEFINITE : XML_MEDIA );
     800             :             }
     801             :         }
     802             : 
     803           0 :         aTemp = xNode->getEnd();
     804           0 :         if( aTemp.hasValue() )
     805             :         {
     806           0 :             convertTiming( sTmp, aTemp );
     807           0 :             mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_END, sTmp.makeStringAndClear() );
     808             :         }
     809             : 
     810           0 :         nTemp = xNode->getFill();
     811           0 :         if( nTemp != AnimationFill::DEFAULT )
     812             :         {
     813           0 :             SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_Fill) );
     814           0 :             mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_FILL, sTmp.makeStringAndClear() );
     815             :         }
     816             : 
     817           0 :         nTemp = xNode->getFillDefault();
     818           0 :         if( nTemp != AnimationFill::INHERIT )
     819             :         {
     820           0 :             SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_FillDefault) );
     821           0 :             mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_FILLDEFAULT, sTmp.makeStringAndClear() );
     822             :         }
     823             : 
     824           0 :         nTemp = xNode->getRestart();
     825           0 :         if( nTemp != AnimationRestart::DEFAULT )
     826             :         {
     827           0 :             SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_Restart) );
     828           0 :             mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_RESTART, sTmp.makeStringAndClear() );
     829             :         }
     830             : 
     831           0 :         nTemp = xNode->getRestartDefault();
     832           0 :         if( nTemp != AnimationRestart::INHERIT )
     833             :         {
     834           0 :             SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_RestartDefault) );
     835           0 :             mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_RESTARTDEFAULT, sTmp.makeStringAndClear() );
     836             :         }
     837             : 
     838           0 :         fTemp = xNode->getAcceleration();
     839           0 :         if( fTemp != 0.0 )
     840             :         {
     841           0 :             ::sax::Converter::convertDouble( sTmp, fTemp );
     842           0 :             mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ACCELERATE, sTmp.makeStringAndClear() );
     843             :         }
     844             : 
     845           0 :         fTemp = xNode->getDecelerate();
     846           0 :         if( fTemp != 0.0 )
     847             :         {
     848           0 :             ::sax::Converter::convertDouble( sTmp, fTemp );
     849           0 :             mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DECELERATE, sTmp.makeStringAndClear() );
     850             :         }
     851             : 
     852           0 :         bool bTemp = xNode->getAutoReverse();
     853           0 :         if( bTemp )
     854             :         {
     855           0 :             ::sax::Converter::convertBool( sTmp, bTemp );
     856           0 :             mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_AUTOREVERSE, sTmp.makeStringAndClear() );
     857             :         }
     858             : 
     859           0 :         aTemp = xNode->getRepeatCount();
     860           0 :         if( aTemp.hasValue() )
     861             :         {
     862             :             Timing eTiming;
     863           0 :             if( (aTemp >>= eTiming ) && (eTiming == Timing_INDEFINITE ) )
     864           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATCOUNT, XML_INDEFINITE );
     865           0 :             else if( aTemp >>= fTemp )
     866             :             {
     867           0 :                 ::sax::Converter::convertDouble( sTmp, fTemp );
     868           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATCOUNT, sTmp.makeStringAndClear() );
     869             :             }
     870             :         }
     871             : 
     872           0 :         aTemp = xNode->getRepeatDuration();
     873           0 :         if( aTemp.hasValue() )
     874             :         {
     875             :             Timing eTiming;
     876           0 :             if( ( aTemp >>= eTiming ) && (eTiming == Timing_INDEFINITE) )
     877             :             {
     878           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATDUR, XML_INDEFINITE );
     879             :             }
     880           0 :             else if( aTemp >>= fTemp )
     881             :             {
     882           0 :                 ::sax::Converter::convertDouble( sTmp, fTemp );
     883           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_REPEATDUR, sTmp.makeStringAndClear() );
     884             :             }
     885             :         }
     886             : 
     887           0 :         aTemp = xNode->getEndSync();
     888           0 :         if( aTemp.hasValue() )
     889             :         {
     890           0 :             if( aTemp >>= nTemp )
     891             :             {
     892           0 :                 SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_Endsync) );
     893           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ENDSYNC, sTmp.makeStringAndClear() );
     894             :             }
     895             :         }
     896             : 
     897           0 :         sal_Int16 nContainerNodeType = EffectNodeType::DEFAULT;
     898           0 :         OUString aPresetId;
     899           0 :         Sequence< NamedValue > aUserData( xNode->getUserData() );
     900           0 :         if( aUserData.hasElements() )
     901             :         {
     902           0 :             const NamedValue* pValue = aUserData.getConstArray();
     903           0 :             const sal_Int32 nLength = aUserData.getLength();
     904             :             sal_Int32 nElement;
     905           0 :             for( nElement = 0; nElement < nLength; nElement++, pValue++ )
     906             :             {
     907           0 :                 if( IsXMLToken( pValue->Name, XML_NODE_TYPE ) )
     908             :                 {
     909           0 :                     if( (pValue->Value >>= nContainerNodeType) && (nContainerNodeType != EffectNodeType::DEFAULT) )
     910             :                     {
     911           0 :                         SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nContainerNodeType, getAnimationsEnumMap(Animations_EnumMap_EffectNodeType) );
     912           0 :                         mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_NODE_TYPE, sTmp.makeStringAndClear() );
     913             :                     }
     914             :                 }
     915           0 :                 else if( IsXMLToken( pValue->Name, XML_PRESET_ID ) )
     916             :                 {
     917           0 :                     if( pValue->Value >>= aPresetId )
     918             :                     {
     919           0 :                         mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PRESET_ID, aPresetId );
     920             :                     }
     921             :                 }
     922           0 :                 else if( IsXMLToken( pValue->Name, XML_PRESET_SUB_TYPE ) )
     923             :                 {
     924           0 :                     OUString aPresetSubType;
     925           0 :                     if( pValue->Value >>= aPresetSubType )
     926             :                     {
     927           0 :                         mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PRESET_SUB_TYPE, aPresetSubType );
     928           0 :                     }
     929             :                 }
     930           0 :                 else if( IsXMLToken( pValue->Name, XML_PRESET_CLASS ) )
     931             :                 {
     932           0 :                     sal_Int16 nEffectPresetClass = sal_Int16();
     933           0 :                     if( pValue->Value >>= nEffectPresetClass )
     934             :                     {
     935           0 :                         SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nEffectPresetClass, getAnimationsEnumMap(Animations_EnumMap_EffectPresetClass) );
     936           0 :                         mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PRESET_CLASS, sTmp.makeStringAndClear() );
     937             :                     }
     938             :                 }
     939           0 :                 else if( IsXMLToken( pValue->Name, XML_MASTER_ELEMENT ) )
     940             :                 {
     941           0 :                     Reference< XInterface > xMaster;
     942           0 :                     pValue->Value >>= xMaster;
     943           0 :                     if( xMaster.is() )
     944             :                     {
     945           0 :                         const OUString& rIdentifier = mrExport.getInterfaceToIdentifierMapper().getIdentifier(xMaster);
     946           0 :                         if( !rIdentifier.isEmpty() )
     947           0 :                             mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_MASTER_ELEMENT, rIdentifier );
     948           0 :                     }
     949             :                 }
     950           0 :                 else if( IsXMLToken( pValue->Name, XML_GROUP_ID ) )
     951             :                 {
     952           0 :                     sal_Int32 nGroupId = 0;
     953           0 :                     if( pValue->Value >>= nGroupId )
     954           0 :                         mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_GROUP_ID, OUString::number( nGroupId ) );
     955             :                 }
     956             :                 else
     957             :                 {
     958           0 :                     OUString aTmp;
     959           0 :                     if( pValue->Value >>= aTmp )
     960           0 :                         mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, pValue->Name, aTmp );
     961             :                 }
     962             :             }
     963             :         }
     964             : 
     965           0 :         nTemp = xNode->getType();
     966           0 :         switch( nTemp )
     967             :         {
     968             :         case AnimationNodeType::PAR:
     969             :         case AnimationNodeType::SEQ:
     970             :         case AnimationNodeType::ITERATE:
     971             :         {
     972           0 :             Reference< XTimeContainer > xContainer( xNode, UNO_QUERY_THROW );
     973           0 :             exportContainer( xContainer, nContainerNodeType );
     974             :         }
     975           0 :         break;
     976             : 
     977             :         case AnimationNodeType::ANIMATE:
     978             :         case AnimationNodeType::SET:
     979             :         case AnimationNodeType::ANIMATEMOTION:
     980             :         case AnimationNodeType::ANIMATECOLOR:
     981             :         case AnimationNodeType::ANIMATETRANSFORM:
     982             :         case AnimationNodeType::TRANSITIONFILTER:
     983             :         {
     984           0 :             Reference< XAnimate > xAnimate( xNode, UNO_QUERY_THROW );
     985           0 :             exportAnimate( xAnimate );
     986             :         }
     987           0 :         break;
     988             :         case AnimationNodeType::AUDIO:
     989             :         {
     990           0 :             Reference< XAudio > xAudio( xNode, UNO_QUERY_THROW );
     991           0 :             exportAudio( xAudio );
     992             :         }
     993           0 :         break;
     994             :         case AnimationNodeType::COMMAND:
     995             :         {
     996           0 :             Reference< XCommand > xCommand( xNode, UNO_QUERY_THROW );
     997           0 :             exportCommand( xCommand );
     998             :         }
     999           0 :         break;
    1000             :         default:
    1001             :             OSL_FAIL( "xmloff::AnimationsExporterImpl::exportNode(), invalid AnimationNodeType!" );
    1002           0 :         }
    1003             :     }
    1004           0 :     catch (const RuntimeException&)
    1005             :     {
    1006             :         OSL_FAIL( "xmloff::AnimationsExporterImpl::exportNode(), RuntimeException caught!" );
    1007             :     }
    1008             : 
    1009             :     // if something goes wrong, its always a good idea to clear the attribute list
    1010           0 :     mrExport.ClearAttrList();
    1011           0 : }
    1012             : 
    1013           0 : void AnimationsExporterImpl::exportContainer( const Reference< XTimeContainer >& xContainer, sal_Int16 nContainerNodeType )
    1014             : {
    1015             :     try
    1016             :     {
    1017           0 :         const sal_Int32 nNodeType = xContainer->getType();
    1018             : 
    1019           0 :         if( nNodeType == AnimationNodeType::ITERATE )
    1020             :         {
    1021           0 :             OUStringBuffer sTmp;
    1022           0 :             Reference< XIterateContainer > xIter( xContainer, UNO_QUERY_THROW );
    1023             : 
    1024           0 :             Any aTemp( xIter->getTarget() );
    1025           0 :             if( aTemp.hasValue() )
    1026             :             {
    1027           0 :                 convertTarget( sTmp, aTemp );
    1028           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TARGETELEMENT, sTmp.makeStringAndClear() );
    1029             :             }
    1030             : 
    1031           0 :             sal_Int16 nTemp = xIter->getSubItem();
    1032           0 :             if( nTemp )
    1033             :             {
    1034           0 :                 SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_SubItem) );
    1035           0 :                 mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_SUB_ITEM, sTmp.makeStringAndClear() );
    1036             :             }
    1037             : 
    1038           0 :             nTemp = xIter->getIterateType();
    1039           0 :             if( nTemp )
    1040             :             {
    1041           0 :                 SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_IterateType) );
    1042           0 :                 mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_ITERATE_TYPE, sTmp.makeStringAndClear() );
    1043             :             }
    1044             : 
    1045           0 :             double fTemp = xIter->getIterateInterval();
    1046           0 :             if( fTemp )
    1047             :             {
    1048           0 :                 if( !( mrExport.getExportFlags() & SvXMLExportFlags::SAVEBACKWARDCOMPATIBLE ) )
    1049             :                 {
    1050             :                     // issue 146582
    1051           0 :                     OUStringBuffer buf;
    1052           0 :                     ::sax::Converter::convertDuration(buf, fTemp / (24*60*60));
    1053             :                     mrExport.AddAttribute( XML_NAMESPACE_ANIMATION,
    1054           0 :                             XML_ITERATE_INTERVAL, buf.makeStringAndClear());
    1055             :                 }
    1056             :                 else
    1057             :                 {
    1058           0 :                     sTmp.append( fTemp );
    1059           0 :                     sTmp.append( 's' );
    1060           0 :                     mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_ITERATE_INTERVAL, sTmp.makeStringAndClear() );
    1061             :                 }
    1062           0 :             }
    1063             :         }
    1064             : 
    1065             :         XMLTokenEnum eElementToken;
    1066           0 :         switch( nNodeType )
    1067             :         {
    1068           0 :         case AnimationNodeType::PAR:    eElementToken = XML_PAR; break;
    1069           0 :         case AnimationNodeType::SEQ:    eElementToken = XML_SEQ; break;
    1070           0 :         case AnimationNodeType::ITERATE:eElementToken = XML_ITERATE; break;
    1071             :         default:
    1072             :             OSL_FAIL( "xmloff::AnimationsExporterImpl::exportContainer(), invalid TimeContainerType!" );
    1073           0 :             return;
    1074             :         }
    1075           0 :         SvXMLElementExport aElement( mrExport, XML_NAMESPACE_ANIMATION, eElementToken, true, true );
    1076             : 
    1077           0 :         if( nContainerNodeType == EffectNodeType::TIMING_ROOT )
    1078           0 :             exportTransitionNode();
    1079             : 
    1080           0 :         Reference< XEnumerationAccess > xEnumerationAccess( xContainer, UNO_QUERY_THROW );
    1081           0 :         Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
    1082           0 :         while( xEnumeration->hasMoreElements() )
    1083             :         {
    1084           0 :             Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
    1085           0 :             exportNode( xChildNode );
    1086           0 :         }
    1087             :     }
    1088           0 :     catch (const RuntimeException&)
    1089             :     {
    1090             :         OSL_FAIL( "xmloff::AnimationsExporterImpl::exportContainer(), RuntimeException caught!" );
    1091             :     }
    1092             : }
    1093             : 
    1094           0 : void AnimationsExporterImpl::exportAnimate( const Reference< XAnimate >& xAnimate )
    1095             : {
    1096             :     try
    1097             :     {
    1098           0 :         const sal_Int16 nNodeType = xAnimate->getType();
    1099             : 
    1100           0 :         OUStringBuffer sTmp;
    1101             :         sal_Int32 nTemp;
    1102             :         bool bTemp;
    1103             : 
    1104           0 :         Any aTemp( xAnimate->getTarget() );
    1105           0 :         if( aTemp.hasValue() )
    1106             :         {
    1107           0 :             convertTarget( sTmp, aTemp );
    1108           0 :             mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TARGETELEMENT, sTmp.makeStringAndClear() );
    1109             :         }
    1110             : 
    1111           0 :         nTemp = xAnimate->getSubItem();
    1112           0 :         if( nTemp )
    1113             :         {
    1114           0 :             SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_SubItem) );
    1115           0 :             mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_SUB_ITEM, sTmp.makeStringAndClear() );
    1116             :         }
    1117             : 
    1118           0 :         XMLTokenEnum eAttributeName = XML_TOKEN_INVALID;
    1119             : 
    1120           0 :         if( nNodeType == AnimationNodeType::TRANSITIONFILTER )
    1121             :         {
    1122           0 :             eAttributeName = XML_TRANSITIONFILTER;
    1123             :         }
    1124           0 :         else if( nNodeType == AnimationNodeType::ANIMATETRANSFORM )
    1125             :         {
    1126           0 :             eAttributeName = XML_ANIMATETRANSFORM;
    1127             :         }
    1128           0 :         else if( nNodeType == AnimationNodeType::ANIMATEMOTION )
    1129             :         {
    1130           0 :             eAttributeName = XML_ANIMATEMOTION;
    1131             :         }
    1132             :         else
    1133             :         {
    1134           0 :             OUString sTemp( xAnimate->getAttributeName() );
    1135           0 :             if( !sTemp.isEmpty() )
    1136             :             {
    1137           0 :                 const struct ImplAttributeNameConversion* p = getAnimationAttributeNamesConversionList();
    1138           0 :                 while( p->mpAPIName )
    1139             :                 {
    1140           0 :                     if( sTemp.equalsAscii( p->mpAPIName ) )
    1141             :                     {
    1142           0 :                         sTemp = GetXMLToken( p->meXMLToken );
    1143           0 :                         eAttributeName = p->meXMLToken;
    1144           0 :                         break;
    1145             :                     }
    1146             : 
    1147           0 :                     p++;
    1148             :                 }
    1149             : 
    1150           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ATTRIBUTENAME, sTemp );
    1151             :             }
    1152             :             else
    1153             :             {
    1154           0 :                 OUString aStr( "invalid" );
    1155           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ATTRIBUTENAME, aStr );
    1156           0 :             }
    1157             :         }
    1158             : 
    1159           0 :         Sequence< Any > aValues( xAnimate->getValues() );
    1160           0 :         if( aValues.getLength() )
    1161             :         {
    1162           0 :             aTemp <<= aValues;
    1163           0 :             convertValue( eAttributeName, sTmp, aTemp );
    1164           0 :             mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_VALUES, sTmp.makeStringAndClear() );
    1165             :         }
    1166             :         else
    1167             :         {
    1168           0 :             aTemp = xAnimate->getFrom();
    1169           0 :             if( aTemp.hasValue() )
    1170             :             {
    1171           0 :                 convertValue( eAttributeName, sTmp, aTemp );
    1172           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_FROM, sTmp.makeStringAndClear() );
    1173             :             }
    1174             : 
    1175           0 :             aTemp = xAnimate->getBy();
    1176           0 :             if( aTemp.hasValue() )
    1177             :             {
    1178           0 :                 convertValue( eAttributeName, sTmp, aTemp );
    1179           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_BY, sTmp.makeStringAndClear() );
    1180             :             }
    1181             : 
    1182           0 :             aTemp = xAnimate->getTo();
    1183           0 :             if( aTemp.hasValue() )
    1184             :             {
    1185           0 :                 convertValue( eAttributeName, sTmp, aTemp );
    1186           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TO, sTmp.makeStringAndClear() );
    1187             :             }
    1188             :         }
    1189             : 
    1190           0 :         if(nNodeType != AnimationNodeType::SET)
    1191             :         {
    1192           0 :             Sequence< double > aKeyTimes( xAnimate->getKeyTimes() );
    1193           0 :             if( aKeyTimes.getLength() )
    1194             :             {
    1195           0 :                 sal_Int32 nLength = aKeyTimes.getLength();
    1196           0 :                 const double* p = aKeyTimes.getConstArray();
    1197             : 
    1198           0 :                 while( nLength-- )
    1199             :                 {
    1200           0 :                     if( !sTmp.isEmpty() )
    1201           0 :                         sTmp.append( ';' );
    1202             : 
    1203           0 :                     sTmp.append( *p++ );
    1204             :                 }
    1205           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_KEYTIMES, sTmp.makeStringAndClear() );
    1206             :             }
    1207             : 
    1208           0 :             OUString sTemp( xAnimate->getFormula() );
    1209           0 :             if( !sTemp.isEmpty() )
    1210           0 :                 mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_FORMULA, sTemp );
    1211             : 
    1212           0 :             if( (nNodeType != AnimationNodeType::TRANSITIONFILTER) &&
    1213             :                 (nNodeType != AnimationNodeType::AUDIO ) )
    1214             :             {
    1215             :                 // calcMode  = "discrete | linear | paced | spline"
    1216           0 :                 nTemp = xAnimate->getCalcMode();
    1217           0 :                 if( ((nNodeType == AnimationNodeType::ANIMATEMOTION ) && (nTemp != AnimationCalcMode::PACED)) ||
    1218           0 :                     ((nNodeType != AnimationNodeType::ANIMATEMOTION ) && (nTemp != AnimationCalcMode::LINEAR)) )
    1219             :                 {
    1220           0 :                     SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_CalcMode) );
    1221           0 :                     mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_CALCMODE, sTmp.makeStringAndClear() );
    1222             :                 }
    1223             : 
    1224           0 :                 bTemp = xAnimate->getAccumulate();
    1225           0 :                 if( bTemp )
    1226           0 :                     mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ACCUMULATE, XML_SUM );
    1227             : 
    1228           0 :                 nTemp = xAnimate->getAdditive();
    1229           0 :                 if( nTemp != AnimationAdditiveMode::REPLACE )
    1230             :                 {
    1231           0 :                     SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_AdditiveMode) );
    1232           0 :                     mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ADDITIVE, sTmp.makeStringAndClear() );
    1233             :                 }
    1234             :             }
    1235             : 
    1236           0 :             Sequence< TimeFilterPair > aTimeFilter( xAnimate->getTimeFilter() );
    1237           0 :             if( aTimeFilter.getLength() )
    1238             :             {
    1239           0 :                 sal_Int32 nLength = aTimeFilter.getLength();
    1240           0 :                 const TimeFilterPair* p = aTimeFilter.getConstArray();
    1241             : 
    1242           0 :                 while( nLength-- )
    1243             :                 {
    1244           0 :                     if( !sTmp.isEmpty() )
    1245           0 :                         sTmp.append( ';' );
    1246             : 
    1247           0 :                     sTmp.append( OUString::number(p->Time) + "," + OUString::number(p->Progress) );
    1248             : 
    1249           0 :                     p++;
    1250             :                 }
    1251             : 
    1252           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_KEYSPLINES, sTmp.makeStringAndClear() );
    1253           0 :             }
    1254             :         }
    1255             : 
    1256           0 :         XMLTokenEnum eElementToken = XML_ANIMATE;
    1257             : 
    1258           0 :         switch( nNodeType )
    1259             :         {
    1260             :         case AnimationNodeType::ANIMATE:
    1261           0 :             eElementToken = XML_ANIMATE;
    1262           0 :             break;
    1263             : 
    1264             :         case AnimationNodeType::SET:
    1265           0 :             eElementToken = XML_SET;
    1266           0 :             break;
    1267             : 
    1268             :         case AnimationNodeType::ANIMATEMOTION:
    1269             :         {
    1270           0 :             eElementToken = XML_ANIMATEMOTION;
    1271             : 
    1272           0 :             Reference< XAnimateMotion > xAnimateMotion( xAnimate, UNO_QUERY_THROW );
    1273             : 
    1274           0 :             aTemp = xAnimateMotion->getPath();
    1275           0 :             if( aTemp.hasValue() )
    1276             :             {
    1277           0 :                 convertPath( sTmp, aTemp );
    1278           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_PATH, sTmp.makeStringAndClear() );
    1279             :             }
    1280             : 
    1281             :             // TODO: origin = ( parent | layout )
    1282           0 :             aTemp = xAnimateMotion->getOrigin();
    1283             :         }
    1284           0 :         break;
    1285             : 
    1286             :         case AnimationNodeType::ANIMATECOLOR:
    1287             :         {
    1288           0 :             eElementToken = XML_ANIMATECOLOR;
    1289             : 
    1290           0 :             Reference< XAnimateColor > xAnimateColor( xAnimate, UNO_QUERY_THROW );
    1291             : 
    1292           0 :             nTemp = xAnimateColor->getColorInterpolation();
    1293           0 :             mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_COLOR_INTERPOLATION, (nTemp == AnimationColorSpace::RGB) ? XML_RGB : XML_HSL );
    1294             : 
    1295           0 :             bTemp = xAnimateColor->getDirection();
    1296           0 :             mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_COLOR_INTERPOLATION_DIRECTION, bTemp ? XML_CLOCKWISE : XML_COUNTER_CLOCKWISE );
    1297             :         }
    1298           0 :         break;
    1299             : 
    1300             :         case AnimationNodeType::ANIMATETRANSFORM:
    1301             :         {
    1302           0 :             eElementToken = XML_ANIMATETRANSFORM;
    1303             : 
    1304           0 :             mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ATTRIBUTENAME, XML_TRANSFORM );
    1305             : 
    1306           0 :             Reference< XAnimateTransform > xTransform( xAnimate, UNO_QUERY_THROW );
    1307           0 :             nTemp = xTransform->getTransformType();
    1308           0 :             SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTemp, getAnimationsEnumMap(Animations_EnumMap_TransformType) );
    1309           0 :             mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_TYPE, sTmp.makeStringAndClear() );
    1310             :         }
    1311           0 :         break;
    1312             : 
    1313             :         case AnimationNodeType::TRANSITIONFILTER:
    1314             :         {
    1315           0 :             Reference< XTransitionFilter > xTransitionFilter( xAnimate, UNO_QUERY );
    1316           0 :             eElementToken = XML_TRANSITIONFILTER;
    1317             : 
    1318           0 :             sal_Int16 nTransition = xTransitionFilter->getTransition();
    1319           0 :             SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nTransition, getAnimationsEnumMap(Animations_EnumMap_TransitionType) );
    1320           0 :             mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TYPE, sTmp.makeStringAndClear() );
    1321             : 
    1322           0 :             sal_Int16 nSubtype = xTransitionFilter->getSubtype();
    1323           0 :             if( nSubtype != TransitionSubType::DEFAULT )
    1324             :             {
    1325           0 :                 SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nSubtype, getAnimationsEnumMap(Animations_EnumMap_TransitionSubType) );
    1326           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_SUBTYPE, sTmp.makeStringAndClear() );
    1327             :             }
    1328             : 
    1329           0 :             bTemp = xTransitionFilter->getMode();
    1330           0 :             if( !bTemp )
    1331           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_MODE, XML_OUT );
    1332             : 
    1333           0 :             bTemp = xTransitionFilter->getDirection();
    1334           0 :             if( !bTemp )
    1335           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_DIRECTION, XML_REVERSE );
    1336             : 
    1337           0 :             if( (nTransition == TransitionType::FADE) && ((nSubtype == TransitionSubType::FADETOCOLOR) || (nSubtype == TransitionSubType::FADEFROMCOLOR) ))
    1338             :             {
    1339           0 :                 nTemp = xTransitionFilter->getFadeColor();
    1340           0 :                 ::sax::Converter::convertColor( sTmp, nTemp );
    1341           0 :                 mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_FADECOLOR, sTmp.makeStringAndClear() );
    1342           0 :             }
    1343             :         }
    1344           0 :         break;
    1345             :         }
    1346             : 
    1347           0 :         SvXMLElementExport aElement( mrExport, XML_NAMESPACE_ANIMATION, eElementToken, true, true );
    1348             : 
    1349             :     }
    1350           0 :     catch (const Exception&)
    1351             :     {
    1352             :         OSL_FAIL( "xmloff::AnimationsExporterImpl::exportAnimate(), exception caught!" );
    1353             :     }
    1354           0 : }
    1355             : 
    1356           0 : void AnimationsExporterImpl::exportAudio( const Reference< XAudio >& xAudio )
    1357             : {
    1358           0 :     if( xAudio.is() ) try
    1359             :     {
    1360           0 :         OUString aSourceURL;
    1361           0 :         xAudio->getSource() >>= aSourceURL;
    1362           0 :         if( !aSourceURL.isEmpty() )
    1363           0 :             mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, mrExport.GetRelativeReference( aSourceURL ) );
    1364             : 
    1365           0 :         const double fVolume = xAudio->getVolume();
    1366           0 :         if( fVolume != 1.0 )
    1367             :         {
    1368           0 :             OUStringBuffer sTmp;
    1369           0 :             ::sax::Converter::convertDouble( sTmp, fVolume );
    1370           0 :             mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_AUDIO_LEVEL, sTmp.makeStringAndClear() );
    1371             :         }
    1372             : 
    1373             : /* todo?
    1374             :         sal_Int32 nEndAfterSlide = 0;
    1375             :         xAudio->getEndAfterSlide() >>= nEndAfterSlide;
    1376             :         if( nEndAfterSlide != 0 )
    1377             :             mrExport.AddAttribute( );
    1378             : */
    1379           0 :         SvXMLElementExport aElement( mrExport, XML_NAMESPACE_ANIMATION, XML_AUDIO, true, true );
    1380             : 
    1381             :     }
    1382           0 :     catch (const Exception&)
    1383             :     {
    1384             :         OSL_FAIL( "xmloff::AnimationsExporterImpl::exportAudio(), exception caught!" );
    1385             :     }
    1386           0 : }
    1387             : 
    1388           0 : void AnimationsExporterImpl::exportCommand( const Reference< XCommand >& xCommand )
    1389             : {
    1390           0 :     if( xCommand.is() ) try
    1391             :     {
    1392           0 :         OUStringBuffer sTmp;
    1393           0 :         Any aTemp( xCommand->getTarget() );
    1394           0 :         if( aTemp.hasValue() )
    1395             :         {
    1396           0 :             convertTarget( sTmp, aTemp );
    1397           0 :             mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_TARGETELEMENT, sTmp.makeStringAndClear() );
    1398             :         }
    1399             : 
    1400           0 :         sal_Int16 nCommand = xCommand->getCommand();
    1401           0 :         SvXMLUnitConverter::convertEnum( sTmp, (sal_uInt16)nCommand, getAnimationsEnumMap(Animations_EnumMap_Command) );
    1402           0 :         mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_COMMAND, sTmp.makeStringAndClear() );
    1403             : 
    1404             : // todo virtual ::com::sun::star::uno::Any SAL_CALL getParameter() throw (::com::sun::star::uno::RuntimeException) = 0;
    1405             : 
    1406           0 :         SvXMLElementExport aElement( mrExport, XML_NAMESPACE_ANIMATION, XML_COMMAND, true, true );
    1407             : 
    1408             :     }
    1409           0 :     catch (const Exception&)
    1410             :     {
    1411             :         OSL_FAIL( "xmloff::AnimationsExporterImpl::exportCommand(), exception caught!" );
    1412             :     }
    1413           0 : }
    1414             : 
    1415           0 : Reference< XInterface > AnimationsExporterImpl::getParagraphTarget( const ParagraphTarget* pTarget )
    1416             : {
    1417           0 :     if( pTarget ) try
    1418             :     {
    1419           0 :         Reference< XEnumerationAccess > xParaEnumAccess( pTarget->Shape, UNO_QUERY_THROW );
    1420             : 
    1421           0 :         Reference< XEnumeration > xEnumeration( xParaEnumAccess->createEnumeration(), UNO_QUERY_THROW );
    1422           0 :         sal_Int32 nParagraph = pTarget->Paragraph;
    1423             : 
    1424           0 :         while( xEnumeration->hasMoreElements() )
    1425             :         {
    1426           0 :             Reference< XInterface > xRef( xEnumeration->nextElement(), UNO_QUERY );
    1427           0 :             if( nParagraph-- == 0 )
    1428           0 :                 return xRef;
    1429           0 :         }
    1430             :     }
    1431           0 :     catch (const RuntimeException&)
    1432             :     {
    1433             :         OSL_FAIL( "xmloff::AnimationsExporterImpl::getParagraphTarget(), RuntimeException caught!" );
    1434             :     }
    1435             : 
    1436           0 :     Reference< XInterface > xRef;
    1437           0 :     return xRef;
    1438             : }
    1439             : 
    1440           0 : void AnimationsExporterImpl::convertPath( OUStringBuffer& sTmp, const Any& rPath )
    1441             : {
    1442           0 :     OUString aStr;
    1443           0 :     rPath >>= aStr;
    1444             : 
    1445           0 :     sTmp = aStr;
    1446           0 : }
    1447             : 
    1448           0 : void AnimationsExporterImpl::convertValue( XMLTokenEnum eAttributeName, OUStringBuffer& sTmp, const Any& rValue ) const
    1449             : {
    1450           0 :     if( !rValue.hasValue() )
    1451           0 :         return;
    1452             : 
    1453           0 :     if( rValue.getValueType() == cppu::UnoType<ValuePair>::get() )
    1454             :     {
    1455           0 :         const ValuePair* pValuePair = static_cast< const ValuePair* >( rValue.getValue() );
    1456           0 :         OUStringBuffer sTmp2;
    1457           0 :         convertValue( eAttributeName, sTmp, pValuePair->First );
    1458           0 :         sTmp.append( ',' );
    1459           0 :         convertValue( eAttributeName, sTmp2, pValuePair->Second );
    1460           0 :         sTmp.append( sTmp2.makeStringAndClear() );
    1461             :     }
    1462           0 :     else if( rValue.getValueType() == cppu::UnoType< Sequence<Any> >::get() )
    1463             :     {
    1464           0 :         const Sequence<Any>* pSequence = static_cast< const Sequence<Any>* >( rValue.getValue() );
    1465           0 :         const sal_Int32 nLength = pSequence->getLength();
    1466             :         sal_Int32 nElement;
    1467           0 :         const Any* pAny = pSequence->getConstArray();
    1468             : 
    1469           0 :         OUStringBuffer sTmp2;
    1470             : 
    1471           0 :         for( nElement = 0; nElement < nLength; nElement++, pAny++ )
    1472             :         {
    1473           0 :             if( !sTmp.isEmpty() )
    1474           0 :                 sTmp.append( ';' );
    1475           0 :             convertValue( eAttributeName, sTmp2, *pAny );
    1476           0 :             sTmp.append( sTmp2.makeStringAndClear() );
    1477           0 :         }
    1478             :     }
    1479             :     else
    1480             :     {
    1481           0 :         OUString aString;
    1482             :         sal_Int32 nType;
    1483             : 
    1484           0 :         switch( eAttributeName )
    1485             :         {
    1486             :         case XML_X:
    1487             :         case XML_Y:
    1488             :         case XML_WIDTH:
    1489             :         case XML_HEIGHT:
    1490             :         case XML_ANIMATETRANSFORM:
    1491             :         case XML_ANIMATEMOTION:
    1492             :         {
    1493           0 :             if( rValue >>= aString )
    1494             :             {
    1495           0 :                 sTmp.append( aString );
    1496             :             }
    1497           0 :             else if( rValue.getValueType() == cppu::UnoType<double>::get() )
    1498             :             {
    1499           0 :                 sTmp.append( *(static_cast< const double* >( rValue.getValue() )) );
    1500             :             }
    1501             :             else
    1502             :             {
    1503             :                 OSL_FAIL( "xmloff::AnimationsExporterImpl::convertValue(), invalid value type!" );
    1504             :             }
    1505           0 :             return;
    1506             :         }
    1507             : 
    1508             :         case XML_SKEWX:
    1509           0 :         case XML_ROTATE:            nType = XML_TYPE_DOUBLE;                    break;
    1510           0 :         case XML_TEXT_ROTATION_ANGLE: nType = XML_TYPE_NUMBER16;                break;
    1511             :         case XML_FILL_COLOR:
    1512             :         case XML_STROKE_COLOR:
    1513             :         case XML_DIM:
    1514           0 :         case XML_COLOR:             nType = XML_TYPE_COLOR;                     break;
    1515           0 :         case XML_FILL:              nType = XML_SD_TYPE_FILLSTYLE;              break;
    1516           0 :         case XML_STROKE:            nType = XML_SD_TYPE_STROKE;                 break;
    1517           0 :         case XML_FONT_WEIGHT:       nType = XML_TYPE_TEXT_WEIGHT;               break;
    1518           0 :         case XML_FONT_STYLE:        nType = XML_TYPE_TEXT_POSTURE;              break;
    1519           0 :         case XML_TEXT_UNDERLINE:    nType = XML_TYPE_TEXT_UNDERLINE_STYLE;      break;
    1520           0 :         case XML_FONT_SIZE:         nType = XML_TYPE_DOUBLE_PERCENT;            break;
    1521           0 :         case XML_VISIBILITY:        nType = XML_SD_TYPE_PRESPAGE_VISIBILITY;    break;
    1522             :         case XML_OPACITY:
    1523           0 :         case XML_TRANSITIONFILTER:  nType = XML_TYPE_DOUBLE;                    break;
    1524             :         default:
    1525             :             OSL_FAIL( "xmloff::AnimationsExporterImpl::convertValue(), invalid AttributeName!" );
    1526           0 :             nType = XML_TYPE_STRING;
    1527             :         }
    1528             : 
    1529             :         //const XMLPropertyHandler* pHandler = static_cast<SdXMLExport*>(&mrExport)->GetSdPropHdlFactory()->GetPropertyHandler( nType );
    1530           0 :         const XMLPropertyHandler* pHandler = mpSdPropHdlFactory->GetPropertyHandler( nType );
    1531           0 :         if( pHandler )
    1532             :         {
    1533           0 :             pHandler->exportXML( aString, rValue, mrExport.GetMM100UnitConverter() );
    1534           0 :             sTmp.append( aString );
    1535           0 :         }
    1536             :     }
    1537             : }
    1538             : 
    1539           0 : void AnimationsExporterImpl::convertTiming( OUStringBuffer& sTmp, const Any& rValue ) const
    1540             : {
    1541           0 :     if( !rValue.hasValue() )
    1542           0 :         return;
    1543             : 
    1544           0 :     if( rValue.getValueType() == cppu::UnoType< Sequence<Any> >::get() )
    1545             :     {
    1546           0 :         const Sequence<Any>* pSequence = static_cast< const Sequence<Any>* >( rValue.getValue() );
    1547           0 :         const sal_Int32 nLength = pSequence->getLength();
    1548             :         sal_Int32 nElement;
    1549           0 :         const Any* pAny = pSequence->getConstArray();
    1550             : 
    1551           0 :         OUStringBuffer sTmp2;
    1552             : 
    1553           0 :         for( nElement = 0; nElement < nLength; nElement++, pAny++ )
    1554             :         {
    1555           0 :             if( !sTmp.isEmpty() )
    1556           0 :                 sTmp.append( ';' );
    1557           0 :             convertTiming( sTmp2, *pAny );
    1558           0 :             sTmp.append( sTmp2.makeStringAndClear() );
    1559           0 :         }
    1560             :     }
    1561           0 :     else if( rValue.getValueType() == cppu::UnoType<double>::get() )
    1562             :     {
    1563           0 :         sTmp.append( *(static_cast< const double* >( rValue.getValue() )) );
    1564           0 :         sTmp.append( 's');
    1565             :     }
    1566           0 :     else if( rValue.getValueType() == cppu::UnoType<Timing>::get() )
    1567             :     {
    1568           0 :         const Timing* pTiming = static_cast< const Timing* >( rValue.getValue() );
    1569           0 :         sTmp.append( GetXMLToken( (*pTiming == Timing_MEDIA) ? XML_MEDIA : XML_INDEFINITE ) );
    1570             :     }
    1571           0 :     else if( rValue.getValueType() == cppu::UnoType<Event>::get() )
    1572             :     {
    1573           0 :         OUStringBuffer sTmp2;
    1574             : 
    1575           0 :         const Event* pEvent = static_cast< const Event* >( rValue.getValue() );
    1576             : 
    1577           0 :         if( pEvent->Trigger != EventTrigger::NONE )
    1578             :         {
    1579           0 :             if( pEvent->Source.hasValue() )
    1580             :             {
    1581           0 :                 convertSource( sTmp, pEvent->Source );
    1582           0 :                 sTmp.append( '.' );
    1583             :             }
    1584             : 
    1585           0 :             SvXMLUnitConverter::convertEnum( sTmp2, (sal_uInt16)pEvent->Trigger, getAnimationsEnumMap(Animations_EnumMap_EventTrigger) );
    1586             : 
    1587           0 :             sTmp.append( sTmp2.makeStringAndClear() );
    1588             :         }
    1589             : 
    1590           0 :         if( pEvent->Offset.hasValue() )
    1591             :         {
    1592           0 :             convertTiming( sTmp2, pEvent->Offset );
    1593             : 
    1594           0 :             if( !sTmp.isEmpty() )
    1595           0 :                 sTmp.append( '+' );
    1596             : 
    1597           0 :             sTmp.append( sTmp2.makeStringAndClear() );
    1598           0 :         }
    1599             :     }
    1600             :     else
    1601             :     {
    1602             :         OSL_FAIL( "xmloff::AnimationsExporterImpl::convertTiming(), invalid value type!" );
    1603             :     }
    1604             : }
    1605             : 
    1606           0 : void AnimationsExporterImpl::convertSource( OUStringBuffer& sTmp, const Any& rSource ) const
    1607             : {
    1608           0 :     convertTarget( sTmp, rSource );
    1609           0 : }
    1610             : 
    1611           0 : void AnimationsExporterImpl::convertTarget( OUStringBuffer& sTmp, const Any& rTarget ) const
    1612             : {
    1613           0 :     if( !rTarget.hasValue() )
    1614           0 :         return;
    1615             : 
    1616           0 :     Reference< XInterface > xRef;
    1617             : 
    1618           0 :     if( rTarget.getValueTypeClass() == ::com::sun::star::uno::TypeClass_INTERFACE )
    1619             :     {
    1620           0 :         rTarget >>= xRef;
    1621             :     }
    1622           0 :     else if( rTarget.getValueType() == cppu::UnoType<ParagraphTarget>::get() )
    1623             :     {
    1624           0 :         xRef = getParagraphTarget( static_cast< const ParagraphTarget* >( rTarget.getValue() ) );
    1625             :     }
    1626             : 
    1627             :     DBG_ASSERT( xRef.is(), "xmloff::AnimationsExporterImpl::convertTarget(), invalid target type!" );
    1628           0 :     if( xRef.is() )
    1629             :     {
    1630           0 :         const OUString& rIdentifier = mrExport.getInterfaceToIdentifierMapper().getIdentifier(xRef);
    1631           0 :         if( !rIdentifier.isEmpty() )
    1632           0 :             sTmp.append( rIdentifier );
    1633           0 :     }
    1634             : }
    1635             : 
    1636          18 : void AnimationsExporterImpl::prepareValue( const Any& rValue )
    1637             : {
    1638          18 :     if( !rValue.hasValue() )
    1639          36 :         return;
    1640             : 
    1641           0 :     if( rValue.getValueType() == cppu::UnoType<ValuePair>::get() )
    1642             :     {
    1643           0 :         const ValuePair* pValuePair = static_cast< const ValuePair* >( rValue.getValue() );
    1644           0 :         prepareValue( pValuePair->First );
    1645           0 :         prepareValue( pValuePair->Second );
    1646             :     }
    1647           0 :     else if( rValue.getValueType() == cppu::UnoType< Sequence<Any> >::get() )
    1648             :     {
    1649           0 :         const Sequence<Any>* pSequence = static_cast< const Sequence<Any>* >( rValue.getValue() );
    1650           0 :         const sal_Int32 nLength = pSequence->getLength();
    1651             :         sal_Int32 nElement;
    1652           0 :         const Any* pAny = pSequence->getConstArray();
    1653             : 
    1654           0 :         for( nElement = 0; nElement < nLength; nElement++, pAny++ )
    1655           0 :             prepareValue( *pAny );
    1656             :     }
    1657           0 :     else if( rValue.getValueTypeClass() == ::com::sun::star::uno::TypeClass_INTERFACE )
    1658             :     {
    1659           0 :         Reference< XInterface> xRef( rValue, UNO_QUERY );
    1660           0 :         if( xRef.is() )
    1661           0 :             mrExport.getInterfaceToIdentifierMapper().registerReference( xRef );
    1662             :     }
    1663           0 :     else if( rValue.getValueType() == cppu::UnoType<ParagraphTarget>::get() )
    1664             :     {
    1665           0 :         Reference< XInterface> xRef( getParagraphTarget( static_cast< const ParagraphTarget* >( rValue.getValue() ) ) );
    1666           0 :         if( xRef.is() )
    1667           0 :             mrExport.getInterfaceToIdentifierMapper().registerReference( xRef );
    1668             :     }
    1669           0 :     else if( rValue.getValueType() == cppu::UnoType<Event>::get() )
    1670             :     {
    1671           0 :         const Event* pEvent = static_cast< const Event* >( rValue.getValue() );
    1672           0 :         prepareValue( pEvent->Source );
    1673             :     }
    1674             : }
    1675             : 
    1676           9 : AnimationsExporter::AnimationsExporter( SvXMLExport& rExport, const Reference< XPropertySet >& xPageProps )
    1677             : {
    1678           9 :     mpImpl = new AnimationsExporterImpl( rExport, xPageProps );
    1679           9 : }
    1680             : 
    1681          27 : AnimationsExporter::~AnimationsExporter()
    1682             : {
    1683           9 :     delete mpImpl;
    1684          18 : }
    1685             : 
    1686           9 : void AnimationsExporter::prepare( Reference< XAnimationNode > xRootNode )
    1687             : {
    1688             :     try
    1689             :     {
    1690           9 :         if( xRootNode.is() )
    1691             :         {
    1692           9 :             mpImpl->prepareTransitionNode();
    1693           9 :             mpImpl->prepareNode( xRootNode );
    1694             :         }
    1695             :     }
    1696           0 :     catch (const RuntimeException&)
    1697             :     {
    1698             :         OSL_FAIL( "xmloff::AnimationsExporter::prepare(), exception caught" );
    1699             :     }
    1700           9 : }
    1701             : 
    1702           9 : void AnimationsExporter::exportAnimations( Reference< XAnimationNode > xRootNode )
    1703             : {
    1704             :     try
    1705             :     {
    1706           9 :         if( xRootNode.is() )
    1707             :         {
    1708           9 :             bool bHasEffects = mpImpl->mbHasTransition;
    1709             : 
    1710           9 :             if( !bHasEffects )
    1711             :             {
    1712             :                 // first check if there are no animations
    1713           9 :                 Reference< XEnumerationAccess > xEnumerationAccess( xRootNode, UNO_QUERY_THROW );
    1714          18 :                 Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
    1715           9 :                 if( xEnumeration->hasMoreElements() )
    1716             :                 {
    1717             :                     // first child node may be an empty main sequence, check this
    1718           0 :                     Reference< XAnimationNode > xMainNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
    1719           0 :                     Reference< XEnumerationAccess > xMainEnumerationAccess( xMainNode, UNO_QUERY_THROW );
    1720           0 :                     Reference< XEnumeration > xMainEnumeration( xMainEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
    1721             : 
    1722             :                     // only export if the main sequence is not empty or if there are additional
    1723             :                     // trigger sequences
    1724           0 :                     bHasEffects = xMainEnumeration->hasMoreElements() || xEnumeration->hasMoreElements();
    1725           9 :                 }
    1726             :             }
    1727             : 
    1728           9 :             if( bHasEffects )
    1729           0 :                 mpImpl->exportNode( xRootNode );
    1730             :         }
    1731             :     }
    1732           0 :     catch (const RuntimeException&)
    1733             :     {
    1734             :         OSL_FAIL( "xmloff::AnimationsExporter::exportAnimations(), exception caught" );
    1735             :     }
    1736           9 : }
    1737             : 
    1738             : }
    1739             : 
    1740             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11