summaryrefslogtreecommitdiff
path: root/sd/source/filter
diff options
context:
space:
mode:
authorAron Budea <aron.budea@collabora.com>2018-04-22 16:10:28 +0200
committerAron Budea <aron.budea@collabora.com>2018-05-17 12:40:36 +0200
commit4e207c2e17d75a3cb7b6b72690375279be40d64a (patch)
treebc95d36a7809ff0a969fd4126f832073acc96a5c /sd/source/filter
parentea955e2f2bfcf05c276b7f7598c7136c732a8542 (diff)
tdf#116899: normalize key times during PPT import if needed
If TimeAnimationValueListEntry contains time with -1000, key times have to be distributed evenly between 0 and 1. ([MS-PPT] 2.8.31) Change-Id: I67a3b83f1f1832fade5df7908c58032bcb9b73ce Reviewed-on: https://gerrit.libreoffice.org/53284 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Aron Budea <aron.budea@collabora.com>
Diffstat (limited to 'sd/source/filter')
-rw-r--r--sd/source/filter/ppt/pptinanimations.cxx15
1 files changed, 12 insertions, 3 deletions
diff --git a/sd/source/filter/ppt/pptinanimations.cxx b/sd/source/filter/ppt/pptinanimations.cxx
index 1a8ab6ea6ebf..d1e00b043f7a 100644
--- a/sd/source/filter/ppt/pptinanimations.cxx
+++ b/sd/source/filter/ppt/pptinanimations.cxx
@@ -2384,15 +2384,17 @@ void AnimationImporter::importAnimateKeyPoints( const Atom* pAtom, const Referen
OUString aFormula;
pIter = pAtom->findFirstChildAtom(DFF_msofbtAnimKeyTime);
- int nKeyTime;
sal_Int32 nTemp;
- for( nKeyTime = 0; (nKeyTime < nKeyTimes) && pIter; nKeyTime++ )
+ bool bToNormalize = false;
+ for( int nKeyTime = 0; (nKeyTime < nKeyTimes) && pIter; nKeyTime++ )
{
if( pIter->seekToContent() )
{
mrStCtrl.ReadInt32( nTemp );
double fTemp = static_cast<double>(nTemp) / 1000.0;
aKeyTimes[nKeyTime] = fTemp;
+ if( fTemp == -1 )
+ bToNormalize = true;
const Atom* pValue = Atom::findNextChildAtom(pIter);
if( pValue && pValue->getType() == DFF_msofbtAnimAttributeValue )
@@ -2489,7 +2491,14 @@ void AnimationImporter::importAnimateKeyPoints( const Atom* pAtom, const Referen
}
dump( "\"" );
#endif
-
+ if( bToNormalize && nKeyTimes >= 2 )
+ {
+ // if TimeAnimationValueList contains time -1000, key points must be evenly distributed between 0 and 1 ([MS-PPT] 2.8.31)
+ for( int nKeyTime = 0; nKeyTime < nKeyTimes; ++nKeyTime )
+ {
+ aKeyTimes[nKeyTime] = static_cast<double>(nKeyTime) / static_cast<double>(nKeyTimes - 1);
+ }
+ }
xAnim->setKeyTimes( aKeyTimes );
xAnim->setValues( aValues );
xAnim->setFormula( aFormula );