LCOV - code coverage report
Current view: top level - xmloff/source/draw - animexp.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 60 162 37.0 %
Date: 2012-08-25 Functions: 10 13 76.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 77 340 22.6 %

           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                 :            : 
      30                 :            : #include <tools/debug.hxx>
      31                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      32                 :            : #include <com/sun/star/presentation/AnimationSpeed.hpp>
      33                 :            : #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
      34                 :            : 
      35                 :            : #include <sax/tools/converter.hxx>
      36                 :            : 
      37                 :            : #include <list>
      38                 :            : #include <comphelper/extract.hxx>
      39                 :            : #include <xmloff/xmltoken.hxx>
      40                 :            : #include "xmloff/xmlnmspe.hxx"
      41                 :            : #include <xmloff/xmluconv.hxx>
      42                 :            : #include <xmloff/xmlexp.hxx>
      43                 :            : #include <xmloff/xmlement.hxx>
      44                 :            : #include <xmloff/nmspmap.hxx>
      45                 :            : #include <xmloff/shapeexport.hxx>
      46                 :            : #include "anim.hxx"
      47                 :            : 
      48                 :            : using ::rtl::OUString;
      49                 :            : using ::rtl::OUStringBuffer;
      50                 :            : 
      51                 :            : using namespace ::std;
      52                 :            : using namespace ::cppu;
      53                 :            : using namespace ::com::sun::star;
      54                 :            : using namespace ::com::sun::star::uno;
      55                 :            : using namespace ::com::sun::star::drawing;
      56                 :            : using namespace ::com::sun::star::beans;
      57                 :            : using namespace ::com::sun::star::lang;
      58                 :            : using namespace ::com::sun::star::presentation;
      59                 :            : using namespace ::xmloff::token;
      60                 :            : 
      61                 :            : 
      62                 :            : const struct Effect
      63                 :            : {
      64                 :            :     XMLEffect meKind;
      65                 :            :     XMLEffectDirection meDirection;
      66                 :            :     sal_Int16 mnStartScale;
      67                 :            :     sal_Bool mbIn;
      68                 :            : }
      69                 :            :     AnimationEffectMap[] =
      70                 :            : {
      71                 :            :     { EK_none, ED_none,             -1, sal_True }, // AnimationEffect_NONE
      72                 :            :     { EK_fade, ED_from_left,        -1, sal_True }, // AnimationEffect_FADE_FROM_LEFT
      73                 :            :     { EK_fade, ED_from_top,         -1, sal_True }, // AnimationEffect_FADE_FROM_TOP
      74                 :            :     { EK_fade, ED_from_right,       -1, sal_True }, // AnimationEffect_FADE_FROM_RIGHT
      75                 :            :     { EK_fade, ED_from_bottom,      -1, sal_True }, // AnimationEffect_FADE_FROM_BOTTOM
      76                 :            :     { EK_fade, ED_to_center,        -1, sal_True }, // AnimationEffect_FADE_TO_CENTER
      77                 :            :     { EK_fade, ED_from_center,      -1, sal_True }, // AnimationEffect_FADE_FROM_CENTER
      78                 :            :     { EK_move, ED_from_left,        -1, sal_True }, // AnimationEffect_MOVE_FROM_LEFT
      79                 :            :     { EK_move, ED_from_top,         -1, sal_True }, // AnimationEffect_MOVE_FROM_TOP
      80                 :            :     { EK_move, ED_from_right,       -1, sal_True }, // AnimationEffect_MOVE_FROM_RIGHT
      81                 :            :     { EK_move, ED_from_bottom,      -1, sal_True }, // AnimationEffect_MOVE_FROM_BOTTOM
      82                 :            :     { EK_stripes, ED_vertical,      -1, sal_True }, // AnimationEffect_VERTICAL_STRIPES
      83                 :            :     { EK_stripes, ED_horizontal,    -1, sal_True }, // AnimationEffect_HORIZONTAL_STRIPES
      84                 :            :     { EK_fade, ED_clockwise,        -1, sal_True }, // AnimationEffect_CLOCKWISE
      85                 :            :     { EK_fade, ED_cclockwise,       -1, sal_True }, // AnimationEffect_COUNTERCLOCKWISE
      86                 :            :     { EK_fade, ED_from_upperleft,   -1, sal_True }, // AnimationEffect_FADE_FROM_UPPERLEFT
      87                 :            :     { EK_fade, ED_from_upperright,  -1, sal_True }, // AnimationEffect_FADE_FROM_UPPERRIGHT
      88                 :            :     { EK_fade, ED_from_lowerleft,   -1, sal_True }, // AnimationEffect_FADE_FROM_LOWERLEFT
      89                 :            :     { EK_fade, ED_from_lowerright,  -1, sal_True }, // AnimationEffect_FADE_FROM_LOWERRIGHT
      90                 :            :     { EK_close,ED_vertical,         -1, sal_True }, // AnimationEffect_CLOSE_VERTICAL
      91                 :            :     { EK_close,ED_horizontal,       -1, sal_True }, // AnimationEffect_CLOSE_HORIZONTAL
      92                 :            :     { EK_open, ED_vertical,         -1, sal_True }, // AnimationEffect_OPEN_VERTICAL
      93                 :            :     { EK_open, ED_horizontal,       -1, sal_True }, // AnimationEffect_OPEN_HORIZONTAL
      94                 :            :     { EK_move, ED_path,             -1, sal_True }, // AnimationEffect_PATH
      95                 :            :     { EK_move, ED_to_left,          -1, sal_False },// AnimationEffect_MOVE_TO_LEFT
      96                 :            :     { EK_move, ED_to_top,           -1, sal_False },// AnimationEffect_MOVE_TO_TOP
      97                 :            :     { EK_move, ED_to_right,         -1, sal_False },// AnimationEffect_MOVE_TO_RIGHT
      98                 :            :     { EK_move, ED_to_bottom,        -1, sal_False },// AnimationEffect_MOVE_TO_BOTTOM
      99                 :            :     { EK_fade, ED_spiral_inward_left,   -1, sal_True }, // AnimationEffect_SPIRALIN_LEFT
     100                 :            :     { EK_fade, ED_spiral_inward_right,  -1, sal_True }, // AnimationEffect_SPIRALIN_RIGHT
     101                 :            :     { EK_fade, ED_spiral_outward_left,  -1, sal_True }, // AnimationEffect_SPIRALOUT_LEFT
     102                 :            :     { EK_fade, ED_spiral_outward_right, -1, sal_True }, // AnimationEffect_SPIRALOUT_RIGHT
     103                 :            :     { EK_dissolve, ED_none,         -1, sal_True }, // AnimationEffect_DISSOLVE
     104                 :            :     { EK_wavyline, ED_from_left,    -1, sal_True }, // AnimationEffect_WAVYLINE_FROM_LEFT
     105                 :            :     { EK_wavyline, ED_from_top,     -1, sal_True }, // AnimationEffect_WAVYLINE_FROM_TOP
     106                 :            :     { EK_wavyline, ED_from_right,   -1, sal_True }, // AnimationEffect_WAVYLINE_FROM_RIGHT
     107                 :            :     { EK_wavyline, ED_from_bottom,  -1, sal_True }, // AnimationEffect_WAVYLINE_FROM_BOTTOM
     108                 :            :     { EK_random, ED_none,           -1, sal_True }, // AnimationEffect_RANDOM
     109                 :            :     { EK_lines, ED_vertical,        -1, sal_True }, // AnimationEffect_VERTICAL_LINES
     110                 :            :     { EK_lines, ED_horizontal,      -1, sal_True }, // AnimationEffect_HORIZONTAL_LINES
     111                 :            :     { EK_laser, ED_from_left,       -1, sal_True }, // AnimationEffect_LASER_FROM_LEFT
     112                 :            :     { EK_laser, ED_from_top,        -1, sal_True }, // AnimationEffect_LASER_FROM_TOP
     113                 :            :     { EK_laser, ED_from_right,      -1, sal_True }, // AnimationEffect_LASER_FROM_RIGHT
     114                 :            :     { EK_laser, ED_from_bottom,     -1, sal_True }, // AnimationEffect_LASER_FROM_BOTTOM
     115                 :            :     { EK_laser, ED_from_upperleft,  -1, sal_True }, // AnimationEffect_LASER_FROM_UPPERLEFT
     116                 :            :     { EK_laser, ED_from_upperright, -1, sal_True }, // AnimationEffect_LASER_FROM_UPPERRIGHT
     117                 :            :     { EK_laser, ED_from_lowerleft,  -1, sal_True }, // AnimationEffect_LASER_FROM_LOWERLEFT
     118                 :            :     { EK_laser, ED_from_lowerright, -1, sal_True }, // AnimationEffect_LASER_FROM_LOWERRIGHT
     119                 :            :     { EK_appear,ED_none,            -1, sal_True }, // AnimationEffect_APPEAR
     120                 :            :     { EK_hide,  ED_none,            -1, sal_False },// AnimationEffect_HIDE
     121                 :            :     { EK_move,  ED_from_upperleft,  -1, sal_True }, // AnimationEffect_MOVE_FROM_UPPERLEFT
     122                 :            :     { EK_move,  ED_from_upperright, -1, sal_True }, // AnimationEffect_MOVE_FROM_UPPERRIGHT
     123                 :            :     { EK_move,  ED_from_lowerright, -1, sal_True }, // AnimationEffect_MOVE_FROM_LOWERRIGHT
     124                 :            :     { EK_move,  ED_from_lowerleft,  -1, sal_True }, // AnimationEffect_MOVE_FROM_LOWERLEFT
     125                 :            :     { EK_move,  ED_to_upperleft,    -1, sal_False },// AnimationEffect_MOVE_TO_UPPERLEFT
     126                 :            :     { EK_move,  ED_to_upperright,   -1, sal_False },// AnimationEffect_MOVE_TO_UPPERRIGHT
     127                 :            :     { EK_move,  ED_to_lowerright,   -1, sal_False },// AnimationEffect_MOVE_TO_LOWERRIGHT
     128                 :            :     { EK_move,  ED_to_lowerleft,    -1, sal_False },// AnimationEffect_MOVE_TO_LOWERLEFT
     129                 :            :     { EK_move_short, ED_from_left,  -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_LEFT
     130                 :            :     { EK_move_short, ED_from_upperleft, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT
     131                 :            :     { EK_move_short, ED_from_top,       -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_TOP
     132                 :            :     { EK_move_short, ED_from_upperright,-1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT
     133                 :            :     { EK_move_short, ED_from_right,     -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_RIGHT
     134                 :            :     { EK_move_short, ED_from_lowerright,-1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT
     135                 :            :     { EK_move_short, ED_from_bottom,    -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_BOTTOM
     136                 :            :     { EK_move_short, ED_from_lowerleft, -1, sal_True }, // AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT
     137                 :            :     { EK_move_short, ED_to_left,        -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_LEFT
     138                 :            :     { EK_move_short, ED_to_upperleft,   -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_UPPERLEFT
     139                 :            :     { EK_move_short, ED_to_top,         -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_TOP
     140                 :            :     { EK_move_short, ED_to_upperright,  -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT
     141                 :            :     { EK_move_short, ED_to_right,       -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_RIGHT
     142                 :            :     { EK_move_short, ED_to_lowerright,  -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT
     143                 :            :     { EK_move_short, ED_to_bottom,      -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_BOTTOM
     144                 :            :     { EK_move_short, ED_to_lowerleft,   -1, sal_False },// AnimationEffect_MOVE_SHORT_TO_LOWERLEFT
     145                 :            :     { EK_checkerboard, ED_vertical,     -1, sal_True }, // AnimationEffect_VERTICAL_CHECKERBOARD
     146                 :            :     { EK_checkerboard, ED_horizontal,   -1, sal_True }, // AnimationEffect_HORIZONTAL_CHECKERBOARD
     147                 :            :     { EK_rotate, ED_horizontal,     -1, sal_True }, // AnimationEffect_HORIZONTAL_ROTATE
     148                 :            :     { EK_rotate, ED_vertical,       -1, sal_True }, // AnimationEffect_VERTICAL_ROTATE
     149                 :            :     { EK_stretch,ED_horizontal,     -1, sal_True }, // AnimationEffect_HORIZONTAL_STRETCH
     150                 :            :     { EK_stretch,ED_vertical,       -1, sal_True }, // AnimationEffect_VERTICAL_STRETCH
     151                 :            :     { EK_stretch,ED_from_left,      -1, sal_True }, // AnimationEffect_STRETCH_FROM_LEFT
     152                 :            :     { EK_stretch,ED_from_upperleft, -1, sal_True }, // AnimationEffect_STRETCH_FROM_UPPERLEFT
     153                 :            :     { EK_stretch,ED_from_top,       -1, sal_True }, // AnimationEffect_STRETCH_FROM_TOP
     154                 :            :     { EK_stretch,ED_from_upperright,-1, sal_True }, // AnimationEffect_STRETCH_FROM_UPPERRIGHT
     155                 :            :     { EK_stretch,ED_from_right,     -1, sal_True }, // AnimationEffect_STRETCH_FROM_RIGHT
     156                 :            :     { EK_stretch,ED_from_lowerright,-1, sal_True }, // AnimationEffect_STRETCH_FROM_LOWERRIGHT
     157                 :            :     { EK_stretch,ED_from_bottom,    -1, sal_True }, // AnimationEffect_STRETCH_FROM_BOTTOM
     158                 :            :     { EK_stretch,ED_from_lowerleft, -1, sal_True }, // AnimationEffect_STRETCH_FROM_LOWERLEFT
     159                 :            :     { EK_move,  ED_none,             0, sal_True }, // AnimationEffect_ZOOM_IN
     160                 :            :     { EK_move,  ED_none,            50, sal_True }, // AnimationEffect_ZOOM_IN_SMALL
     161                 :            :     { EK_move,  ED_spiral_inward_left,   0, sal_True }, // AnimationEffect_ZOOM_IN_SPIRAL
     162                 :            :     { EK_move,  ED_none,           400, sal_True }, // AnimationEffect_ZOOM_OUT
     163                 :            :     { EK_move,  ED_none,           200, sal_True }, // AnimationEffect_ZOOM_OUT_SMALL
     164                 :            :     { EK_move,  ED_spiral_inward_left, 400, sal_True }, // AnimationEffect_ZOOM_OUT_SPIRAL
     165                 :            :     { EK_move,  ED_from_left,        0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_LEFT
     166                 :            :     { EK_move,  ED_from_upperleft,   0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_UPPERLEFT
     167                 :            :     { EK_move,  ED_from_top,         0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_TOP
     168                 :            :     { EK_move,  ED_from_upperright,  0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT
     169                 :            :     { EK_move,  ED_from_right,       0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_RIGHT
     170                 :            :     { EK_move,  ED_from_lowerright,  0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT
     171                 :            :     { EK_move,  ED_from_bottom,      0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_BOTTOM
     172                 :            :     { EK_move,  ED_from_lowerleft,   0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_LOWERLEFT
     173                 :            :     { EK_move,  ED_from_center,      0, sal_True }, // AnimationEffect_ZOOM_IN_FROM_CENTER
     174                 :            :     { EK_move,  ED_from_left,      400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_LEFT
     175                 :            :     { EK_move,  ED_from_upperleft, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT
     176                 :            :     { EK_move,  ED_from_top,       400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_TOP
     177                 :            :     { EK_move,  ED_from_upperright,400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT
     178                 :            :     { EK_move,  ED_from_right,     400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_RIGHT
     179                 :            :     { EK_move,  ED_from_lowerright,400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT
     180                 :            :     { EK_move,  ED_from_bottom,    400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_BOTTOM
     181                 :            :     { EK_move,  ED_from_lowerleft, 400, sal_True }, // AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT
     182                 :            :     { EK_move,  ED_from_center,    400, sal_True }  // AnimationEffect_ZOOM_OUT_FROM_CENTER
     183                 :            : };
     184                 :            : 
     185                 :          0 : void SdXMLImplSetEffect( AnimationEffect eEffect, XMLEffect& eKind, XMLEffectDirection& eDirection, sal_Int16& nStartScale, sal_Bool& bIn )
     186                 :            : {
     187 [ #  # ][ #  # ]:          0 :     if( eEffect < AnimationEffect_NONE || eEffect > AnimationEffect_ZOOM_OUT_FROM_CENTER )
     188                 :            :     {
     189                 :            :         OSL_FAIL( "unknown animation effect!" );
     190                 :          0 :         eEffect = AnimationEffect_NONE;
     191                 :            :     }
     192                 :            : 
     193                 :          0 :     const Effect& rEffect = AnimationEffectMap[eEffect];
     194                 :          0 :     eKind = rEffect.meKind;
     195                 :          0 :     eDirection = rEffect.meDirection;
     196                 :          0 :     nStartScale = rEffect.mnStartScale;
     197                 :          0 :     bIn = rEffect.mbIn;
     198                 :          0 : }
     199                 :            : 
     200                 :            : enum XMLActionKind
     201                 :            : {
     202                 :            :     XMLE_SHOW,
     203                 :            :     XMLE_HIDE,
     204                 :            :     XMLE_DIM,
     205                 :            :     XMLE_PLAY
     206                 :            : };
     207                 :            : 
     208                 :          4 : struct XMLEffectHint
     209                 :            : {
     210                 :            :     XMLActionKind   meKind;
     211                 :            :     sal_Bool        mbTextEffect;
     212                 :            :     Reference<XShape> mxShape;
     213                 :            : 
     214                 :            :     XMLEffect       meEffect;
     215                 :            :     XMLEffectDirection  meDirection;
     216                 :            :     sal_Int16       mnStartScale;
     217                 :            : 
     218                 :            :     AnimationSpeed  meSpeed;
     219                 :            :         sal_Int32               maDimColor;
     220                 :            :     OUString        maSoundURL;
     221                 :            :     sal_Bool        mbPlayFull;
     222                 :            :     sal_Int32       mnPresId;
     223                 :            :     sal_Int32       mnPathShapeId;
     224                 :            : 
     225                 :          0 :     int operator<(const XMLEffectHint& rComp) const { return mnPresId < rComp.mnPresId; }
     226                 :            : 
     227                 :          4 :     XMLEffectHint()
     228                 :            :     :   meKind( XMLE_SHOW ), mbTextEffect( sal_False ),
     229                 :            :         meEffect( EK_none ), meDirection( ED_none ), mnStartScale( -1 ),
     230                 :            :         meSpeed( AnimationSpeed_SLOW ), maDimColor(0), mbPlayFull( sal_False ),
     231                 :          4 :         mnPresId( 0 ), mnPathShapeId( -1 )
     232                 :          4 :         {}
     233                 :            : };
     234                 :            : 
     235         [ +  - ]:          4 : class AnimExpImpl
     236                 :            : {
     237                 :            : public:
     238                 :            :     list<XMLEffectHint> maEffects;
     239                 :            :     UniReference< XMLShapeExport > mxShapeExp;
     240                 :            : 
     241                 :            :     OUString msDimColor;
     242                 :            :     OUString msDimHide;
     243                 :            :     OUString msDimPrev;
     244                 :            :     OUString msEffect;
     245                 :            :     OUString msPlayFull;
     246                 :            :     OUString msPresOrder;
     247                 :            :     OUString msSound;
     248                 :            :     OUString msSoundOn;
     249                 :            :     OUString msSpeed;
     250                 :            :     OUString msTextEffect;
     251                 :            :     OUString msIsAnimation;
     252                 :            :     OUString msAnimPath;
     253                 :            : 
     254                 :          4 :     AnimExpImpl()
     255                 :            :     :   msDimColor( RTL_CONSTASCII_USTRINGPARAM( "DimColor" ) ),
     256                 :            :         msDimHide( RTL_CONSTASCII_USTRINGPARAM( "DimHide" ) ),
     257                 :            :         msDimPrev( RTL_CONSTASCII_USTRINGPARAM( "DimPrevious" ) ),
     258                 :            :         msEffect( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ),
     259                 :            :         msPlayFull( RTL_CONSTASCII_USTRINGPARAM( "PlayFull" ) ),
     260                 :            :         msPresOrder( RTL_CONSTASCII_USTRINGPARAM( "PresentationOrder" ) ),
     261                 :            :         msSound( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ),
     262                 :            :         msSoundOn( RTL_CONSTASCII_USTRINGPARAM( "SoundOn" ) ),
     263                 :            :         msSpeed( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) ),
     264                 :            :         msTextEffect( RTL_CONSTASCII_USTRINGPARAM( "TextEffect" ) ),
     265                 :            :         msIsAnimation( RTL_CONSTASCII_USTRINGPARAM( "IsAnimation" ) ),
     266 [ +  - ][ +  - ]:          4 :         msAnimPath( RTL_CONSTASCII_USTRINGPARAM( "AnimationPath" ) )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     267                 :          4 :     {}
     268                 :            : };
     269                 :            : 
     270                 :          4 : XMLAnimationsExporter::XMLAnimationsExporter( XMLShapeExport* pShapeExp )
     271                 :            : {
     272 [ +  - ][ +  - ]:          4 :     mpImpl = new AnimExpImpl;
     273         [ +  - ]:          4 :     mpImpl->mxShapeExp = pShapeExp;
     274                 :          4 : }
     275                 :            : 
     276                 :          4 : XMLAnimationsExporter::~XMLAnimationsExporter()
     277                 :            : {
     278 [ +  - ][ +  - ]:          4 :     delete mpImpl;
     279                 :          4 :     mpImpl = NULL;
     280         [ -  + ]:          8 : }
     281                 :            : 
     282                 :          8 : void XMLAnimationsExporter::prepare( Reference< XShape > xShape, SvXMLExport& )
     283                 :            : {
     284                 :            :     try
     285                 :            :     {
     286                 :            :         // check for presentation shape service
     287                 :            :         {
     288         [ +  - ]:          8 :             Reference< XServiceInfo > xServiceInfo( xShape, UNO_QUERY );
     289 [ +  - ][ +  - ]:          8 :             if( !xServiceInfo.is() || !xServiceInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.Shape" ) ) ) )
         [ +  - ][ +  - ]
         [ -  + ][ +  - ]
         [ -  + ][ #  # ]
     290         [ +  - ]:         16 :                 return;
     291                 :            :         }
     292                 :            : 
     293         [ +  - ]:          8 :         Reference< XPropertySet > xProps( xShape, UNO_QUERY );
     294         [ +  - ]:          8 :         if( xProps.is() )
     295                 :            :         {
     296                 :            :             AnimationEffect eEffect;
     297 [ +  - ][ +  - ]:          8 :             xProps->getPropertyValue( mpImpl->msEffect ) >>= eEffect;
                 [ +  - ]
     298         [ -  + ]:          8 :             if( eEffect == AnimationEffect_PATH )
     299                 :            :             {
     300                 :          0 :                 Reference< XShape > xPath;
     301 [ #  # ][ #  # ]:          8 :                 xProps->getPropertyValue( mpImpl->msAnimPath ) >>= xPath;
                 [ #  # ]
     302                 :            :             }
     303         [ #  # ]:          8 :         }
     304                 :            :     }
     305                 :          0 :     catch (const Exception&)
     306                 :            :     {
     307                 :            :         OSL_FAIL("exception caught while collection animation information!");
     308                 :            :     }
     309                 :            : }
     310                 :            : 
     311                 :          4 : void XMLAnimationsExporter::collect( Reference< XShape > xShape, SvXMLExport& rExport )
     312                 :            : {
     313                 :            :     try
     314                 :            :     {
     315                 :            :         // check for presentation shape service
     316                 :            :         {
     317         [ +  - ]:          4 :             Reference< XServiceInfo > xServiceInfo( xShape, UNO_QUERY );
     318 [ +  - ][ +  - ]:          4 :             if( !xServiceInfo.is() || !xServiceInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.Shape" ) ) ) )
         [ +  - ][ +  - ]
         [ -  + ][ +  - ]
         [ -  + ][ #  # ]
     319         [ +  - ]:          8 :                 return;
     320                 :            :         }
     321                 :            : 
     322         [ +  - ]:          4 :         Reference< XPropertySet > xProps( xShape, UNO_QUERY );
     323         [ +  - ]:          4 :         if( xProps.is() )
     324                 :            :         {
     325                 :          4 :             const OUString aEmptyStr;
     326                 :            : 
     327 [ +  - ][ +  - ]:          4 :             Reference< XPropertySetInfo > xInfo( xProps->getPropertySetInfo() );
     328                 :            :             AnimationEffect eEffect;
     329         [ +  - ]:          4 :             XMLEffectHint aEffect;
     330                 :            : 
     331 [ +  - ][ +  - ]:          4 :             if( any2bool( xProps->getPropertyValue( mpImpl->msSoundOn ) ) )
         [ +  - ][ -  + ]
     332                 :            :             {
     333 [ #  # ][ #  # ]:          0 :                 xProps->getPropertyValue( mpImpl->msSound ) >>= aEffect.maSoundURL;
     334 [ #  # ][ #  # ]:          0 :                 xProps->getPropertyValue( mpImpl->msPlayFull ) >>= aEffect.mbPlayFull;
     335                 :            :             }
     336                 :            : 
     337 [ +  - ][ +  - ]:          4 :             xProps->getPropertyValue( mpImpl->msPresOrder ) >>= aEffect.mnPresId;
     338 [ +  - ][ +  - ]:          4 :             xProps->getPropertyValue( mpImpl->msSpeed ) >>= aEffect.meSpeed;
                 [ +  - ]
     339                 :            : 
     340                 :            : 
     341                 :          4 :             sal_Bool bIsAnimation = false;
     342 [ +  - ][ +  - ]:          4 :             xProps->getPropertyValue( mpImpl->msIsAnimation ) >>= bIsAnimation;
     343         [ -  + ]:          4 :             if( bIsAnimation )
     344                 :            :             {
     345                 :          0 :                 aEffect.meKind = XMLE_PLAY;
     346                 :            : 
     347         [ #  # ]:          0 :                 if( !aEffect.mxShape.is() )
     348                 :            :                 {
     349 [ #  # ][ #  # ]:          0 :                     rExport.getInterfaceToIdentifierMapper().registerReference( xShape );
     350         [ #  # ]:          0 :                     aEffect.mxShape = xShape;
     351                 :            :                 }
     352                 :            : 
     353         [ #  # ]:          0 :                 mpImpl->maEffects.push_back( aEffect );
     354                 :            :             }
     355                 :            : 
     356                 :            :             {
     357                 :            : 
     358 [ +  - ][ +  - ]:          4 :                 xProps->getPropertyValue( mpImpl->msEffect ) >>= eEffect;
                 [ +  - ]
     359         [ -  + ]:          4 :                 if( eEffect != AnimationEffect_NONE )
     360                 :            :                 {
     361                 :          0 :                     sal_Bool bIn = sal_True;
     362                 :          0 :                     SdXMLImplSetEffect( eEffect, aEffect.meEffect, aEffect.meDirection, aEffect.mnStartScale, bIn );
     363                 :            : 
     364                 :          0 :                     aEffect.meKind = bIn ? XMLE_SHOW : XMLE_HIDE;
     365                 :            : 
     366         [ #  # ]:          0 :                     if( !aEffect.mxShape.is() )
     367                 :            :                     {
     368 [ #  # ][ #  # ]:          0 :                         rExport.getInterfaceToIdentifierMapper().registerReference( xShape );
     369         [ #  # ]:          0 :                         aEffect.mxShape = xShape;
     370                 :            :                     }
     371                 :            : 
     372         [ #  # ]:          0 :                     if( eEffect == AnimationEffect_PATH )
     373                 :            :                     {
     374                 :          0 :                         Reference< XShape > xPath;
     375 [ #  # ][ #  # ]:          0 :                         xProps->getPropertyValue( mpImpl->msAnimPath ) >>= xPath;
                 [ #  # ]
     376                 :          0 :                         if( xPath.is() )
     377                 :            :                         {
     378                 :            : // strip                    mpImpl->mxShapeExp->createShapeId( xPath );
     379                 :            : // strip                    aEffect.mnPathShapeId = mpImpl->mxShapeExp->getShapeId( xPath );
     380                 :          0 :                         }
     381                 :            :                     }
     382         [ #  # ]:          0 :                     mpImpl->maEffects.push_back( aEffect );
     383                 :            : 
     384                 :          0 :                     aEffect.mnPathShapeId = -1;
     385                 :          0 :                     aEffect.maSoundURL = aEmptyStr;
     386                 :            :                 }
     387                 :            : 
     388 [ +  - ][ +  - ]:          4 :                 xProps->getPropertyValue( mpImpl->msTextEffect ) >>= eEffect;
                 [ +  - ]
     389         [ -  + ]:          4 :                 if( eEffect != AnimationEffect_NONE )
     390                 :            :                 {
     391                 :          0 :                     sal_Bool bIn = sal_True;
     392                 :          0 :                     SdXMLImplSetEffect( eEffect, aEffect.meEffect, aEffect.meDirection, aEffect.mnStartScale, bIn );
     393                 :          0 :                     aEffect.meKind = bIn ? XMLE_SHOW : XMLE_HIDE;
     394                 :          0 :                     aEffect.mbTextEffect = sal_True;
     395                 :            : 
     396         [ #  # ]:          0 :                     if( !aEffect.mxShape.is() )
     397                 :            :                     {
     398 [ #  # ][ #  # ]:          0 :                         rExport.getInterfaceToIdentifierMapper().registerReference( xShape );
     399         [ #  # ]:          0 :                         aEffect.mxShape = xShape;
     400                 :            :                     }
     401                 :            : 
     402         [ #  # ]:          0 :                     mpImpl->maEffects.push_back( aEffect );
     403                 :          0 :                     aEffect.mbTextEffect = sal_False;
     404                 :          0 :                     aEffect.maSoundURL = aEmptyStr;
     405                 :            :                 }
     406                 :            : 
     407                 :          4 :                 sal_Bool bDimPrev = false;
     408                 :          4 :                 sal_Bool bDimHide = false;
     409 [ +  - ][ +  - ]:          4 :                 xProps->getPropertyValue( mpImpl->msDimPrev ) >>= bDimPrev;
     410 [ +  - ][ +  - ]:          4 :                 xProps->getPropertyValue( mpImpl->msDimHide ) >>= bDimHide;
     411 [ -  + ][ +  - ]:          4 :                 if( bDimPrev || bDimHide )
     412                 :            :                 {
     413         [ #  # ]:          0 :                     aEffect.meKind = bDimPrev ? XMLE_DIM : XMLE_HIDE;
     414                 :          0 :                     aEffect.meEffect = EK_none;
     415                 :          0 :                     aEffect.meDirection = ED_none;
     416                 :          0 :                     aEffect.meSpeed = AnimationSpeed_MEDIUM;
     417         [ #  # ]:          0 :                     if( bDimPrev )
     418                 :            :                     {
     419         [ #  # ]:          0 :                         xProps->getPropertyValue( mpImpl->msDimColor )
     420         [ #  # ]:          0 :                             >>= aEffect.maDimColor;
     421                 :            :                     }
     422                 :            : 
     423         [ #  # ]:          0 :                     if( !aEffect.mxShape.is() )
     424                 :            :                     {
     425 [ #  # ][ #  # ]:          0 :                         rExport.getInterfaceToIdentifierMapper().registerReference( xShape );
     426         [ #  # ]:          0 :                         aEffect.mxShape = xShape;
     427                 :            :                     }
     428                 :            : 
     429         [ #  # ]:          0 :                     mpImpl->maEffects.push_back( aEffect );
     430                 :          0 :                     aEffect.maSoundURL = aEmptyStr;
     431                 :            :                 }
     432         [ +  - ]:          4 :             }
     433         [ #  # ]:          4 :         }
     434                 :            :     }
     435                 :          0 :     catch (const Exception&)
     436                 :            :     {
     437                 :            :         OSL_FAIL("exception caught while collection animation information!");
     438                 :            :     }
     439                 :            : }
     440                 :            : 
     441                 :          2 : void XMLAnimationsExporter::exportAnimations( SvXMLExport& rExport )
     442                 :            : {
     443         [ +  - ]:          2 :     mpImpl->maEffects.sort();
     444                 :            : 
     445                 :          2 :     list<XMLEffectHint>::iterator aIter = mpImpl->maEffects.begin();
     446                 :          2 :     const list<XMLEffectHint>::iterator aEnd = mpImpl->maEffects.end();
     447                 :            : 
     448                 :          2 :     OUStringBuffer sTmp;
     449                 :            : 
     450         [ -  + ]:          2 :     if( aIter != aEnd )
     451                 :            :     {
     452         [ #  # ]:          0 :         SvXMLElementExport aElement( rExport, XML_NAMESPACE_PRESENTATION, XML_ANIMATIONS, sal_True, sal_True );
     453                 :            : 
     454         [ #  # ]:          0 :         do
     455                 :            :         {
     456                 :          0 :             XMLEffectHint& rEffect = *aIter;
     457                 :            : 
     458                 :            :             DBG_ASSERT( rEffect.mxShape.is(), "shape id creation failed for animation effect?" );
     459                 :            : 
     460 [ #  # ][ #  # ]:          0 :             rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_SHAPE_ID, rExport.getInterfaceToIdentifierMapper().getIdentifier( rEffect.mxShape ) );
                 [ #  # ]
     461                 :            : 
     462         [ #  # ]:          0 :             if( rEffect.meKind == XMLE_DIM )
     463                 :            :             {
     464                 :            :                 // export a dim action;
     465                 :            : 
     466         [ #  # ]:          0 :                 ::sax::Converter::convertColor( sTmp, rEffect.maDimColor );
     467 [ #  # ][ #  # ]:          0 :                 rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_COLOR, sTmp.makeStringAndClear() );
     468                 :            : 
     469 [ #  # ][ #  # ]:          0 :                 SvXMLElementExport aElem( rExport, XML_NAMESPACE_PRESENTATION, XML_DIM, sal_True, sal_True );
     470                 :            :             }
     471         [ #  # ]:          0 :             else if( rEffect.meKind == XMLE_PLAY )
     472                 :            :             {
     473         [ #  # ]:          0 :                 if( rEffect.meSpeed != AnimationSpeed_MEDIUM )
     474                 :            :                 {
     475         [ #  # ]:          0 :                     SvXMLUnitConverter::convertEnum( sTmp, rEffect.meSpeed, aXML_AnimationSpeed_EnumMap );
     476 [ #  # ][ #  # ]:          0 :                     rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SPEED, sTmp.makeStringAndClear() );
     477                 :            :                 }
     478                 :            : 
     479 [ #  # ][ #  # ]:          0 :                 SvXMLElementExport aElem( rExport, XML_NAMESPACE_PRESENTATION, XML_PLAY, sal_True, sal_True );
     480                 :            :             }
     481                 :            :             else
     482                 :            :             {
     483                 :            : 
     484         [ #  # ]:          0 :                 if( rEffect.meEffect != EK_none )
     485                 :            :                 {
     486         [ #  # ]:          0 :                     SvXMLUnitConverter::convertEnum( sTmp, rEffect.meEffect, aXML_AnimationEffect_EnumMap );
     487 [ #  # ][ #  # ]:          0 :                     rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_EFFECT, sTmp.makeStringAndClear() );
     488                 :            :                 }
     489                 :            : 
     490         [ #  # ]:          0 :                 if( rEffect.meDirection != ED_none )
     491                 :            :                 {
     492         [ #  # ]:          0 :                     SvXMLUnitConverter::convertEnum( sTmp, rEffect.meDirection, aXML_AnimationDirection_EnumMap );
     493 [ #  # ][ #  # ]:          0 :                     rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_DIRECTION, sTmp.makeStringAndClear() );
     494                 :            :                 }
     495                 :            : 
     496         [ #  # ]:          0 :                 if( rEffect.mnStartScale != -1 )
     497                 :            :                 {
     498         [ #  # ]:          0 :                     ::sax::Converter::convertPercent(sTmp, rEffect.mnStartScale);
     499 [ #  # ][ #  # ]:          0 :                     rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_START_SCALE, sTmp.makeStringAndClear() );
     500                 :            :                 }
     501                 :            : 
     502         [ #  # ]:          0 :                 if( rEffect.meSpeed != AnimationSpeed_MEDIUM )
     503                 :            :                 {
     504         [ #  # ]:          0 :                     SvXMLUnitConverter::convertEnum( sTmp, rEffect.meSpeed, aXML_AnimationSpeed_EnumMap );
     505 [ #  # ][ #  # ]:          0 :                     rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SPEED, sTmp.makeStringAndClear() );
     506                 :            :                 }
     507                 :            : 
     508         [ #  # ]:          0 :                 if( rEffect.mnPathShapeId != -1 )
     509                 :            :                 {
     510         [ #  # ]:          0 :                     rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PATH_ID, OUString::valueOf( rEffect.mnPathShapeId ) );
     511                 :            :                 }
     512                 :            : 
     513                 :            :                 enum XMLTokenEnum eLocalName;
     514         [ #  # ]:          0 :                 if( rEffect.meKind == XMLE_SHOW )
     515                 :            :                 {
     516         [ #  # ]:          0 :                     if( rEffect.mbTextEffect )
     517                 :          0 :                         eLocalName = XML_SHOW_TEXT;
     518                 :            :                     else
     519                 :          0 :                         eLocalName = XML_SHOW_SHAPE;
     520                 :            :                 }
     521                 :            :                 else
     522                 :            :                 {
     523         [ #  # ]:          0 :                     if( rEffect.mbTextEffect )
     524                 :          0 :                         eLocalName = XML_HIDE_TEXT;
     525                 :            :                     else
     526                 :          0 :                         eLocalName = XML_HIDE_SHAPE;
     527                 :            :                 }
     528                 :            : 
     529         [ #  # ]:          0 :                 SvXMLElementExport aEle( rExport, XML_NAMESPACE_PRESENTATION, eLocalName, sal_True, sal_True );
     530         [ #  # ]:          0 :                 if( !rEffect.maSoundURL.isEmpty() )
     531                 :            :                 {
     532 [ #  # ][ #  # ]:          0 :                     rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, rExport.GetRelativeReference(rEffect.maSoundURL) );
     533         [ #  # ]:          0 :                     rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
     534         [ #  # ]:          0 :                     rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_NEW );
     535         [ #  # ]:          0 :                     rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
     536         [ #  # ]:          0 :                     if( rEffect.mbPlayFull )
     537         [ #  # ]:          0 :                         rExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PLAY_FULL, XML_TRUE );
     538                 :            : 
     539 [ #  # ][ #  # ]:          0 :                     SvXMLElementExport aElem( rExport, XML_NAMESPACE_PRESENTATION, XML_SOUND, sal_True, sal_True );
     540         [ #  # ]:          0 :                 }
     541                 :            :             }
     542                 :            : 
     543                 :          0 :             ++aIter;
     544                 :            :         }
     545         [ #  # ]:          0 :         while( aIter != aEnd );
     546                 :            :     }
     547                 :            : 
     548                 :          2 :     mpImpl->maEffects.clear();
     549                 :          2 : }
     550                 :            : 
     551                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10