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