LibreOffice Module oox (master)  1
commontimenodecontext.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
21 #include "conditioncontext.hxx"
22 
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>
28 
32 #include <oox/token/namespaces.hxx>
33 #include <oox/token/tokens.hxx>
34 
35 #include "animationtypes.hxx"
36 
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;
42 
43 
44 namespace oox::ppt {
45 
47 {
48  static const convert_subtype aList[] =
49  {
50  // fly in
51  { 1, "from-top" },
52  { 2, "from-right" },
53  { 3, "from-top-right" },
54  { 4, "from-bottom" },
55  { 5, "horizontal" },
56  { 6, "from-bottom-right" },
57  { 8, "from-left" },
58  { 9, "from-top-left" },
59  { 10, "vertical" },
60  { 12, "from-bottom-left" },
61  { 16, "in" },
62  { 21, "vertical-in" },
63  { 26, "horizontal-in" },
64  { 32, "out" },
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" },
71  { 0, nullptr }
72  };
73 
74  return aList;
75 }
76 
78 {
79 
80  static const preset_mapping aList[] =
81  {
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" },
217 
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" },
282 
283  { 0,0,nullptr }
284  };
285 
286  return aList;
287 };
288 
289 OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId, sal_Int32 nPresetSubType )
290 {
291  const char* pStr = nullptr;
292 
293  if( (nPresetClass == EffectPresetClass::ENTRANCE) || (nPresetClass == EffectPresetClass::EXIT) )
294  {
295  // skip wheel effect
296  if( nPresetId != 21 )
297  {
298  if( nPresetId == 5 )
299  {
300  // checkerboard
301  switch( nPresetSubType )
302  {
303  case 5: pStr = "downward"; break;
304  case 10: pStr = "across"; break;
305  }
306  }
307  else if( nPresetId == 17 )
308  {
309  // stretch
310  if( nPresetSubType == 10 )
311  pStr = "across";
312  }
313  else if( nPresetId == 18 )
314  {
315  // strips
316  switch( nPresetSubType )
317  {
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;
322  }
323  }
324 
325  if( pStr == nullptr )
326  {
328 
329  while( p->mpStrSubType )
330  {
331  if( p->mnID == nPresetSubType )
332  {
333  pStr = p->mpStrSubType;
334  break;
335  }
336  p++;
337  }
338  }
339  }
340  }
341 
342  if( pStr )
343  return OUString::createFromAscii( pStr );
344  else
345  return OUString::number( nPresetSubType );
346 }
347 
349  FragmentHandler2 const & rParent,
350  sal_Int32 aElement,
351  const Reference< XFastAttributeList >& xAttribs,
352  const TimeNodePtr & pNode )
353  : TimeNodeContext( rParent, aElement, pNode )
354  , mbIterate( false )
355  {
356  AttributeList attribs( xAttribs );
357  sal_Int32 nInt; // some temporary int value for float conversions
358 
359  NodePropertyMap & aProps = pNode->getNodeProperties();
360  TimeNode::UserDataMap & aUserData = pNode->getUserData();
361 
362  if( attribs.hasAttribute( XML_accel ) )
363  {
364  double dPercent = ::oox::drawingml::GetPositiveFixedPercentage( xAttribs->getOptionalValue( XML_accel ) );
365  aProps[ NP_ACCELERATION ] <<= dPercent;
366  }
367 
368  if( attribs.hasAttribute( XML_afterEffect ) )
369  {
370  aUserData[ "after-effect" ]
371  <<= attribs.getBool( XML_afterEffect, false );
372  }
373  aProps[ NP_AUTOREVERSE ] <<= attribs.getBool( XML_autoRev, false );
374 
375  // TODO
376  if( attribs.hasAttribute( XML_bldLvl ) )
377  {
378  attribs.getInteger( XML_bldLvl, 0 );
379  }
380  if( attribs.hasAttribute( XML_decel ) )
381  {
382  double dPercent = ::oox::drawingml::GetPositiveFixedPercentage( xAttribs->getOptionalValue( XML_decel ) );
383  aProps[ NP_DECELERATE ] <<= dPercent;
384  }
385  // TODO
386  if( attribs.hasAttribute( XML_display ) )
387  {
388  aProps[ NP_DISPLAY ] <<= attribs.getBool( XML_display, true );
389  }
390  if( attribs.hasAttribute( XML_dur ) )
391  {
392  aProps[ NP_DURATION ] = GetTime( xAttribs->getOptionalValue( XML_dur) );
393  }
394  // TODO
395  if( attribs.hasAttribute( XML_evtFilter ) )
396  {
397  xAttribs->getOptionalValue( XML_evtFilter );
398  }
399  // ST_TLTimeNodeFillType
400  if( attribs.hasAttribute( XML_fill ) )
401  {
402  nInt = xAttribs->getOptionalValueToken( XML_fill, 0 );
403  if( nInt != 0 )
404  {
405  sal_Int16 nEnum;
406  switch( nInt )
407  {
408  case XML_remove:
409  nEnum = AnimationFill::REMOVE;
410  break;
411  case XML_freeze:
412  nEnum = AnimationFill::FREEZE;
413  break;
414  case XML_hold:
415  nEnum = AnimationFill::HOLD;
416  break;
417  case XML_transition:
418  nEnum = AnimationFill::TRANSITION;
419  break;
420  default:
421  nEnum = AnimationFill::DEFAULT;
422  break;
423  }
424  aProps[ NP_FILL ] <<= nEnum;
425  }
426  }
427  if( attribs.hasAttribute( XML_grpId ) )
428  {
429  attribs.getUnsigned( XML_grpId, 0 );
430  }
431  // ST_TLTimeNodeID
432  if( attribs.hasAttribute( XML_id ) )
433  {
434  sal_uInt32 nId = attribs.getUnsigned( XML_id, 0 );
435  pNode->setId( nId );
436  }
437  // ST_TLTimeNodeMasterRelation
438  nInt = xAttribs->getOptionalValueToken( XML_masterRel, 0 );
439  if( nInt )
440  {
441  // TODO
442  switch(nInt)
443  {
444  case XML_sameClick:
445  case XML_lastClick:
446  case XML_nextClick:
447  break;
448  }
449  }
450 
451  // TODO
452  if( attribs.hasAttribute( XML_nodePh ) )
453  {
454  attribs.getBool( XML_nodePh, false );
455  }
456  // ST_TLTimeNodeType
457  nInt = xAttribs->getOptionalValueToken( XML_nodeType, 0 );
458  if( nInt != 0 )
459  {
460  sal_Int16 nEnum;
461  switch( nInt )
462  {
463  case XML_clickEffect:
464  case XML_clickPar:
465  nEnum = EffectNodeType::ON_CLICK;
466  break;
467  case XML_withEffect:
468  case XML_withGroup:
469  nEnum = EffectNodeType::WITH_PREVIOUS;
470  break;
471  case XML_mainSeq:
472  nEnum = EffectNodeType::MAIN_SEQUENCE;
473  break;
474  case XML_interactiveSeq:
475  nEnum = EffectNodeType::INTERACTIVE_SEQUENCE;
476  break;
477  case XML_afterGroup:
478  case XML_afterEffect:
479  nEnum = EffectNodeType::AFTER_PREVIOUS;
480  break;
481  case XML_tmRoot:
482  nEnum = EffectNodeType::TIMING_ROOT;
483  break;
484  default:
485  nEnum = EffectNodeType::DEFAULT;
486  break;
487  }
488  aUserData[ "node-type" ] <<= nEnum;
489  }
490 
491  // ST_TLTimeNodePresetClassType
492  nInt = xAttribs->getOptionalValueToken( XML_presetClass, 0 );
493  if( nInt != 0 )
494  {
495  sal_Int16 nEffectPresetClass = 0;
496  // TODO put that in a function
497  switch( nInt )
498  {
499  case XML_entr:
500  nEffectPresetClass = EffectPresetClass::ENTRANCE;
501  break;
502  case XML_exit:
503  nEffectPresetClass = EffectPresetClass::EXIT;
504  break;
505  case XML_emph:
506  nEffectPresetClass = EffectPresetClass::EMPHASIS;
507  break;
508  case XML_path:
509  nEffectPresetClass = EffectPresetClass::MOTIONPATH;
510  break;
511  case XML_verb:
512  // TODO check that the value below is correct
513  nEffectPresetClass = EffectPresetClass::OLEACTION;
514  break;
515  case XML_mediacall:
516  nEffectPresetClass = EffectPresetClass::MEDIACALL;
517  break;
518  default:
519  nEffectPresetClass = 0;
520  break;
521  }
522  aUserData[ "preset-class" ] <<= nEffectPresetClass;
523  if( attribs.hasAttribute( XML_presetID ) )
524  {
525  sal_Int32 nPresetId = attribs.getInteger( XML_presetID, 0 );
527  while( p->mpStrPresetId && ((p->mnPresetClass != nEffectPresetClass) || (p->mnPresetId != nPresetId )) )
528  p++;
529 
530  aUserData[ "preset-id" ]
531  <<= OUString::createFromAscii( p->mpStrPresetId );
532  sal_Int32 nPresetSubType = attribs.getInteger( XML_presetSubtype, 0 );
533  if( nPresetSubType )
534  {
535  aUserData[ "preset-sub-type" ] <<= getConvertedSubType( nEffectPresetClass, nPresetId, nPresetSubType );
536  }
537  }
538  }
539  if( attribs.hasAttribute( XML_repeatCount ) )
540  {
541  aProps[ NP_REPEATCOUNT ] = GetTime( xAttribs->getOptionalValue( XML_repeatCount ) );
542  }
543  /* see pptinanimation */
544 // aProps[ NP_REPEATCOUNT ] <<= (fCount < ((float)3.40282346638528860e+38)) ? makeAny( (double)fCount ) : makeAny( Timing_INDEFINITE );
545  if( attribs.hasAttribute( XML_repeatDur ) )
546  {
547  aProps[ NP_REPEATDURATION ] = GetTime( xAttribs->getOptionalValue( XML_repeatDur ) );
548  }
549  // TODO repeatDur is otherwise the same as dur. What shall we do? -- Hub
550 
551  // ST_TLTimeNodeRestartType
552  nInt = xAttribs->getOptionalValueToken( XML_restart, 0 );
553  if( nInt != 0 )
554  {
555  // TODO put that in a function
556  sal_Int16 nEnum;
557  switch( nInt )
558  {
559  case XML_always:
560  nEnum = AnimationRestart::ALWAYS;
561  break;
562  case XML_whenNotActive:
563  nEnum = AnimationRestart::WHEN_NOT_ACTIVE;
564  break;
565  case XML_never:
566  nEnum = AnimationRestart::NEVER;
567  break;
568  default:
569  nEnum = AnimationRestart::DEFAULT;
570  break;
571  }
572  aProps[ NP_RESTART ] <<= nEnum;
573  }
574  // ST_Percentage TODO
575  xAttribs->getOptionalValue( XML_spd /*"10000" */ );
576  // ST_TLTimeNodeSyncType TODO
577  xAttribs->getOptionalValue( XML_syncBehavior );
578  // TODO (string)
579  xAttribs->getOptionalValue( XML_tmFilter );
580  }
581 
583  {
584  }
585 
587  {
588  if( isCurrentElement( PPT_TOKEN( iterate ) ) )
589  {
590  mbIterate = false;
591  }
592  }
593 
595  {
596 
597  switch ( aElementToken )
598  {
599  case PPT_TOKEN( childTnLst ):
600  case PPT_TOKEN( subTnLst ):
601  return new TimeNodeListContext( *this, mpNode->getChildren() );
602 
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() );
607 
608  case PPT_TOKEN( endSync ):
609  return new CondContext( *this, rAttribs.getFastAttributeList(), mpNode, mpNode->getEndSyncValue() );
610  case PPT_TOKEN( iterate ):
611  {
612  sal_Int32 nVal = rAttribs.getToken( XML_type, XML_el );
613  if( nVal != 0 )
614  {
615  // TODO put that in a function
616  sal_Int16 nEnum;
617  switch( nVal )
618  {
619  case XML_el:
620  nEnum = TextAnimationType::BY_PARAGRAPH;
621  break;
622  case XML_lt:
623  nEnum = TextAnimationType::BY_LETTER;
624  break;
625  case XML_wd:
626  nEnum = TextAnimationType::BY_WORD;
627  break;
628  default:
629  // default is BY_WORD. See Ppt97Animation::GetTextAnimationType()
630  // in sd/source/filter/ppt/ppt97animations.cxx:297
631  nEnum = TextAnimationType::BY_WORD;
632  break;
633  }
634  mpNode->getNodeProperties()[ NP_ITERATETYPE ] <<= nEnum;
635  }
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 );
639  mbIterate = true;
640  return this;
641  }
642  case PPT_TOKEN( tmAbs ):
643  if( mbIterate )
644  {
645  double fTime = rAttribs.getUnsigned( XML_val, 0 ) / 1000.0; // convert ms. to second.
646  mpNode->getNodeProperties()[NP_ITERATEINTERVAL] <<= fTime;
647  }
648  return this;
649  case PPT_TOKEN( tmPct ):
650  if( mbIterate )
651  {
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;
655  }
656  return this;
657  default:
658  break;
659  }
660 
661  return this;
662  }
663 
664 }
665 
666 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptValue< bool > getBool(sal_Int32 nAttrToken) const
Returns the boolean value of the specified attribute.
OptValue< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
Returns the 32-bit signed integer value of the specified attribute (decimal).
bool isCurrentElement(sal_Int32 nElement) const
Returns true, if nElement contains the identifier of the currently processed element.
Any GetTime(const OUString &val)
sal_Int16 nId
Definition: olehelper.cxx:97
OUString getConvertedSubType(sal_Int16 nPresetClass, sal_Int32 nPresetId, sal_Int32 nPresetSubType)
std::array< css::uno::Any, NP_SIZE_ > NodePropertyMap
bool hasAttribute(sal_Int32 nAttrToken) const
Returns true, if the specified attribute is present.
virtual ~CommonTimeNodeContext() noexcept override
OptValue< sal_uInt32 > getUnsigned(sal_Int32 nAttrToken) const
Returns the 32-bit unsigned integer value of the specified attribute (decimal).
::std::map< OUString, css::uno::Any > UserDataMap
Definition: timenode.hxx:52
static const preset_mapping * getList()
double GetPositiveFixedPercentage(const OUString &sValue)
Converts a ST_PositiveFixedPercentage to a float.
static const convert_subtype * getList()
Provides access to attribute values of an element.
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 aElementToken, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
CT_TLTimeConditionList.
CT_TLTimeCondition.
const css::uno::Reference< css::xml::sax::XFastAttributeList > & getFastAttributeList() const
Returns the wrapped com.sun.star.xml.sax.XFastAttributeList object.
void * p
std::shared_ptr< TimeNode > TimeNodePtr
Definition: timenode.hxx:44
CommonTimeNodeContext(::oox::core::FragmentHandler2 const &rParent, sal_Int32 aElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttribs, const TimeNodePtr &pNode)
virtual void onEndElement() override
Will be called when the current element is about to be left.
OptValue< sal_Int32 > getToken(sal_Int32 nAttrToken) const
Returns the token identifier of the value of the specified attribute.
FastParser context for XML_tnLst, XML_subTnLst and XML_childTnLst.