LCOV - code coverage report
Current view: top level - oox/source/ppt - commontimenodecontext.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 106 181 58.6 %
Date: 2014-11-03 Functions: 8 8 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10