diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-05-21 16:26:37 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-05-21 16:36:09 +0100 |
commit | 99938e7bc8a305dcc9733adbe635e25a38afed31 (patch) | |
tree | 25354420d171019465042ae542508485ce5c508e /sd/source/ui/animations | |
parent | 15cc77f8d3d1edfd0e8114829bc4b340c3d73b4d (diff) |
tdf#91381 - fix a couple of animation related lifecycle issues.
Change-Id: I4aada7f27e3a88124ad670e62ddb6c92ecf431a8
Diffstat (limited to 'sd/source/ui/animations')
-rw-r--r-- | sd/source/ui/animations/CustomAnimationPane.cxx | 102 |
1 files changed, 50 insertions, 52 deletions
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index d7a97cb15f36..ca19853a4c0a 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -1752,76 +1752,74 @@ void CustomAnimationPane::onChange( bool bCreate ) } } - VclPtrInstance< CustomAnimationCreateDialog > pDlg( this, this, aTargets, bHasText, sPresetId, fDuration ); - if( pDlg->Execute() ) { - addUndo(); - fDuration = pDlg->getSelectedDuration(); - CustomAnimationPresetPtr pDescriptor = pDlg->getSelectedPreset(); - if( pDescriptor.get() ) + ScopedVclPtrInstance< CustomAnimationCreateDialog > pDlg( this, this, aTargets, bHasText, sPresetId, fDuration ); + if( pDlg->Execute() ) { - if( bCreate ) + addUndo(); + fDuration = pDlg->getSelectedDuration(); + CustomAnimationPresetPtr pDescriptor = pDlg->getSelectedPreset(); + if( pDescriptor.get() ) { - mpCustomAnimationList->SelectAll( false ); - - // gather shapes from the selection - std::vector< Any >::iterator aIter( aTargets.begin() ); - const std::vector< Any >::iterator aEnd( aTargets.end() ); - bool bFirst = true; - for( ; aIter != aEnd; ++aIter ) + if( bCreate ) { - CustomAnimationEffectPtr pCreated = mpMainSequence->append( pDescriptor, (*aIter), fDuration ); + mpCustomAnimationList->SelectAll( false ); - // if only one shape with text and no fill or outline is selected, animate only by first level paragraphs - if( bHasText && (aTargets.size() == 1) ) + // gather shapes from the selection + std::vector< Any >::iterator aIter( aTargets.begin() ); + const std::vector< Any >::iterator aEnd( aTargets.end() ); + bool bFirst = true; + for( ; aIter != aEnd; ++aIter ) { - Reference< XShape > xShape( (*aIter), UNO_QUERY ); - if( xShape.is() && !hasVisibleShape( xShape ) ) + CustomAnimationEffectPtr pCreated = mpMainSequence->append( pDescriptor, (*aIter), fDuration ); + + // if only one shape with text and no fill or outline is selected, animate only by first level paragraphs + if( bHasText && (aTargets.size() == 1) ) { - mpMainSequence->createTextGroup( pCreated, 1, -1.0, false, false ); + Reference< XShape > xShape( (*aIter), UNO_QUERY ); + if( xShape.is() && !hasVisibleShape( xShape ) ) + { + mpMainSequence->createTextGroup( pCreated, 1, -1.0, false, false ); + } } - } - if( bFirst ) - bFirst = false; - else - pCreated->setNodeType( EffectNodeType::WITH_PREVIOUS ); + if( bFirst ) + bFirst = false; + else + pCreated->setNodeType( EffectNodeType::WITH_PREVIOUS ); - if( pCreated.get() ) - { - mpCustomAnimationList->select( pCreated ); + if( pCreated.get() ) + mpCustomAnimationList->select( pCreated ); } } - } - else - { - MainSequenceRebuildGuard aGuard( mpMainSequence ); - - // get selected effect - EffectSequence::iterator aIter( maListSelection.begin() ); - const EffectSequence::iterator aEnd( maListSelection.end() ); - while( aIter != aEnd ) + else { - CustomAnimationEffectPtr pEffect = (*aIter++); + MainSequenceRebuildGuard aGuard( mpMainSequence ); - EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence(); - if( !pEffectSequence ) - pEffectSequence = mpMainSequence.get(); + // get selected effect + EffectSequence::iterator aIter( maListSelection.begin() ); + const EffectSequence::iterator aEnd( maListSelection.end() ); + while( aIter != aEnd ) + { + CustomAnimationEffectPtr pEffect = (*aIter++); + + EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence(); + if( !pEffectSequence ) + pEffectSequence = mpMainSequence.get(); - pEffectSequence->replace( pEffect, pDescriptor, fDuration ); + pEffectSequence->replace( pEffect, pDescriptor, fDuration ); + } } } + else + { + PathKind eKind = pDlg->getCreatePathKind(); + if( eKind != PathKind::NONE ) + createPath( eKind, aTargets, fDuration ); + } + mrBase.GetDocShell()->SetModified(); } - else - { - PathKind eKind = pDlg->getCreatePathKind(); - if( eKind != PathKind::NONE ) - createPath( eKind, aTargets, fDuration ); - } - mrBase.GetDocShell()->SetModified(); - } - - pDlg.reset(); + } // dispose pDlg updateControls(); |