undoapi: don't do view updates when paints are locked

This commit is contained in:
Frank Schoenheit [fs] 2010-11-18 12:16:57 +01:00
parent 230136cff1
commit ff89cf3166
8 changed files with 48 additions and 39 deletions

View file

@ -334,6 +334,8 @@ public:
void PostPaintGridAll();
void PostPaintExtras();
bool IsPaintLocked() const { return pPaintLockData != NULL; }
void PostDataChanged();
void UpdatePaintExt( USHORT& rExtFlags, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab,

View file

@ -31,6 +31,7 @@
#include <svl/undo.hxx>
#include "global.hxx"
#include "address.hxx"
#include "docsh.hxx"
class ScDocument;
class ScDocShell;
@ -53,6 +54,10 @@ protected:
ScDocShell* pDocShell;
SfxUndoAction* pDetectiveUndo;
bool IsPaintLocked() const { return pDocShell->IsPaintLocked(); }
bool SetViewMarkData( const ScMarkData& rMarkData );
void BeginUndo();
void EndUndo();
void BeginRedo();

View file

@ -66,6 +66,19 @@ __EXPORT ScSimpleUndo::~ScSimpleUndo()
delete pDetectiveUndo;
}
bool ScSimpleUndo::SetViewMarkData( const ScMarkData& rMarkData )
{
if ( IsPaintLocked() )
return false;
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if ( !pViewShell )
return false;
pViewShell->SetMarkData( rMarkData );
return true;
}
BOOL __EXPORT ScSimpleUndo::Merge( SfxUndoAction *pNextAction )
{
// Zu jeder Undo-Action kann eine SdrUndoGroup fuer das Aktualisieren
@ -253,6 +266,9 @@ BOOL ScBlockUndo::AdjustHeight()
void ScBlockUndo::ShowBlock()
{
if ( IsPaintLocked() )
return;
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{

View file

@ -1600,10 +1600,8 @@ String __EXPORT ScUndoSelectionStyle::GetComment() const
void ScUndoSelectionStyle::DoChange( const BOOL bUndo )
{
ScDocument* pDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
pViewShell->SetMarkData( aMarkData );
SetViewMarkData( aMarkData );
ScRange aWorkRange( aRange );
if ( pDoc->HasAttrib( aWorkRange, HASATTR_MERGED ) ) // zusammengefasste Zellen?
@ -1635,6 +1633,7 @@ void ScUndoSelectionStyle::DoChange( const BOOL bUndo )
pDocShell->UpdatePaintExt( nExtFlags, aWorkRange );
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if ( !( (pViewShell) && pViewShell->AdjustBlockHeight() ) )
/*A*/ pDocShell->PostPaint( aWorkRange, PAINT_GRID | PAINT_EXTRAS, nExtFlags );

View file

@ -113,18 +113,13 @@ void __EXPORT ScUndoWidthOrHeight::Undo()
BeginUndo();
ScDocument* pDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCCOLROW nPaintStart = nStart > 0 ? nStart-1 : static_cast<SCCOLROW>(0);
if (eMode==SC_SIZE_OPTIMAL)
{
if (pViewShell)
{
pViewShell->SetMarkData( aMarkData );
if ( SetViewMarkData( aMarkData ) )
nPaintStart = 0; // paint all, because of changed selection
}
}
//! outlines from all tables?
@ -155,6 +150,7 @@ void __EXPORT ScUndoWidthOrHeight::Undo()
DoSdrUndoAction( pDrawUndo, pDoc );
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
pViewShell->UpdateScrollBars();
@ -171,19 +167,14 @@ void __EXPORT ScUndoWidthOrHeight::Redo()
{
BeginRedo();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
BOOL bPaintAll = FALSE;
if (eMode==SC_SIZE_OPTIMAL)
{
if (pViewShell)
{
pViewShell->SetMarkData( aMarkData );
if ( SetViewMarkData( aMarkData ) )
bPaintAll = TRUE; // paint all, because of changed selection
}
}
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
@ -192,7 +183,8 @@ void __EXPORT ScUndoWidthOrHeight::Redo()
}
// SetWidthOrHeight aendert aktuelle Tabelle !
pViewShell->SetWidthOrHeight( bWidth, nRangeCnt, pRanges, eMode, nNewSize, FALSE, TRUE, &aMarkData );
if ( pViewShell )
pViewShell->SetWidthOrHeight( bWidth, nRangeCnt, pRanges, eMode, nNewSize, FALSE, TRUE, &aMarkData );
// paint grid if selection was changed directly at the MarkData
if (bPaintAll)

View file

@ -147,10 +147,8 @@ void ScUndoDeleteContents::SetChangeTrack()
void ScUndoDeleteContents::DoChange( const BOOL bUndo )
{
ScDocument* pDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
pViewShell->SetMarkData( aMarkData );
SetViewMarkData( aMarkData );
USHORT nExtFlags = 0;
@ -195,6 +193,7 @@ void ScUndoDeleteContents::DoChange( const BOOL bUndo )
SetChangeTrack();
}
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if ( !( (pViewShell) && pViewShell->AdjustRowHeight(
aRange.aStart.Row(), aRange.aEnd.Row() ) ) )
/*A*/ pDocShell->PostPaint( aRange, PAINT_GRID | PAINT_EXTRAS, nExtFlags );
@ -341,10 +340,8 @@ void ScUndoFillTable::SetChangeTrack()
void ScUndoFillTable::DoChange( const BOOL bUndo )
{
ScDocument* pDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
pViewShell->SetMarkData( aMarkData );
SetViewMarkData( aMarkData );
if (bUndo) // nur Undo
{
@ -379,6 +376,7 @@ void ScUndoFillTable::DoChange( const BOOL bUndo )
// CellContentChanged kommt mit der Markierung
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
@ -485,10 +483,8 @@ String __EXPORT ScUndoSelectionAttr::GetComment() const
void ScUndoSelectionAttr::DoChange( const BOOL bUndo )
{
ScDocument* pDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
pViewShell->SetMarkData( aMarkData );
SetViewMarkData( aMarkData );
ScRange aEffRange( aRange );
if ( pDoc->HasAttrib( aEffRange, HASATTR_MERGED ) ) // zusammengefasste Zellen?
@ -515,6 +511,7 @@ void ScUndoSelectionAttr::DoChange( const BOOL bUndo )
pDoc->ApplySelectionFrame( aMarkData, pLineOuter, pLineInner );
}
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if ( !( (pViewShell) && pViewShell->AdjustBlockHeight() ) )
/*A*/ pDocShell->PostPaint( aEffRange, PAINT_GRID | PAINT_EXTRAS, nExtFlags );
@ -1165,8 +1162,7 @@ void __EXPORT ScUndoReplace::Undo()
DBG_ASSERT(pSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE_ALL,
"ScUndoReplace:: Falscher Modus");
if (pViewShell)
pViewShell->SetMarkData( aMarkData );
SetViewMarkData( aMarkData );
//! markierte Tabellen
//! Bereich merken ?
@ -1243,7 +1239,7 @@ void __EXPORT ScUndoReplace::Redo()
{
if (pViewShell)
{
pViewShell->SetMarkData( aMarkData );
SetViewMarkData( aMarkData );
pViewShell->SearchAndReplace( pSearchItem, FALSE, TRUE );
}
@ -1466,9 +1462,7 @@ void ScUndoConversion::DoChange( ScDocument* pRefDoc, const ScAddress& rCursorPo
ScDocument* pDoc = pDocShell->GetDocument();
ShowTable( rCursorPos.Tab() );
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
pViewShell->SetMarkData( aMarkData );
SetViewMarkData( aMarkData );
SCTAB nTabCount = pDoc->GetTableCount();
// Undo/Redo-doc has only selected tables
@ -1575,9 +1569,7 @@ void ScUndoRefConversion::DoChange( ScDocument* pRefDoc)
ShowTable(aRange);
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
pViewShell->SetMarkData( aMarkData );
SetViewMarkData( aMarkData );
ScRange aCopyRange = aRange;
SCTAB nTabCount = pDoc->GetTableCount();
@ -1586,6 +1578,7 @@ void ScUndoRefConversion::DoChange( ScDocument* pRefDoc)
pRefDoc->CopyToDocument( aCopyRange, nFlags, bMulti, pDoc, &aMarkData );
pDocShell->PostPaint( aRange, PAINT_GRID);
pDocShell->PostDataChanged();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
pViewShell->CellContentChanged();
}

View file

@ -901,9 +901,7 @@ void ScUndoMakeScenario::Undo()
void ScUndoMakeScenario::Redo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
pViewShell->SetMarkData( aMarkData );
SetViewMarkData( aMarkData );
RedoSdrUndoAction( pDrawUndo ); // Draw Redo first
@ -915,6 +913,7 @@ void ScUndoMakeScenario::Redo()
bDrawIsInUndo = FALSE;
pDocShell->SetInUndo( FALSE );
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
pViewShell->SetTabNo( nDestTab, TRUE );

View file

@ -43,10 +43,13 @@
#include "globstr.hrc"
#include "global.hxx"
void ScUndoUtil::MarkSimpleBlock( ScDocShell* /* pDocShell */,
void ScUndoUtil::MarkSimpleBlock( ScDocShell* pDocShell,
SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
SCCOL nEndX, SCROW nEndY, SCTAB nEndZ )
{
if ( pDocShell->IsPaintLocked() )
return;
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{