LCOV - code coverage report
Current view: top level - sd/source/filter/ppt - pptinanimations.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1423 0.0 %
Date: 2014-04-14 Functions: 0 52 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
      21             : #include <com/sun/star/animations/AnimationFill.hpp>
      22             : #include <com/sun/star/animations/AnimationRestart.hpp>
      23             : #include <com/sun/star/animations/Timing.hpp>
      24             : #include <com/sun/star/animations/Event.hpp>
      25             : #include <com/sun/star/animations/AnimationEndSync.hpp>
      26             : #include <com/sun/star/animations/Command.hpp>
      27             : #include <com/sun/star/animations/EventTrigger.hpp>
      28             : #include <com/sun/star/animations/AnimationNodeType.hpp>
      29             : #include <com/sun/star/animations/AnimationTransformType.hpp>
      30             : #include <com/sun/star/animations/AnimationCalcMode.hpp>
      31             : #include <com/sun/star/animations/AnimationValueType.hpp>
      32             : #include <com/sun/star/animations/AnimationAdditiveMode.hpp>
      33             : #include <com/sun/star/animations/XIterateContainer.hpp>
      34             : #include <com/sun/star/animations/XAnimateSet.hpp>
      35             : #include <com/sun/star/animations/XAudio.hpp>
      36             : #include <com/sun/star/animations/XCommand.hpp>
      37             : #include <com/sun/star/animations/XTransitionFilter.hpp>
      38             : #include <com/sun/star/animations/XAnimateColor.hpp>
      39             : #include <com/sun/star/animations/XAnimateMotion.hpp>
      40             : #include <com/sun/star/animations/XAnimateTransform.hpp>
      41             : #include <com/sun/star/animations/ValuePair.hpp>
      42             : #include <com/sun/star/animations/AnimationColorSpace.hpp>
      43             : #include <com/sun/star/presentation/EffectNodeType.hpp>
      44             : #include <com/sun/star/presentation/EffectPresetClass.hpp>
      45             : #include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
      46             : #include <com/sun/star/presentation/EffectCommands.hpp>
      47             : #include <com/sun/star/beans/NamedValue.hpp>
      48             : #include <com/sun/star/drawing/FillStyle.hpp>
      49             : #include <com/sun/star/drawing/LineStyle.hpp>
      50             : #include <com/sun/star/awt/FontWeight.hpp>
      51             : #include <com/sun/star/awt/FontUnderline.hpp>
      52             : #include <com/sun/star/awt/FontSlant.hpp>
      53             : #include <com/sun/star/container/XEnumerationAccess.hpp>
      54             : #include <com/sun/star/presentation/ParagraphTarget.hpp>
      55             : #include <com/sun/star/presentation/TextAnimationType.hpp>
      56             : #include <comphelper/processfactory.hxx>
      57             : #include <rtl/ustrbuf.hxx>
      58             : #include <rtl/math.hxx>
      59             : 
      60             : #include <vcl/vclenum.hxx>
      61             : #include <svx/svdotext.hxx>
      62             : #include <editeng/outlobj.hxx>
      63             : #include <editeng/editobj.hxx>
      64             : #include <pptinanimations.hxx>
      65             : #include <pptatom.hxx>
      66             : #include "pptin.hxx"
      67             : #include <algorithm>
      68             : 
      69             : using ::std::map;
      70             : using ::com::sun::star::beans::NamedValue;
      71             : using ::com::sun::star::container::XEnumerationAccess;
      72             : using ::com::sun::star::container::XEnumeration;
      73             : using ::com::sun::star::lang::XMultiServiceFactory;
      74             : 
      75             : using namespace ::com::sun::star::uno;
      76             : using namespace ::com::sun::star::drawing;
      77             : using namespace ::com::sun::star::animations;
      78             : using namespace ::com::sun::star::presentation;
      79             : 
      80             : namespace sd
      81             : {
      82             : extern Reference< XInterface > RandomAnimationNode_createInstance( sal_Int16 nPresetClass );
      83             : }
      84             : 
      85             : namespace ppt
      86             : {
      87             : 
      88           0 : const transition* transition::find( const OUString& rName )
      89             : {
      90           0 :     const transition* p = gTransitions;
      91             : 
      92           0 :     while( p->mpName )
      93             :     {
      94           0 :         if( rName.equalsAscii( p->mpName ) )
      95           0 :             return p;
      96             : 
      97           0 :         p++;
      98             :     }
      99             : 
     100           0 :     return NULL;
     101             : }
     102             : 
     103             : 
     104             : 
     105             : 
     106             : 
     107             : 
     108             : 
     109           0 : SvStream& operator>>(SvStream& rIn, AnimationNode& rNode )
     110             : {
     111           0 :     rIn.ReadInt32( rNode.mnU1 );
     112           0 :     rIn.ReadInt32( rNode.mnRestart );
     113           0 :     rIn.ReadInt32( rNode.mnGroupType );
     114           0 :     rIn.ReadInt32( rNode.mnFill );
     115           0 :     rIn.ReadInt32( rNode.mnU3 );
     116           0 :     rIn.ReadInt32( rNode.mnU4 );
     117           0 :     rIn.ReadInt32( rNode.mnDuration );
     118           0 :     rIn.ReadInt32( rNode.mnNodeType );
     119             : 
     120           0 :     return rIn;
     121             : }
     122             : 
     123             : 
     124             : 
     125           0 : static bool convertMeasure( OUString& rString )
     126             : {
     127           0 :     bool bRet = false;
     128             : 
     129           0 :     const sal_Char* pSource[] = { "ppt_x", "ppt_y", "ppt_w", "ppt_h", NULL };
     130           0 :     const sal_Char* pDest[] = { "x", "y", "width", "height", NULL };
     131           0 :     sal_Int32 nIndex = 0;
     132             : 
     133           0 :     const sal_Char** ps = pSource;
     134           0 :     const sal_Char** pd = pDest;
     135             : 
     136           0 :     while( *ps )
     137             :     {
     138           0 :         const OUString aSearch( OUString::createFromAscii( *ps ) );
     139           0 :         while( (nIndex = rString.indexOf( aSearch, nIndex )) != -1  )
     140             :         {
     141           0 :             sal_Int32 nLength = aSearch.getLength();
     142           0 :             if( nIndex && (rString[nIndex-1] == '#' ) )
     143             :             {
     144           0 :                 nIndex--;
     145           0 :                 nLength++;
     146             :             }
     147             : 
     148           0 :             const OUString aNew( OUString::createFromAscii( *pd ) );
     149           0 :             rString = rString.replaceAt( nIndex, nLength, aNew );
     150           0 :             nIndex += aNew.getLength();
     151           0 :             bRet = true;
     152           0 :         }
     153           0 :         ps++;
     154           0 :         pd++;
     155           0 :     }
     156             : 
     157           0 :     return bRet;
     158             : }
     159             : 
     160             : 
     161             : 
     162             : 
     163           0 : bool PropertySet::hasProperty( sal_Int32 nProperty ) const
     164             : {
     165           0 :     return maProperties.find( nProperty ) != maProperties.end();
     166             : }
     167             : 
     168             : 
     169             : 
     170           0 : Any PropertySet::getProperty( sal_Int32 nProperty ) const
     171             : {
     172           0 :     PropertySetMap_t::const_iterator aIter( maProperties.find( nProperty ) );
     173           0 :     if( aIter != maProperties.end() )
     174           0 :         return (*aIter).second;
     175             :     else
     176           0 :         return Any();
     177             : }
     178             : 
     179             : 
     180             : 
     181             : /** this adds an any to another any.
     182             :     if rNewValue is empty, rOldValue is returned.
     183             :     if rOldValue is empty, rNewValue is returned.
     184             :     if rOldValue contains a value, a sequence with rOldValue and rNewValue is returned.
     185             :     if rOldValue contains a sequence, a new sequence with the old sequence and rNewValue is returned.
     186             : */
     187           0 : static Any addToSequence( const Any& rOldValue, const Any& rNewValue )
     188             : {
     189           0 :     if( !rNewValue.hasValue() )
     190             :     {
     191           0 :         return rOldValue;
     192             :     }
     193           0 :     else if( !rOldValue.hasValue() )
     194             :     {
     195           0 :         return rNewValue;
     196             :     }
     197             :     else
     198             :     {
     199           0 :         Sequence< Any > aNewSeq;
     200           0 :         if( rOldValue >>= aNewSeq )
     201             :         {
     202           0 :             sal_Int32 nSize = aNewSeq.getLength();
     203           0 :             aNewSeq.realloc(nSize+1);
     204           0 :             aNewSeq[nSize] = rNewValue;
     205             :         }
     206             :         else
     207             :         {
     208           0 :             aNewSeq.realloc(2);
     209           0 :             aNewSeq[0] = rOldValue;
     210           0 :             aNewSeq[1] = rNewValue;
     211             :         }
     212           0 :         return makeAny( aNewSeq );
     213             :     }
     214             : }
     215             : 
     216             : 
     217             : 
     218           0 : AnimationImporter::AnimationImporter( ImplSdPPTImport* pPPTImport, SvStream& rStCtrl )
     219           0 : : mpPPTImport( pPPTImport ), mrStCtrl( rStCtrl )
     220             : {
     221           0 : }
     222             : 
     223             : 
     224             : 
     225           0 : int AnimationImporter::import( const Reference< XDrawPage >& xPage, const DffRecordHeader& rProgTagContentHd )
     226             : {
     227           0 :     int nNodes = 0;
     228             : 
     229             : #ifdef DBG_ANIM_LOG
     230             :     static int ppt_anim_debug_stream_number = 1;
     231             :     OUString ppt_anim_debug_filename("ppt-animation-import-debug-output-");
     232             :     ppt_anim_debug_filename += OUString::number(ppt_anim_debug_stream_number++);
     233             :     ppt_anim_debug_filename += ".xml";
     234             :     mpFile = fopen( OUStringToOString( ppt_anim_debug_filename, RTL_TEXTENCODING_UTF8).getStr() , "w+" );
     235             : #endif
     236           0 :     dump("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
     237             : 
     238           0 :     Reference< XAnimationNodeSupplier > xNodeSupplier( xPage, UNO_QUERY );
     239           0 :     if( xNodeSupplier.is() )
     240             :     {
     241           0 :         mxRootNode = xNodeSupplier->getAnimationNode();
     242           0 :         if( mxRootNode.is() )
     243             :         {
     244           0 :             Reference< XAnimationNode > xParent;
     245             : 
     246           0 :             boost::scoped_ptr<Atom> pAtom(Atom::import( rProgTagContentHd, mrStCtrl ));
     247           0 :             if( pAtom )
     248             :             {
     249           0 :                 nNodes = importAnimationContainer( pAtom.get(), xParent );
     250             :             }
     251             : 
     252           0 :             processAfterEffectNodes();
     253             :         }
     254             :     }
     255             : 
     256             : #ifdef DBG_ANIM_LOG
     257             :     fclose( mpFile );
     258             : #endif
     259             : 
     260           0 :     return nNodes;
     261             : }
     262             : 
     263             : 
     264             : 
     265           0 : void AnimationImporter::processAfterEffectNodes()
     266             : {
     267           0 :     std::for_each( maAfterEffectNodes.begin(), maAfterEffectNodes.end(), sd::stl_process_after_effect_node_func );
     268           0 : }
     269             : 
     270             : 
     271             : 
     272           0 : Reference< XAnimationNode > AnimationImporter::createNode( const Atom* pAtom, const AnimationNode& rNode )
     273             : {
     274           0 :     const char* pServiceName = NULL;
     275             : 
     276           0 :     switch( rNode.mnGroupType )
     277             :     {
     278             :     case mso_Anim_GroupType_PAR:
     279           0 :         if( pAtom->hasChildAtom( DFF_msofbtAnimIteration ) )
     280           0 :             pServiceName = "com.sun.star.animations.IterateContainer";
     281             :         else
     282           0 :             pServiceName = "com.sun.star.animations.ParallelTimeContainer";
     283           0 :         break;
     284             :     case mso_Anim_GroupType_SEQ:
     285           0 :         pServiceName = "com.sun.star.animations.SequenceTimeContainer";
     286           0 :         break;
     287             :     case mso_Anim_GroupType_NODE:
     288             :     {
     289           0 :         switch( rNode.mnNodeType )
     290             :         {
     291             :         case mso_Anim_Behaviour_FILTER:
     292             :         case mso_Anim_Behaviour_ANIMATION:
     293           0 :             if( pAtom->hasChildAtom( DFF_msofbtAnimateSet ) )
     294           0 :                 pServiceName = "com.sun.star.animations.AnimateSet";
     295           0 :             else if( pAtom->hasChildAtom( DFF_msofbtAnimateColor ) )
     296           0 :                 pServiceName = "com.sun.star.animations.AnimateColor";
     297           0 :             else if( pAtom->hasChildAtom( DFF_msofbtAnimateScale ) )
     298           0 :                 pServiceName = "com.sun.star.animations.AnimateTransform";
     299           0 :             else if( pAtom->hasChildAtom( DFF_msofbtAnimateRotation ) )
     300           0 :                 pServiceName = "com.sun.star.animations.AnimateTransform";
     301           0 :             else if( pAtom->hasChildAtom( DFF_msofbtAnimateMotion ) )
     302           0 :                 pServiceName = "com.sun.star.animations.AnimateMotion";
     303           0 :             else if( pAtom->hasChildAtom( DFF_msofbtAnimateFilter ) )
     304           0 :                 pServiceName = "com.sun.star.animations.TransitionFilter";
     305           0 :             else if( pAtom->hasChildAtom( DFF_msofbtAnimCommand ) )
     306           0 :                 pServiceName = "com.sun.star.animations.Command";
     307             :             else
     308           0 :                 pServiceName = "com.sun.star.animations.Animate";
     309           0 :             break;
     310             :         }
     311           0 :         break;
     312             :     }
     313             :     case mso_Anim_GroupType_MEDIA:
     314           0 :         pServiceName = "com.sun.star.animations.Audio";
     315           0 :         break;
     316             : 
     317             :     default:
     318           0 :         pServiceName = "com.sun.star.animations.Animate";
     319           0 :         break;
     320             :     }
     321             : 
     322           0 :     Reference< XAnimationNode > xNode;
     323           0 :     if( pServiceName )
     324             :     {
     325           0 :         Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
     326           0 :         const OUString aServiceName( OUString::createFromAscii(pServiceName) );
     327           0 :         Reference< XInterface > xFac( xContext->getServiceManager()->createInstanceWithContext(aServiceName, xContext) );
     328           0 :         xNode.set(xFac , UNO_QUERY );
     329             :     }
     330             : 
     331             :     DBG_ASSERT( xNode.is(), "sd::AnimationImporter::createNode(), node creation failed!" );
     332           0 :     return xNode;
     333             : }
     334             : 
     335             : 
     336             : 
     337           0 : static bool is_random( const AnimationNode& rNode, const PropertySet& rSet, sal_Int32& rPresetClass )
     338             : {
     339           0 :     if( rNode.mnGroupType != mso_Anim_GroupType_PAR )
     340           0 :         return false;
     341             : 
     342           0 :     if( !rSet.hasProperty( DFF_ANIM_PRESET_ID ) || !rSet.hasProperty( DFF_ANIM_PRESET_CLASS ) )
     343           0 :         return false;
     344             : 
     345           0 :     sal_Int32 nPresetId = 0;
     346           0 :     if( !(rSet.getProperty( DFF_ANIM_PRESET_ID ) >>= nPresetId) || (nPresetId != 24) )
     347           0 :         return false;
     348             : 
     349           0 :     sal_Int32 nPresetClass = 0;
     350           0 :     if( !(rSet.getProperty( DFF_ANIM_PRESET_CLASS ) >>= nPresetClass) )
     351           0 :         return false;
     352             : 
     353           0 :     switch( nPresetClass )
     354             :     {
     355           0 :     case DFF_ANIM_PRESS_CLASS_ENTRANCE: rPresetClass = EffectPresetClass::ENTRANCE; return true;
     356           0 :     case DFF_ANIM_PRESS_CLASS_EXIT: rPresetClass = EffectPresetClass::EXIT; return true;
     357             :     }
     358           0 :     return false;
     359             : }
     360             : 
     361             : 
     362           0 : int AnimationImporter::importAnimationContainer( const Atom* pAtom, const Reference< XAnimationNode >& xParent )
     363             : {
     364           0 :     int nNodes = 0;
     365           0 :     if( pAtom->seekToContent() )
     366             :     {
     367           0 :         AnimationNode aNode;
     368           0 :         const Atom* pAnimationNodeAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimNode );
     369           0 :         if( pAnimationNodeAtom && pAnimationNodeAtom->seekToContent() )
     370           0 :             mrStCtrl >> aNode;
     371             : 
     372           0 :         PropertySet aSet;
     373           0 :         const Atom* pAnimationPropertySetAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimPropertySet );
     374           0 :         if( pAnimationPropertySetAtom )
     375           0 :             importPropertySetContainer( pAnimationPropertySetAtom, aSet );
     376             : 
     377           0 :         Reference< XAnimationNode > xNode;
     378             : 
     379           0 :         if( xParent.is() )
     380             :         {
     381             :             sal_Int32 nPresetClass;
     382           0 :             if( is_random( aNode, aSet, nPresetClass ) )
     383             :             {
     384             :                 // create a random animation node with the given preset class
     385           0 :                 xNode.set( sd::RandomAnimationNode_createInstance( (sal_Int16)nPresetClass ), UNO_QUERY );
     386             :             }
     387             : 
     388           0 :             if( !xNode.is() )
     389             :             {
     390             :                 // create a node for the given atom
     391           0 :                 xNode = createNode( pAtom, aNode );
     392             :             }
     393             :         }
     394             :         else
     395             :         {
     396             :             // if we have no parent we fill the root node
     397           0 :             xNode = mxRootNode;
     398             :         }
     399             : 
     400             :         // import if we have a node and its not random
     401           0 :         if( xNode.is() )
     402             :         {
     403           0 :             fillNode( xNode, aNode, aSet );
     404             : 
     405           0 :             switch( aNode.mnGroupType )
     406             :             {
     407             :             case mso_Anim_GroupType_PAR:
     408             :             {
     409           0 :                 dump( "<par" );
     410           0 :                 dump( aNode );
     411           0 :                 dump( aSet );
     412           0 :                 nNodes += importTimeContainer( pAtom, xNode );
     413           0 :                 dump( "</par>\n" );
     414             : 
     415             :                 // for iteration containers, map target from children to iteration
     416           0 :                 Reference< XIterateContainer > xIter( xNode, UNO_QUERY );
     417           0 :                 if( xIter.is() )
     418             :                 {
     419           0 :                     double fDuration = 0.0;
     420           0 :                     Any aTarget, aEmpty;
     421           0 :                     Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY );
     422           0 :                     if( xEnumerationAccess.is() )
     423             :                     {
     424           0 :                         Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
     425           0 :                         if( xEnumeration.is() )
     426             :                         {
     427           0 :                             while( xEnumeration->hasMoreElements() )
     428             :                             {
     429           0 :                                 Reference< XAnimate > xChildNode( xEnumeration->nextElement(), UNO_QUERY );
     430           0 :                                 if( xChildNode.is() )
     431             :                                 {
     432           0 :                                     double fChildBegin = 0.0;
     433           0 :                                     double fChildDuration = 0.0;
     434           0 :                                     xChildNode->getBegin() >>= fChildBegin;
     435           0 :                                     xChildNode->getDuration() >>= fChildDuration;
     436             : 
     437           0 :                                     fChildDuration += fChildBegin;
     438           0 :                                     if( fChildDuration > fDuration )
     439           0 :                                         fDuration = fChildDuration;
     440             : 
     441           0 :                                     if( !aTarget.hasValue() )
     442           0 :                                         aTarget = xChildNode->getTarget();
     443             : 
     444           0 :                                     xChildNode->setTarget( aEmpty );
     445             :                                 }
     446           0 :                             }
     447           0 :                         }
     448             :                     }
     449             : 
     450           0 :                     xIter->setTarget( aTarget );
     451             : 
     452           0 :                     double fIterateInterval = xIter->getIterateInterval() * fDuration / 100;
     453           0 :                     xIter->setIterateInterval( fIterateInterval );
     454           0 :                 }
     455             :             }
     456           0 :             break;
     457             : 
     458             :             case mso_Anim_GroupType_SEQ:
     459             :             {
     460           0 :                 dump( "<seq" );
     461           0 :                 dump( aNode );
     462           0 :                 dump( aSet );
     463           0 :                 nNodes += importTimeContainer( pAtom, xNode );
     464           0 :                 dump( "</seq>\n" );
     465             : 
     466           0 :                 if( aSet.hasProperty( DFF_ANIM_NODE_TYPE ) )
     467             :                 {
     468           0 :                     sal_Int32 nPPTNodeType = 0;
     469           0 :                     if( aSet.getProperty( DFF_ANIM_NODE_TYPE ) >>= nPPTNodeType )
     470             :                     {
     471           0 :                         switch(nPPTNodeType)
     472             :                         {
     473             :                         case DFF_ANIM_NODE_TYPE_MAIN_SEQUENCE:
     474           0 :                             fixMainSequenceTiming( xNode );
     475           0 :                             break;
     476             :                         case DFF_ANIM_NODE_TYPE_INTERACTIVE_SEQ:
     477           0 :                             fixInteractiveSequenceTiming( xNode );
     478           0 :                             break;
     479             :                         }
     480             :                     }
     481             :                 }
     482             :             }
     483           0 :             break;
     484             : 
     485             :             case mso_Anim_GroupType_NODE:
     486             :             {
     487             : #ifdef DBG_ANIM_LOG
     488             :                 if( pAtom->hasChildAtom( DFF_msofbtAnimateSet ) )
     489             :                 {
     490             :                     dump( "<set" );
     491             :                 }
     492             :                 else if( pAtom->hasChildAtom( DFF_msofbtAnimateColor ) )
     493             :                 {
     494             :                     dump( "<animateColor" );
     495             :                 }
     496             :                 else if( pAtom->hasChildAtom( DFF_msofbtAnimateScale ) )
     497             :                 {
     498             :                     dump( "<animateScale" );
     499             :                 }
     500             :                 else if( pAtom->hasChildAtom( DFF_msofbtAnimateRotation ) )
     501             :                 {
     502             :                     dump( "<animateRotation" );
     503             :                 }
     504             :                 else if( pAtom->hasChildAtom( DFF_msofbtAnimateMotion ) )
     505             :                 {
     506             :                     dump( "<animateMotion" );
     507             :                 }
     508             :                 else if( pAtom->hasChildAtom( DFF_msofbtAnimate ) )
     509             :                 {
     510             :                     dump( "<animate" );
     511             :                 }
     512             :                 else if( pAtom->hasChildAtom( DFF_msofbtAnimateFilter ) )
     513             :                 {
     514             :                     dump( "<animateFilter" );
     515             :                 }
     516             :                 else if( pAtom->hasChildAtom( DFF_msofbtAnimCommand ) )
     517             :                 {
     518             :                     dump( "<command" );
     519             :                 }
     520             :                 else
     521             :                 {
     522             :                     OSL_FAIL( "unknown node atom!" );
     523             :                     dump_atom_header( pAtom, true, false );
     524             :                     dump_atom( pAtom );
     525             :                     dump_atom_header( pAtom, false, false );
     526             :                     break;
     527             :                 }
     528             :                 dump( aNode );
     529             :                 dump( aSet );
     530             : #endif
     531           0 :                 int nANCNodes = importAnimationNodeContainer( pAtom, xNode );
     532           0 :                 if( !convertAnimationNode( xNode, xParent ) )
     533           0 :                     xNode = 0;
     534             :                 else
     535           0 :                     nNodes += nANCNodes;
     536           0 :                 dump( "/>\n");
     537             : 
     538             :             }
     539           0 :             break;
     540             : 
     541             :             case mso_Anim_GroupType_MEDIA:
     542             :             {
     543           0 :                 dump( "<audio" );
     544           0 :                 dump( aNode );
     545           0 :                 dump( aSet );
     546           0 :                 nNodes += importAudioContainer( pAtom, xNode );
     547           0 :                 dump( "</audio>\n" );
     548             :             }
     549           0 :             break;
     550             : 
     551             :             default:
     552             :                 OSL_FAIL( "unknown group atom!" );
     553             : 
     554           0 :                 dump_atom_header( pAtom, true, false );
     555           0 :                 dump_atom( pAtom );
     556           0 :                 dump_atom_header( pAtom, false, false );
     557           0 :                 break;
     558             : 
     559             :             }
     560             :         }
     561             : 
     562           0 :         if( xParent.is() && xNode.is() )
     563             :         {
     564           0 :             Reference< XTimeContainer > xParentContainer( xParent, UNO_QUERY );
     565             :             DBG_ASSERT( xParentContainer.is(), "parent is no container, then why do I have a child here?" );
     566           0 :             if( xParentContainer.is() )
     567             :             {
     568           0 :                 xParentContainer->appendChild( xNode );
     569           0 :             }
     570           0 :         }
     571             :     }
     572             : 
     573           0 :     return nNodes;
     574             : }
     575             : 
     576             : 
     577           0 : void AnimationImporter::fixMainSequenceTiming( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode )
     578             : {
     579             :     try
     580             :     {
     581           0 :         bool bFirst = true;
     582           0 :         Reference< XEnumerationAccess > xEA( xNode, UNO_QUERY_THROW );
     583           0 :         Reference< XEnumeration > xE( xEA->createEnumeration(), UNO_QUERY_THROW );
     584           0 :         while( xE->hasMoreElements() )
     585             :         {
     586             :             // click node
     587           0 :             Reference< XAnimationNode > xClickNode( xE->nextElement(), UNO_QUERY );
     588             : 
     589           0 :             Event aEvent;
     590           0 :             aEvent.Trigger = EventTrigger::ON_NEXT;
     591           0 :             aEvent.Repeat = 0;
     592           0 :             xClickNode->setBegin( makeAny( aEvent ) );
     593             : 
     594           0 :             if( bFirst )
     595             :             {
     596           0 :                 bFirst = false;
     597           0 :                 Reference< XEnumerationAccess > xEA2( xClickNode, UNO_QUERY_THROW );
     598           0 :                 Reference< XEnumeration > xE2( xEA2->createEnumeration(), UNO_QUERY_THROW );
     599           0 :                 if( xE2->hasMoreElements() )
     600             :                 {
     601             :                     // with node
     602           0 :                     xE2->nextElement() >>= xEA2;
     603           0 :                     if( xEA2.is() )
     604           0 :                         xE2.query( xEA2->createEnumeration() );
     605             :                     else
     606           0 :                         xE2.clear();
     607             : 
     608           0 :                     if( xE2.is() && xE2->hasMoreElements() )
     609             :                     {
     610           0 :                         Reference< XAnimationNode > xEffectNode( xE2->nextElement(), UNO_QUERY_THROW );
     611           0 :                         const Sequence< NamedValue > aUserData( xEffectNode->getUserData() );
     612           0 :                         const NamedValue* p = aUserData.getConstArray();
     613           0 :                         sal_Int32 nLength = aUserData.getLength();
     614           0 :                         while( nLength-- )
     615             :                         {
     616           0 :                             if ( p->Name == "node-type" )
     617             :                             {
     618           0 :                                 sal_Int16 nNodeType = 0;
     619           0 :                                 p->Value >>= nNodeType;
     620           0 :                                 if( nNodeType != ::com::sun::star::presentation::EffectNodeType::ON_CLICK )
     621             :                                 {
     622             :                                     // first effect does not start on click, so correct
     623             :                                     // first click nodes begin to 0s
     624           0 :                                     xClickNode->setBegin( makeAny( (double)0.0 ) );
     625           0 :                                     break;
     626             :                                 }
     627             :                             }
     628           0 :                             p++;
     629           0 :                         }
     630             :                     }
     631           0 :                 }
     632             :             }
     633           0 :         }
     634             :     }
     635           0 :     catch( Exception& )
     636             :     {
     637             :         OSL_FAIL("sd::AnimationImporter::fixMainSequenceTiming(), exception caught!" );
     638             :     }
     639           0 : }
     640             : 
     641             : 
     642             : 
     643           0 : void AnimationImporter::fixInteractiveSequenceTiming( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode )
     644             : {
     645             :     try
     646             :     {
     647           0 :         Any aBegin( xNode->getBegin() );
     648           0 :         Any aEmpty;
     649           0 :         xNode->setBegin( aEmpty );
     650             : 
     651           0 :         Reference< XEnumerationAccess > xEA( xNode, UNO_QUERY_THROW );
     652           0 :         Reference< XEnumeration > xE( xEA->createEnumeration(), UNO_QUERY_THROW );
     653           0 :         while( xE->hasMoreElements() )
     654             :         {
     655             :             // click node
     656           0 :             Reference< XAnimationNode > xClickNode( xE->nextElement(), UNO_QUERY );
     657           0 :             xClickNode->setBegin( aBegin );
     658           0 :         }
     659             :     }
     660           0 :     catch( Exception& )
     661             :     {
     662             :         OSL_FAIL("sd::AnimationImporter::fixInteractiveSequenceTiming(), exception caught!" );
     663             :     }
     664           0 : }
     665             : 
     666             : 
     667             : 
     668           0 : bool AnimationImporter::convertAnimationNode( const Reference< XAnimationNode >& xNode, const Reference< XAnimationNode >& xParent )
     669             : {
     670           0 :     Reference< XAnimate > xAnimate( xNode, UNO_QUERY );
     671           0 :     if( !xAnimate.is() )
     672           0 :         return true;
     673             : 
     674           0 :     if( !xAnimate->getTarget().hasValue() )
     675           0 :         return false;
     676             : 
     677           0 :     const sal_Int16 nNodeType = xNode->getType();
     678             : 
     679           0 :     if( nNodeType == AnimationNodeType::TRANSITIONFILTER )
     680           0 :         return true;
     681             : 
     682           0 :     OUString aAttributeName( xAnimate->getAttributeName() );
     683             : 
     684           0 :     if( (nNodeType == AnimationNodeType::SET) && aAttributeName == "fill.on" )
     685           0 :         return false;
     686             : 
     687           0 :     const ImplAttributeNameConversion* p = gImplConversionList;
     688             : 
     689           0 :     MS_AttributeNames eAttribute = MS_UNKNOWN;
     690             : 
     691           0 :     if( (nNodeType == AnimationNodeType::ANIMATEMOTION) ||
     692             :         (nNodeType == AnimationNodeType::ANIMATETRANSFORM) )
     693             :     {
     694           0 :         OUString aEmpty;
     695           0 :         aAttributeName = aEmpty;
     696             :     }
     697             :     else
     698             :     {
     699           0 :         while( p->mpMSName )
     700             :         {
     701           0 :             if( aAttributeName.equalsAscii( p->mpMSName ) )
     702           0 :                 break;
     703             : 
     704           0 :             p++;
     705             :         }
     706             : 
     707             :         DBG_ASSERT( p->mpMSName || aAttributeName.isEmpty(), "sd::AnimationImporter::convertAnimationNode(), unknown attribute!" );
     708             : #ifdef DBG_ANIM_LOG
     709             :         if( p->mpMSName == 0 ) dump( "<error text=\"sd::AnimationImporter::convertAnimationNode(), unknown attribute!\"/>\n" );
     710             : #endif
     711             : 
     712           0 :         eAttribute = p->meAttribute;
     713             : 
     714           0 :         if( p->mpAPIName )
     715           0 :             aAttributeName = OUString::createFromAscii( p->mpAPIName );
     716             :     }
     717             : 
     718           0 :     xAnimate->setAttributeName( aAttributeName );
     719             : 
     720           0 :     if( eAttribute != MS_UNKNOWN )
     721             :     {
     722           0 :         Any aAny( xAnimate->getFrom() );
     723           0 :         if( aAny.hasValue() )
     724             :         {
     725           0 :             if( convertAnimationValue( eAttribute, aAny ) )
     726           0 :                 xAnimate->setFrom( aAny );
     727             :         }
     728             : 
     729           0 :         aAny = xAnimate->getBy();
     730           0 :         if( aAny.hasValue() )
     731             :         {
     732           0 :             if( convertAnimationValue( eAttribute, aAny ) )
     733           0 :                 xAnimate->setBy( aAny );
     734             :         }
     735             : 
     736           0 :         aAny = xAnimate->getTo();
     737           0 :         if( aAny.hasValue() )
     738             :         {
     739           0 :             if( convertAnimationValue( eAttribute, aAny ) )
     740           0 :                 xAnimate->setTo( aAny );
     741             :         }
     742             : 
     743           0 :         Sequence< Any > aValues( xAnimate->getValues() );
     744           0 :         sal_Int32 nValues = aValues.getLength();
     745           0 :         if( nValues )
     746             :         {
     747           0 :             Any* p2 = aValues.getArray();
     748           0 :             while( nValues-- )
     749           0 :                 convertAnimationValue( eAttribute, *p2++ );
     750             : 
     751           0 :             xAnimate->setValues( aValues );
     752             :         }
     753             : 
     754           0 :         OUString aFormula( xAnimate->getFormula() );
     755           0 :         if( !aFormula.isEmpty() )
     756             :         {
     757           0 :             if( convertMeasure( aFormula ) )
     758           0 :                 xAnimate->setFormula( aFormula );
     759           0 :         }
     760             :     }
     761             : 
     762             :     // check for after-affect
     763           0 :     Sequence< NamedValue > aUserData( xNode->getUserData() );
     764           0 :     NamedValue* pValue = aUserData.getArray();
     765           0 :     NamedValue* pLastValue = pValue;
     766           0 :     sal_Int32 nLength = aUserData.getLength(), nRemoved = 0;
     767             : 
     768           0 :     sal_Bool bAfterEffect = false;
     769           0 :     sal_Int32 nMasterRel = 0;
     770           0 :     for( ; nLength--; pValue++ )
     771             :     {
     772           0 :         if ( pValue->Name == "after-effect" )
     773             :         {
     774           0 :             pValue->Value >>= bAfterEffect;
     775           0 :             nRemoved++;
     776             :         }
     777           0 :         else if ( pValue->Name == "master-rel" )
     778             :         {
     779           0 :             pValue->Value >>= nMasterRel;
     780           0 :             nRemoved++;
     781             :         }
     782             :         else
     783             :         {
     784           0 :             if( nRemoved )
     785           0 :                 *pLastValue = *pValue;
     786           0 :             pLastValue++;
     787             :         }
     788             :     }
     789             : 
     790           0 :     if( nRemoved )
     791             :     {
     792           0 :         aUserData.realloc( aUserData.getLength() - nRemoved );
     793           0 :         xNode->setUserData( aUserData );
     794             :     }
     795             : 
     796             :     // if its an after effect node, add it to the list for
     797             :     // later processing
     798             :     // after effect nodes are not inserted at their import
     799             :     // position, so return false in this case
     800           0 :     if( bAfterEffect )
     801             :     {
     802           0 :         if( nMasterRel != 2 )
     803             :         {
     804           0 :             Event aEvent;
     805             : 
     806           0 :             aEvent.Source <<= xParent;
     807           0 :             aEvent.Trigger = EventTrigger::END_EVENT;
     808           0 :             aEvent.Repeat = 0;
     809             : 
     810           0 :             xNode->setBegin( makeAny( aEvent ) );
     811             :         }
     812             : 
     813             :         // add to after effect nodes for later processing
     814           0 :         sd::AfterEffectNode aNode( xNode, xParent, nMasterRel == 2 );
     815           0 :         maAfterEffectNodes.push_back( aNode );
     816           0 :         return false;
     817             :     }
     818             : 
     819           0 :     return true;
     820             : }
     821             : 
     822           0 : static int lcl_gethex( int nChar )
     823             : {
     824           0 :     if( nChar >= '0' && nChar <= '9' )
     825           0 :         return nChar - '0';
     826           0 :     else if( nChar >= 'a' && nChar <= 'f' )
     827           0 :         return nChar - 'a' + 10;
     828           0 :     else if( nChar >= 'A' && nChar <= 'F' )
     829           0 :         return nChar - 'A' + 10;
     830             :     else
     831           0 :         return 0;
     832             : }
     833             : 
     834           0 : bool AnimationImporter::convertAnimationValue( MS_AttributeNames eAttribute, Any& rValue )
     835             : {
     836           0 :     bool bRet = false;
     837           0 :     switch( eAttribute )
     838             :     {
     839             :     case MS_PPT_X:
     840             :     case MS_PPT_Y:
     841             :     case MS_PPT_W:
     842             :     case MS_PPT_H:
     843             :     {
     844           0 :         OUString aString;
     845             : 
     846           0 :         if( rValue.getValueType() == ::getCppuType((const ValuePair*)0) )
     847             :         {
     848           0 :             ValuePair aValuePair;
     849           0 :             if( rValue >>= aValuePair )
     850             :             {
     851           0 :                 if( aValuePair.First >>= aString )
     852             :                 {
     853           0 :                     if( convertMeasure( aString ) )
     854             :                     {
     855           0 :                         aValuePair.First <<= aString;
     856           0 :                         bRet = true;
     857             :                     }
     858             :                 }
     859             : 
     860           0 :                 if( aValuePair.Second >>= aString )
     861             :                 {
     862           0 :                     if( convertMeasure( aString ) )
     863             :                     {
     864           0 :                         aValuePair.Second <<= aString;
     865           0 :                         bRet = true;
     866             :                     }
     867             :                 }
     868           0 :             }
     869             :         }
     870           0 :         else if( rValue.getValueType() == ::getCppuType((const OUString*)0) )
     871             :         {
     872           0 :             if( rValue >>= aString )
     873             :             {
     874           0 :                 bRet = convertMeasure( aString );
     875             : 
     876           0 :                 if( bRet )
     877           0 :                     rValue <<= aString;
     878             :             }
     879           0 :         }
     880             :     }
     881           0 :     break;
     882             : 
     883             :     case MS_XSHEAR:
     884             :     case MS_R:
     885             :     {
     886           0 :         OUString aString;
     887           0 :         if( rValue >>= aString )
     888             :         {
     889           0 :             rValue <<= aString.toDouble();
     890           0 :             bRet = true;
     891           0 :         }
     892             :     }
     893           0 :     break;
     894             : 
     895             :     case MS_STYLEROTATION:
     896             :     {
     897           0 :         if( rValue.getValueType() == ::getCppuType((const OUString*)0) )
     898             :         {
     899           0 :             OUString aString;
     900           0 :             rValue >>= aString;
     901           0 :             rValue <<= (sal_Int16)aString.toDouble();
     902           0 :             bRet = true;
     903             :         }
     904           0 :         else if( rValue.getValueType() == ::getCppuType((const double*)0) )
     905             :         {
     906           0 :             double fValue = 0.0;
     907           0 :             rValue >>= fValue;
     908           0 :             rValue <<= (sal_Int16)fValue;
     909           0 :             bRet = true;
     910             :         }
     911             :     }
     912           0 :     break;
     913             : 
     914             :     case MS_FILLCOLOR:
     915             :     case MS_STROKECOLOR:
     916             :     case MS_STYLECOLOR:
     917             :     case MS_PPT_C:
     918             :     {
     919           0 :         OUString aString;
     920           0 :         if( rValue >>= aString )
     921             :         {
     922           0 :             if( aString.getLength() >= 7 && aString[0] == '#' )
     923             :             {
     924           0 :                 Color aColor;
     925           0 :                 aColor.SetRed( (sal_uInt8)(lcl_gethex( aString[1] ) * 16 + lcl_gethex( aString[2] )) );
     926           0 :                 aColor.SetGreen( (sal_uInt8)(lcl_gethex( aString[3] ) * 16 + lcl_gethex( aString[4] )) );
     927           0 :                 aColor.SetBlue( (sal_uInt8)(lcl_gethex( aString[5] ) * 16 + lcl_gethex( aString[6] )) );
     928           0 :                 rValue <<= (sal_Int32)aColor.GetColor();
     929           0 :                 bRet = true;
     930             :             }
     931           0 :             else if( aString.matchAsciiL( "rgb(", 4, 0 ) )
     932             :             {
     933           0 :                 aString = aString.copy( 4, aString.getLength() - 5 );
     934           0 :                 Color aColor;
     935           0 :                 sal_Int32 index = 0;
     936           0 :                 aColor.SetRed( (sal_uInt8)aString.getToken( 0, (sal_Unicode)',', index ).toInt32() );
     937           0 :                 aColor.SetGreen( (sal_uInt8)aString.getToken( 0, (sal_Unicode)',', index ).toInt32() );
     938           0 :                 aColor.SetRed( (sal_uInt8)aString.getToken( 0, (sal_Unicode)',', index ).toInt32() );
     939           0 :                 rValue <<= (sal_Int32)aColor.GetColor();
     940           0 :                 bRet = true;
     941             :             }
     942           0 :             else if( aString.matchAsciiL( "hsl(", 4, 0 ) )
     943             :             {
     944           0 :                 sal_Int32 index = 0;
     945           0 :                 sal_Int32 nA = aString.getToken( 0, (sal_Unicode)',', index ).toInt32();
     946           0 :                 sal_Int32 nB = aString.getToken( 0, (sal_Unicode)',', index ).toInt32();
     947           0 :                 sal_Int32 nC = aString.getToken( 0, (sal_Unicode)',', index ).toInt32();
     948           0 :                 dump( "hsl(%ld", nA );
     949           0 :                 dump( ",%ld", nB );
     950           0 :                 dump( ",%ld)", nC );
     951           0 :                 Sequence< double > aHSL( 3 );
     952           0 :                 aHSL[0] = nA * 360.0/255.0;
     953           0 :                 aHSL[1] = nB / 255.0;
     954           0 :                 aHSL[2] = nC / 255.0;
     955           0 :                 rValue <<= aHSL;
     956           0 :                 bRet = true;
     957             :             }
     958           0 :         }
     959             :     }
     960           0 :     break;
     961             : 
     962             :     case MS_FILLTYPE:
     963             :     {
     964           0 :         OUString aString;
     965           0 :         if( rValue >>= aString )
     966             :         {
     967           0 :             rValue <<= aString == "solid" ? FillStyle_SOLID : FillStyle_NONE;
     968           0 :             bRet = true;
     969           0 :         }
     970             :     }
     971           0 :     break;
     972             : 
     973             :     case MS_STROKEON:
     974             :     {
     975           0 :         OUString aString;
     976           0 :         if( rValue >>= aString )
     977             :         {
     978           0 :             rValue <<= aString == "true" ? ::com::sun::star::drawing::LineStyle_SOLID : ::com::sun::star::drawing::LineStyle_NONE;
     979           0 :             bRet = true;
     980           0 :         }
     981             :     }
     982           0 :     break;
     983             : 
     984             :     case MS_FONTWEIGHT:
     985             :     {
     986           0 :         OUString aString;
     987           0 :         if( rValue >>= aString )
     988             :         {
     989           0 :             rValue <<= aString == "bold" ? com::sun::star::awt::FontWeight::BOLD : com::sun::star::awt::FontWeight::NORMAL;
     990           0 :             bRet = true;
     991           0 :         }
     992             :     }
     993           0 :     break;
     994             : 
     995             :     case MS_STYLEFONTSTYLE:
     996             :     {
     997           0 :         OUString aString;
     998           0 :         if( rValue >>= aString )
     999             :         {
    1000           0 :             rValue <<= aString == "italic" ? com::sun::star::awt::FontSlant_ITALIC : com::sun::star::awt::FontSlant_NONE;
    1001           0 :             bRet = true;
    1002           0 :         }
    1003             :     }
    1004           0 :     break;
    1005             : 
    1006             :     case MS_STYLEUNDERLINE:
    1007             :     {
    1008           0 :         OUString aString;
    1009           0 :         if( rValue >>= aString )
    1010             :         {
    1011           0 :             rValue <<= aString == "true" ? com::sun::star::awt::FontUnderline::SINGLE : com::sun::star::awt::FontUnderline::NONE;
    1012           0 :             bRet = true;
    1013           0 :         }
    1014             :     }
    1015           0 :     break;
    1016             : 
    1017             :     case MS_STYLEOPACITY:
    1018             :     case MS_STYLEFONTSIZE:
    1019             :     {
    1020           0 :         OUString aString;
    1021           0 :         if( rValue >>= aString )
    1022             :         {
    1023           0 :             rValue <<= (float)aString.toDouble();
    1024           0 :             bRet = true;
    1025           0 :         }
    1026             :     }
    1027           0 :     break;
    1028             : 
    1029             :     case MS_STYLEVISIBILITY:
    1030             :     {
    1031           0 :         OUString aString;
    1032           0 :         if( rValue >>= aString )
    1033             :         {
    1034           0 :             rValue <<= aString == "visible" ? sal_True : sal_False;
    1035           0 :             bRet = true;
    1036           0 :         }
    1037             :     }
    1038           0 :     break;
    1039             :     default:
    1040           0 :         break;
    1041             :     }
    1042             : 
    1043           0 :     return bRet;
    1044             : }
    1045             : 
    1046             : 
    1047             : 
    1048           0 : static OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId, sal_Int32 nPresetSubType )
    1049             : {
    1050           0 :     const sal_Char* pStr = 0;
    1051             : 
    1052           0 :     if( (nPresetClass == EffectPresetClass::ENTRANCE) || (nPresetClass == EffectPresetClass::EXIT) )
    1053             :     {
    1054             :         // skip wheel effect
    1055           0 :         if( nPresetId != 21 )
    1056             :         {
    1057           0 :             if( nPresetId == 5 )
    1058             :             {
    1059             :                 // checkerboard
    1060           0 :                 switch( nPresetSubType )
    1061             :                 {
    1062           0 :                 case  5: pStr = "downward"; break;
    1063           0 :                 case 10: pStr = "across"; break;
    1064             :                 }
    1065             :             }
    1066           0 :             else if( nPresetId == 17 )
    1067             :             {
    1068             :                 // stretch
    1069           0 :                 if( nPresetSubType == 10 )
    1070           0 :                     pStr = "across";
    1071             :             }
    1072           0 :             else if( nPresetId == 18 )
    1073             :             {
    1074             :                 // strips
    1075           0 :                 switch( nPresetSubType )
    1076             :                 {
    1077           0 :                 case 3: pStr = "right-to-top"; break;
    1078           0 :                 case 6: pStr = "right-to-bottom"; break;
    1079           0 :                 case 9: pStr = "left-to-top"; break;
    1080           0 :                 case 12: pStr = "left-to-bottom"; break;
    1081             :                 }
    1082             :             }
    1083             : 
    1084           0 :             if( pStr == 0 )
    1085             :             {
    1086           0 :                 const convert_subtype* p = gConvertArray;
    1087             : 
    1088           0 :                 while( p->mpStrSubType )
    1089             :                 {
    1090           0 :                     if( p->mnID == nPresetSubType )
    1091             :                     {
    1092           0 :                         pStr = p->mpStrSubType;
    1093           0 :                         break;
    1094             :                     }
    1095           0 :                     p++;
    1096             :                 }
    1097             :             }
    1098             :         }
    1099             :     }
    1100             : 
    1101           0 :     if( pStr )
    1102           0 :         return OUString::createFromAscii( pStr );
    1103             :     else
    1104           0 :         return OUString::number( nPresetSubType );
    1105             : }
    1106             : 
    1107             : 
    1108             : 
    1109           0 : void AnimationImporter::fillNode( Reference< XAnimationNode >& xNode, const AnimationNode& rNode, const PropertySet& rSet )
    1110             : {
    1111           0 :     sal_Bool bAfterEffect = false;
    1112             : 
    1113             :     // attribute Restart
    1114           0 :     if( rNode.mnRestart )
    1115             :     {
    1116           0 :         sal_Int16 nRestart = AnimationRestart::DEFAULT;
    1117           0 :         switch( rNode.mnRestart )
    1118             :         {
    1119           0 :         case 1: nRestart = AnimationRestart::ALWAYS; break;
    1120           0 :         case 2: nRestart = AnimationRestart::WHEN_NOT_ACTIVE; break;
    1121           0 :         case 3: nRestart = AnimationRestart::NEVER; break;
    1122             :         }
    1123           0 :         xNode->setRestart( nRestart );
    1124             :     }
    1125             : 
    1126             :     // attribute Fill
    1127           0 :     if( rNode.mnFill )
    1128             :     {
    1129           0 :         sal_Int16 nFill = AnimationFill::DEFAULT;
    1130           0 :         switch( rNode.mnFill )
    1131             :         {
    1132           0 :         case 1: nFill = AnimationFill::REMOVE; break;
    1133           0 :         case 2: nFill = AnimationFill::FREEZE; break;
    1134           0 :         case 3: nFill = AnimationFill::HOLD; break;
    1135           0 :         case 4: nFill = AnimationFill::TRANSITION; break;
    1136             :         }
    1137           0 :         xNode->setFill( nFill );
    1138             :     }
    1139             : 
    1140             :     // attribute Duration
    1141           0 :     if( rNode.mnDuration )
    1142             :     {
    1143           0 :         Any aDuration;
    1144           0 :         if( rNode.mnDuration > 0 )
    1145             :         {
    1146           0 :             aDuration <<= (double)(rNode.mnDuration / 1000.0);
    1147             :         }
    1148           0 :         else if( rNode.mnDuration < 0 )
    1149             :         {
    1150           0 :             aDuration <<= Timing_INDEFINITE;
    1151             :         }
    1152           0 :         xNode->setDuration( aDuration );
    1153             :     }
    1154             : 
    1155             :     // TODO: DFF_ANIM_PATH_EDIT_MODE
    1156           0 :     if( rSet.hasProperty( DFF_ANIM_PATH_EDIT_MODE ) )
    1157             :     {
    1158             :         sal_Int32 nPathEditMode ;
    1159           0 :         if( rSet.getProperty( DFF_ANIM_PATH_EDIT_MODE ) >>= nPathEditMode )
    1160             :         {
    1161             :         }
    1162             :     }
    1163             : 
    1164             :     // set user data
    1165           0 :     Sequence< NamedValue > aUserData;
    1166             : 
    1167             :     // attribute Type
    1168           0 :     if( rSet.hasProperty( DFF_ANIM_NODE_TYPE ) )
    1169             :     {
    1170           0 :         sal_Int32 nPPTNodeType = 0;
    1171           0 :         if( rSet.getProperty( DFF_ANIM_NODE_TYPE ) >>= nPPTNodeType )
    1172             :         {
    1173           0 :             sal_Int16 nNodeType = ::com::sun::star::presentation::EffectNodeType::DEFAULT;
    1174           0 :             switch( nPPTNodeType )
    1175             :             {
    1176           0 :                 case DFF_ANIM_NODE_TYPE_ON_CLICK:       nNodeType = ::com::sun::star::presentation::EffectNodeType::ON_CLICK;   break;
    1177           0 :                 case DFF_ANIM_NODE_TYPE_WITH_PREVIOUS:  nNodeType = ::com::sun::star::presentation::EffectNodeType::WITH_PREVIOUS; break;
    1178           0 :                 case DFF_ANIM_NODE_TYPE_AFTER_PREVIOUS: nNodeType = ::com::sun::star::presentation::EffectNodeType::AFTER_PREVIOUS; break;
    1179           0 :                 case DFF_ANIM_NODE_TYPE_MAIN_SEQUENCE:  nNodeType = ::com::sun::star::presentation::EffectNodeType::MAIN_SEQUENCE; break;
    1180           0 :                 case DFF_ANIM_NODE_TYPE_TIMING_ROOT:    nNodeType = ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT; break;
    1181           0 :                 case DFF_ANIM_NODE_TYPE_INTERACTIVE_SEQ:nNodeType = ::com::sun::star::presentation::EffectNodeType::INTERACTIVE_SEQUENCE; break;
    1182             :             }
    1183             : 
    1184           0 :             sal_Int32 nSize = aUserData.getLength();
    1185           0 :             aUserData.realloc(nSize+1);
    1186           0 :             aUserData[nSize].Name = "node-type";
    1187           0 :             aUserData[nSize].Value <<= nNodeType;
    1188             :         }
    1189             :     }
    1190             : 
    1191           0 :     if( rSet.hasProperty( DFF_ANIM_GROUP_ID ) )
    1192             :     {
    1193             :         sal_Int32 nGroupId;
    1194           0 :         if( rSet.getProperty( DFF_ANIM_GROUP_ID ) >>= nGroupId )
    1195             :         {
    1196           0 :             sal_Int32 nSize = aUserData.getLength();
    1197           0 :             aUserData.realloc(nSize+1);
    1198           0 :             aUserData[nSize].Name = "group-id";
    1199           0 :             aUserData[nSize].Value <<= nGroupId;
    1200             :         }
    1201             :     }
    1202             : 
    1203           0 :     sal_Int16 nEffectPresetClass = EffectPresetClass::CUSTOM;
    1204           0 :     sal_Int32 nPresetId = 0;
    1205             : 
    1206           0 :     if( rSet.hasProperty( DFF_ANIM_PRESET_CLASS ) )
    1207             :     {
    1208           0 :         sal_Int32 nPresetClass = 0;
    1209           0 :         if ( rSet.getProperty( DFF_ANIM_PRESET_CLASS ) >>= nPresetClass )
    1210             :         {
    1211           0 :             switch( nPresetClass )
    1212             :             {
    1213           0 :             case DFF_ANIM_PRESS_CLASS_ENTRANCE:     nEffectPresetClass = EffectPresetClass::ENTRANCE; break;
    1214           0 :             case DFF_ANIM_PRESS_CLASS_EXIT:         nEffectPresetClass = EffectPresetClass::EXIT; break;
    1215           0 :             case DFF_ANIM_PRESS_CLASS_EMPHASIS:     nEffectPresetClass = EffectPresetClass::EMPHASIS; break;
    1216           0 :             case DFF_ANIM_PRESS_CLASS_MOTIONPATH:   nEffectPresetClass = EffectPresetClass::MOTIONPATH; break;
    1217           0 :             case DFF_ANIM_PRESS_CLASS_OLE_ACTION:   nEffectPresetClass = EffectPresetClass::OLEACTION; break;
    1218           0 :             case DFF_ANIM_PRESS_CLASS_MEDIACALL:    nEffectPresetClass = EffectPresetClass::MEDIACALL; break;
    1219             :             }
    1220           0 :             sal_Int32 nSize = aUserData.getLength();
    1221           0 :             aUserData.realloc(nSize+1);
    1222           0 :             aUserData[nSize].Name = "preset-class";
    1223           0 :             aUserData[nSize].Value <<= nEffectPresetClass;
    1224             :         }
    1225             :     }
    1226             : 
    1227           0 :     if( rSet.hasProperty( DFF_ANIM_PRESET_ID ) )
    1228             :     {
    1229           0 :         if( rSet.getProperty( DFF_ANIM_PRESET_ID ) >>= nPresetId )
    1230             :         {
    1231           0 :             sal_Int32 nSize = aUserData.getLength();
    1232           0 :             aUserData.realloc(nSize+1);
    1233           0 :             aUserData[nSize].Name = "preset-id";
    1234             : 
    1235           0 :             const preset_maping* p = gPresetMaping;
    1236           0 :             while( p->mpStrPresetId && ((p->mnPresetClass != nEffectPresetClass) || (p->mnPresetId != nPresetId )) )
    1237           0 :                 p++;
    1238             : 
    1239           0 :             if( p->mpStrPresetId )
    1240             :             {
    1241           0 :                 aUserData[nSize].Value <<= OUString::createFromAscii( p->mpStrPresetId );
    1242             :             }
    1243             :             else
    1244             :             {
    1245           0 :                 OUStringBuffer sBuffer;
    1246           0 :                 sBuffer.appendAscii( "ppt_" );
    1247           0 :                 switch( nEffectPresetClass )
    1248             :                 {
    1249           0 :                 case EffectPresetClass::ENTRANCE: sBuffer.appendAscii( "entrance_" ); break;
    1250           0 :                 case EffectPresetClass::EXIT: sBuffer.appendAscii( "exit_" ); break;
    1251           0 :                 case EffectPresetClass::EMPHASIS: sBuffer.appendAscii( "emphasis_" ); break;
    1252           0 :                 case EffectPresetClass::MOTIONPATH: sBuffer.appendAscii( "motionpath_" ); break;
    1253           0 :                 case EffectPresetClass::OLEACTION: sBuffer.appendAscii( "oleaction_" ); break;
    1254           0 :                 case EffectPresetClass::MEDIACALL: sBuffer.appendAscii( "mediacall_" ); break;
    1255             :                 }
    1256           0 :                 sBuffer.append( nPresetId );
    1257             : 
    1258           0 :                 aUserData[nSize].Value <<= sBuffer.makeStringAndClear();
    1259             :             }
    1260             :         }
    1261             :     }
    1262             : 
    1263           0 :     if( rSet.hasProperty( DFF_ANIM_PRESET_SUB_TYPE ) )
    1264             :     {
    1265           0 :         sal_Int32 nPresetSubType = 0;
    1266           0 :         if( (rSet.getProperty( DFF_ANIM_PRESET_SUB_TYPE ) >>= nPresetSubType) )
    1267             :         {
    1268           0 :             if( nPresetSubType )
    1269             :             {
    1270           0 :                 sal_Int32 nSize = aUserData.getLength();
    1271           0 :                 aUserData.realloc(nSize+1);
    1272           0 :                 aUserData[nSize].Name = "preset-sub-type";
    1273           0 :                 aUserData[nSize].Value <<= getConvertedSubType( nEffectPresetClass, nPresetId, nPresetSubType );
    1274             :             }
    1275             :         }
    1276             :     }
    1277             : 
    1278           0 :     if( rSet.hasProperty( DFF_ANIM_AFTEREFFECT ) )
    1279             :     {
    1280           0 :         if( rSet.getProperty( DFF_ANIM_AFTEREFFECT ) >>= bAfterEffect )
    1281             :         {
    1282           0 :             sal_Int32 nSize = aUserData.getLength();
    1283           0 :             aUserData.realloc(nSize+1);
    1284           0 :             aUserData[nSize].Name = "after-effect";
    1285           0 :             aUserData[nSize].Value <<= bAfterEffect;
    1286             :         }
    1287             :     }
    1288             : 
    1289           0 :     if( bAfterEffect && rSet.hasProperty( DFF_ANIM_MASTERREL ) )
    1290             :     {
    1291           0 :         sal_Int32 nMasterRel = 2;
    1292           0 :         if( rSet.getProperty( DFF_ANIM_MASTERREL ) >>= nMasterRel )
    1293             :         {
    1294           0 :             sal_Int32 nSize = aUserData.getLength();
    1295           0 :             aUserData.realloc(nSize+1);
    1296           0 :             aUserData[nSize].Name = "master-rel";
    1297           0 :             aUserData[nSize].Value <<= nMasterRel;
    1298             :         }
    1299             :     }
    1300             : 
    1301           0 :     xNode->setUserData( aUserData );
    1302             : 
    1303             :     // TODO: DFF_ANIM_ID
    1304           0 :     if( rSet.hasProperty( DFF_ANIM_ID ) )
    1305             :     {
    1306           0 :         OUString aString;
    1307           0 :         rSet.getProperty( DFF_ANIM_ID ) >>= aString;
    1308             :         //if( !aString.isEmpty() )
    1309             :         //{
    1310             :         //}
    1311             :     }
    1312             : 
    1313             :     // TODO: DFF_ANIM_EVENT_FILTER
    1314           0 :     if( rSet.hasProperty( DFF_ANIM_EVENT_FILTER ) )
    1315             :     {
    1316           0 :         OUString aString;
    1317           0 :         rSet.getProperty( DFF_ANIM_EVENT_FILTER ) >>= aString;
    1318             :         //if( !aString.isEmpty() )
    1319             :         //{
    1320             :         //}
    1321             :     }
    1322             : 
    1323             :     // DFF_ANIM_TIMEFILTER
    1324           0 :     if( rSet.hasProperty( DFF_ANIM_TIMEFILTER ) )
    1325             :     {
    1326           0 :         Reference< XAnimate > xAnim( xNode, UNO_QUERY );
    1327           0 :         if( xAnim.is() )
    1328             :         {
    1329           0 :             OUString aString;
    1330           0 :             rSet.getProperty( DFF_ANIM_TIMEFILTER ) >>= aString;
    1331           0 :             if( !aString.isEmpty() )
    1332             :             {
    1333           0 :                 sal_Int32 nElements = 1; // a non empty string has at least one value
    1334             : 
    1335           0 :                 sal_Int32 fromIndex = 0;
    1336             :                 while(true)
    1337             :                 {
    1338           0 :                     fromIndex = aString.indexOf( (sal_Unicode)';', fromIndex );
    1339           0 :                     if( fromIndex == -1 )
    1340           0 :                         break;
    1341             : 
    1342           0 :                     fromIndex++;
    1343           0 :                     nElements++;
    1344             :                 }
    1345             : 
    1346           0 :                 Sequence< TimeFilterPair > aTimeFilter( nElements );
    1347             : 
    1348           0 :                 TimeFilterPair* pValues = aTimeFilter.getArray();
    1349           0 :                 sal_Int32 nIndex = 0;
    1350           0 :                 while( (nElements--) && (nIndex >= 0) )
    1351             :                 {
    1352           0 :                     const OUString aToken( aString.getToken( 0, ';', nIndex ) );
    1353             : 
    1354           0 :                     sal_Int32 nPos = aToken.indexOf( ',' );
    1355           0 :                     if( nPos >= 0 )
    1356             :                     {
    1357           0 :                         pValues->Time = aToken.copy( 0, nPos ).toDouble();
    1358           0 :                         pValues->Progress = aToken.copy( nPos+1, aToken.getLength() - nPos - 1 ).toDouble();
    1359             :                     }
    1360           0 :                     pValues++;
    1361           0 :                 }
    1362             : 
    1363           0 :                 xAnim->setTimeFilter( aTimeFilter );
    1364           0 :             }
    1365           0 :         }
    1366             :     }
    1367             : 
    1368             : 
    1369             : // TODO: DFF_ANIM_ENDAFTERSLIDE / DFF_ANIM_VOLUME handling. git history has sample code
    1370           0 :     Reference< XAnimateColor > xColor( xNode, UNO_QUERY );
    1371           0 :     if( xColor.is() )
    1372             :     {
    1373           0 :         if( rSet.hasProperty( DFF_ANIM_DIRECTION ) )
    1374             :         {
    1375           0 :             sal_Bool bDirection = sal_False;
    1376           0 :             if( rSet.getProperty( DFF_ANIM_DIRECTION ) >>= bDirection )
    1377           0 :                 xColor->setDirection( (sal_Bool)!bDirection );
    1378             :         }
    1379             : 
    1380           0 :         if( rSet.hasProperty( DFF_ANIM_COLORSPACE ) )
    1381             :         {
    1382           0 :             sal_Int32 nColorSpace = 0;
    1383           0 :             rSet.getProperty( DFF_ANIM_COLORSPACE ) >>= nColorSpace;
    1384           0 :             xColor->setColorInterpolation( (nColorSpace == 0) ? AnimationColorSpace::RGB : AnimationColorSpace::HSL );
    1385             :         }
    1386           0 :     }
    1387           0 : }
    1388             : 
    1389             : 
    1390             : 
    1391           0 : int AnimationImporter::importTimeContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
    1392             : {
    1393           0 :     int nNodes = 0;
    1394             : 
    1395             :     DBG_ASSERT( pAtom && xNode.is(), "invalid call to ppt::AnimationImporter::importTimeContainer()!");
    1396           0 :     if( pAtom && xNode.is() )
    1397             :     {
    1398           0 :         importAnimationEvents( pAtom, xNode );
    1399           0 :         importAnimationValues( pAtom, xNode );
    1400           0 :         importAnimationActions( pAtom, xNode );
    1401             : 
    1402           0 :         dump(">\n");
    1403             : 
    1404             :         // import sub containers
    1405           0 :         const Atom* pChildAtom = pAtom->findFirstChildAtom();
    1406             : 
    1407           0 :         while( pChildAtom )
    1408             :         {
    1409           0 :             switch( pChildAtom->getType() )
    1410             :             {
    1411             :                 case DFF_msofbtAnimNode:
    1412             :                 case DFF_msofbtAnimEvent:
    1413             :                 case DFF_msofbtAnimValue:
    1414             :                 case DFF_msofbtAnimAction:
    1415             :                 case DFF_msofbtAnimPropertySet:
    1416           0 :                     break;
    1417             : 
    1418             :                 case DFF_msofbtAnimSubGoup :
    1419             :                 {
    1420           0 :                     if( pChildAtom->hasChildAtom( DFF_msofbtAnimCommand ) )
    1421             :                     {
    1422           0 :                         Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
    1423           0 :                         Reference< XAnimationNode > xChildNode( Command::create(xContext), UNO_QUERY_THROW );
    1424           0 :                         nNodes += importAnimationNodeContainer( pChildAtom, xChildNode );
    1425           0 :                         Reference< XTimeContainer > xParentContainer( xNode, UNO_QUERY );
    1426           0 :                         if( xParentContainer.is() && xChildNode.is() )
    1427           0 :                             xParentContainer->appendChild( xChildNode );
    1428             :                     }
    1429             :                     else
    1430             :                     {
    1431           0 :                         nNodes += importAnimationContainer( pChildAtom, xNode );
    1432             :                     }
    1433             :                 }
    1434           0 :                 break;
    1435             :                 case DFF_msofbtAnimGroup :
    1436             :                 {
    1437           0 :                     nNodes += importAnimationContainer( pChildAtom, xNode );
    1438             :                 }
    1439           0 :                 break;
    1440             :                 case DFF_msofbtAnimIteration:
    1441             :                 {
    1442           0 :                     if( pChildAtom->seekToContent() )
    1443             :                     {
    1444             :                         float fInterval;
    1445             :                         sal_Int32 nTextUnitEffect, nU1, nU2, nU3;
    1446             : 
    1447           0 :                         mrStCtrl.ReadFloat( fInterval ).ReadInt32( nTextUnitEffect ).ReadInt32( nU1 ).ReadInt32( nU2 ).ReadInt32( nU3 );
    1448             : 
    1449           0 :                         Reference< XIterateContainer > xIter( xNode, UNO_QUERY );
    1450           0 :                         if( xIter.is() )
    1451             :                         {
    1452           0 :                             sal_Int16 nIterateType = TextAnimationType::BY_PARAGRAPH;
    1453           0 :                             switch( nTextUnitEffect )
    1454             :                             {
    1455           0 :                             case 1: nIterateType = TextAnimationType::BY_WORD; break;
    1456           0 :                             case 2: nIterateType = TextAnimationType::BY_LETTER; break;
    1457             :                             }
    1458           0 :                             xIter->setIterateType( nIterateType );
    1459           0 :                             xIter->setIterateInterval( (double)fInterval );
    1460             :                         }
    1461             : 
    1462           0 :                         nNodes++;
    1463             : 
    1464           0 :                         dump( "<iterate" );
    1465           0 :                         dump( " iterateType=\"%s\"", (nTextUnitEffect == 0) ? "byElement" : (nTextUnitEffect == 1) ? "byWord" : "byLetter" );
    1466           0 :                         dump( " iterateInterval=\"%g\"", fInterval );
    1467           0 :                         dump( " u1=\"%ld\"", nU1 );
    1468           0 :                         dump( " u2=\"%ld\"", nU2 );
    1469           0 :                         dump( " u3=\"%ld\"/>\n", nU3 );
    1470             :                     }
    1471             :                 }
    1472           0 :                 break;
    1473             : 
    1474             :                 case 0xf136:
    1475             :                 {
    1476             : #ifdef DBG_ANIM_LOG
    1477             :                     sal_uInt32 nU1, nU2;
    1478             :                     mrStCtrl >> nU1 >> nU2;
    1479             : 
    1480             :                     fprintf( mpFile, "<unknown_0xf136 nU1=\"%ld\" nU2=\"%ld\"/>\n", nU1, nU2 );
    1481             : #endif
    1482             :                 }
    1483           0 :                 break;
    1484             : 
    1485             :                 default:
    1486             :                 {
    1487           0 :                     dump_atom_header( pChildAtom, true, false );
    1488           0 :                     dump_atom( pChildAtom );
    1489           0 :                     dump_atom_header( pChildAtom, false, false );
    1490             :                 }
    1491           0 :                 break;
    1492             :             }
    1493             : 
    1494           0 :             pChildAtom = pAtom->findNextChildAtom( pChildAtom );
    1495             :         }
    1496             :     }
    1497             : 
    1498           0 :     return nNodes;
    1499             : }
    1500             : 
    1501             : 
    1502             : 
    1503           0 : int AnimationImporter::importAnimationNodeContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
    1504             : {
    1505           0 :     int nNodes = 0;
    1506             : 
    1507             :     DBG_ASSERT( pAtom && xNode.is(), "invalid call to ppt::AnimationImporter::importAnimationNodeContainer()!");
    1508           0 :     if( pAtom && xNode.is() )
    1509             :     {
    1510           0 :         importAnimationEvents( pAtom, xNode );
    1511           0 :         importAnimationValues( pAtom, xNode );
    1512           0 :         importAnimationActions( pAtom, xNode );
    1513             : 
    1514           0 :         const Atom* pChildAtom = pAtom->findFirstChildAtom();
    1515             : 
    1516           0 :         while( pChildAtom )
    1517             :         {
    1518           0 :             nNodes ++;
    1519           0 :             switch( pChildAtom->getType() )
    1520             :             {
    1521             :                 case DFF_msofbtAnimNode:
    1522             :                 case DFF_msofbtAnimEvent:
    1523             :                 case DFF_msofbtAnimValue:
    1524             :                 case DFF_msofbtAnimAction:
    1525             :                 case DFF_msofbtAnimPropertySet:
    1526           0 :                     break;
    1527             : 
    1528             :                 case DFF_msofbtAnimateFilter:
    1529           0 :                     importAnimateFilterContainer( pChildAtom, xNode );
    1530           0 :                     break;
    1531             : 
    1532             :                 case DFF_msofbtAnimateSet:
    1533           0 :                     importAnimateSetContainer( pChildAtom, xNode );
    1534           0 :                     break;
    1535             : 
    1536             :                 case DFF_msofbtAnimate:
    1537           0 :                     importAnimateContainer( pChildAtom, xNode );
    1538           0 :                     break;
    1539             : 
    1540             :                 case DFF_msofbtAnimateScale:
    1541           0 :                     importAnimateScaleContainer( pChildAtom, xNode );
    1542           0 :                     break;
    1543             : 
    1544             :                 case DFF_msofbtAnimateColor:
    1545           0 :                     importAnimateColorContainer( pChildAtom, xNode );
    1546           0 :                     break;
    1547             : 
    1548             :                 case DFF_msofbtAnimateRotation:
    1549           0 :                     importAnimateRotationContainer( pChildAtom, xNode );
    1550           0 :                     break;
    1551             : 
    1552             :                 case DFF_msofbtAnimateMotion:
    1553           0 :                     importAnimateMotionContainer( pChildAtom, xNode );
    1554           0 :                     break;
    1555             : 
    1556             :                 case DFF_msofbtAnimCommand:
    1557           0 :                     importCommandContainer( pChildAtom, xNode );
    1558           0 :                     break;
    1559             : 
    1560             :                 default:
    1561             :                 {
    1562           0 :                     nNodes --;
    1563           0 :                     dump_atom_header( pChildAtom, true, false );
    1564           0 :                     dump_atom( pChildAtom );
    1565           0 :                     dump_atom_header( pChildAtom, false, false );
    1566             :                 }
    1567           0 :                 break;
    1568             :             }
    1569             : 
    1570           0 :             pChildAtom = pAtom->findNextChildAtom( pChildAtom );
    1571             :         }
    1572             :     }
    1573             : 
    1574           0 :     return nNodes;
    1575             : }
    1576             : 
    1577             : 
    1578             : 
    1579           0 : void AnimationImporter::importAnimateFilterContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
    1580             : {
    1581           0 :     Reference< XTransitionFilter > xFilter( xNode, UNO_QUERY );
    1582             : 
    1583             :     DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateFilter && xFilter.is(), "invalid call to ppt::AnimationImporter::importAnimateFilterContainer()!");
    1584           0 :     if( pAtom && xFilter.is() )
    1585             :     {
    1586           0 :         sal_uInt32 nBits = 0;
    1587             : 
    1588           0 :         const Atom* pChildAtom = pAtom->findFirstChildAtom();
    1589             : 
    1590           0 :         while( pChildAtom )
    1591             :         {
    1592           0 :             if( !pChildAtom->isContainer() )
    1593             :             {
    1594           0 :                 if( !pChildAtom->seekToContent() )
    1595           0 :                     break;
    1596             :             }
    1597             : 
    1598           0 :             switch( pChildAtom->getType() )
    1599             :             {
    1600             :             case DFF_msofbtAnimateFilterData:
    1601             :             {
    1602             :                 sal_uInt32 transition;
    1603           0 :                 mrStCtrl.ReadUInt32( nBits );
    1604           0 :                 mrStCtrl.ReadUInt32( transition );
    1605             : 
    1606           0 :                 if( nBits & 1 )
    1607           0 :                     xFilter->setMode( transition == 0 );
    1608             : 
    1609           0 :                 dump( " transition=\"%s\"", (transition == 0) ? "in" : "out" );
    1610             :             }
    1611           0 :             break;
    1612             : 
    1613             :             case DFF_msofbtAnimAttributeValue:
    1614             :             {
    1615           0 :                 if( (nBits & 2 ) && ( pChildAtom->getInstance() == 1 )  )
    1616             :                 {
    1617           0 :                     Any aAny;
    1618           0 :                     if ( importAttributeValue( pChildAtom, aAny ) )
    1619             :                     {
    1620           0 :                         OUString filter;
    1621           0 :                         aAny >>= filter;
    1622             : 
    1623           0 :                         dump( " filter=\"%s\"", filter );
    1624             : 
    1625           0 :                         const transition* pTransition = transition::find( filter );
    1626           0 :                         if( pTransition )
    1627             :                         {
    1628           0 :                             xFilter->setTransition( pTransition->mnType );
    1629           0 :                             xFilter->setSubtype( pTransition->mnSubType );
    1630           0 :                             xFilter->setDirection( pTransition->mbDirection );
    1631             :                         }
    1632             :                         else
    1633             :                         {
    1634             :                             OSL_FAIL( "unknown transition!" );
    1635           0 :                         }
    1636           0 :                     }
    1637             :                 }
    1638             :             }
    1639           0 :             break;
    1640             : 
    1641             :             case DFF_msofbtAnimateTarget:
    1642           0 :                 importAnimateAttributeTargetContainer( pChildAtom, xNode );
    1643           0 :                 break;
    1644             : 
    1645             :             default:
    1646           0 :                 dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
    1647           0 :                 break;
    1648             : 
    1649             :             }
    1650             : 
    1651           0 :             pChildAtom = pAtom->findNextChildAtom( pChildAtom );
    1652             :         }
    1653           0 :     }
    1654           0 : }
    1655             : 
    1656             : 
    1657             : 
    1658           0 : void AnimationImporter::importAnimateAttributeTargetContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
    1659             : {
    1660             :     DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateTarget, "invalid call to ppt::AnimationImporter::importAnimateAttributeTargetContainer()!");
    1661             : 
    1662           0 :     Any aTarget;
    1663             : 
    1664           0 :     Reference< XAnimate > xAnimate( xNode, UNO_QUERY );
    1665             : 
    1666           0 :     bool bWrongContext = false;
    1667             : 
    1668           0 :     if( pAtom )
    1669             :     {
    1670           0 :         const Atom* pChildAtom = pAtom->findFirstChildAtom();
    1671             : 
    1672           0 :         while( pChildAtom )
    1673             :         {
    1674           0 :             if( !pChildAtom->isContainer() )
    1675             :             {
    1676           0 :                 if( !pChildAtom->seekToContent() )
    1677           0 :                     break;
    1678             :             }
    1679             : 
    1680           0 :             switch( pChildAtom->getType() )
    1681             :             {
    1682             :             case DFF_msofbtAnimPropertySet:
    1683             :             {
    1684           0 :                 PropertySet aSet;
    1685           0 :                 importPropertySetContainer( pChildAtom, aSet );
    1686           0 :                 if( aSet.hasProperty( DFF_ANIM_RUNTIMECONTEXT ) )
    1687             :                 {
    1688           0 :                     OUString aContext;
    1689           0 :                     if( aSet.getProperty( DFF_ANIM_RUNTIMECONTEXT ) >>= aContext )
    1690             :                     {
    1691           0 :                         if( aContext != "PPT" )
    1692           0 :                             bWrongContext = true;
    1693           0 :                     }
    1694             :                 }
    1695             : 
    1696           0 :                 dump( aSet );
    1697             :             }
    1698           0 :             break;
    1699             : 
    1700             :             case DFF_msofbtAnimateTargetSettings:
    1701             :             {
    1702           0 :                 if( xAnimate.is() )
    1703             :                 {
    1704             :                     sal_uInt32 nBits;
    1705             :                     sal_uInt32 nAdditive;
    1706             :                     sal_uInt32 nAccumulate;
    1707             :                     sal_uInt32 nTransformType;
    1708             : 
    1709           0 :                     mrStCtrl.ReadUInt32( nBits ).ReadUInt32( nAdditive ).ReadUInt32( nAccumulate ).ReadUInt32( nTransformType );
    1710             : 
    1711             :                     // nBits %0001: additive, %0010: accumulate, %0100: attributeName, %1000: transformtype
    1712             :                     // nAdditive 0 = base, 1 = sum, 2 = replace, 3 = multiply, 4 = none
    1713             :                     // nAccumulate 0 = none, 1 = always
    1714             :                     // nTransformType 0: "property" else "image"
    1715             : 
    1716           0 :                     if( nBits & 3 )
    1717             :                     {
    1718           0 :                         if( xAnimate.is() )
    1719             :                         {
    1720           0 :                             if( nBits & 1 )
    1721             :                             {
    1722           0 :                                 sal_Int16 nTemp = AnimationAdditiveMode::BASE;
    1723           0 :                                 switch( nAdditive )
    1724             :                                 {
    1725           0 :                                 case 1: nTemp = AnimationAdditiveMode::SUM; break;
    1726           0 :                                 case 2: nTemp = AnimationAdditiveMode::REPLACE; break;
    1727           0 :                                 case 3: nTemp = AnimationAdditiveMode::MULTIPLY; break;
    1728           0 :                                 case 4: nTemp = AnimationAdditiveMode::NONE; break;
    1729             :                                 }
    1730           0 :                                 xAnimate->setAdditive( nTemp );
    1731             :                             }
    1732             : 
    1733           0 :                             if( nBits & 2 )
    1734             :                             {
    1735           0 :                                 xAnimate->setAccumulate( (nAccumulate == 0) ? sal_True : sal_False );
    1736             :                             }
    1737             :                         }
    1738             :                     }
    1739             : #ifdef DBG_ANIM_LOG
    1740             :                     if( nBits & 1 )
    1741             :                         fprintf( mpFile, " additive=\"%s\"", (nAdditive == 0) ? "base" : (nAdditive == 2) ? "replace" : (nAdditive == 1) ? "sum" : (nAdditive == 3 ) ? "multiply" : (nAdditive == 4) ? "none" : "unknown" );
    1742             : 
    1743             :                     if( nBits & 2 )
    1744             :                         fprintf( mpFile, " accumulate=\"%s\"", (nAccumulate == 0) ? "none" : "always" );
    1745             : 
    1746             :                     if( nBits & 8 )
    1747             :                         fprintf( mpFile, " transformType=\"%s\"", (nTransformType == 0) ? "property" : "image" );
    1748             : #endif
    1749             :                 }
    1750             :             }
    1751           0 :             break;
    1752             : 
    1753             :             case DFF_msofbtAnimateAttributeNames:
    1754             :             {
    1755           0 :                 if( xAnimate.is() )
    1756             :                 {
    1757           0 :                     OUString aAttributeName;
    1758           0 :                     importAttributeNamesContainer( pChildAtom, aAttributeName );
    1759           0 :                     if( xAnimate.is() )
    1760           0 :                         xAnimate->setAttributeName( aAttributeName );
    1761           0 :                     dump( " attributeName=\"%s\"", aAttributeName );
    1762             :                 }
    1763             :             }
    1764           0 :             break;
    1765             : 
    1766             :             case DFF_msofbtAnimateTargetElement:
    1767             :             {
    1768             :                 sal_Int16 nSubType;
    1769           0 :                 importTargetElementContainer( pChildAtom, aTarget, nSubType );
    1770           0 :                 if( xAnimate.is() )
    1771           0 :                     xAnimate->setSubItem( nSubType );
    1772             : 
    1773           0 :                 dump( " target=\"" );
    1774           0 :                 dump_target( aTarget );
    1775           0 :                 dump( "\"" );
    1776             :             }
    1777           0 :             break;
    1778             : 
    1779             :             default:
    1780           0 :                 dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
    1781           0 :                 break;
    1782             :             }
    1783             : 
    1784           0 :             pChildAtom = pAtom->findNextChildAtom( pChildAtom );
    1785             :         }
    1786             :     }
    1787             : 
    1788           0 :     if( bWrongContext )
    1789           0 :         aTarget.clear();
    1790             : 
    1791           0 :     if( xAnimate.is() )
    1792           0 :         xAnimate->setTarget( aTarget );
    1793             :     else
    1794             :     {
    1795           0 :         Reference< XCommand > xCommand( xNode, UNO_QUERY );
    1796           0 :         if( xCommand.is() )
    1797           0 :             xCommand->setTarget( aTarget );
    1798           0 :     }
    1799           0 : }
    1800             : 
    1801             : 
    1802             : 
    1803           0 : sal_Int16 AnimationImporter::implGetColorSpace( sal_Int32 nMode, sal_Int32 /*nA*/, sal_Int32 /*nB*/, sal_Int32 /*nC*/ )
    1804             : {
    1805           0 :     switch( nMode )
    1806             :     {
    1807             :     case 2: // index
    1808             :         // FALLTHROUGH intended
    1809             :     default:
    1810             :         // FALLTHROUGH intended
    1811             :     case 0: // rgb
    1812           0 :         return AnimationColorSpace::RGB;
    1813             : 
    1814             :     case 1: // hsl
    1815           0 :         return AnimationColorSpace::HSL;
    1816             :     }
    1817             : }
    1818             : 
    1819             : 
    1820             : 
    1821           0 : Any AnimationImporter::implGetColorAny( sal_Int32 nMode, sal_Int32  nA, sal_Int32 nB, sal_Int32 nC )
    1822             : {
    1823           0 :     switch( nMode )
    1824             :     {
    1825             :     case 0: // rgb
    1826             :         {
    1827           0 :             dump( "rgb(%ld", nA );
    1828           0 :             dump( ",%ld", nB );
    1829           0 :             dump( ",%ld)", nC );
    1830           0 :             Color aColor( (sal_uInt8)nA, (sal_uInt8)nB, (sal_uInt8)nC );
    1831           0 :             return makeAny( (sal_Int32)aColor.GetRGBColor() );
    1832             :         }
    1833             :     case 1: // hsl
    1834             :         {
    1835           0 :             dump( "hsl(%ld", nA );
    1836           0 :             dump( ",%ld", nB );
    1837           0 :             dump( ",%ld)", nC );
    1838           0 :             Sequence< double > aHSL( 3 );
    1839           0 :             aHSL[0] = nA * 360.0/255.0;
    1840           0 :             aHSL[1] = nB / 255.0;
    1841           0 :             aHSL[2] = nC / 255.0;
    1842           0 :             return makeAny( aHSL );
    1843             :         }
    1844             : 
    1845             :     case 2: // index
    1846             :         {
    1847           0 :             Color aColor;
    1848           0 :             mpPPTImport->GetColorFromPalette((sal_uInt16)nA, aColor );
    1849           0 :             dump( "index(%ld", nA );
    1850           0 :             dump( " [%ld", (sal_Int32)aColor.GetRed() );
    1851           0 :             dump( ",%ld", (sal_Int32)aColor.GetGreen() );
    1852           0 :             dump( ",%ld])", (sal_Int32)aColor.GetBlue() );
    1853           0 :             return makeAny( (sal_Int32)aColor.GetRGBColor() );
    1854             :         }
    1855             : 
    1856             :     default:
    1857             :         {
    1858           0 :             dump( "unknown_%ld(", nMode );
    1859           0 :             dump( "%ld", nA );
    1860           0 :             dump( ",%ld", nB );
    1861           0 :             dump( ",%ld)", nC );
    1862             :             OSL_FAIL( "ppt::implGetColorAny(), unhandled color type" );
    1863             : 
    1864           0 :             Any aAny;
    1865           0 :             return aAny;
    1866             :         }
    1867             :     }
    1868             : }
    1869             : 
    1870           0 : void AnimationImporter::importAnimateColorContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
    1871             : {
    1872           0 :     Reference< XAnimateColor > xColor( xNode, UNO_QUERY );
    1873             : 
    1874             :     DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateColor && xColor.is(), "invalid call to ppt::AnimationImporter::importAnimateColorContainer()!");
    1875           0 :     if( pAtom && xColor.is() )
    1876             :     {
    1877           0 :         const Atom* pChildAtom = pAtom->findFirstChildAtom();
    1878             : 
    1879           0 :         while( pChildAtom )
    1880             :         {
    1881           0 :             if( !pChildAtom->isContainer() )
    1882             :             {
    1883           0 :                 if( !pChildAtom->seekToContent() )
    1884           0 :                     break;
    1885             :             }
    1886             : 
    1887           0 :             switch( pChildAtom->getType() )
    1888             :             {
    1889             :             case DFF_msofbtAnimateColorData:
    1890             :             {
    1891             :                 sal_uInt32 nBits;
    1892             :                 sal_Int32 nByMode, nByA, nByB, nByC;
    1893             :                 sal_Int32 nFromMode, nFromA, nFromB, nFromC;
    1894             :                 sal_Int32 nToMode, nToA, nToB, nToC;
    1895           0 :                 mrStCtrl.ReadUInt32( nBits );
    1896           0 :                 mrStCtrl.ReadInt32( nByMode ).ReadInt32( nByA ).ReadInt32( nByB ).ReadInt32( nByC );
    1897           0 :                 mrStCtrl.ReadInt32( nFromMode ).ReadInt32( nFromA ).ReadInt32( nFromB ).ReadInt32( nFromC );
    1898           0 :                 mrStCtrl.ReadInt32( nToMode ).ReadInt32( nToA ).ReadInt32( nToB ).ReadInt32( nToC );
    1899             : 
    1900           0 :                 if( nBits & 1 )
    1901             :                 {
    1902           0 :                     dump( " by=\"" );
    1903           0 :                     xColor->setBy( implGetColorAny( nByMode, nByA, nByB, nByC ) );
    1904           0 :                     xColor->setColorInterpolation( implGetColorSpace( nByMode, nByA, nByB, nByC ) );
    1905           0 :                     dump( "\"");
    1906             :                 }
    1907             : 
    1908           0 :                 if( nBits & 2 )
    1909             :                 {
    1910           0 :                     dump( " from=\"" );
    1911           0 :                     xColor->setFrom( implGetColorAny( nFromMode, nFromA, nFromB, nFromC ) );
    1912           0 :                     xColor->setColorInterpolation( implGetColorSpace( nFromMode, nFromA, nFromB, nFromC ) );
    1913           0 :                     dump( "\"");
    1914             :                 }
    1915             : 
    1916           0 :                 if( nBits & 4 )
    1917             :                 {
    1918           0 :                     dump( " to=\"" );
    1919           0 :                     xColor->setTo( implGetColorAny( nToMode, nToA, nToB, nToC ) );
    1920           0 :                     xColor->setColorInterpolation( implGetColorSpace( nToMode, nToA, nToB, nToC ) );
    1921           0 :                     dump( "\"");
    1922             :                 }
    1923             :             }
    1924           0 :             break;
    1925             : 
    1926             :             case DFF_msofbtAnimateTarget:
    1927           0 :                 importAnimateAttributeTargetContainer( pChildAtom, xNode );
    1928           0 :                 break;
    1929             : 
    1930             :             default:
    1931           0 :                 dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
    1932           0 :                 break;
    1933             :             }
    1934             : 
    1935           0 :             pChildAtom = pAtom->findNextChildAtom( pChildAtom );
    1936             :         }
    1937           0 :     }
    1938           0 : }
    1939             : 
    1940             : 
    1941             : 
    1942           0 : void AnimationImporter::importAnimateSetContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
    1943             : {
    1944           0 :     Reference< XAnimateSet > xSet( xNode, UNO_QUERY );
    1945             : 
    1946             :     DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateSet && xSet.is(), "invalid call to ppt::AnimationImporter::importAnimateSetContainer()!");
    1947           0 :     if( pAtom && xSet.is() )
    1948             :     {
    1949           0 :         const Atom* pChildAtom = pAtom->findFirstChildAtom();
    1950             : 
    1951           0 :         while( pChildAtom )
    1952             :         {
    1953           0 :             if( !pChildAtom->isContainer() )
    1954             :             {
    1955           0 :                 if( !pChildAtom->seekToContent() )
    1956           0 :                     break;
    1957             :             }
    1958             : 
    1959           0 :             switch( pChildAtom->getType() )
    1960             :             {
    1961             :             case DFF_msofbtAnimateSetData:
    1962             :             {
    1963             :                 sal_Int32 nU1, nU2;
    1964           0 :                 mrStCtrl.ReadInt32( nU1 ).ReadInt32( nU2 );
    1965             : 
    1966           0 :                 dump( " set_1=\"%ld\"", nU1 ),
    1967           0 :                 dump( " set_2=\"%ld\"", nU2 );
    1968             :             }
    1969           0 :             break;
    1970             : 
    1971             :             case DFF_msofbtAnimAttributeValue:
    1972             :             {
    1973           0 :                 Any aTo;
    1974           0 :                 if ( importAttributeValue( pChildAtom, aTo ) )
    1975             :                 {
    1976           0 :                     xSet->setTo( aTo );
    1977             : 
    1978           0 :                     dump( " value=\"" );
    1979           0 :                     dump( aTo );
    1980           0 :                     dump( "\"" );
    1981           0 :                 }
    1982             :             }
    1983           0 :             break;
    1984             : 
    1985             :             case DFF_msofbtAnimateTarget:
    1986           0 :                 importAnimateAttributeTargetContainer( pChildAtom, xNode );
    1987           0 :                 break;
    1988             : 
    1989             :             default:
    1990           0 :                 dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
    1991           0 :                 break;
    1992             :             }
    1993             : 
    1994           0 :             pChildAtom = pAtom->findNextChildAtom( pChildAtom );
    1995             :         }
    1996           0 :     }
    1997           0 : }
    1998             : 
    1999             : 
    2000             : 
    2001           0 : void AnimationImporter::importAnimateContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
    2002             : {
    2003           0 :     Reference< XAnimate > xAnim( xNode, UNO_QUERY );
    2004             : 
    2005             :     DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimate && xAnim.is(), "invalid call to ppt::AnimationImporter::importAnimateContainer()!");
    2006           0 :     if( pAtom && xAnim.is() )
    2007             :     {
    2008           0 :         const Atom* pChildAtom = pAtom->findFirstChildAtom();
    2009             : 
    2010           0 :         while( pChildAtom )
    2011             :         {
    2012           0 :             if( !pChildAtom->isContainer() )
    2013             :             {
    2014           0 :                 if( !pChildAtom->seekToContent() )
    2015           0 :                     break;
    2016             :             }
    2017             : 
    2018           0 :             switch( pChildAtom->getType() )
    2019             :             {
    2020             :             case DFF_msofbtAnimateData:
    2021             :             {
    2022             :                 sal_uInt32 nCalcmode, nBits, nValueType;
    2023           0 :                 mrStCtrl.ReadUInt32( nCalcmode ).ReadUInt32( nBits ).ReadUInt32( nValueType );
    2024             : 
    2025           0 :                 if( nBits & 0x08 )
    2026             :                 {
    2027           0 :                     sal_Int16 n = (nCalcmode == 1) ? AnimationCalcMode::LINEAR : /* (nCalcmode == 2) ? AnimationCalcMode::FORMULA : */ AnimationCalcMode::DISCRETE;
    2028           0 :                     xAnim->setCalcMode( n );
    2029           0 :                     dump( " calcmode=\"%s\"", (nCalcmode == 0) ? "discrete" : (nCalcmode == 1) ? "linear" : (nCalcmode == 2) ? "formula" : "unknown" );
    2030             :                 }
    2031             : 
    2032           0 :                 if( nBits & 0x30 )
    2033             :                 {
    2034           0 :                     sal_Int16 n = (nValueType == 1) ? AnimationValueType::NUMBER : (nValueType == 2 ) ? AnimationValueType::COLOR : AnimationValueType::STRING;
    2035           0 :                     xAnim->setValueType( n );
    2036           0 :                     dump( " valueType=\"%s\"", (nValueType == 0) ? "string" : (nValueType == 1) ? "number" : (nValueType == 2) ? "color" : "unknown" );
    2037             :                 }
    2038             :             }
    2039           0 :             break;
    2040             : 
    2041             :             case DFF_msofbtAnimateTarget:
    2042           0 :                 importAnimateAttributeTargetContainer( pChildAtom, xNode );
    2043           0 :                 break;
    2044             : 
    2045             :             case DFF_msofbtAnimKeyPoints:
    2046           0 :                 importAnimateKeyPoints( pChildAtom, xNode );
    2047           0 :                 break;
    2048             : 
    2049             :             case DFF_msofbtAnimAttributeValue:
    2050             :                 {
    2051           0 :                     Any a;
    2052           0 :                     if ( importAttributeValue( pChildAtom, a ) )
    2053             :                     {
    2054           0 :                         switch( pChildAtom->getInstance() )
    2055             :                         {
    2056           0 :                         case 1: xAnim->setBy( a ); dump( " by=\"" ); break;
    2057           0 :                         case 2: xAnim->setFrom( a ); dump( " from=\"" ); break;
    2058           0 :                         case 3: xAnim->setTo( a ); dump( " to=\"" ); break;
    2059             :                         default:
    2060           0 :                             dump( " unknown_value=\"" );
    2061             :                         }
    2062             : 
    2063           0 :                         dump( a );
    2064           0 :                         dump( "\"" );
    2065           0 :                     }
    2066             :                 }
    2067           0 :                 break;
    2068             :             default:
    2069           0 :                 dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
    2070           0 :                 break;
    2071             :             }
    2072             : 
    2073           0 :             pChildAtom = pAtom->findNextChildAtom( pChildAtom );
    2074             :         }
    2075           0 :     }
    2076           0 : }
    2077             : 
    2078             : 
    2079             : 
    2080           0 : void AnimationImporter::importAnimateMotionContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
    2081             : {
    2082           0 :     Reference< XAnimateMotion > xMotion( xNode, UNO_QUERY );
    2083             : 
    2084             :     DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateMotion && xMotion.is(), "invalid call to ppt::AnimationImporter::importAnimateMotionContainer()!");
    2085           0 :     if( pAtom && xMotion.is() )
    2086             :     {
    2087           0 :         const Atom* pChildAtom = pAtom->findFirstChildAtom();
    2088             : 
    2089           0 :         while( pChildAtom )
    2090             :         {
    2091           0 :             if( !pChildAtom->isContainer() )
    2092             :             {
    2093           0 :                 if( !pChildAtom->seekToContent() )
    2094           0 :                     break;
    2095             :             }
    2096             : 
    2097           0 :             switch( pChildAtom->getType() )
    2098             :             {
    2099             :             case DFF_msofbtAnimateMotionData:
    2100             :             {
    2101             :                 sal_uInt32 nBits, nOrigin;
    2102             :                 float fByX, fByY, fFromX, fFromY, fToX, fToY;
    2103             : 
    2104           0 :                 mrStCtrl.ReadUInt32( nBits ).ReadFloat( fByX ).ReadFloat( fByY ).ReadFloat( fFromX ).ReadFloat( fFromY ).ReadFloat( fToX ).ReadFloat( fToY ).ReadUInt32( nOrigin );
    2105             : 
    2106             : #ifdef DBG_ANIM_LOG
    2107             :                 if( nBits & 1 )
    2108             :                     fprintf( mpFile, " by=\"%g,%g\"", (double)fByX, (double)fByY );
    2109             : 
    2110             :                 if( nBits & 2 )
    2111             :                     fprintf( mpFile, " from=\"%g,%g\"", (double)fFromX, (double)fFromY );
    2112             : 
    2113             :                 if( nBits & 4 )
    2114             :                     fprintf( mpFile, " to=\"%g,%g\"", (double)fToX, (double)fToY );
    2115             : 
    2116             :                 if( nBits & 8 )
    2117             :                     fprintf( mpFile, " origin=\"%s\"", (nOrigin == 1) ? "parent" : (nOrigin == 2) ? "layout" : "unknown" );
    2118             : 
    2119             : #endif
    2120             :             }
    2121           0 :             break;
    2122             : 
    2123             :             case DFF_msofbtAnimAttributeValue:
    2124             :             {
    2125           0 :                 Any aPath;
    2126           0 :                 if ( importAttributeValue( pChildAtom, aPath ) )
    2127             :                 {
    2128           0 :                     OUString aStr;
    2129           0 :                     if ( aPath >>= aStr )
    2130             :                     {
    2131             :                         // E can appear inside a number, so we only check for its presence at the end
    2132           0 :                         aStr = aStr.trim();
    2133           0 :                         if (aStr.endsWith("E"))
    2134           0 :                             aStr = aStr.copy(0, aStr.getLength() - 1);
    2135           0 :                         aStr = aStr.trim();
    2136           0 :                         aPath <<= aStr;
    2137           0 :                         xMotion->setPath( aPath );
    2138           0 :                         dump( " path=\"" );
    2139           0 :                         dump( aPath );
    2140           0 :                         dump( "\"" );
    2141           0 :                     }
    2142           0 :                 }
    2143             :             }
    2144           0 :             break;
    2145             : 
    2146             :             case DFF_msofbtAnimateTarget:
    2147           0 :                 importAnimateAttributeTargetContainer( pChildAtom, xNode );
    2148           0 :                 break;
    2149             : 
    2150             :             default:
    2151           0 :                 dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
    2152           0 :                 break;
    2153             :             }
    2154             : 
    2155           0 :             pChildAtom = pAtom->findNextChildAtom( pChildAtom );
    2156             :         }
    2157           0 :     }
    2158           0 : }
    2159             : 
    2160             : 
    2161             : 
    2162           0 : void AnimationImporter::importCommandContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
    2163             : {
    2164           0 :     Reference< XCommand > xCommand( xNode, UNO_QUERY );
    2165             :     DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimCommand && xCommand.is(), "invalid call to ppt::AnimationImporter::importCommandContainer()!");
    2166           0 :     if( pAtom && xCommand.is() )
    2167             :     {
    2168           0 :         sal_Int32 nBits = 0;
    2169           0 :         Any aValue;
    2170             : 
    2171           0 :         const Atom* pChildAtom = pAtom->findFirstChildAtom();
    2172             : 
    2173           0 :         while( pChildAtom )
    2174             :         {
    2175           0 :             if( !pChildAtom->isContainer() )
    2176             :             {
    2177           0 :                 if( !pChildAtom->seekToContent() )
    2178           0 :                     break;
    2179             :             }
    2180             : 
    2181           0 :             switch( pChildAtom->getType() )
    2182             :             {
    2183             :             case DFF_msofbtCommandData:
    2184             :             {
    2185             :                 sal_Int32 nCommandType;
    2186             :                 // looks like U1 is a bitset, bit 1 enables the type and bit 2 enables
    2187             :                 // a propertyvalue that follows
    2188           0 :                 mrStCtrl.ReadInt32( nBits );
    2189           0 :                 mrStCtrl.ReadInt32( nCommandType );
    2190             : 
    2191           0 :                 if( nBits & 1 )
    2192             :                 {
    2193           0 :                     dump( " type=\"%s\"", (nCommandType == 0) ? "event" : ( nCommandType == 1) ? "call" : "verb" );
    2194             :                 }
    2195             :             }
    2196           0 :             break;
    2197             : 
    2198             :             case DFF_msofbtAnimAttributeValue:
    2199             :             {
    2200           0 :                 if ( importAttributeValue( pChildAtom, aValue ) )
    2201             :                 {
    2202           0 :                     if( nBits & 2 )
    2203             :                     {
    2204           0 :                         dump( " cmd=\"" );
    2205           0 :                         dump( aValue );
    2206           0 :                         dump( "\"" );
    2207             :                     }
    2208             :                 }
    2209             :             }
    2210           0 :             break;
    2211             : 
    2212             :             case DFF_msofbtAnimateTarget:
    2213           0 :                 importAnimateAttributeTargetContainer( pChildAtom, xNode );
    2214           0 :                 break;
    2215             : 
    2216             :             default:
    2217           0 :                 dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
    2218           0 :                 break;
    2219             :             }
    2220             : 
    2221           0 :             pChildAtom = pAtom->findNextChildAtom( pChildAtom );
    2222             :         }
    2223             : 
    2224           0 :         if( nBits & 3 )
    2225             :         {
    2226           0 :             OUString aParam;
    2227           0 :             aValue >>= aParam;
    2228             : 
    2229           0 :             sal_Int16 nCommand = EffectCommands::CUSTOM;
    2230             : 
    2231           0 :             NamedValue aParamValue;
    2232             : 
    2233           0 :             if ( aParam == "onstopaudio" )
    2234             :             {
    2235           0 :                 nCommand = EffectCommands::STOPAUDIO;
    2236             :             }
    2237           0 :             else if ( aParam == "play" )
    2238             :             {
    2239           0 :                 nCommand = EffectCommands::PLAY;
    2240             :             }
    2241           0 :             else if( aParam.startsWith( "playFrom" ) )
    2242             :             {
    2243           0 :                 const OUString aMediaTime( aParam.copy( 9, aParam.getLength() - 10 ) );
    2244             :                 rtl_math_ConversionStatus eStatus;
    2245           0 :                 double fMediaTime = ::rtl::math::stringToDouble( aMediaTime, (sal_Unicode)('.'), (sal_Unicode)(','), &eStatus, NULL );
    2246           0 :                 if( eStatus == rtl_math_ConversionStatus_Ok )
    2247             :                 {
    2248           0 :                     aParamValue.Name = "MediaTime";
    2249           0 :                     aParamValue.Value <<= fMediaTime;
    2250             :                 }
    2251           0 :                 nCommand = EffectCommands::PLAY;
    2252             :             }
    2253           0 :             else if ( aParam == "togglePause" )
    2254             :             {
    2255           0 :                 nCommand = EffectCommands::TOGGLEPAUSE;
    2256             :             }
    2257           0 :             else if ( aParam == "stop" )
    2258             :             {
    2259           0 :                 nCommand = EffectCommands::STOP;
    2260             :             }
    2261             : 
    2262           0 :             xCommand->setCommand( nCommand );
    2263           0 :             if( nCommand == EffectCommands::CUSTOM )
    2264             :             {
    2265             :                 OSL_FAIL("sd::AnimationImporter::importCommandContainer(), unknown command!");
    2266           0 :                 aParamValue.Name = "UserDefined";
    2267           0 :                 aParamValue.Value <<= aParam;
    2268             :             }
    2269             : 
    2270           0 :             if( aParamValue.Value.hasValue() )
    2271             :             {
    2272           0 :                 Sequence< NamedValue > aParamSeq( &aParamValue, 1 );
    2273           0 :                 xCommand->setParameter( makeAny( aParamSeq ) );
    2274           0 :             }
    2275           0 :         }
    2276           0 :     }
    2277           0 : }
    2278             : 
    2279             : 
    2280             : 
    2281           0 : int AnimationImporter::importAudioContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
    2282             : {
    2283           0 :     int nNodes = 0;
    2284             : 
    2285           0 :     Reference< XAudio > xAudio( xNode, UNO_QUERY );
    2286             :     DBG_ASSERT( pAtom && xAudio.is() &&
    2287             :                  ( (pAtom->getType() == DFF_msofbtAnimGroup) ||
    2288             :                    (pAtom->getType() == DFF_msofbtAnimSubGoup) ), "invalid call to ppt::AnimationImporter::importAudioContainer()!");
    2289           0 :     if( pAtom && xAudio.is() )
    2290             :     {
    2291           0 :         importAnimationEvents( pAtom, xNode );
    2292           0 :         importAnimationValues( pAtom, xNode );
    2293           0 :         importAnimationActions( pAtom, xNode );
    2294             : 
    2295           0 :         dump(">\n");
    2296             : 
    2297           0 :         const Atom* pChildAtom = pAtom->findFirstChildAtom();
    2298             : 
    2299           0 :         while( pChildAtom )
    2300             :         {
    2301           0 :             if( !pChildAtom->isContainer() )
    2302             :             {
    2303           0 :                 if( !pChildAtom->seekToContent() )
    2304           0 :                     break;
    2305             :             }
    2306             : 
    2307           0 :             switch( pChildAtom->getType() )
    2308             :             {
    2309             :             case DFF_msofbtAnimNode:
    2310             :             case DFF_msofbtAnimEvent:
    2311             :             case DFF_msofbtAnimValue:
    2312             :             case DFF_msofbtAnimAction:
    2313             :             case DFF_msofbtAnimPropertySet:
    2314           0 :                 break;
    2315             : 
    2316             :             case DFF_msofbtAnimAttributeValue:
    2317             :             {
    2318           0 :                 Any aValue;
    2319           0 :                 if ( importAttributeValue( pChildAtom, aValue ) )
    2320             :                 {
    2321           0 :                     nNodes ++;
    2322           0 :                     dump( " value=\"" );
    2323           0 :                     dump( aValue );
    2324           0 :                     dump( "\"" );
    2325           0 :                 }
    2326             :             }
    2327           0 :             break;
    2328             : 
    2329             :             case DFF_msofbtAnimateTargetElement:
    2330             :             {
    2331             :                 sal_Int16 nSubType;
    2332           0 :                 Any aSource;
    2333           0 :                 importTargetElementContainer( pChildAtom, aSource, nSubType );
    2334           0 :                 if( xAudio.is() ) {
    2335           0 :                     xAudio->setSource( aSource );
    2336           0 :                     nNodes ++;
    2337           0 :                 }
    2338             :             }
    2339           0 :             break;
    2340             : 
    2341             :             default:
    2342           0 :                 dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
    2343           0 :                 break;
    2344             :             }
    2345             : 
    2346           0 :             pChildAtom = pAtom->findNextChildAtom( pChildAtom );
    2347             :         }
    2348             : 
    2349             :         // TODO: What to do with them?
    2350           0 :         Any aEmpty;
    2351           0 :         xAudio->setBegin( aEmpty );
    2352           0 :         xAudio->setEnd( aEmpty );
    2353             :     }
    2354             : 
    2355           0 :     return nNodes;
    2356             : }
    2357             : 
    2358             : 
    2359             : 
    2360           0 : void AnimationImporter::importAnimateScaleContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
    2361             : {
    2362           0 :     Reference< XAnimateTransform > xTransform( xNode, UNO_QUERY );
    2363             : 
    2364             :     DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateScale && xTransform.is(), "invalid call to ppt::AnimationImporter::importAnimateScaleContainer()!");
    2365           0 :     if( pAtom && xTransform.is() )
    2366             :     {
    2367           0 :         xTransform->setTransformType( AnimationTransformType::SCALE );
    2368             : 
    2369           0 :         const Atom* pChildAtom = pAtom->findFirstChildAtom();
    2370             : 
    2371           0 :         while( pChildAtom )
    2372             :         {
    2373           0 :             if( !pChildAtom->isContainer() )
    2374             :             {
    2375           0 :                 if( !pChildAtom->seekToContent() )
    2376           0 :                     break;
    2377             :             }
    2378             : 
    2379           0 :             switch( pChildAtom->getType() )
    2380             :             {
    2381             :             case DFF_msofbtAnimateScaleData:
    2382             :             {
    2383             :                 sal_uInt32 nBits, nZoomContents;
    2384             :                 float fByX, fByY, fFromX, fFromY, fToX, fToY;
    2385             : 
    2386             :                 // nBits %001: by, %010: from, %100: to, %1000: zoomContents(bool)
    2387           0 :                 mrStCtrl.ReadUInt32( nBits ).ReadFloat( fByX ).ReadFloat( fByY ).ReadFloat( fFromX ).ReadFloat( fFromY ).ReadFloat( fToX ).ReadFloat( fToY ).ReadUInt32( nZoomContents );
    2388             : 
    2389           0 :                 ValuePair aPair;
    2390             :                 // 'from' value
    2391           0 :                 if( nBits & 2 )
    2392             :                 {
    2393           0 :                     aPair.First <<= (double)fFromX / 100.0;
    2394           0 :                     aPair.Second <<= (double)fFromY / 100.0;
    2395           0 :                     xTransform->setFrom( makeAny( aPair ) );
    2396             :                 }
    2397             : 
    2398             :                 // 'to' value
    2399           0 :                 if( nBits & 4 )
    2400             :                 {
    2401           0 :                     aPair.First <<= (double)fToX / 100.0;
    2402           0 :                     aPair.Second <<= (double)fToY / 100.0;
    2403           0 :                     xTransform->setTo( makeAny( aPair ) );
    2404             :                 }
    2405             : 
    2406             :                 // 'by' value
    2407           0 :                 if( nBits & 1 )
    2408             :                 {
    2409           0 :                     aPair.First <<= (double)fByX / 100.0;
    2410           0 :                     aPair.Second <<= (double)fByY / 100.0;
    2411             : 
    2412           0 :                     if( nBits & 2 )
    2413             :                     {
    2414             :                         // 'from' value given, import normally
    2415           0 :                         xTransform->setBy( makeAny( aPair ) );
    2416             :                     }
    2417             :                     else
    2418             :                     {
    2419             :                         // mapping 'by' to 'to', if no 'from' is
    2420             :                         // given. This is due to a non-conformity in
    2421             :                         // PPT, which exports animateScale effects
    2422             :                         // with a sole 'by' value, but with the
    2423             :                         // semantics of a sole 'to' animation
    2424           0 :                         xTransform->setTo( makeAny( aPair ) );
    2425             :                     }
    2426           0 :                 }
    2427             : 
    2428             : 
    2429             : #ifdef DBG_ANIM_LOG
    2430             :                 if( nBits & 1 )
    2431             :                     fprintf( mpFile, " by=\"%g,%g\"", (double)fByX, (double)fByY );
    2432             : 
    2433             :                 if( nBits & 2 )
    2434             :                     fprintf( mpFile, " from=\"%g,%g\"", (double)fFromX, (double)fFromY );
    2435             : 
    2436             :                 if( nBits & 4 )
    2437             :                     fprintf( mpFile, " to=\"%g,%g\"", (double)fToX, (double)fToY );
    2438             : 
    2439             :                 if( nBits & 8 )
    2440             :                     fprintf( mpFile, " zoomContents=\"%s\"", nZoomContents ? "true" : "false" );
    2441             : #endif
    2442             :             }
    2443           0 :             break;
    2444             : 
    2445             :             case DFF_msofbtAnimateTarget:
    2446           0 :                 importAnimateAttributeTargetContainer( pChildAtom, xNode );
    2447           0 :                 break;
    2448             : 
    2449             :             default:
    2450           0 :                 dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
    2451           0 :                 break;
    2452             :             }
    2453             : 
    2454           0 :             pChildAtom = pAtom->findNextChildAtom( pChildAtom );
    2455             :         }
    2456           0 :     }
    2457           0 : }
    2458             : 
    2459             : 
    2460             : 
    2461           0 : void AnimationImporter::importAnimateRotationContainer( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
    2462             : {
    2463           0 :     Reference< XAnimateTransform > xTransform( xNode, UNO_QUERY );
    2464             : 
    2465             :     DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimateRotation && xTransform.is(), "invalid call to ppt::AnimationImporter::importAnimateRotationContainer()!");
    2466           0 :     if( pAtom && xTransform.is() )
    2467             :     {
    2468           0 :         xTransform->setTransformType( AnimationTransformType::ROTATE );
    2469             : 
    2470           0 :         const Atom* pChildAtom = pAtom->findFirstChildAtom();
    2471             : 
    2472           0 :         while( pChildAtom )
    2473             :         {
    2474           0 :             if( !pChildAtom->isContainer() )
    2475             :             {
    2476           0 :                 if( !pChildAtom->seekToContent() )
    2477           0 :                     break;
    2478             :             }
    2479             : 
    2480           0 :             switch( pChildAtom->getType() )
    2481             :             {
    2482             :             case DFF_msofbtAnimateRotationData:
    2483             :             {
    2484             :                 sal_uInt32 nBits, nU1;
    2485             :                 float fBy, fFrom, fTo;
    2486             : 
    2487             :                 // nBits %001: by, %010: from, %100: to, %1000: zoomContents(bool)
    2488           0 :                 mrStCtrl.ReadUInt32( nBits ).ReadFloat( fBy ).ReadFloat( fFrom ).ReadFloat( fTo ).ReadUInt32( nU1 );
    2489             : 
    2490           0 :                 if( nBits & 1 )
    2491           0 :                     xTransform->setBy( makeAny( (double) fBy ) );
    2492             : 
    2493           0 :                 if( nBits & 2 )
    2494           0 :                     xTransform->setFrom( makeAny( (double) fFrom ) );
    2495             : 
    2496           0 :                 if( nBits & 4 )
    2497           0 :                     xTransform->setTo( makeAny( (double) fTo ) );
    2498             : 
    2499             : #ifdef DBG_ANIM_LOG
    2500             :                 if( nBits & 1 )
    2501             :                     fprintf( mpFile, " by=\"%g\"", (double)fBy );
    2502             : 
    2503             :                 if( nBits & 2 )
    2504             :                     fprintf( mpFile, " from=\"%g\"", (double)fFrom );
    2505             : 
    2506             :                 if( nBits & 4 )
    2507             :                     fprintf( mpFile, " to=\"%g\"", (double)fTo );
    2508             : 
    2509             :                 if( nU1 )
    2510             :                     fprintf( mpFile, " rotation_1=\"%ld\"", nU1 );
    2511             : #endif
    2512             :             }
    2513           0 :             break;
    2514             : 
    2515             :             case DFF_msofbtAnimateTarget:
    2516           0 :                 importAnimateAttributeTargetContainer( pChildAtom, xNode );
    2517           0 :                 break;
    2518             : 
    2519             :             default:
    2520           0 :                 dump( " unknown_atom=\"%ld\"", (sal_Int32)pChildAtom->getType() );
    2521           0 :                 break;
    2522             :             }
    2523             : 
    2524           0 :             pChildAtom = pAtom->findNextChildAtom( pChildAtom );
    2525             :         }
    2526           0 :     }
    2527           0 : }
    2528             : 
    2529             : 
    2530           0 : bool AnimationImporter::importAttributeNamesContainer( const Atom* pAtom, OUString& rAttributeNames )
    2531             : {
    2532           0 :     OUStringBuffer aNames;
    2533             : 
    2534             :     DBG_ASSERT( pAtom && (pAtom->getType() == DFF_msofbtAnimateAttributeNames), "invalid call to ppt::AnimationImporter::importAttributeName()!" );
    2535           0 :     if( pAtom )
    2536             :     {
    2537           0 :         const Atom* pAttributeValueAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimAttributeValue );
    2538             : 
    2539           0 :         while( pAttributeValueAtom )
    2540             :         {
    2541           0 :             Any aAny;
    2542           0 :             if ( importAttributeValue( pAttributeValueAtom, aAny ) )
    2543             :             {
    2544           0 :                 OUString aName;
    2545           0 :                 if( aAny >>= aName )
    2546             :                 {
    2547           0 :                     if( !aNames.isEmpty() )
    2548           0 :                         aNames.append( ';' );
    2549             : 
    2550           0 :                     aNames.append( aName );
    2551           0 :                 }
    2552             :             }
    2553             :             else
    2554             :             {
    2555             :                 OSL_FAIL( "error during ppt::AnimationImporter::importAttributeName()!" );
    2556             :             }
    2557             : 
    2558           0 :             pAttributeValueAtom = pAtom->findNextChildAtom( DFF_msofbtAnimAttributeValue, pAttributeValueAtom );
    2559           0 :         }
    2560             :     }
    2561             : 
    2562           0 :     rAttributeNames = aNames.makeStringAndClear();
    2563           0 :     return true;
    2564             : }
    2565             : 
    2566             : 
    2567             : 
    2568           0 : void AnimationImporter::importAnimationValues( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
    2569             : {
    2570             :     DBG_ASSERT( pAtom, "invalid call to ppt::AnimationImporter::importAnimationValues()!" );
    2571             : 
    2572           0 :     if( pAtom )
    2573             :     {
    2574           0 :         const Atom* pValueAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimValue );
    2575             : 
    2576           0 :         while( pValueAtom && pValueAtom->seekToContent() )
    2577             :         {
    2578             :             sal_uInt32 nType;
    2579           0 :             mrStCtrl.ReadUInt32( nType );
    2580           0 :             switch( nType )
    2581             :             {
    2582             :             case 0:
    2583             :             {
    2584             :                 float fRepeat;
    2585           0 :                 mrStCtrl.ReadFloat( fRepeat );
    2586           0 :                 xNode->setRepeatCount( (fRepeat < ((float)3.40282346638528860e+38)) ? makeAny( (double)fRepeat ) : makeAny( Timing_INDEFINITE ) );
    2587             : 
    2588             : #ifdef DBG_ANIM_LOG
    2589             :                 if( (fRepeat < ((float)3.40282346638528860e+38)) )
    2590             :                 {
    2591             :                     dump( " repeat=\"%g\"", (double)fRepeat );
    2592             :                 }
    2593             :                 else
    2594             :                 {
    2595             :                     dump( " repeat=\"indefinite\"" );
    2596             :                 }
    2597             : #endif
    2598             :             }
    2599           0 :             break;
    2600             : 
    2601             :             case 3:
    2602             :             {
    2603             :                 float faccelerate;
    2604           0 :                 mrStCtrl.ReadFloat( faccelerate );
    2605           0 :                 xNode->setAcceleration( faccelerate );
    2606           0 :                 dump( " accelerate=\"%g\"", (double)faccelerate );
    2607             :             }
    2608           0 :             break;
    2609             : 
    2610             :             case 4:
    2611             :             {
    2612             :                 float fdecelerate;
    2613           0 :                 mrStCtrl.ReadFloat( fdecelerate );
    2614           0 :                 xNode->setDecelerate( fdecelerate );
    2615           0 :                 dump( " decelerate=\"%g\"", (double)fdecelerate );
    2616             :             }
    2617           0 :             break;
    2618             : 
    2619             :             case 5:
    2620             :             {
    2621             :                 sal_Int32 nAutoreverse;
    2622           0 :                 mrStCtrl.ReadInt32( nAutoreverse );
    2623           0 :                 xNode->setAutoReverse( nAutoreverse != 0 );
    2624           0 :                 dump( " autoreverse=\"%#lx\"", nAutoreverse );
    2625             :             }
    2626           0 :             break;
    2627             : 
    2628             :             default:
    2629             :             {
    2630             :                 sal_uInt32 nUnknown;
    2631           0 :                 mrStCtrl.ReadUInt32( nUnknown );
    2632             : #ifdef DBG_ANIM_LOG
    2633             :                 fprintf(mpFile, " attribute_%d=\"%#lx\"", nType, nUnknown );
    2634             : #endif
    2635             :             }
    2636           0 :             break;
    2637             :             }
    2638             : 
    2639           0 :             pValueAtom = pAtom->findNextChildAtom( DFF_msofbtAnimValue, pValueAtom );
    2640             :         }
    2641             :     }
    2642           0 : }
    2643             : 
    2644             : 
    2645             : 
    2646           0 : void AnimationImporter::importAnimateKeyPoints( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
    2647             : {
    2648           0 :     Reference< XAnimate > xAnim( xNode, UNO_QUERY );
    2649             : 
    2650             :     DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimKeyPoints && xAnim.is(), "invalid call to ppt::AnimationImporter::importAnimateKeyPoints()!" );
    2651             : 
    2652           0 :     if( pAtom && xAnim.is() )
    2653             :     {
    2654             :         // first count keytimes
    2655           0 :         const Atom* pIter = NULL;
    2656           0 :         int nKeyTimes = 0;
    2657             : 
    2658           0 :         while( (pIter = pAtom->findNextChildAtom( DFF_msofbtAnimKeyTime,  pIter )) != 0 )
    2659           0 :             nKeyTimes++;
    2660             : 
    2661           0 :         Sequence< double > aKeyTimes( nKeyTimes );
    2662           0 :         Sequence< Any > aValues( nKeyTimes );
    2663           0 :         OUString aFormula;
    2664             : 
    2665           0 :         pIter = pAtom->findFirstChildAtom(DFF_msofbtAnimKeyTime);
    2666             :         int nKeyTime;
    2667             :         sal_Int32 nTemp;
    2668           0 :         for( nKeyTime = 0; (nKeyTime < nKeyTimes) && pIter; nKeyTime++ )
    2669             :         {
    2670           0 :             if( pIter->seekToContent() )
    2671             :             {
    2672           0 :                 mrStCtrl.ReadInt32( nTemp );
    2673           0 :                 double fTemp = (double)nTemp / 1000.0;
    2674           0 :                 aKeyTimes[nKeyTime] = fTemp;
    2675             : 
    2676           0 :                 const Atom* pValue = pAtom->findNextChildAtom(pIter);
    2677           0 :                 if( pValue && pValue->getType() == DFF_msofbtAnimAttributeValue )
    2678             :                 {
    2679           0 :                     Any aValue1, aValue2;
    2680           0 :                     if( importAttributeValue( pValue, aValue1 ) )
    2681             :                     {
    2682           0 :                         pValue = pAtom->findNextChildAtom(pValue);
    2683           0 :                         if( pValue && pValue->getType() == DFF_msofbtAnimAttributeValue )
    2684           0 :                             importAttributeValue( pValue, aValue2 );
    2685             : 
    2686           0 :                         bool bCouldBeFormula = false;
    2687           0 :                         bool bHasValue = aValue2.hasValue();
    2688           0 :                         if( bHasValue )
    2689             :                         {
    2690           0 :                             if( aValue2.getValueType() == ::getCppuType((const OUString*)0) )
    2691             :                             {
    2692           0 :                                 OUString aTest;
    2693           0 :                                 aValue2 >>= aTest;
    2694           0 :                                 bHasValue = !aTest.isEmpty();
    2695           0 :                                 bCouldBeFormula = true;
    2696             :                             }
    2697             :                         }
    2698             : 
    2699           0 :                         if( bHasValue && bCouldBeFormula && (aValue1.getValueType() == ::getCppuType((const double*)0)) )
    2700             :                         {
    2701           0 :                             aValue2 >>= aFormula;
    2702           0 :                             bHasValue = false;
    2703             :                         }
    2704             : 
    2705           0 :                         if( bHasValue )
    2706             :                         {
    2707           0 :                             aValues[nKeyTime] = makeAny( ValuePair( aValue1, aValue2 ) );
    2708             :                         }
    2709             :                         else
    2710             :                         {
    2711           0 :                             aValues[nKeyTime] = aValue1;
    2712             :                         }
    2713           0 :                     }
    2714             :                 }
    2715             :             }
    2716           0 :             pIter = pAtom->findNextChildAtom(DFF_msofbtAnimKeyTime, pIter);
    2717             :         }
    2718             : 
    2719             : #ifdef DBG_ANIM_LOG
    2720             :         dump( " keyTimes=\"" );
    2721             :         for( int i=0; i<nKeyTimes; ++i )
    2722             :             dump( "%f;", aKeyTimes[i] );
    2723             : 
    2724             :         if( !aFormula.isEmpty() )
    2725             :         {
    2726             :             dump( "formula=\"%s", aFormula );
    2727             :         }
    2728             : 
    2729             :         dump( "\" values=\"" );
    2730             :         double nVal;
    2731             :         OUString aStr;
    2732             :         for( int i=0; i<nKeyTimes; ++i )
    2733             :         {
    2734             :             if( i != 0 )
    2735             :                 dump( ";" );
    2736             : 
    2737             :             if( aValues[i] >>= aStr )
    2738             :                 dump( "%s",
    2739             :                       OUStringToOString( aStr,
    2740             :                                                 RTL_TEXTENCODING_ASCII_US ).getStr() );
    2741             :             else if( aValues[i] >>= nVal )
    2742             :                 dump( "%f", nVal );
    2743             :             else
    2744             :             {
    2745             :                 ValuePair aValuePair;
    2746             : 
    2747             :                 if( aValues[i] >>= aValuePair )
    2748             :                 {
    2749             :                     if( aValuePair.First >>= aStr )
    2750             :                         dump( "%s",
    2751             :                               OUStringToOString( aStr,
    2752             :                                                         RTL_TEXTENCODING_ASCII_US ).getStr() );
    2753             :                     else if( aValuePair.First >>= nVal )
    2754             :                         dump( "%f", nVal );
    2755             :                     else
    2756             :                         dump( "%X", (sal_Int64)&aValuePair.First );
    2757             : 
    2758             :                     if( aValuePair.Second >>= aStr )
    2759             :                         dump( ",%s",
    2760             :                               OUStringToOString( aStr,
    2761             :                                                         RTL_TEXTENCODING_ASCII_US ).getStr() );
    2762             :                     else if( aValuePair.Second >>= nVal )
    2763             :                         dump( ",%f", nVal );
    2764             :                     else
    2765             :                         dump( ",%X", (sal_Int64)&aValuePair.Second );
    2766             :                 }
    2767             :             }
    2768             :         }
    2769             :         dump( "\"" );
    2770             : #endif
    2771             : 
    2772           0 :         xAnim->setKeyTimes( aKeyTimes );
    2773           0 :         xAnim->setValues( aValues );
    2774           0 :         xAnim->setFormula( aFormula );
    2775           0 :     }
    2776           0 : }
    2777             : 
    2778             : 
    2779             : 
    2780           0 : bool AnimationImporter::importAttributeValue( const Atom* pAtom, Any& rAny )
    2781             : {
    2782             :     DBG_ASSERT( pAtom && pAtom->getType() == DFF_msofbtAnimAttributeValue, "invalid call to ppt::AnimationImporter::importAttributeValue()!" );
    2783             : 
    2784           0 :     bool bOk = false;
    2785             : 
    2786           0 :     if( pAtom && pAtom->seekToContent() )
    2787             :     {
    2788           0 :         sal_uInt32 nRecLen = pAtom->getLength();
    2789           0 :         if ( nRecLen >= 1 )
    2790             :         {
    2791             :             sal_Int8 nType;
    2792           0 :             mrStCtrl.ReadSChar( nType );
    2793           0 :             switch( nType )
    2794             :             {
    2795             :                 case DFF_ANIM_PROP_TYPE_BYTE :
    2796             :                 {
    2797           0 :                     if ( nRecLen == 2 )
    2798             :                     {
    2799             :                         sal_uInt8 nByte;
    2800           0 :                         mrStCtrl.ReadUChar( nByte );
    2801           0 :                         rAny <<= nByte;
    2802             : 
    2803           0 :                         bOk = true;
    2804             :                     }
    2805             :                 }
    2806           0 :                 break;
    2807             : 
    2808             :                 case DFF_ANIM_PROP_TYPE_INT32 :
    2809             :                 {
    2810           0 :                     if ( nRecLen == 5 )
    2811             :                     {
    2812             :                         sal_uInt32 nInt32;
    2813           0 :                         mrStCtrl.ReadUInt32( nInt32 );
    2814           0 :                         rAny <<= nInt32;
    2815             : 
    2816           0 :                         bOk = true;
    2817             :                     }
    2818             :                 }
    2819           0 :                 break;
    2820             : 
    2821             :                 case DFF_ANIM_PROP_TYPE_FLOAT:
    2822             :                 {
    2823           0 :                     if( nRecLen == 5 )
    2824             :                     {
    2825             :                         float fFloat;
    2826           0 :                         mrStCtrl.ReadFloat( fFloat );
    2827           0 :                         rAny <<= (double)fFloat;
    2828             : 
    2829           0 :                         bOk = true;
    2830             :                     }
    2831             :                 }
    2832           0 :                 break;
    2833             : 
    2834             :                 case DFF_ANIM_PROP_TYPE_UNISTRING :
    2835             :                 {
    2836           0 :                     if ( ( nRecLen & 1 ) && ( nRecLen > 1 ) )
    2837             :                     {
    2838           0 :                         OUString aOUString = mpPPTImport->MSDFFReadZString( mrStCtrl, nRecLen - 1, true );
    2839           0 :                         rAny <<= aOUString;
    2840             : 
    2841           0 :                         bOk = true;
    2842             :                     }
    2843             :                 }
    2844           0 :                 break;
    2845             :             }
    2846             :         }
    2847             :     }
    2848             : 
    2849             :     DBG_ASSERT( bOk, "invalid value inside ppt::AnimationImporter::importAttributeValue()!" );
    2850           0 :     return bOk;
    2851             : }
    2852             : 
    2853             : 
    2854             : 
    2855           0 : void AnimationImporter::importAnimationEvents( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
    2856             : {
    2857             :     DBG_ASSERT( xNode.is() && pAtom, "invalid call to ppt::AnimationImporter::importAnimationEvents()!" );
    2858             : 
    2859           0 :     Any aBegin, aEnd, aNext, aPrev;
    2860             : 
    2861           0 :     const Atom* pEventAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimEvent );
    2862           0 :     while( pEventAtom )
    2863             :     {
    2864           0 :         Any* pEvents = NULL;
    2865             : 
    2866           0 :         switch( pEventAtom->getInstance() )
    2867             :         {
    2868           0 :         case 1: pEvents = &aBegin; break;
    2869           0 :         case 2: pEvents = &aEnd; break;
    2870           0 :         case 3: pEvents = &aNext; break;
    2871           0 :         case 4: pEvents = &aPrev; break;
    2872             :         }
    2873             : 
    2874           0 :         if( pEvents )
    2875             :         {
    2876           0 :             Event aEvent;
    2877           0 :             aEvent.Trigger = EventTrigger::NONE;
    2878           0 :             aEvent.Repeat = 0;
    2879             : 
    2880           0 :             const Atom* pChildAtom = pEventAtom->findFirstChildAtom();
    2881             : 
    2882           0 :             while( pChildAtom && pChildAtom->seekToContent() )
    2883             :             {
    2884           0 :                 switch( pChildAtom->getType() )
    2885             :                 {
    2886             :                 case DFF_msofbtAnimTrigger:
    2887             :                 {
    2888             :                     sal_Int32 nU1, nTrigger, nU3, nBegin;
    2889           0 :                     mrStCtrl.ReadInt32( nU1 );
    2890           0 :                     mrStCtrl.ReadInt32( nTrigger );
    2891           0 :                     mrStCtrl.ReadInt32( nU3 );
    2892           0 :                     mrStCtrl.ReadInt32( nBegin );
    2893             : 
    2894           0 :                     switch( nTrigger )
    2895             :                     {
    2896           0 :                     case 0: aEvent.Trigger = EventTrigger::NONE; break;
    2897           0 :                     case 1: aEvent.Trigger = EventTrigger::ON_BEGIN; break;
    2898           0 :                     case 2: aEvent.Trigger = EventTrigger::ON_END; break;
    2899           0 :                     case 3: aEvent.Trigger = EventTrigger::BEGIN_EVENT; break;
    2900           0 :                     case 4: aEvent.Trigger = EventTrigger::END_EVENT; break;
    2901           0 :                     case 5: aEvent.Trigger = EventTrigger::ON_CLICK; break;
    2902           0 :                     case 6: aEvent.Trigger = EventTrigger::ON_DBL_CLICK; break;
    2903           0 :                     case 7: aEvent.Trigger = EventTrigger::ON_MOUSE_ENTER; break;
    2904           0 :                     case 8: aEvent.Trigger = EventTrigger::ON_MOUSE_LEAVE; break;
    2905           0 :                     case 9: aEvent.Trigger = EventTrigger::ON_NEXT; break;
    2906           0 :                     case 10: aEvent.Trigger = EventTrigger::ON_PREV; break;
    2907           0 :                     case 11: aEvent.Trigger = EventTrigger::ON_STOP_AUDIO; break;
    2908             :                     }
    2909             : 
    2910           0 :                     if( (nBegin != 0) || (aEvent.Trigger == EventTrigger::NONE) )
    2911           0 :                         aEvent.Offset = (nBegin == -1) ? makeAny( Timing_INDEFINITE ) : makeAny( (double)(nBegin / 1000.0) );
    2912             :                 }
    2913           0 :                 break;
    2914             :                 case DFF_msofbtAnimateTargetElement:
    2915             :                 {
    2916             :                     sal_Int16 nSubType;
    2917           0 :                     importTargetElementContainer( pChildAtom, aEvent.Source, nSubType );
    2918             :                 }
    2919           0 :                 break;
    2920             :                 default:
    2921             :                 {
    2922             :                     OSL_FAIL("unknown atom inside ppt::AnimationImporter::importAnimationEvents()!");
    2923             :                 }
    2924             :                 }
    2925             : 
    2926           0 :                 pChildAtom = pEventAtom->findNextChildAtom( pChildAtom );
    2927             :             }
    2928             : 
    2929           0 :             *pEvents = addToSequence( *pEvents, (aEvent.Trigger == EventTrigger::NONE) ? aEvent.Offset : makeAny( aEvent ) );
    2930             :         }
    2931             : 
    2932           0 :         pEventAtom = pAtom->findNextChildAtom( DFF_msofbtAnimEvent, pEventAtom );
    2933             :     }
    2934             : 
    2935           0 :     xNode->setBegin( aBegin );
    2936           0 :     xNode->setEnd( aEnd );
    2937             :     // TODO: xNode->setNext( aNext );
    2938             :     // TODO: xNode->setPrev( aNext );
    2939             : 
    2940             : #ifdef DBG_ANIM_LOG
    2941             :     if( aBegin.hasValue() )
    2942             :     {
    2943             :         dump( " begin=\"" );
    2944             :         dump( aBegin );
    2945             :         dump( "\"" );
    2946             :     }
    2947             : 
    2948             :     if( aEnd.hasValue() )
    2949             :     {
    2950             :         dump( " end=\"" );
    2951             :         dump( aEnd );
    2952             :         dump( "\"" );
    2953             :     }
    2954             : 
    2955             :     if( aNext.hasValue() )
    2956             :     {
    2957             :         dump( " next=\"" );
    2958             :         dump( aNext );
    2959             :         dump( "\"" );
    2960             :     }
    2961             : 
    2962             :     if( aPrev.hasValue() )
    2963             :     {
    2964             :         dump( " prev=\"" );
    2965             :         dump( aPrev );
    2966             :         dump( "\"" );
    2967             :     }
    2968             : #endif
    2969           0 : }
    2970             : 
    2971             : 
    2972             : 
    2973           0 : void AnimationImporter::importAnimationActions( const Atom* pAtom, const Reference< XAnimationNode >& xNode )
    2974             : {
    2975             :     DBG_ASSERT( pAtom && xNode.is(), "invalid call to ppt::AnimationImporter::importAnimationActions()!");
    2976             : 
    2977           0 :     if( pAtom )
    2978             :     {
    2979           0 :         const Atom* pActionAtom = pAtom->findFirstChildAtom( DFF_msofbtAnimAction );
    2980             : 
    2981           0 :         if( pActionAtom && pActionAtom->seekToContent() )
    2982             :         {
    2983             :             sal_Int32 nConcurrent, nNextAction, nEndSync, nU4, nU5;
    2984           0 :             mrStCtrl.ReadInt32( nConcurrent );
    2985           0 :             mrStCtrl.ReadInt32( nNextAction );
    2986           0 :             mrStCtrl.ReadInt32( nEndSync );
    2987           0 :             mrStCtrl.ReadInt32( nU4 );
    2988           0 :             mrStCtrl.ReadInt32( nU5 );
    2989             : 
    2990           0 :             if( nEndSync == 1 )
    2991           0 :                 xNode->setEndSync( makeAny( AnimationEndSync::ALL ) );
    2992             : 
    2993             :     #ifdef DBG_ANIM_LOG
    2994             :             dump( " concurrent=\"%s\"", nConcurrent == 0 ? "disabled" : (nConcurrent == 1 ? "enabled" : "unknown") );
    2995             : 
    2996             :             dump( " nextAction=\"%s\"", nNextAction == 0 ? "none" : (nNextAction == 1 ? "seek" : "unknown") );
    2997             : 
    2998             :             if( nEndSync != 0 )
    2999             :             {
    3000             :                 dump( " endSync=\"%s\"", nEndSync == 1 ? "all" : "unknown" );
    3001             :             }
    3002             : 
    3003             :             dump( " action_4=\"%#lx\"", nU4 );
    3004             :             dump( " action_5=\"%#lx\"", nU5 );
    3005             :     #endif
    3006             :         }
    3007             :     }
    3008           0 : }
    3009             : 
    3010             : 
    3011             : 
    3012           0 : sal_Int32 AnimationImporter::importTargetElementContainer( const Atom* pAtom, Any& rTarget, sal_Int16& rSubType )
    3013             : {
    3014           0 :     rSubType = ShapeAnimationSubType::AS_WHOLE;
    3015           0 :     sal_Int32 nRefMode = -1;
    3016             : 
    3017             :     DBG_ASSERT( pAtom && (pAtom->getType() == DFF_msofbtAnimateTargetElement), "invalid call to ppt::AnimationImporter::importTargetElementContainer()!" );
    3018           0 :     if( pAtom )
    3019             :     {
    3020           0 :         const Atom* pChildAtom = pAtom->findFirstChildAtom();
    3021           0 :         while( pChildAtom && pChildAtom->seekToContent() )
    3022             :         {
    3023           0 :             switch( pChildAtom->getType() )
    3024             :             {
    3025             :             case DFF_msofbtAnimReference:
    3026             :             {
    3027             :                 sal_Int32 nRefType,nRefId;
    3028             :                 sal_Int32 begin,end;
    3029           0 :                 mrStCtrl.ReadInt32( nRefMode );
    3030           0 :                 mrStCtrl.ReadInt32( nRefType );
    3031           0 :                 mrStCtrl.ReadInt32( nRefId );
    3032           0 :                 mrStCtrl.ReadInt32( begin );
    3033           0 :                 mrStCtrl.ReadInt32( end );
    3034             : 
    3035           0 :                 switch( nRefType )
    3036             :                 {
    3037             :                 case 1: // shape
    3038             :                 {
    3039           0 :                     SdrObject* pSdrObject = mpPPTImport->getShapeForId( nRefId );
    3040           0 :                     if( pSdrObject == NULL )
    3041           0 :                         break;
    3042             : 
    3043           0 :                     rTarget <<= pSdrObject->getUnoShape();
    3044             : 
    3045           0 :                     switch( nRefMode )
    3046             :                     {
    3047           0 :                     case 6: rSubType = ShapeAnimationSubType::ONLY_BACKGROUND; break;
    3048           0 :                     case 8: rSubType = ShapeAnimationSubType::ONLY_TEXT; break;
    3049             :                     case 2: // one paragraph
    3050             :                     {
    3051           0 :                         if( ((begin == -1) && (end == -1)) || !pSdrObject->ISA( SdrTextObj )  )
    3052           0 :                             break;
    3053             : 
    3054           0 :                         SdrTextObj* pTextObj = static_cast< SdrTextObj* >( pSdrObject );
    3055             : 
    3056           0 :                         const OutlinerParaObject* pOPO = pTextObj->GetOutlinerParaObject();
    3057           0 :                         if( pOPO == NULL )
    3058           0 :                             break;
    3059             : 
    3060           0 :                         const EditTextObject& rEditTextObject = pOPO->GetTextObject();
    3061             : 
    3062           0 :                         const sal_Int32 nParaCount = rEditTextObject.GetParagraphCount();
    3063             : 
    3064           0 :                         sal_Int32 nPara = 0;
    3065             : 
    3066           0 :                         while( (nPara < nParaCount) && (begin > 0) )
    3067             :                         {
    3068           0 :                             sal_Int32 nParaLength = rEditTextObject.GetText( nPara ).getLength() + 1;
    3069           0 :                             begin -= nParaLength;
    3070           0 :                             end -= nParaLength;
    3071           0 :                             nPara++;
    3072             :                         }
    3073             : 
    3074           0 :                         if( nPara < nParaCount )
    3075             :                         {
    3076           0 :                             ParagraphTarget aParaTarget;
    3077           0 :                             rTarget >>= aParaTarget.Shape;
    3078             :                             /* FIXME: Paragraph should be sal_Int32 as well */
    3079           0 :                             aParaTarget.Paragraph = static_cast<sal_Int16>(nPara);
    3080           0 :                             rTarget = makeAny( aParaTarget );
    3081             : 
    3082           0 :                             rSubType = ShapeAnimationSubType::ONLY_TEXT;
    3083           0 :                             dump( " paragraph %d,", (sal_Int32)nPara);
    3084           0 :                             dump( " %d characters", (sal_Int32)end );
    3085             :                         }
    3086             :                     }
    3087             :                     }
    3088             :                 }
    3089           0 :                 break;
    3090             : 
    3091             :                 case 2: // sound
    3092             :                     {
    3093           0 :                         OUString aSoundURL( ((ImplSdPPTImport*)mpPPTImport)->ReadSound( nRefId ) );
    3094           0 :                         rTarget <<= aSoundURL;
    3095           0 :                         dump( " srcRef=\"%s\"", aSoundURL );
    3096             :                     }
    3097           0 :                     break;
    3098             :                 case 3: // audio object
    3099             :                 case 4: // video object
    3100             :                     {
    3101           0 :                         SdrObject* pSdrObject = mpPPTImport->getShapeForId( nRefId );
    3102           0 :                         if( pSdrObject == NULL )
    3103           0 :                             break;
    3104             : 
    3105           0 :                         rTarget <<= pSdrObject->getUnoShape();
    3106             :                     }
    3107           0 :                     break;
    3108             :                 default:
    3109             :                     OSL_FAIL("unknown reference type");
    3110             :                 }
    3111             : 
    3112             :             }
    3113           0 :             break;
    3114             :             case 0x2b01:
    3115             :             {
    3116             :                 sal_Int32 nU1;
    3117           0 :                 mrStCtrl.ReadInt32( nU1 );
    3118             :             }
    3119           0 :             break;
    3120             :             default:
    3121             :                 OSL_FAIL("unknown atom inside ppt::AnimationImporter::importTargetElementContainer()!");
    3122           0 :                 break;
    3123             :             }
    3124             : 
    3125           0 :         pChildAtom = pAtom->findNextChildAtom( pChildAtom );
    3126             : 
    3127             :         }
    3128             :     }
    3129             : 
    3130           0 :     return nRefMode;
    3131             : }
    3132             : 
    3133             : 
    3134             : 
    3135           0 : void AnimationImporter::importPropertySetContainer( const Atom* pAtom, PropertySet& rSet )
    3136             : {
    3137             :     DBG_ASSERT( pAtom && (pAtom->getType() == DFF_msofbtAnimPropertySet), "invalid call to ppt::AnimationImporter::importPropertySetContainer()!" );
    3138             : 
    3139           0 :     if( pAtom )
    3140             :     {
    3141           0 :         const Atom* pChildAtom = pAtom->findFirstChildAtom();
    3142           0 :         while( pChildAtom )
    3143             :         {
    3144           0 :             if( pChildAtom->getType() == DFF_msofbtAnimAttributeValue )
    3145             :             {
    3146           0 :                 Any aAny;
    3147           0 :                 importAttributeValue( pChildAtom, aAny );
    3148           0 :                 rSet.maProperties[ pChildAtom->getInstance() ] = aAny;
    3149             :             }
    3150             :             else
    3151             :             {
    3152             :                 OSL_FAIL("unknown atom inside ppt::AnimationImporter::importPropertySetContainer()!");
    3153             :             }
    3154             : 
    3155           0 :             pChildAtom = pAtom->findNextChildAtom( pChildAtom );
    3156             :         }
    3157             :     }
    3158           0 : }
    3159             : 
    3160             : 
    3161             : 
    3162             : #ifdef DBG_ANIM_LOG
    3163             : void AnimationImporter::dump_atom_header( const Atom* pAtom, bool bOpen, bool bAppend )
    3164             : {
    3165             :     if( pAtom )
    3166             :     {
    3167             :         const char* pTitle;
    3168             : 
    3169             :         switch( pAtom->getType() )
    3170             :         {
    3171             :         case DFF_msofbtAnimEvent: pTitle = "AnimEvent"; break;
    3172             :         case DFF_msofbtAnimTrigger: pTitle = "AnimTrigger"; break;
    3173             :         case DFF_msofbtAnimateMotion:   pTitle = "AnimateMotion"; break;
    3174             :         case DFF_msofbtAnimPropertySet: pTitle = "AnimPropertySet"; break;
    3175             :         case DFF_msofbtAnimateAttributeNames: pTitle = "AnimAttributeName"; break;
    3176             :         case DFF_msofbtAnimAttributeValue: pTitle = "AnimAttributeValue"; break;
    3177             :         case DFF_msofbtAnimGroup: pTitle = "AnimGroup"; break;
    3178             :         case DFF_msofbtAnimNode: pTitle = "AnimNode"; break;
    3179             :         case DFF_msofbtAnimValue: pTitle = "AnimValue"; break;
    3180             :         case DFF_msofbtAnimateFilter: pTitle = "animateFilter"; break;
    3181             :         case DFF_msofbtAnimate: pTitle = "animate"; break;
    3182             :         case DFF_msofbtAnimateSet: pTitle = "set"; break;
    3183             :         case DFF_msofbtAnimKeyTime: pTitle = "AnimKeyTime"; break;
    3184             :         case DFF_msofbtAnimKeyPoints: pTitle = "AnimKeyPoints"; break;
    3185             :         case DFF_msofbtAnimReference: pTitle = "AnimReference"; break;
    3186             :         case DFF_msofbtAnimateTargetElement: pTitle = "AnimTargetElementContainer"; break;
    3187             :         case DFF_msofbtAnimAction: pTitle = "AnimAction"; break;
    3188             :         case DFF_msofbtAnimCommand: pTitle = "AnimCommand"; break;
    3189             :         case DFF_msofbtAnimateTarget: pTitle = "TransformationTarget"; break;
    3190             :         case DFF_msofbtAnimateTargetSettings: pTitle = "TransformationTargetSettings"; break;
    3191             :         case DFF_msofbtAnimIteration: pTitle = "iterate"; break;
    3192             :         case DFF_msofbtAnimateColorData: pTitle = "colorData"; break;
    3193             :         case DFF_msofbtAnimateScaleData: pTitle = "scaleData"; break;
    3194             :         case DFF_msofbtAnimateSetData: pTitle = "setData"; break;
    3195             : 
    3196             :         default:
    3197             :             {
    3198             :                 static char buffer[128];
    3199             :                 sprintf( buffer, "unknown_%#x", pAtom->getType() );
    3200             :                 pTitle = buffer;
    3201             :             }
    3202             :         }
    3203             : 
    3204             :         if( bOpen )
    3205             :         {
    3206             :             fprintf(mpFile, "<%s", pTitle );
    3207             : 
    3208             :             fprintf(mpFile, " instance=\"%hu\"%s",
    3209             :                         pAtom->getInstance(),
    3210             :                         bAppend ? "" : ">\n");
    3211             :         }
    3212             :         else
    3213             :         {
    3214             :             if( bAppend )
    3215             :                 fprintf(mpFile,"/>\n");
    3216             :             else
    3217             :                 fprintf(mpFile, "</%s>\n", pTitle );
    3218             :         }
    3219             :     }
    3220             : }
    3221             : 
    3222             : 
    3223             : 
    3224             : void AnimationImporter::dump( sal_uInt32 nLen, bool bNewLine )
    3225             : {
    3226             :     char * faul = "0123456789abcdef";
    3227             : 
    3228             :     sal_uInt32 i = 0;
    3229             :     int b = 0;
    3230             :     sal_Int8 nData;
    3231             : 
    3232             :     for( i = 0; i < nLen; i++ )
    3233             :     {
    3234             :         mrStCtrl >> nData;
    3235             : 
    3236             :         fprintf( mpFile, "%c%c ", faul[ (nData >> 4) & 0x0f ], faul[ nData & 0x0f ] );
    3237             : 
    3238             :         b++;
    3239             :         if( bNewLine && (b == 32) )
    3240             :         {
    3241             :             fprintf(mpFile,"\n");
    3242             :             b = 0;
    3243             :         }
    3244             :     }
    3245             :     if( (b != 0) && bNewLine )
    3246             :         fprintf(mpFile,"\n");
    3247             : }
    3248             : 
    3249             : 
    3250             : 
    3251             : void AnimationImporter::dump_atom( const Atom* pAtom, bool bNewLine )
    3252             : {
    3253             :     if( pAtom )
    3254             :     {
    3255             :         if( pAtom->isContainer() )
    3256             :         {
    3257             :             const Atom* pChildAtom = pAtom->findFirstChildAtom();
    3258             :             while( pChildAtom )
    3259             :             {
    3260             :                 if( pChildAtom->getType() == DFF_msofbtAnimAttributeValue )
    3261             :                 {
    3262             :                     fprintf(mpFile, "<attributeValue instance=\"%hu\"", pChildAtom->getInstance() );
    3263             : 
    3264             :                     Any aValue;
    3265             :                     if( importAttributeValue( pChildAtom, aValue ) )
    3266             :                     {
    3267             :                         sal_Int32 nInt;
    3268             :                         OUString aString;
    3269             :                         double fDouble;
    3270             : 
    3271             :                         if( aValue >>= nInt )
    3272             :                         {
    3273             :                             fprintf(mpFile, " value=\"%ld\"", nInt );
    3274             :                         }
    3275             :                         else if( aValue >>= aString )
    3276             :                         {
    3277             :                             fprintf(mpFile, " value=\"%s\"",
    3278             :                                 OUStringToOString(aString,
    3279             :                                     RTL_TEXTENCODING_UTF8).getStr());
    3280             :                         }
    3281             :                         else if( aValue >>= fDouble )
    3282             :                         {
    3283             :                             fprintf(mpFile, " value=\"%g\"", fDouble );
    3284             :                         }
    3285             :                     }
    3286             :                     else
    3287             :                     {
    3288             :                         if( pChildAtom->seekToContent() )
    3289             :                         {
    3290             :                             fprintf(mpFile, " value=\""  );
    3291             :                             dump_atom( pChildAtom, false );
    3292             :                             fprintf(mpFile, "\"");
    3293             :                         }
    3294             :                     }
    3295             : 
    3296             :                     fprintf(mpFile, "/>\n" );
    3297             :                 }
    3298             :                 else
    3299             :                 {
    3300             :                     dump_atom_header( pChildAtom, true, pChildAtom->getType() == DFF_msofbtAnimAttributeValue );
    3301             :                     dump_atom( pChildAtom );
    3302             :                     dump_atom_header( pChildAtom, false, pChildAtom->getType() == DFF_msofbtAnimAttributeValue );
    3303             :                 }
    3304             : 
    3305             :                 pChildAtom = pAtom->findNextChildAtom(pChildAtom);
    3306             :             }
    3307             :         }
    3308             :         else if( pAtom->seekToContent() )
    3309             :         {
    3310             :             dump( pAtom->getLength(), bNewLine );
    3311             :         }
    3312             :     }
    3313             : }
    3314             : 
    3315             : 
    3316             : 
    3317             : void AnimationImporter::dump_anim_group( const Atom* pAtom, const AnimationNode& rNode, const PropertySet& rSet, bool bOpen )
    3318             : {
    3319             :     fprintf( mpFile, bOpen ? "<" : "</" );
    3320             : 
    3321             :     switch( rNode.mnGroupType )
    3322             :     {
    3323             :     case mso_Anim_GroupType_PAR:
    3324             :         fprintf( mpFile, "par" );
    3325             :         break;
    3326             :     case mso_Anim_GroupType_SEQ:
    3327             :         fprintf( mpFile, "seq" );
    3328             :         break;
    3329             :     case mso_Anim_GroupType_NODE:
    3330             :         switch( rNode.mnNodeType )
    3331             :         {
    3332             :         case mso_Anim_Behaviour_FILTER:
    3333             :             fprintf( mpFile, "animateFilter" );
    3334             :             break;
    3335             :         case mso_Anim_Behaviour_ANIMATION:
    3336             :             if( pAtom->hasChildAtom( DFF_msofbtAnimateSet ) )
    3337             :                 fprintf( mpFile, "set" );
    3338             :             else if( pAtom->hasChildAtom( DFF_msofbtAnimateColor ) )
    3339             :                 fprintf( mpFile, "animateColor" );
    3340             :             else if( pAtom->hasChildAtom( DFF_msofbtAnimateScale ) )
    3341             :                 fprintf( mpFile, "animateScale" );
    3342             :             else if( pAtom->hasChildAtom( DFF_msofbtAnimateRotation ) )
    3343             :                 fprintf( mpFile, "animateRotation" );
    3344             :             else if( pAtom->hasChildAtom( DFF_msofbtAnimateMotion ) )
    3345             :                 fprintf( mpFile, "animateMotion" );
    3346             :             else if( pAtom->hasChildAtom( DFF_msofbtAnimCommand ) )
    3347             :                 fprintf( mpFile, "command" );
    3348             :             else
    3349             :                 fprintf( mpFile, "animation" );
    3350             :             break;
    3351             :         default:
    3352             :             {
    3353             :                 fprintf( mpFile, "unknown_node_%#lx", rNode.mnNodeType );
    3354             :             }
    3355             :             break;
    3356             :         }
    3357             :         break;
    3358             :     case mso_Anim_GroupType_MEDIA:
    3359             :         fprintf( mpFile, "media" );
    3360             :         break;
    3361             :     default:
    3362             :         fprintf( mpFile, "unknown_group_%#lx", rNode.mnGroupType );
    3363             :         break;
    3364             :     }
    3365             : 
    3366             :     if( bOpen )
    3367             :     {
    3368             :         dump( rNode );
    3369             :         dump( rSet );
    3370             :     }
    3371             : 
    3372             :     fprintf(mpFile,">\n");
    3373             : }
    3374             : 
    3375             : void AnimationImporter::dump( const AnimationNode& rNode )
    3376             : {
    3377             :     // dump animation node
    3378             :     if( rNode.mnRestart != 0 )
    3379             :     {
    3380             :         fprintf(mpFile," restart=\"%s\"",
    3381             :             rNode.mnRestart == 1 ? "always" : (rNode.mnRestart == 2 ? "whenOff" : (rNode.mnRestart == 3 ? "never" : "unknown")) );
    3382             :     }
    3383             : 
    3384             :     if( rNode.mnFill )
    3385             :     {
    3386             :         fprintf(mpFile," fill=\"%s\"",
    3387             :             rNode.mnFill == 1 ? "remove" : (rNode.mnFill == 3 ? "hold" : (rNode.mnFill == 2 ? "freeze" : "unknown")) );
    3388             :     }
    3389             : 
    3390             :     if( rNode.mnDuration > 0 )
    3391             :     {
    3392             :         double fSeconds = rNode.mnDuration;
    3393             :         fSeconds /= 1000.0;
    3394             :         fprintf(mpFile, " dur=\"%g\"", fSeconds);
    3395             :     }
    3396             :     else if( rNode.mnDuration < 0 )
    3397             :     {
    3398             :         fprintf(mpFile, " dur=\"indefinite\"" );
    3399             :     }
    3400             : 
    3401             :     if( rNode.mnU1 ) fprintf(mpFile," u1=\"%#lx\"", rNode.mnU1);
    3402             :     if( rNode.mnU3 ) fprintf(mpFile," u3=\"%#lx\"", rNode.mnU3);
    3403             :     if( rNode.mnU4 ) fprintf(mpFile," u4=\"%#lx\"", rNode.mnU4);
    3404             : }
    3405             : 
    3406             : void AnimationImporter::dump( Any& rAny )
    3407             : {
    3408             :     Sequence< Any > aSeq;
    3409             :     sal_Int32 nInt;
    3410             :     double fDouble;
    3411             :     OUString aString;
    3412             :     sal_Bool bBool;
    3413             :     Event aEvent;
    3414             :     Timing aTiming;
    3415             : 
    3416             :     if( rAny >>= aSeq )
    3417             :     {
    3418             :         const sal_Int32 nSize = aSeq.getLength();
    3419             :         sal_Int32 nIndex = 0;
    3420             :         while( nIndex < nSize )
    3421             :         {
    3422             :             dump( aSeq[nIndex++] );
    3423             :             if(nIndex < nSize)
    3424             :                 fprintf( mpFile, "," );
    3425             :         }
    3426             :     }
    3427             :     else if( rAny >>= aString )
    3428             :     {
    3429             :         fprintf( mpFile, "%s", OUStringToOString(aString,
    3430             :             RTL_TEXTENCODING_UTF8).getStr() );
    3431             :     }
    3432             :     else if( rAny >>= nInt )
    3433             :     {
    3434             :         fprintf( mpFile, "%ld", nInt );
    3435             :     }
    3436             :     else if( rAny >>= bBool )
    3437             :     {
    3438             :         fprintf( mpFile, "%s", bBool ? "true" : "false" );
    3439             :     }
    3440             :     else if( rAny >>= fDouble )
    3441             :     {
    3442             :         fprintf( mpFile, "%g", fDouble );
    3443             :     }
    3444             :     else if( rAny >>= aTiming )
    3445             :     {
    3446             :         fprintf( mpFile, "%s", aTiming == (Timing_INDEFINITE) ? "indefinite" : "media" );
    3447             :     }
    3448             :     else if( rAny >>= aEvent )
    3449             :     {
    3450             :         static const char* triggers[] =
    3451             :         {
    3452             :             "none","onbegin","onend","begin",
    3453             :             "end","onclick","ondoubleclick","onmouseenter",
    3454             :             "onmouseleave","onpptnext","onpptprev","onstopaudio"
    3455             :         };
    3456             : 
    3457             :         if( aEvent.Trigger != EventTrigger::NONE )
    3458             :         {
    3459             :             if( aEvent.Source.hasValue() )
    3460             :             {
    3461             :                 dump_target( aEvent.Source );
    3462             :                 dump( "." );
    3463             :             }
    3464             : 
    3465             :             dump( triggers[ aEvent.Trigger ] );
    3466             :         }
    3467             : 
    3468             :         if( aEvent.Offset.hasValue() )
    3469             :         {
    3470             :             double fOffset;
    3471             :             if( aEvent.Offset >>= fOffset )
    3472             :                 fprintf( mpFile, "%g", fOffset );
    3473             :             else
    3474             :                 dump( "indefinite" );
    3475             :         }
    3476             :     }
    3477             : }
    3478             : 
    3479             : void AnimationImporter::dump( const PropertySet& rSet )
    3480             : {
    3481             :     // dump property set
    3482             : 
    3483             :     map< sal_Int32, Any >::const_iterator aIter( rSet.maProperties.begin() );
    3484             :     const map< sal_Int32, Any >::const_iterator aEnd( rSet.maProperties.end() );
    3485             :     while( aIter != aEnd )
    3486             :     {
    3487             :         bool bKnown = false;
    3488             : 
    3489             :         const sal_Int32 nInstance = (*aIter).first;
    3490             :         Any aAny( (*aIter).second );
    3491             : 
    3492             :         switch ( nInstance )
    3493             :         {
    3494             :         case DFF_ANIM_COLORSPACE:
    3495             :         {
    3496             :             sal_Int32 nColorSpace;
    3497             :             if( aAny >>= nColorSpace )
    3498             :             {
    3499             :                 fprintf( mpFile, " colorSpace=\"%s\"", (nColorSpace == 0) ? "rgb" : (nColorSpace == 1) ? "hsl" : "unknown" );
    3500             :                 bKnown = true;
    3501             :             }
    3502             :         }
    3503             :         break;
    3504             : 
    3505             :         case DFF_ANIM_DIRECTION:
    3506             :         {
    3507             :             sal_Bool bDirection;
    3508             :             if( aAny >>= bDirection )
    3509             :             {
    3510             :                 fprintf( mpFile, " direction=\"%s\"", bDirection ? "cclockwise" : "clockwise"  );
    3511             :                 bKnown = true;
    3512             :             }
    3513             :             else
    3514             :             {
    3515             :                 sal_Int32 nMasterRel;
    3516             :                 if( aAny >>= nMasterRel )
    3517             :                 {
    3518             :                     fprintf( mpFile, " direction=\"%s\"", nMasterRel == 0 ? "sameClick" : ( nMasterRel == 2 ? "nextClick" : "lastClick" )  );
    3519             :                     bKnown = true;
    3520             :                 }
    3521             :             }
    3522             :         }
    3523             :         break;
    3524             : 
    3525             :         case DFF_ANIM_OVERRIDE:     // TODO
    3526             :         {
    3527             :             sal_Int32 nOverride;
    3528             :             if( aAny >>= nOverride )
    3529             :             {
    3530             :                 fprintf( mpFile, " override=\"%s\"", (nOverride == 1) ? "childStyle" : (nOverride == 0) ? "normal" : "unknown" );
    3531             :                 bKnown = true;
    3532             :             }
    3533             :         }
    3534             :         break;
    3535             : 
    3536             :         case DFF_ANIM_PATH_EDIT_MODE:
    3537             :         {
    3538             :             sal_Bool bPathEditMode;
    3539             :             if( aAny >>= bPathEditMode )
    3540             :             {
    3541             :                 fprintf( mpFile, " pptPathEditMode=\"%s\"", bPathEditMode ? "relative" : "fixed" );
    3542             :                 bKnown = true;
    3543             :             }
    3544             :         }
    3545             :         break;
    3546             : 
    3547             :         case DFF_ANIM_PRESET_ID :
    3548             :         {
    3549             :             sal_Int32 nPresetId ;
    3550             :             if( aAny >>= nPresetId )
    3551             :             {
    3552             :                 fprintf(mpFile, " presetid=\"%ld\"", nPresetId );
    3553             :                 bKnown = true;
    3554             :             }
    3555             :         }
    3556             :         break;
    3557             : 
    3558             :         case DFF_ANIM_PRESET_SUB_TYPE :
    3559             :         {
    3560             :             sal_Int32 nPointsType ;
    3561             :             if( aAny >>= nPointsType )
    3562             :             {
    3563             :                 fprintf(mpFile, " presetSubType=\"%ld\"", nPointsType );
    3564             :                 bKnown = true;
    3565             :             }
    3566             :         }
    3567             :         break;
    3568             : 
    3569             :         case DFF_ANIM_PRESET_CLASS :
    3570             :         {
    3571             :             sal_Int32 nPresetClass;
    3572             :             if ( aAny >>= nPresetClass )
    3573             :             {
    3574             :                 const char* pMode;
    3575             :                 switch( nPresetClass )
    3576             :                 {
    3577             :                 case DFF_ANIM_PRESS_CLASS_USER_DEFINED:     pMode = "userdefined"; break;
    3578             :                 case DFF_ANIM_PRESS_CLASS_ENTRANCE:         pMode = "entrance"; break;
    3579             :                 case DFF_ANIM_PRESS_CLASS_EXIT:             pMode = "exit"; break;
    3580             :                 case DFF_ANIM_PRESS_CLASS_EMPHASIS:         pMode = "emphasis"; break;
    3581             :                 case DFF_ANIM_PRESS_CLASS_MOTIONPATH:       pMode = "motionpath"; break;
    3582             :                 case DFF_ANIM_PRESS_CLASS_OLE_ACTION:       pMode = "oleaction"; break;
    3583             :                 case DFF_ANIM_PRESS_CLASS_MEDIACALL:        pMode = "mediacall"; break;
    3584             :                 default:
    3585             :                 {
    3586             :                     static char buffer[128];
    3587             :                     sprintf( buffer, "%ld", nPresetClass );
    3588             :                     pMode = buffer;
    3589             :                 }
    3590             :                 break;
    3591             :                 }
    3592             : 
    3593             :                 fprintf(mpFile, " class=\"%s\"", pMode);
    3594             :                 bKnown = true;
    3595             :             }
    3596             :         }
    3597             :         break;
    3598             : 
    3599             :         case DFF_ANIM_NODE_TYPE :
    3600             :         {
    3601             :             sal_Int32 nNodeType;
    3602             :             if ( aAny >>= nNodeType )
    3603             :             {
    3604             :                 const char* pNode;
    3605             :                 switch( nNodeType )
    3606             :                 {
    3607             :                     case DFF_ANIM_NODE_TYPE_ON_CLICK:       pNode = "onclick";  break;
    3608             :                     case DFF_ANIM_NODE_TYPE_WITH_PREVIOUS:  pNode = "withprevious"; break;
    3609             :                     case DFF_ANIM_NODE_TYPE_AFTER_PREVIOUS: pNode = "afterprevious"; break;
    3610             :                     case DFF_ANIM_NODE_TYPE_MAIN_SEQUENCE:  pNode = "mainsequence"; break;
    3611             :                     case DFF_ANIM_NODE_TYPE_TIMING_ROOT:    pNode = "timingroot"; break;
    3612             :                     case DFF_ANIM_NODE_TYPE_INTERACTIVE_SEQ:pNode = "interactivesequence"; break;
    3613             :                     default :
    3614             :                     {
    3615             :                         static char buffer[128];
    3616             :                         sprintf( buffer, "%ld", nNodeType );
    3617             :                         pNode = buffer;
    3618             :                     }
    3619             :                     break;
    3620             :                 }
    3621             : 
    3622             :                 fprintf(mpFile, " nodeType=\"%s\"", pNode);
    3623             :                 bKnown = true;
    3624             :             }
    3625             :         }
    3626             :         break;
    3627             : 
    3628             :         case DFF_ANIM_GROUP_ID:
    3629             :         {
    3630             :             sal_Int32 nGroupId;
    3631             :             if ( aAny >>= nGroupId )
    3632             :             {
    3633             :                 fprintf( mpFile, " groupId=\"%ld\"", nGroupId );
    3634             :                 bKnown = true;
    3635             :             }
    3636             :         }
    3637             :         break;
    3638             : 
    3639             :         case DFF_ANIM_ID:
    3640             :         {
    3641             :             OUString aString;
    3642             :             if( aAny >>= aString )
    3643             :             {
    3644             :                 fprintf( mpFile, " id=\"%s\"",
    3645             :                     OUStringToOString(aString,
    3646             :                         RTL_TEXTENCODING_UTF8).getStr() );
    3647             :                 bKnown = true;
    3648             :             }
    3649             :         }
    3650             :         break;
    3651             : 
    3652             :         case DFF_ANIM_EVENT_FILTER:
    3653             :         {
    3654             :             OUString aString;
    3655             :             if( aAny >>= aString )
    3656             :             {
    3657             :                 fprintf( mpFile, " eventFilter=\"%s\"",
    3658             :                     OUStringToOString(aString,
    3659             :                         RTL_TEXTENCODING_UTF8).getStr() );
    3660             :                 bKnown = true;
    3661             :             }
    3662             :         }
    3663             :         break;
    3664             : 
    3665             :         case DFF_ANIM_ENDAFTERSLIDE:
    3666             :         {
    3667             :             sal_Int32 nEndAfterSlide;
    3668             :             if( aAny >>= nEndAfterSlide )
    3669             :             {
    3670             :                 fprintf(mpFile, " endAfterSlide=\"%ld\"", nEndAfterSlide );
    3671             :             bKnown = true;
    3672             :             }
    3673             :         }
    3674             : 
    3675             :         case DFF_ANIM_TIMEFILTER:
    3676             :         {
    3677             :             OUString aString;
    3678             :             if( aAny >>= aString )
    3679             :             {
    3680             :                 fprintf( mpFile, " timeFilter=\"%s\"",
    3681             :                     OUStringToOString(aString,
    3682             :                         RTL_TEXTENCODING_UTF8).getStr() );
    3683             :                 bKnown = true;
    3684             :             }
    3685             :         }
    3686             :         break;
    3687             : 
    3688             :         case DFF_ANIM_RUNTIMECONTEXT:
    3689             :         {
    3690             :             OUString aString;
    3691             :             if( aAny >>= aString )
    3692             :             {
    3693             :                 fprintf( mpFile, " runtimeContext=\"%s\"",
    3694             :                     OUStringToOString(aString,
    3695             :                         RTL_TEXTENCODING_UTF8).getStr() );
    3696             :                 bKnown = true;
    3697             :             }
    3698             :         }
    3699             :         break;
    3700             : 
    3701             :         case DFF_ANIM_VOLUME:
    3702             :         {
    3703             :             double fVolume(0.0);
    3704             :             if( aAny >>= fVolume )
    3705             :             {
    3706             :                 fprintf( mpFile, " volume=\"%g%%\"", (double)(fVolume * 100.0) );
    3707             :                 bKnown = true;
    3708             :             }
    3709             :         }
    3710             :         break;
    3711             : 
    3712             :         case DFF_ANIM_AFTEREFFECT:
    3713             :         {
    3714             :             sal_Bool bAfterEffect;
    3715             :             if( aAny >>= bAfterEffect )
    3716             :             {
    3717             :                 fprintf( mpFile, "afterEffect=\"%s\"", bAfterEffect ? "true" : "false" );
    3718             :                 bKnown = true;
    3719             :             }
    3720             :         }
    3721             :         break;
    3722             : 
    3723             :         }
    3724             : 
    3725             : 
    3726             :         if( !bKnown )
    3727             :         {
    3728             :             fprintf( mpFile, " unknown_%lu=\"", nInstance );
    3729             :             dump( aAny );
    3730             :             fprintf( mpFile, "\"" );
    3731             :         }
    3732             : 
    3733             :         ++aIter;
    3734             :     }
    3735             : }
    3736             : 
    3737             : void AnimationImporter::dump_target( Any& rAny )
    3738             : {
    3739             :     Any aSource, aSourceData;
    3740             :     Sequence< Any > aSeq;
    3741             :     if( rAny >>= aSeq )
    3742             :     {
    3743             :         if( aSeq.getLength() >= 1 ) aSource = aSeq[0];
    3744             :         if( aSeq.getLength() >= 2 ) aSourceData = aSeq[1];
    3745             :     }
    3746             :     else
    3747             :     {
    3748             :         aSource = rAny;
    3749             :     }
    3750             : 
    3751             :     Reference< XShape > xShape;
    3752             :     aSource >>= xShape;
    3753             :     if( xShape.is() )
    3754             :     {
    3755             :         OUString aStr( xShape->getShapeType() );
    3756             :         dump( aStr );
    3757             : 
    3758             :         if( aSourceData.hasValue() )
    3759             :         {
    3760             :             dump( "(" );
    3761             :             dump( aSourceData );
    3762             :             dump( ")" );
    3763             :         }
    3764             :     }
    3765             : }
    3766             : 
    3767             : void AnimationImporter::dump( const char * pText )
    3768             : {
    3769             :     fprintf( mpFile, "%s", pText );
    3770             : }
    3771             : 
    3772             : void AnimationImporter::dump( const OUString& rString )
    3773             : {
    3774             :     fprintf( mpFile, OUStringToOString(rString,
    3775             :         RTL_TEXTENCODING_UTF8).getStr() );
    3776             : }
    3777             : 
    3778             : void AnimationImporter::dump( const char * pText, sal_Int64 nInt )
    3779             : {
    3780             :     fprintf( mpFile, pText, nInt );
    3781             : }
    3782             : 
    3783             : void AnimationImporter::dump( const char * pText, sal_Int32 nInt )
    3784             : {
    3785             :     fprintf( mpFile, pText, nInt );
    3786             : }
    3787             : 
    3788             : void AnimationImporter::dump( const char * pText, double fDouble )
    3789             : {
    3790             :     fprintf( mpFile, pText, fDouble );
    3791             : }
    3792             : 
    3793             : void AnimationImporter::dump( const char * pText, const char * pText2 )
    3794             : {
    3795             :     fprintf( mpFile, pText, pText2 );
    3796             : }
    3797             : 
    3798             : void AnimationImporter::dump( const char * pText, const OUString& rString )
    3799             : {
    3800             :     fprintf( mpFile, pText, OUStringToOString(rString,
    3801             :         RTL_TEXTENCODING_UTF8).getStr() );
    3802             : }
    3803             : 
    3804             : #else
    3805             : 
    3806           0 : void AnimationImporter::dump_atom_header( const Atom* , bool , bool  )
    3807             : {
    3808           0 : }
    3809             : 
    3810           0 : void AnimationImporter::dump_atom( const Atom* , bool  )
    3811             : {
    3812           0 : }
    3813             : 
    3814           0 : void AnimationImporter::dump_target( ::com::sun::star::uno::Any&  )
    3815             : {
    3816           0 : }
    3817             : 
    3818           0 : void AnimationImporter::dump( ::com::sun::star::uno::Any&  )
    3819             : {
    3820           0 : }
    3821             : 
    3822           0 : void AnimationImporter::dump( const PropertySet&  )
    3823             : {
    3824           0 : }
    3825             : 
    3826           0 : void AnimationImporter::dump( const AnimationNode&  )
    3827             : {
    3828           0 : }
    3829             : 
    3830           0 : void AnimationImporter::dump( const char *  )
    3831             : {
    3832           0 : }
    3833             : 
    3834           0 : void AnimationImporter::dump( const char * , sal_Int32  )
    3835             : {
    3836           0 : }
    3837             : 
    3838           0 : void AnimationImporter::dump( const char * , double  )
    3839             : {
    3840           0 : }
    3841             : 
    3842           0 : void AnimationImporter::dump( const char * , const char *  )
    3843             : {
    3844           0 : }
    3845             : 
    3846           0 : void AnimationImporter::dump( const char * , const OUString&  )
    3847             : {
    3848           0 : }
    3849             : 
    3850             : #endif
    3851             : 
    3852             : } // namespace ppt;
    3853             : 
    3854             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10