Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / oox / source / ppt / commontimenodecontext.cxx
blob178962340467d9fef6024b0b651d579b952a97b3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "commontimenodecontext.hxx"
22 #include <algorithm>
24 #include <cppuhelper/exc_hlp.hxx>
26 #include <com/sun/star/animations/AnimationFill.hpp>
27 #include <com/sun/star/animations/AnimationRestart.hpp>
28 #include <com/sun/star/presentation/TextAnimationType.hpp>
29 #include <com/sun/star/presentation/EffectPresetClass.hpp>
30 #include <com/sun/star/presentation/EffectNodeType.hpp>
32 #include <oox/helper/attributelist.hxx>
33 #include <oox/core/fragmenthandler.hxx>
34 #include <oox/ppt/pptimport.hxx>
35 #include <oox/ppt/pptfilterhelpers.hxx>
36 #include <oox/drawingml/drawingmltypes.hxx>
37 #include <oox/token/namespaces.hxx>
38 #include <oox/token/tokens.hxx>
40 #include "animationtypes.hxx"
42 using namespace ::oox::core;
43 using namespace ::com::sun::star::uno;
44 using namespace ::com::sun::star::animations;
45 using namespace ::com::sun::star::presentation;
46 using namespace ::com::sun::star::xml::sax;
49 namespace oox { namespace ppt {
51 const convert_subtype* convert_subtype::getList()
53 static const convert_subtype aList[] =
55 // fly in
56 { 1, "from-top" },
57 { 2, "from-right" },
58 { 3, "from-top-right" },
59 { 4, "from-bottom" },
60 { 5, "horizontal" },
61 { 6, "from-bottom-right" },
62 { 8, "from-left" },
63 { 9, "from-top-left" },
64 { 10, "vertical" },
65 { 12, "from-bottom-left" },
66 { 16, "in" },
67 { 21, "vertical-in" },
68 { 26, "horizontal-in" },
69 { 32, "out" },
70 { 36, "out-from-screen-center" },
71 { 37, "vertical-out" },
72 { 42, "horizontal-out" },
73 { 272, "in-slightly" },
74 { 288, "out-slightly" },
75 { 528, "in-from-screen-center" },
76 { 0, nullptr }
79 return aList;
82 const preset_mapping* preset_mapping::getList()
85 static const preset_mapping aList[] =
87 { css::presentation::EffectPresetClass::ENTRANCE, 1 ,"ooo-entrance-appear" },
88 { css::presentation::EffectPresetClass::ENTRANCE, 2 ,"ooo-entrance-fly-in" },
89 { css::presentation::EffectPresetClass::ENTRANCE, 3 ,"ooo-entrance-venetian-blinds" },
90 { css::presentation::EffectPresetClass::ENTRANCE, 4 ,"ooo-entrance-box" },
91 { css::presentation::EffectPresetClass::ENTRANCE, 5 ,"ooo-entrance-checkerboard" },
92 { css::presentation::EffectPresetClass::ENTRANCE, 6 ,"ooo-entrance-circle" },
93 { css::presentation::EffectPresetClass::ENTRANCE, 7 ,"ooo-entrance-fly-in-slow" },
94 { css::presentation::EffectPresetClass::ENTRANCE, 8 ,"ooo-entrance-diamond" },
95 { css::presentation::EffectPresetClass::ENTRANCE, 9 ,"ooo-entrance-dissolve-in" },
96 { css::presentation::EffectPresetClass::ENTRANCE, 10 ,"ooo-entrance-fade-in" },
97 { css::presentation::EffectPresetClass::ENTRANCE, 11 ,"ooo-entrance-flash-once" },
98 { css::presentation::EffectPresetClass::ENTRANCE, 12 ,"ooo-entrance-peek-in" },
99 { css::presentation::EffectPresetClass::ENTRANCE, 13 ,"ooo-entrance-plus" },
100 { css::presentation::EffectPresetClass::ENTRANCE, 14 ,"ooo-entrance-random-bars" },
101 { css::presentation::EffectPresetClass::ENTRANCE, 15 ,"ooo-entrance-spiral-in" },
102 { css::presentation::EffectPresetClass::ENTRANCE, 16 ,"ooo-entrance-split" },
103 { css::presentation::EffectPresetClass::ENTRANCE, 17 ,"ooo-entrance-stretchy" },
104 { css::presentation::EffectPresetClass::ENTRANCE, 18 ,"ooo-entrance-diagonal-squares" },
105 { css::presentation::EffectPresetClass::ENTRANCE, 19 ,"ooo-entrance-swivel" },
106 { css::presentation::EffectPresetClass::ENTRANCE, 20 ,"ooo-entrance-wedge" },
107 { css::presentation::EffectPresetClass::ENTRANCE, 21 ,"ooo-entrance-wheel" },
108 { css::presentation::EffectPresetClass::ENTRANCE, 22 ,"ooo-entrance-wipe" },
109 { css::presentation::EffectPresetClass::ENTRANCE, 23 ,"ooo-entrance-zoom" },
110 { css::presentation::EffectPresetClass::ENTRANCE, 24 ,"ooo-entrance-random" },
111 { css::presentation::EffectPresetClass::ENTRANCE, 25 ,"ooo-entrance-boomerang" },
112 { css::presentation::EffectPresetClass::ENTRANCE, 26 ,"ooo-entrance-bounce" },
113 { css::presentation::EffectPresetClass::ENTRANCE, 27 ,"ooo-entrance-colored-lettering" },
114 { css::presentation::EffectPresetClass::ENTRANCE, 28 ,"ooo-entrance-movie-credits" },
115 { css::presentation::EffectPresetClass::ENTRANCE, 29 ,"ooo-entrance-ease-in" },
116 { css::presentation::EffectPresetClass::ENTRANCE, 30 ,"ooo-entrance-float" },
117 { css::presentation::EffectPresetClass::ENTRANCE, 31 ,"ooo-entrance-turn-and-grow" },
118 { css::presentation::EffectPresetClass::ENTRANCE, 34 ,"ooo-entrance-breaks" },
119 { css::presentation::EffectPresetClass::ENTRANCE, 35 ,"ooo-entrance-pinwheel" },
120 { css::presentation::EffectPresetClass::ENTRANCE, 37 ,"ooo-entrance-rise-up" },
121 { css::presentation::EffectPresetClass::ENTRANCE, 38 ,"ooo-entrance-falling-in" },
122 { css::presentation::EffectPresetClass::ENTRANCE, 39 ,"ooo-entrance-thread" },
123 { css::presentation::EffectPresetClass::ENTRANCE, 40 ,"ooo-entrance-unfold" },
124 { css::presentation::EffectPresetClass::ENTRANCE, 41 ,"ooo-entrance-whip" },
125 { css::presentation::EffectPresetClass::ENTRANCE, 42 ,"ooo-entrance-ascend" },
126 { css::presentation::EffectPresetClass::ENTRANCE, 43 ,"ooo-entrance-center-revolve" },
127 { css::presentation::EffectPresetClass::ENTRANCE, 45 ,"ooo-entrance-fade-in-and-swivel" },
128 { css::presentation::EffectPresetClass::ENTRANCE, 47 ,"ooo-entrance-descend" },
129 { css::presentation::EffectPresetClass::ENTRANCE, 48 ,"ooo-entrance-sling" },
130 { css::presentation::EffectPresetClass::ENTRANCE, 49 ,"ooo-entrance-spin-in" },
131 { css::presentation::EffectPresetClass::ENTRANCE, 50 ,"ooo-entrance-compress" },
132 { css::presentation::EffectPresetClass::ENTRANCE, 51 ,"ooo-entrance-magnify" },
133 { css::presentation::EffectPresetClass::ENTRANCE, 52 ,"ooo-entrance-curve-up" },
134 { css::presentation::EffectPresetClass::ENTRANCE, 53 ,"ooo-entrance-fade-in-and-zoom" },
135 { css::presentation::EffectPresetClass::ENTRANCE, 54 ,"ooo-entrance-glide" },
136 { css::presentation::EffectPresetClass::ENTRANCE, 55 ,"ooo-entrance-expand" },
137 { css::presentation::EffectPresetClass::ENTRANCE, 56 ,"ooo-entrance-flip" },
138 { css::presentation::EffectPresetClass::ENTRANCE, 58 ,"ooo-entrance-fold" },
139 { css::presentation::EffectPresetClass::EMPHASIS, 1 ,"ooo-emphasis-fill-color" },
140 { css::presentation::EffectPresetClass::EMPHASIS, 2 ,"ooo-emphasis-font" },
141 { css::presentation::EffectPresetClass::EMPHASIS, 3 ,"ooo-emphasis-font-color" },
142 { css::presentation::EffectPresetClass::EMPHASIS, 4 ,"ooo-emphasis-font-size" },
143 { css::presentation::EffectPresetClass::EMPHASIS, 5 ,"ooo-emphasis-font-style" },
144 { css::presentation::EffectPresetClass::EMPHASIS, 6 ,"ooo-emphasis-grow-and-shrink" },
145 { css::presentation::EffectPresetClass::EMPHASIS, 7 ,"ooo-emphasis-line-color" },
146 { css::presentation::EffectPresetClass::EMPHASIS, 8 ,"ooo-emphasis-spin" },
147 { css::presentation::EffectPresetClass::EMPHASIS, 9 ,"ooo-emphasis-transparency" },
148 { css::presentation::EffectPresetClass::EMPHASIS, 10 ,"ooo-emphasis-bold-flash" },
149 { css::presentation::EffectPresetClass::EMPHASIS, 14 ,"ooo-emphasis-blast" },
150 { css::presentation::EffectPresetClass::EMPHASIS, 15 ,"ooo-emphasis-bold-reveal" },
151 { css::presentation::EffectPresetClass::EMPHASIS, 16 ,"ooo-emphasis-color-over-by-word" },
152 { css::presentation::EffectPresetClass::EMPHASIS, 18 ,"ooo-emphasis-reveal-underline" },
153 { css::presentation::EffectPresetClass::EMPHASIS, 19 ,"ooo-emphasis-color-blend" },
154 { css::presentation::EffectPresetClass::EMPHASIS, 20 ,"ooo-emphasis-color-over-by-letter" },
155 { css::presentation::EffectPresetClass::EMPHASIS, 21 ,"ooo-emphasis-complementary-color" },
156 { css::presentation::EffectPresetClass::EMPHASIS, 22 ,"ooo-emphasis-complementary-color-2" },
157 { css::presentation::EffectPresetClass::EMPHASIS, 23 ,"ooo-emphasis-contrasting-color" },
158 { css::presentation::EffectPresetClass::EMPHASIS, 24 ,"ooo-emphasis-darken" },
159 { css::presentation::EffectPresetClass::EMPHASIS, 25 ,"ooo-emphasis-desaturate" },
160 { css::presentation::EffectPresetClass::EMPHASIS, 26 ,"ooo-emphasis-flash-bulb" },
161 { css::presentation::EffectPresetClass::EMPHASIS, 27 ,"ooo-emphasis-flicker" },
162 { css::presentation::EffectPresetClass::EMPHASIS, 28 ,"ooo-emphasis-grow-with-color" },
163 { css::presentation::EffectPresetClass::EMPHASIS, 30 ,"ooo-emphasis-lighten" },
164 { css::presentation::EffectPresetClass::EMPHASIS, 31 ,"ooo-emphasis-style-emphasis" },
165 { css::presentation::EffectPresetClass::EMPHASIS, 32 ,"ooo-emphasis-teeter" },
166 { css::presentation::EffectPresetClass::EMPHASIS, 33 ,"ooo-emphasis-vertical-highlight" },
167 { css::presentation::EffectPresetClass::EMPHASIS, 34 ,"ooo-emphasis-wave" },
168 { css::presentation::EffectPresetClass::EMPHASIS, 35 ,"ooo-emphasis-blink" },
169 { css::presentation::EffectPresetClass::EMPHASIS, 36 ,"ooo-emphasis-shimmer" },
170 { css::presentation::EffectPresetClass::EXIT, 1 ,"ooo-exit-disappear" },
171 { css::presentation::EffectPresetClass::EXIT, 2 ,"ooo-exit-fly-out" },
172 { css::presentation::EffectPresetClass::EXIT, 3 ,"ooo-exit-venetian-blinds" },
173 { css::presentation::EffectPresetClass::EXIT, 4 ,"ooo-exit-box" },
174 { css::presentation::EffectPresetClass::EXIT, 5 ,"ooo-exit-checkerboard" },
175 { css::presentation::EffectPresetClass::EXIT, 6 ,"ooo-exit-circle" },
176 { css::presentation::EffectPresetClass::EXIT, 7 ,"ooo-exit-crawl-out" },
177 { css::presentation::EffectPresetClass::EXIT, 8 ,"ooo-exit-diamond" },
178 { css::presentation::EffectPresetClass::EXIT, 9 ,"ooo-exit-dissolve" },
179 { css::presentation::EffectPresetClass::EXIT, 10 ,"ooo-exit-fade-out" },
180 { css::presentation::EffectPresetClass::EXIT, 11 ,"ooo-exit-flash-once" },
181 { css::presentation::EffectPresetClass::EXIT, 12 ,"ooo-exit-peek-out" },
182 { css::presentation::EffectPresetClass::EXIT, 13 ,"ooo-exit-plus" },
183 { css::presentation::EffectPresetClass::EXIT, 14 ,"ooo-exit-random-bars" },
184 { css::presentation::EffectPresetClass::EXIT, 15 ,"ooo-exit-spiral-out" },
185 { css::presentation::EffectPresetClass::EXIT, 16 ,"ooo-exit-split" },
186 { css::presentation::EffectPresetClass::EXIT, 17 ,"ooo-exit-collapse" },
187 { css::presentation::EffectPresetClass::EXIT, 18 ,"ooo-exit-diagonal-squares" },
188 { css::presentation::EffectPresetClass::EXIT, 19 ,"ooo-exit-swivel" },
189 { css::presentation::EffectPresetClass::EXIT, 20 ,"ooo-exit-wedge" },
190 { css::presentation::EffectPresetClass::EXIT, 21 ,"ooo-exit-wheel" },
191 { css::presentation::EffectPresetClass::EXIT, 22 ,"ooo-exit-wipe" },
192 { css::presentation::EffectPresetClass::EXIT, 23 ,"ooo-exit-zoom" },
193 { css::presentation::EffectPresetClass::EXIT, 24 ,"ooo-exit-random" },
194 { css::presentation::EffectPresetClass::EXIT, 25 ,"ooo-exit-boomerang" },
195 { css::presentation::EffectPresetClass::EXIT, 26 ,"ooo-exit-bounce" },
196 { css::presentation::EffectPresetClass::EXIT, 27 ,"ooo-exit-colored-lettering" },
197 { css::presentation::EffectPresetClass::EXIT, 28 ,"ooo-exit-movie-credits" },
198 { css::presentation::EffectPresetClass::EXIT, 29 ,"ooo-exit-ease-out" },
199 { css::presentation::EffectPresetClass::EXIT, 30 ,"ooo-exit-float" },
200 { css::presentation::EffectPresetClass::EXIT, 31 ,"ooo-exit-turn-and-grow" },
201 { css::presentation::EffectPresetClass::EXIT, 34 ,"ooo-exit-breaks" },
202 { css::presentation::EffectPresetClass::EXIT, 35 ,"ooo-exit-pinwheel" },
203 { css::presentation::EffectPresetClass::EXIT, 37 ,"ooo-exit-sink-down" },
204 { css::presentation::EffectPresetClass::EXIT, 38 ,"ooo-exit-swish" },
205 { css::presentation::EffectPresetClass::EXIT, 39 ,"ooo-exit-thread" },
206 { css::presentation::EffectPresetClass::EXIT, 40 ,"ooo-exit-unfold" },
207 { css::presentation::EffectPresetClass::EXIT, 41 ,"ooo-exit-whip" },
208 { css::presentation::EffectPresetClass::EXIT, 42 ,"ooo-exit-descend" },
209 { css::presentation::EffectPresetClass::EXIT, 43 ,"ooo-exit-center-revolve" },
210 { css::presentation::EffectPresetClass::EXIT, 45 ,"ooo-exit-fade-out-and-swivel" },
211 { css::presentation::EffectPresetClass::EXIT, 47 ,"ooo-exit-ascend" },
212 { css::presentation::EffectPresetClass::EXIT, 48 ,"ooo-exit-sling" },
213 { css::presentation::EffectPresetClass::EXIT, 53 ,"ooo-exit-fade-out-and-zoom" },
214 { css::presentation::EffectPresetClass::EXIT, 55 ,"ooo-exit-contract" },
215 { css::presentation::EffectPresetClass::EXIT, 49 ,"ooo-exit-spin-out" },
216 { css::presentation::EffectPresetClass::EXIT, 50 ,"ooo-exit-stretchy" },
217 { css::presentation::EffectPresetClass::EXIT, 51 ,"ooo-exit-magnify" },
218 { css::presentation::EffectPresetClass::EXIT, 52 ,"ooo-exit-curve-down" },
219 { css::presentation::EffectPresetClass::EXIT, 54 ,"ooo-exit-glide" },
220 { css::presentation::EffectPresetClass::EXIT, 56 ,"ooo-exit-flip" },
221 { css::presentation::EffectPresetClass::EXIT, 58 ,"ooo-exit-fold" },
223 { css::presentation::EffectPresetClass::MOTIONPATH, 16 ,"ooo-motionpath-4-point-star" },
224 { css::presentation::EffectPresetClass::MOTIONPATH, 5 ,"ooo-motionpath-5-point-star" },
225 { css::presentation::EffectPresetClass::MOTIONPATH, 11 ,"ooo-motionpath-6-point-star" },
226 { css::presentation::EffectPresetClass::MOTIONPATH, 17 ,"ooo-motionpath-8-point-star" },
227 { css::presentation::EffectPresetClass::MOTIONPATH, 1 ,"ooo-motionpath-circle" },
228 { css::presentation::EffectPresetClass::MOTIONPATH, 6 ,"ooo-motionpath-crescent-moon" },
229 { css::presentation::EffectPresetClass::MOTIONPATH, 3 ,"ooo-motionpath-diamond" },
230 { css::presentation::EffectPresetClass::MOTIONPATH, 13 ,"ooo-motionpath-equal-triangle" },
231 { css::presentation::EffectPresetClass::MOTIONPATH, 12 ,"ooo-motionpath-oval" },
232 { css::presentation::EffectPresetClass::MOTIONPATH, 9 ,"ooo-motionpath-heart" },
233 { css::presentation::EffectPresetClass::MOTIONPATH, 4 ,"ooo-motionpath-hexagon" },
234 { css::presentation::EffectPresetClass::MOTIONPATH, 10 ,"ooo-motionpath-octagon" },
235 { css::presentation::EffectPresetClass::MOTIONPATH, 14 ,"ooo-motionpath-parallelogram" },
236 { css::presentation::EffectPresetClass::MOTIONPATH, 15 ,"ooo-motionpath-pentagon" },
237 { css::presentation::EffectPresetClass::MOTIONPATH, 2 ,"ooo-motionpath-right-triangle" },
238 { css::presentation::EffectPresetClass::MOTIONPATH, 7 ,"ooo-motionpath-square" },
239 { css::presentation::EffectPresetClass::MOTIONPATH, 18 ,"ooo-motionpath-teardrop" },
240 { css::presentation::EffectPresetClass::MOTIONPATH, 8 ,"ooo-motionpath-trapezoid" },
241 { css::presentation::EffectPresetClass::MOTIONPATH, 37 ,"ooo-motionpath-arc-down" },
242 { css::presentation::EffectPresetClass::MOTIONPATH, 51 ,"ooo-motionpath-arc-left" },
243 { css::presentation::EffectPresetClass::MOTIONPATH, 58 ,"ooo-motionpath-arc-right" },
244 { css::presentation::EffectPresetClass::MOTIONPATH, 44 ,"ooo-motionpath-arc-up" },
245 { css::presentation::EffectPresetClass::MOTIONPATH, 41 ,"ooo-motionpath-bounce-left" },
246 { css::presentation::EffectPresetClass::MOTIONPATH, 54 ,"ooo-motionpath-bounce-right" },
247 { css::presentation::EffectPresetClass::MOTIONPATH, 48 ,"ooo-motionpath-curvy-left" },
248 { css::presentation::EffectPresetClass::MOTIONPATH, 61 ,"ooo-motionpath-curvy-right" },
249 { css::presentation::EffectPresetClass::MOTIONPATH, 60 ,"ooo-motionpath-decaying-wave" },
250 { css::presentation::EffectPresetClass::MOTIONPATH, 49 ,"ooo-motionpath-diagonal-down-right" },
251 { css::presentation::EffectPresetClass::MOTIONPATH, 56 ,"ooo-motionpath-diagonal-up-right" },
252 { css::presentation::EffectPresetClass::MOTIONPATH, 42 ,"ooo-motionpath-down" },
253 { css::presentation::EffectPresetClass::MOTIONPATH, 52 ,"ooo-motionpath-funnel" },
254 { css::presentation::EffectPresetClass::MOTIONPATH, 53 ,"ooo-motionpath-spring" },
255 { css::presentation::EffectPresetClass::MOTIONPATH, 62 ,"ooo-motionpath-stairs-down" },
256 { css::presentation::EffectPresetClass::MOTIONPATH, 50 ,"ooo-motionpath-turn-down" },
257 { css::presentation::EffectPresetClass::MOTIONPATH, 36 ,"ooo-motionpath-turn-down-right" },
258 { css::presentation::EffectPresetClass::MOTIONPATH, 43 ,"ooo-motionpath-turn-up" },
259 { css::presentation::EffectPresetClass::MOTIONPATH, 57 ,"ooo-motionpath-turn-up-right" },
260 { css::presentation::EffectPresetClass::MOTIONPATH, 64 ,"ooo-motionpath-up" },
261 { css::presentation::EffectPresetClass::MOTIONPATH, 47 ,"ooo-motionpath-wave" },
262 { css::presentation::EffectPresetClass::MOTIONPATH, 38 ,"ooo-motionpath-zigzag" },
263 { css::presentation::EffectPresetClass::MOTIONPATH, 31 ,"ooo-motionpath-bean" },
264 { css::presentation::EffectPresetClass::MOTIONPATH, 25 ,"ooo-motionpath-buzz-saw" },
265 { css::presentation::EffectPresetClass::MOTIONPATH, 20 ,"ooo-motionpath-curved-square" },
266 { css::presentation::EffectPresetClass::MOTIONPATH, 21 ,"ooo-motionpath-curved-x" },
267 { css::presentation::EffectPresetClass::MOTIONPATH, 23 ,"ooo-motionpath-curvy-star" },
268 { css::presentation::EffectPresetClass::MOTIONPATH, 28 ,"ooo-motionpath-figure-8-four" },
269 { css::presentation::EffectPresetClass::MOTIONPATH, 26 ,"ooo-motionpath-horizontal-figure-8" },
270 { css::presentation::EffectPresetClass::MOTIONPATH, 34 ,"ooo-motionpath-inverted-square" },
271 { css::presentation::EffectPresetClass::MOTIONPATH, 33 ,"ooo-motionpath-inverted-triangle" },
272 { css::presentation::EffectPresetClass::MOTIONPATH, 24 ,"ooo-motionpath-loop-de-loop" },
273 { css::presentation::EffectPresetClass::MOTIONPATH, 29 ,"ooo-motionpath-neutron" },
274 { css::presentation::EffectPresetClass::MOTIONPATH, 27 ,"ooo-motionpath-peanut" },
275 { css::presentation::EffectPresetClass::MOTIONPATH, 32 ,"ooo-motionpath-clover" },
276 { css::presentation::EffectPresetClass::MOTIONPATH, 19 ,"ooo-motionpath-pointy-star" },
277 { css::presentation::EffectPresetClass::MOTIONPATH, 30 ,"ooo-motionpath-swoosh" },
278 { css::presentation::EffectPresetClass::MOTIONPATH, 22 ,"ooo-motionpath-vertical-figure-8" },
279 { css::presentation::EffectPresetClass::MOTIONPATH, 35 ,"ooo-motionpath-left" },
280 { css::presentation::EffectPresetClass::MOTIONPATH, 63 ,"ooo-motionpath-right" },
281 { css::presentation::EffectPresetClass::MOTIONPATH, 55 ,"ooo-motionpath-spiral-left" },
282 { css::presentation::EffectPresetClass::MOTIONPATH, 46 ,"ooo-motionpath-spiral-right" },
283 { css::presentation::EffectPresetClass::MOTIONPATH, 40 ,"ooo-motionpath-sine-wave" },
284 { css::presentation::EffectPresetClass::MOTIONPATH, 59 ,"ooo-motionpath-s-curve-1" },
285 { css::presentation::EffectPresetClass::MOTIONPATH, 39 ,"ooo-motionpath-s-curve-2" },
286 { css::presentation::EffectPresetClass::MOTIONPATH, 45 ,"ooo-motionpath-heartbeat" },
288 { 0,0,nullptr }
291 return aList;
294 OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId, sal_Int32 nPresetSubType )
296 const sal_Char* pStr = nullptr;
298 if( (nPresetClass == EffectPresetClass::ENTRANCE) || (nPresetClass == EffectPresetClass::EXIT) )
300 // skip wheel effect
301 if( nPresetId != 21 )
303 if( nPresetId == 5 )
305 // checkerboard
306 switch( nPresetSubType )
308 case 5: pStr = "downward"; break;
309 case 10: pStr = "across"; break;
312 else if( nPresetId == 17 )
314 // stretch
315 if( nPresetSubType == 10 )
316 pStr = "across";
318 else if( nPresetId == 18 )
320 // strips
321 switch( nPresetSubType )
323 case 3: pStr = "right-to-top"; break;
324 case 6: pStr = "right-to-bottom"; break;
325 case 9: pStr = "left-to-top"; break;
326 case 12: pStr = "left-to-bottom"; break;
330 if( pStr == nullptr )
332 const convert_subtype* p = convert_subtype::getList();
334 while( p->mpStrSubType )
336 if( p->mnID == nPresetSubType )
338 pStr = p->mpStrSubType;
339 break;
341 p++;
347 if( pStr )
348 return OUString::createFromAscii( pStr );
349 else
350 return OUString::number( nPresetSubType );
353 CommonTimeNodeContext::CommonTimeNodeContext(
354 FragmentHandler2 const & rParent,
355 sal_Int32 aElement,
356 const Reference< XFastAttributeList >& xAttribs,
357 const TimeNodePtr & pNode )
358 : TimeNodeContext( rParent, aElement, pNode )
359 , mbIterate( false )
361 AttributeList attribs( xAttribs );
362 sal_Int32 nInt; // some temporary int value for float conversions
364 NodePropertyMap & aProps = pNode->getNodeProperties();
365 TimeNode::UserDataMap & aUserData = pNode->getUserData();
367 if( attribs.hasAttribute( XML_accel ) )
369 double dPercent = ::oox::drawingml::GetPositiveFixedPercentage( xAttribs->getOptionalValue( XML_accel ) );
370 aProps[ NP_ACCELERATION ] <<= dPercent;
373 if( attribs.hasAttribute( XML_afterEffect ) )
375 aUserData[ "after-effect" ]
376 <<= attribs.getBool( XML_afterEffect, false );
378 aProps[ NP_AUTOREVERSE ] <<= attribs.getBool( XML_autoRev, false );
380 // TODO
381 if( attribs.hasAttribute( XML_bldLvl ) )
383 attribs.getInteger( XML_bldLvl, 0 );
385 if( attribs.hasAttribute( XML_decel ) )
387 double dPercent = ::oox::drawingml::GetPositiveFixedPercentage( xAttribs->getOptionalValue( XML_decel ) );
388 aProps[ NP_DECELERATE ] <<= dPercent;
390 // TODO
391 if( attribs.hasAttribute( XML_display ) )
393 aProps[ NP_DISPLAY ] <<= attribs.getBool( XML_display, true );
395 if( attribs.hasAttribute( XML_dur ) )
397 aProps[ NP_DURATION ] = GetTime( xAttribs->getOptionalValue( XML_dur) );
399 // TODO
400 if( attribs.hasAttribute( XML_evtFilter ) )
402 xAttribs->getOptionalValue( XML_evtFilter );
404 // ST_TLTimeNodeFillType
405 if( attribs.hasAttribute( XML_fill ) )
407 nInt = xAttribs->getOptionalValueToken( XML_fill, 0 );
408 if( nInt != 0 )
410 sal_Int16 nEnum;
411 switch( nInt )
413 case XML_remove:
414 nEnum = AnimationFill::REMOVE;
415 break;
416 case XML_freeze:
417 nEnum = AnimationFill::FREEZE;
418 break;
419 case XML_hold:
420 nEnum = AnimationFill::HOLD;
421 break;
422 case XML_transition:
423 nEnum = AnimationFill::TRANSITION;
424 break;
425 default:
426 nEnum = AnimationFill::DEFAULT;
427 break;
429 aProps[ NP_FILL ] <<= nEnum;
432 if( attribs.hasAttribute( XML_grpId ) )
434 attribs.getUnsigned( XML_grpId, 0 );
436 // ST_TLTimeNodeID
437 if( attribs.hasAttribute( XML_id ) )
439 sal_uInt32 nId = attribs.getUnsigned( XML_id, 0 );
440 pNode->setId( nId );
442 // ST_TLTimeNodeMasterRelation
443 nInt = xAttribs->getOptionalValueToken( XML_masterRel, 0 );
444 if( nInt )
446 // TODO
447 switch(nInt)
449 case XML_sameClick:
450 case XML_lastClick:
451 case XML_nextClick:
452 break;
456 // TODO
457 if( attribs.hasAttribute( XML_nodePh ) )
459 attribs.getBool( XML_nodePh, false );
461 // ST_TLTimeNodeType
462 nInt = xAttribs->getOptionalValueToken( XML_nodeType, 0 );
463 if( nInt != 0 )
465 sal_Int16 nEnum;
466 switch( nInt )
468 case XML_clickEffect:
469 case XML_clickPar:
470 nEnum = EffectNodeType::ON_CLICK;
471 break;
472 case XML_withEffect:
473 case XML_withGroup:
474 nEnum = EffectNodeType::WITH_PREVIOUS;
475 break;
476 case XML_mainSeq:
477 nEnum = EffectNodeType::MAIN_SEQUENCE;
478 break;
479 case XML_interactiveSeq:
480 nEnum = EffectNodeType::INTERACTIVE_SEQUENCE;
481 break;
482 case XML_afterGroup:
483 case XML_afterEffect:
484 nEnum = EffectNodeType::AFTER_PREVIOUS;
485 break;
486 case XML_tmRoot:
487 nEnum = EffectNodeType::TIMING_ROOT;
488 break;
489 default:
490 nEnum = EffectNodeType::DEFAULT;
491 break;
493 aUserData[ "node-type" ] <<= nEnum;
496 // ST_TLTimeNodePresetClassType
497 nInt = xAttribs->getOptionalValueToken( XML_presetClass, 0 );
498 if( nInt != 0 )
500 sal_Int16 nEffectPresetClass = 0;
501 // TODO put that in a function
502 switch( nInt )
504 case XML_entr:
505 nEffectPresetClass = EffectPresetClass::ENTRANCE;
506 break;
507 case XML_exit:
508 nEffectPresetClass = EffectPresetClass::EXIT;
509 break;
510 case XML_emph:
511 nEffectPresetClass = EffectPresetClass::EMPHASIS;
512 break;
513 case XML_path:
514 nEffectPresetClass = EffectPresetClass::MOTIONPATH;
515 break;
516 case XML_verb:
517 // TODO check that the value below is correct
518 nEffectPresetClass = EffectPresetClass::OLEACTION;
519 break;
520 case XML_mediacall:
521 nEffectPresetClass = EffectPresetClass::MEDIACALL;
522 break;
523 default:
524 nEffectPresetClass = 0;
525 break;
527 aUserData[ "preset-class" ] <<= nEffectPresetClass;
528 if( attribs.hasAttribute( XML_presetID ) )
530 sal_Int32 nPresetId = attribs.getInteger( XML_presetID, 0 );
531 const preset_mapping* p = preset_mapping::getList();
532 while( p->mpStrPresetId && ((p->mnPresetClass != nEffectPresetClass) || (p->mnPresetId != nPresetId )) )
533 p++;
535 aUserData[ "preset-id" ]
536 <<= OUString::createFromAscii( p->mpStrPresetId );
537 sal_Int32 nPresetSubType = attribs.getInteger( XML_presetSubtype, 0 );
538 if( nPresetSubType )
540 aUserData[ "preset-sub-type" ] <<= getConvertedSubType( nEffectPresetClass, nPresetId, nPresetSubType );
544 if( attribs.hasAttribute( XML_repeatCount ) )
546 aProps[ NP_REPEATCOUNT ] = GetTime( xAttribs->getOptionalValue( XML_repeatCount ) );
548 /* see pptinanimation */
549 // aProps[ NP_REPEATCOUNT ] <<= (fCount < ((float)3.40282346638528860e+38)) ? makeAny( (double)fCount ) : makeAny( Timing_INDEFINITE );
550 if( attribs.hasAttribute( XML_repeatDur ) )
552 aProps[ NP_REPEATDURATION ] = GetTime( xAttribs->getOptionalValue( XML_repeatDur ) );
554 // TODO repeatDur is otherwise the same as dur. What shall we do? -- Hub
556 // ST_TLTimeNodeRestartType
557 nInt = xAttribs->getOptionalValueToken( XML_restart, 0 );
558 if( nInt != 0 )
560 // TODO put that in a function
561 sal_Int16 nEnum;
562 switch( nInt )
564 case XML_always:
565 nEnum = AnimationRestart::ALWAYS;
566 break;
567 case XML_whenNotActive:
568 nEnum = AnimationRestart::WHEN_NOT_ACTIVE;
569 break;
570 case XML_never:
571 nEnum = AnimationRestart::NEVER;
572 break;
573 default:
574 nEnum = AnimationRestart::DEFAULT;
575 break;
577 aProps[ NP_RESTART ] <<= nEnum;
579 // ST_Percentage TODO
580 xAttribs->getOptionalValue( XML_spd /*"10000" */ );
581 // ST_TLTimeNodeSyncType TODO
582 xAttribs->getOptionalValue( XML_syncBehavior );
583 // TODO (string)
584 xAttribs->getOptionalValue( XML_tmFilter );
587 CommonTimeNodeContext::~CommonTimeNodeContext( ) throw ( )
591 void CommonTimeNodeContext::onEndElement()
593 if( isCurrentElement( PPT_TOKEN( iterate ) ) )
595 mbIterate = false;
599 ::oox::core::ContextHandlerRef CommonTimeNodeContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
602 switch ( aElementToken )
604 case PPT_TOKEN( childTnLst ):
605 case PPT_TOKEN( subTnLst ):
606 return new TimeNodeListContext( *this, mpNode->getChildren() );
608 case PPT_TOKEN( stCondLst ):
609 return new CondListContext( *this, aElementToken, mpNode, mpNode->getStartCondition() );
610 case PPT_TOKEN( endCondLst ):
611 return new CondListContext( *this, aElementToken, mpNode, mpNode->getEndCondition() );
613 case PPT_TOKEN( endSync ):
614 return new CondContext( *this, rAttribs.getFastAttributeList(), mpNode, mpNode->getEndSyncValue() );
615 case PPT_TOKEN( iterate ):
617 sal_Int32 nVal = rAttribs.getToken( XML_type, XML_el );
618 if( nVal != 0 )
620 // TODO put that in a function
621 sal_Int16 nEnum;
622 switch( nVal )
624 case XML_el:
625 nEnum = TextAnimationType::BY_PARAGRAPH;
626 break;
627 case XML_lt:
628 nEnum = TextAnimationType::BY_LETTER;
629 break;
630 case XML_wd:
631 nEnum = TextAnimationType::BY_WORD;
632 break;
633 default:
634 // default is BY_WORD. See Ppt97Animation::GetTextAnimationType()
635 // in sd/source/filter/ppt/ppt97animations.cxx:297
636 nEnum = TextAnimationType::BY_WORD;
637 break;
639 mpNode->getNodeProperties()[ NP_ITERATETYPE ] <<= nEnum;
641 // in case of exception we ignore the whole tag.
642 // TODO what to do with this
643 /*bool bBackwards =*/ rAttribs.getBool( XML_backwards, false );
644 mbIterate = true;
645 return this;
647 case PPT_TOKEN( tmAbs ):
648 if( mbIterate )
650 double fTime = rAttribs.getUnsigned( XML_val, 0 ) / 1000.0; // convert ms. to second.
651 mpNode->getNodeProperties()[NP_ITERATEINTERVAL] <<= fTime;
653 return this;
654 case PPT_TOKEN( tmPct ):
655 if( mbIterate )
657 // TODO: should use duration to get iterate interval in second.
658 double fPercent = static_cast<double>(rAttribs.getUnsigned( XML_val, 0 )) / 100000.0;
659 mpNode->getNodeProperties()[ NP_ITERATEINTERVAL ] <<= fPercent;
661 return this;
662 default:
663 break;
666 return this;
671 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */