LCOV - code coverage report
Current view: top level - sd/source/core - EffectMigration.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 113 490 23.1 %
Date: 2012-08-25 Functions: 13 26 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 85 1131 7.5 %

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

Generated by: LCOV version 1.10