1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
21 #include "conditioncontext.hxx"
23 #include <com/sun/star/animations/AnimationFill.hpp>
24 #include <com/sun/star/animations/AnimationRestart.hpp>
25 #include <com/sun/star/presentation/TextAnimationType.hpp>
26 #include <com/sun/star/presentation/EffectPresetClass.hpp>
27 #include <com/sun/star/presentation/EffectNodeType.hpp>
29 #include <oox/helper/attributelist.hxx>
30 #include <oox/ppt/pptfilterhelpers.hxx>
31 #include <oox/drawingml/drawingmltypes.hxx>
32 #include <oox/token/namespaces.hxx>
33 #include <oox/token/tokens.hxx>
35 #include "animationtypes.hxx"
37 using namespace ::oox::core
;
38 using namespace ::com::sun::star::uno
;
39 using namespace ::com::sun::star::animations
;
40 using namespace ::com::sun::star::presentation
;
41 using namespace ::com::sun::star::xml::sax
;
46 const convert_subtype
* convert_subtype::getList()
48 static const convert_subtype aList
[] =
53 { 3, "from-top-right" },
56 { 6, "from-bottom-right" },
58 { 9, "from-top-left" },
60 { 12, "from-bottom-left" },
62 { 21, "vertical-in" },
63 { 26, "horizontal-in" },
65 { 36, "out-from-screen-center" },
66 { 37, "vertical-out" },
67 { 42, "horizontal-out" },
68 { 272, "in-slightly" },
69 { 288, "out-slightly" },
70 { 528, "in-from-screen-center" },
77 const preset_mapping
* preset_mapping::getList()
80 static const preset_mapping aList
[] =
82 { css::presentation::EffectPresetClass::ENTRANCE
, 1 ,"ooo-entrance-appear" },
83 { css::presentation::EffectPresetClass::ENTRANCE
, 2 ,"ooo-entrance-fly-in" },
84 { css::presentation::EffectPresetClass::ENTRANCE
, 3 ,"ooo-entrance-venetian-blinds" },
85 { css::presentation::EffectPresetClass::ENTRANCE
, 4 ,"ooo-entrance-box" },
86 { css::presentation::EffectPresetClass::ENTRANCE
, 5 ,"ooo-entrance-checkerboard" },
87 { css::presentation::EffectPresetClass::ENTRANCE
, 6 ,"ooo-entrance-circle" },
88 { css::presentation::EffectPresetClass::ENTRANCE
, 7 ,"ooo-entrance-fly-in-slow" },
89 { css::presentation::EffectPresetClass::ENTRANCE
, 8 ,"ooo-entrance-diamond" },
90 { css::presentation::EffectPresetClass::ENTRANCE
, 9 ,"ooo-entrance-dissolve-in" },
91 { css::presentation::EffectPresetClass::ENTRANCE
, 10 ,"ooo-entrance-fade-in" },
92 { css::presentation::EffectPresetClass::ENTRANCE
, 11 ,"ooo-entrance-flash-once" },
93 { css::presentation::EffectPresetClass::ENTRANCE
, 12 ,"ooo-entrance-peek-in" },
94 { css::presentation::EffectPresetClass::ENTRANCE
, 13 ,"ooo-entrance-plus" },
95 { css::presentation::EffectPresetClass::ENTRANCE
, 14 ,"ooo-entrance-random-bars" },
96 { css::presentation::EffectPresetClass::ENTRANCE
, 15 ,"ooo-entrance-spiral-in" },
97 { css::presentation::EffectPresetClass::ENTRANCE
, 16 ,"ooo-entrance-split" },
98 { css::presentation::EffectPresetClass::ENTRANCE
, 17 ,"ooo-entrance-stretchy" },
99 { css::presentation::EffectPresetClass::ENTRANCE
, 18 ,"ooo-entrance-diagonal-squares" },
100 { css::presentation::EffectPresetClass::ENTRANCE
, 19 ,"ooo-entrance-swivel" },
101 { css::presentation::EffectPresetClass::ENTRANCE
, 20 ,"ooo-entrance-wedge" },
102 { css::presentation::EffectPresetClass::ENTRANCE
, 21 ,"ooo-entrance-wheel" },
103 { css::presentation::EffectPresetClass::ENTRANCE
, 22 ,"ooo-entrance-wipe" },
104 { css::presentation::EffectPresetClass::ENTRANCE
, 23 ,"ooo-entrance-zoom" },
105 { css::presentation::EffectPresetClass::ENTRANCE
, 24 ,"ooo-entrance-random" },
106 { css::presentation::EffectPresetClass::ENTRANCE
, 25 ,"ooo-entrance-boomerang" },
107 { css::presentation::EffectPresetClass::ENTRANCE
, 26 ,"ooo-entrance-bounce" },
108 { css::presentation::EffectPresetClass::ENTRANCE
, 27 ,"ooo-entrance-colored-lettering" },
109 { css::presentation::EffectPresetClass::ENTRANCE
, 28 ,"ooo-entrance-movie-credits" },
110 { css::presentation::EffectPresetClass::ENTRANCE
, 29 ,"ooo-entrance-ease-in" },
111 { css::presentation::EffectPresetClass::ENTRANCE
, 30 ,"ooo-entrance-float" },
112 { css::presentation::EffectPresetClass::ENTRANCE
, 31 ,"ooo-entrance-turn-and-grow" },
113 { css::presentation::EffectPresetClass::ENTRANCE
, 34 ,"ooo-entrance-breaks" },
114 { css::presentation::EffectPresetClass::ENTRANCE
, 35 ,"ooo-entrance-pinwheel" },
115 { css::presentation::EffectPresetClass::ENTRANCE
, 37 ,"ooo-entrance-rise-up" },
116 { css::presentation::EffectPresetClass::ENTRANCE
, 38 ,"ooo-entrance-falling-in" },
117 { css::presentation::EffectPresetClass::ENTRANCE
, 39 ,"ooo-entrance-thread" },
118 { css::presentation::EffectPresetClass::ENTRANCE
, 40 ,"ooo-entrance-unfold" },
119 { css::presentation::EffectPresetClass::ENTRANCE
, 41 ,"ooo-entrance-whip" },
120 { css::presentation::EffectPresetClass::ENTRANCE
, 42 ,"ooo-entrance-ascend" },
121 { css::presentation::EffectPresetClass::ENTRANCE
, 43 ,"ooo-entrance-center-revolve" },
122 { css::presentation::EffectPresetClass::ENTRANCE
, 45 ,"ooo-entrance-fade-in-and-swivel" },
123 { css::presentation::EffectPresetClass::ENTRANCE
, 47 ,"ooo-entrance-descend" },
124 { css::presentation::EffectPresetClass::ENTRANCE
, 48 ,"ooo-entrance-sling" },
125 { css::presentation::EffectPresetClass::ENTRANCE
, 49 ,"ooo-entrance-spin-in" },
126 { css::presentation::EffectPresetClass::ENTRANCE
, 50 ,"ooo-entrance-compress" },
127 { css::presentation::EffectPresetClass::ENTRANCE
, 51 ,"ooo-entrance-magnify" },
128 { css::presentation::EffectPresetClass::ENTRANCE
, 52 ,"ooo-entrance-curve-up" },
129 { css::presentation::EffectPresetClass::ENTRANCE
, 53 ,"ooo-entrance-fade-in-and-zoom" },
130 { css::presentation::EffectPresetClass::ENTRANCE
, 54 ,"ooo-entrance-glide" },
131 { css::presentation::EffectPresetClass::ENTRANCE
, 55 ,"ooo-entrance-expand" },
132 { css::presentation::EffectPresetClass::ENTRANCE
, 56 ,"ooo-entrance-flip" },
133 { css::presentation::EffectPresetClass::ENTRANCE
, 58 ,"ooo-entrance-fold" },
134 { css::presentation::EffectPresetClass::EMPHASIS
, 1 ,"ooo-emphasis-fill-color" },
135 { css::presentation::EffectPresetClass::EMPHASIS
, 2 ,"ooo-emphasis-font" },
136 { css::presentation::EffectPresetClass::EMPHASIS
, 3 ,"ooo-emphasis-font-color" },
137 { css::presentation::EffectPresetClass::EMPHASIS
, 4 ,"ooo-emphasis-font-size" },
138 { css::presentation::EffectPresetClass::EMPHASIS
, 5 ,"ooo-emphasis-font-style" },
139 { css::presentation::EffectPresetClass::EMPHASIS
, 6 ,"ooo-emphasis-grow-and-shrink" },
140 { css::presentation::EffectPresetClass::EMPHASIS
, 7 ,"ooo-emphasis-line-color" },
141 { css::presentation::EffectPresetClass::EMPHASIS
, 8 ,"ooo-emphasis-spin" },
142 { css::presentation::EffectPresetClass::EMPHASIS
, 9 ,"ooo-emphasis-transparency" },
143 { css::presentation::EffectPresetClass::EMPHASIS
, 10 ,"ooo-emphasis-bold-flash" },
144 { css::presentation::EffectPresetClass::EMPHASIS
, 14 ,"ooo-emphasis-blast" },
145 { css::presentation::EffectPresetClass::EMPHASIS
, 15 ,"ooo-emphasis-bold-reveal" },
146 { css::presentation::EffectPresetClass::EMPHASIS
, 16 ,"ooo-emphasis-color-over-by-word" },
147 { css::presentation::EffectPresetClass::EMPHASIS
, 18 ,"ooo-emphasis-reveal-underline" },
148 { css::presentation::EffectPresetClass::EMPHASIS
, 19 ,"ooo-emphasis-color-blend" },
149 { css::presentation::EffectPresetClass::EMPHASIS
, 20 ,"ooo-emphasis-color-over-by-letter" },
150 { css::presentation::EffectPresetClass::EMPHASIS
, 21 ,"ooo-emphasis-complementary-color" },
151 { css::presentation::EffectPresetClass::EMPHASIS
, 22 ,"ooo-emphasis-complementary-color-2" },
152 { css::presentation::EffectPresetClass::EMPHASIS
, 23 ,"ooo-emphasis-contrasting-color" },
153 { css::presentation::EffectPresetClass::EMPHASIS
, 24 ,"ooo-emphasis-darken" },
154 { css::presentation::EffectPresetClass::EMPHASIS
, 25 ,"ooo-emphasis-desaturate" },
155 { css::presentation::EffectPresetClass::EMPHASIS
, 26 ,"ooo-emphasis-flash-bulb" },
156 { css::presentation::EffectPresetClass::EMPHASIS
, 27 ,"ooo-emphasis-flicker" },
157 { css::presentation::EffectPresetClass::EMPHASIS
, 28 ,"ooo-emphasis-grow-with-color" },
158 { css::presentation::EffectPresetClass::EMPHASIS
, 30 ,"ooo-emphasis-lighten" },
159 { css::presentation::EffectPresetClass::EMPHASIS
, 31 ,"ooo-emphasis-style-emphasis" },
160 { css::presentation::EffectPresetClass::EMPHASIS
, 32 ,"ooo-emphasis-teeter" },
161 { css::presentation::EffectPresetClass::EMPHASIS
, 33 ,"ooo-emphasis-vertical-highlight" },
162 { css::presentation::EffectPresetClass::EMPHASIS
, 34 ,"ooo-emphasis-wave" },
163 { css::presentation::EffectPresetClass::EMPHASIS
, 35 ,"ooo-emphasis-blink" },
164 { css::presentation::EffectPresetClass::EMPHASIS
, 36 ,"ooo-emphasis-shimmer" },
165 { css::presentation::EffectPresetClass::EXIT
, 1 ,"ooo-exit-disappear" },
166 { css::presentation::EffectPresetClass::EXIT
, 2 ,"ooo-exit-fly-out" },
167 { css::presentation::EffectPresetClass::EXIT
, 3 ,"ooo-exit-venetian-blinds" },
168 { css::presentation::EffectPresetClass::EXIT
, 4 ,"ooo-exit-box" },
169 { css::presentation::EffectPresetClass::EXIT
, 5 ,"ooo-exit-checkerboard" },
170 { css::presentation::EffectPresetClass::EXIT
, 6 ,"ooo-exit-circle" },
171 { css::presentation::EffectPresetClass::EXIT
, 7 ,"ooo-exit-crawl-out" },
172 { css::presentation::EffectPresetClass::EXIT
, 8 ,"ooo-exit-diamond" },
173 { css::presentation::EffectPresetClass::EXIT
, 9 ,"ooo-exit-dissolve" },
174 { css::presentation::EffectPresetClass::EXIT
, 10 ,"ooo-exit-fade-out" },
175 { css::presentation::EffectPresetClass::EXIT
, 11 ,"ooo-exit-flash-once" },
176 { css::presentation::EffectPresetClass::EXIT
, 12 ,"ooo-exit-peek-out" },
177 { css::presentation::EffectPresetClass::EXIT
, 13 ,"ooo-exit-plus" },
178 { css::presentation::EffectPresetClass::EXIT
, 14 ,"ooo-exit-random-bars" },
179 { css::presentation::EffectPresetClass::EXIT
, 15 ,"ooo-exit-spiral-out" },
180 { css::presentation::EffectPresetClass::EXIT
, 16 ,"ooo-exit-split" },
181 { css::presentation::EffectPresetClass::EXIT
, 17 ,"ooo-exit-collapse" },
182 { css::presentation::EffectPresetClass::EXIT
, 18 ,"ooo-exit-diagonal-squares" },
183 { css::presentation::EffectPresetClass::EXIT
, 19 ,"ooo-exit-swivel" },
184 { css::presentation::EffectPresetClass::EXIT
, 20 ,"ooo-exit-wedge" },
185 { css::presentation::EffectPresetClass::EXIT
, 21 ,"ooo-exit-wheel" },
186 { css::presentation::EffectPresetClass::EXIT
, 22 ,"ooo-exit-wipe" },
187 { css::presentation::EffectPresetClass::EXIT
, 23 ,"ooo-exit-zoom" },
188 { css::presentation::EffectPresetClass::EXIT
, 24 ,"ooo-exit-random" },
189 { css::presentation::EffectPresetClass::EXIT
, 25 ,"ooo-exit-boomerang" },
190 { css::presentation::EffectPresetClass::EXIT
, 26 ,"ooo-exit-bounce" },
191 { css::presentation::EffectPresetClass::EXIT
, 27 ,"ooo-exit-colored-lettering" },
192 { css::presentation::EffectPresetClass::EXIT
, 28 ,"ooo-exit-movie-credits" },
193 { css::presentation::EffectPresetClass::EXIT
, 29 ,"ooo-exit-ease-out" },
194 { css::presentation::EffectPresetClass::EXIT
, 30 ,"ooo-exit-float" },
195 { css::presentation::EffectPresetClass::EXIT
, 31 ,"ooo-exit-turn-and-grow" },
196 { css::presentation::EffectPresetClass::EXIT
, 34 ,"ooo-exit-breaks" },
197 { css::presentation::EffectPresetClass::EXIT
, 35 ,"ooo-exit-pinwheel" },
198 { css::presentation::EffectPresetClass::EXIT
, 37 ,"ooo-exit-sink-down" },
199 { css::presentation::EffectPresetClass::EXIT
, 38 ,"ooo-exit-swish" },
200 { css::presentation::EffectPresetClass::EXIT
, 39 ,"ooo-exit-thread" },
201 { css::presentation::EffectPresetClass::EXIT
, 40 ,"ooo-exit-unfold" },
202 { css::presentation::EffectPresetClass::EXIT
, 41 ,"ooo-exit-whip" },
203 { css::presentation::EffectPresetClass::EXIT
, 42 ,"ooo-exit-descend" },
204 { css::presentation::EffectPresetClass::EXIT
, 43 ,"ooo-exit-center-revolve" },
205 { css::presentation::EffectPresetClass::EXIT
, 45 ,"ooo-exit-fade-out-and-swivel" },
206 { css::presentation::EffectPresetClass::EXIT
, 47 ,"ooo-exit-ascend" },
207 { css::presentation::EffectPresetClass::EXIT
, 48 ,"ooo-exit-sling" },
208 { css::presentation::EffectPresetClass::EXIT
, 53 ,"ooo-exit-fade-out-and-zoom" },
209 { css::presentation::EffectPresetClass::EXIT
, 55 ,"ooo-exit-contract" },
210 { css::presentation::EffectPresetClass::EXIT
, 49 ,"ooo-exit-spin-out" },
211 { css::presentation::EffectPresetClass::EXIT
, 50 ,"ooo-exit-stretchy" },
212 { css::presentation::EffectPresetClass::EXIT
, 51 ,"ooo-exit-magnify" },
213 { css::presentation::EffectPresetClass::EXIT
, 52 ,"ooo-exit-curve-down" },
214 { css::presentation::EffectPresetClass::EXIT
, 54 ,"ooo-exit-glide" },
215 { css::presentation::EffectPresetClass::EXIT
, 56 ,"ooo-exit-flip" },
216 { css::presentation::EffectPresetClass::EXIT
, 58 ,"ooo-exit-fold" },
218 { css::presentation::EffectPresetClass::MOTIONPATH
, 16 ,"ooo-motionpath-4-point-star" },
219 { css::presentation::EffectPresetClass::MOTIONPATH
, 5 ,"ooo-motionpath-5-point-star" },
220 { css::presentation::EffectPresetClass::MOTIONPATH
, 11 ,"ooo-motionpath-6-point-star" },
221 { css::presentation::EffectPresetClass::MOTIONPATH
, 17 ,"ooo-motionpath-8-point-star" },
222 { css::presentation::EffectPresetClass::MOTIONPATH
, 1 ,"ooo-motionpath-circle" },
223 { css::presentation::EffectPresetClass::MOTIONPATH
, 6 ,"ooo-motionpath-crescent-moon" },
224 { css::presentation::EffectPresetClass::MOTIONPATH
, 3 ,"ooo-motionpath-diamond" },
225 { css::presentation::EffectPresetClass::MOTIONPATH
, 13 ,"ooo-motionpath-equal-triangle" },
226 { css::presentation::EffectPresetClass::MOTIONPATH
, 12 ,"ooo-motionpath-oval" },
227 { css::presentation::EffectPresetClass::MOTIONPATH
, 9 ,"ooo-motionpath-heart" },
228 { css::presentation::EffectPresetClass::MOTIONPATH
, 4 ,"ooo-motionpath-hexagon" },
229 { css::presentation::EffectPresetClass::MOTIONPATH
, 10 ,"ooo-motionpath-octagon" },
230 { css::presentation::EffectPresetClass::MOTIONPATH
, 14 ,"ooo-motionpath-parallelogram" },
231 { css::presentation::EffectPresetClass::MOTIONPATH
, 15 ,"ooo-motionpath-pentagon" },
232 { css::presentation::EffectPresetClass::MOTIONPATH
, 2 ,"ooo-motionpath-right-triangle" },
233 { css::presentation::EffectPresetClass::MOTIONPATH
, 7 ,"ooo-motionpath-square" },
234 { css::presentation::EffectPresetClass::MOTIONPATH
, 18 ,"ooo-motionpath-teardrop" },
235 { css::presentation::EffectPresetClass::MOTIONPATH
, 8 ,"ooo-motionpath-trapezoid" },
236 { css::presentation::EffectPresetClass::MOTIONPATH
, 37 ,"ooo-motionpath-arc-down" },
237 { css::presentation::EffectPresetClass::MOTIONPATH
, 51 ,"ooo-motionpath-arc-left" },
238 { css::presentation::EffectPresetClass::MOTIONPATH
, 58 ,"ooo-motionpath-arc-right" },
239 { css::presentation::EffectPresetClass::MOTIONPATH
, 44 ,"ooo-motionpath-arc-up" },
240 { css::presentation::EffectPresetClass::MOTIONPATH
, 41 ,"ooo-motionpath-bounce-left" },
241 { css::presentation::EffectPresetClass::MOTIONPATH
, 54 ,"ooo-motionpath-bounce-right" },
242 { css::presentation::EffectPresetClass::MOTIONPATH
, 48 ,"ooo-motionpath-curvy-left" },
243 { css::presentation::EffectPresetClass::MOTIONPATH
, 61 ,"ooo-motionpath-curvy-right" },
244 { css::presentation::EffectPresetClass::MOTIONPATH
, 60 ,"ooo-motionpath-decaying-wave" },
245 { css::presentation::EffectPresetClass::MOTIONPATH
, 49 ,"ooo-motionpath-diagonal-down-right" },
246 { css::presentation::EffectPresetClass::MOTIONPATH
, 56 ,"ooo-motionpath-diagonal-up-right" },
247 { css::presentation::EffectPresetClass::MOTIONPATH
, 42 ,"ooo-motionpath-down" },
248 { css::presentation::EffectPresetClass::MOTIONPATH
, 52 ,"ooo-motionpath-funnel" },
249 { css::presentation::EffectPresetClass::MOTIONPATH
, 53 ,"ooo-motionpath-spring" },
250 { css::presentation::EffectPresetClass::MOTIONPATH
, 62 ,"ooo-motionpath-stairs-down" },
251 { css::presentation::EffectPresetClass::MOTIONPATH
, 50 ,"ooo-motionpath-turn-down" },
252 { css::presentation::EffectPresetClass::MOTIONPATH
, 36 ,"ooo-motionpath-turn-down-right" },
253 { css::presentation::EffectPresetClass::MOTIONPATH
, 43 ,"ooo-motionpath-turn-up" },
254 { css::presentation::EffectPresetClass::MOTIONPATH
, 57 ,"ooo-motionpath-turn-up-right" },
255 { css::presentation::EffectPresetClass::MOTIONPATH
, 64 ,"ooo-motionpath-up" },
256 { css::presentation::EffectPresetClass::MOTIONPATH
, 47 ,"ooo-motionpath-wave" },
257 { css::presentation::EffectPresetClass::MOTIONPATH
, 38 ,"ooo-motionpath-zigzag" },
258 { css::presentation::EffectPresetClass::MOTIONPATH
, 31 ,"ooo-motionpath-bean" },
259 { css::presentation::EffectPresetClass::MOTIONPATH
, 25 ,"ooo-motionpath-buzz-saw" },
260 { css::presentation::EffectPresetClass::MOTIONPATH
, 20 ,"ooo-motionpath-curved-square" },
261 { css::presentation::EffectPresetClass::MOTIONPATH
, 21 ,"ooo-motionpath-curved-x" },
262 { css::presentation::EffectPresetClass::MOTIONPATH
, 23 ,"ooo-motionpath-curvy-star" },
263 { css::presentation::EffectPresetClass::MOTIONPATH
, 28 ,"ooo-motionpath-figure-8-four" },
264 { css::presentation::EffectPresetClass::MOTIONPATH
, 26 ,"ooo-motionpath-horizontal-figure-8" },
265 { css::presentation::EffectPresetClass::MOTIONPATH
, 34 ,"ooo-motionpath-inverted-square" },
266 { css::presentation::EffectPresetClass::MOTIONPATH
, 33 ,"ooo-motionpath-inverted-triangle" },
267 { css::presentation::EffectPresetClass::MOTIONPATH
, 24 ,"ooo-motionpath-loop-de-loop" },
268 { css::presentation::EffectPresetClass::MOTIONPATH
, 29 ,"ooo-motionpath-neutron" },
269 { css::presentation::EffectPresetClass::MOTIONPATH
, 27 ,"ooo-motionpath-peanut" },
270 { css::presentation::EffectPresetClass::MOTIONPATH
, 32 ,"ooo-motionpath-clover" },
271 { css::presentation::EffectPresetClass::MOTIONPATH
, 19 ,"ooo-motionpath-pointy-star" },
272 { css::presentation::EffectPresetClass::MOTIONPATH
, 30 ,"ooo-motionpath-swoosh" },
273 { css::presentation::EffectPresetClass::MOTIONPATH
, 22 ,"ooo-motionpath-vertical-figure-8" },
274 { css::presentation::EffectPresetClass::MOTIONPATH
, 35 ,"ooo-motionpath-left" },
275 { css::presentation::EffectPresetClass::MOTIONPATH
, 63 ,"ooo-motionpath-right" },
276 { css::presentation::EffectPresetClass::MOTIONPATH
, 55 ,"ooo-motionpath-spiral-left" },
277 { css::presentation::EffectPresetClass::MOTIONPATH
, 46 ,"ooo-motionpath-spiral-right" },
278 { css::presentation::EffectPresetClass::MOTIONPATH
, 40 ,"ooo-motionpath-sine-wave" },
279 { css::presentation::EffectPresetClass::MOTIONPATH
, 59 ,"ooo-motionpath-s-curve-1" },
280 { css::presentation::EffectPresetClass::MOTIONPATH
, 39 ,"ooo-motionpath-s-curve-2" },
281 { css::presentation::EffectPresetClass::MOTIONPATH
, 45 ,"ooo-motionpath-heartbeat" },
289 OUString
getConvertedSubType( sal_Int16 nPresetClass
, sal_Int32 nPresetId
, sal_Int32 nPresetSubType
)
291 const char* pStr
= nullptr;
293 if( (nPresetClass
== EffectPresetClass::ENTRANCE
) || (nPresetClass
== EffectPresetClass::EXIT
) )
296 if( nPresetId
!= 21 )
301 switch( nPresetSubType
)
303 case 5: pStr
= "downward"; break;
304 case 10: pStr
= "across"; break;
307 else if( nPresetId
== 17 )
310 if( nPresetSubType
== 10 )
313 else if( nPresetId
== 18 )
316 switch( nPresetSubType
)
318 case 3: pStr
= "right-to-top"; break;
319 case 6: pStr
= "right-to-bottom"; break;
320 case 9: pStr
= "left-to-top"; break;
321 case 12: pStr
= "left-to-bottom"; break;
325 if( pStr
== nullptr )
327 const convert_subtype
* p
= convert_subtype::getList();
329 while( p
->mpStrSubType
)
331 if( p
->mnID
== nPresetSubType
)
333 pStr
= p
->mpStrSubType
;
343 return OUString::createFromAscii( pStr
);
345 return OUString::number( nPresetSubType
);
348 CommonTimeNodeContext::CommonTimeNodeContext(
349 FragmentHandler2
const & rParent
,
351 const Reference
< XFastAttributeList
>& xAttribs
,
352 const TimeNodePtr
& pNode
)
353 : TimeNodeContext( rParent
, aElement
, pNode
)
356 AttributeList
attribs( xAttribs
);
357 sal_Int32 nInt
; // some temporary int value for float conversions
359 NodePropertyMap
& aProps
= pNode
->getNodeProperties();
360 TimeNode::UserDataMap
& aUserData
= pNode
->getUserData();
362 if( attribs
.hasAttribute( XML_accel
) )
364 double dPercent
= ::oox::drawingml::GetPositiveFixedPercentage( xAttribs
->getOptionalValue( XML_accel
) );
365 aProps
[ NP_ACCELERATION
] <<= dPercent
;
368 if( attribs
.hasAttribute( XML_afterEffect
) )
370 aUserData
[ "after-effect" ]
371 <<= attribs
.getBool( XML_afterEffect
, false );
373 aProps
[ NP_AUTOREVERSE
] <<= attribs
.getBool( XML_autoRev
, false );
376 if( attribs
.hasAttribute( XML_bldLvl
) )
378 attribs
.getInteger( XML_bldLvl
, 0 );
380 if( attribs
.hasAttribute( XML_decel
) )
382 double dPercent
= ::oox::drawingml::GetPositiveFixedPercentage( xAttribs
->getOptionalValue( XML_decel
) );
383 aProps
[ NP_DECELERATE
] <<= dPercent
;
386 if( attribs
.hasAttribute( XML_display
) )
388 aProps
[ NP_DISPLAY
] <<= attribs
.getBool( XML_display
, true );
390 if( attribs
.hasAttribute( XML_dur
) )
392 aProps
[ NP_DURATION
] = GetTime( xAttribs
->getOptionalValue( XML_dur
) );
395 if( attribs
.hasAttribute( XML_evtFilter
) )
397 xAttribs
->getOptionalValue( XML_evtFilter
);
399 // ST_TLTimeNodeFillType
400 if( attribs
.hasAttribute( XML_fill
) )
402 nInt
= xAttribs
->getOptionalValueToken( XML_fill
, 0 );
409 nEnum
= AnimationFill::REMOVE
;
412 nEnum
= AnimationFill::FREEZE
;
415 nEnum
= AnimationFill::HOLD
;
418 nEnum
= AnimationFill::TRANSITION
;
421 nEnum
= AnimationFill::DEFAULT
;
424 aProps
[ NP_FILL
] <<= nEnum
;
427 if( attribs
.hasAttribute( XML_grpId
) )
429 attribs
.getUnsigned( XML_grpId
, 0 );
432 if( attribs
.hasAttribute( XML_id
) )
434 sal_uInt32 nId
= attribs
.getUnsigned( XML_id
, 0 );
437 // ST_TLTimeNodeMasterRelation
438 nInt
= xAttribs
->getOptionalValueToken( XML_masterRel
, 0 );
452 if( attribs
.hasAttribute( XML_nodePh
) )
454 attribs
.getBool( XML_nodePh
, false );
457 nInt
= xAttribs
->getOptionalValueToken( XML_nodeType
, 0 );
463 case XML_clickEffect
:
465 nEnum
= EffectNodeType::ON_CLICK
;
469 nEnum
= EffectNodeType::WITH_PREVIOUS
;
472 nEnum
= EffectNodeType::MAIN_SEQUENCE
;
474 case XML_interactiveSeq
:
475 nEnum
= EffectNodeType::INTERACTIVE_SEQUENCE
;
478 case XML_afterEffect
:
479 nEnum
= EffectNodeType::AFTER_PREVIOUS
;
482 nEnum
= EffectNodeType::TIMING_ROOT
;
485 nEnum
= EffectNodeType::DEFAULT
;
488 aUserData
[ "node-type" ] <<= nEnum
;
491 // ST_TLTimeNodePresetClassType
492 nInt
= xAttribs
->getOptionalValueToken( XML_presetClass
, 0 );
495 sal_Int16 nEffectPresetClass
= 0;
496 // TODO put that in a function
500 nEffectPresetClass
= EffectPresetClass::ENTRANCE
;
503 nEffectPresetClass
= EffectPresetClass::EXIT
;
506 nEffectPresetClass
= EffectPresetClass::EMPHASIS
;
509 nEffectPresetClass
= EffectPresetClass::MOTIONPATH
;
512 // TODO check that the value below is correct
513 nEffectPresetClass
= EffectPresetClass::OLEACTION
;
516 nEffectPresetClass
= EffectPresetClass::MEDIACALL
;
519 nEffectPresetClass
= 0;
522 aUserData
[ "preset-class" ] <<= nEffectPresetClass
;
523 if( attribs
.hasAttribute( XML_presetID
) )
525 sal_Int32 nPresetId
= attribs
.getInteger( XML_presetID
, 0 );
526 const preset_mapping
* p
= preset_mapping::getList();
527 while( p
->mpStrPresetId
&& ((p
->mnPresetClass
!= nEffectPresetClass
) || (p
->mnPresetId
!= nPresetId
)) )
530 aUserData
[ "preset-id" ]
531 <<= OUString::createFromAscii( p
->mpStrPresetId
);
532 sal_Int32 nPresetSubType
= attribs
.getInteger( XML_presetSubtype
, 0 );
535 aUserData
[ "preset-sub-type" ] <<= getConvertedSubType( nEffectPresetClass
, nPresetId
, nPresetSubType
);
539 if( attribs
.hasAttribute( XML_repeatCount
) )
541 aProps
[ NP_REPEATCOUNT
] = GetTime( xAttribs
->getOptionalValue( XML_repeatCount
) );
543 /* see pptinanimation */
544 // aProps[ NP_REPEATCOUNT ] <<= (fCount < ((float)3.40282346638528860e+38)) ? makeAny( (double)fCount ) : makeAny( Timing_INDEFINITE );
545 if( attribs
.hasAttribute( XML_repeatDur
) )
547 aProps
[ NP_REPEATDURATION
] = GetTime( xAttribs
->getOptionalValue( XML_repeatDur
) );
549 // TODO repeatDur is otherwise the same as dur. What shall we do? -- Hub
551 // ST_TLTimeNodeRestartType
552 nInt
= xAttribs
->getOptionalValueToken( XML_restart
, 0 );
555 // TODO put that in a function
560 nEnum
= AnimationRestart::ALWAYS
;
562 case XML_whenNotActive
:
563 nEnum
= AnimationRestart::WHEN_NOT_ACTIVE
;
566 nEnum
= AnimationRestart::NEVER
;
569 nEnum
= AnimationRestart::DEFAULT
;
572 aProps
[ NP_RESTART
] <<= nEnum
;
574 // ST_Percentage TODO
575 xAttribs
->getOptionalValue( XML_spd
/*"10000" */ );
576 // ST_TLTimeNodeSyncType TODO
577 xAttribs
->getOptionalValue( XML_syncBehavior
);
579 xAttribs
->getOptionalValue( XML_tmFilter
);
582 CommonTimeNodeContext::~CommonTimeNodeContext( ) noexcept
586 void CommonTimeNodeContext::onEndElement()
588 if( isCurrentElement( PPT_TOKEN( iterate
) ) )
594 ::oox::core::ContextHandlerRef
CommonTimeNodeContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
597 switch ( aElementToken
)
599 case PPT_TOKEN( childTnLst
):
600 case PPT_TOKEN( subTnLst
):
601 return new TimeNodeListContext( *this, mpNode
->getChildren() );
603 case PPT_TOKEN( stCondLst
):
604 return new CondListContext( *this, aElementToken
, mpNode
, mpNode
->getStartCondition() );
605 case PPT_TOKEN( endCondLst
):
606 return new CondListContext( *this, aElementToken
, mpNode
, mpNode
->getEndCondition() );
608 case PPT_TOKEN( endSync
):
609 return new CondContext( *this, rAttribs
.getFastAttributeList(), mpNode
, mpNode
->getEndSyncValue() );
610 case PPT_TOKEN( iterate
):
612 sal_Int32 nVal
= rAttribs
.getToken( XML_type
, XML_el
);
615 // TODO put that in a function
620 nEnum
= TextAnimationType::BY_PARAGRAPH
;
623 nEnum
= TextAnimationType::BY_LETTER
;
626 nEnum
= TextAnimationType::BY_WORD
;
629 // default is BY_WORD. See Ppt97Animation::GetTextAnimationType()
630 // in sd/source/filter/ppt/ppt97animations.cxx:297
631 nEnum
= TextAnimationType::BY_WORD
;
634 mpNode
->getNodeProperties()[ NP_ITERATETYPE
] <<= nEnum
;
636 // in case of exception we ignore the whole tag.
637 // TODO what to do with this
638 /*bool bBackwards =*/ rAttribs
.getBool( XML_backwards
, false );
642 case PPT_TOKEN( tmAbs
):
645 double fTime
= rAttribs
.getUnsigned( XML_val
, 0 ) / 1000.0; // convert ms. to second.
646 mpNode
->getNodeProperties()[NP_ITERATEINTERVAL
] <<= fTime
;
649 case PPT_TOKEN( tmPct
):
652 // TODO: should use duration to get iterate interval in second.
653 double fPercent
= static_cast<double>(rAttribs
.getUnsigned( XML_val
, 0 )) / 100000.0;
654 mpNode
->getNodeProperties()[ NP_ITERATEINTERVAL
] <<= fPercent
;
666 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */