1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include "commontimenodecontext.hxx"
29 
30 #include <algorithm>
31 
32 #include "comphelper/anytostring.hxx"
33 #include "cppuhelper/exc_hlp.hxx"
34 #include <osl/diagnose.h>
35 
36 #include <com/sun/star/animations/XTimeContainer.hpp>
37 #include <com/sun/star/animations/XAnimationNode.hpp>
38 #include <com/sun/star/animations/AnimationFill.hpp>
39 #include <com/sun/star/animations/AnimationRestart.hpp>
40 #include <com/sun/star/presentation/TextAnimationType.hpp>
41 #include <com/sun/star/presentation/EffectPresetClass.hpp>
42 #include <com/sun/star/presentation/EffectNodeType.hpp>
43 
44 #include "oox/helper/attributelist.hxx"
45 #include "oox/core/fragmenthandler.hxx"
46 #include "oox/ppt/pptimport.hxx"
47 #include "oox/drawingml/drawingmltypes.hxx"
48 
49 #include "animationtypes.hxx"
50 
51 using namespace ::oox::core;
52 using namespace ::com::sun::star::uno;
53 using namespace ::com::sun::star::animations;
54 using namespace ::com::sun::star::presentation;
55 using namespace ::com::sun::star::xml::sax;
56 
57 
58 using ::rtl::OUString;
59 using ::com::sun::star::beans::NamedValue;
60 
61 namespace oox { namespace ppt {
62 
63 // BEGIN CUT&PASTE from sd/source/filter/ppt/pptanimations.hxx
64 struct convert_subtype
65 {
66 	sal_Int32 mnID;
67 	const sal_Char* mpStrSubType;
68 };
69 static const convert_subtype gConvertArray[] =
70 {
71 	// fly in
72 	{   1, "from-top" },
73 	{   2, "from-right" },
74 	{   3, "from-top-right" },
75 	{   4, "from-bottom" },
76 	{   5, "horizontal" },
77 	{   6, "from-bottom-right" },
78 	{   8, "from-left" },
79 	{   9, "from-top-left" },
80 	{  10, "vertical" },
81 	{  12, "from-bottom-left" },
82 	{  16, "in" },
83 	{  21, "vertical-in" },
84 	{  26, "horizontal-in" },
85 	{  32, "out" },
86 	{  36, "out-from-screen-center" },
87 	{  37, "vertical-out" },
88 	{  42, "horizontal-out" },
89 	{  272, "in-slightly" },
90 	{  288, "out-slightly" },
91 	{  528, "in-from-screen-center" },
92 	{  0, 0 }
93 };
94 
95 
96 struct preset_maping
97 {
98 	sal_Int32	mnPresetClass;
99 	sal_Int32	mnPresetId;
100 	const sal_Char*	mpStrPresetId;
101 };
102 
103 static const preset_maping gPresetMaping[] =
104 {
105 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 1	,"ooo-entrance-appear" },
106 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 2	,"ooo-entrance-fly-in" },
107 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 3	,"ooo-entrance-venetian-blinds" },
108 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 4	,"ooo-entrance-box" },
109 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 5	,"ooo-entrance-checkerboard" },
110 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 6	,"ooo-entrance-circle" },
111 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 7	,"ooo-entrance-fly-in-slow" },
112 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 8	,"ooo-entrance-diamond" },
113 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 9	,"ooo-entrance-dissolve-in" },
114 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 10	,"ooo-entrance-fade-in" },
115 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 11	,"ooo-entrance-flash-once" },
116 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 12	,"ooo-entrance-peek-in" },
117 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 13	,"ooo-entrance-plus" },
118 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 14	,"ooo-entrance-random-bars" },
119 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 15	,"ooo-entrance-spiral-in" },
120 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 16	,"ooo-entrance-split" },
121 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 17	,"ooo-entrance-stretchy" },
122 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 18	,"ooo-entrance-diagonal-squares" },
123 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 19	,"ooo-entrance-swivel" },
124 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 20	,"ooo-entrance-wedge" },
125 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 21	,"ooo-entrance-wheel" },
126 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 22	,"ooo-entrance-wipe" },
127 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 23	,"ooo-entrance-zoom" },
128 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 24	,"ooo-entrance-random" },
129 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 25	,"ooo-entrance-boomerang" },
130 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 26	,"ooo-entrance-bounce" },
131 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 27	,"ooo-entrance-colored-lettering" },
132 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 28	,"ooo-entrance-movie-credits" },
133 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 29	,"ooo-entrance-ease-in" },
134 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 30	,"ooo-entrance-float" },
135 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 31	,"ooo-entrance-turn-and-grow" },
136 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 34	,"ooo-entrance-breaks" },
137 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 35	,"ooo-entrance-pinwheel" },
138 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 37	,"ooo-entrance-rise-up" },
139 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 38	,"ooo-entrance-falling-in" },
140 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 39	,"ooo-entrance-thread" },
141 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 40	,"ooo-entrance-unfold" },
142 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 41	,"ooo-entrance-whip" },
143 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 42	,"ooo-entrance-ascend" },
144 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 43	,"ooo-entrance-center-revolve" },
145 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 45	,"ooo-entrance-fade-in-and-swivel" },
146 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 47	,"ooo-entrance-descend" },
147 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 48	,"ooo-entrance-sling" },
148 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 49	,"ooo-entrance-spin-in" },
149 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 50	,"ooo-entrance-compress" },
150 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 51	,"ooo-entrance-magnify" },
151 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 52	,"ooo-entrance-curve-up" },
152 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 53	,"ooo-entrance-fade-in-and-zoom" },
153 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 54	,"ooo-entrance-glide" },
154 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 55	,"ooo-entrance-expand" },
155 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 56	,"ooo-entrance-flip" },
156 	{ ::com::sun::star::presentation::EffectPresetClass::ENTRANCE, 58	,"ooo-entrance-fold" },
157 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 1	,"ooo-emphasis-fill-color" },
158 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 2	,"ooo-emphasis-font" },
159 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 3	,"ooo-emphasis-font-color" },
160 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 4	,"ooo-emphasis-font-size" },
161 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 5	,"ooo-emphasis-font-style" },
162 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 6	,"ooo-emphasis-grow-and-shrink" },
163 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 7	,"ooo-emphasis-line-color" },
164 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 8	,"ooo-emphasis-spin" },
165 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 9	,"ooo-emphasis-transparency" },
166 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 10	,"ooo-emphasis-bold-flash" },
167 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 14	,"ooo-emphasis-blast" },
168 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 15	,"ooo-emphasis-bold-reveal" },
169 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 16	,"ooo-emphasis-color-over-by-word" },
170 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 18	,"ooo-emphasis-reveal-underline" },
171 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 19	,"ooo-emphasis-color-blend" },
172 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 20	,"ooo-emphasis-color-over-by-letter" },
173 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 21	,"ooo-emphasis-complementary-color" },
174 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 22	,"ooo-emphasis-complementary-color-2" },
175 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 23	,"ooo-emphasis-contrasting-color" },
176 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 24	,"ooo-emphasis-darken" },
177 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 25	,"ooo-emphasis-desaturate" },
178 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 26	,"ooo-emphasis-flash-bulb" },
179 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 27	,"ooo-emphasis-flicker" },
180 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 28	,"ooo-emphasis-grow-with-color" },
181 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 30	,"ooo-emphasis-lighten" },
182 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 31	,"ooo-emphasis-style-emphasis" },
183 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 32	,"ooo-emphasis-teeter" },
184 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 33	,"ooo-emphasis-vertical-highlight" },
185 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 34	,"ooo-emphasis-wave" },
186 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 35	,"ooo-emphasis-blink" },
187 	{ ::com::sun::star::presentation::EffectPresetClass::EMPHASIS, 36	,"ooo-emphasis-shimmer" },
188 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 1		,"ooo-exit-disappear" },
189 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 2		,"ooo-exit-fly-out" },
190 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 3		,"ooo-exit-venetian-blinds" },
191 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 4		,"ooo-exit-box" },
192 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 5		,"ooo-exit-checkerboard" },
193 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 6		,"ooo-exit-circle" },
194 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 7		,"ooo-exit-crawl-out" },
195 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 8		,"ooo-exit-diamond" },
196 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 9		,"ooo-exit-dissolve" },
197 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 10		,"ooo-exit-fade-out" },
198 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 11		,"ooo-exit-flash-once" },
199 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 12		,"ooo-exit-peek-out" },
200 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 13		,"ooo-exit-plus" },
201 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 14		,"ooo-exit-random-bars" },
202 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 15		,"ooo-exit-spiral-out" },
203 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 16		,"ooo-exit-split" },
204 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 17		,"ooo-exit-collapse" },
205 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 18		,"ooo-exit-diagonal-squares" },
206 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 19		,"ooo-exit-swivel" },
207 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 20		,"ooo-exit-wedge" },
208 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 21		,"ooo-exit-wheel" },
209 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 22		,"ooo-exit-wipe" },
210 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 23		,"ooo-exit-zoom" },
211 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 24		,"ooo-exit-random" },
212 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 25		,"ooo-exit-boomerang" },
213 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 26		,"ooo-exit-bounce" },
214 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 27		,"ooo-exit-colored-lettering" },
215 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 28		,"ooo-exit-movie-credits" },
216 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 29		,"ooo-exit-ease-out" },
217 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 30		,"ooo-exit-float" },
218 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 31		,"ooo-exit-turn-and-grow" },
219 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 34		,"ooo-exit-breaks" },
220 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 35		,"ooo-exit-pinwheel" },
221 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 37		,"ooo-exit-sink-down" },
222 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 38		,"ooo-exit-swish" },
223 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 39		,"ooo-exit-thread" },
224 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 40		,"ooo-exit-unfold" },
225 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 41		,"ooo-exit-whip" },
226 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 42		,"ooo-exit-descend" },
227 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 43		,"ooo-exit-center-revolve" },
228 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 45		,"ooo-exit-fade-out-and-swivel" },
229 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 47		,"ooo-exit-ascend" },
230 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 48		,"ooo-exit-sling" },
231 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 53		,"ooo-exit-fade-out-and-zoom" },
232 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 55		,"ooo-exit-contract" },
233 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 49		,"ooo-exit-spin-out" },
234 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 50		,"ooo-exit-stretchy" },
235 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 51		,"ooo-exit-magnify" },
236 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 52		,"ooo-exit-curve-down" },
237 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 54		,"ooo-exit-glide" },
238 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 56		,"ooo-exit-flip" },
239 	{ ::com::sun::star::presentation::EffectPresetClass::EXIT, 58		,"ooo-exit-fold" },
240 
241 
242 
243 
244 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 16		,"ooo-motionpath-4-point-star" },
245 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 5		,"ooo-motionpath-5-point-star" },
246 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 11		,"ooo-motionpath-6-point-star" },
247 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 17		,"ooo-motionpath-8-point-star" },
248 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 1		,"ooo-motionpath-circle" },
249 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 6		,"ooo-motionpath-crescent-moon" },
250 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 3		,"ooo-motionpath-diamond" },
251 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 13		,"ooo-motionpath-equal-triangle" },
252 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 12		,"ooo-motionpath-oval" },
253 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 9		,"ooo-motionpath-heart" },
254 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 4		,"ooo-motionpath-hexagon" },
255 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 10		,"ooo-motionpath-octagon" },
256 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 14		,"ooo-motionpath-parallelogram" },
257 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 15		,"ooo-motionpath-pentagon" },
258 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 2		,"ooo-motionpath-right-triangle" },
259 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 7		,"ooo-motionpath-square" },
260 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 18		,"ooo-motionpath-teardrop" },
261 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 8		,"ooo-motionpath-trapezoid" },
262 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 37		,"ooo-motionpath-arc-down" },
263 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 51		,"ooo-motionpath-arc-left" },
264 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 58		,"ooo-motionpath-arc-right" },
265 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 44		,"ooo-motionpath-arc-up" },
266 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 41		,"ooo-motionpath-bounce-left" },
267 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 54		,"ooo-motionpath-bounce-right" },
268 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 48		,"ooo-motionpath-curvy-left" },
269 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 61		,"ooo-motionpath-curvy-right" },
270 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 60		,"ooo-motionpath-decaying-wave" },
271 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 49		,"ooo-motionpath-diagonal-down-right" },
272 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 56		,"ooo-motionpath-diagonal-up-right" },
273 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 42		,"ooo-motionpath-down" },
274 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 52		,"ooo-motionpath-funnel" },
275 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 53		,"ooo-motionpath-spring" },
276 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 62		,"ooo-motionpath-stairs-down" },
277 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 50		,"ooo-motionpath-turn-down" },
278 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 36		,"ooo-motionpath-turn-down-right" },
279 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 43		,"ooo-motionpath-turn-up" },
280 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 57		,"ooo-motionpath-turn-up-right" },
281 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 64		,"ooo-motionpath-up" },
282 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 47		,"ooo-motionpath-wave" },
283 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 38		,"ooo-motionpath-zigzag" },
284 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 31		,"ooo-motionpath-bean" },
285 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 25		,"ooo-motionpath-buzz-saw" },
286 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 20		,"ooo-motionpath-curved-square" },
287 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 21		,"ooo-motionpath-curved-x" },
288 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 23		,"ooo-motionpath-curvy-star" },
289 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 28		,"ooo-motionpath-figure-8-four" },
290 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 26		,"ooo-motionpath-horizontal-figure-8" },
291 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 34		,"ooo-motionpath-inverted-square" },
292 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 33		,"ooo-motionpath-inverted-triangle" },
293 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 24		,"ooo-motionpath-loop-de-loop" },
294 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 29		,"ooo-motionpath-neutron" },
295 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 27		,"ooo-motionpath-peanut" },
296 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 32		,"ooo-motionpath-clover" },
297 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 19		,"ooo-motionpath-pointy-star" },
298 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 30		,"ooo-motionpath-swoosh" },
299 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 22		,"ooo-motionpath-vertical-figure-8" },
300 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 35		,"ooo-motionpath-left" },
301 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 63		,"ooo-motionpath-right" },
302 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 55		,"ooo-motionpath-spiral-left" },
303 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 46		,"ooo-motionpath-spiral-right" },
304 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 40		,"ooo-motionpath-sine-wave" },
305 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 59		,"ooo-motionpath-s-curve-1" },
306 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 39		,"ooo-motionpath-s-curve-2" },
307 	{ ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH, 45		,"ooo-motionpath-heartbeat" },
308 
309 
310 	{ 0,0,0 }
311 };
312 
313 // from sd/source/filter/ppt/pptinanimations.cxx
314 static OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId, sal_Int32 nPresetSubType )
315 {
316 	const sal_Char* pStr = 0;
317 
318 	if( (nPresetClass == EffectPresetClass::ENTRANCE) || (nPresetClass == EffectPresetClass::EXIT) )
319 	{
320 		// skip wheel effect
321 		if( nPresetId != 21 )
322 		{
323 			if( nPresetId == 5 )
324 			{
325 				// checkerboard
326 				switch( nPresetSubType )
327 				{
328 				case  5: pStr = "downward"; break;
329 				case 10: pStr = "across"; break;
330 				}
331 			}
332 			else if( nPresetId == 17 )
333 			{
334 				// stretch
335 				if( nPresetSubType == 10 )
336 					pStr = "across";
337 			}
338 			else if( nPresetId == 18 )
339 			{
340 				// strips
341 				switch( nPresetSubType )
342 				{
343 				case 3:	pStr = "right-to-top"; break;
344 				case 6: pStr = "right-to-bottom"; break;
345 				case 9: pStr = "left-to-top"; break;
346 				case 12: pStr = "left-to-bottom"; break;
347 				}
348 			}
349 
350 			if( pStr == 0 )
351 			{
352 				const convert_subtype* p = gConvertArray;
353 
354 				while( p->mpStrSubType )
355 				{
356 					if( p->mnID == nPresetSubType )
357 					{
358 						pStr = p->mpStrSubType;
359 						break;
360 					}
361 					p++;
362 				}
363 			}
364 		}
365 	}
366 
367 	if( pStr )
368 		return OUString::createFromAscii( pStr );
369 	else
370 		return OUString::valueOf( nPresetSubType );
371 }
372 
373 // END
374 
375     CommonTimeNodeContext::CommonTimeNodeContext(
376             ContextHandler& rParent,
377             sal_Int32  aElement,
378             const Reference< XFastAttributeList >& xAttribs,
379             const TimeNodePtr & pNode )
380         : TimeNodeContext( rParent, aElement, xAttribs, pNode )
381 			, mbIterate( false )
382 	{
383 		AttributeList attribs( xAttribs );
384 		sal_Int32 nInt; // some temporary int value for float conversions
385 
386 		NodePropertyMap & aProps = pNode->getNodeProperties();
387         TimeNode::UserDataMap & aUserData = pNode->getUserData();
388 
389 		if( attribs.hasAttribute( XML_accel ) )
390 		{
391 			double dPercent = ::oox::drawingml::GetPositiveFixedPercentage( xAttribs->getOptionalValue( XML_accel ) );
392 			aProps[ NP_ACCELERATION ] <<= dPercent;
393 		}
394 
395 		if( attribs.hasAttribute( XML_afterEffect ) )
396 		{
397 			aUserData[ CREATE_OUSTRING( "after-effect" ) ]
398 				= makeAny( attribs.getBool( XML_afterEffect, false ) );
399 		}
400 		aProps[ NP_AUTOREVERSE ] = makeAny( attribs.getBool( XML_autoRev, false ) );
401 
402 		// TODO
403 		if( attribs.hasAttribute( XML_bldLvl ) )
404 		{
405 			attribs.getInteger( XML_bldLvl, 0 );
406 		}
407 		if( attribs.hasAttribute( XML_decel ) )
408 		{
409 			double dPercent = ::oox::drawingml::GetPositiveFixedPercentage( xAttribs->getOptionalValue( XML_decel ) );
410 			aProps[ NP_DECELERATE ] <<= dPercent;
411 		}
412 		// TODO
413 		if( attribs.hasAttribute( XML_display ) )
414 		{
415 			aProps[ NP_DISPLAY ] <<= attribs.getBool( XML_display, true );
416 		}
417 		if( attribs.hasAttribute( XML_dur ) )
418 		{
419 			aProps[ NP_DURATION ] = GetTime( xAttribs->getOptionalValue( XML_dur) );
420 		}
421 		// TODO
422 		if( attribs.hasAttribute( XML_evtFilter ) )
423 		{
424 			xAttribs->getOptionalValue( XML_evtFilter );
425 		}
426 		// ST_TLTimeNodeFillType
427 		if( attribs.hasAttribute( XML_fill ) )
428 		{
429 			nInt = xAttribs->getOptionalValueToken( XML_fill, 0 );
430 			if( nInt != 0 )
431 			{
432 				sal_Int16 nEnum;
433 				switch( nInt )
434 				{
435 				case XML_remove:
436 					nEnum = AnimationFill::REMOVE;
437 					break;
438 				case XML_freeze:
439 					nEnum = AnimationFill::FREEZE;
440 					break;
441 				case XML_hold:
442 					nEnum = AnimationFill::HOLD;
443 					break;
444 				case XML_transition:
445 					nEnum = AnimationFill::TRANSITION;
446 					break;
447 				default:
448 					nEnum = AnimationFill::DEFAULT;
449 					break;
450 				}
451 				aProps[ NP_FILL ] <<=  (sal_Int16)nEnum;
452 			}
453 		}
454 		if( attribs.hasAttribute( XML_grpId ) )
455 		{
456             attribs.getUnsigned( XML_grpId, 0 );
457 		}
458 		// ST_TLTimeNodeID
459 		if( attribs.hasAttribute( XML_id ) )
460 		{
461             sal_uInt32 nId = attribs.getUnsigned( XML_id, 0 );
462 			pNode->setId( nId );
463 		}
464 		// ST_TLTimeNodeMasterRelation
465 		nInt = xAttribs->getOptionalValueToken( XML_masterRel, 0 );
466 		if( nInt )
467 		{
468 			// TODO
469 			switch(nInt)
470 			{
471 			case XML_sameClick:
472 			case XML_lastClick:
473 			case XML_nextClick:
474 				break;
475 			}
476 		}
477 
478 		// TODO
479 		if( attribs.hasAttribute( XML_nodePh ) )
480 		{
481 			attribs.getBool( XML_nodePh, false );
482 		}
483 		// ST_TLTimeNodeType
484 		nInt = xAttribs->getOptionalValueToken( XML_nodeType, 0 );
485 		if( nInt != 0 )
486 		{
487 			sal_Int16 nEnum;
488 			switch( nInt )
489 			{
490 			case XML_clickEffect:
491 			case XML_clickPar:
492 				nEnum = EffectNodeType::ON_CLICK;
493 				break;
494 			case XML_withEffect:
495 			case XML_withGroup:
496 				nEnum = EffectNodeType::WITH_PREVIOUS;
497 				break;
498 			case XML_mainSeq:
499 				nEnum = EffectNodeType::MAIN_SEQUENCE;
500 				break;
501 			case XML_interactiveSeq:
502 				nEnum = EffectNodeType::INTERACTIVE_SEQUENCE;
503 				break;
504 			case XML_afterGroup:
505 			case XML_afterEffect:
506 				nEnum = EffectNodeType::AFTER_PREVIOUS;
507 				break;
508 			case XML_tmRoot:
509 				nEnum = EffectNodeType::TIMING_ROOT;
510 				break;
511 			default:
512 				nEnum = EffectNodeType::DEFAULT;
513 				break;
514 			}
515 			aUserData[ CREATE_OUSTRING( "node-type" ) ] <<= nEnum;
516 		}
517 
518 		// ST_TLTimeNodePresetClassType
519 		nInt = xAttribs->getOptionalValueToken( XML_presetClass, 0 );
520 		sal_Int16 nEffectPresetClass = 0;
521 		sal_Int32 nPresetId = 0;
522 		sal_Int32 nPresetSubType = 0;
523 		if( nInt != 0 )
524 		{
525 			// TODO put that in a function
526 			switch( nInt )
527 			{
528 			case XML_entr:
529 				nEffectPresetClass = EffectPresetClass::ENTRANCE;
530 				break;
531 			case XML_exit:
532 				nEffectPresetClass = EffectPresetClass::EXIT;
533 				break;
534 			case XML_emph:
535 				nEffectPresetClass = EffectPresetClass::EMPHASIS;
536 				break;
537 			case XML_path:
538 				nEffectPresetClass = EffectPresetClass::MOTIONPATH;
539 				break;
540 			case XML_verb:
541 				// TODO check that the value below is correct
542 				nEffectPresetClass = EffectPresetClass::OLEACTION;
543 				break;
544 			case XML_mediacall:
545 				nEffectPresetClass = EffectPresetClass::MEDIACALL;
546 				break;
547 			default:
548 				nEffectPresetClass = 0;
549 				break;
550 			}
551 			aUserData[ CREATE_OUSTRING( "preset-class" ) ] = makeAny( nEffectPresetClass );
552 			if( attribs.hasAttribute( XML_presetID ) )
553 			{
554 				nPresetId = attribs.getInteger( XML_presetID, 0 );
555 				const preset_maping* p = gPresetMaping;
556 				while( p->mpStrPresetId && ((p->mnPresetClass != nEffectPresetClass) || (p->mnPresetId != nPresetId )) )
557 					p++;
558 
559 				aUserData[ CREATE_OUSTRING( "preset-id" ) ]
560 					= makeAny( OUString::createFromAscii( p->mpStrPresetId ) );
561 				nPresetSubType = attribs.getInteger( XML_presetSubtype, 0 );
562 				if( nPresetSubType )
563 				{
564 					aUserData[ CREATE_OUSTRING( "preset-sub-type" ) ]
565 						= makeAny( getConvertedSubType( nEffectPresetClass, nPresetId, nPresetSubType ) );
566 				}
567 			}
568 		}
569 		if( attribs.hasAttribute( XML_repeatCount ) )
570 		{
571 			aProps[ NP_REPEATCOUNT ] = GetTime( xAttribs->getOptionalValue( XML_repeatCount ) );
572 		}
573 		/* see pptinanimation */
574 //			aProps[ NP_REPEATCOUNT ] <<= (fCount < ((float)3.40282346638528860e+38)) ? makeAny( (double)fCount ) : makeAny( Timing_INDEFINITE );
575 		if( attribs.hasAttribute( XML_repeatDur ) )
576 		{
577 			aProps[ NP_REPEATDURATION ] = GetTime( xAttribs->getOptionalValue( XML_repeatDur ) );
578 		}
579 		// TODO repeatDur is otherwise the same as dur. What shall we do? -- Hub
580 
581 		// ST_TLTimeNodeRestartType
582 		nInt = xAttribs->getOptionalValueToken( XML_restart, 0 );
583 		if( nInt != 0 )
584 		{
585 			// TODO put that in a function
586 			sal_Int16 nEnum;
587 			switch( nInt )
588 			{
589 			case XML_always:
590 				nEnum = AnimationRestart::ALWAYS;
591 				break;
592 			case XML_whenNotActive:
593 				nEnum = AnimationRestart::WHEN_NOT_ACTIVE;
594 				break;
595 			case XML_never:
596 				nEnum = AnimationRestart::NEVER;
597 				break;
598 			default:
599 				nEnum =	AnimationRestart::DEFAULT;
600 				break;
601 			}
602 			aProps[ NP_RESTART ] <<= (sal_Int16)nEnum;
603 		}
604 		// ST_Percentage TODO
605 		xAttribs->getOptionalValue( XML_spd /*"10000" */ );
606 		// ST_TLTimeNodeSyncType TODO
607 		xAttribs->getOptionalValue( XML_syncBehavior );
608 		// TODO (string)
609 		xAttribs->getOptionalValue( XML_tmFilter );
610 	}
611 
612 
613 	CommonTimeNodeContext::~CommonTimeNodeContext( ) throw ( )
614 	{
615 	}
616 
617 
618 	void SAL_CALL CommonTimeNodeContext::endFastElement( sal_Int32 aElement ) throw ( SAXException, RuntimeException)
619 	{
620 		if( aElement == ( PPT_TOKEN( iterate ) ) )
621 		{
622 			mbIterate = false;
623 		}
624 	}
625 
626 
627 	Reference< XFastContextHandler > SAL_CALL CommonTimeNodeContext::createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException )
628 	{
629 		Reference< XFastContextHandler > xRet;
630 
631 		switch ( aElementToken )
632 		{
633 		case PPT_TOKEN( childTnLst ):
634 		case PPT_TOKEN( subTnLst ):
635             xRet.set( new TimeNodeListContext( *this, mpNode->getChildren() ) );
636 			break;
637 
638 		case PPT_TOKEN( stCondLst ):
639             xRet.set( new CondListContext( *this, aElementToken, xAttribs, mpNode, mpNode->getStartCondition() ) );
640 			break;
641 		case PPT_TOKEN( endCondLst ):
642             xRet.set( new CondListContext( *this, aElementToken, xAttribs, mpNode, mpNode->getEndCondition() ) );
643 			break;
644 
645 		case PPT_TOKEN( endSync ):
646             xRet.set( new CondContext( *this, xAttribs, mpNode, mpNode->getEndSyncValue() ) );
647 			break;
648 		case PPT_TOKEN( iterate ):
649 		{
650 			sal_Int32 nVal = xAttribs->getOptionalValueToken( XML_type, XML_el );
651 			if( nVal != 0 )
652 			{
653 				// TODO put that in a function
654 				sal_Int16 nEnum;
655 				switch( nVal )
656 				{
657 				case XML_el:
658 					nEnum =	TextAnimationType::BY_PARAGRAPH;
659 					break;
660 				case XML_lt:
661 					nEnum = TextAnimationType::BY_LETTER;
662 					break;
663 				case XML_wd:
664 					nEnum = TextAnimationType::BY_WORD;
665 					break;
666 				default:
667 					// default is BY_WORD. See Ppt97Animation::GetTextAnimationType()
668 					// in sd/source/filter/ppt/ppt97animations.cxx:297
669 					nEnum = TextAnimationType::BY_WORD;
670 					break;
671 				}
672 				mpNode->getNodeProperties()[ NP_ITERATETYPE ] <<= nEnum;
673 			}
674 			// in case of exception we ignore the whole tag.
675 			AttributeList attribs( xAttribs );
676 			// TODO what to do with this
677 			/*bool bBackwards =*/ attribs.getBool( XML_backwards, false );
678 			mbIterate = true;
679 			break;
680 		}
681 		case PPT_TOKEN( tmAbs ):
682 			if( mbIterate )
683 			{
684 				AttributeList attribs( xAttribs );
685                 double fTime = attribs.getUnsigned( XML_val, 0 );
686 				// time in ms. property is in % TODO
687 				mpNode->getNodeProperties()[ NP_ITERATEINTERVAL ] <<= fTime;
688 			}
689 			break;
690 		case PPT_TOKEN( tmPct ):
691 			if( mbIterate )
692 			{
693 				AttributeList attribs( xAttribs );
694                 double fPercent = (double)attribs.getUnsigned( XML_val, 0 ) / 100000.0;
695 				mpNode->getNodeProperties()[ NP_ITERATEINTERVAL ] <<= fPercent;
696 			}
697 			break;
698 		default:
699 			break;
700 		}
701 
702 		if( !xRet.is() )
703 			xRet.set( this );
704 
705 		return xRet;
706 	}
707 
708 } }
709