Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / oox / source / ppt / commontimenodecontext.cxx
blob3733719ac596b8321124f37d04976e8e0704ad31
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 "comphelper/anytostring.hxx"
25 #include "cppuhelper/exc_hlp.hxx"
27 #include <com/sun/star/animations/XTimeContainer.hpp>
28 #include <com/sun/star/animations/XAnimationNode.hpp>
29 #include <com/sun/star/animations/AnimationFill.hpp>
30 #include <com/sun/star/animations/AnimationRestart.hpp>
31 #include <com/sun/star/presentation/TextAnimationType.hpp>
32 #include <com/sun/star/presentation/EffectPresetClass.hpp>
33 #include <com/sun/star/presentation/EffectNodeType.hpp>
35 #include "oox/helper/attributelist.hxx"
36 #include "oox/core/fragmenthandler.hxx"
37 #include "oox/ppt/pptimport.hxx"
38 #include <oox/ppt/pptfilterhelpers.hxx>
39 #include "oox/drawingml/drawingmltypes.hxx"
40 #include <oox/token/namespaces.hxx>
41 #include <oox/token/tokens.hxx>
43 #include "animationtypes.hxx"
45 using namespace ::oox::core;
46 using namespace ::com::sun::star::uno;
47 using namespace ::com::sun::star::animations;
48 using namespace ::com::sun::star::presentation;
49 using namespace ::com::sun::star::xml::sax;
52 namespace oox { namespace ppt {
54 const convert_subtype* convert_subtype::getList()
56 static const convert_subtype aList[] =
58 // fly in
59 { 1, "from-top" },
60 { 2, "from-right" },
61 { 3, "from-top-right" },
62 { 4, "from-bottom" },
63 { 5, "horizontal" },
64 { 6, "from-bottom-right" },
65 { 8, "from-left" },
66 { 9, "from-top-left" },
67 { 10, "vertical" },
68 { 12, "from-bottom-left" },
69 { 16, "in" },
70 { 21, "vertical-in" },
71 { 26, "horizontal-in" },
72 { 32, "out" },
73 { 36, "out-from-screen-center" },
74 { 37, "vertical-out" },
75 { 42, "horizontal-out" },
76 { 272, "in-slightly" },
77 { 288, "out-slightly" },
78 { 528, "in-from-screen-center" },
79 { 0, nullptr }
82 return aList;
85 const preset_maping* preset_maping::getList()
88 static const preset_maping aList[] =
90 { css::presentation::EffectPresetClass::ENTRANCE, 1 ,"ooo-entrance-appear" },
91 { css::presentation::EffectPresetClass::ENTRANCE, 2 ,"ooo-entrance-fly-in" },
92 { css::presentation::EffectPresetClass::ENTRANCE, 3 ,"ooo-entrance-venetian-blinds" },
93 { css::presentation::EffectPresetClass::ENTRANCE, 4 ,"ooo-entrance-box" },
94 { css::presentation::EffectPresetClass::ENTRANCE, 5 ,"ooo-entrance-checkerboard" },
95 { css::presentation::EffectPresetClass::ENTRANCE, 6 ,"ooo-entrance-circle" },
96 { css::presentation::EffectPresetClass::ENTRANCE, 7 ,"ooo-entrance-fly-in-slow" },
97 { css::presentation::EffectPresetClass::ENTRANCE, 8 ,"ooo-entrance-diamond" },
98 { css::presentation::EffectPresetClass::ENTRANCE, 9 ,"ooo-entrance-dissolve-in" },
99 { css::presentation::EffectPresetClass::ENTRANCE, 10 ,"ooo-entrance-fade-in" },
100 { css::presentation::EffectPresetClass::ENTRANCE, 11 ,"ooo-entrance-flash-once" },
101 { css::presentation::EffectPresetClass::ENTRANCE, 12 ,"ooo-entrance-peek-in" },
102 { css::presentation::EffectPresetClass::ENTRANCE, 13 ,"ooo-entrance-plus" },
103 { css::presentation::EffectPresetClass::ENTRANCE, 14 ,"ooo-entrance-random-bars" },
104 { css::presentation::EffectPresetClass::ENTRANCE, 15 ,"ooo-entrance-spiral-in" },
105 { css::presentation::EffectPresetClass::ENTRANCE, 16 ,"ooo-entrance-split" },
106 { css::presentation::EffectPresetClass::ENTRANCE, 17 ,"ooo-entrance-stretchy" },
107 { css::presentation::EffectPresetClass::ENTRANCE, 18 ,"ooo-entrance-diagonal-squares" },
108 { css::presentation::EffectPresetClass::ENTRANCE, 19 ,"ooo-entrance-swivel" },
109 { css::presentation::EffectPresetClass::ENTRANCE, 20 ,"ooo-entrance-wedge" },
110 { css::presentation::EffectPresetClass::ENTRANCE, 21 ,"ooo-entrance-wheel" },
111 { css::presentation::EffectPresetClass::ENTRANCE, 22 ,"ooo-entrance-wipe" },
112 { css::presentation::EffectPresetClass::ENTRANCE, 23 ,"ooo-entrance-zoom" },
113 { css::presentation::EffectPresetClass::ENTRANCE, 24 ,"ooo-entrance-random" },
114 { css::presentation::EffectPresetClass::ENTRANCE, 25 ,"ooo-entrance-boomerang" },
115 { css::presentation::EffectPresetClass::ENTRANCE, 26 ,"ooo-entrance-bounce" },
116 { css::presentation::EffectPresetClass::ENTRANCE, 27 ,"ooo-entrance-colored-lettering" },
117 { css::presentation::EffectPresetClass::ENTRANCE, 28 ,"ooo-entrance-movie-credits" },
118 { css::presentation::EffectPresetClass::ENTRANCE, 29 ,"ooo-entrance-ease-in" },
119 { css::presentation::EffectPresetClass::ENTRANCE, 30 ,"ooo-entrance-float" },
120 { css::presentation::EffectPresetClass::ENTRANCE, 31 ,"ooo-entrance-turn-and-grow" },
121 { css::presentation::EffectPresetClass::ENTRANCE, 34 ,"ooo-entrance-breaks" },
122 { css::presentation::EffectPresetClass::ENTRANCE, 35 ,"ooo-entrance-pinwheel" },
123 { css::presentation::EffectPresetClass::ENTRANCE, 37 ,"ooo-entrance-rise-up" },
124 { css::presentation::EffectPresetClass::ENTRANCE, 38 ,"ooo-entrance-falling-in" },
125 { css::presentation::EffectPresetClass::ENTRANCE, 39 ,"ooo-entrance-thread" },
126 { css::presentation::EffectPresetClass::ENTRANCE, 40 ,"ooo-entrance-unfold" },
127 { css::presentation::EffectPresetClass::ENTRANCE, 41 ,"ooo-entrance-whip" },
128 { css::presentation::EffectPresetClass::ENTRANCE, 42 ,"ooo-entrance-ascend" },
129 { css::presentation::EffectPresetClass::ENTRANCE, 43 ,"ooo-entrance-center-revolve" },
130 { css::presentation::EffectPresetClass::ENTRANCE, 45 ,"ooo-entrance-fade-in-and-swivel" },
131 { css::presentation::EffectPresetClass::ENTRANCE, 47 ,"ooo-entrance-descend" },
132 { css::presentation::EffectPresetClass::ENTRANCE, 48 ,"ooo-entrance-sling" },
133 { css::presentation::EffectPresetClass::ENTRANCE, 49 ,"ooo-entrance-spin-in" },
134 { css::presentation::EffectPresetClass::ENTRANCE, 50 ,"ooo-entrance-compress" },
135 { css::presentation::EffectPresetClass::ENTRANCE, 51 ,"ooo-entrance-magnify" },
136 { css::presentation::EffectPresetClass::ENTRANCE, 52 ,"ooo-entrance-curve-up" },
137 { css::presentation::EffectPresetClass::ENTRANCE, 53 ,"ooo-entrance-fade-in-and-zoom" },
138 { css::presentation::EffectPresetClass::ENTRANCE, 54 ,"ooo-entrance-glide" },
139 { css::presentation::EffectPresetClass::ENTRANCE, 55 ,"ooo-entrance-expand" },
140 { css::presentation::EffectPresetClass::ENTRANCE, 56 ,"ooo-entrance-flip" },
141 { css::presentation::EffectPresetClass::ENTRANCE, 58 ,"ooo-entrance-fold" },
142 { css::presentation::EffectPresetClass::EMPHASIS, 1 ,"ooo-emphasis-fill-color" },
143 { css::presentation::EffectPresetClass::EMPHASIS, 2 ,"ooo-emphasis-font" },
144 { css::presentation::EffectPresetClass::EMPHASIS, 3 ,"ooo-emphasis-font-color" },
145 { css::presentation::EffectPresetClass::EMPHASIS, 4 ,"ooo-emphasis-font-size" },
146 { css::presentation::EffectPresetClass::EMPHASIS, 5 ,"ooo-emphasis-font-style" },
147 { css::presentation::EffectPresetClass::EMPHASIS, 6 ,"ooo-emphasis-grow-and-shrink" },
148 { css::presentation::EffectPresetClass::EMPHASIS, 7 ,"ooo-emphasis-line-color" },
149 { css::presentation::EffectPresetClass::EMPHASIS, 8 ,"ooo-emphasis-spin" },
150 { css::presentation::EffectPresetClass::EMPHASIS, 9 ,"ooo-emphasis-transparency" },
151 { css::presentation::EffectPresetClass::EMPHASIS, 10 ,"ooo-emphasis-bold-flash" },
152 { css::presentation::EffectPresetClass::EMPHASIS, 14 ,"ooo-emphasis-blast" },
153 { css::presentation::EffectPresetClass::EMPHASIS, 15 ,"ooo-emphasis-bold-reveal" },
154 { css::presentation::EffectPresetClass::EMPHASIS, 16 ,"ooo-emphasis-color-over-by-word" },
155 { css::presentation::EffectPresetClass::EMPHASIS, 18 ,"ooo-emphasis-reveal-underline" },
156 { css::presentation::EffectPresetClass::EMPHASIS, 19 ,"ooo-emphasis-color-blend" },
157 { css::presentation::EffectPresetClass::EMPHASIS, 20 ,"ooo-emphasis-color-over-by-letter" },
158 { css::presentation::EffectPresetClass::EMPHASIS, 21 ,"ooo-emphasis-complementary-color" },
159 { css::presentation::EffectPresetClass::EMPHASIS, 22 ,"ooo-emphasis-complementary-color-2" },
160 { css::presentation::EffectPresetClass::EMPHASIS, 23 ,"ooo-emphasis-contrasting-color" },
161 { css::presentation::EffectPresetClass::EMPHASIS, 24 ,"ooo-emphasis-darken" },
162 { css::presentation::EffectPresetClass::EMPHASIS, 25 ,"ooo-emphasis-desaturate" },
163 { css::presentation::EffectPresetClass::EMPHASIS, 26 ,"ooo-emphasis-flash-bulb" },
164 { css::presentation::EffectPresetClass::EMPHASIS, 27 ,"ooo-emphasis-flicker" },
165 { css::presentation::EffectPresetClass::EMPHASIS, 28 ,"ooo-emphasis-grow-with-color" },
166 { css::presentation::EffectPresetClass::EMPHASIS, 30 ,"ooo-emphasis-lighten" },
167 { css::presentation::EffectPresetClass::EMPHASIS, 31 ,"ooo-emphasis-style-emphasis" },
168 { css::presentation::EffectPresetClass::EMPHASIS, 32 ,"ooo-emphasis-teeter" },
169 { css::presentation::EffectPresetClass::EMPHASIS, 33 ,"ooo-emphasis-vertical-highlight" },
170 { css::presentation::EffectPresetClass::EMPHASIS, 34 ,"ooo-emphasis-wave" },
171 { css::presentation::EffectPresetClass::EMPHASIS, 35 ,"ooo-emphasis-blink" },
172 { css::presentation::EffectPresetClass::EMPHASIS, 36 ,"ooo-emphasis-shimmer" },
173 { css::presentation::EffectPresetClass::EXIT, 1 ,"ooo-exit-disappear" },
174 { css::presentation::EffectPresetClass::EXIT, 2 ,"ooo-exit-fly-out" },
175 { css::presentation::EffectPresetClass::EXIT, 3 ,"ooo-exit-venetian-blinds" },
176 { css::presentation::EffectPresetClass::EXIT, 4 ,"ooo-exit-box" },
177 { css::presentation::EffectPresetClass::EXIT, 5 ,"ooo-exit-checkerboard" },
178 { css::presentation::EffectPresetClass::EXIT, 6 ,"ooo-exit-circle" },
179 { css::presentation::EffectPresetClass::EXIT, 7 ,"ooo-exit-crawl-out" },
180 { css::presentation::EffectPresetClass::EXIT, 8 ,"ooo-exit-diamond" },
181 { css::presentation::EffectPresetClass::EXIT, 9 ,"ooo-exit-dissolve" },
182 { css::presentation::EffectPresetClass::EXIT, 10 ,"ooo-exit-fade-out" },
183 { css::presentation::EffectPresetClass::EXIT, 11 ,"ooo-exit-flash-once" },
184 { css::presentation::EffectPresetClass::EXIT, 12 ,"ooo-exit-peek-out" },
185 { css::presentation::EffectPresetClass::EXIT, 13 ,"ooo-exit-plus" },
186 { css::presentation::EffectPresetClass::EXIT, 14 ,"ooo-exit-random-bars" },
187 { css::presentation::EffectPresetClass::EXIT, 15 ,"ooo-exit-spiral-out" },
188 { css::presentation::EffectPresetClass::EXIT, 16 ,"ooo-exit-split" },
189 { css::presentation::EffectPresetClass::EXIT, 17 ,"ooo-exit-collapse" },
190 { css::presentation::EffectPresetClass::EXIT, 18 ,"ooo-exit-diagonal-squares" },
191 { css::presentation::EffectPresetClass::EXIT, 19 ,"ooo-exit-swivel" },
192 { css::presentation::EffectPresetClass::EXIT, 20 ,"ooo-exit-wedge" },
193 { css::presentation::EffectPresetClass::EXIT, 21 ,"ooo-exit-wheel" },
194 { css::presentation::EffectPresetClass::EXIT, 22 ,"ooo-exit-wipe" },
195 { css::presentation::EffectPresetClass::EXIT, 23 ,"ooo-exit-zoom" },
196 { css::presentation::EffectPresetClass::EXIT, 24 ,"ooo-exit-random" },
197 { css::presentation::EffectPresetClass::EXIT, 25 ,"ooo-exit-boomerang" },
198 { css::presentation::EffectPresetClass::EXIT, 26 ,"ooo-exit-bounce" },
199 { css::presentation::EffectPresetClass::EXIT, 27 ,"ooo-exit-colored-lettering" },
200 { css::presentation::EffectPresetClass::EXIT, 28 ,"ooo-exit-movie-credits" },
201 { css::presentation::EffectPresetClass::EXIT, 29 ,"ooo-exit-ease-out" },
202 { css::presentation::EffectPresetClass::EXIT, 30 ,"ooo-exit-float" },
203 { css::presentation::EffectPresetClass::EXIT, 31 ,"ooo-exit-turn-and-grow" },
204 { css::presentation::EffectPresetClass::EXIT, 34 ,"ooo-exit-breaks" },
205 { css::presentation::EffectPresetClass::EXIT, 35 ,"ooo-exit-pinwheel" },
206 { css::presentation::EffectPresetClass::EXIT, 37 ,"ooo-exit-sink-down" },
207 { css::presentation::EffectPresetClass::EXIT, 38 ,"ooo-exit-swish" },
208 { css::presentation::EffectPresetClass::EXIT, 39 ,"ooo-exit-thread" },
209 { css::presentation::EffectPresetClass::EXIT, 40 ,"ooo-exit-unfold" },
210 { css::presentation::EffectPresetClass::EXIT, 41 ,"ooo-exit-whip" },
211 { css::presentation::EffectPresetClass::EXIT, 42 ,"ooo-exit-descend" },
212 { css::presentation::EffectPresetClass::EXIT, 43 ,"ooo-exit-center-revolve" },
213 { css::presentation::EffectPresetClass::EXIT, 45 ,"ooo-exit-fade-out-and-swivel" },
214 { css::presentation::EffectPresetClass::EXIT, 47 ,"ooo-exit-ascend" },
215 { css::presentation::EffectPresetClass::EXIT, 48 ,"ooo-exit-sling" },
216 { css::presentation::EffectPresetClass::EXIT, 53 ,"ooo-exit-fade-out-and-zoom" },
217 { css::presentation::EffectPresetClass::EXIT, 55 ,"ooo-exit-contract" },
218 { css::presentation::EffectPresetClass::EXIT, 49 ,"ooo-exit-spin-out" },
219 { css::presentation::EffectPresetClass::EXIT, 50 ,"ooo-exit-stretchy" },
220 { css::presentation::EffectPresetClass::EXIT, 51 ,"ooo-exit-magnify" },
221 { css::presentation::EffectPresetClass::EXIT, 52 ,"ooo-exit-curve-down" },
222 { css::presentation::EffectPresetClass::EXIT, 54 ,"ooo-exit-glide" },
223 { css::presentation::EffectPresetClass::EXIT, 56 ,"ooo-exit-flip" },
224 { css::presentation::EffectPresetClass::EXIT, 58 ,"ooo-exit-fold" },
226 { css::presentation::EffectPresetClass::MOTIONPATH, 16 ,"ooo-motionpath-4-point-star" },
227 { css::presentation::EffectPresetClass::MOTIONPATH, 5 ,"ooo-motionpath-5-point-star" },
228 { css::presentation::EffectPresetClass::MOTIONPATH, 11 ,"ooo-motionpath-6-point-star" },
229 { css::presentation::EffectPresetClass::MOTIONPATH, 17 ,"ooo-motionpath-8-point-star" },
230 { css::presentation::EffectPresetClass::MOTIONPATH, 1 ,"ooo-motionpath-circle" },
231 { css::presentation::EffectPresetClass::MOTIONPATH, 6 ,"ooo-motionpath-crescent-moon" },
232 { css::presentation::EffectPresetClass::MOTIONPATH, 3 ,"ooo-motionpath-diamond" },
233 { css::presentation::EffectPresetClass::MOTIONPATH, 13 ,"ooo-motionpath-equal-triangle" },
234 { css::presentation::EffectPresetClass::MOTIONPATH, 12 ,"ooo-motionpath-oval" },
235 { css::presentation::EffectPresetClass::MOTIONPATH, 9 ,"ooo-motionpath-heart" },
236 { css::presentation::EffectPresetClass::MOTIONPATH, 4 ,"ooo-motionpath-hexagon" },
237 { css::presentation::EffectPresetClass::MOTIONPATH, 10 ,"ooo-motionpath-octagon" },
238 { css::presentation::EffectPresetClass::MOTIONPATH, 14 ,"ooo-motionpath-parallelogram" },
239 { css::presentation::EffectPresetClass::MOTIONPATH, 15 ,"ooo-motionpath-pentagon" },
240 { css::presentation::EffectPresetClass::MOTIONPATH, 2 ,"ooo-motionpath-right-triangle" },
241 { css::presentation::EffectPresetClass::MOTIONPATH, 7 ,"ooo-motionpath-square" },
242 { css::presentation::EffectPresetClass::MOTIONPATH, 18 ,"ooo-motionpath-teardrop" },
243 { css::presentation::EffectPresetClass::MOTIONPATH, 8 ,"ooo-motionpath-trapezoid" },
244 { css::presentation::EffectPresetClass::MOTIONPATH, 37 ,"ooo-motionpath-arc-down" },
245 { css::presentation::EffectPresetClass::MOTIONPATH, 51 ,"ooo-motionpath-arc-left" },
246 { css::presentation::EffectPresetClass::MOTIONPATH, 58 ,"ooo-motionpath-arc-right" },
247 { css::presentation::EffectPresetClass::MOTIONPATH, 44 ,"ooo-motionpath-arc-up" },
248 { css::presentation::EffectPresetClass::MOTIONPATH, 41 ,"ooo-motionpath-bounce-left" },
249 { css::presentation::EffectPresetClass::MOTIONPATH, 54 ,"ooo-motionpath-bounce-right" },
250 { css::presentation::EffectPresetClass::MOTIONPATH, 48 ,"ooo-motionpath-curvy-left" },
251 { css::presentation::EffectPresetClass::MOTIONPATH, 61 ,"ooo-motionpath-curvy-right" },
252 { css::presentation::EffectPresetClass::MOTIONPATH, 60 ,"ooo-motionpath-decaying-wave" },
253 { css::presentation::EffectPresetClass::MOTIONPATH, 49 ,"ooo-motionpath-diagonal-down-right" },
254 { css::presentation::EffectPresetClass::MOTIONPATH, 56 ,"ooo-motionpath-diagonal-up-right" },
255 { css::presentation::EffectPresetClass::MOTIONPATH, 42 ,"ooo-motionpath-down" },
256 { css::presentation::EffectPresetClass::MOTIONPATH, 52 ,"ooo-motionpath-funnel" },
257 { css::presentation::EffectPresetClass::MOTIONPATH, 53 ,"ooo-motionpath-spring" },
258 { css::presentation::EffectPresetClass::MOTIONPATH, 62 ,"ooo-motionpath-stairs-down" },
259 { css::presentation::EffectPresetClass::MOTIONPATH, 50 ,"ooo-motionpath-turn-down" },
260 { css::presentation::EffectPresetClass::MOTIONPATH, 36 ,"ooo-motionpath-turn-down-right" },
261 { css::presentation::EffectPresetClass::MOTIONPATH, 43 ,"ooo-motionpath-turn-up" },
262 { css::presentation::EffectPresetClass::MOTIONPATH, 57 ,"ooo-motionpath-turn-up-right" },
263 { css::presentation::EffectPresetClass::MOTIONPATH, 64 ,"ooo-motionpath-up" },
264 { css::presentation::EffectPresetClass::MOTIONPATH, 47 ,"ooo-motionpath-wave" },
265 { css::presentation::EffectPresetClass::MOTIONPATH, 38 ,"ooo-motionpath-zigzag" },
266 { css::presentation::EffectPresetClass::MOTIONPATH, 31 ,"ooo-motionpath-bean" },
267 { css::presentation::EffectPresetClass::MOTIONPATH, 25 ,"ooo-motionpath-buzz-saw" },
268 { css::presentation::EffectPresetClass::MOTIONPATH, 20 ,"ooo-motionpath-curved-square" },
269 { css::presentation::EffectPresetClass::MOTIONPATH, 21 ,"ooo-motionpath-curved-x" },
270 { css::presentation::EffectPresetClass::MOTIONPATH, 23 ,"ooo-motionpath-curvy-star" },
271 { css::presentation::EffectPresetClass::MOTIONPATH, 28 ,"ooo-motionpath-figure-8-four" },
272 { css::presentation::EffectPresetClass::MOTIONPATH, 26 ,"ooo-motionpath-horizontal-figure-8" },
273 { css::presentation::EffectPresetClass::MOTIONPATH, 34 ,"ooo-motionpath-inverted-square" },
274 { css::presentation::EffectPresetClass::MOTIONPATH, 33 ,"ooo-motionpath-inverted-triangle" },
275 { css::presentation::EffectPresetClass::MOTIONPATH, 24 ,"ooo-motionpath-loop-de-loop" },
276 { css::presentation::EffectPresetClass::MOTIONPATH, 29 ,"ooo-motionpath-neutron" },
277 { css::presentation::EffectPresetClass::MOTIONPATH, 27 ,"ooo-motionpath-peanut" },
278 { css::presentation::EffectPresetClass::MOTIONPATH, 32 ,"ooo-motionpath-clover" },
279 { css::presentation::EffectPresetClass::MOTIONPATH, 19 ,"ooo-motionpath-pointy-star" },
280 { css::presentation::EffectPresetClass::MOTIONPATH, 30 ,"ooo-motionpath-swoosh" },
281 { css::presentation::EffectPresetClass::MOTIONPATH, 22 ,"ooo-motionpath-vertical-figure-8" },
282 { css::presentation::EffectPresetClass::MOTIONPATH, 35 ,"ooo-motionpath-left" },
283 { css::presentation::EffectPresetClass::MOTIONPATH, 63 ,"ooo-motionpath-right" },
284 { css::presentation::EffectPresetClass::MOTIONPATH, 55 ,"ooo-motionpath-spiral-left" },
285 { css::presentation::EffectPresetClass::MOTIONPATH, 46 ,"ooo-motionpath-spiral-right" },
286 { css::presentation::EffectPresetClass::MOTIONPATH, 40 ,"ooo-motionpath-sine-wave" },
287 { css::presentation::EffectPresetClass::MOTIONPATH, 59 ,"ooo-motionpath-s-curve-1" },
288 { css::presentation::EffectPresetClass::MOTIONPATH, 39 ,"ooo-motionpath-s-curve-2" },
289 { css::presentation::EffectPresetClass::MOTIONPATH, 45 ,"ooo-motionpath-heartbeat" },
291 { 0,0,nullptr }
294 return aList;
297 OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId, sal_Int32 nPresetSubType )
299 const sal_Char* pStr = nullptr;
301 if( (nPresetClass == EffectPresetClass::ENTRANCE) || (nPresetClass == EffectPresetClass::EXIT) )
303 // skip wheel effect
304 if( nPresetId != 21 )
306 if( nPresetId == 5 )
308 // checkerboard
309 switch( nPresetSubType )
311 case 5: pStr = "downward"; break;
312 case 10: pStr = "across"; break;
315 else if( nPresetId == 17 )
317 // stretch
318 if( nPresetSubType == 10 )
319 pStr = "across";
321 else if( nPresetId == 18 )
323 // strips
324 switch( nPresetSubType )
326 case 3: pStr = "right-to-top"; break;
327 case 6: pStr = "right-to-bottom"; break;
328 case 9: pStr = "left-to-top"; break;
329 case 12: pStr = "left-to-bottom"; break;
333 if( pStr == nullptr )
335 const convert_subtype* p = convert_subtype::getList();
337 while( p->mpStrSubType )
339 if( p->mnID == nPresetSubType )
341 pStr = p->mpStrSubType;
342 break;
344 p++;
350 if( pStr )
351 return OUString::createFromAscii( pStr );
352 else
353 return OUString::number( nPresetSubType );
356 CommonTimeNodeContext::CommonTimeNodeContext(
357 FragmentHandler2& rParent,
358 sal_Int32 aElement,
359 const Reference< XFastAttributeList >& xAttribs,
360 const TimeNodePtr & pNode )
361 : TimeNodeContext( rParent, aElement, xAttribs, pNode )
362 , mbIterate( false )
364 AttributeList attribs( xAttribs );
365 sal_Int32 nInt; // some temporary int value for float conversions
367 NodePropertyMap & aProps = pNode->getNodeProperties();
368 TimeNode::UserDataMap & aUserData = pNode->getUserData();
370 if( attribs.hasAttribute( XML_accel ) )
372 double dPercent = ::oox::drawingml::GetPositiveFixedPercentage( xAttribs->getOptionalValue( XML_accel ) );
373 aProps[ NP_ACCELERATION ] <<= dPercent;
376 if( attribs.hasAttribute( XML_afterEffect ) )
378 aUserData[ "after-effect" ]
379 <<= attribs.getBool( XML_afterEffect, false );
381 aProps[ NP_AUTOREVERSE ] <<= attribs.getBool( XML_autoRev, false );
383 // TODO
384 if( attribs.hasAttribute( XML_bldLvl ) )
386 attribs.getInteger( XML_bldLvl, 0 );
388 if( attribs.hasAttribute( XML_decel ) )
390 double dPercent = ::oox::drawingml::GetPositiveFixedPercentage( xAttribs->getOptionalValue( XML_decel ) );
391 aProps[ NP_DECELERATE ] <<= dPercent;
393 // TODO
394 if( attribs.hasAttribute( XML_display ) )
396 aProps[ NP_DISPLAY ] <<= attribs.getBool( XML_display, true );
398 if( attribs.hasAttribute( XML_dur ) )
400 aProps[ NP_DURATION ] = GetTime( xAttribs->getOptionalValue( XML_dur) );
402 // TODO
403 if( attribs.hasAttribute( XML_evtFilter ) )
405 xAttribs->getOptionalValue( XML_evtFilter );
407 // ST_TLTimeNodeFillType
408 if( attribs.hasAttribute( XML_fill ) )
410 nInt = xAttribs->getOptionalValueToken( XML_fill, 0 );
411 if( nInt != 0 )
413 sal_Int16 nEnum;
414 switch( nInt )
416 case XML_remove:
417 nEnum = AnimationFill::REMOVE;
418 break;
419 case XML_freeze:
420 nEnum = AnimationFill::FREEZE;
421 break;
422 case XML_hold:
423 nEnum = AnimationFill::HOLD;
424 break;
425 case XML_transition:
426 nEnum = AnimationFill::TRANSITION;
427 break;
428 default:
429 nEnum = AnimationFill::DEFAULT;
430 break;
432 aProps[ NP_FILL ] <<= nEnum;
435 if( attribs.hasAttribute( XML_grpId ) )
437 attribs.getUnsigned( XML_grpId, 0 );
439 // ST_TLTimeNodeID
440 if( attribs.hasAttribute( XML_id ) )
442 sal_uInt32 nId = attribs.getUnsigned( XML_id, 0 );
443 pNode->setId( nId );
445 // ST_TLTimeNodeMasterRelation
446 nInt = xAttribs->getOptionalValueToken( XML_masterRel, 0 );
447 if( nInt )
449 // TODO
450 switch(nInt)
452 case XML_sameClick:
453 case XML_lastClick:
454 case XML_nextClick:
455 break;
459 // TODO
460 if( attribs.hasAttribute( XML_nodePh ) )
462 attribs.getBool( XML_nodePh, false );
464 // ST_TLTimeNodeType
465 nInt = xAttribs->getOptionalValueToken( XML_nodeType, 0 );
466 if( nInt != 0 )
468 sal_Int16 nEnum;
469 switch( nInt )
471 case XML_clickEffect:
472 case XML_clickPar:
473 nEnum = EffectNodeType::ON_CLICK;
474 break;
475 case XML_withEffect:
476 case XML_withGroup:
477 nEnum = EffectNodeType::WITH_PREVIOUS;
478 break;
479 case XML_mainSeq:
480 nEnum = EffectNodeType::MAIN_SEQUENCE;
481 break;
482 case XML_interactiveSeq:
483 nEnum = EffectNodeType::INTERACTIVE_SEQUENCE;
484 break;
485 case XML_afterGroup:
486 case XML_afterEffect:
487 nEnum = EffectNodeType::AFTER_PREVIOUS;
488 break;
489 case XML_tmRoot:
490 nEnum = EffectNodeType::TIMING_ROOT;
491 break;
492 default:
493 nEnum = EffectNodeType::DEFAULT;
494 break;
496 aUserData[ "node-type" ] <<= nEnum;
499 // ST_TLTimeNodePresetClassType
500 nInt = xAttribs->getOptionalValueToken( XML_presetClass, 0 );
501 if( nInt != 0 )
503 sal_Int16 nEffectPresetClass = 0;
504 // TODO put that in a function
505 switch( nInt )
507 case XML_entr:
508 nEffectPresetClass = EffectPresetClass::ENTRANCE;
509 break;
510 case XML_exit:
511 nEffectPresetClass = EffectPresetClass::EXIT;
512 break;
513 case XML_emph:
514 nEffectPresetClass = EffectPresetClass::EMPHASIS;
515 break;
516 case XML_path:
517 nEffectPresetClass = EffectPresetClass::MOTIONPATH;
518 break;
519 case XML_verb:
520 // TODO check that the value below is correct
521 nEffectPresetClass = EffectPresetClass::OLEACTION;
522 break;
523 case XML_mediacall:
524 nEffectPresetClass = EffectPresetClass::MEDIACALL;
525 break;
526 default:
527 nEffectPresetClass = 0;
528 break;
530 aUserData[ "preset-class" ] <<= nEffectPresetClass;
531 if( attribs.hasAttribute( XML_presetID ) )
533 sal_Int32 nPresetId = attribs.getInteger( XML_presetID, 0 );
534 const preset_maping* p = preset_maping::getList();
535 while( p->mpStrPresetId && ((p->mnPresetClass != nEffectPresetClass) || (p->mnPresetId != nPresetId )) )
536 p++;
538 aUserData[ "preset-id" ]
539 <<= OUString::createFromAscii( p->mpStrPresetId );
540 sal_Int32 nPresetSubType = attribs.getInteger( XML_presetSubtype, 0 );
541 if( nPresetSubType )
543 aUserData[ "preset-sub-type" ] <<= getConvertedSubType( nEffectPresetClass, nPresetId, nPresetSubType );
547 if( attribs.hasAttribute( XML_repeatCount ) )
549 aProps[ NP_REPEATCOUNT ] = GetTime( xAttribs->getOptionalValue( XML_repeatCount ) );
551 /* see pptinanimation */
552 // aProps[ NP_REPEATCOUNT ] <<= (fCount < ((float)3.40282346638528860e+38)) ? makeAny( (double)fCount ) : makeAny( Timing_INDEFINITE );
553 if( attribs.hasAttribute( XML_repeatDur ) )
555 aProps[ NP_REPEATDURATION ] = GetTime( xAttribs->getOptionalValue( XML_repeatDur ) );
557 // TODO repeatDur is otherwise the same as dur. What shall we do? -- Hub
559 // ST_TLTimeNodeRestartType
560 nInt = xAttribs->getOptionalValueToken( XML_restart, 0 );
561 if( nInt != 0 )
563 // TODO put that in a function
564 sal_Int16 nEnum;
565 switch( nInt )
567 case XML_always:
568 nEnum = AnimationRestart::ALWAYS;
569 break;
570 case XML_whenNotActive:
571 nEnum = AnimationRestart::WHEN_NOT_ACTIVE;
572 break;
573 case XML_never:
574 nEnum = AnimationRestart::NEVER;
575 break;
576 default:
577 nEnum = AnimationRestart::DEFAULT;
578 break;
580 aProps[ NP_RESTART ] <<= nEnum;
582 // ST_Percentage TODO
583 xAttribs->getOptionalValue( XML_spd /*"10000" */ );
584 // ST_TLTimeNodeSyncType TODO
585 xAttribs->getOptionalValue( XML_syncBehavior );
586 // TODO (string)
587 xAttribs->getOptionalValue( XML_tmFilter );
590 CommonTimeNodeContext::~CommonTimeNodeContext( ) throw ( )
594 void CommonTimeNodeContext::onEndElement()
596 if( isCurrentElement( PPT_TOKEN( iterate ) ) )
598 mbIterate = false;
602 ::oox::core::ContextHandlerRef CommonTimeNodeContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
605 switch ( aElementToken )
607 case PPT_TOKEN( childTnLst ):
608 case PPT_TOKEN( subTnLst ):
609 return new TimeNodeListContext( *this, mpNode->getChildren() );
611 case PPT_TOKEN( stCondLst ):
612 return new CondListContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode, mpNode->getStartCondition() );
613 case PPT_TOKEN( endCondLst ):
614 return new CondListContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode, mpNode->getEndCondition() );
616 case PPT_TOKEN( endSync ):
617 return new CondContext( *this, rAttribs.getFastAttributeList(), mpNode, mpNode->getEndSyncValue() );
618 case PPT_TOKEN( iterate ):
620 sal_Int32 nVal = rAttribs.getToken( XML_type, XML_el );
621 if( nVal != 0 )
623 // TODO put that in a function
624 sal_Int16 nEnum;
625 switch( nVal )
627 case XML_el:
628 nEnum = TextAnimationType::BY_PARAGRAPH;
629 break;
630 case XML_lt:
631 nEnum = TextAnimationType::BY_LETTER;
632 break;
633 case XML_wd:
634 nEnum = TextAnimationType::BY_WORD;
635 break;
636 default:
637 // default is BY_WORD. See Ppt97Animation::GetTextAnimationType()
638 // in sd/source/filter/ppt/ppt97animations.cxx:297
639 nEnum = TextAnimationType::BY_WORD;
640 break;
642 mpNode->getNodeProperties()[ NP_ITERATETYPE ] <<= nEnum;
644 // in case of exception we ignore the whole tag.
645 // TODO what to do with this
646 /*bool bBackwards =*/ rAttribs.getBool( XML_backwards, false );
647 mbIterate = true;
648 return this;
650 case PPT_TOKEN( tmAbs ):
651 if( mbIterate )
653 double fTime = rAttribs.getUnsigned( XML_val, 0 );
654 // time in ms. property is in % TODO
655 mpNode->getNodeProperties()[ NP_ITERATEINTERVAL ] <<= fTime;
657 return this;
658 case PPT_TOKEN( tmPct ):
659 if( mbIterate )
661 double fPercent = (double)rAttribs.getUnsigned( XML_val, 0 ) / 100000.0;
662 mpNode->getNodeProperties()[ NP_ITERATEINTERVAL ] <<= fPercent;
664 return this;
665 default:
666 break;
669 return this;
674 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */