diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2018-02-02 10:21:50 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-02-12 19:50:21 +0100 |
commit | 6f05db5a19c0bd82b937e2c79f766bb35c60acc1 (patch) | |
tree | 45ab103622bd702856a4e6922da503db6776efd8 /oox | |
parent | dc6b1c2329bb744fb5e8c33749dcff34553645da (diff) |
tdf#115394 import custom slide transition time in PPTX
* custom values are imported correctly
* standard (fast, slow, medium) values are changed
to match values in the MSO
Change-Id: I004242afbbf641fe414abc8df248a2844c104502
Reviewed-on: https://gerrit.libreoffice.org/49139
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/49521
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/ppt/slidetransition.cxx | 30 | ||||
-rw-r--r-- | oox/source/ppt/slidetransitioncontext.cxx | 6 | ||||
-rw-r--r-- | oox/source/token/properties.txt | 1 |
3 files changed, 29 insertions, 8 deletions
diff --git a/oox/source/ppt/slidetransition.cxx b/oox/source/ppt/slidetransition.cxx index 9ae715fa49c0..dc2dbf923b67 100644 --- a/oox/source/ppt/slidetransition.cxx +++ b/oox/source/ppt/slidetransition.cxx @@ -47,6 +47,7 @@ namespace oox { namespace ppt { , mbTransitionDirectionNormal( true ) , mnAnimationSpeed( AnimationSpeed_FAST ) , mnFadeColor( 0 ) + , mfTransitionDurationInSeconds( -1.0 ) , mbMode( true ) , mnAdvanceTime( -1 ) { @@ -59,6 +60,7 @@ namespace oox { namespace ppt { , mbTransitionDirectionNormal( true ) , mnAnimationSpeed( AnimationSpeed_FAST ) , mnFadeColor( 0 ) + , mfTransitionDurationInSeconds( -1.0 ) , mbMode( true ) , mnAdvanceTime( -1 ) { @@ -79,11 +81,13 @@ namespace oox { namespace ppt { aProps.setProperty( PROP_TransitionSubtype, mnTransitionSubType); aProps.setProperty( PROP_TransitionDirection, mbTransitionDirectionNormal); aProps.setProperty( PROP_Speed, mnAnimationSpeed); + if( mfTransitionDurationInSeconds >= 0.0 ) + aProps.setProperty( PROP_TransitionDuration, mfTransitionDurationInSeconds); aProps.setProperty( PROP_TransitionFadeColor, mnFadeColor); - if( mnAdvanceTime != -1 ) { - aProps.setProperty( PROP_Duration, mnAdvanceTime/1000); - aProps.setProperty( PROP_Change, static_cast<sal_Int32>(1)); - } + if( mnAdvanceTime != -1 ) { + aProps.setProperty( PROP_Duration, mnAdvanceTime/1000); + aProps.setProperty( PROP_Change, static_cast<sal_Int32>(1)); + } } catch( Exception& ) { @@ -113,19 +117,21 @@ namespace oox { namespace ppt { { switch( nToken ) { - /* In case you want to use time values in second, - * the speed values are located in the PPT97 importer - * sd/source/filter/ppt/ppt97animations.cxx:664 - * (void Ppt97Animation::UpdateCacheData() const) + /* the speed values are located in the PPT97 importer + * sd/source/filter/ppt/pptin.cxx:1783 + * (void ImplSdPPTImport::ImportPageEffect) */ case XML_fast: mnAnimationSpeed = AnimationSpeed_FAST; + mfTransitionDurationInSeconds = 0.5; break; case XML_med: mnAnimationSpeed = AnimationSpeed_MEDIUM; + mfTransitionDurationInSeconds = 0.75; break; case XML_slow: mnAnimationSpeed = AnimationSpeed_SLOW; + mfTransitionDurationInSeconds = 1.0; break; default: // should not happen. just ignore @@ -133,6 +139,14 @@ namespace oox { namespace ppt { } } + void SlideTransition::setOoxTransitionSpeed( double fDurationInSeconds ) + { + // for compatibility + mnAnimationSpeed = ( fDurationInSeconds <= 0.5 ) ? AnimationSpeed_FAST + : ( fDurationInSeconds >= 1.0 ) ? AnimationSpeed_SLOW : AnimationSpeed_MEDIUM; + mfTransitionDurationInSeconds = fDurationInSeconds; + } + sal_Int16 SlideTransition::ooxToOdpEightDirections( ::sal_Int32 nOoxType ) { sal_Int16 nOdpDirection; diff --git a/oox/source/ppt/slidetransitioncontext.cxx b/oox/source/ppt/slidetransitioncontext.cxx index 9b29653e98e6..bed6060d4d4a 100644 --- a/oox/source/ppt/slidetransitioncontext.cxx +++ b/oox/source/ppt/slidetransitioncontext.cxx @@ -32,6 +32,7 @@ #include "oox/helper/attributelist.hxx" #include <oox/token/namespaces.hxx> #include <oox/token/tokens.hxx> +#include <oox/token/properties.hxx> using namespace ::com::sun::star; using namespace ::oox::core; @@ -50,6 +51,11 @@ SlideTransitionContext::SlideTransitionContext( FragmentHandler2& rParent, const // ST_TransitionSpeed maTransition.setOoxTransitionSpeed( rAttribs.getToken( XML_spd, XML_fast ) ); + // p14:dur + sal_Int32 nDurationInMs = rAttribs.getInteger( P14_TOKEN( dur ), -1 ); + if( nDurationInMs > -1 ) + maTransition.setOoxTransitionSpeed( nDurationInMs / 1000.0 ); + // TODO rAttribs.getBool( XML_advClick, true ); diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 52909147b9e1..f4ca60265708 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -527,6 +527,7 @@ TopMargin TotalsRow Transformation TransitionDirection +TransitionDuration TransitionFadeColor TransitionSubtype TransitionType |