diff options
author | Katarina Machalkova <kmachalkova@suse.cz> | 2010-10-19 16:40:50 +0200 |
---|---|---|
committer | Katarina Machalkova <kmachalkova@suse.cz> | 2010-10-19 16:40:50 +0200 |
commit | 7c44931a14c700867750de4ebcfe1679eed45482 (patch) | |
tree | 5b0cdf1352e19116ec663a15382adb728011682e /sd | |
parent | 166b875b073388a09b517e973c4deff37ceabc3a (diff) |
Merged oox-pptx-export-animations-filter.diff from ooo-build
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/filter/pptx/epptooxml.hxx | 2 | ||||
-rw-r--r-- | sd/source/filter/pptx/pptexanimations.hxx | 2 | ||||
-rw-r--r-- | sd/source/filter/pptx/pptx-epptooxml.cxx | 55 | ||||
-rw-r--r-- | sd/source/filter/pptx/pptx-pptexanimations.cxx | 4 |
4 files changed, 52 insertions, 11 deletions
diff --git a/sd/source/filter/pptx/epptooxml.hxx b/sd/source/filter/pptx/epptooxml.hxx index 02d39301599d..44beff3cc0d8 100644 --- a/sd/source/filter/pptx/epptooxml.hxx +++ b/sd/source/filter/pptx/epptooxml.hxx @@ -85,7 +85,9 @@ protected: void WriteAnimationAttributeName( ::sax_fastparser::FSHelperPtr pFS, const ::rtl::OUString& rAttributeName ); void WriteAnimationNode( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Bool bMainSeqChild ); void WriteAnimationNodeAnimate( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, sal_Bool bMainSeqChild ); + void WriteAnimationNodeAnimateInside( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Bool bMainSeqChild, sal_Bool bSimple ); void WriteAnimationNodeSeq( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, sal_Bool bMainSeqChild ); + void WriteAnimationNodeEffect( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, sal_Bool bMainSeqChild ); void WriteAnimationNodeCommonPropsStart( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rXNode, sal_Bool bSingle, sal_Bool bMainSeqChild ); void WriteAnimationNodeCommonPropsEnd( ::sax_fastparser::FSHelperPtr pFS ); void WriteAnimationProperty( ::sax_fastparser::FSHelperPtr pFS, const ::com::sun::star::uno::Any& rAny ); diff --git a/sd/source/filter/pptx/pptexanimations.hxx b/sd/source/filter/pptx/pptexanimations.hxx index 38eb953d95b5..bbc9b6e32b80 100644 --- a/sd/source/filter/pptx/pptexanimations.hxx +++ b/sd/source/filter/pptx/pptexanimations.hxx @@ -142,6 +142,8 @@ public: static sal_uInt32 TranslatePresetSubType( const sal_uInt32 nPresetClass, const sal_uInt32 nPresetId, const rtl::OUString& rPresetSubType ); static sal_uInt32 GetPresetID( const rtl::OUString& rPreset, sal_uInt32 nAPIPresetClass, sal_Bool& bPresetId ); static sal_uInt32 GetValueTypeForAttributeName( const rtl::OUString& rAttributeName ); + + static const sal_Char* FindTransitionName( const sal_Int16 nType, const sal_Int16 nSubType, const sal_Bool bDirection ); }; } // namespace ppt diff --git a/sd/source/filter/pptx/pptx-epptooxml.cxx b/sd/source/filter/pptx/pptx-epptooxml.cxx index 014294d167f6..e93f735b94c9 100644 --- a/sd/source/filter/pptx/pptx-epptooxml.cxx +++ b/sd/source/filter/pptx/pptx-epptooxml.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/animations/XAnimateSet.hpp> #include <com/sun/star/animations/XAnimationNode.hpp> #include <com/sun/star/animations/XAnimationNodeSupplier.hpp> +#include <com/sun/star/animations/XTransitionFilter.hpp> #include <com/sun/star/beans/Property.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> @@ -607,6 +608,9 @@ void PowerPointExport::WriteAnimateTo( FSHelperPtr pFS, Any aValue, const OUStri void PowerPointExport::WriteAnimationAttributeName( FSHelperPtr pFS, const OUString& rAttributeName ) { + if( ! rAttributeName.getLength() ) + return; + pFS->startElementNS( XML_p, XML_attrNameLst, FSEND ); DBG(printf("write attribute name: %s\n", USS( rAttributeName ))); @@ -648,9 +652,9 @@ void PowerPointExport::WriteAnimationNodeAnimate( FSHelperPtr pFS, const Referen const char* pCalcMode = NULL; const char* pValueType = NULL; - const char* pAdditive = NULL; + sal_Bool bSimple = ( nXmlNodeType != XML_anim ); - if( nXmlNodeType == XML_anim ) { + if( !bSimple ) { switch( rXAnimate->getCalcMode() ) { case AnimationCalcMode::DISCRETE: pCalcMode = "discrete"; @@ -671,7 +675,25 @@ void PowerPointExport::WriteAnimationNodeAnimate( FSHelperPtr pFS, const Referen pValueType = "clr"; break; } + } + + pFS->startElementNS( XML_p, nXmlNodeType, + XML_calcmode, pCalcMode, + XML_valueType, pValueType, + FSEND ); + WriteAnimationNodeAnimateInside( pFS, rXNode, bMainSeqChild, bSimple ); + pFS->endElementNS( XML_p, nXmlNodeType ); +} + +void PowerPointExport::WriteAnimationNodeAnimateInside( FSHelperPtr pFS, const Reference< XAnimationNode >& rXNode, sal_Bool bMainSeqChild, sal_Bool bSimple ) +{ + Reference< XAnimate > rXAnimate( rXNode, UNO_QUERY ); + if( !rXAnimate.is() ) + return; + + const char* pAdditive = NULL; + if( !bSimple ) { switch( rXAnimate->getAdditive() ) { case AnimationAdditiveMode::BASE: pAdditive = "base"; @@ -691,10 +713,6 @@ void PowerPointExport::WriteAnimationNodeAnimate( FSHelperPtr pFS, const Referen } } - pFS->startElementNS( XML_p, nXmlNodeType, - XML_calcmode, pCalcMode, - XML_valueType, pValueType, - FSEND ); pFS->startElementNS( XML_p, XML_cBhvr, XML_additive, pAdditive, FSEND ); @@ -704,7 +722,6 @@ void PowerPointExport::WriteAnimationNodeAnimate( FSHelperPtr pFS, const Referen pFS->endElementNS( XML_p, XML_cBhvr ); WriteAnimateValues( pFS, rXAnimate ); WriteAnimateTo( pFS, rXAnimate->getTo(), rXAnimate->getAttributeName() ); - pFS->endElementNS( XML_p, nXmlNodeType ); } void PowerPointExport::WriteAnimationCondition( FSHelperPtr pFS, const char* pDelay, const char* pEvent, double fDelay, sal_Bool bHasFDelay ) @@ -1014,6 +1031,25 @@ void PowerPointExport::WriteAnimationNodeSeq( FSHelperPtr pFS, const Reference< pFS->endElementNS( XML_p, XML_seq ); } +void PowerPointExport::WriteAnimationNodeEffect( FSHelperPtr pFS, const Reference< XAnimationNode >& rXNode, sal_Int32, sal_Bool bMainSeqChild ) +{ + DBG(printf ("write animation node FILTER\n")); + + Reference< XTransitionFilter > xFilter( rXNode, UNO_QUERY ); + if ( xFilter.is() ) { + const char* pFilter = ppt::AnimationExporter::FindTransitionName( xFilter->getTransition(), xFilter->getSubtype(), xFilter->getDirection() ); + const char* pDirection = xFilter->getDirection() ? "in" : "out"; + pFS->startElementNS( XML_p, XML_animEffect, + XML_filter, pFilter, + XML_transition, pDirection, + FSEND ); + + WriteAnimationNodeAnimateInside( pFS, rXNode, bMainSeqChild, FALSE ); + + pFS->endElementNS( XML_p, XML_animEffect ); + } +} + void PowerPointExport::WriteAnimationNode( FSHelperPtr pFS, const Reference< XAnimationNode >& rXNode, sal_Bool bMainSeqChild ) { DBG(printf ("export node type: %d\n", rXNode->getType())); @@ -1036,8 +1072,9 @@ void PowerPointExport::WriteAnimationNode( FSHelperPtr pFS, const Reference< XAn xmlNodeType = XML_set; pMethod = &PowerPointExport::WriteAnimationNodeAnimate; break; -// case AnimationNodeType::TRANSITIONFILTER: -// xmlNodeType = XML_xfrm; + case AnimationNodeType::TRANSITIONFILTER: + xmlNodeType = XML_animEffect; + pMethod = &PowerPointExport::WriteAnimationNodeEffect; break; } diff --git a/sd/source/filter/pptx/pptx-pptexanimations.cxx b/sd/source/filter/pptx/pptx-pptexanimations.cxx index 1cf57441ff5e..bf502ab655e8 100644 --- a/sd/source/filter/pptx/pptx-pptexanimations.cxx +++ b/sd/source/filter/pptx/pptx-pptexanimations.cxx @@ -243,7 +243,7 @@ sal_uInt32 AnimationExporter::TranslatePresetSubType( const sal_uInt32 nPresetCl return nPresetSubType; } -const sal_Char* transition::find( const sal_Int16 nType, const sal_Int16 nSubType, const sal_Bool bDirection ) +const sal_Char* AnimationExporter::FindTransitionName( const sal_Int16 nType, const sal_Int16 nSubType, const sal_Bool bDirection ) { const sal_Char* pRet = NULL; int nFit = 0; @@ -1943,7 +1943,7 @@ void AnimationExporter::exportTransitionFilter( SvStream& rStrm, const Reference rStrm << nBits << nTransition; } - const sal_Char* pFilter = transition::find( xFilter->getTransition(), xFilter->getSubtype(), xFilter->getDirection() ); + const sal_Char* pFilter = FindTransitionName( xFilter->getTransition(), xFilter->getSubtype(), xFilter->getDirection() ); if ( pFilter ) { const OUString aStr( OUString::createFromAscii( pFilter ) ); |