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

Generated by: LCOV version 1.10