summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-07-17 15:25:12 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-07-17 15:40:44 -0400
commitebd8d28361a3c0f420346fcafcecadef09efbda5 (patch)
tree767a7e1cbb27bcb8cd93b84642c7706e9e7ef6a2
parentefd6fc5e99d89509129469843bbdf3e8f94b58a4 (diff)
Scope reduction.
Change-Id: I4caeaf3565255ab141fc4951f1bd149a7af6bb8f
-rw-r--r--sc/source/core/tool/chgtrack.cxx97
1 files changed, 48 insertions, 49 deletions
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 8373605e1ab3..48e4f7f63f66 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -3163,65 +3163,64 @@ void ScChangeTrack::Undo( sal_uLong nStartAction, sal_uLong nEndAction, bool bMe
// Deletes are in right order
ScChangeAction* pAct = IsLastAction(j) ? pLast : GetAction(j);
- if ( pAct )
+ if (!pAct)
+ continue;
+
+ if ( pAct->IsDeleteType() )
{
- if ( pAct->IsDeleteType() )
+ if (j == nEndAction || (pAct != pLast && ((ScChangeActionDel*)pAct)->IsTopDelete()))
{
- if ( j == nEndAction || (pAct != pLast &&
- ((ScChangeActionDel*)pAct)->IsTopDelete()) )
- {
- SetInDeleteTop( true );
- SetInDeleteRange( ((ScChangeActionDel*)pAct)->
- GetOverAllRange().MakeRange() );
- }
+ SetInDeleteTop( true );
+ SetInDeleteRange( ((ScChangeActionDel*)pAct)->GetOverAllRange().MakeRange() );
}
- UpdateReference( pAct, true );
- SetInDeleteTop( false );
- Remove( pAct );
- if ( IsInPasteCut() )
- aPasteCutMap.insert( ::std::make_pair( pAct->GetActionNumber(), pAct ) );
- else
- {
- if ( j == nStartAction && pAct->GetType() == SC_CAT_MOVE )
+ }
+ UpdateReference( pAct, true );
+ SetInDeleteTop( false );
+ Remove( pAct );
+ if ( IsInPasteCut() )
+ {
+ aPasteCutMap.insert( ::std::make_pair( pAct->GetActionNumber(), pAct ) );
+ continue;
+ }
+
+ if ( j == nStartAction && pAct->GetType() == SC_CAT_MOVE )
+ {
+ ScChangeActionMove* pMove = (ScChangeActionMove*) pAct;
+ sal_uLong nStart = pMove->GetStartLastCut();
+ sal_uLong nEnd = pMove->GetEndLastCut();
+ if ( nStart && nStart <= nEnd )
+ { // Recover LastCut
+ //! Break Links before Cut Append
+ pMove->RemoveAllLinks();
+ StartBlockModify( SC_CTM_APPEND, nStart );
+ for ( sal_uLong nCut = nStart; nCut <= nEnd; nCut++ )
{
- ScChangeActionMove* pMove = (ScChangeActionMove*) pAct;
- sal_uLong nStart = pMove->GetStartLastCut();
- sal_uLong nEnd = pMove->GetEndLastCut();
- if ( nStart && nStart <= nEnd )
- { // Recover LastCut
- //! Break Links before Cut Append
- pMove->RemoveAllLinks();
- StartBlockModify( SC_CTM_APPEND, nStart );
- for ( sal_uLong nCut = nStart; nCut <= nEnd; nCut++ )
- {
- ScChangeActionMap::iterator itCut = aPasteCutMap.find( nCut );
+ ScChangeActionMap::iterator itCut = aPasteCutMap.find( nCut );
- if ( itCut != aPasteCutMap.end() )
- {
- OSL_ENSURE( aMap.find( nCut ) == aMap.end(), "ScChangeTrack::Undo: nCut dup" );
- Append( itCut->second, nCut );
- aPasteCutMap.erase( itCut );
- }
- else
- {
- OSL_FAIL( "ScChangeTrack::Undo: nCut not found" );
- }
- }
- EndBlockModify( nEnd );
- ResetLastCut();
- nStartLastCut = nStart;
- nEndLastCut = nEnd;
- pLastCutMove = pMove;
- SetLastCutMoveRange(
- pMove->GetFromRange().MakeRange(), pDoc );
+ if ( itCut != aPasteCutMap.end() )
+ {
+ OSL_ENSURE( aMap.find( nCut ) == aMap.end(), "ScChangeTrack::Undo: nCut dup" );
+ Append( itCut->second, nCut );
+ aPasteCutMap.erase( itCut );
}
else
- delete pMove;
+ {
+ OSL_FAIL( "ScChangeTrack::Undo: nCut not found" );
+ }
}
- else
- delete pAct;
+ EndBlockModify( nEnd );
+ ResetLastCut();
+ nStartLastCut = nStart;
+ nEndLastCut = nEnd;
+ pLastCutMove = pMove;
+ SetLastCutMoveRange(
+ pMove->GetFromRange().MakeRange(), pDoc );
}
+ else
+ delete pMove;
}
+ else
+ delete pAct;
}
EndBlockModify( nEndAction );
}