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

Generated by: LCOV version 1.10