Kaydet (Commit) 94f8754f authored tarafından Michael Meeks's avatar Michael Meeks

tdf#91381 - fix a couple of animation related lifecycle issues.

Change-Id: I4aada7f27e3a88124ad670e62ddb6c92ecf431a8
üst 07f872d4
...@@ -1752,76 +1752,74 @@ void CustomAnimationPane::onChange( bool bCreate ) ...@@ -1752,76 +1752,74 @@ void CustomAnimationPane::onChange( bool bCreate )
} }
} }
VclPtrInstance< CustomAnimationCreateDialog > pDlg( this, this, aTargets, bHasText, sPresetId, fDuration );
if( pDlg->Execute() )
{ {
addUndo(); ScopedVclPtrInstance< CustomAnimationCreateDialog > pDlg( this, this, aTargets, bHasText, sPresetId, fDuration );
fDuration = pDlg->getSelectedDuration(); if( pDlg->Execute() )
CustomAnimationPresetPtr pDescriptor = pDlg->getSelectedPreset();
if( pDescriptor.get() )
{ {
if( bCreate ) addUndo();
fDuration = pDlg->getSelectedDuration();
CustomAnimationPresetPtr pDescriptor = pDlg->getSelectedPreset();
if( pDescriptor.get() )
{ {
mpCustomAnimationList->SelectAll( false ); if( bCreate )
// 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 )
{ {
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 // gather shapes from the selection
if( bHasText && (aTargets.size() == 1) ) 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 ); CustomAnimationEffectPtr pCreated = mpMainSequence->append( pDescriptor, (*aIter), fDuration );
if( xShape.is() && !hasVisibleShape( xShape ) )
// 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 ) if( bFirst )
bFirst = false; bFirst = false;
else else
pCreated->setNodeType( EffectNodeType::WITH_PREVIOUS ); pCreated->setNodeType( EffectNodeType::WITH_PREVIOUS );
if( pCreated.get() ) if( pCreated.get() )
{ mpCustomAnimationList->select( pCreated );
mpCustomAnimationList->select( pCreated );
} }
} }
} else
else
{
MainSequenceRebuildGuard aGuard( mpMainSequence );
// get selected effect
EffectSequence::iterator aIter( maListSelection.begin() );
const EffectSequence::iterator aEnd( maListSelection.end() );
while( aIter != aEnd )
{ {
CustomAnimationEffectPtr pEffect = (*aIter++); MainSequenceRebuildGuard aGuard( mpMainSequence );
EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence(); // get selected effect
if( !pEffectSequence ) EffectSequence::iterator aIter( maListSelection.begin() );
pEffectSequence = mpMainSequence.get(); 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 } // dispose pDlg
{
PathKind eKind = pDlg->getCreatePathKind();
if( eKind != PathKind::NONE )
createPath( eKind, aTargets, fDuration );
}
mrBase.GetDocShell()->SetModified();
}
pDlg.reset();
updateControls(); updateControls();
......
...@@ -1729,6 +1729,9 @@ Size SfxDockingWindow::GetMinOutputSizePixel() const ...@@ -1729,6 +1729,9 @@ Size SfxDockingWindow::GetMinOutputSizePixel() const
bool SfxDockingWindow::Notify( NotifyEvent& rEvt ) bool SfxDockingWindow::Notify( NotifyEvent& rEvt )
{ {
if ( !pImp )
return DockingWindow::Notify( rEvt );
if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS ) if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS )
{ {
if (pMgr != NULL) if (pMgr != NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment