LCOV - code coverage report
Current view: top level - animations/source/animcore - targetpropertiescreator.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 116 1.7 %
Date: 2012-08-25 Functions: 1 22 4.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 216 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #include <com/sun/star/uno/XComponentContext.hpp>
      21                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      22                 :            : #include <com/sun/star/lang/XTypeProvider.hpp>
      23                 :            : #include <com/sun/star/animations/XTargetPropertiesCreator.hpp>
      24                 :            : #include <com/sun/star/animations/XIterateContainer.hpp>
      25                 :            : #include <com/sun/star/animations/TargetProperties.hpp>
      26                 :            : #include <com/sun/star/presentation/ParagraphTarget.hpp>
      27                 :            : #include <com/sun/star/registry/XRegistryKey.hpp>
      28                 :            : #include <com/sun/star/lang/XInitialization.hpp>
      29                 :            : #include <com/sun/star/lang/XServiceName.hpp>
      30                 :            : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      31                 :            : #include <com/sun/star/drawing/XShape.hpp>
      32                 :            : #include <com/sun/star/animations/AnimationNodeType.hpp>
      33                 :            : #include <com/sun/star/animations/XAnimate.hpp>
      34                 :            : #include <cppuhelper/compbase3.hxx>
      35                 :            : #include <cppuhelper/factory.hxx>
      36                 :            : #include <cppuhelper/implementationentry.hxx>
      37                 :            : #include <comphelper/broadcasthelper.hxx>
      38                 :            : #include <comphelper/sequence.hxx>
      39                 :            : 
      40                 :            : #include <animations/animationnodehelper.hxx>
      41                 :            : 
      42                 :            : #include <vector>
      43                 :            : #include <boost/unordered_map.hpp>
      44                 :            : 
      45                 :            : 
      46                 :            : using namespace ::com::sun::star;
      47                 :            : 
      48                 :            : #define IMPLEMENTATION_NAME "animcore::TargetPropertiesCreator"
      49                 :            : #define SERVICE_NAME "com.sun.star.animations.TargetPropertiesCreator"
      50                 :            : 
      51                 :            : namespace animcore
      52                 :            : {
      53                 :            :     typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::animations::XTargetPropertiesCreator,
      54                 :            :                                               lang::XServiceInfo,
      55                 :            :                                               lang::XServiceName >  TargetPropertiesCreator_Base;
      56                 :            : 
      57                 :            :     class TargetPropertiesCreator : public ::comphelper::OBaseMutex,
      58                 :            :                                     public TargetPropertiesCreator_Base
      59                 :            :     {
      60                 :            :     public:
      61                 :          0 :         static uno::Reference< uno::XInterface > SAL_CALL createInstance( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::Exception )
      62                 :            :         {
      63         [ #  # ]:          0 :             return uno::Reference< uno::XInterface >( static_cast<cppu::OWeakObject*>(new TargetPropertiesCreator( xContext )) );
      64                 :            :         }
      65                 :            : 
      66                 :            :         /// Dispose all internal references
      67                 :            :         virtual void SAL_CALL disposing();
      68                 :            : 
      69                 :            :         // XTargetPropertiesCreator
      70                 :            :         virtual uno::Sequence< animations::TargetProperties > SAL_CALL createInitialTargetProperties( const uno::Reference< animations::XAnimationNode >& rootNode ) throw (uno::RuntimeException);
      71                 :            : 
      72                 :            :         // XServiceInfo
      73                 :            :         virtual ::rtl::OUString SAL_CALL getImplementationName() throw( uno::RuntimeException );
      74                 :            :         virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( uno::RuntimeException );
      75                 :            :         virtual uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()  throw( uno::RuntimeException );
      76                 :            : 
      77                 :            :         // XServiceName
      78                 :            :         virtual ::rtl::OUString SAL_CALL getServiceName(  ) throw (uno::RuntimeException);
      79                 :            : 
      80                 :            :     protected:
      81                 :            :         ~TargetPropertiesCreator(); // we're a ref-counted UNO class. _We_ destroy ourselves.
      82                 :            : 
      83                 :            :     private:
      84                 :            :         // default: disabled copy/assignment
      85                 :            :         TargetPropertiesCreator(const TargetPropertiesCreator&);
      86                 :            :         TargetPropertiesCreator& operator=( const TargetPropertiesCreator& );
      87                 :            : 
      88                 :            :         TargetPropertiesCreator( const uno::Reference< uno::XComponentContext >& rxContext );
      89                 :            :     };
      90                 :            : 
      91                 :            :     // --------------------------------------------------------------------
      92                 :            : 
      93                 :          0 :     uno::Reference< uno::XInterface > SAL_CALL createInstance_TargetPropertiesCreator( const uno::Reference< uno::XComponentContext > & rSMgr ) throw (uno::Exception)
      94                 :            :     {
      95                 :          0 :         return TargetPropertiesCreator::createInstance( rSMgr );
      96                 :            :     }
      97                 :            : 
      98                 :          6 :     ::rtl::OUString getImplementationName_TargetPropertiesCreator()
      99                 :            :     {
     100                 :          6 :         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) );
     101                 :            :     }
     102                 :            : 
     103                 :          0 :     uno::Sequence< ::rtl::OUString > getSupportedServiceNames_TargetPropertiesCreator(void)
     104                 :            :     {
     105                 :          0 :         uno::Sequence< ::rtl::OUString > aRet(1);
     106 [ #  # ][ #  # ]:          0 :         aRet.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICE_NAME ) );
     107                 :          0 :         return aRet;
     108                 :            :     }
     109                 :            : 
     110                 :            :     // --------------------------------------------------------------------
     111                 :            : 
     112                 :            :     namespace
     113                 :            :     {
     114                 :            :         // Vector containing all properties for a given shape
     115                 :            :         typedef ::std::vector< beans::NamedValue > VectorOfNamedValues;
     116                 :            : 
     117                 :            :         /** The hash map key
     118                 :            : 
     119                 :            :             This key contains both XShape reference and a paragraph
     120                 :            :             index, as we somehow have to handle shape and paragraph
     121                 :            :             targets with the same data structure.
     122                 :            :          */
     123                 :          0 :         struct ShapeHashKey
     124                 :            :         {
     125                 :            :             /// Shape target
     126                 :            :             uno::Reference< drawing::XShape >   mxRef;
     127                 :            : 
     128                 :            :             /** Paragraph index.
     129                 :            : 
     130                 :            :                 If this is a pure shape target, mnParagraphIndex is
     131                 :            :                 set to -1.
     132                 :            :              */
     133                 :            :             sal_Int16                           mnParagraphIndex;
     134                 :            : 
     135                 :            :             /// Comparison needed for boost::unordered_map
     136                 :          0 :             bool operator==( const ShapeHashKey& rRHS ) const
     137                 :            :             {
     138 [ #  # ][ #  # ]:          0 :                 return mxRef == rRHS.mxRef && mnParagraphIndex == rRHS.mnParagraphIndex;
     139                 :            :             }
     140                 :            :         };
     141                 :            : 
     142                 :            :         // A hash map which maps a XShape to the corresponding vector of initial properties
     143                 :            :         typedef ::boost::unordered_map< ShapeHashKey,
     144                 :            :                                  VectorOfNamedValues,
     145                 :            :                                  ::std::size_t (*)(const ShapeHashKey&) > XShapeHash;
     146                 :            : 
     147                 :          0 :         ::std::size_t refhasher( const ShapeHashKey& rKey )
     148                 :            :         {
     149                 :            :             // TODO(P2): Maybe a better hash function would be to
     150                 :            :             // spread mnParagraphIndex to 32 bit: a0b0c0d0e0... Hakmem
     151                 :            :             // should have a formula.
     152                 :            :             //
     153                 :            :             // Yes it has:
     154                 :            :             // x = (x & 0x0000FF00) << 8) | (x >> 8) & 0x0000FF00 | x & 0xFF0000FF;
     155                 :            :             // x = (x & 0x00F000F0) << 4) | (x >> 4) & 0x00F000F0 | x & 0xF00FF00F;
     156                 :            :             // x = (x & 0x0C0C0C0C) << 2) | (x >> 2) & 0x0C0C0C0C | x & 0xC3C3C3C3;
     157                 :            :             // x = (x & 0x22222222) << 1) | (x >> 1) & 0x22222222 | x & 0x99999999;
     158                 :            :             //
     159                 :            :             // Costs about 17 cycles on a RISC machine with infinite
     160                 :            :             // instruction level parallelism (~42 basic
     161                 :            :             // instructions). Thus I truly doubt this pays off...
     162                 :          0 :             return reinterpret_cast< ::std::size_t >(rKey.mxRef.get()) ^ (rKey.mnParagraphIndex << 16L);
     163                 :            :         }
     164                 :            : 
     165                 :            : 
     166                 :          0 :         class NodeFunctor
     167                 :            :         {
     168                 :            :         public:
     169                 :          0 :             explicit NodeFunctor( XShapeHash& rShapeHash ) :
     170                 :            :                 mrShapeHash( rShapeHash ),
     171                 :            :                 mxTargetShape(),
     172                 :          0 :                 mnParagraphIndex( -1 )
     173                 :            :             {
     174                 :          0 :             }
     175                 :            : 
     176                 :          0 :             NodeFunctor( XShapeHash&                                rShapeHash,
     177                 :            :                          const uno::Reference< drawing::XShape >&   rTargetShape,
     178                 :            :                          sal_Int16                                  nParagraphIndex ) :
     179                 :            :                 mrShapeHash( rShapeHash ),
     180                 :            :                 mxTargetShape( rTargetShape ),
     181                 :          0 :                 mnParagraphIndex( nParagraphIndex )
     182                 :            :             {
     183                 :          0 :             }
     184                 :            : 
     185                 :          0 :             void operator()( const uno::Reference< animations::XAnimationNode >& xNode ) const
     186                 :            :             {
     187         [ #  # ]:          0 :                 if( !xNode.is() )
     188                 :            :                 {
     189                 :            :                     OSL_FAIL( "AnimCore: NodeFunctor::operator(): invalid XAnimationNode" );
     190                 :            :                     return;
     191                 :            :                 }
     192                 :            : 
     193                 :          0 :                 uno::Reference< drawing::XShape > xTargetShape( mxTargetShape );
     194                 :          0 :                 sal_Int16                         nParagraphIndex( mnParagraphIndex );
     195                 :            : 
     196         [ #  # ]:          0 :                 switch( xNode->getType() )
           [ #  #  #  # ]
                 [ #  # ]
     197                 :            :                 {
     198                 :            :                     case animations::AnimationNodeType::ITERATE:
     199                 :            :                     {
     200                 :            :                         // extract target shape from iterate node
     201                 :            :                         // (will override the target for all children)
     202                 :            :                         // --------------------------------------------------
     203                 :            : 
     204                 :            :                         uno::Reference< animations::XIterateContainer > xIterNode( xNode,
     205         [ #  # ]:          0 :                                                                                    uno::UNO_QUERY );
     206                 :            : 
     207                 :            :                         // TODO(E1): I'm not too sure what to expect here...
     208 [ #  # ][ #  # ]:          0 :                         if( !xIterNode->getTarget().hasValue() )
                 [ #  # ]
     209                 :            :                         {
     210                 :            :                             OSL_FAIL( "animcore: NodeFunctor::operator(): no target on ITERATE node" );
     211                 :            :                             return;
     212                 :            :                         }
     213                 :            : 
     214         [ #  # ]:          0 :                         xTargetShape.set( xIterNode->getTarget(),
     215 [ #  # ][ #  # ]:          0 :                                           uno::UNO_QUERY );
     216                 :            : 
     217         [ #  # ]:          0 :                         if( !xTargetShape.is() )
     218                 :            :                         {
     219         [ #  # ]:          0 :                             ::com::sun::star::presentation::ParagraphTarget aTarget;
     220                 :            : 
     221                 :            :                             // no shape provided. Maybe a ParagraphTarget?
     222 [ #  # ][ #  # ]:          0 :                             if( !(xIterNode->getTarget() >>= aTarget) )
         [ #  # ][ #  # ]
     223                 :            :                             {
     224                 :            :                                 OSL_FAIL( "animcore: NodeFunctor::operator(): could not extract any "
     225                 :            :                                             "target information" );
     226                 :            :                                 return;
     227                 :            :                             }
     228                 :            : 
     229         [ #  # ]:          0 :                             xTargetShape = aTarget.Shape;
     230                 :          0 :                             nParagraphIndex = aTarget.Paragraph;
     231                 :            : 
     232         [ #  # ]:          0 :                             if( !xTargetShape.is() )
     233                 :            :                             {
     234                 :            :                                 OSL_FAIL( "animcore: NodeFunctor::operator(): invalid shape in ParagraphTarget" );
     235                 :            :                                 return;
     236 [ #  # ][ #  # ]:          0 :                             }
     237         [ #  # ]:          0 :                         }
     238                 :            :                     }
     239                 :            :                         // FALLTHROUGH intended
     240                 :            :                     case animations::AnimationNodeType::PAR:
     241                 :            :                         // FALLTHROUGH intended
     242                 :            :                     case animations::AnimationNodeType::SEQ:
     243                 :            :                     {
     244                 :            :                         NodeFunctor aFunctor( mrShapeHash,
     245                 :            :                                               xTargetShape,
     246         [ #  # ]:          0 :                                               nParagraphIndex );
     247                 :          0 :                         if( !::anim::for_each_childNode( xNode,
     248         [ #  # ]:          0 :                                                          aFunctor ) )
     249                 :            :                         {
     250                 :            :                             OSL_FAIL( "AnimCore: NodeFunctor::operator(): child node iteration failed, "
     251                 :            :                                         "or extraneous container nodes encountered" );
     252         [ #  # ]:          0 :                         }
     253                 :            :                     }
     254                 :          0 :                     break;
     255                 :            : 
     256                 :            :                     case animations::AnimationNodeType::CUSTOM:
     257                 :            :                         // FALLTHROUGH intended
     258                 :            :                     case animations::AnimationNodeType::ANIMATE:
     259                 :            :                         // FALLTHROUGH intended
     260                 :            :                     case animations::AnimationNodeType::ANIMATEMOTION:
     261                 :            :                         // FALLTHROUGH intended
     262                 :            :                     case animations::AnimationNodeType::ANIMATECOLOR:
     263                 :            :                         // FALLTHROUGH intended
     264                 :            :                     case animations::AnimationNodeType::ANIMATETRANSFORM:
     265                 :            :                         // FALLTHROUGH intended
     266                 :            :                     case animations::AnimationNodeType::TRANSITIONFILTER:
     267                 :            :                         // FALLTHROUGH intended
     268                 :            :                     case animations::AnimationNodeType::AUDIO:
     269                 :            :                         // FALLTHROUGH intended
     270                 :            :                     default:
     271                 :            :                         // ignore this node, no valuable content for now.
     272                 :          0 :                         break;
     273                 :            : 
     274                 :            :                     case animations::AnimationNodeType::SET:
     275                 :            :                     {
     276                 :            :                         // evaluate set node content
     277                 :            :                         uno::Reference< animations::XAnimate > xAnimateNode( xNode,
     278         [ #  # ]:          0 :                                                                              uno::UNO_QUERY );
     279                 :            : 
     280         [ #  # ]:          0 :                         if( !xAnimateNode.is() )
     281                 :            :                             break; // invalid node
     282                 :            : 
     283                 :            :                         // determine target shape (if any)
     284         [ #  # ]:          0 :                         ShapeHashKey aTarget;
     285         [ #  # ]:          0 :                         if( xTargetShape.is() )
     286                 :            :                         {
     287                 :            :                             // override target shape with parent-supplied
     288         [ #  # ]:          0 :                             aTarget.mxRef = xTargetShape;
     289                 :          0 :                             aTarget.mnParagraphIndex = nParagraphIndex;
     290                 :            :                         }
     291                 :            :                         else
     292                 :            :                         {
     293                 :            :                             // no parent-supplied target, retrieve
     294                 :            :                             // node target
     295 [ #  # ][ #  # ]:          0 :                             if( (xAnimateNode->getTarget() >>= aTarget.mxRef) )
         [ #  # ][ #  # ]
     296                 :            :                             {
     297                 :            :                                 // pure shape target - set paragraph
     298                 :            :                                 // index to magic
     299                 :          0 :                                 aTarget.mnParagraphIndex = -1;
     300                 :            :                             }
     301                 :            :                             else
     302                 :            :                             {
     303                 :            :                                 // not a pure shape target - maybe a
     304                 :            :                                 // ParagraphTarget?
     305         [ #  # ]:          0 :                                 presentation::ParagraphTarget aUnoTarget;
     306                 :            : 
     307 [ #  # ][ #  # ]:          0 :                                 if( !(xAnimateNode->getTarget() >>= aUnoTarget) )
         [ #  # ][ #  # ]
     308                 :            :                                 {
     309                 :            :                                     OSL_FAIL( "AnimCore: NodeFunctor::operator(): unknown target type encountered" );
     310                 :            :                                     break;
     311                 :            :                                 }
     312                 :            : 
     313         [ #  # ]:          0 :                                 aTarget.mxRef = aUnoTarget.Shape;
     314 [ #  # ][ #  # ]:          0 :                                 aTarget.mnParagraphIndex = aUnoTarget.Paragraph;
     315                 :            :                             }
     316                 :            :                         }
     317                 :            : 
     318         [ #  # ]:          0 :                         if( !aTarget.mxRef.is() )
     319                 :            :                         {
     320                 :            :                             OSL_FAIL( "AnimCore: NodeFunctor::operator(): Found target, but XShape is NULL" );
     321                 :            :                             break; // invalid target XShape
     322                 :            :                         }
     323                 :            : 
     324                 :            :                         // check whether we already have an entry for
     325                 :            :                         // this target (we only take the first set
     326                 :            :                         // effect for every shape)
     327                 :          0 :                         XShapeHash::const_iterator aIter;
     328 [ #  # ][ #  # ]:          0 :                         if( (aIter=mrShapeHash.find( aTarget )) != mrShapeHash.end() )
                 [ #  # ]
     329                 :            :                             break; // already an entry in existence for given XShape
     330                 :            : 
     331                 :            :                         // if this is an appear effect, hide shape
     332                 :            :                         // initially. This is currently the only place
     333                 :            :                         // where a shape effect influences shape
     334                 :            :                         // attributes outside it's effective duration.
     335 [ #  # ][ #  # ]:          0 :                         if( xAnimateNode->getAttributeName().equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("visibility")) )
                 [ #  # ]
     336                 :            :                         {
     337                 :          0 :                             sal_Bool bVisible( sal_False );
     338                 :            : 
     339 [ #  # ][ #  # ]:          0 :                             uno::Any aAny( xAnimateNode->getTo() );
     340                 :            : 
     341                 :            :                             // try to extract bool value
     342         [ #  # ]:          0 :                             if( !(aAny >>= bVisible) )
     343                 :            :                             {
     344                 :            :                                 // try to extract string
     345                 :          0 :                                 ::rtl::OUString aString;
     346         [ #  # ]:          0 :                                 if( (aAny >>= aString) )
     347                 :            :                                 {
     348                 :            :                                     // we also take the strings "true" and "false",
     349                 :            :                                     // as well as "on" and "off" here
     350   [ #  #  #  # ]:          0 :                                     if( aString.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("true")) ||
                 [ #  # ]
     351                 :          0 :                                         aString.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("on")) )
     352                 :            :                                     {
     353                 :          0 :                                         bVisible = sal_True;
     354                 :            :                                     }
     355   [ #  #  #  # ]:          0 :                                     if( aString.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("false")) ||
                 [ #  # ]
     356                 :          0 :                                         aString.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("off")) )
     357                 :            :                                     {
     358                 :          0 :                                         bVisible = sal_False;
     359                 :            :                                     }
     360                 :          0 :                                 }
     361                 :            :                             }
     362                 :            : 
     363         [ #  # ]:          0 :                             if( bVisible )
     364                 :            :                             {
     365                 :            :                                 // target is set to 'visible' at the
     366                 :            :                                 // first relevant effect. Thus, target
     367                 :            :                                 // must be initially _hidden_, for the
     368                 :            :                                 // effect to have visible impact.
     369                 :            :                                 mrShapeHash.insert(
     370                 :            :                                     XShapeHash::value_type(
     371                 :            :                                         aTarget,
     372                 :            :                                         VectorOfNamedValues(
     373                 :            :                                             1,
     374                 :            :                                             beans::NamedValue(
     375         [ #  # ]:          0 :                                                 xAnimateNode->getAttributeName(),
     376 [ #  # ][ #  # ]:          0 :                                                 uno::makeAny( sal_False ) ) ) ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     377                 :          0 :                             }
     378 [ #  # ][ #  # ]:          0 :                         }
                 [ #  # ]
     379                 :            :                     }
     380                 :          0 :                     break;
     381         [ #  # ]:          0 :                 }
     382                 :            :             }
     383                 :            : 
     384                 :            :         private:
     385                 :            :             XShapeHash&                         mrShapeHash;
     386                 :            :             uno::Reference< drawing::XShape >   mxTargetShape;
     387                 :            :             sal_Int16                           mnParagraphIndex;
     388                 :            :         };
     389                 :            :     }
     390                 :            : 
     391                 :            :     // --------------------------------------------------------------------
     392                 :            : 
     393                 :          0 :     TargetPropertiesCreator::TargetPropertiesCreator( const uno::Reference< uno::XComponentContext >&  ) :
     394                 :          0 :         TargetPropertiesCreator_Base( m_aMutex )
     395                 :            :     {
     396                 :          0 :     }
     397                 :            : 
     398         [ #  # ]:          0 :     TargetPropertiesCreator::~TargetPropertiesCreator()
     399                 :            :     {
     400         [ #  # ]:          0 :     }
     401                 :            : 
     402                 :          0 :     void SAL_CALL TargetPropertiesCreator::disposing()
     403                 :            :     {
     404 [ #  # ][ #  # ]:          0 :         ::osl::MutexGuard aGuard( m_aMutex );
     405                 :          0 :     }
     406                 :            : 
     407                 :            :     // XTargetPropertiesCreator
     408                 :          0 :     uno::Sequence< animations::TargetProperties > SAL_CALL TargetPropertiesCreator::createInitialTargetProperties
     409                 :            :         (
     410                 :            :             const uno::Reference< animations::XAnimationNode >& xRootNode
     411                 :            :         ) throw (uno::RuntimeException)
     412                 :            :     {
     413         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( m_aMutex );
     414                 :            : 
     415                 :            :         // scan all nodes for visibility changes, and record first
     416                 :            :         // 'visibility=true' for each shape
     417                 :            :         XShapeHash aShapeHash( 101,
     418         [ #  # ]:          0 :                                &refhasher );
     419                 :            : 
     420         [ #  # ]:          0 :         NodeFunctor aFunctor( aShapeHash );
     421                 :            : 
     422                 :            :         // TODO(F1): Maybe limit functor application to main sequence
     423                 :            :         // alone (CL said something that shape visibility is only
     424                 :            :         // affected by effects in the main sequence for PPT).
     425                 :            :         //
     426                 :            :         // OTOH, client code can pass us only the main sequence (which
     427                 :            :         // it actually does right now, for the slideshow implementation).
     428         [ #  # ]:          0 :         aFunctor( xRootNode );
     429                 :            : 
     430                 :            : 
     431                 :            :         // output to result sequence
     432                 :            :         // ----------------------------------------------------------------------
     433                 :            : 
     434         [ #  # ]:          0 :         uno::Sequence< animations::TargetProperties > aRes( aShapeHash.size() );
     435                 :            : 
     436                 :          0 :         ::std::size_t                       nCurrIndex(0);
     437         [ #  # ]:          0 :         XShapeHash::const_iterator          aCurr( aShapeHash.begin() );
     438         [ #  # ]:          0 :         const XShapeHash::const_iterator    aEnd ( aShapeHash.end()   );
     439         [ #  # ]:          0 :         while( aCurr != aEnd )
     440                 :            :         {
     441         [ #  # ]:          0 :             animations::TargetProperties& rCurrProps( aRes[ nCurrIndex++ ] );
     442                 :            : 
     443 [ #  # ][ #  # ]:          0 :             if( aCurr->first.mnParagraphIndex == -1 )
     444                 :            :             {
     445 [ #  # ][ #  # ]:          0 :                 rCurrProps.Target = uno::makeAny( aCurr->first.mxRef );
     446                 :            :             }
     447                 :            :             else
     448                 :            :             {
     449                 :            :                 rCurrProps.Target = uno::makeAny(
     450                 :            :                     presentation::ParagraphTarget(
     451         [ #  # ]:          0 :                         aCurr->first.mxRef,
     452 [ #  # ][ #  # ]:          0 :                         aCurr->first.mnParagraphIndex ) );
         [ #  # ][ #  # ]
     453                 :            :             }
     454                 :            : 
     455 [ #  # ][ #  # ]:          0 :             rCurrProps.Properties = ::comphelper::containerToSequence( aCurr->second );
         [ #  # ][ #  # ]
     456                 :            : 
     457                 :          0 :             ++aCurr;
     458                 :            :         }
     459                 :            : 
     460 [ #  # ][ #  # ]:          0 :         return aRes;
                 [ #  # ]
     461                 :            :     }
     462                 :            : 
     463                 :            :     // XServiceInfo
     464                 :          0 :     ::rtl::OUString SAL_CALL TargetPropertiesCreator::getImplementationName() throw( uno::RuntimeException )
     465                 :            :     {
     466                 :          0 :         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) );
     467                 :            :     }
     468                 :            : 
     469                 :          0 :     sal_Bool SAL_CALL TargetPropertiesCreator::supportsService( const ::rtl::OUString& ServiceName ) throw( uno::RuntimeException )
     470                 :            :     {
     471                 :          0 :         return ServiceName.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM(SERVICE_NAME));
     472                 :            :     }
     473                 :            : 
     474                 :          0 :     uno::Sequence< ::rtl::OUString > SAL_CALL TargetPropertiesCreator::getSupportedServiceNames()  throw( uno::RuntimeException )
     475                 :            :     {
     476                 :          0 :         uno::Sequence< ::rtl::OUString > aRet(1);
     477 [ #  # ][ #  # ]:          0 :         aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
     478                 :            : 
     479                 :          0 :         return aRet;
     480                 :            :     }
     481                 :            : 
     482                 :            :     // XServiceName
     483                 :          0 :     ::rtl::OUString SAL_CALL TargetPropertiesCreator::getServiceName(  ) throw (uno::RuntimeException)
     484                 :            :     {
     485                 :          0 :         return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICE_NAME ) );
     486                 :            :     }
     487                 :            : 
     488                 :            : } // namespace animcore
     489                 :            : 
     490                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10