LCOV - code coverage report
Current view: top level - libreoffice/sd/source/core - EffectMigration.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 490 0.0 %
Date: 2012-12-27 Functions: 0 26 0.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 <com/sun/star/presentation/EffectNodeType.hpp>
      21             : #include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
      22             : #include <com/sun/star/presentation/TextAnimationType.hpp>
      23             : #include <com/sun/star/presentation/ParagraphTarget.hpp>
      24             : #include <svx/unoshape.hxx>
      25             : #include <svx/svdotext.hxx>
      26             : #include <svx/svdopath.hxx>
      27             : #include "drawdoc.hxx"
      28             : #include "sdpage.hxx"
      29             : #include <CustomAnimationPreset.hxx>
      30             : #include <TransitionPreset.hxx>
      31             : #include <EffectMigration.hxx>
      32             : #include <anminfo.hxx>
      33             : 
      34             : using namespace ::sd;
      35             : using namespace ::com::sun::star::uno;
      36             : using namespace ::com::sun::star::animations;
      37             : using namespace ::com::sun::star::presentation;
      38             : 
      39             : using ::com::sun::star::drawing::XShape;
      40             : using ::rtl::OUString;
      41             : 
      42             : struct deprecated_FadeEffect_conversion_table_entry
      43             : {
      44             :     FadeEffect  meFadeEffect;
      45             :     const sal_Char* mpPresetId;
      46             : }
      47             : deprecated_FadeEffect_conversion_table[] =
      48             : {
      49             : // OOo 1.x transitions
      50             :     { FadeEffect_FADE_FROM_LEFT,            "wipe-right" },
      51             :     { FadeEffect_FADE_FROM_TOP,             "wipe-down" },
      52             :     { FadeEffect_FADE_FROM_RIGHT,           "wipe-left" },
      53             :     { FadeEffect_FADE_FROM_BOTTOM,          "wipe-up" },
      54             : 
      55             :     { FadeEffect_CLOCKWISE,                 "wheel-clockwise-1-spoke" },
      56             : 
      57             :     { FadeEffect_UNCOVER_TO_LEFT,           "uncover-left" },
      58             :     { FadeEffect_UNCOVER_TO_UPPERLEFT,      "uncover-left-up" },
      59             :     { FadeEffect_UNCOVER_TO_TOP,            "uncover-up" },
      60             :     { FadeEffect_UNCOVER_TO_UPPERRIGHT,     "uncover-right-up" },
      61             :     { FadeEffect_UNCOVER_TO_RIGHT,          "uncover-right" },
      62             :     { FadeEffect_UNCOVER_TO_LOWERRIGHT,     "uncover-right-down" },
      63             :     { FadeEffect_UNCOVER_TO_BOTTOM,         "uncover-down" },
      64             :     { FadeEffect_UNCOVER_TO_LOWERLEFT,      "uncover-left-down" },
      65             : 
      66             :     { FadeEffect_VERTICAL_LINES,            "random-bars-vertical" },
      67             :     { FadeEffect_HORIZONTAL_LINES,          "random-bars-horizontal" },
      68             : 
      69             :     { FadeEffect_VERTICAL_CHECKERBOARD,     "checkerboard-down" },
      70             :     { FadeEffect_HORIZONTAL_CHECKERBOARD,   "checkerboard-across" },
      71             : 
      72             :     { FadeEffect_FADE_TO_CENTER,            "box-in" },
      73             :     { FadeEffect_FADE_FROM_CENTER,          "box-out" },
      74             : 
      75             :     { FadeEffect_VERTICAL_STRIPES,          "venetian-blinds-vertical" },
      76             :     { FadeEffect_HORIZONTAL_STRIPES,        "venetian-blinds-horizontal" },
      77             : 
      78             :     { FadeEffect_MOVE_FROM_LEFT,            "cover-right" },
      79             :     { FadeEffect_MOVE_FROM_TOP,             "cover-down" },
      80             :     { FadeEffect_MOVE_FROM_RIGHT,           "cover-left" },
      81             :     { FadeEffect_MOVE_FROM_BOTTOM,          "cover-up" },
      82             :     { FadeEffect_MOVE_FROM_UPPERLEFT,       "cover-right-down" },
      83             :     { FadeEffect_MOVE_FROM_UPPERRIGHT,      "cover-left-down" },
      84             :     { FadeEffect_MOVE_FROM_LOWERRIGHT,      "cover-left-up" },
      85             :     { FadeEffect_MOVE_FROM_LOWERLEFT,       "cover-right-up" },
      86             : 
      87             :     { FadeEffect_DISSOLVE,                  "dissolve" },
      88             : 
      89             :     { FadeEffect_RANDOM,                    "random-transition" },
      90             : 
      91             :     { FadeEffect_ROLL_FROM_LEFT,            "push-right" },
      92             :     { FadeEffect_ROLL_FROM_TOP,             "push-down" },
      93             :     { FadeEffect_ROLL_FROM_RIGHT,           "push-left" },
      94             :     { FadeEffect_ROLL_FROM_BOTTOM,          "push-up" },
      95             : 
      96             :     { FadeEffect_CLOSE_VERTICAL,            "split-horizontal-in" },
      97             :     { FadeEffect_CLOSE_HORIZONTAL,          "split-vertical-in" },
      98             :     { FadeEffect_OPEN_VERTICAL,             "split-horizontal-out" },
      99             :     { FadeEffect_OPEN_HORIZONTAL,           "split-vertical-out" },
     100             : 
     101             :     { FadeEffect_FADE_FROM_UPPERLEFT,       "diagonal-squares-right-down" },
     102             :     { FadeEffect_FADE_FROM_UPPERRIGHT,      "diagonal-squares-left-down" },
     103             :     { FadeEffect_FADE_FROM_LOWERLEFT,       "diagonal-squares-right-up" },
     104             :     { FadeEffect_FADE_FROM_LOWERRIGHT,      "diagonal-squares-left-up" },
     105             : 
     106             : // OOo 1.x transitions not in OOo 2.x
     107             :     { FadeEffect_CLOCKWISE,                 "clock-wipe-twelve" },
     108             :     { FadeEffect_COUNTERCLOCKWISE,          "reverse-clock-wipe-twelve" },
     109             :     { FadeEffect_SPIRALIN_LEFT,             "spiral-wipe-top-left-clockwise" },
     110             :     { FadeEffect_SPIRALIN_RIGHT,            "spiral-wipe-top-right-counter-clockwise" },
     111             :     { FadeEffect_SPIRALOUT_LEFT,            "spiral-wipe-out-to-bottom-right-clockwise" },
     112             :     { FadeEffect_SPIRALOUT_RIGHT,           "spiral-wipe-out-to-bottom-left-counter-clockwise" },
     113             :     { FadeEffect_WAVYLINE_FROM_LEFT,        "snake-wipe-top-left-vertical" },
     114             :     { FadeEffect_WAVYLINE_FROM_TOP,         "snake-wipe-top-left-horizontal" },
     115             :     { FadeEffect_WAVYLINE_FROM_RIGHT,       "snake-wipe-bottom-right-vertical" },
     116             :     { FadeEffect_WAVYLINE_FROM_BOTTOM,      "snake-wipe-bottom-right-horizontal" },
     117             :     { FadeEffect_STRETCH_FROM_LEFT,         "wipe-right" }, // todo
     118             :     { FadeEffect_STRETCH_FROM_TOP,          "wipe-down" },  // todo
     119             :     { FadeEffect_STRETCH_FROM_RIGHT,        "wipe-left" },  // todo
     120             :     { FadeEffect_STRETCH_FROM_BOTTOM,       "wipe-up" },    // todo
     121             : 
     122             : // OOo 1.x not available transitions
     123             : 
     124             :     { FadeEffect_CLOCKWISE,                 "wheel-clockwise-2-spokes" },
     125             :     { FadeEffect_CLOCKWISE,                 "wheel-clockwise-3-spokes" },
     126             :     { FadeEffect_CLOCKWISE,                 "wheel-clockwise-4-spokes" },
     127             :     { FadeEffect_CLOCKWISE,                 "wheel-clockwise-8-spokes" },
     128             : 
     129             :     { FadeEffect_FADE_FROM_CENTER,          "shape-circle" },
     130             :     { FadeEffect_FADE_FROM_CENTER,          "shape-diamond" },
     131             :     { FadeEffect_FADE_FROM_CENTER,          "shape-plus" },
     132             : 
     133             :     { FadeEffect_CLOCKWISE,                 "wedge" },
     134             : 
     135             :     { FadeEffect_DISSOLVE,                  "fade-through-black" },
     136             : 
     137             :     { FadeEffect_CLOCKWISE,                 "zoom-rotate-in" },
     138             : 
     139             :     { FadeEffect_HORIZONTAL_LINES,          "comb-horizontal" },
     140             :     { FadeEffect_VERTICAL_LINES,            "comb-vertical" },
     141             : 
     142             :     { FadeEffect_DISSOLVE,                  "fade-smoothly" },
     143             : 
     144             :     { FadeEffect_NONE, 0 }
     145             : };
     146             : 
     147             : /* todo
     148             : cut                             cut                                 (same as NONE?)
     149             : cut-through-black               cut         toBlack
     150             : wedge                           wedge
     151             : */
     152             : 
     153           0 : void EffectMigration::SetFadeEffect( SdPage* pPage, ::com::sun::star::presentation::FadeEffect eNewEffect)
     154             : {
     155           0 :     deprecated_FadeEffect_conversion_table_entry* pEntry = deprecated_FadeEffect_conversion_table;
     156           0 :     while( (pEntry->meFadeEffect != FadeEffect_NONE) && (pEntry->meFadeEffect != eNewEffect) )
     157           0 :         pEntry++;
     158             : 
     159           0 :     if( pEntry->mpPresetId )
     160             :     {
     161           0 :         const OUString aPresetId( OUString::createFromAscii( pEntry->mpPresetId ) );
     162             : 
     163           0 :         const TransitionPresetList& rPresetList = TransitionPreset::getTransitionPresetList();
     164             : 
     165           0 :         TransitionPresetList::const_iterator aIt( rPresetList.begin());
     166           0 :         const TransitionPresetList::const_iterator aEndIt( rPresetList.end());
     167           0 :         for( ; aIt != aEndIt; ++aIt )
     168             :         {
     169           0 :             if( (*aIt)->getPresetId() == aPresetId)
     170             :             {
     171           0 :                 pPage->setTransitionType( (*aIt)->getTransition() );
     172           0 :                 pPage->setTransitionSubtype( (*aIt)->getSubtype() );
     173           0 :                 pPage->setTransitionDirection( (*aIt)->getDirection() );
     174           0 :                 pPage->setTransitionFadeColor( (*aIt)->getFadeColor() );
     175           0 :                 break;
     176             :             }
     177           0 :         }
     178             :     }
     179             :     else
     180             :     {
     181           0 :         pPage->setTransitionType( 0 );
     182           0 :         pPage->setTransitionSubtype( 0 );
     183           0 :         pPage->setTransitionDirection( 0 );
     184           0 :         pPage->setTransitionFadeColor( 0 );
     185             :     }
     186           0 : }
     187             : 
     188           0 : FadeEffect EffectMigration::GetFadeEffect( const SdPage* pPage )
     189             : {
     190           0 :     const TransitionPresetList & rPresetList = TransitionPreset::getTransitionPresetList();
     191           0 :     TransitionPresetList::const_iterator aIt( rPresetList.begin());
     192           0 :     const TransitionPresetList::const_iterator aEndIt( rPresetList.end());
     193           0 :     for( ; aIt != aEndIt; ++aIt )
     194             :     {
     195           0 :         if( ( (*aIt)->getTransition() == pPage->getTransitionType() ) &&
     196           0 :             ( (*aIt)->getSubtype() == pPage->getTransitionSubtype() ) &&
     197           0 :             ( (*aIt)->getDirection() == pPage->getTransitionDirection() ) &&
     198           0 :             ( (*aIt)->getFadeColor() == pPage->getTransitionFadeColor() ) )
     199             :         {
     200           0 :             const OUString& aPresetId = (*aIt)->getPresetId();
     201             : 
     202           0 :             deprecated_FadeEffect_conversion_table_entry* pEntry = deprecated_FadeEffect_conversion_table;
     203           0 :             while( (pEntry->meFadeEffect != FadeEffect_NONE) && (!aPresetId.equalsAscii( pEntry->mpPresetId ) ) )
     204           0 :                 pEntry++;
     205             : 
     206           0 :             return pEntry->meFadeEffect;
     207             :         }
     208             :     }
     209           0 :     return FadeEffect_NONE;
     210             : }
     211             : 
     212             : struct deprecated_AnimationEffect_conversion_table_entry
     213             : {
     214             :     AnimationEffect meEffect;
     215             :     const sal_Char* mpPresetId;
     216             :     const sal_Char* mpPresetSubType;
     217             : }
     218             : deprecated_AnimationEffect_conversion_table[] =
     219             : {
     220             : // OOo 1.x entrance effects
     221             :     { AnimationEffect_APPEAR, "ooo-entrance-appear",0 },
     222             : 
     223             :     { AnimationEffect_FADE_TO_CENTER, "ooo-entrance-box","in" },
     224             :     { AnimationEffect_FADE_FROM_CENTER, "ooo-entrance-box","out" },
     225             : 
     226             :     { AnimationEffect_VERTICAL_CHECKERBOARD, "ooo-entrance-checkerboard","downward" },
     227             :     { AnimationEffect_HORIZONTAL_CHECKERBOARD, "ooo-entrance-checkerboard","across" },
     228             : 
     229             :     { AnimationEffect_FADE_FROM_UPPERLEFT, "ooo-entrance-diagonal-squares","right-to-bottom" },
     230             :     { AnimationEffect_FADE_FROM_UPPERRIGHT, "ooo-entrance-diagonal-squares","left-to-bottom" },
     231             :     { AnimationEffect_FADE_FROM_LOWERLEFT, "ooo-entrance-diagonal-squares","right-to-top" },
     232             :     { AnimationEffect_FADE_FROM_LOWERRIGHT, "ooo-entrance-diagonal-squares","left-to-top" },
     233             : 
     234             :     { AnimationEffect_DISSOLVE, "ooo-entrance-dissolve-in",0 },
     235             : 
     236             :     { AnimationEffect_MOVE_FROM_LEFT, "ooo-entrance-fly-in","from-left" },
     237             :     { AnimationEffect_MOVE_FROM_TOP, "ooo-entrance-fly-in","from-top" },
     238             :     { AnimationEffect_MOVE_FROM_RIGHT, "ooo-entrance-fly-in","from-right" },
     239             :     { AnimationEffect_MOVE_FROM_BOTTOM, "ooo-entrance-fly-in","from-bottom" },
     240             :     { AnimationEffect_MOVE_FROM_UPPERLEFT, "ooo-entrance-fly-in","from-top-left" },
     241             :     { AnimationEffect_MOVE_FROM_UPPERRIGHT, "ooo-entrance-fly-in","from-top-right" },
     242             :     { AnimationEffect_MOVE_FROM_LOWERRIGHT, "ooo-entrance-fly-in","from-bottom-right" },
     243             :     { AnimationEffect_MOVE_FROM_LOWERLEFT, "ooo-entrance-fly-in","from-bottom-left" },
     244             : 
     245             :     { AnimationEffect_MOVE_FROM_BOTTOM, "ooo-entrance-fly-in-slow", "from-bottom" },
     246             :     { AnimationEffect_MOVE_FROM_LEFT, "ooo-entrance-fly-in-slow", "from-left" },
     247             :     { AnimationEffect_MOVE_FROM_RIGHT, "ooo-entrance-fly-in-slow", "from-right" },
     248             :     { AnimationEffect_MOVE_FROM_TOP, "ooo-entrance-fly-in-slow", "from-top" },
     249             : 
     250             :     { AnimationEffect_MOVE_SHORT_FROM_LEFT, "ooo-entrance-peek-in","from-left" },
     251             :     { AnimationEffect_MOVE_SHORT_FROM_TOP, "ooo-entrance-peek-in","from-top" },
     252             :     { AnimationEffect_MOVE_SHORT_FROM_RIGHT, "ooo-entrance-peek-in","from-right" },
     253             :     { AnimationEffect_MOVE_SHORT_FROM_BOTTOM, "ooo-entrance-peek-in","from-bottom" },
     254             : 
     255             :     { AnimationEffect_VERTICAL_LINES, "ooo-entrance-random-bars","horizontal" },
     256             :     { AnimationEffect_HORIZONTAL_LINES, "ooo-entrance-random-bars","vertical" },
     257             : 
     258             :     { AnimationEffect_RANDOM, "ooo-entrance-random",0 },
     259             : 
     260             :     { AnimationEffect_CLOSE_VERTICAL, "ooo-entrance-split","horizontal-in" },
     261             :     { AnimationEffect_CLOSE_HORIZONTAL, "ooo-entrance-split","vertical-in" },
     262             :     { AnimationEffect_OPEN_VERTICAL, "ooo-entrance-split","horizontal-out" },
     263             :     { AnimationEffect_OPEN_HORIZONTAL, "ooo-entrance-split","vertical-out" },
     264             : 
     265             :     { AnimationEffect_VERTICAL_STRIPES, "ooo-entrance-venetian-blinds","horizontal" },
     266             :     { AnimationEffect_HORIZONTAL_STRIPES, "ooo-entrance-venetian-blinds","vertical" },
     267             : 
     268             :     { AnimationEffect_FADE_FROM_LEFT, "ooo-entrance-wipe","from-left" },
     269             :     { AnimationEffect_FADE_FROM_TOP, "ooo-entrance-wipe","from-bottom" },
     270             :     { AnimationEffect_FADE_FROM_RIGHT, "ooo-entrance-wipe","from-right" },
     271             :     { AnimationEffect_FADE_FROM_BOTTOM, "ooo-entrance-wipe","from-top" },
     272             : 
     273             :     { AnimationEffect_HORIZONTAL_ROTATE, "ooo-entrance-swivel","vertical" },
     274             :     { AnimationEffect_VERTICAL_ROTATE, "ooo-entrance-swivel","horizontal" },
     275             : 
     276             :     { AnimationEffect_STRETCH_FROM_LEFT, "ooo-entrance-stretchy","from-left" },
     277             :     { AnimationEffect_STRETCH_FROM_UPPERLEFT, "ooo-entrance-stretchy","from-top-left" },
     278             :     { AnimationEffect_STRETCH_FROM_TOP, "ooo-entrance-stretchy","from-top" },
     279             :     { AnimationEffect_STRETCH_FROM_UPPERRIGHT, "ooo-entrance-stretchy","from-top-right" },
     280             :     { AnimationEffect_STRETCH_FROM_RIGHT, "ooo-entrance-stretchy","from-right" },
     281             :     { AnimationEffect_STRETCH_FROM_LOWERRIGHT, "ooo-entrance-stretchy","from-bottom-right" },
     282             :     { AnimationEffect_STRETCH_FROM_BOTTOM, "ooo-entrance-stretchy","from-bottom" },
     283             :     { AnimationEffect_STRETCH_FROM_LOWERLEFT, "ooo-entrance-stretchy","from-bottom-left" },
     284             : 
     285             :     { AnimationEffect_HORIZONTAL_STRETCH, "ooo-entrance-expand", 0 },
     286             : 
     287             :     { AnimationEffect_CLOCKWISE, "ooo-entrance-wheel","1" },
     288             :     { AnimationEffect_COUNTERCLOCKWISE, "ooo-entrance-clock-wipe","counter-clockwise" },
     289             : 
     290             :     { AnimationEffect_SPIRALIN_LEFT, "ooo-entrance-spiral-wipe", "from-top-left-clockwise" },
     291             :     { AnimationEffect_SPIRALIN_RIGHT, "ooo-entrance-spiral-wipe", "from-top-right-counter-clockwise" },
     292             :     { AnimationEffect_SPIRALOUT_LEFT, "ooo-entrance-spiral-wipe", "from-center-clockwise" },
     293             :     { AnimationEffect_SPIRALOUT_RIGHT, "ooo-entrance-spiral-wipe", "from-center-counter-clockwise" },
     294             : 
     295             :     { AnimationEffect_WAVYLINE_FROM_LEFT, "ooo-entrance-snake-wipe","from-top-left-vertical" },
     296             :     { AnimationEffect_WAVYLINE_FROM_TOP, "ooo-entrance-snake-wipe","from-top-left-horizontal" },
     297             :     { AnimationEffect_WAVYLINE_FROM_RIGHT, "ooo-entrance-snake-wipe","from-bottom-right-vertical" },
     298             :     { AnimationEffect_WAVYLINE_FROM_BOTTOM, "ooo-entrance-snake-wipe","from-bottom-right-horizontal" },
     299             : 
     300             : // ooo 1.x exit effects
     301             :     { AnimationEffect_HIDE, "ooo-exit-disappear",0 },
     302             :     { AnimationEffect_MOVE_TO_LEFT, "ooo-exit-fly-out", "from-right" },
     303             :     { AnimationEffect_MOVE_TO_TOP, "ooo-exit-fly-out", "from-bottom" },
     304             :     { AnimationEffect_MOVE_TO_RIGHT, "ooo-exit-fly-out", "from-left" },
     305             :     { AnimationEffect_MOVE_TO_BOTTOM, "ooo-exit-fly-out", "from-top" },
     306             :     { AnimationEffect_MOVE_TO_UPPERLEFT, "ooo-exit-fly-out", "from-top-right" },
     307             :     { AnimationEffect_MOVE_TO_UPPERRIGHT, "ooo-exit-fly-out", "from-top-left" },
     308             :     { AnimationEffect_MOVE_TO_LOWERRIGHT, "ooo-exit-fly-out", "from-bottom-left" },
     309             :     { AnimationEffect_MOVE_TO_LOWERLEFT, "ooo-exit-fly-out", "from-bottom-right" },
     310             :     { AnimationEffect_MOVE_SHORT_TO_LEFT, "ooo-exit-peek-out", "from-right" },
     311             :     { AnimationEffect_MOVE_SHORT_TO_UPPERLEFT, "ooo-exit-peek-out", "from-right" },
     312             :     { AnimationEffect_MOVE_SHORT_TO_TOP, "ooo-exit-peek-out", "from-bottom" },
     313             :     { AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT, "ooo-exit-peek-out", "from-bottom" },
     314             :     { AnimationEffect_MOVE_SHORT_TO_RIGHT, "ooo-exit-peek-out", "from-left" },
     315             :     { AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT, "ooo-exit-peek-out","from-left" },
     316             :     { AnimationEffect_MOVE_SHORT_TO_BOTTOM, "ooo-exit-peek-out", "from-top" },
     317             :     { AnimationEffect_MOVE_SHORT_TO_LOWERLEFT, "ooo-exit-peek-out", "from-top" },
     318             : 
     319             : // no matching in OOo 2.x
     320             :     { AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT, "ooo-entrance-peek-in","from-left" },
     321             :     { AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT, "ooo-entrance-peek-in","from-top" },
     322             :     { AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT, "ooo-entrance-peek-in","from-right" },
     323             :     { AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT, "ooo-entrance-peek-in","from-bottom" },
     324             :     { AnimationEffect_LASER_FROM_LEFT, "ooo-entrance-fly-in","from-left" },
     325             :     { AnimationEffect_LASER_FROM_TOP, "ooo-entrance-fly-in","from-top" },
     326             :     { AnimationEffect_LASER_FROM_RIGHT, "ooo-entrance-fly-in","from-right" },
     327             :     { AnimationEffect_LASER_FROM_BOTTOM, "ooo-entrance-fly-in","from-bottom" },
     328             :     { AnimationEffect_LASER_FROM_UPPERLEFT, "ooo-entrance-fly-in","from-top-left" },
     329             :     { AnimationEffect_LASER_FROM_UPPERRIGHT, "ooo-entrance-fly-in","from-top-right" },
     330             :     { AnimationEffect_LASER_FROM_LOWERLEFT, "ooo-entrance-fly-in","from-bottom-left" },
     331             :     { AnimationEffect_LASER_FROM_LOWERRIGHT, "ooo-entrance-fly-in","from-bottom-right" },
     332             : 
     333             : // no matching in OOo 1.x
     334             : 
     335             :     { AnimationEffect_FADE_TO_CENTER, "ooo-entrance-circle", "in" },
     336             :     { AnimationEffect_FADE_FROM_CENTER, "ooo-entrance-circle", "out" },
     337             :     { AnimationEffect_FADE_TO_CENTER, "ooo-entrance-diamond", "in" },
     338             :     { AnimationEffect_FADE_FROM_CENTER, "ooo-entrance-diamond", "out" },
     339             :     { AnimationEffect_FADE_TO_CENTER, "ooo-entrance-plus", "in" },
     340             :     { AnimationEffect_FADE_FROM_CENTER, "ooo-entrance-plus", "out" },
     341             :     { AnimationEffect_CLOCKWISE, "ooo-entrance-wedge", 0 },
     342             :     { AnimationEffect_CLOCKWISE, "ooo-entrance-wheel", "2" },
     343             :     { AnimationEffect_CLOCKWISE, "ooo-entrance-wheel", "3" },
     344             :     { AnimationEffect_CLOCKWISE, "ooo-entrance-wheel", "4" },
     345             :     { AnimationEffect_CLOCKWISE, "ooo-entrance-wheel", "8" },
     346             : 
     347             :     { AnimationEffect_MOVE_FROM_RIGHT, "ooo-entrance-boomerang", 0 },
     348             :     { AnimationEffect_MOVE_FROM_UPPERRIGHT, "ooo-entrance-bounce", 0 },
     349             :     { AnimationEffect_MOVE_FROM_BOTTOM, "ooo-entrance-curve-up", 0 },
     350             :     { AnimationEffect_MOVE_FROM_TOP, "ooo-entrance-float", 0 },
     351             :     { AnimationEffect_MOVE_FROM_LEFT, "ooo-entrance-glide", 0 },
     352             :     { AnimationEffect_MOVE_FROM_BOTTOM, "ooo-entrance-magnify", 0 },
     353             :     { AnimationEffect_HORIZONTAL_ROTATE, "ooo-entrance-pinwheel", 0 },
     354             :     { AnimationEffect_MOVE_FROM_LEFT, "ooo-entrance-breaks", 0 },
     355             :     { AnimationEffect_MOVE_FROM_LEFT, "ooo-entrance-sling", 0 },
     356             :     { AnimationEffect_MOVE_FROM_LEFT, "ooo-entrance-spiral-in", 0 },
     357             :     { AnimationEffect_MOVE_FROM_LEFT, "ooo-entrance-thread", 0 },
     358             :     { AnimationEffect_MOVE_FROM_BOTTOM, "ooo-entrance-ascend", 0 },
     359             :     { AnimationEffect_MOVE_FROM_BOTTOM, "ooo-entrance-center-revolve", 0 },
     360             :     { AnimationEffect_APPEAR, "ooo-entrance-compress", 0 },
     361             :     { AnimationEffect_MOVE_SHORT_FROM_TOP, "ooo-entrance-descend", 0 },
     362             :     { AnimationEffect_MOVE_SHORT_FROM_LEFT, "ooo-entrance-ease-in", 0 },
     363             :     { AnimationEffect_MOVE_FROM_BOTTOM, "ooo-entrance-rise-up", 0 },
     364             :     { AnimationEffect_HORIZONTAL_ROTATE, "ooo-entrance-spin-in", 0 },
     365             :     { AnimationEffect_STRETCH_FROM_LEFT, "ooo-entrance-stretchy", "across" },
     366             :     { AnimationEffect_STRETCH_FROM_TOP, "ooo-entrance-stretchy", "downward" },
     367             : 
     368             :     { AnimationEffect_FADE_FROM_CENTER, "ooo-entrance-zoom","in" },
     369             :     { AnimationEffect_FADE_FROM_CENTER, "ooo-entrance-zoom","in-slightly" },
     370             :     { AnimationEffect_FADE_FROM_CENTER, "ooo-entrance-zoom","in-from-screen-center" },
     371             :     { AnimationEffect_FADE_TO_CENTER, "ooo-entrance-zoom","out" },
     372             :     { AnimationEffect_FADE_TO_CENTER, "ooo-entrance-zoom","out-slightly" },
     373             :     { AnimationEffect_FADE_TO_CENTER, "ooo-entrance-zoom","out-from-screen-center" },
     374             : 
     375             :     { AnimationEffect_DISSOLVE, "ooo-entrance-fade-in", 0 },
     376             :     { AnimationEffect_DISSOLVE, "ooo-entrance-fade-in-and-zoom", 0 },
     377             :     { AnimationEffect_DISSOLVE, "ooo-entrance-fade-in-and-swivel", 0 },
     378             : 
     379             :     // still open (no matching effect: AnimationEffect_ZOOM_IN_FROM_*,
     380             :     // AnimationEffect_ZOOM_OUT_FROM_*, AnimationEffect_PATH
     381             : 
     382             :     { AnimationEffect_NONE, 0, 0 }
     383             : };
     384             : 
     385           0 : EffectSequence::iterator ImplFindEffect( MainSequencePtr& pMainSequence, const Reference< XShape >& rShape, sal_Int16 nSubItem )
     386             : {
     387           0 :     EffectSequence::iterator aIter;
     388             : 
     389           0 :     for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
     390             :     {
     391           0 :         CustomAnimationEffectPtr pEffect( (*aIter) );
     392           0 :         if( (pEffect->getTargetShape() == rShape) && (pEffect->getTargetSubItem() == nSubItem) )
     393             :             break;
     394           0 :     }
     395             : 
     396           0 :     return aIter;
     397             : }
     398             : 
     399           0 : static bool implIsInsideGroup( SdrObject* pObj )
     400             : {
     401           0 :     return pObj && pObj->GetObjList() && pObj->GetObjList()->GetUpList();
     402             : }
     403             : 
     404           0 : void EffectMigration::SetAnimationEffect( SvxShape* pShape, AnimationEffect eEffect )
     405             : {
     406             :     DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
     407             :                 "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
     408           0 :     if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
     409             :         return;
     410             : 
     411           0 :     SdrObject* pObj = pShape->GetSdrObject();
     412           0 :     if( implIsInsideGroup( pObj ) )
     413             :         return;
     414             : 
     415           0 :     OUString aPresetId;
     416           0 :     OUString aPresetSubType;
     417             : 
     418           0 :     if( !ConvertAnimationEffect( eEffect, aPresetId, aPresetSubType ) )
     419             :     {
     420             :         OSL_FAIL( "sd::EffectMigration::SetAnimationEffect(), no mapping for given AnimationEffect value" );
     421             :         return;
     422             :     }
     423             : 
     424           0 :     const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets();
     425             : 
     426           0 :     CustomAnimationPresetPtr pPreset( rPresets.getEffectDescriptor( aPresetId ) );
     427           0 :     sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
     428             : 
     429           0 :     if( pPreset.get() && pMainSequence.get() )
     430             :     {
     431           0 :         const Reference< XShape > xShape( pShape );
     432             : 
     433           0 :         EffectSequence::iterator aIterOnlyBackground( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_BACKGROUND ) );
     434           0 :         EffectSequence::iterator aIterAsWhole( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::AS_WHOLE ) );
     435           0 :         const EffectSequence::iterator aEnd( pMainSequence->getEnd() );
     436             : 
     437           0 :         bool bEffectCreated = false;
     438             : 
     439           0 :         if( (aIterOnlyBackground == aEnd) && (aIterAsWhole == aEnd) )
     440             :         {
     441             :             // check if there is already an text effect for this shape
     442           0 :             EffectSequence::iterator aIterOnlyText( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_TEXT ) );
     443           0 :             if( aIterOnlyText != aEnd )
     444             :             {
     445             :                 // check if this is an animation text group
     446           0 :                 sal_Int32 nGroupId = (*aIterOnlyText)->getGroupId();
     447           0 :                 if( nGroupId >= 0 )
     448             :                 {
     449           0 :                     CustomAnimationTextGroupPtr pGroup = pMainSequence->findGroup( nGroupId );
     450           0 :                     if( pGroup.get() )
     451             :                     {
     452             :                         // add an effect to animate the shape
     453           0 :                         pMainSequence->setAnimateForm( pGroup, true );
     454             : 
     455             :                         // find this effect
     456           0 :                         EffectSequence::iterator aIter( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_BACKGROUND ) );
     457             : 
     458           0 :                         if( aIter != aEnd )
     459             :                         {
     460           0 :                             if( ((*aIter)->getPresetId() != aPresetId) ||
     461           0 :                                 ((*aIter)->getPresetSubType() != aPresetSubType) )
     462             :                             {
     463           0 :                                 (*aIter)->replaceNode( pPreset->create( aPresetSubType ) );
     464           0 :                                 pMainSequence->rebuild();
     465           0 :                                 bEffectCreated = true;
     466             :                             }
     467             :                         }
     468           0 :                     }
     469             :                 }
     470             :             }
     471             : 
     472           0 :             if( !bEffectCreated )
     473             :             {
     474             :                 // if there is not yet an effect that target this shape, we generate one
     475             :                 // we insert the shape effect before it
     476           0 :                 Reference< XAnimationNode > xNode( pPreset->create( aPresetSubType ) );
     477             :                 DBG_ASSERT( xNode.is(), "EffectMigration::SetAnimationEffect(), could not create preset!" );
     478           0 :                 if( xNode.is() )
     479             :                 {
     480           0 :                     CustomAnimationEffectPtr pEffect( new CustomAnimationEffect( xNode ) );
     481           0 :                     pEffect->setTarget( makeAny( xShape ) );
     482           0 :                     SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
     483           0 :                     const bool bManual = (pPage == 0) || (pPage->GetPresChange() == PRESCHANGE_MANUAL);
     484           0 :                     if( !bManual )
     485           0 :                         pEffect->setNodeType( EffectNodeType::AFTER_PREVIOUS );
     486             : 
     487           0 :                     pMainSequence->append( pEffect );
     488             : 
     489           0 :                     if( ( pObj->GetObjInventor() == SdrInventor ) && ( pObj->GetObjIdentifier() == OBJ_OUTLINETEXT ) )
     490             :                     {
     491             :                         // special case for outline text, effects are always mapped to text group effect
     492           0 :                         pMainSequence->
     493           0 :                             createTextGroup( pEffect, 10, bManual ? -1 : 0.0, sal_False, sal_False );
     494           0 :                     }
     495           0 :                 }
     496             :             }
     497             :         }
     498             :         else
     499             :         {
     500             :             // if there is already an effect targeting this shape
     501             :             // just replace it
     502           0 :             CustomAnimationEffectPtr pEffect;
     503           0 :             if( aIterAsWhole != aEnd )
     504             :             {
     505           0 :                 pEffect = (*aIterAsWhole);
     506             :             }
     507             :             else
     508             :             {
     509           0 :                 pEffect = (*aIterOnlyBackground);
     510             :             }
     511             : 
     512           0 :             if( pEffect.get() )
     513             :             {
     514           0 :                 if( (pEffect->getPresetId() != aPresetId) ||
     515           0 :                     (pEffect->getPresetSubType() != aPresetSubType) )
     516             :                 {
     517           0 :                     pMainSequence->replace( pEffect, pPreset, aPresetSubType );
     518             :                 }
     519           0 :             }
     520           0 :         }
     521           0 :     }
     522             : }
     523             : 
     524             : // --------------------------------------------------------------------
     525             : 
     526           0 : AnimationEffect EffectMigration::GetAnimationEffect( SvxShape* pShape )
     527             : {
     528           0 :     OUString aPresetId;
     529           0 :     OUString aPresetSubType;
     530             : 
     531           0 :     SdrObject* pObj = pShape->GetSdrObject();
     532           0 :     sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
     533             : 
     534           0 :     if( pMainSequence.get() )
     535             :     {
     536           0 :         const Reference< XShape > xShape( pShape );
     537             : 
     538           0 :         EffectSequence::iterator aIter;
     539             : 
     540           0 :         for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
     541             :         {
     542           0 :             CustomAnimationEffectPtr pEffect( (*aIter) );
     543           0 :             if( pEffect->getTargetShape() == xShape )
     544             :             {
     545           0 :                 if( (pEffect->getTargetSubItem() == ShapeAnimationSubType::ONLY_BACKGROUND) ||
     546           0 :                     (pEffect->getTargetSubItem() == ShapeAnimationSubType::AS_WHOLE))
     547             :                 {
     548           0 :                     if( pEffect->getDuration() != 0.1 ) // ignore appear effects created from old text effect import
     549             :                     {
     550           0 :                         aPresetId = (*aIter)->getPresetId();
     551           0 :                         aPresetSubType = (*aIter)->getPresetSubType();
     552             :                         break;
     553             :                     }
     554             :                 }
     555             :             }
     556           0 :         }
     557             :     }
     558             : 
     559             :     // now find old effect
     560           0 :     AnimationEffect eEffect = AnimationEffect_NONE;
     561             : 
     562           0 :     if( !ConvertPreset( aPresetId, &aPresetSubType, eEffect ) )
     563           0 :         ConvertPreset( aPresetId, 0, eEffect );
     564             : 
     565           0 :     return eEffect;
     566             : }
     567             : 
     568             : 
     569             : // --------------------------------------------------------------------
     570             : 
     571           0 : void EffectMigration::SetTextAnimationEffect( SvxShape* pShape, AnimationEffect eEffect )
     572             : {
     573             :     DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
     574             :                 "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
     575           0 :     if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
     576             :         return;
     577             : 
     578           0 :     SdrObject* pObj = pShape->GetSdrObject();
     579           0 :     if( implIsInsideGroup( pObj ) )
     580             :         return;
     581             : 
     582             :     // first map the deprecated AnimationEffect to a preset and subtype
     583           0 :     OUString aPresetId;
     584           0 :     OUString aPresetSubType;
     585             : 
     586           0 :     if( !ConvertAnimationEffect( eEffect, aPresetId, aPresetSubType ) )
     587             :     {
     588             :         OSL_FAIL( "sd::EffectMigration::SetAnimationEffect(), no mapping for given AnimationEffect value" );
     589             :         return;
     590             :     }
     591             : 
     592           0 :     SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
     593             : 
     594             :     // ignore old text effects on shape without text
     595           0 :     if( (pTextObj == 0) || (!pTextObj->HasText()) )
     596             :         return;
     597             : 
     598           0 :     const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets();
     599             : 
     600             :     // create an effect from this preset
     601           0 :     CustomAnimationPresetPtr pPreset( rPresets.getEffectDescriptor( aPresetId ) );
     602             : 
     603           0 :     sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
     604             : 
     605           0 :     if( pPreset.get() && pMainSequence.get() )
     606             :     {
     607           0 :         const Reference< XShape > xShape( pShape );
     608             : 
     609           0 :         EffectSequence::iterator aIterOnlyText( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_TEXT ) );
     610           0 :         const EffectSequence::iterator aEnd( pMainSequence->getEnd() );
     611             : 
     612           0 :         CustomAnimationTextGroupPtr pGroup;
     613             : 
     614             :         // is there already an animation text group for this shape?
     615           0 :         if( aIterOnlyText != aEnd )
     616             :         {
     617           0 :             const sal_Int32 nGroupId = (*aIterOnlyText)->getGroupId();
     618           0 :             if( nGroupId >= 0 )
     619           0 :                 pGroup = pMainSequence->findGroup( nGroupId );
     620             :         }
     621             : 
     622             :         // if there is not yet a group, create it
     623           0 :         if( pGroup.get() == 0 )
     624             :         {
     625           0 :             CustomAnimationEffectPtr pShapeEffect;
     626             : 
     627           0 :             EffectSequence::iterator aIterOnlyBackground( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_BACKGROUND ) );
     628           0 :             if( aIterOnlyBackground != aEnd )
     629             :             {
     630           0 :                 pShapeEffect = (*aIterOnlyBackground);
     631             :             }
     632             :             else
     633             :             {
     634           0 :                 EffectSequence::iterator aIterAsWhole( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::AS_WHOLE ) );
     635           0 :                 if( aIterAsWhole != aEnd )
     636             :                 {
     637           0 :                     pShapeEffect = (*aIterAsWhole);
     638             :                 }
     639             :                 else
     640             :                 {
     641           0 :                     OUString aEmpty;
     642           0 :                     CustomAnimationPresetPtr pShapePreset( rPresets.getEffectDescriptor( "ooo-entrance-appear" ) );
     643             : 
     644           0 :                     Reference< XAnimationNode > xNode( pPreset->create( aEmpty ) );
     645             :                     DBG_ASSERT( xNode.is(), "EffectMigration::SetTextAnimationEffect(), could not create preset!" );
     646           0 :                     if( xNode.is() )
     647             :                     {
     648           0 :                         pShapeEffect.reset( new CustomAnimationEffect( xNode ) );
     649           0 :                         pShapeEffect->setTarget( makeAny( xShape ) );
     650           0 :                         pShapeEffect->setDuration( 0.1 );
     651           0 :                         pMainSequence->append( pShapeEffect );
     652             : 
     653           0 :                         SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
     654           0 :                         if( pPage && pPage->GetPresChange() != PRESCHANGE_MANUAL )
     655           0 :                             pShapeEffect->setNodeType( EffectNodeType::AFTER_PREVIOUS );
     656           0 :                     }
     657             :                 }
     658             :             }
     659             : 
     660           0 :             if( pShapeEffect.get() )
     661             :             {
     662           0 :                 SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
     663           0 :                 const bool bManual = (pPage == 0) || (pPage->GetPresChange() == PRESCHANGE_MANUAL);
     664             : 
     665             :                 // now create effects for each paragraph
     666             :                 pGroup =
     667           0 :                     pMainSequence->
     668           0 :                         createTextGroup( pShapeEffect, 10, bManual ? -1 : 0.0, sal_True, sal_False );
     669           0 :             }
     670             :         }
     671             : 
     672           0 :         if( pGroup.get() != 0 )
     673             :         {
     674           0 :             const bool bLaserEffect = (eEffect >= AnimationEffect_LASER_FROM_LEFT) && (eEffect <= AnimationEffect_LASER_FROM_LOWERRIGHT);
     675             : 
     676             :             // now we have a group, so check if all effects are same as we like to have them
     677           0 :             const EffectSequence& rEffects = pGroup->getEffects();
     678             : 
     679           0 :             EffectSequence::const_iterator aIter;
     680           0 :             for( aIter = rEffects.begin(); aIter != rEffects.end(); ++aIter )
     681             :             {
     682             :                 // only work on paragraph targets
     683           0 :                 if( (*aIter)->getTarget().getValueType() == ::getCppuType((const ParagraphTarget*)0) )
     684             :                 {
     685           0 :                     if( ((*aIter)->getPresetId() != aPresetId) ||
     686           0 :                         ((*aIter)->getPresetSubType() != aPresetSubType) )
     687             :                     {
     688           0 :                         (*aIter)->replaceNode( pPreset->create( aPresetSubType ) );
     689             :                     }
     690             : 
     691           0 :                     if( bLaserEffect )
     692             :                     {
     693           0 :                         (*aIter)->setIterateType( TextAnimationType::BY_LETTER );
     694           0 :                         (*aIter)->setIterateInterval( 0.5 );// TODO:
     695             :                                                              // Determine
     696             :                                                              // interval
     697             :                                                              // according
     698             :                                                              // to
     699             :                                                              // total
     700             :                                                              // effect
     701             :                                                              // duration
     702             :                     }
     703             :                 }
     704             :             }
     705             :         }
     706           0 :         pMainSequence->rebuild();
     707           0 :     }
     708             : }
     709             : 
     710             : // --------------------------------------------------------------------
     711             : 
     712           0 : AnimationEffect EffectMigration::GetTextAnimationEffect( SvxShape* pShape )
     713             : {
     714           0 :     OUString aPresetId;
     715           0 :     OUString aPresetSubType;
     716             : 
     717           0 :     SdrObject* pObj = pShape->GetSdrObject();
     718           0 :     if( pObj )
     719             :     {
     720           0 :         sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
     721             : 
     722           0 :         if( pMainSequence.get() )
     723             :         {
     724           0 :             const Reference< XShape > xShape( pShape );
     725           0 :             EffectSequence::iterator aIter( ImplFindEffect( pMainSequence, xShape, ShapeAnimationSubType::ONLY_TEXT ) );
     726           0 :             if( aIter != pMainSequence->getEnd() )
     727             :             {
     728           0 :                 aPresetId = (*aIter)->getPresetId();
     729           0 :                 aPresetSubType = (*aIter)->getPresetSubType();
     730           0 :             }
     731           0 :         }
     732             :     }
     733             : 
     734             :     // now find old effect
     735           0 :     AnimationEffect eEffect = AnimationEffect_NONE;
     736             : 
     737           0 :     if( !ConvertPreset( aPresetId, &aPresetSubType, eEffect ) )
     738           0 :         ConvertPreset( aPresetId, 0, eEffect );
     739             : 
     740           0 :     return eEffect;
     741             : }
     742             : 
     743             : // --------------------------------------------------------------------
     744             : 
     745           0 : bool EffectMigration::ConvertPreset( const OUString& rPresetId, const OUString* pPresetSubType, AnimationEffect& rEffect )
     746             : {
     747           0 :     rEffect = AnimationEffect_NONE;
     748           0 :     if( !rPresetId.isEmpty() )
     749             :     {
     750             :         // first try a match for preset id and subtype
     751           0 :         deprecated_AnimationEffect_conversion_table_entry* p = deprecated_AnimationEffect_conversion_table;
     752           0 :         while( p->mpPresetId )
     753             :         {
     754           0 :             if( rPresetId.equalsAscii( p->mpPresetId ) &&
     755             :                 (( p->mpPresetSubType == 0 ) ||
     756             :                  ( pPresetSubType == 0) ||
     757           0 :                  ( pPresetSubType->equalsAscii( p->mpPresetSubType )) ) )
     758             :             {
     759           0 :                 rEffect = p->meEffect;
     760           0 :                 return true;
     761             :             }
     762           0 :             p++;
     763             :         }
     764           0 :         return false;
     765             :     }
     766             :     else
     767             :     {
     768             :         // empty preset id means AnimationEffect_NONE
     769           0 :         return true;
     770             :     }
     771             : }
     772             : 
     773             : // --------------------------------------------------------------------
     774             : 
     775           0 : bool EffectMigration::ConvertAnimationEffect( const AnimationEffect& rEffect, OUString& rPresetId, OUString& rPresetSubType )
     776             : {
     777           0 :     deprecated_AnimationEffect_conversion_table_entry* p = deprecated_AnimationEffect_conversion_table;
     778           0 :     while( p->mpPresetId )
     779             :     {
     780           0 :         if( p->meEffect == rEffect )
     781             :         {
     782           0 :             rPresetId = OUString::createFromAscii( p->mpPresetId );
     783           0 :             rPresetSubType = OUString::createFromAscii( p->mpPresetSubType );
     784           0 :             return true;
     785             :         }
     786           0 :         p++;
     787             :     }
     788             : 
     789           0 :     return false;
     790             : }
     791             : 
     792             : // --------------------------------------------------------------------
     793             : 
     794           0 : double EffectMigration::ConvertAnimationSpeed( AnimationSpeed eSpeed )
     795             : {
     796             :     double fDuration;
     797           0 :     switch( eSpeed )
     798             :     {
     799           0 :     case AnimationSpeed_SLOW: fDuration = 2.0; break;
     800           0 :     case AnimationSpeed_FAST: fDuration = 0.5; break;
     801             :     default:
     802           0 :         fDuration = 1.0; break;
     803             :     }
     804           0 :     return fDuration;
     805             : }
     806             : // --------------------------------------------------------------------
     807             : 
     808           0 : void EffectMigration::SetAnimationSpeed( SvxShape* pShape, AnimationSpeed eSpeed )
     809             : {
     810             :     DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
     811             :                 "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
     812           0 :     if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
     813             :         return;
     814             : 
     815           0 :     SdrObject* pObj = pShape->GetSdrObject();
     816           0 :     if( implIsInsideGroup( pObj ) )
     817             :         return;
     818             : 
     819           0 :     double fDuration = ConvertAnimationSpeed( eSpeed );
     820             : 
     821           0 :     sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
     822             : 
     823           0 :     const Reference< XShape > xShape( pShape );
     824             : 
     825           0 :     EffectSequence::iterator aIter;
     826           0 :     bool bNeedRebuild = false;
     827             : 
     828           0 :     for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
     829             :     {
     830           0 :         CustomAnimationEffectPtr pEffect( (*aIter) );
     831           0 :         if( pEffect->getTargetShape() == xShape )
     832             :         {
     833           0 :             if( pEffect->getDuration() != 0.1 )
     834           0 :                 pEffect->setDuration( fDuration );
     835           0 :             bNeedRebuild = true;
     836             :         }
     837           0 :     }
     838             : 
     839           0 :     if( bNeedRebuild )
     840           0 :         pMainSequence->rebuild();
     841             : }
     842             : 
     843             : // --------------------------------------------------------------------
     844             : 
     845           0 : AnimationSpeed EffectMigration::GetAnimationSpeed( SvxShape* pShape )
     846             : {
     847           0 :     SdrObject* pObj = pShape->GetSdrObject();
     848           0 :     sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
     849             : 
     850           0 :     const Reference< XShape > xShape( pShape );
     851             : 
     852           0 :     EffectSequence::iterator aIter;
     853             : 
     854           0 :     double fDuration = 1.0;
     855             : 
     856           0 :     for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
     857             :     {
     858           0 :         CustomAnimationEffectPtr pEffect( (*aIter) );
     859           0 :         if( pEffect->getTargetShape() == xShape )
     860             :         {
     861           0 :             if( pEffect->getDuration() != 0.1 )
     862             :             {
     863           0 :                 fDuration = pEffect->getDuration();
     864             :                 break;
     865             :             }
     866             :         }
     867           0 :     }
     868             : 
     869           0 :     return ConvertDuration( fDuration );
     870             : }
     871             : 
     872             : // --------------------------------------------------------------------
     873             : 
     874           0 : AnimationSpeed EffectMigration::ConvertDuration( double fDuration )
     875             : {
     876             :     AnimationSpeed eSpeed;
     877             : 
     878           0 :     if( fDuration < 1.0 )
     879           0 :         eSpeed = AnimationSpeed_FAST;
     880           0 :     else if( fDuration > 1.5 )
     881           0 :         eSpeed = AnimationSpeed_SLOW;
     882             :     else
     883           0 :         eSpeed = AnimationSpeed_MEDIUM;
     884             : 
     885           0 :     return eSpeed;
     886             : }
     887             : 
     888             : // --------------------------------------------------------------------
     889             : 
     890           0 : void EffectMigration::SetDimColor( SvxShape* pShape, sal_Int32 nColor )
     891             : {
     892             :     DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
     893             :                 "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
     894           0 :     if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
     895             :         return;
     896             : 
     897           0 :     SdrObject* pObj = pShape->GetSdrObject();
     898           0 :     if( implIsInsideGroup( pObj ) )
     899             :         return;
     900             : 
     901           0 :     sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
     902             : 
     903           0 :     const Reference< XShape > xShape( pShape );
     904             : 
     905           0 :     EffectSequence::iterator aIter;
     906           0 :     bool bNeedRebuild = false;
     907             : 
     908           0 :     for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
     909             :     {
     910           0 :         CustomAnimationEffectPtr pEffect( (*aIter) );
     911           0 :         if( pEffect->getTargetShape() == xShape )
     912             :         {
     913           0 :             pEffect->setHasAfterEffect( true );
     914           0 :             pEffect->setDimColor( makeAny( nColor ) );
     915           0 :             pEffect->setAfterEffectOnNext( true );
     916           0 :             bNeedRebuild = true;
     917             :         }
     918           0 :     }
     919             : 
     920           0 :     if( bNeedRebuild )
     921           0 :         pMainSequence->rebuild();
     922             : }
     923             : 
     924             : // --------------------------------------------------------------------
     925             : 
     926           0 : sal_Int32 EffectMigration::GetDimColor( SvxShape* pShape )
     927             : {
     928           0 :     sal_Int32 nColor = 0;
     929           0 :     if( pShape )
     930             :     {
     931           0 :         SdrObject* pObj = pShape->GetSdrObject();
     932           0 :         if( pObj && pObj->GetPage() )
     933             :         {
     934           0 :             sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
     935             : 
     936           0 :             const Reference< XShape > xShape( pShape );
     937           0 :             EffectSequence::iterator aIter;
     938             : 
     939           0 :             for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
     940             :             {
     941           0 :                 CustomAnimationEffectPtr pEffect( (*aIter) );
     942           0 :                 if( (pEffect->getTargetShape() == xShape) &&
     943           0 :                     pEffect->getDimColor().hasValue() &&
     944           0 :                     pEffect->hasAfterEffect())
     945             :                 {
     946           0 :                     pEffect->getDimColor() >>= nColor;
     947             :                     break;
     948             :                 }
     949           0 :             }
     950             :         }
     951             :     }
     952             : 
     953           0 :     return nColor;
     954             : }
     955             : 
     956             : // --------------------------------------------------------------------
     957             : 
     958             : 
     959           0 : void EffectMigration::SetDimHide( SvxShape* pShape, sal_Bool bDimHide )
     960             : {
     961             :     DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
     962             :                 "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
     963           0 :     if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
     964             :         return;
     965             : 
     966           0 :     SdrObject* pObj = pShape->GetSdrObject();
     967           0 :     if( implIsInsideGroup( pObj ) )
     968             :         return;
     969             : 
     970           0 :     sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
     971             : 
     972           0 :     const Reference< XShape > xShape( pShape );
     973             : 
     974           0 :     EffectSequence::iterator aIter;
     975           0 :     bool bNeedRebuild = false;
     976             : 
     977           0 :     for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
     978             :     {
     979           0 :         CustomAnimationEffectPtr pEffect( (*aIter) );
     980           0 :         if( pEffect->getTargetShape() == xShape )
     981             :         {
     982           0 :             pEffect->setHasAfterEffect( bDimHide ? true : false );
     983           0 :             if( bDimHide ) {
     984           0 :                 Any aEmpty;
     985           0 :                 pEffect->setDimColor( aEmpty );
     986             :             }
     987           0 :             pEffect->setAfterEffectOnNext( false );
     988           0 :             bNeedRebuild = true;
     989             :         }
     990           0 :     }
     991             : 
     992           0 :     if( bNeedRebuild )
     993           0 :         pMainSequence->rebuild();
     994             : }
     995             : 
     996             : // --------------------------------------------------------------------
     997             : 
     998           0 : sal_Bool EffectMigration::GetDimHide( SvxShape* pShape )
     999             : {
    1000           0 :     sal_Bool bRet = sal_False;
    1001           0 :     if( pShape )
    1002             :     {
    1003           0 :         SdrObject* pObj = pShape->GetSdrObject();
    1004           0 :         if( pObj && pObj->GetPage() )
    1005             :         {
    1006           0 :             sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    1007             : 
    1008           0 :             const Reference< XShape > xShape( pShape );
    1009             : 
    1010           0 :             EffectSequence::iterator aIter;
    1011           0 :             for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
    1012             :             {
    1013           0 :                 CustomAnimationEffectPtr pEffect( (*aIter) );
    1014           0 :                 if( pEffect->getTargetShape() == xShape )
    1015             :                 {
    1016           0 :                     bRet = pEffect->hasAfterEffect() &&
    1017           0 :                             !pEffect->getDimColor().hasValue() &&
    1018           0 :                             (!pEffect->IsAfterEffectOnNext());
    1019             :                     break;
    1020             :                 }
    1021           0 :             }
    1022             :         }
    1023             :     }
    1024             : 
    1025           0 :     return bRet;
    1026             : }
    1027             : 
    1028             : // --------------------------------------------------------------------
    1029             : 
    1030           0 : void EffectMigration::SetDimPrevious( SvxShape* pShape, sal_Bool bDimPrevious )
    1031             : {
    1032             :     DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
    1033             :                 "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
    1034           0 :     if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
    1035             :         return;
    1036             : 
    1037           0 :     SdrObject* pObj = pShape->GetSdrObject();
    1038           0 :     if( implIsInsideGroup( pObj ) )
    1039             :         return;
    1040             : 
    1041           0 :     Any aColor;
    1042             : 
    1043           0 :     if( bDimPrevious )
    1044           0 :         aColor <<= (sal_Int32)COL_LIGHTGRAY;
    1045             : 
    1046           0 :     sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    1047             : 
    1048           0 :     const Reference< XShape > xShape( pShape );
    1049             : 
    1050           0 :     EffectSequence::iterator aIter;
    1051           0 :     bool bNeedRebuild = false;
    1052             : 
    1053           0 :     for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
    1054             :     {
    1055           0 :         CustomAnimationEffectPtr pEffect( (*aIter) );
    1056           0 :         if( pEffect->getTargetShape() == xShape )
    1057             :         {
    1058           0 :             pEffect->setHasAfterEffect( bDimPrevious );
    1059           0 :             if( !bDimPrevious || !pEffect->getDimColor().hasValue() )
    1060           0 :                 pEffect->setDimColor( aColor );
    1061           0 :             pEffect->setAfterEffectOnNext( true );
    1062           0 :             bNeedRebuild = true;
    1063             :         }
    1064           0 :     }
    1065             : 
    1066           0 :     if( bNeedRebuild )
    1067           0 :         pMainSequence->rebuild();
    1068             : }
    1069             : 
    1070             : // --------------------------------------------------------------------
    1071             : 
    1072           0 : sal_Bool EffectMigration::GetDimPrevious( SvxShape* pShape )
    1073             : {
    1074           0 :     sal_Bool bRet = sal_False;
    1075           0 :     if( pShape )
    1076             :     {
    1077           0 :         SdrObject* pObj = pShape->GetSdrObject();
    1078           0 :         if( pObj && pObj->GetPage() )
    1079             :         {
    1080           0 :             sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    1081             : 
    1082           0 :             const Reference< XShape > xShape( pShape );
    1083             : 
    1084           0 :             EffectSequence::iterator aIter;
    1085           0 :             for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
    1086             :             {
    1087           0 :                 CustomAnimationEffectPtr pEffect( (*aIter) );
    1088           0 :                 if( pEffect->getTargetShape() == xShape )
    1089             :                 {
    1090           0 :                     bRet = pEffect->hasAfterEffect() &&
    1091           0 :                             pEffect->getDimColor().hasValue() &&
    1092           0 :                             pEffect->IsAfterEffectOnNext();
    1093             :                     break;
    1094             :                 }
    1095           0 :             }
    1096             :         }
    1097             :     }
    1098             : 
    1099           0 :     return bRet;
    1100             : }
    1101             : 
    1102             : // --------------------------------------------------------------------
    1103             : 
    1104           0 : void EffectMigration::SetPresentationOrder( SvxShape* pShape, sal_Int32 nNewPos )
    1105             : {
    1106           0 :     if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
    1107             :         return;
    1108             : 
    1109           0 :     SdrObject* pObj = pShape->GetSdrObject();
    1110           0 :     sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    1111             : 
    1112           0 :     EffectSequence& rSequence = pMainSequence->getSequence();
    1113             :     sal_Int32 nPos;
    1114           0 :     sal_Int32 nCurrentPos = -1;
    1115           0 :     std::vector< std::vector< EffectSequence::iterator > > aEffectVector(1);
    1116             : 
    1117           0 :     if( !rSequence.empty() )
    1118             :     {
    1119           0 :         Reference< XShape > xThis( pShape );
    1120           0 :         Reference< XShape > xCurrent;
    1121             : 
    1122           0 :         EffectSequence::iterator aIter( rSequence.begin() );
    1123           0 :         EffectSequence::iterator aEnd( rSequence.end() );
    1124           0 :         for( nPos = 0; aIter != aEnd; ++aIter )
    1125             :         {
    1126           0 :             CustomAnimationEffectPtr pEffect = (*aIter);
    1127             : 
    1128           0 :             if( !xCurrent.is() )
    1129             :             {
    1130           0 :                 xCurrent = pEffect->getTargetShape();
    1131             :             }
    1132           0 :             else if( pEffect->getTargetShape() != xCurrent )
    1133             :             {
    1134           0 :                 nPos++;
    1135           0 :                 xCurrent = pEffect->getTargetShape();
    1136           0 :                 aEffectVector.resize( nPos+1 );
    1137             :             }
    1138             : 
    1139             :             // is this the first effect for xThis shape?
    1140           0 :             if(( nCurrentPos == -1 ) && ( xCurrent == xThis ) )
    1141             :             {
    1142           0 :                 nCurrentPos = nPos;
    1143             :             }
    1144             : 
    1145           0 :             aEffectVector[nPos].push_back( aIter );
    1146           0 :         }
    1147             :     }
    1148             : 
    1149             :     // check if there is at least one effect for xThis
    1150           0 :     if( nCurrentPos == -1 )
    1151             :     {
    1152             :         OSL_FAIL("sd::EffectMigration::SetPresentationOrder() failed cause this shape has no effect" );
    1153             :         return;
    1154             :     }
    1155             : 
    1156             :     // check trivial case
    1157           0 :     if( nCurrentPos != nNewPos )
    1158             :     {
    1159           0 :         std::vector< CustomAnimationEffectPtr > aEffects;
    1160             : 
    1161           0 :         std::vector< EffectSequence::iterator >::iterator aIter( aEffectVector[nCurrentPos].begin() );
    1162           0 :         std::vector< EffectSequence::iterator >::iterator aEnd( aEffectVector[nCurrentPos].end() );
    1163           0 :         while( aIter != aEnd )
    1164             :         {
    1165           0 :             aEffects.push_back( (*(*aIter)) );
    1166           0 :             rSequence.erase( (*aIter++) );
    1167             :         }
    1168             : 
    1169           0 :         if( nNewPos > nCurrentPos )
    1170           0 :             nNewPos++;
    1171             : 
    1172           0 :         std::vector< CustomAnimationEffectPtr >::iterator aTempIter( aEffects.begin() );
    1173           0 :         std::vector< CustomAnimationEffectPtr >::iterator aTempEnd( aEffects.end() );
    1174             : 
    1175           0 :         if( nNewPos == (sal_Int32)aEffectVector.size() )
    1176             :         {
    1177           0 :             while( aTempIter != aTempEnd )
    1178             :             {
    1179           0 :                 rSequence.push_back( (*aTempIter++) );
    1180             :             }
    1181             :         }
    1182             :         else
    1183             :         {
    1184           0 :             EffectSequence::iterator aPos( aEffectVector[nNewPos][0] );
    1185           0 :             while( aTempIter != aTempEnd )
    1186             :             {
    1187           0 :                 rSequence.insert( aPos, (*aTempIter++) );
    1188             :             }
    1189           0 :         }
    1190           0 :     }
    1191             : }
    1192             : 
    1193             : // --------------------------------------------------------------------
    1194             : 
    1195             : /** Returns the position of the given SdrObject in the Presentation order.
    1196             :  *  This function returns -1 if the SdrObject is not in the Presentation order
    1197             :  *  or if its the path-object.
    1198             :  */
    1199           0 : sal_Int32 EffectMigration::GetPresentationOrder( SvxShape* pShape )
    1200             : {
    1201           0 :     sal_Int32 nPos = -1, nFound = -1;
    1202             : 
    1203           0 :     SdrObject* pObj = pShape->GetSdrObject();
    1204           0 :     sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    1205             : 
    1206           0 :     EffectSequence& rSequence = pMainSequence->getSequence();
    1207             : 
    1208           0 :     Reference< XShape > xThis( pShape );
    1209           0 :     Reference< XShape > xCurrent;
    1210             : 
    1211           0 :     EffectSequence::iterator aIter( rSequence.begin() );
    1212           0 :     EffectSequence::iterator aEnd( rSequence.end() );
    1213           0 :     for( ; aIter != aEnd; ++aIter )
    1214             :     {
    1215           0 :         CustomAnimationEffectPtr pEffect = (*aIter);
    1216             : 
    1217           0 :         if( !xCurrent.is() || pEffect->getTargetShape() != xCurrent )
    1218             :         {
    1219           0 :             nPos++;
    1220           0 :             xCurrent = pEffect->getTargetShape();
    1221             : 
    1222             :             // is this the first effect for xThis shape?
    1223           0 :             if( xCurrent == xThis )
    1224             :             {
    1225           0 :                 nFound = nPos;
    1226             :                 break;
    1227             :             }
    1228             :         }
    1229           0 :     }
    1230             : 
    1231           0 :     return nFound;
    1232             : }
    1233             : 
    1234             : // --------------------------------------------------------------------
    1235             : 
    1236           0 : void EffectMigration::UpdateSoundEffect( SvxShape* pShape, SdAnimationInfo* pInfo )
    1237             : {
    1238           0 :     if( pInfo )
    1239             :     {
    1240           0 :         SdrObject* pObj = pShape->GetSdrObject();
    1241           0 :         sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    1242             : 
    1243           0 :         const Reference< XShape > xShape( pShape );
    1244             : 
    1245           0 :         EffectSequence::iterator aIter;
    1246           0 :         bool bNeedRebuild = false;
    1247             : 
    1248           0 :         OUString aSoundFile;
    1249           0 :         if( pInfo->mbSoundOn )
    1250           0 :             aSoundFile = pInfo->maSoundFile;
    1251             : 
    1252           0 :         for( aIter = pMainSequence->getBegin(); aIter != pMainSequence->getEnd(); ++aIter )
    1253             :         {
    1254           0 :             CustomAnimationEffectPtr pEffect( (*aIter) );
    1255           0 :             if( pEffect->getTargetShape() == xShape )
    1256             :             {
    1257           0 :                 if( !aSoundFile.isEmpty() )
    1258             :                 {
    1259           0 :                     pEffect->createAudio( makeAny( aSoundFile ) );
    1260             :                 }
    1261             :                 else
    1262             :                 {
    1263           0 :                     pEffect->removeAudio();
    1264             :                 }
    1265           0 :                 bNeedRebuild = true;
    1266             :             }
    1267           0 :         }
    1268             : 
    1269           0 :         if( bNeedRebuild )
    1270           0 :             pMainSequence->rebuild();
    1271             :     }
    1272           0 : }
    1273             : 
    1274             : // --------------------------------------------------------------------
    1275             : 
    1276           0 : OUString EffectMigration::GetSoundFile( SvxShape* pShape )
    1277             : {
    1278           0 :     OUString aSoundFile;
    1279             : 
    1280           0 :     if( pShape )
    1281             :     {
    1282           0 :         SdrObject* pObj = pShape->GetSdrObject();
    1283           0 :         if( pObj && pObj->GetPage() )
    1284             :         {
    1285           0 :             sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    1286             : 
    1287           0 :             const Reference< XShape > xShape( pShape );
    1288             : 
    1289           0 :             EffectSequence::iterator aIter;
    1290             : 
    1291           0 :             for(    aIter = pMainSequence->getBegin();
    1292           0 :                     (aSoundFile.isEmpty()) && (aIter != pMainSequence->getEnd());
    1293             :                     ++aIter )
    1294             :             {
    1295           0 :                 CustomAnimationEffectPtr pEffect( (*aIter) );
    1296           0 :                 if( pEffect->getTargetShape() == xShape )
    1297             :                 {
    1298           0 :                     if( pEffect->getAudio().is() )
    1299           0 :                         pEffect->getAudio()->getSource() >>= aSoundFile;
    1300             :                 }
    1301           0 :             }
    1302             :         }
    1303             :     }
    1304           0 :     return aSoundFile;
    1305             : }
    1306             : 
    1307             : // --------------------------------------------------------------------
    1308             : 
    1309           0 : sal_Bool EffectMigration::GetSoundOn( SvxShape* pShape )
    1310             : {
    1311           0 :     return !GetSoundFile( pShape ).isEmpty();
    1312             : }
    1313             : 
    1314             : // --------------------------------------------------------------------
    1315             : 
    1316           0 : void EffectMigration::SetAnimationPath( SvxShape* pShape, SdrPathObj* pPathObj )
    1317             : {
    1318           0 :     if( pShape && pPathObj )
    1319             :     {
    1320           0 :         SdrObject* pObj = pShape->GetSdrObject();
    1321             : 
    1322           0 :         if( pObj )
    1323             :         {
    1324           0 :             const Reference< XShape > xShape( pShape );
    1325           0 :             SdPage* pPage = dynamic_cast< SdPage* >( pPathObj ? pPathObj->GetPage() : 0 );
    1326           0 :             if( pPage )
    1327             :             {
    1328           0 :                 boost::shared_ptr< sd::MainSequence > pMainSequence( pPage->getMainSequence() );
    1329           0 :                 if( pMainSequence.get() )
    1330           0 :                     CustomAnimationEffectPtr pCreated( pMainSequence->append( *pPathObj, makeAny( xShape ), -1.0 ) );
    1331           0 :             }
    1332             :         }
    1333             :     }
    1334           0 : }
    1335             : 
    1336             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10