LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/oox/source/ppt - slidetransitioncontext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 21 54 38.9 %
Date: 2013-07-09 Functions: 7 7 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "oox/ppt/slidetransitioncontext.hxx"
      21             : 
      22             : #include "comphelper/anytostring.hxx"
      23             : #include "cppuhelper/exc_hlp.hxx"
      24             : 
      25             : #include <com/sun/star/beans/XMultiPropertySet.hpp>
      26             : #include <com/sun/star/container/XNamed.hpp>
      27             : 
      28             : #include <oox/ppt/backgroundproperties.hxx>
      29             : #include "oox/ppt/slidefragmenthandler.hxx"
      30             : #include "oox/ppt/soundactioncontext.hxx"
      31             : #include "oox/drawingml/shapegroupcontext.hxx"
      32             : #include "oox/helper/attributelist.hxx"
      33             : 
      34             : using namespace ::com::sun::star;
      35             : using namespace ::oox::core;
      36             : using namespace ::oox::drawingml;
      37             : using namespace ::com::sun::star::uno;
      38             : using namespace ::com::sun::star::xml::sax;
      39             : using namespace ::com::sun::star::container;
      40             : 
      41             : namespace oox { namespace ppt {
      42             : 
      43             : 
      44           1 : SlideTransitionContext::SlideTransitionContext( FragmentHandler2& rParent, const AttributeList& rAttribs, PropertyMap & aProperties ) throw()
      45             : : FragmentHandler2( rParent )
      46             : , maSlideProperties( aProperties )
      47           1 : , mbHasTransition( sal_False )
      48             : {
      49             :     // ST_TransitionSpeed
      50           1 :     maTransition.setOoxTransitionSpeed( rAttribs.getToken( XML_spd, XML_fast ) );
      51             : 
      52             :     // TODO
      53           1 :     rAttribs.getBool( XML_advClick, true );
      54             : 
      55             :     // careful. if missing, no auto advance... 0 looks like a valid value
      56             :     // for auto advance
      57           1 :     if(rAttribs.hasAttribute( XML_advTm ))
      58           0 :         maTransition.setOoxAdvanceTime( rAttribs.getInteger( XML_advTm, -1 ) );
      59           1 : }
      60             : 
      61           2 : SlideTransitionContext::~SlideTransitionContext() throw()
      62             : {
      63             : 
      64           2 : }
      65             : 
      66           1 : ::oox::core::ContextHandlerRef SlideTransitionContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
      67             : {
      68           1 :     switch( aElementToken )
      69             :     {
      70             :     case PPT_TOKEN( blinds ):
      71             :     case PPT_TOKEN( checker ):
      72             :     case PPT_TOKEN( comb ):
      73             :     case PPT_TOKEN( randomBar ):
      74           0 :         if (!mbHasTransition)
      75             :         {
      76           0 :             mbHasTransition = true;
      77           0 :             maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_horz ), 0);
      78             :         }
      79           0 :         return this;
      80             :     case PPT_TOKEN( cover ):
      81             :     case PPT_TOKEN( pull ):
      82           0 :         if (!mbHasTransition)
      83             :         {
      84           0 :             mbHasTransition = true;
      85           0 :             maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_l ), 0 );
      86             :         }
      87           0 :         return this;
      88             :     case PPT_TOKEN( cut ):
      89             :     case PPT_TOKEN( fade ):
      90           0 :         if (!mbHasTransition)
      91             :         {
      92           0 :             mbHasTransition = true;
      93           0 :             maTransition.setOoxTransitionType( aElementToken, rAttribs.getBool( XML_thruBlk, false ), 0);
      94             :         }
      95           0 :         return this;
      96             :     case PPT_TOKEN( push ):
      97             :     case PPT_TOKEN( wipe ):
      98           1 :         if (!mbHasTransition)
      99             :         {
     100           1 :             mbHasTransition = true;
     101           1 :             maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_l ), 0 );
     102             :         }
     103           1 :         return this;
     104             :     case PPT_TOKEN( split ):
     105           0 :         if (!mbHasTransition)
     106             :         {
     107           0 :             mbHasTransition = true;
     108           0 :             maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_orient, XML_horz ),    rAttribs.getToken( XML_dir, XML_out ) );
     109             :         }
     110           0 :         return this;
     111             :     case PPT_TOKEN( zoom ):
     112           0 :         if (!mbHasTransition)
     113             :         {
     114           0 :             mbHasTransition = true;
     115           0 :             maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_out ), 0 );
     116             :         }
     117           0 :         return this;
     118             :     case PPT_TOKEN( wheel ):
     119           0 :         if (!mbHasTransition)
     120             :         {
     121           0 :             mbHasTransition = true;
     122           0 :             maTransition.setOoxTransitionType( aElementToken, rAttribs.getUnsigned( XML_spokes, 4 ), 0 );
     123             :             // unsignedInt
     124             :         }
     125           0 :         return this;
     126             :     case PPT_TOKEN( circle ):
     127             :     case PPT_TOKEN( diamond ):
     128             :     case PPT_TOKEN( dissolve ):
     129             :     case PPT_TOKEN( newsflash ):
     130             :     case PPT_TOKEN( plus ):
     131             :     case PPT_TOKEN( random ):
     132             :     case PPT_TOKEN( wedge ):
     133             :         // CT_Empty
     134           0 :         if (!mbHasTransition)
     135             :         {
     136           0 :             mbHasTransition = true;
     137           0 :             maTransition.setOoxTransitionType( aElementToken, 0, 0 );
     138             :         }
     139           0 :         return this;
     140             : 
     141             :     case PPT_TOKEN( sndAc ): // CT_TransitionSoundAction
     142             :         //"Sound"
     143           0 :         return new SoundActionContext ( *this, maSlideProperties );
     144             :     case PPT_TOKEN( extLst ): // CT_OfficeArtExtensionList
     145           0 :         return this;
     146             :     default:
     147           0 :         break;
     148             :     }
     149             : 
     150           0 :     return this;
     151             : }
     152             : 
     153           2 : void SlideTransitionContext::onEndElement()
     154             : {
     155           2 :     if( isCurrentElement(PPT_TOKEN( transition )) )
     156             :     {
     157           1 :         if( mbHasTransition )
     158             :         {
     159           1 :             maTransition.setSlideProperties( maSlideProperties );
     160           1 :             mbHasTransition = false;
     161             :         }
     162             :     }
     163           2 : }
     164             : 
     165             : 
     166         141 : } }
     167             : 
     168             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10