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