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