summaryrefslogtreecommitdiff
path: root/sc/source/ui/undo
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-06-18 12:14:29 +0200
committerNoel Grandin <noel@peralex.com>2014-06-24 11:34:21 +0200
commite2080e70fe8b085f18e868e46340454720fa94ca (patch)
tree4038d1d57b41b68a47d5ebbbe6ad390648ec6303 /sc/source/ui/undo
parentf910280b8704ed9c289150a4ca3c8d60e15d0d97 (diff)
new compilerplugin returnbyref
Find places where we are returning a pointer to something, where we can be returning a reference. e.g. class A { struct X x; public X* getX() { return &x; } } which can be: public X& getX() { return x; } Change-Id: I796fd23fd36a18aedf6e36bc28f8fab4f518c6c7
Diffstat (limited to 'sc/source/ui/undo')
-rw-r--r--sc/source/ui/undo/undobase.cxx92
-rw-r--r--sc/source/ui/undo/undoblk.cxx332
-rw-r--r--sc/source/ui/undo/undoblk2.cxx22
-rw-r--r--sc/source/ui/undo/undoblk3.cxx296
-rw-r--r--sc/source/ui/undo/undocell.cxx130
-rw-r--r--sc/source/ui/undo/undocell2.cxx4
-rw-r--r--sc/source/ui/undo/undodat.cxx366
-rw-r--r--sc/source/ui/undo/undorangename.cxx14
-rw-r--r--sc/source/ui/undo/undostyl.cxx20
-rw-r--r--sc/source/ui/undo/undotab.cxx266
-rw-r--r--sc/source/ui/undo/undoutil.cxx4
11 files changed, 772 insertions, 774 deletions
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index 6a2510b6c2cc..55d80ad42a7c 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -146,8 +146,8 @@ void ScSimpleUndo::EndRedo()
void ScSimpleUndo::BroadcastChanges( const ScRange& rRange )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->BroadcastCells(rRange, SC_HINT_DATACHANGED);
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.BroadcastCells(rRange, SC_HINT_DATACHANGED);
}
namespace {
@@ -181,14 +181,14 @@ public:
void ScSimpleUndo::BroadcastChanges( const DataSpansType& rSpans )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- SpanBroadcaster aBroadcaster(*pDoc);
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SpanBroadcaster aBroadcaster(rDoc);
DataSpansType::const_iterator it = rSpans.begin(), itEnd = rSpans.end();
for (; it != itEnd; ++it)
{
const sc::ColumnSpanSet& rSet = *it->second;
- rSet.executeColumnAction(*pDoc, aBroadcaster);
+ rSet.executeColumnAction(rDoc, aBroadcaster);
}
}
@@ -206,7 +206,7 @@ void ScSimpleUndo::ShowTable( const ScRange& rRange )
{
SCTAB nStart = rRange.aStart.Tab();
SCTAB nEnd = rRange.aEnd.Tab();
- SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nTab = pViewShell->GetViewData().GetTabNo();
if ( nTab < nStart || nTab > nEnd ) // if not in range:
pViewShell->SetTabNo( nStart ); // at beginning of the range
}
@@ -218,7 +218,7 @@ ScBlockUndo::ScBlockUndo( ScDocShell* pDocSh, const ScRange& rRange,
aBlockRange( rRange ),
eMode( eBlockMode )
{
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScBlockUndo::~ScBlockUndo()
@@ -229,7 +229,7 @@ ScBlockUndo::~ScBlockUndo()
void ScBlockUndo::BeginUndo()
{
ScSimpleUndo::BeginUndo();
- EnableDrawAdjust( pDocShell->GetDocument(), false );
+ EnableDrawAdjust( &pDocShell->GetDocument(), false );
}
void ScBlockUndo::EndUndo()
@@ -237,8 +237,8 @@ void ScBlockUndo::EndUndo()
if (eMode == SC_UNDO_AUTOHEIGHT)
AdjustHeight();
- EnableDrawAdjust( pDocShell->GetDocument(), true );
- DoSdrUndoAction( pDrawUndo, pDocShell->GetDocument() );
+ EnableDrawAdjust( &pDocShell->GetDocument(), true );
+ DoSdrUndoAction( pDrawUndo, &pDocShell->GetDocument() );
ShowBlock();
ScSimpleUndo::EndUndo();
@@ -255,7 +255,7 @@ void ScBlockUndo::EndRedo()
bool ScBlockUndo::AdjustHeight()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
VirtualDevice aVirtDev;
Fraction aZoomX( 1, 1 );
@@ -264,11 +264,11 @@ bool ScBlockUndo::AdjustHeight()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
- ScViewData* pData = pViewShell->GetViewData();
- nPPTX = pData->GetPPTX();
- nPPTY = pData->GetPPTY();
- aZoomX = pData->GetZoomX();
- aZoomY = pData->GetZoomY();
+ ScViewData& rData = pViewShell->GetViewData();
+ nPPTX = rData.GetPPTX();
+ nPPTY = rData.GetPPTY();
+ aZoomX = rData.GetZoomX();
+ aZoomY = rData.GetZoomY();
}
else
{
@@ -278,7 +278,7 @@ bool ScBlockUndo::AdjustHeight()
}
sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, &aVirtDev);
- bool bRet = pDoc->SetOptimalHeight(
+ bool bRet = rDoc.SetOptimalHeight(
aCxt, aBlockRange.aStart.Row(), aBlockRange.aEnd.Row(), aBlockRange.aStart.Tab());
if (bRet)
@@ -300,7 +300,7 @@ void ScBlockUndo::ShowBlock()
ShowTable( aBlockRange ); // with multiple sheets in range each of them is good
pViewShell->MoveCursorAbs( aBlockRange.aStart.Col(), aBlockRange.aStart.Row(),
SC_FOLLOW_JUMP, false, false );
- SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nTab = pViewShell->GetViewData().GetTabNo();
ScRange aRange = aBlockRange;
aRange.aStart.SetTab( nTab );
aRange.aEnd.SetTab( nTab );
@@ -316,7 +316,7 @@ ScMultiBlockUndo::ScMultiBlockUndo(
maBlockRanges(rRanges),
meMode(eBlockMode)
{
- mpDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ mpDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScMultiBlockUndo::~ScMultiBlockUndo()
@@ -327,7 +327,7 @@ ScMultiBlockUndo::~ScMultiBlockUndo()
void ScMultiBlockUndo::BeginUndo()
{
ScSimpleUndo::BeginUndo();
- EnableDrawAdjust(pDocShell->GetDocument(), false);
+ EnableDrawAdjust(&pDocShell->GetDocument(), false);
}
void ScMultiBlockUndo::EndUndo()
@@ -335,8 +335,8 @@ void ScMultiBlockUndo::EndUndo()
if (meMode == SC_UNDO_AUTOHEIGHT)
AdjustHeight();
- EnableDrawAdjust(pDocShell->GetDocument(), true);
- DoSdrUndoAction(mpDrawUndo, pDocShell->GetDocument());
+ EnableDrawAdjust(&pDocShell->GetDocument(), true);
+ DoSdrUndoAction(mpDrawUndo, &pDocShell->GetDocument());
ShowBlock();
ScSimpleUndo::EndUndo();
@@ -353,7 +353,7 @@ void ScMultiBlockUndo::EndRedo()
void ScMultiBlockUndo::AdjustHeight()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
VirtualDevice aVirtDev;
Fraction aZoomX( 1, 1 );
@@ -362,11 +362,11 @@ void ScMultiBlockUndo::AdjustHeight()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
- ScViewData* pData = pViewShell->GetViewData();
- nPPTX = pData->GetPPTX();
- nPPTY = pData->GetPPTY();
- aZoomX = pData->GetZoomX();
- aZoomY = pData->GetZoomY();
+ ScViewData& rData = pViewShell->GetViewData();
+ nPPTX = rData.GetPPTX();
+ nPPTY = rData.GetPPTY();
+ aZoomX = rData.GetZoomX();
+ aZoomY = rData.GetZoomY();
}
else
{
@@ -379,7 +379,7 @@ void ScMultiBlockUndo::AdjustHeight()
for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
{
const ScRange& r = *maBlockRanges[i];
- bool bRet = pDoc->SetOptimalHeight(aCxt, r.aStart.Row(), r.aEnd.Row(), r.aStart.Tab());
+ bool bRet = rDoc.SetOptimalHeight(aCxt, r.aStart.Row(), r.aEnd.Row(), r.aStart.Tab());
if (bRet)
pDocShell->PostPaint(
@@ -405,7 +405,7 @@ void ScMultiBlockUndo::ShowBlock()
ShowTable(aRange);
pViewShell->MoveCursorAbs(
aRange.aStart.Col(), aRange.aStart.Row(), SC_FOLLOW_JUMP, false, false);
- SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nTab = pViewShell->GetViewData().GetTabNo();
aRange.aStart.SetTab(nTab);
aRange.aEnd.SetTab(nTab);
pViewShell->MarkRange(aRange, false, false);
@@ -426,10 +426,10 @@ ScMoveUndo::ScMoveUndo( ScDocShell* pDocSh, ScDocument* pRefDoc, ScRefUndoData*
pRefUndoData( pRefData ),
eMode( eRefMode )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
if (pRefUndoData)
- pRefUndoData->DeleteUnchanged(pDoc);
- pDrawUndo = GetSdrUndoAction( pDoc );
+ pRefUndoData->DeleteUnchanged(&rDoc);
+ pDrawUndo = GetSdrUndoAction( &rDoc );
}
ScMoveUndo::~ScMoveUndo()
@@ -441,11 +441,11 @@ ScMoveUndo::~ScMoveUndo()
void ScMoveUndo::UndoRef()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScRange aRange(0,0,0, MAXCOL,MAXROW,pRefUndoDoc->GetTableCount()-1);
- pRefUndoDoc->CopyToDocument( aRange, IDF_FORMULA, false, pDoc, NULL, false );
+ pRefUndoDoc->CopyToDocument( aRange, IDF_FORMULA, false, &rDoc, NULL, false );
if (pRefUndoData)
- pRefUndoData->DoUndo( pDoc, (eMode == SC_UNDO_REFFIRST) );
+ pRefUndoData->DoUndo( &rDoc, (eMode == SC_UNDO_REFFIRST) );
// HACK: ScDragDropUndo is the only one with REFFIRST.
// If not, results possibly in a too frequent adjustment
// of ChartRefs. Not that pretty, but not too bad either..
@@ -455,7 +455,7 @@ void ScMoveUndo::BeginUndo()
{
ScSimpleUndo::BeginUndo();
- EnableDrawAdjust( pDocShell->GetDocument(), false );
+ EnableDrawAdjust( &pDocShell->GetDocument(), false );
if (pRefUndoDoc && eMode == SC_UNDO_REFFIRST)
UndoRef();
@@ -463,12 +463,12 @@ void ScMoveUndo::BeginUndo()
void ScMoveUndo::EndUndo()
{
- DoSdrUndoAction( pDrawUndo, pDocShell->GetDocument() ); // must also be called when pointer is null
+ DoSdrUndoAction( pDrawUndo, &pDocShell->GetDocument() ); // must also be called when pointer is null
if (pRefUndoDoc && eMode == SC_UNDO_REFLAST)
UndoRef();
- EnableDrawAdjust( pDocShell->GetDocument(), true );
+ EnableDrawAdjust( &pDocShell->GetDocument(), true );
ScSimpleUndo::EndUndo();
}
@@ -496,7 +496,7 @@ void ScDBFuncUndo::SetDrawUndoAction( SdrUndoAction* pDrawUndo )
void ScDBFuncUndo::BeginUndo()
{
ScSimpleUndo::BeginUndo();
- DoSdrUndoAction( mpDrawUndo, pDocShell->GetDocument() );
+ DoSdrUndoAction( mpDrawUndo, &pDocShell->GetDocument() );
}
void ScDBFuncUndo::EndUndo()
@@ -505,9 +505,9 @@ void ScDBFuncUndo::EndUndo()
if ( pAutoDBRange )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTab = pDoc->GetVisibleTab();
- ScDBData* pNoNameData = pDoc->GetAnonymousDBData(nTab);
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTab = rDoc.GetVisibleTab();
+ ScDBData* pNoNameData = rDoc.GetAnonymousDBData(nTab);
if (pNoNameData )
{
SCCOL nRangeX1;
@@ -524,7 +524,7 @@ void ScDBFuncUndo::EndUndo()
{
// restore AutoFilter buttons
pAutoDBRange->GetArea( nRangeTab, nRangeX1, nRangeY1, nRangeX2, nRangeY2 );
- pDoc->ApplyFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, SC_MF_AUTO );
+ rDoc.ApplyFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, SC_MF_AUTO );
pDocShell->PostPaint( nRangeX1, nRangeY1, nRangeTab, nRangeX2, nRangeY1, nRangeTab, PAINT_GRID );
}
}
@@ -538,8 +538,8 @@ void ScDBFuncUndo::BeginRedo()
{
// move the database range to this function's position again (see ScDocShell::GetDBData)
- ScDocument* pDoc = pDocShell->GetDocument();
- ScDBData* pNoNameData = pDoc->GetAnonymousDBData(aOriginalRange.aStart.Tab());
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScDBData* pNoNameData = rDoc.GetAnonymousDBData(aOriginalRange.aStart.Tab());
if ( pNoNameData )
{
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index aaa58ec792be..65e4875b97d7 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -149,7 +149,7 @@ bool ScUndoInsertCells::Merge( SfxUndoAction* pNextAction )
void ScUndoInsertCells::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
pChangeTrack->AppendInsert( aEffRange );
@@ -161,12 +161,12 @@ void ScUndoInsertCells::SetChangeTrack()
void ScUndoInsertCells::DoChange( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCTAB i;
if ( bUndo )
{
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
}
@@ -182,10 +182,10 @@ void ScUndoInsertCells::DoChange( const bool bUndo )
for( i=0; i<nCount; i++ )
{
if (bUndo)
- pDoc->DeleteRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
+ rDoc.DeleteRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
else
- pDoc->InsertRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
+ rDoc.InsertRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
}
break;
@@ -194,10 +194,10 @@ void ScUndoInsertCells::DoChange( const bool bUndo )
for( i=0; i<nCount; i++ )
{
if (bUndo)
- pDoc->DeleteCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
+ rDoc.DeleteCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1));
else
- pDoc->InsertCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
+ rDoc.InsertCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1));
}
break;
@@ -212,12 +212,12 @@ void ScUndoInsertCells::DoChange( const bool bUndo )
aWorkRange.aEnd.SetCol(MAXCOL);
for( i=0; i<nCount; i++ )
{
- if ( pDoc->HasAttrib( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
+ if ( rDoc.HasAttrib( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i], HASATTR_MERGED ) )
{
SCCOL nEndCol = aWorkRange.aEnd.Col();
SCROW nEndRow = aWorkRange.aEnd.Row();
- pDoc->ExtendMerge( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), nEndCol, nEndRow, pTabs[i], true );
+ rDoc.ExtendMerge( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), nEndCol, nEndRow, pTabs[i], true );
}
}
@@ -283,9 +283,9 @@ void ScUndoInsertCells::Undo()
DoChange( true );
EndUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for (SCTAB i = 0; i < nCount; ++i)
- pDoc->SetDrawPageSize(pTabs[i]);
+ rDoc.SetDrawPageSize(pTabs[i]);
}
void ScUndoInsertCells::Redo()
@@ -298,9 +298,9 @@ void ScUndoInsertCells::Redo()
if ( pPasteUndo )
pPasteUndo->Redo(); // redo paste last
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for (SCTAB i = 0; i < nCount; ++i)
- pDoc->SetDrawPageSize(pTabs[i]);
+ rDoc.SetDrawPageSize(pTabs[i]);
}
void ScUndoInsertCells::Repeat(SfxRepeatTarget& rTarget)
@@ -363,7 +363,7 @@ OUString ScUndoDeleteCells::GetComment() const
void ScUndoDeleteCells::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->AppendDeleteRange( aEffRange, pRefUndoDoc,
nStartChangeAction, nEndChangeAction );
@@ -373,12 +373,12 @@ void ScUndoDeleteCells::SetChangeTrack()
void ScUndoDeleteCells::DoChange( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCTAB i;
if ( bUndo )
{
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
}
@@ -392,10 +392,10 @@ void ScUndoDeleteCells::DoChange( const bool bUndo )
for( i=0; i<nCount; i++ )
{
if (bUndo)
- pDoc->InsertRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
+ rDoc.InsertRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
else
- pDoc->DeleteRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
+ rDoc.DeleteRow( aEffRange.aStart.Col(), pTabs[i], aEffRange.aEnd.Col(), pTabs[i]+pScenarios[i],
aEffRange.aStart.Row(), static_cast<SCSIZE>(aEffRange.aEnd.Row()-aEffRange.aStart.Row()+1));
}
break;
@@ -404,10 +404,10 @@ void ScUndoDeleteCells::DoChange( const bool bUndo )
for( i=0; i<nCount; i++ )
{
if (bUndo)
- pDoc->InsertCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
+ rDoc.InsertCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1));
else
- pDoc->DeleteCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
+ rDoc.DeleteCol( aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
aEffRange.aStart.Col(), static_cast<SCSIZE>(aEffRange.aEnd.Col()-aEffRange.aStart.Col()+1));
}
break;
@@ -421,7 +421,7 @@ void ScUndoDeleteCells::DoChange( const bool bUndo )
for( i=0; i<nCount && bUndo; i++ )
{
pRefUndoDoc->CopyToDocument( aEffRange.aStart.Col(), aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Col(), aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
- IDF_ALL | IDF_NOCAPTIONS, false, pDoc );
+ IDF_ALL | IDF_NOCAPTIONS, false, &rDoc );
}
ScRange aWorkRange( aEffRange );
@@ -430,7 +430,7 @@ void ScUndoDeleteCells::DoChange( const bool bUndo )
for( i=0; i<nCount; i++ )
{
- if ( pDoc->HasAttrib( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
+ if ( rDoc.HasAttrib( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i],
aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i], HASATTR_MERGED | HASATTR_OVERLAPPED ) )
{
// #i51445# old merge flag attributes must be deleted also for single cells,
@@ -444,16 +444,16 @@ void ScUndoDeleteCells::DoChange( const bool bUndo )
aWorkRange.aEnd.SetRow(MAXROW);
ScMarkData aMarkData;
aMarkData.SelectOneTable( aWorkRange.aStart.Tab() );
- ScPatternAttr aPattern( pDoc->GetPool() );
+ ScPatternAttr aPattern( rDoc.GetPool() );
aPattern.GetItemSet().Put( ScMergeFlagAttr() );
- pDoc->ApplyPatternArea( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(),
+ rDoc.ApplyPatternArea( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(),
aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(),
aMarkData, aPattern );
}
SCCOL nEndCol = aWorkRange.aEnd.Col();
SCROW nEndRow = aWorkRange.aEnd.Row();
- pDoc->ExtendMerge( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), nEndCol, nEndRow, pTabs[i], true );
+ rDoc.ExtendMerge( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), nEndCol, nEndRow, pTabs[i], true );
}
}
@@ -526,9 +526,9 @@ void ScUndoDeleteCells::Undo()
}
}
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for (SCTAB i = 0; i < nCount; ++i)
- pDoc->SetDrawPageSize(pTabs[i]);
+ rDoc.SetDrawPageSize(pTabs[i]);
}
void ScUndoDeleteCells::Redo()
@@ -543,9 +543,9 @@ void ScUndoDeleteCells::Redo()
if (pViewShell)
pViewShell->DoneBlockMode(); // current way
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for (SCTAB i = 0; i < nCount; ++i)
- pDoc->SetDrawPageSize(pTabs[i]);
+ rDoc.SetDrawPageSize(pTabs[i]);
}
void ScUndoDeleteCells::Repeat(SfxRepeatTarget& rTarget)
@@ -603,11 +603,11 @@ void ScUndoDeleteMulti::DoChange() const
if (mbRefresh)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCCOL nEndCol = MAXCOL;
SCROW nEndRow = MAXROW;
- pDoc->RemoveFlagsTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, SC_MF_HOR | SC_MF_VER );
- pDoc->ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, nTab, true );
+ rDoc.RemoveFlagsTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, SC_MF_HOR | SC_MF_VER );
+ rDoc.ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, nTab, true );
}
pDocShell->PostPaint( nStartCol, nStartRow, nTab, MAXCOL, MAXROW, nTab, nPaint );
@@ -621,7 +621,7 @@ void ScUndoDeleteMulti::DoChange() const
void ScUndoDeleteMulti::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
nStartChangeAction = pChangeTrack->GetActionMax() + 1;
@@ -660,7 +660,7 @@ void ScUndoDeleteMulti::Undo()
WaitObject aWait( pDocShell->GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
// reverse delete -> forward insert
std::vector<sc::ColRowSpan>::const_iterator it = maSpans.begin(), itEnd = maSpans.end();
@@ -669,9 +669,9 @@ void ScUndoDeleteMulti::Undo()
SCCOLROW nStart = it->mnStart;
SCCOLROW nEnd = it->mnEnd;
if (mbRows)
- pDoc->InsertRow( 0,nTab, MAXCOL,nTab, nStart,static_cast<SCSIZE>(nEnd-nStart+1) );
+ rDoc.InsertRow( 0,nTab, MAXCOL,nTab, nStart,static_cast<SCSIZE>(nEnd-nStart+1) );
else
- pDoc->InsertCol( 0,nTab, MAXROW,nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) );
+ rDoc.InsertCol( 0,nTab, MAXROW,nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) );
}
it = maSpans.begin();
@@ -680,13 +680,13 @@ void ScUndoDeleteMulti::Undo()
SCCOLROW nStart = it->mnStart;
SCCOLROW nEnd = it->mnEnd;
if (mbRows)
- pRefUndoDoc->CopyToDocument( 0,nStart,nTab, MAXCOL,nEnd,nTab, IDF_ALL,false,pDoc );
+ pRefUndoDoc->CopyToDocument( 0,nStart,nTab, MAXCOL,nEnd,nTab, IDF_ALL,false, &rDoc );
else
pRefUndoDoc->CopyToDocument( static_cast<SCCOL>(nStart),0,nTab,
- static_cast<SCCOL>(nEnd),MAXROW,nTab, IDF_ALL,false,pDoc );
+ static_cast<SCCOL>(nEnd),MAXROW,nTab, IDF_ALL,false, &rDoc );
}
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -704,7 +704,7 @@ void ScUndoDeleteMulti::Redo()
WaitObject aWait( pDocShell->GetActiveDialogParent() ); // important because of TrackFormulas in UpdateReference
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
// reverse delete
std::vector<sc::ColRowSpan>::const_reverse_iterator ri = maSpans.rbegin(), riEnd = maSpans.rend();
@@ -713,9 +713,9 @@ void ScUndoDeleteMulti::Redo()
SCCOLROW nEnd = ri->mnEnd;
SCCOLROW nStart = ri->mnStart;
if (mbRows)
- pDoc->DeleteRow( 0,nTab, MAXCOL,nTab, nStart,static_cast<SCSIZE>(nEnd-nStart+1) );
+ rDoc.DeleteRow( 0,nTab, MAXCOL,nTab, nStart,static_cast<SCSIZE>(nEnd-nStart+1) );
else
- pDoc->DeleteCol( 0,nTab, MAXROW,nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) );
+ rDoc.DeleteCol( 0,nTab, MAXROW,nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) );
}
SetChangeTrack();
@@ -762,7 +762,7 @@ OUString ScUndoCut::GetComment() const
void ScUndoCut::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc,
nStartChangeAction, nEndChangeAction, SC_CACM_CUT );
@@ -772,7 +772,7 @@ void ScUndoCut::SetChangeTrack()
void ScUndoCut::DoChange( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
sal_uInt16 nExtFlags = 0;
// do not undo/redo objects and note captions, they are handled via drawing undo
@@ -781,12 +781,12 @@ void ScUndoCut::DoChange( const bool bUndo )
if (bUndo) // only for Undo
{
// all sheets - CopyToDocument skips those that don't exist in pUndoDoc
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScRange aCopyRange = aExtendedRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pUndoDoc->CopyToDocument( aCopyRange, nUndoFlags, false, pDoc );
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ pUndoDoc->CopyToDocument( aCopyRange, nUndoFlags, false, &rDoc );
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -795,7 +795,7 @@ void ScUndoCut::DoChange( const bool bUndo )
else // only for Redo
{
pDocShell->UpdatePaintExt( nExtFlags, aExtendedRange );
- pDoc->DeleteArea( aBlockRange.aStart.Col(), aBlockRange.aStart.Row(),
+ rDoc.DeleteArea( aBlockRange.aStart.Col(), aBlockRange.aStart.Row(),
aBlockRange.aEnd.Col(), aBlockRange.aEnd.Row(), aMarkData, nUndoFlags );
SetChangeTrack();
}
@@ -822,10 +822,10 @@ void ScUndoCut::Undo()
void ScUndoCut::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
- EnableDrawAdjust( pDoc, false ); //! include in ScBlockUndo?
+ ScDocument& rDoc = pDocShell->GetDocument();
+ EnableDrawAdjust( &rDoc, false ); //! include in ScBlockUndo?
DoChange( false );
- EnableDrawAdjust( pDoc, true ); //! include in ScBlockUndo?
+ EnableDrawAdjust( &rDoc, true ); //! include in ScBlockUndo?
EndRedo();
}
@@ -856,7 +856,7 @@ ScUndoPaste::ScUndoPaste( ScDocShell* pNewDocShell, const ScRangeList& rRanges,
bRedoFilled( bRedoIsFilled )
{
if ( pRefUndoData )
- pRefUndoData->DeleteUnchanged( pDocShell->GetDocument() );
+ pRefUndoData->DeleteUnchanged( &pDocShell->GetDocument() );
if ( pOptions )
aPasteOptions = *pOptions; // used only for Repeat
@@ -879,7 +879,7 @@ OUString ScUndoPaste::GetComment() const
void ScUndoPaste::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack && (nFlags & IDF_CONTENTS) )
{
for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
@@ -894,13 +894,13 @@ void ScUndoPaste::SetChangeTrack()
void ScUndoPaste::DoChange(bool bUndo)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
// RefUndoData for redo is created before first undo
// (with DeleteUnchanged after the DoUndo call)
bool bCreateRedoData = ( bUndo && pRefUndoData && !pRefRedoData );
if ( bCreateRedoData )
- pRefRedoData = new ScRefUndoData( pDoc );
+ pRefRedoData = new ScRefUndoData( &rDoc );
ScRefUndoData* pWorkRefData = bUndo ? pRefUndoData : pRefRedoData;
@@ -918,7 +918,7 @@ void ScUndoPaste::DoChange(bool bUndo)
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
if ( bUndo && !bRedoFilled )
{
if (!pRedoDoc)
@@ -935,7 +935,7 @@ void ScUndoPaste::DoChange(bool bUndo)
}
pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRedoDoc->InitUndoSelected( pDoc, aMarkData, bColInfo, bRowInfo );
+ pRedoDoc->InitUndoSelected( &rDoc, aMarkData, bColInfo, bRowInfo );
}
// read "redo" data from the document in the first undo
// all sheets - CopyToDocument skips those that don't exist in pRedoDoc
@@ -944,7 +944,7 @@ void ScUndoPaste::DoChange(bool bUndo)
ScRange aCopyRange = *maBlockRanges[i];
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, nUndoFlags, false, pRedoDoc );
+ rDoc.CopyToDocument( aCopyRange, nUndoFlags, false, pRedoDoc );
bRedoFilled = true;
}
}
@@ -952,11 +952,11 @@ void ScUndoPaste::DoChange(bool bUndo)
sal_uInt16 nExtFlags = 0;
pDocShell->UpdatePaintExt(nExtFlags, maBlockRanges.Combine());
- pDoc->ForgetNoteCaptions(maBlockRanges);
+ rDoc.ForgetNoteCaptions(maBlockRanges);
aMarkData.MarkToMulti();
- pDoc->DeleteSelection(nUndoFlags, aMarkData, false); // no broadcasting here
+ rDoc.DeleteSelection(nUndoFlags, aMarkData, false); // no broadcasting here
for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
- pDoc->BroadcastCells(*maBlockRanges[i], SC_HINT_DATACHANGED);
+ rDoc.BroadcastCells(*maBlockRanges[i], SC_HINT_DATACHANGED);
aMarkData.MarkToSimple();
@@ -969,7 +969,7 @@ void ScUndoPaste::DoChange(bool bUndo)
ScRange aRange = *maBlockRanges[i];
aRange.aStart.SetTab(nFirstSelected);
aRange.aEnd.SetTab(nFirstSelected);
- pRedoDoc->UndoToDocument(aRange, nUndoFlags, false, pDoc);
+ pRedoDoc->UndoToDocument(aRange, nUndoFlags, false, &rDoc);
ScMarkData::iterator itr = aMarkData.begin(), itrEnd = aMarkData.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
@@ -978,21 +978,21 @@ void ScUndoPaste::DoChange(bool bUndo)
aRange.aStart.SetTab(*itr);
aRange.aEnd.SetTab(*itr);
- pRedoDoc->CopyToDocument( aRange, nUndoFlags, false, pDoc );
+ pRedoDoc->CopyToDocument( aRange, nUndoFlags, false, &rDoc );
}
}
}
if (pWorkRefData)
{
- pWorkRefData->DoUndo( pDoc, true ); // true = bSetChartRangeLists for SetChartListenerCollection
+ pWorkRefData->DoUndo( &rDoc, true ); // true = bSetChartRangeLists for SetChartListenerCollection
if (!maBlockRanges.empty() &&
- pDoc->RefreshAutoFilter(0, 0, MAXCOL, MAXROW, maBlockRanges[0]->aStart.Tab()))
+ rDoc.RefreshAutoFilter(0, 0, MAXCOL, MAXROW, maBlockRanges[0]->aStart.Tab()))
bPaintAll = true;
}
if ( bCreateRedoData && pRefRedoData )
- pRefRedoData->DeleteUnchanged( pDoc );
+ pRefRedoData->DeleteUnchanged( &rDoc );
if (bUndo) // Undo: UndoToDocument after handling RefData
{
@@ -1004,14 +1004,14 @@ void ScUndoPaste::DoChange(bool bUndo)
{
aRange.aStart.SetTab(*itr);
aRange.aEnd.SetTab(*itr);
- pUndoDoc->UndoToDocument(aRange, nUndoFlags, false, pDoc);
+ pUndoDoc->UndoToDocument(aRange, nUndoFlags, false, &rDoc);
}
}
}
if ( bUndo )
{
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
}
@@ -1023,7 +1023,7 @@ void ScUndoPaste::DoChange(bool bUndo)
for (size_t i = 0, n = aDrawRanges.size(); i < n; ++i)
{
ScRange& rDrawRange = *aDrawRanges[i];
- pDoc->ExtendMerge(rDrawRange, true); // only needed for single sheet (text/rtf etc.)
+ rDoc.ExtendMerge(rDrawRange, true); // only needed for single sheet (text/rtf etc.)
if (bPaintAll)
{
rDrawRange.aStart.SetCol(0);
@@ -1081,10 +1081,10 @@ void ScUndoPaste::Undo()
void ScUndoPaste::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
- EnableDrawAdjust( pDoc, false ); //! include in ScBlockUndo?
+ ScDocument& rDoc = pDocShell->GetDocument();
+ EnableDrawAdjust( &rDoc, false ); //! include in ScBlockUndo?
DoChange( false );
- EnableDrawAdjust( pDoc, true ); //! include in ScBlockUndo?
+ EnableDrawAdjust( &rDoc, true ); //! include in ScBlockUndo?
EndRedo();
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
}
@@ -1130,7 +1130,7 @@ ScUndoDragDrop::ScUndoDragDrop( ScDocShell* pNewDocShell,
if ( !bIncludeFiltered )
{
// find number of non-filtered rows
- SCROW nPastedCount = pDocShell->GetDocument()->CountNonFilteredRows(
+ SCROW nPastedCount = pDocShell->GetDocument().CountNonFilteredRows(
aSrcRange.aStart.Row(), aSrcRange.aEnd.Row(), aSrcRange.aStart.Tab());
if ( nPastedCount == 0 )
@@ -1157,7 +1157,7 @@ OUString ScUndoDragDrop::GetComment() const
void ScUndoDragDrop::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
if ( bCut )
@@ -1178,17 +1178,17 @@ void ScUndoDragDrop::PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const
{
sal_uInt16 nPaint = PAINT_GRID;
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
if (pViewShell)
{
VirtualDevice aVirtDev;
- ScViewData* pViewData = pViewShell->GetViewData();
+ ScViewData& rViewData = pViewShell->GetViewData();
sc::RowHeightContext aCxt(
- pViewData->GetPPTX(), pViewData->GetPPTY(), pViewData->GetZoomX(), pViewData->GetZoomY(),
+ rViewData.GetPPTX(), rViewData.GetPPTY(), rViewData.GetZoomX(), rViewData.GetZoomY(),
&aVirtDev);
- if (pDoc->SetOptimalHeight(aCxt, aRange.aStart.Row(), aRange.aEnd.Row(), aRange.aStart.Tab()))
+ if (rDoc.SetOptimalHeight(aCxt, aRange.aStart.Row(), aRange.aEnd.Row(), aRange.aStart.Tab()))
{
aRange.aStart.SetCol(0);
aRange.aEnd.SetCol(MAXCOL);
@@ -1223,26 +1223,26 @@ void ScUndoDragDrop::PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const
void ScUndoDragDrop::DoUndo( ScRange aRange )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
// Database range before data, so that the Autofilter button match up in ExtendMerge
ScRange aPaintRange = aRange;
- pDoc->ExtendMerge( aPaintRange ); // before deleting
+ rDoc.ExtendMerge( aPaintRange ); // before deleting
pDocShell->UpdatePaintExt(mnPaintExtFlags, aPaintRange);
// do not undo objects and note captions, they are handled via drawing undo
sal_uInt16 nUndoFlags = (IDF_ALL & ~IDF_OBJECTS) | IDF_NOCAPTIONS;
- pDoc->DeleteAreaTab( aRange, nUndoFlags );
- pRefUndoDoc->CopyToDocument( aRange, nUndoFlags, false, pDoc );
- if ( pDoc->HasAttrib( aRange, HASATTR_MERGED ) )
- pDoc->ExtendMerge( aRange, true );
+ rDoc.DeleteAreaTab( aRange, nUndoFlags );
+ pRefUndoDoc->CopyToDocument( aRange, nUndoFlags, false, &rDoc );
+ if ( rDoc.HasAttrib( aRange, HASATTR_MERGED ) )
+ rDoc.ExtendMerge( aRange, true );
aPaintRange.aEnd.SetCol( std::max( aPaintRange.aEnd.Col(), aRange.aEnd.Col() ) );
aPaintRange.aEnd.SetRow( std::max( aPaintRange.aEnd.Row(), aRange.aEnd.Row() ) );
@@ -1261,18 +1261,18 @@ void ScUndoDragDrop::Undo()
if (bCut)
{
// Notify all listeners of the destination range, and have them update their references.
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCCOL nColDelta = aSrcRange.aStart.Col() - aDestRange.aStart.Col();
SCROW nRowDelta = aSrcRange.aStart.Row() - aDestRange.aStart.Row();
SCTAB nTabDelta = aSrcRange.aStart.Tab() - aDestRange.aStart.Tab();
sc::RefMovedHint aHint(aDestRange, ScAddress(nColDelta, nRowDelta, nTabDelta));
- pDoc->BroadcastRefMoved(aHint);
+ rDoc.BroadcastRefMoved(aHint);
- ScValidationDataList* pValidList = pDoc->GetValidationList();
+ ScValidationDataList* pValidList = rDoc.GetValidationList();
if (pValidList)
{
// Update the references of validation entries.
- sc::RefUpdateContext aCxt(*pDoc);
+ sc::RefUpdateContext aCxt(rDoc);
aCxt.meMode = URM_MOVE;
aCxt.maRange = aSrcRange;
aCxt.mnColDelta = nColDelta;
@@ -1300,10 +1300,10 @@ void ScUndoDragDrop::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
boost::scoped_ptr<ScDocument> pClipDoc(new ScDocument( SCDOCMODE_CLIP ));
- EnableDrawAdjust( pDoc, false ); //! include in ScBlockUndo?
+ EnableDrawAdjust( &rDoc, false ); //! include in ScBlockUndo?
// do not undo/redo objects and note captions, they are handled via drawing undo
sal_uInt16 nRedoFlags = (IDF_ALL & ~IDF_OBJECTS) | IDF_NOCAPTIONS;
@@ -1329,15 +1329,15 @@ void ScUndoDragDrop::Redo()
// do not clone objects and note captions into clipdoc (see above)
// but at least copy notes
ScClipParam aClipParam(aSrcRange, bCut);
- pDoc->CopyToClip(aClipParam, pClipDoc.get(), &aSourceMark, false, bKeepScenarioFlags, false, true);
+ rDoc.CopyToClip(aClipParam, pClipDoc.get(), &aSourceMark, false, bKeepScenarioFlags, false, true);
if (bCut)
{
ScRange aSrcPaintRange = aSrcRange;
- pDoc->ExtendMerge( aSrcPaintRange ); // before deleting
+ rDoc.ExtendMerge( aSrcPaintRange ); // before deleting
sal_uInt16 nExtFlags = 0;
pDocShell->UpdatePaintExt( nExtFlags, aSrcPaintRange );
- pDoc->DeleteAreaTab( aSrcRange, nRedoFlags );
+ rDoc.DeleteAreaTab( aSrcRange, nRedoFlags );
PaintArea( aSrcPaintRange, nExtFlags );
}
@@ -1347,11 +1347,11 @@ void ScUndoDragDrop::Redo()
bool bIncludeFiltered = bCut;
// TODO: restore old note captions instead of cloning new captions...
- pDoc->CopyFromClip( aDestRange, aDestMark, IDF_ALL & ~IDF_OBJECTS, NULL, pClipDoc.get(), true, false, bIncludeFiltered );
+ rDoc.CopyFromClip( aDestRange, aDestMark, IDF_ALL & ~IDF_OBJECTS, NULL, pClipDoc.get(), true, false, bIncludeFiltered );
if (bCut)
for (nTab=aSrcRange.aStart.Tab(); nTab<=aSrcRange.aEnd.Tab(); nTab++)
- pDoc->RefreshAutoFilter( aSrcRange.aStart.Col(), aSrcRange.aStart.Row(),
+ rDoc.RefreshAutoFilter( aSrcRange.aStart.Col(), aSrcRange.aStart.Row(),
aSrcRange.aEnd.Col(), aSrcRange.aEnd.Row(), nTab );
// skipped rows and merged cells don't mix
@@ -1362,7 +1362,7 @@ void ScUndoDragDrop::Redo()
{
SCCOL nEndCol = aDestRange.aEnd.Col();
SCROW nEndRow = aDestRange.aEnd.Row();
- pDoc->ExtendMerge( aDestRange.aStart.Col(), aDestRange.aStart.Row(),
+ rDoc.ExtendMerge( aDestRange.aStart.Col(), aDestRange.aStart.Row(),
nEndCol, nEndRow, nTab, true );
PaintArea( ScRange( aDestRange.aStart.Col(), aDestRange.aStart.Row(), nTab,
nEndCol, nEndRow, nTab ), 0 );
@@ -1374,7 +1374,7 @@ void ScUndoDragDrop::Redo()
ShowTable( aDestRange.aStart.Tab() );
RedoSdrUndoAction( pDrawUndo ); //! include in ScBlockUndo?
- EnableDrawAdjust( pDoc, true ); //! include in ScBlockUndo?
+ EnableDrawAdjust( &rDoc, true ); //! include in ScBlockUndo?
EndRedo();
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
@@ -1412,10 +1412,10 @@ OUString ScUndoListNames::GetComment() const
void ScUndoListNames::DoChange( ScDocument* pSrcDoc ) const
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- pDoc->DeleteAreaTab( aBlockRange, IDF_ALL );
- pSrcDoc->CopyToDocument( aBlockRange, IDF_ALL, false, pDoc );
+ rDoc.DeleteAreaTab( aBlockRange, IDF_ALL );
+ pSrcDoc->CopyToDocument( aBlockRange, IDF_ALL, false, &rDoc );
pDocShell->PostPaint( aBlockRange, PAINT_GRID );
pDocShell->PostDataChanged();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -1478,10 +1478,10 @@ void ScUndoConditionalFormat::Redo()
void ScUndoConditionalFormat::DoChange(ScDocument* pSrcDoc)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- pDoc->DeleteAreaTab( maRange, IDF_ALL );
- pSrcDoc->CopyToDocument( maRange, IDF_ALL, false, pDoc );
+ rDoc.DeleteAreaTab( maRange, IDF_ALL );
+ pSrcDoc->CopyToDocument( maRange, IDF_ALL, false, &rDoc );
pDocShell->PostPaint( maRange, PAINT_GRID );
pDocShell->PostDataChanged();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -1538,9 +1538,9 @@ void ScUndoUseScenario::Undo()
pViewShell->InitOwnBlockMode();
}
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->DeleteSelection( IDF_ALL, aMarkData );
- pUndoDoc->CopyToDocument( aRange, IDF_ALL, true, pDoc, &aMarkData );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.DeleteSelection( IDF_ALL, aMarkData );
+ pUndoDoc->CopyToDocument( aRange, IDF_ALL, true, &rDoc, &aMarkData );
// scenario table
bool bFrame = false;
@@ -1555,14 +1555,14 @@ void ScUndoUseScenario::Undo()
Color aColor;
sal_uInt16 nScenFlags;
pUndoDoc->GetScenarioData( i, aComment, aColor, nScenFlags );
- pDoc->SetScenarioData( i, aComment, aColor, nScenFlags );
+ rDoc.SetScenarioData( i, aComment, aColor, nScenFlags );
bool bActive = pUndoDoc->IsActiveScenario( i );
- pDoc->SetActiveScenario( i, bActive );
+ rDoc.SetActiveScenario( i, bActive );
// For copy-back scenario also consider content
if ( nScenFlags & SC_SCENARIO_TWOWAY )
{
- pDoc->DeleteAreaTab( 0,0, MAXCOL,MAXROW, i, IDF_ALL );
- pUndoDoc->CopyToDocument( 0,0,i, MAXCOL,MAXROW,i, IDF_ALL,false, pDoc );
+ rDoc.DeleteAreaTab( 0,0, MAXCOL,MAXROW, i, IDF_ALL );
+ pUndoDoc->CopyToDocument( 0,0,i, MAXCOL,MAXROW,i, IDF_ALL,false, &rDoc );
}
if ( nScenFlags & SC_SCENARIO_SHOWFRAME )
bFrame = true;
@@ -1613,8 +1613,8 @@ bool ScUndoUseScenario::CanRepeat(SfxRepeatTarget& rTarget) const
{
if (rTarget.ISA(ScTabViewTarget))
{
- ScViewData* pViewData = ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData();
- return !pViewData->GetDocument()->IsScenario( pViewData->GetTabNo() );
+ ScViewData& rViewData = ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData();
+ return !rViewData.GetDocument()->IsScenario( rViewData.GetTabNo() );
}
return false;
}
@@ -1645,28 +1645,28 @@ OUString ScUndoSelectionStyle::GetComment() const
void ScUndoSelectionStyle::DoChange( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SetViewMarkData( aMarkData );
ScRange aWorkRange( aRange );
- if ( pDoc->HasAttrib( aWorkRange, HASATTR_MERGED ) ) // Merged cells?
- pDoc->ExtendMerge( aWorkRange, true );
+ if ( rDoc.HasAttrib( aWorkRange, HASATTR_MERGED ) ) // Merged cells?
+ rDoc.ExtendMerge( aWorkRange, true );
sal_uInt16 nExtFlags = 0;
pDocShell->UpdatePaintExt( nExtFlags, aWorkRange );
if (bUndo) // if Undo then push back all old data again
{
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScRange aCopyRange = aWorkRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, true, pDoc, &aMarkData );
+ pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, true, &rDoc, &aMarkData );
}
else // if Redo, then reapply style
{
- ScStyleSheetPool* pStlPool = pDoc->GetStyleSheetPool();
+ ScStyleSheetPool* pStlPool = rDoc.GetStyleSheetPool();
ScStyleSheet* pStyleSheet =
(ScStyleSheet*) pStlPool->Find( aStyleName, SFX_STYLE_FAMILY_PARA );
if (!pStyleSheet)
@@ -1674,7 +1674,7 @@ void ScUndoSelectionStyle::DoChange( const bool bUndo )
OSL_FAIL("StyleSheet not found");
return;
}
- pDoc->ApplySelectionStyle( *pStyleSheet, aMarkData );
+ rDoc.ApplySelectionStyle( *pStyleSheet, aMarkData );
}
pDocShell->UpdatePaintExt( nExtFlags, aWorkRange );
@@ -1704,8 +1704,8 @@ void ScUndoSelectionStyle::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScStyleSheetPool* pStlPool = pDoc->GetStyleSheetPool();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScStyleSheetPool* pStlPool = rDoc.GetStyleSheetPool();
ScStyleSheet* pStyleSheet = (ScStyleSheet*) pStlPool->
Find( aStyleName, SFX_STYLE_FAMILY_PARA );
if (!pStyleSheet)
@@ -1750,8 +1750,8 @@ OUString ScUndoEnterMatrix::GetComment() const
void ScUndoEnterMatrix::SetChangeTrack()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc,
nStartChangeAction, nEndChangeAction );
@@ -1763,17 +1763,17 @@ void ScUndoEnterMatrix::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- pDoc->DeleteAreaTab( aBlockRange, IDF_ALL & ~IDF_NOTE );
- pUndoDoc->CopyToDocument( aBlockRange, IDF_ALL & ~IDF_NOTE, false, pDoc );
+ rDoc.DeleteAreaTab( aBlockRange, IDF_ALL & ~IDF_NOTE );
+ pUndoDoc->CopyToDocument( aBlockRange, IDF_ALL & ~IDF_NOTE, false, &rDoc );
pDocShell->PostPaint( aBlockRange, PAINT_GRID );
pDocShell->PostDataChanged();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
pViewShell->CellContentChanged();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -1784,13 +1784,13 @@ void ScUndoEnterMatrix::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScMarkData aDestMark;
aDestMark.SelectOneTable( aBlockRange.aStart.Tab() );
aDestMark.SetMarkArea( aBlockRange );
- pDoc->InsertMatrixFormula( aBlockRange.aStart.Col(), aBlockRange.aStart.Row(),
+ rDoc.InsertMatrixFormula( aBlockRange.aStart.Col(), aBlockRange.aStart.Row(),
aBlockRange.aEnd.Col(), aBlockRange.aEnd.Row(),
aDestMark, aFormula );
@@ -1804,8 +1804,8 @@ void ScUndoEnterMatrix::Repeat(SfxRepeatTarget& rTarget)
if (rTarget.ISA(ScTabViewTarget))
{
OUString aTemp = aFormula;
- ScDocument* pDoc = pDocShell->GetDocument();
- ((ScTabViewTarget&)rTarget).GetViewShell()->EnterMatrix(aTemp, pDoc->GetGrammar());
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ((ScTabViewTarget&)rTarget).GetViewShell()->EnterMatrix(aTemp, rDoc.GetGrammar());
}
}
@@ -1847,12 +1847,12 @@ void ScUndoIndent::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScRange aCopyRange = aBlockRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, true, pDoc, &aMarkData );
+ pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, true, &rDoc, &aMarkData );
pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
EndUndo();
@@ -1862,8 +1862,8 @@ void ScUndoIndent::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->ChangeSelectionIndent( bIsIncrement, aMarkData );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.ChangeSelectionIndent( bIsIncrement, aMarkData );
pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
EndRedo();
@@ -1903,12 +1903,12 @@ void ScUndoTransliterate::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScRange aCopyRange = aBlockRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pUndoDoc->CopyToDocument( aCopyRange, IDF_CONTENTS, true, pDoc, &aMarkData );
+ pUndoDoc->CopyToDocument( aCopyRange, IDF_CONTENTS, true, &rDoc, &aMarkData );
pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
EndUndo();
@@ -1918,8 +1918,8 @@ void ScUndoTransliterate::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->TransliterateText( aMarkData, nTransliterationType );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.TransliterateText( aMarkData, nTransliterationType );
pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
EndRedo();
@@ -1968,8 +1968,8 @@ void ScUndoClearItems::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
- pUndoDoc->CopyToDocument( aBlockRange, IDF_ATTRIB, true, pDoc, &aMarkData );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ pUndoDoc->CopyToDocument( aBlockRange, IDF_ATTRIB, true, &rDoc, &aMarkData );
pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
EndUndo();
@@ -1979,8 +1979,8 @@ void ScUndoClearItems::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->ClearSelectionItems( pWhich, aMarkData );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.ClearSelectionItems( pWhich, aMarkData );
pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
EndRedo();
@@ -1990,8 +1990,8 @@ void ScUndoClearItems::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
{
- ScViewData* pViewData = ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData();
- pViewData->GetDocFunc().ClearItems( pViewData->GetMarkData(), pWhich, false );
+ ScViewData& rViewData = ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData();
+ rViewData.GetDocFunc().ClearItems( rViewData.GetMarkData(), pWhich, false );
}
}
@@ -2023,10 +2023,10 @@ void ScUndoRemoveBreaks::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- pUndoDoc->CopyToDocument( 0,0,nTab, MAXCOL,MAXROW,nTab, IDF_NONE, false, pDoc );
+ pUndoDoc->CopyToDocument( 0,0,nTab, MAXCOL,MAXROW,nTab, IDF_NONE, false, &rDoc );
if (pViewShell)
pViewShell->UpdatePageBreakData( true );
pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID );
@@ -2038,11 +2038,11 @@ void ScUndoRemoveBreaks::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- pDoc->RemoveManualBreaks(nTab);
- pDoc->UpdatePageBreaks(nTab);
+ rDoc.RemoveManualBreaks(nTab);
+ rDoc.UpdatePageBreaks(nTab);
if (pViewShell)
pViewShell->UpdatePageBreakData( true );
pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID );
@@ -2091,7 +2091,7 @@ void ScUndoRemoveMerge::Undo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for (set<SCTAB>::const_iterator itr = maOption.maTabs.begin(), itrEnd = maOption.maTabs.end();
itr != itrEnd; ++itr)
{
@@ -2100,8 +2100,8 @@ void ScUndoRemoveMerge::Undo()
continue;
// There is no need to extend merge area because it's already been extended.
ScRange aRange = maOption.getSingleRange(*itr);
- pDoc->DeleteAreaTab(aRange, IDF_ATTRIB);
- pUndoDoc->CopyToDocument(aRange, IDF_ATTRIB, false, pDoc);
+ rDoc.DeleteAreaTab(aRange, IDF_ATTRIB);
+ pUndoDoc->CopyToDocument(aRange, IDF_ATTRIB, false, &rDoc);
bool bDidPaint = false;
if ( pViewShell )
@@ -2123,7 +2123,7 @@ void ScUndoRemoveMerge::Redo()
SetCurTab();
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
for (set<SCTAB>::const_iterator itr = maOption.maTabs.begin(), itrEnd = maOption.maTabs.end();
@@ -2133,18 +2133,18 @@ void ScUndoRemoveMerge::Redo()
// There is no need to extend merge area because it's already been extended.
ScRange aRange = maOption.getSingleRange(nTab);
- const SfxPoolItem& rDefAttr = pDoc->GetPool()->GetDefaultItem( ATTR_MERGE );
- ScPatternAttr aPattern( pDoc->GetPool() );
+ const SfxPoolItem& rDefAttr = rDoc.GetPool()->GetDefaultItem( ATTR_MERGE );
+ ScPatternAttr aPattern( rDoc.GetPool() );
aPattern.GetItemSet().Put( rDefAttr );
- pDoc->ApplyPatternAreaTab( maOption.mnStartCol, maOption.mnStartRow,
+ rDoc.ApplyPatternAreaTab( maOption.mnStartCol, maOption.mnStartRow,
maOption.mnEndCol, maOption.mnEndRow, nTab,
aPattern );
- pDoc->RemoveFlagsTab( maOption.mnStartCol, maOption.mnStartRow,
+ rDoc.RemoveFlagsTab( maOption.mnStartCol, maOption.mnStartRow,
maOption.mnEndCol, maOption.mnEndRow, nTab,
SC_MF_HOR | SC_MF_VER );
- pDoc->ExtendMerge(aRange, true);
+ rDoc.ExtendMerge(aRange, true);
// Paint
@@ -2228,10 +2228,10 @@ void ScUndoBorder::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScMarkData aMarkData;
aMarkData.MarkFromRangeList( *pRanges, false );
- pUndoDoc->CopyToDocument( aBlockRange, IDF_ATTRIB, true, pDoc, &aMarkData );
+ pUndoDoc->CopyToDocument( aBlockRange, IDF_ATTRIB, true, &rDoc, &aMarkData );
pDocShell->PostPaint( aBlockRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
EndUndo();
@@ -2241,7 +2241,7 @@ void ScUndoBorder::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument(); // call function at docfunc
+ ScDocument& rDoc = pDocShell->GetDocument(); // call function at docfunc
size_t nCount = pRanges->size();
for (size_t i = 0; i < nCount; ++i )
{
@@ -2252,7 +2252,7 @@ void ScUndoBorder::Redo()
aMark.SetMarkArea( aRange );
aMark.SelectTable( nTab, true );
- pDoc->ApplySelectionFrame( aMark, pOuter, pInner );
+ rDoc.ApplySelectionFrame( aMark, pOuter, pInner );
}
for (size_t i = 0; i < nCount; ++i)
pDocShell->PostPaint( *(*pRanges)[i], PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
diff --git a/sc/source/ui/undo/undoblk2.cxx b/sc/source/ui/undo/undoblk2.cxx
index 674f9bb62f23..071198b43d7e 100644
--- a/sc/source/ui/undo/undoblk2.cxx
+++ b/sc/source/ui/undo/undoblk2.cxx
@@ -53,7 +53,7 @@ ScUndoWidthOrHeight::ScUndoWidthOrHeight( ScDocShell* pNewDocShell,
eMode( eNewMode ),
pDrawUndo( NULL )
{
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScUndoWidthOrHeight::~ScUndoWidthOrHeight()
@@ -81,7 +81,7 @@ void ScUndoWidthOrHeight::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCCOLROW nPaintStart = nStart > 0 ? nStart-1 : static_cast<SCCOLROW>(0);
@@ -93,9 +93,9 @@ void ScUndoWidthOrHeight::Undo()
//! outlines from all tables?
if (pUndoTab) // Outlines are included when saving ?
- pDoc->SetOutlineTable( nStartTab, pUndoTab );
+ rDoc.SetOutlineTable( nStartTab, pUndoTab );
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScMarkData::iterator itr = aMarkData.begin(), itrEnd = aMarkData.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
@@ -103,27 +103,27 @@ void ScUndoWidthOrHeight::Undo()
{
pUndoDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, *itr,
static_cast<SCCOL>(nEnd), MAXROW, *itr, IDF_NONE,
- false, pDoc );
- pDoc->UpdatePageBreaks( *itr );
+ false, &rDoc );
+ rDoc.UpdatePageBreaks( *itr );
pDocShell->PostPaint( static_cast<SCCOL>(nPaintStart), 0, *itr,
MAXCOL, MAXROW, *itr, PAINT_GRID | PAINT_TOP );
}
else // Height
{
- pUndoDoc->CopyToDocument( 0, nStart, *itr, MAXCOL, nEnd, *itr, IDF_NONE, false, pDoc );
- pDoc->UpdatePageBreaks( *itr );
+ pUndoDoc->CopyToDocument( 0, nStart, *itr, MAXCOL, nEnd, *itr, IDF_NONE, false, &rDoc );
+ rDoc.UpdatePageBreaks( *itr );
pDocShell->PostPaint( 0, nPaintStart, *itr, MAXCOL, MAXROW, *itr, PAINT_GRID | PAINT_LEFT );
}
}
- DoSdrUndoAction( pDrawUndo, pDoc );
+ DoSdrUndoAction( pDrawUndo, &rDoc );
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
pViewShell->UpdateScrollBars();
- SCTAB nCurrentTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nCurrentTab = pViewShell->GetViewData().GetTabNo();
if ( nCurrentTab < nStartTab || nCurrentTab > nEndTab )
pViewShell->SetTabNo( nStartTab );
}
@@ -145,7 +145,7 @@ void ScUndoWidthOrHeight::Redo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
- SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nTab = pViewShell->GetViewData().GetTabNo();
if ( nTab < nStartTab || nTab > nEndTab )
pViewShell->SetTabNo( nStartTab );
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 736d140c5b0d..e80c5265969b 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -87,7 +87,7 @@ ScUndoDeleteContents::ScUndoDeleteContents(
bMulti ( bNewMulti ) // unnecessary
{
if (bObjects)
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
if ( !(aMarkData.IsMarked() || aMarkData.IsMultiMarked()) ) // if no cell is selected:
aMarkData.SetMarkArea( aRange ); // select cell under cursor
@@ -113,7 +113,7 @@ void ScUndoDeleteContents::SetDataSpans( const boost::shared_ptr<DataSpansType>&
void ScUndoDeleteContents::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack && (nFlags & IDF_CONTENTS) )
pChangeTrack->AppendContentRange( aRange, pUndoDoc,
nStartChangeAction, nEndChangeAction );
@@ -123,7 +123,7 @@ void ScUndoDeleteContents::SetChangeTrack()
void ScUndoDeleteContents::DoChange( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SetViewMarkData( aMarkData );
@@ -142,15 +142,15 @@ void ScUndoDeleteContents::DoChange( const bool bUndo )
nUndoFlags |= IDF_NOCAPTIONS;
ScRange aCopyRange = aRange;
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pUndoDoc->CopyToDocument( aCopyRange, nUndoFlags, bMulti, pDoc, &aMarkData );
+ pUndoDoc->CopyToDocument( aCopyRange, nUndoFlags, bMulti, &rDoc, &aMarkData );
- DoSdrUndoAction( pDrawUndo, pDoc );
+ DoSdrUndoAction( pDrawUndo, &rDoc );
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -164,7 +164,7 @@ void ScUndoDeleteContents::DoChange( const bool bUndo )
RedoSdrUndoAction( pDrawUndo );
// do not delete objects and note captions, they have been removed via drawing undo
sal_uInt16 nRedoFlags = (nFlags & ~IDF_OBJECTS) | IDF_NOCAPTIONS;
- pDoc->DeleteSelection( nRedoFlags, aMarkData );
+ rDoc.DeleteSelection( nRedoFlags, aMarkData );
aMarkData.MarkToSimple();
SetChangeTrack();
@@ -256,10 +256,10 @@ OUString ScUndoFillTable::GetComment() const
void ScUndoFillTable::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
- SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount();
+ SCTAB nTabCount = pDocShell->GetDocument().GetTableCount();
ScRange aWorkRange(aRange);
nStartChangeAction = 0;
sal_uLong nTmpAction;
@@ -283,13 +283,13 @@ void ScUndoFillTable::SetChangeTrack()
void ScUndoFillTable::DoChange( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SetViewMarkData( aMarkData );
if (bUndo) // only Undo
{
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScRange aWorkRange(aRange);
ScMarkData::iterator itr = aMarkData.begin(), itrEnd = aMarkData.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
@@ -298,20 +298,20 @@ void ScUndoFillTable::DoChange( const bool bUndo )
aWorkRange.aStart.SetTab(*itr);
aWorkRange.aEnd.SetTab(*itr);
if (bMulti)
- pDoc->DeleteSelectionTab( *itr, IDF_ALL, aMarkData );
+ rDoc.DeleteSelectionTab( *itr, IDF_ALL, aMarkData );
else
- pDoc->DeleteAreaTab( aWorkRange, IDF_ALL );
- pUndoDoc->CopyToDocument( aWorkRange, IDF_ALL, bMulti, pDoc, &aMarkData );
+ rDoc.DeleteAreaTab( aWorkRange, IDF_ALL );
+ pUndoDoc->CopyToDocument( aWorkRange, IDF_ALL, bMulti, &rDoc, &aMarkData );
}
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
}
else // only Redo
{
aMarkData.MarkToMulti();
- pDoc->FillTabMarked( nSrcTab, aMarkData, nFlags, nFunction, bSkipEmpty, bAsLink );
+ rDoc.FillTabMarked( nSrcTab, aMarkData, nFlags, nFunction, bSkipEmpty, bAsLink );
aMarkData.MarkToSimple();
SetChangeTrack();
}
@@ -324,7 +324,7 @@ void ScUndoFillTable::DoChange( const bool bUndo )
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
- SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nTab = pViewShell->GetViewData().GetTabNo();
if ( !aMarkData.GetTableSelect(nTab) )
pViewShell->SetTabNo( nSrcTab );
@@ -371,7 +371,7 @@ ScUndoSelectionAttr::ScUndoSelectionAttr( ScDocShell* pNewDocShell,
pUndoDoc ( pNewUndoDoc ),
bMulti ( bNewMulti )
{
- ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
+ ScDocumentPool* pPool = pDocShell->GetDocument().GetPool();
pApplyPattern = (ScPatternAttr*) &pPool->Put( *pNewApply );
pLineOuter = pNewOuter ? (SvxBoxItem*) &pPool->Put( *pNewOuter ) : NULL;
pLineInner = pNewInner ? (SvxBoxInfoItem*) &pPool->Put( *pNewInner ) : NULL;
@@ -379,7 +379,7 @@ ScUndoSelectionAttr::ScUndoSelectionAttr( ScDocShell* pNewDocShell,
ScUndoSelectionAttr::~ScUndoSelectionAttr()
{
- ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
+ ScDocumentPool* pPool = pDocShell->GetDocument().GetPool();
pPool->Remove(*pApplyPattern);
if (pLineOuter)
pPool->Remove(*pLineOuter);
@@ -402,13 +402,13 @@ ScEditDataArray* ScUndoSelectionAttr::GetDataArray()
void ScUndoSelectionAttr::DoChange( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SetViewMarkData( aMarkData );
ScRange aEffRange( aRange );
- if ( pDoc->HasAttrib( aEffRange, HASATTR_MERGED ) ) // merged cells?
- pDoc->ExtendMerge( aEffRange );
+ if ( rDoc.HasAttrib( aEffRange, HASATTR_MERGED ) ) // merged cells?
+ rDoc.ExtendMerge( aEffRange );
sal_uInt16 nExtFlags = 0;
pDocShell->UpdatePaintExt( nExtFlags, aEffRange );
@@ -418,19 +418,19 @@ void ScUndoSelectionAttr::DoChange( const bool bUndo )
if (bUndo) // only for Undo
{
ScRange aCopyRange = aRange;
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, bMulti, pDoc, &aMarkData );
+ pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, bMulti, &rDoc, &aMarkData );
}
else // only for Redo
{
aMarkData.MarkToMulti();
- pDoc->ApplySelectionPattern( *pApplyPattern, aMarkData );
+ rDoc.ApplySelectionPattern( *pApplyPattern, aMarkData );
aMarkData.MarkToSimple();
if (pLineOuter)
- pDoc->ApplySelectionFrame( aMarkData, pLineOuter, pLineInner );
+ rDoc.ApplySelectionFrame( aMarkData, pLineOuter, pLineInner );
}
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -442,26 +442,26 @@ void ScUndoSelectionAttr::DoChange( const bool bUndo )
void ScUndoSelectionAttr::ChangeEditData( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for (const ScEditDataArray::Item* pItem = mpDataArray->First(); pItem; pItem = mpDataArray->Next())
{
ScAddress aPos(pItem->GetCol(), pItem->GetRow(), pItem->GetTab());
- if (pDoc->GetCellType(aPos) != CELLTYPE_EDIT)
+ if (rDoc.GetCellType(aPos) != CELLTYPE_EDIT)
continue;
if (bUndo)
{
if (pItem->GetOldData())
- pDoc->SetEditText(aPos, *pItem->GetOldData(), NULL);
+ rDoc.SetEditText(aPos, *pItem->GetOldData(), NULL);
else
- pDoc->SetEmptyCell(aPos);
+ rDoc.SetEmptyCell(aPos);
}
else
{
if (pItem->GetNewData())
- pDoc->SetEditText(aPos, *pItem->GetNewData(), NULL);
+ rDoc.SetEditText(aPos, *pItem->GetNewData(), NULL);
else
- pDoc->SetEmptyCell(aPos);
+ rDoc.SetEmptyCell(aPos);
}
}
}
@@ -528,7 +528,7 @@ OUString ScUndoAutoFill::GetComment() const
void ScUndoAutoFill::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc,
nStartChangeAction, nEndChangeAction );
@@ -540,9 +540,9 @@ void ScUndoAutoFill::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScMarkData::iterator itr = aMarkData.begin(), itrEnd = aMarkData.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
@@ -552,10 +552,10 @@ void ScUndoAutoFill::Undo()
sal_uInt16 nExtFlags = 0;
pDocShell->UpdatePaintExt( nExtFlags, aWorkRange );
- pDoc->DeleteAreaTab( aWorkRange, IDF_AUTOFILL );
- pUndoDoc->CopyToDocument( aWorkRange, IDF_AUTOFILL, false, pDoc );
+ rDoc.DeleteAreaTab( aWorkRange, IDF_AUTOFILL );
+ pUndoDoc->CopyToDocument( aWorkRange, IDF_AUTOFILL, false, &rDoc );
- pDoc->ExtendMerge( aWorkRange, true );
+ rDoc.ExtendMerge( aWorkRange, true );
pDocShell->PostPaint( aWorkRange, PAINT_GRID, nExtFlags );
}
pDocShell->PostDataChanged();
@@ -563,7 +563,7 @@ void ScUndoAutoFill::Undo()
if (pViewShell)
pViewShell->CellContentChanged();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -593,13 +593,13 @@ void ScUndoAutoFill::Redo()
break;
}
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
if ( fStartValue != MAXDOUBLE )
{
SCCOL nValX = (eFillDir == FILL_TO_LEFT) ? aSource.aEnd.Col() : aSource.aStart.Col();
SCROW nValY = (eFillDir == FILL_TO_TOP ) ? aSource.aEnd.Row() : aSource.aStart.Row();
SCTAB nTab = aSource.aStart.Tab();
- pDoc->SetValue( nValX, nValY, nTab, fStartValue );
+ rDoc.SetValue( nValX, nValY, nTab, fStartValue );
}
sal_uLong nProgCount;
if (eFillDir == FILL_TO_BOTTOM || eFillDir == FILL_TO_TOP)
@@ -607,10 +607,10 @@ void ScUndoAutoFill::Redo()
else
nProgCount = aSource.aEnd.Row() - aSource.aStart.Row() + 1;
nProgCount *= nCount;
- ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScProgress aProgress( rDoc.GetDocumentShell(),
ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
- pDoc->Fill( aSource.aStart.Col(), aSource.aStart.Row(),
+ rDoc.Fill( aSource.aStart.Col(), aSource.aStart.Row(),
aSource.aEnd.Col(), aSource.aEnd.Row(), &aProgress,
aMarkData, nCount,
eFillDir, eFillCmd, eFillDateCmd,
@@ -674,7 +674,7 @@ void ScUndoMerge::DoChange( bool bUndo ) const
// Nothing to do.
return;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
ScRange aCurRange = maOption.getSingleRange(ScDocShell::GetCurTab());
@@ -688,20 +688,20 @@ void ScUndoMerge::DoChange( bool bUndo ) const
if (bUndo)
// remove merge (contents are copied back below from undo document)
- pDoc->RemoveMerge( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aStart.Tab() );
+ rDoc.RemoveMerge( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aStart.Tab() );
else
{
// repeat merge, but do not remove note captions (will be done by drawing redo below)
- pDoc->DoMerge( aRange.aStart.Tab(),
+ rDoc.DoMerge( aRange.aStart.Tab(),
aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(), false );
if (maOption.mbCenter)
{
- pDoc->ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(),
+ rDoc.ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aStart.Tab(),
SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY ) );
- pDoc->ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(),
+ rDoc.ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aStart.Tab(),
SvxVerJustifyItem( SVX_VER_JUSTIFY_CENTER, ATTR_VER_JUSTIFY ) );
}
@@ -710,20 +710,20 @@ void ScUndoMerge::DoChange( bool bUndo ) const
// undo -> copy back deleted contents
if (bUndo && mpUndoDoc)
{
- pDoc->DeleteAreaTab( aRange, IDF_CONTENTS|IDF_NOCAPTIONS );
- mpUndoDoc->CopyToDocument( aRange, IDF_ALL|IDF_NOCAPTIONS, false, pDoc );
+ rDoc.DeleteAreaTab( aRange, IDF_CONTENTS|IDF_NOCAPTIONS );
+ mpUndoDoc->CopyToDocument( aRange, IDF_ALL|IDF_NOCAPTIONS, false, &rDoc );
}
// redo -> merge contents again
else if (!bUndo && mbMergeContents)
{
- pDoc->DoMergeContents( aRange.aStart.Tab(),
+ rDoc.DoMergeContents( aRange.aStart.Tab(),
aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row() );
}
if (bUndo)
- DoSdrUndoAction( mpDrawUndo, pDoc );
+ DoSdrUndoAction( mpDrawUndo, &rDoc );
else
RedoSdrUndoAction( mpDrawUndo );
@@ -795,16 +795,16 @@ void ScUndoAutoFormat::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
- pDoc->DeleteArea( aBlockRange.aStart.Col(), aBlockRange.aStart.Row(),
+ SCTAB nTabCount = rDoc.GetTableCount();
+ rDoc.DeleteArea( aBlockRange.aStart.Col(), aBlockRange.aStart.Row(),
aBlockRange.aEnd.Col(), aBlockRange.aEnd.Row(),
aMarkData, IDF_ATTRIB );
ScRange aCopyRange = aBlockRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, false, pDoc, &aMarkData );
+ pUndoDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, false, &rDoc, &aMarkData );
// cell heights and widths (IDF_NONE)
if (bSize)
@@ -817,9 +817,9 @@ void ScUndoAutoFormat::Undo()
SCTAB nEndZ = aBlockRange.aEnd.Tab();
pUndoDoc->CopyToDocument( nStartX, 0, 0, nEndX, MAXROW, nTabCount-1,
- IDF_NONE, false, pDoc, &aMarkData );
+ IDF_NONE, false, &rDoc, &aMarkData );
pUndoDoc->CopyToDocument( 0, nStartY, 0, MAXCOL, nEndY, nTabCount-1,
- IDF_NONE, false, pDoc, &aMarkData );
+ IDF_NONE, false, &rDoc, &aMarkData );
pDocShell->PostPaint( 0, 0, nStartZ, MAXCOL, MAXROW, nEndZ,
PAINT_GRID | PAINT_LEFT | PAINT_TOP, SC_PF_LINES );
}
@@ -833,7 +833,7 @@ void ScUndoAutoFormat::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCCOL nStartX = aBlockRange.aStart.Col();
SCROW nStartY = aBlockRange.aStart.Row();
@@ -842,7 +842,7 @@ void ScUndoAutoFormat::Redo()
SCROW nEndY = aBlockRange.aEnd.Row();
SCTAB nEndZ = aBlockRange.aEnd.Tab();
- pDoc->AutoFormat( nStartX, nStartY, nEndX, nEndY, nFormatNo, aMarkData );
+ rDoc.AutoFormat( nStartX, nStartY, nEndX, nEndY, nFormatNo, aMarkData );
if (bSize)
{
@@ -853,11 +853,11 @@ void ScUndoAutoFormat::Redo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
- ScViewData* pData = pViewShell->GetViewData();
- nPPTX = pData->GetPPTX();
- nPPTY = pData->GetPPTY();
- aZoomX = pData->GetZoomX();
- aZoomY = pData->GetZoomY();
+ ScViewData& rData = pViewShell->GetViewData();
+ nPPTX = rData.GetPPTX();
+ nPPTY = rData.GetPPTY();
+ aZoomX = rData.GetZoomX();
+ aZoomY = rData.GetZoomY();
}
else
{
@@ -879,22 +879,22 @@ void ScUndoAutoFormat::Redo()
// as SC_SIZE_VISOPT
for (SCROW nRow=nStartY; nRow<=nEndY; nRow++)
{
- sal_uInt8 nOld = pDoc->GetRowFlags(nRow,nTab);
- bool bHidden = pDoc->RowHidden(nRow, nTab);
+ sal_uInt8 nOld = rDoc.GetRowFlags(nRow,nTab);
+ bool bHidden = rDoc.RowHidden(nRow, nTab);
if ( !bHidden && ( nOld & CR_MANUALSIZE ) )
- pDoc->SetRowFlags( nRow, nTab, nOld & ~CR_MANUALSIZE );
+ rDoc.SetRowFlags( nRow, nTab, nOld & ~CR_MANUALSIZE );
}
- pDoc->SetOptimalHeight(aCxt, nStartY, nEndY, nTab);
+ rDoc.SetOptimalHeight(aCxt, nStartY, nEndY, nTab);
for (SCCOL nCol=nStartX; nCol<=nEndX; nCol++)
- if (!pDoc->ColHidden(nCol, nTab))
+ if (!rDoc.ColHidden(nCol, nTab))
{
- sal_uInt16 nThisSize = STD_EXTRA_WIDTH + pDoc->GetOptimalColWidth( nCol, nTab,
+ sal_uInt16 nThisSize = STD_EXTRA_WIDTH + rDoc.GetOptimalColWidth( nCol, nTab,
&aVirtDev, nPPTX, nPPTY, aZoomX, aZoomY, bFormula,
&aDestMark );
- pDoc->SetColWidth( nCol, nTab, nThisSize );
- pDoc->ShowCol( nCol, nTab, true );
+ rDoc.SetColWidth( nCol, nTab, nThisSize );
+ rDoc.ShowCol( nCol, nTab, true );
}
}
@@ -941,8 +941,8 @@ ScUndoReplace::~ScUndoReplace()
void ScUndoReplace::SetChangeTrack()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
{
if ( pUndoDoc )
@@ -957,9 +957,9 @@ void ScUndoReplace::SetChangeTrack()
ScChangeActionContent* pContent = new ScChangeActionContent(
ScRange( aCursorPos) );
ScCellValue aCell;
- aCell.assign(*pDoc, aCursorPos);
- pContent->SetOldValue( aUndoStr, pDoc );
- pContent->SetNewValue(aCell, pDoc);
+ aCell.assign(rDoc, aCursorPos);
+ pContent->SetOldValue( aUndoStr, &rDoc );
+ pContent->SetNewValue(aCell, &rDoc);
pChangeTrack->Append( pContent );
nEndChangeAction = pChangeTrack->GetActionMax();
}
@@ -977,7 +977,7 @@ void ScUndoReplace::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
ShowTable( aCursorPos.Tab() );
@@ -998,7 +998,7 @@ void ScUndoReplace::Undo()
sal_uInt16 nUndoFlags = (pSearchItem->GetPattern()) ? IDF_ATTRIB : IDF_CONTENTS;
pUndoDoc->CopyToDocument( 0, 0, 0,
MAXCOL, MAXROW, MAXTAB,
- nUndoFlags, false, pDoc, NULL, false ); // without row flags
+ nUndoFlags, false, &rDoc, NULL, false ); // without row flags
pDocShell->PostPaintGridAll();
}
else if (pSearchItem->GetPattern() &&
@@ -1007,7 +1007,7 @@ void ScUndoReplace::Undo()
OUString aTempStr = pSearchItem->GetSearchString(); // toggle
pSearchItem->SetSearchString(pSearchItem->GetReplaceString());
pSearchItem->SetReplaceString(aTempStr);
- pDoc->ReplaceStyle( *pSearchItem,
+ rDoc.ReplaceStyle( *pSearchItem,
aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(),
aMarkData, true);
pSearchItem->SetReplaceString(pSearchItem->GetSearchString());
@@ -1019,7 +1019,7 @@ void ScUndoReplace::Undo()
}
else if (pSearchItem->GetCellType() == SVX_SEARCHIN_NOTE)
{
- ScPostIt* pNote = pDoc->GetNote(aCursorPos);
+ ScPostIt* pNote = rDoc.GetNote(aCursorPos);
OSL_ENSURE( pNote, "ScUndoReplace::Undo - cell does not contain a note" );
if (pNote)
pNote->SetText( aCursorPos, aUndoStr );
@@ -1032,19 +1032,19 @@ void ScUndoReplace::Undo()
// aUndoStr may contain line breaks
if ( aUndoStr.indexOf('\n') != -1 )
{
- ScFieldEditEngine& rEngine = pDoc->GetEditEngine();
+ ScFieldEditEngine& rEngine = rDoc.GetEditEngine();
rEngine.SetText(aUndoStr);
- pDoc->SetEditText(aCursorPos, rEngine.CreateTextObject());
+ rDoc.SetEditText(aCursorPos, rEngine.CreateTextObject());
}
else
- pDoc->SetString( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), aUndoStr );
+ rDoc.SetString( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), aUndoStr );
if (pViewShell)
pViewShell->MoveCursorAbs( aCursorPos.Col(), aCursorPos.Row(),
SC_FOLLOW_JUMP, false, false );
pDocShell->PostPaintGridAll();
}
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -1055,7 +1055,7 @@ void ScUndoReplace::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
@@ -1073,7 +1073,7 @@ void ScUndoReplace::Redo()
else if (pSearchItem->GetPattern() &&
pSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE)
{
- pDoc->ReplaceStyle( *pSearchItem,
+ rDoc.ReplaceStyle( *pSearchItem,
aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(),
aMarkData, true);
pDocShell->PostPaintGridAll();
@@ -1137,9 +1137,9 @@ void ScUndoTabOp::Undo()
sal_uInt16 nExtFlags = 0;
pDocShell->UpdatePaintExt( nExtFlags, aRange );
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->DeleteAreaTab( aRange,IDF_ALL & ~IDF_NOTE );
- pUndoDoc->CopyToDocument( aRange, IDF_ALL & ~IDF_NOTE, false, pDoc );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.DeleteAreaTab( aRange,IDF_ALL & ~IDF_NOTE );
+ pUndoDoc->CopyToDocument( aRange, IDF_ALL & ~IDF_NOTE, false, &rDoc );
pDocShell->PostPaint( aRange, PAINT_GRID, nExtFlags );
pDocShell->PostDataChanged();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -1197,8 +1197,8 @@ ScUndoConversion::~ScUndoConversion()
void ScUndoConversion::SetChangeTrack()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
{
if ( pUndoDoc )
@@ -1231,18 +1231,18 @@ void ScUndoConversion::DoChange( ScDocument* pRefDoc, const ScAddress& rCursorPo
{
if (pRefDoc)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ShowTable( rCursorPos.Tab() );
SetViewMarkData( aMarkData );
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
// Undo/Redo-doc has only selected tables
bool bMulti = aMarkData.IsMultiMarked();
pRefDoc->CopyToDocument( 0, 0, 0,
MAXCOL, MAXROW, nTabCount-1,
- IDF_CONTENTS, bMulti, pDoc, &aMarkData );
+ IDF_CONTENTS, bMulti, &rDoc, &aMarkData );
pDocShell->PostPaintGridAll();
}
else
@@ -1255,7 +1255,7 @@ void ScUndoConversion::Undo()
{
BeginUndo();
DoChange( pUndoDoc, aCursorPos );
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
EndUndo();
@@ -1307,7 +1307,7 @@ OUString ScUndoRefConversion::GetComment() const
void ScUndoRefConversion::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack && (nFlags & IDF_FORMULA) )
pChangeTrack->AppendContentsIfInRefDoc( pUndoDoc,
nStartChangeAction, nEndChangeAction );
@@ -1317,17 +1317,17 @@ void ScUndoRefConversion::SetChangeTrack()
void ScUndoRefConversion::DoChange( ScDocument* pRefDoc)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ShowTable(aRange);
SetViewMarkData( aMarkData );
ScRange aCopyRange = aRange;
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pRefDoc->CopyToDocument( aCopyRange, nFlags, bMulti, pDoc, &aMarkData );
+ pRefDoc->CopyToDocument( aCopyRange, nFlags, bMulti, &rDoc, &aMarkData );
pDocShell->PostPaint( aRange, PAINT_GRID);
pDocShell->PostDataChanged();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -1340,7 +1340,7 @@ void ScUndoRefConversion::Undo()
BeginUndo();
if (pUndoDoc)
DoChange(pUndoDoc);
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
EndUndo();
@@ -1394,8 +1394,8 @@ void ScUndoRefreshLink::Undo()
pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
bool bFirst = true;
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nCount = rDoc.GetTableCount();
for (SCTAB nTab=0; nTab<nCount; nTab++)
if (pUndoDoc->HasTable(nTab))
{
@@ -1403,28 +1403,28 @@ void ScUndoRefreshLink::Undo()
if (bMakeRedo)
{
if (bFirst)
- pRedoDoc->InitUndo( pDoc, nTab, nTab, true, true );
+ pRedoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
else
pRedoDoc->AddUndoTab( nTab, nTab, true, true );
bFirst = false;
- pDoc->CopyToDocument(aRange, IDF_ALL, false, pRedoDoc);
+ rDoc.CopyToDocument(aRange, IDF_ALL, false, pRedoDoc);
pRedoDoc->SetLink( nTab,
- pDoc->GetLinkMode(nTab),
- pDoc->GetLinkDoc(nTab),
- pDoc->GetLinkFlt(nTab),
- pDoc->GetLinkOpt(nTab),
- pDoc->GetLinkTab(nTab),
- pDoc->GetLinkRefreshDelay(nTab) );
- pRedoDoc->SetTabBgColor( nTab, pDoc->GetTabBgColor(nTab) );
+ rDoc.GetLinkMode(nTab),
+ rDoc.GetLinkDoc(nTab),
+ rDoc.GetLinkFlt(nTab),
+ rDoc.GetLinkOpt(nTab),
+ rDoc.GetLinkTab(nTab),
+ rDoc.GetLinkRefreshDelay(nTab) );
+ pRedoDoc->SetTabBgColor( nTab, rDoc.GetTabBgColor(nTab) );
}
- pDoc->DeleteAreaTab( aRange,IDF_ALL );
- pUndoDoc->CopyToDocument( aRange, IDF_ALL, false, pDoc );
- pDoc->SetLink( nTab, pUndoDoc->GetLinkMode(nTab), pUndoDoc->GetLinkDoc(nTab),
+ rDoc.DeleteAreaTab( aRange,IDF_ALL );
+ pUndoDoc->CopyToDocument( aRange, IDF_ALL, false, &rDoc );
+ rDoc.SetLink( nTab, pUndoDoc->GetLinkMode(nTab), pUndoDoc->GetLinkDoc(nTab),
pUndoDoc->GetLinkFlt(nTab), pUndoDoc->GetLinkOpt(nTab),
pUndoDoc->GetLinkTab(nTab),
pUndoDoc->GetLinkRefreshDelay(nTab) );
- pDoc->SetTabBgColor( nTab, pUndoDoc->GetTabBgColor(nTab) );
+ rDoc.SetTabBgColor( nTab, pUndoDoc->GetTabBgColor(nTab) );
}
pDocShell->PostPaintGridAll();
@@ -1439,23 +1439,23 @@ void ScUndoRefreshLink::Redo()
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nCount = rDoc.GetTableCount();
for (SCTAB nTab=0; nTab<nCount; nTab++)
if (pRedoDoc->HasTable(nTab))
{
ScRange aRange(0,0,nTab,MAXCOL,MAXROW,nTab);
- pDoc->DeleteAreaTab( aRange, IDF_ALL );
- pRedoDoc->CopyToDocument( aRange, IDF_ALL, false, pDoc );
- pDoc->SetLink( nTab,
+ rDoc.DeleteAreaTab( aRange, IDF_ALL );
+ pRedoDoc->CopyToDocument( aRange, IDF_ALL, false, &rDoc );
+ rDoc.SetLink( nTab,
pRedoDoc->GetLinkMode(nTab),
pRedoDoc->GetLinkDoc(nTab),
pRedoDoc->GetLinkFlt(nTab),
pRedoDoc->GetLinkOpt(nTab),
pRedoDoc->GetLinkTab(nTab),
pRedoDoc->GetLinkRefreshDelay(nTab) );
- pDoc->SetTabBgColor( nTab, pRedoDoc->GetTabBgColor(nTab) );
+ rDoc.SetTabBgColor( nTab, pRedoDoc->GetTabBgColor(nTab) );
}
pDocShell->PostPaintGridAll();
@@ -1518,8 +1518,8 @@ OUString ScUndoInsertAreaLink::GetComment() const
void ScUndoInsertAreaLink::Undo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
ScAreaLink* pLink = lcl_FindAreaLink( pLinkManager, aDocName, aFltName, aOptions,
aAreaName, aRange );
@@ -1531,8 +1531,8 @@ void ScUndoInsertAreaLink::Undo()
void ScUndoInsertAreaLink::Redo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
ScAreaLink* pLink = new ScAreaLink( pDocShell, aDocName, aFltName, aOptions,
aAreaName, aRange.aStart, nRefreshDelay );
@@ -1580,8 +1580,8 @@ OUString ScUndoRemoveAreaLink::GetComment() const
void ScUndoRemoveAreaLink::Undo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
ScAreaLink* pLink = new ScAreaLink( pDocShell, aDocName, aFltName, aOptions,
aAreaName, aRange.aStart, nRefreshDelay );
@@ -1596,8 +1596,8 @@ void ScUndoRemoveAreaLink::Undo()
void ScUndoRemoveAreaLink::Redo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
ScAreaLink* pLink = lcl_FindAreaLink( pLinkManager, aDocName, aFltName, aOptions,
aAreaName, aRange );
@@ -1656,7 +1656,7 @@ OUString ScUndoUpdateAreaLink::GetComment() const
void ScUndoUpdateAreaLink::DoChange( const bool bUndo ) const
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCCOL nEndX = std::max( aOldRange.aEnd.Col(), aNewRange.aEnd.Col() );
SCROW nEndY = std::max( aOldRange.aEnd.Row(), aNewRange.aEnd.Row() );
@@ -1666,35 +1666,35 @@ void ScUndoUpdateAreaLink::DoChange( const bool bUndo ) const
{
if ( bWithInsert )
{
- pDoc->FitBlock( aNewRange, aOldRange );
- pDoc->DeleteAreaTab( aOldRange, IDF_ALL & ~IDF_NOTE );
- pUndoDoc->UndoToDocument( aOldRange, IDF_ALL & ~IDF_NOTE, false, pDoc );
+ rDoc.FitBlock( aNewRange, aOldRange );
+ rDoc.DeleteAreaTab( aOldRange, IDF_ALL & ~IDF_NOTE );
+ pUndoDoc->UndoToDocument( aOldRange, IDF_ALL & ~IDF_NOTE, false, &rDoc );
}
else
{
ScRange aCopyRange( aOldRange.aStart, ScAddress(nEndX,nEndY,nEndZ) );
- pDoc->DeleteAreaTab( aCopyRange, IDF_ALL & ~IDF_NOTE );
- pUndoDoc->CopyToDocument( aCopyRange, IDF_ALL & ~IDF_NOTE, false, pDoc );
+ rDoc.DeleteAreaTab( aCopyRange, IDF_ALL & ~IDF_NOTE );
+ pUndoDoc->CopyToDocument( aCopyRange, IDF_ALL & ~IDF_NOTE, false, &rDoc );
}
}
else
{
if ( bWithInsert )
{
- pDoc->FitBlock( aOldRange, aNewRange );
- pDoc->DeleteAreaTab( aNewRange, IDF_ALL & ~IDF_NOTE );
- pRedoDoc->CopyToDocument( aNewRange, IDF_ALL & ~IDF_NOTE, false, pDoc );
+ rDoc.FitBlock( aOldRange, aNewRange );
+ rDoc.DeleteAreaTab( aNewRange, IDF_ALL & ~IDF_NOTE );
+ pRedoDoc->CopyToDocument( aNewRange, IDF_ALL & ~IDF_NOTE, false, &rDoc );
}
else
{
ScRange aCopyRange( aOldRange.aStart, ScAddress(nEndX,nEndY,nEndZ) );
- pDoc->DeleteAreaTab( aCopyRange, IDF_ALL & ~IDF_NOTE );
- pRedoDoc->CopyToDocument( aCopyRange, IDF_ALL & ~IDF_NOTE, false, pDoc );
+ rDoc.DeleteAreaTab( aCopyRange, IDF_ALL & ~IDF_NOTE );
+ pRedoDoc->CopyToDocument( aCopyRange, IDF_ALL & ~IDF_NOTE, false, &rDoc );
}
}
ScRange aWorkRange( aNewRange.aStart, ScAddress( nEndX, nEndY, nEndZ ) );
- pDoc->ExtendMerge( aWorkRange, true );
+ rDoc.ExtendMerge( aWorkRange, true );
// Paint
@@ -1714,8 +1714,8 @@ void ScUndoUpdateAreaLink::DoChange( const bool bUndo ) const
void ScUndoUpdateAreaLink::Undo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
ScAreaLink* pLink = lcl_FindAreaLink( pLinkManager, aNewDoc, aNewFlt, aNewOpt,
aNewArea, aNewRange );
if (pLink)
@@ -1730,8 +1730,8 @@ void ScUndoUpdateAreaLink::Undo()
void ScUndoUpdateAreaLink::Redo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
ScAreaLink* pLink = lcl_FindAreaLink( pLinkManager, aOldDoc, aOldFlt, aOldOpt,
aOldArea, aOldRange );
if (pLink)
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index 1119a9ee5024..aa8497870598 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -49,7 +49,7 @@ using ::boost::shared_ptr;
namespace HelperNotifyChanges
{
- void NotifyIfChangesListeners(ScDocShell &rDocShell, const ScAddress &rPos,
+ void NotifyIfChangesListeners(ScDocShell& rDocShell, const ScAddress &rPos,
const ScUndoEnterData::ValuesType &rOldValues, const OUString &rType = OUString("cell-change"))
{
if (ScModelObj* pModelObj = getMustPropagateChangesModel(rDocShell))
@@ -90,7 +90,7 @@ ScUndoCursorAttr::ScUndoCursorAttr( ScDocShell* pNewDocShell,
pNewEditData( static_cast<EditTextObject*>(NULL) ),
bIsAutomatic( bAutomatic )
{
- ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
+ ScDocumentPool* pPool = pDocShell->GetDocument().GetPool();
pNewPattern = (ScPatternAttr*) &pPool->Put( *pNewPat );
pOldPattern = (ScPatternAttr*) &pPool->Put( *pOldPat );
pApplyPattern = (ScPatternAttr*) &pPool->Put( *pApplyPat );
@@ -98,7 +98,7 @@ ScUndoCursorAttr::ScUndoCursorAttr( ScDocShell* pNewDocShell,
ScUndoCursorAttr::~ScUndoCursorAttr()
{
- ScDocumentPool* pPool = pDocShell->GetDocument()->GetPool();
+ ScDocumentPool* pPool = pDocShell->GetDocument().GetPool();
pPool->Remove(*pNewPattern);
pPool->Remove(*pOldPattern);
pPool->Remove(*pApplyPattern);
@@ -120,12 +120,12 @@ void ScUndoCursorAttr::SetEditData( EditTextObject* pOld, EditTextObject* pNew )
void ScUndoCursorAttr::DoChange( const ScPatternAttr* pWhichPattern, const shared_ptr<EditTextObject>& pEditData ) const
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScAddress aPos(nCol, nRow, nTab);
- pDoc->SetPattern( nCol, nRow, nTab, *pWhichPattern, true );
+ rDoc.SetPattern( nCol, nRow, nTab, *pWhichPattern, true );
- if (pDoc->GetCellType(aPos) == CELLTYPE_EDIT && pEditData)
- pDoc->SetEditText(aPos, *pEditData, NULL);
+ if (rDoc.GetCellType(aPos) == CELLTYPE_EDIT && pEditData)
+ rDoc.SetEditText(aPos, *pEditData, NULL);
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
@@ -225,7 +225,7 @@ void ScUndoEnterData::DoChange() const
void ScUndoEnterData::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
mnEndChangeAction = pChangeTrack->GetActionMax() + 1;
@@ -249,29 +249,29 @@ void ScUndoEnterData::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for (size_t i = 0, n = maOldValues.size(); i < n; ++i)
{
Value& rVal = maOldValues[i];
ScCellValue aNewCell;
- aNewCell.assign(rVal.maCell, *pDoc, SC_CLONECELL_STARTLISTENING);
+ aNewCell.assign(rVal.maCell, rDoc, SC_CLONECELL_STARTLISTENING);
ScAddress aPos = maPos;
aPos.SetTab(rVal.mnTab);
- aNewCell.release(*pDoc, aPos);
+ aNewCell.release(rDoc, aPos);
if (rVal.mbHasFormat)
- pDoc->ApplyAttr(maPos.Col(), maPos.Row(), rVal.mnTab,
+ rDoc.ApplyAttr(maPos.Col(), maPos.Row(), rVal.mnTab,
SfxUInt32Item(ATTR_VALUE_FORMAT, rVal.mnFormat));
else
{
- ScPatternAttr aPattern(*pDoc->GetPattern(maPos.Col(), maPos.Row(), rVal.mnTab));
+ ScPatternAttr aPattern(*rDoc.GetPattern(maPos.Col(), maPos.Row(), rVal.mnTab));
aPattern.GetItemSet().ClearItem( ATTR_VALUE_FORMAT );
- pDoc->SetPattern(maPos.Col(), maPos.Row(), rVal.mnTab, aPattern, true);
+ rDoc.SetPattern(maPos.Col(), maPos.Row(), rVal.mnTab, aPattern, true);
}
pDocShell->PostPaintCell(maPos.Col(), maPos.Row(), rVal.mnTab);
}
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
size_t nCount = maOldValues.size();
if ( pChangeTrack && mnEndChangeAction >= sal::static_int_cast<sal_uLong>(nCount) )
pChangeTrack->Undo( mnEndChangeAction - nCount + 1, mnEndChangeAction );
@@ -286,7 +286,7 @@ void ScUndoEnterData::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
for (size_t i = 0, n = maOldValues.size(); i < n; ++i)
{
SCTAB nTab = maOldValues[i].mnTab;
@@ -295,10 +295,10 @@ void ScUndoEnterData::Redo()
ScAddress aPos = maPos;
aPos.SetTab(nTab);
// edit text wil be cloned.
- pDoc->SetEditText(aPos, *mpNewEditData, NULL);
+ rDoc.SetEditText(aPos, *mpNewEditData, NULL);
}
else
- pDoc->SetString(maPos.Col(), maPos.Row(), nTab, maNewString);
+ rDoc.SetString(maPos.Col(), maPos.Row(), nTab, maNewString);
pDocShell->PostPaintCell(maPos.Col(), maPos.Row(), nTab);
}
@@ -348,8 +348,8 @@ OUString ScUndoEnterValue::GetComment() const
void ScUndoEnterValue::SetChangeTrack()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
{
nEndChangeAction = pChangeTrack->GetActionMax() + 1;
@@ -365,14 +365,14 @@ void ScUndoEnterValue::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScCellValue aNewCell;
- aNewCell.assign(maOldCell, *pDoc, SC_CLONECELL_STARTLISTENING);
- aNewCell.release(*pDoc, aPos);
+ aNewCell.assign(maOldCell, rDoc, SC_CLONECELL_STARTLISTENING);
+ aNewCell.release(rDoc, aPos);
pDocShell->PostPaintCell( aPos );
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
@@ -383,8 +383,8 @@ void ScUndoEnterValue::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->SetValue( aPos.Col(), aPos.Row(), aPos.Tab(), nValue );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.SetValue( aPos.Col(), aPos.Row(), aPos.Tab(), nValue );
pDocShell->PostPaintCell( aPos );
SetChangeTrack();
@@ -416,8 +416,8 @@ void ScUndoSetCell::Undo()
SetValue(maOldValue);
pDocShell->PostPaintCell(maPos);
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if (pChangeTrack)
pChangeTrack->Undo(mnEndChangeAction, mnEndChangeAction);
@@ -450,8 +450,8 @@ OUString ScUndoSetCell::GetComment() const
void ScUndoSetCell::SetChangeTrack()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if (pChangeTrack)
{
mnEndChangeAction = pChangeTrack->GetActionMax() + 1;
@@ -467,29 +467,29 @@ void ScUndoSetCell::SetChangeTrack()
void ScUndoSetCell::SetValue( const ScCellValue& rVal )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
switch (rVal.meType)
{
case CELLTYPE_NONE:
// empty cell
- pDoc->SetEmptyCell(maPos);
+ rDoc.SetEmptyCell(maPos);
break;
case CELLTYPE_VALUE:
- pDoc->SetValue(maPos, rVal.mfValue);
+ rDoc.SetValue(maPos, rVal.mfValue);
break;
case CELLTYPE_STRING:
{
ScSetStringParam aParam;
aParam.setTextInput();
- pDoc->SetString(maPos, rVal.mpString->getString());
+ rDoc.SetString(maPos, rVal.mpString->getString());
}
break;
case CELLTYPE_EDIT:
- pDoc->SetEditText(maPos, rVal.mpEditText->Clone());
+ rDoc.SetEditText(maPos, rVal.mpEditText->Clone());
break;
case CELLTYPE_FORMULA:
- pDoc->SetFormulaCell(maPos, rVal.mpFormula->Clone());
+ rDoc.SetFormulaCell(maPos, rVal.mpFormula->Clone());
break;
default:
;
@@ -540,7 +540,7 @@ void ScUndoPageBreak::DoChange( bool bInsertP ) const
else
pViewShell->DeletePageBreak(bColumn, false);
- pDocShell->GetDocument()->InvalidatePageBreaks(nTab);
+ pDocShell->GetDocument().InvalidatePageBreaks(nTab);
}
}
@@ -601,9 +601,9 @@ void ScUndoPrintZoom::DoChange( bool bUndo )
sal_uInt16 nScale = bUndo ? nOldScale : nNewScale;
sal_uInt16 nPages = bUndo ? nOldPages : nNewPages;
- ScDocument* pDoc = pDocShell->GetDocument();
- OUString aStyleName = pDoc->GetPageStyle( nTab );
- ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ OUString aStyleName = rDoc.GetPageStyle( nTab );
+ ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aStyleName, SFX_STYLE_FAMILY_PAGE );
OSL_ENSURE( pStyleSheet, "PageStyle not found" );
if ( pStyleSheet )
@@ -636,8 +636,8 @@ void ScUndoPrintZoom::Repeat(SfxRepeatTarget& rTarget)
if (rTarget.ISA(ScTabViewTarget))
{
ScTabViewShell& rViewShell = *((ScTabViewTarget&)rTarget).GetViewShell();
- ScViewData* pViewData = rViewShell.GetViewData();
- pViewData->GetDocShell()->SetPrintZoom( pViewData->GetTabNo(), nNewScale, nNewPages );
+ ScViewData& rViewData = rViewShell.GetViewData();
+ rViewData.GetDocShell()->SetPrintZoom( rViewData.GetTabNo(), nNewScale, nNewPages );
}
}
@@ -668,7 +668,7 @@ OUString ScUndoThesaurus::GetComment() const
void ScUndoThesaurus::SetChangeTrack( const ScCellValue& rOldCell )
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
nEndChangeAction = pChangeTrack->GetActionMax() + 1;
@@ -682,7 +682,7 @@ void ScUndoThesaurus::SetChangeTrack( const ScCellValue& rOldCell )
void ScUndoThesaurus::DoChange( bool bUndo, const ScCellValue& rText )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
@@ -692,7 +692,7 @@ void ScUndoThesaurus::DoChange( bool bUndo, const ScCellValue& rText )
}
ScAddress aPos(nCol, nRow, nTab);
- rText.commit(*pDoc, aPos);
+ rText.commit(rDoc, aPos);
if (!bUndo)
SetChangeTrack(maOldText);
@@ -703,7 +703,7 @@ void ScUndoThesaurus::Undo()
{
BeginUndo();
DoChange(true, maOldText);
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
EndUndo();
@@ -757,7 +757,7 @@ ScUndoReplaceNote::~ScUndoReplaceNote()
void ScUndoReplaceNote::Undo()
{
BeginUndo();
- DoSdrUndoAction( mpDrawUndo, pDocShell->GetDocument() );
+ DoSdrUndoAction( mpDrawUndo, &pDocShell->GetDocument() );
/* Undo insert -> remove new note.
Undo remove -> insert old note.
Undo replace -> remove new note, insert old note. */
@@ -799,7 +799,7 @@ void ScUndoReplaceNote::DoInsertNote( const ScNoteData& rNoteData )
{
if( rNoteData.mpCaption )
{
- ScDocument& rDoc = *pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
OSL_ENSURE( !rDoc.GetNote(maPos), "ScUndoReplaceNote::DoInsertNote - unexpected cell note" );
ScPostIt* pNote = new ScPostIt( rDoc, maPos, rNoteData, false );
rDoc.SetNote( maPos, pNote );
@@ -810,7 +810,7 @@ void ScUndoReplaceNote::DoRemoveNote( const ScNoteData& rNoteData )
{
if( rNoteData.mpCaption )
{
- ScDocument& rDoc = *pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
OSL_ENSURE( rDoc.GetNote(maPos), "ScUndoReplaceNote::DoRemoveNote - missing cell note" );
if( ScPostIt* pNote = rDoc.ReleaseNote( maPos ) )
{
@@ -837,7 +837,7 @@ ScUndoShowHideNote::~ScUndoShowHideNote()
void ScUndoShowHideNote::Undo()
{
BeginUndo();
- if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote(maPos) )
+ if( ScPostIt* pNote = pDocShell->GetDocument().GetNote(maPos) )
pNote->ShowCaption( maPos, !mbShown );
EndUndo();
}
@@ -845,7 +845,7 @@ void ScUndoShowHideNote::Undo()
void ScUndoShowHideNote::Redo()
{
BeginRedo();
- if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote(maPos) )
+ if( ScPostIt* pNote = pDocShell->GetDocument().GetNote(maPos) )
pNote->ShowCaption( maPos, mbShown );
EndRedo();
}
@@ -906,19 +906,19 @@ void ScUndoDetective::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
- DoSdrUndoAction(pDrawUndo, pDoc);
+ ScDocument& rDoc = pDocShell->GetDocument();
+ DoSdrUndoAction(pDrawUndo, &rDoc);
if (bIsDelete)
{
if ( pOldList )
- pDoc->SetDetOpList( new ScDetOpList(*pOldList) );
+ rDoc.SetDetOpList( new ScDetOpList(*pOldList) );
}
else
{
// Remove entry from list
- ScDetOpList* pList = pDoc->GetDetOpList();
+ ScDetOpList* pList = rDoc.GetDetOpList();
if (pList && pList->Count())
{
ScDetOpDataVector& rVec = pList->GetDataVector();
@@ -945,12 +945,12 @@ void ScUndoDetective::Redo()
RedoSdrUndoAction(pDrawUndo);
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
if (bIsDelete)
- pDoc->ClearDetectiveOperations();
+ rDoc.ClearDetectiveOperations();
else
- pDoc->AddDetectiveOperation( ScDetOpData( aPos, (ScDetOpType) nAction ) );
+ rDoc.AddDetectiveOperation( ScDetOpData( aPos, (ScDetOpType) nAction ) );
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
@@ -991,25 +991,25 @@ OUString ScUndoRangeNames::GetComment() const
void ScUndoRangeNames::DoChange( bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->PreprocessRangeNameUpdate();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.PreprocessRangeNameUpdate();
if ( bUndo )
{
if (mnTab >= 0)
- pDoc->SetRangeName( mnTab, new ScRangeName( *pOldRanges ) );
+ rDoc.SetRangeName( mnTab, new ScRangeName( *pOldRanges ) );
else
- pDoc->SetRangeName( new ScRangeName( *pOldRanges ) );
+ rDoc.SetRangeName( new ScRangeName( *pOldRanges ) );
}
else
{
if (mnTab >= 0)
- pDoc->SetRangeName( mnTab, new ScRangeName( *pNewRanges ) );
+ rDoc.SetRangeName( mnTab, new ScRangeName( *pNewRanges ) );
else
- pDoc->SetRangeName( new ScRangeName( *pNewRanges ) );
+ rDoc.SetRangeName( new ScRangeName( *pNewRanges ) );
}
- pDoc->PostprocessRangeNameUpdate();
+ rDoc.PostprocessRangeNameUpdate();
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) );
}
diff --git a/sc/source/ui/undo/undocell2.cxx b/sc/source/ui/undo/undocell2.cxx
index 0b45efc419e9..0aa39a56fa01 100644
--- a/sc/source/ui/undo/undocell2.cxx
+++ b/sc/source/ui/undo/undocell2.cxx
@@ -20,8 +20,8 @@ UndoSetCells::~UndoSetCells() {}
void UndoSetCells::DoChange( const CellValues& rValues )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->CopyCellValuesFrom(maTopPos, rValues);
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.CopyCellValuesFrom(maTopPos, rValues);
ScRange aRange(maTopPos);
aRange.aEnd.IncRow(rValues.size());
diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index 59845fa4a057..94c0df4a5598 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -96,12 +96,12 @@ void ScUndoDoOutline::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
// sheet has to be switched over (#46952#)!
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -115,9 +115,9 @@ void ScUndoDoOutline::Undo()
// Original column/row status
if (bColumns)
pUndoDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
- static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false, pDoc);
+ static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false, &rDoc);
else
- pUndoDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pDoc );
+ pUndoDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, &rDoc );
pViewShell->UpdateScrollBars();
@@ -134,7 +134,7 @@ void ScUndoDoOutline::Redo()
// sheet has to be switched over (#46952#)!
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -185,15 +185,15 @@ void ScUndoMakeOutline::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCTAB nTab = aBlockStart.Tab();
ScUndoUtil::MarkSimpleBlock( pDocShell, aBlockStart, aBlockEnd );
- pDoc->SetOutlineTable( nTab, pUndoTable );
+ rDoc.SetOutlineTable( nTab, pUndoTable );
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -268,26 +268,26 @@ void ScUndoOutlineLevel::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
// Original Outline table
- pDoc->SetOutlineTable( nTab, pUndoTable );
+ rDoc.SetOutlineTable( nTab, pUndoTable );
// Original column/row status
if (bColumns)
pUndoDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
- static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false, pDoc);
+ static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false, &rDoc);
else
- pUndoDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pDoc );
+ pUndoDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, &rDoc );
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.UpdatePageBreaks( nTab );
pViewShell->UpdateScrollBars();
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -304,7 +304,7 @@ void ScUndoOutlineLevel::Redo()
// sheet has to be switched on or off before this (#46952#) !!!
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -355,12 +355,12 @@ void ScUndoOutlineBlock::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCTAB nTab = aBlockStart.Tab();
// Original Outline table
- pDoc->SetOutlineTable( nTab, pUndoTable );
+ rDoc.SetOutlineTable( nTab, pUndoTable );
// Original column/row status
SCCOLROW nStartCol = aBlockStart.Col();
@@ -371,21 +371,21 @@ void ScUndoOutlineBlock::Undo()
if (!bShow)
{ // Size of the hidden blocks
size_t nLevel;
- pUndoTable->GetColArray()->FindTouchedLevel( nStartCol, nEndCol, nLevel );
- pUndoTable->GetColArray()->ExtendBlock( nLevel, nStartCol, nEndCol );
- pUndoTable->GetRowArray()->FindTouchedLevel( nStartRow, nEndRow, nLevel );
- pUndoTable->GetRowArray()->ExtendBlock( nLevel, nStartRow, nEndRow );
+ pUndoTable->GetColArray().FindTouchedLevel( nStartCol, nEndCol, nLevel );
+ pUndoTable->GetColArray().ExtendBlock( nLevel, nStartCol, nEndCol );
+ pUndoTable->GetRowArray().FindTouchedLevel( nStartRow, nEndRow, nLevel );
+ pUndoTable->GetRowArray().ExtendBlock( nLevel, nStartRow, nEndRow );
}
pUndoDoc->CopyToDocument( static_cast<SCCOL>(nStartCol), 0, nTab,
- static_cast<SCCOL>(nEndCol), MAXROW, nTab, IDF_NONE, false, pDoc );
- pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pDoc );
+ static_cast<SCCOL>(nEndCol), MAXROW, nTab, IDF_NONE, false, &rDoc );
+ pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, &rDoc );
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.UpdatePageBreaks( nTab );
pViewShell->UpdateScrollBars();
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -454,12 +454,12 @@ void ScUndoRemoveAllOutlines::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCTAB nTab = aBlockStart.Tab();
// Original Outline table
- pDoc->SetOutlineTable( nTab, pUndoTable );
+ rDoc.SetOutlineTable( nTab, pUndoTable );
// Original column/row status
SCCOL nStartCol = aBlockStart.Col();
@@ -467,14 +467,14 @@ void ScUndoRemoveAllOutlines::Undo()
SCROW nStartRow = aBlockStart.Row();
SCROW nEndRow = aBlockEnd.Row();
- pUndoDoc->CopyToDocument( nStartCol, 0, nTab, nEndCol, MAXROW, nTab, IDF_NONE, false, pDoc );
- pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pDoc );
+ pUndoDoc->CopyToDocument( nStartCol, 0, nTab, nEndCol, MAXROW, nTab, IDF_NONE, false, &rDoc );
+ pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, &rDoc );
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.UpdatePageBreaks( nTab );
pViewShell->UpdateScrollBars();
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -492,7 +492,7 @@ void ScUndoRemoveAllOutlines::Redo()
// sheet has to be switched over (#46952#)!
SCTAB nTab = aBlockStart.Tab();
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -539,12 +539,12 @@ void ScUndoAutoOutline::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCTAB nTab = aBlockStart.Tab();
// Original outline table
- pDoc->SetOutlineTable( nTab, pUndoTable );
+ rDoc.SetOutlineTable( nTab, pUndoTable );
// Original column/row status
if (pUndoDoc && pUndoTable)
@@ -553,18 +553,18 @@ void ScUndoAutoOutline::Undo()
SCCOLROW nStartRow;
SCCOLROW nEndCol;
SCCOLROW nEndRow;
- pUndoTable->GetColArray()->GetRange( nStartCol, nEndCol );
- pUndoTable->GetRowArray()->GetRange( nStartRow, nEndRow );
+ pUndoTable->GetColArray().GetRange( nStartCol, nEndCol );
+ pUndoTable->GetRowArray().GetRange( nStartRow, nEndRow );
pUndoDoc->CopyToDocument( static_cast<SCCOL>(nStartCol), 0, nTab,
static_cast<SCCOL>(nEndCol), MAXROW, nTab, IDF_NONE, false,
- pDoc);
- pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pDoc );
+ &rDoc);
+ pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, &rDoc );
pViewShell->UpdateScrollBars();
}
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -584,7 +584,7 @@ void ScUndoAutoOutline::Redo()
{
// sheet has to be switched on or off before this (#46952#) !!!
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
}
@@ -648,21 +648,21 @@ void ScUndoSubTotals::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (nNewEndRow > aParam.nRow2)
{
- pDoc->DeleteRow( 0,nTab, MAXCOL,nTab, aParam.nRow2+1, static_cast<SCSIZE>(nNewEndRow-aParam.nRow2) );
+ rDoc.DeleteRow( 0,nTab, MAXCOL,nTab, aParam.nRow2+1, static_cast<SCSIZE>(nNewEndRow-aParam.nRow2) );
}
else if (nNewEndRow < aParam.nRow2)
{
- pDoc->InsertRow( 0,nTab, MAXCOL,nTab, nNewEndRow+1, static_cast<SCSIZE>(aParam.nRow2-nNewEndRow) );
+ rDoc.InsertRow( 0,nTab, MAXCOL,nTab, nNewEndRow+1, static_cast<SCSIZE>(aParam.nRow2-nNewEndRow) );
}
// Original Outline table
- pDoc->SetOutlineTable( nTab, pUndoTable );
+ rDoc.SetOutlineTable( nTab, pUndoTable );
// Original column/row status
if (pUndoTable)
@@ -671,13 +671,13 @@ void ScUndoSubTotals::Undo()
SCCOLROW nStartRow;
SCCOLROW nEndCol;
SCCOLROW nEndRow;
- pUndoTable->GetColArray()->GetRange( nStartCol, nEndCol );
- pUndoTable->GetRowArray()->GetRange( nStartRow, nEndRow );
+ pUndoTable->GetColArray().GetRange( nStartCol, nEndCol );
+ pUndoTable->GetRowArray().GetRange( nStartRow, nEndRow );
pUndoDoc->CopyToDocument( static_cast<SCCOL>(nStartCol), 0, nTab,
static_cast<SCCOL>(nEndCol), MAXROW, nTab, IDF_NONE, false,
- pDoc);
- pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pDoc );
+ &rDoc);
+ pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, &rDoc );
pViewShell->UpdateScrollBars();
}
@@ -687,22 +687,22 @@ void ScUndoSubTotals::Undo()
ScUndoUtil::MarkSimpleBlock( pDocShell, 0, aParam.nRow1+1, nTab,
MAXCOL, aParam.nRow2, nTab );
- pDoc->DeleteAreaTab( 0,aParam.nRow1+1, MAXCOL,aParam.nRow2, nTab, IDF_ALL );
+ rDoc.DeleteAreaTab( 0,aParam.nRow1+1, MAXCOL,aParam.nRow2, nTab, IDF_ALL );
pUndoDoc->CopyToDocument( 0, aParam.nRow1+1, nTab, MAXCOL, aParam.nRow2, nTab,
- IDF_NONE, false, pDoc ); // Flags
+ IDF_NONE, false, &rDoc ); // Flags
pUndoDoc->UndoToDocument( 0, aParam.nRow1+1, nTab, MAXCOL, aParam.nRow2, nTab,
- IDF_ALL, false, pDoc );
+ IDF_ALL, false, &rDoc );
ScUndoUtil::MarkSimpleBlock( pDocShell, aParam.nCol1,aParam.nRow1,nTab,
aParam.nCol2,aParam.nRow2,nTab );
if (pUndoRange)
- pDoc->SetRangeName( new ScRangeName( *pUndoRange ) );
+ rDoc.SetRangeName( new ScRangeName( *pUndoRange ) );
if (pUndoDB)
- pDoc->SetDBCollection( new ScDBCollection( *pUndoDB ), true );
+ rDoc.SetDBCollection( new ScDBCollection( *pUndoDB ), true );
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -718,7 +718,7 @@ void ScUndoSubTotals::Redo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -772,7 +772,7 @@ void ScUndoSort::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCCOL nStartCol = aSortParam.nCol1;
@@ -793,26 +793,26 @@ void ScUndoSort::Undo()
nEndCol, nEndRow, nSortTab );
// do not delete/copy note captions, they are handled in drawing undo (ScDBFuncUndo::mpDrawUndo)
- pDoc->DeleteAreaTab( nStartCol,nStartRow, nEndCol,nEndRow, nSortTab, IDF_ALL|IDF_NOCAPTIONS );
+ rDoc.DeleteAreaTab( nStartCol,nStartRow, nEndCol,nEndRow, nSortTab, IDF_ALL|IDF_NOCAPTIONS );
pUndoDoc->CopyToDocument( nStartCol, nStartRow, nSortTab, nEndCol, nEndRow, nSortTab,
- IDF_ALL|IDF_NOCAPTIONS, false, pDoc );
+ IDF_ALL|IDF_NOCAPTIONS, false, &rDoc );
if (bDestArea)
{
// do not delete/copy note captions, they are handled in drawing undo (ScDBFuncUndo::mpDrawUndo)
- pDoc->DeleteAreaTab( aDestRange, IDF_ALL|IDF_NOCAPTIONS );
- pUndoDoc->CopyToDocument( aDestRange, IDF_ALL|IDF_NOCAPTIONS, false, pDoc );
+ rDoc.DeleteAreaTab( aDestRange, IDF_ALL|IDF_NOCAPTIONS );
+ pUndoDoc->CopyToDocument( aDestRange, IDF_ALL|IDF_NOCAPTIONS, false, &rDoc );
}
// Row heights always (due to automatic adjustment)
// TODO change to use ScBlockUndo
pUndoDoc->CopyToDocument( 0, nStartRow, nSortTab, MAXCOL, nEndRow, nSortTab,
- IDF_NONE, false, pDoc );
+ IDF_NONE, false, &rDoc );
if (pUndoDB)
- pDoc->SetDBCollection( new ScDBCollection( *pUndoDB ), true );
+ rDoc.SetDBCollection( new ScDBCollection( *pUndoDB ), true );
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nSortTab )
pViewShell->SetTabNo( nSortTab );
@@ -828,7 +828,7 @@ void ScUndoSort::Redo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -879,7 +879,7 @@ ScUndoQuery::ScUndoQuery( ScDocShell* pNewDocShell, SCTAB nNewTab, const ScQuery
aAdvSource = *pAdvSrc;
}
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScUndoQuery::~ScUndoQuery()
@@ -898,7 +898,7 @@ void ScUndoQuery::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
bool bCopy = !aQueryParam.bInplace;
@@ -909,7 +909,7 @@ void ScUndoQuery::Undo()
nDestEndCol = aQueryParam.nDestCol + ( aQueryParam.nCol2-aQueryParam.nCol1 );
nDestEndRow = aQueryParam.nDestRow + ( aQueryParam.nRow2-aQueryParam.nRow1 );
- ScDBData* pData = pDoc->GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
+ ScDBData* pData = rDoc.GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
aQueryParam.nDestTab, true );
if (pData)
{
@@ -922,7 +922,7 @@ void ScUndoQuery::Undo()
if ( bDoSize && bDestArea )
{
// aDestRange is the old range
- pDoc->FitBlock( ScRange(
+ rDoc.FitBlock( ScRange(
aQueryParam.nDestCol, aQueryParam.nDestRow, aQueryParam.nDestTab,
nDestEndCol, nDestEndRow, aQueryParam.nDestTab ),
aOldDest );
@@ -931,43 +931,43 @@ void ScUndoQuery::Undo()
ScUndoUtil::MarkSimpleBlock( pDocShell,
aQueryParam.nDestCol, aQueryParam.nDestRow, aQueryParam.nDestTab,
nDestEndCol, nDestEndRow, aQueryParam.nDestTab );
- pDoc->DeleteAreaTab( aQueryParam.nDestCol, aQueryParam.nDestRow,
+ rDoc.DeleteAreaTab( aQueryParam.nDestCol, aQueryParam.nDestRow,
nDestEndCol, nDestEndRow, aQueryParam.nDestTab, IDF_ALL );
pViewShell->DoneBlockMode();
pUndoDoc->CopyToDocument( aQueryParam.nDestCol, aQueryParam.nDestRow, aQueryParam.nDestTab,
nDestEndCol, nDestEndRow, aQueryParam.nDestTab,
- IDF_ALL, false, pDoc );
+ IDF_ALL, false, &rDoc );
// Attributes are always copied (#49287#)
// rest of the old range
if ( bDestArea && !bDoSize )
{
- pDoc->DeleteAreaTab( aOldDest, IDF_ALL );
- pUndoDoc->CopyToDocument( aOldDest, IDF_ALL, false, pDoc );
+ rDoc.DeleteAreaTab( aOldDest, IDF_ALL );
+ pUndoDoc->CopyToDocument( aOldDest, IDF_ALL, false, &rDoc );
}
}
else
pUndoDoc->CopyToDocument( 0, aQueryParam.nRow1, nTab, MAXCOL, aQueryParam.nRow2, nTab,
- IDF_NONE, false, pDoc );
+ IDF_NONE, false, &rDoc );
if (pUndoDB)
- pDoc->SetDBCollection( new ScDBCollection( *pUndoDB ), true );
+ rDoc.SetDBCollection( new ScDBCollection( *pUndoDB ), true );
if (!bCopy)
{
- pDoc->InvalidatePageBreaks(nTab);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.InvalidatePageBreaks(nTab);
+ rDoc.UpdatePageBreaks( nTab );
}
ScRange aDirtyRange( 0 , aQueryParam.nRow1, nTab,
MAXCOL, aQueryParam.nRow2, nTab );
- pDoc->SetDirty( aDirtyRange );
+ rDoc.SetDirty( aDirtyRange );
- DoSdrUndoAction( pDrawUndo, pDoc );
+ DoSdrUndoAction( pDrawUndo, &rDoc );
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -1003,7 +1003,7 @@ void ScUndoQuery::Redo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -1047,16 +1047,16 @@ void ScUndoAutoFilter::DoChange( bool bUndo )
{
bool bNewFilter = bUndo ? !bFilterSet : bFilterSet;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScDBData* pDBData=NULL;
if (aDBName.equalsAscii(STR_DB_LOCAL_NONAME))
{
SCTAB nTab = aOriginalRange.aStart.Tab();
- pDBData = pDoc->GetAnonymousDBData(nTab);
+ pDBData = rDoc.GetAnonymousDBData(nTab);
}
else
{
- ScDBCollection* pColl = pDoc->GetDBCollection();
+ ScDBCollection* pColl = rDoc.GetDBCollection();
pDBData = pColl->getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(aDBName));
}
@@ -1072,9 +1072,9 @@ void ScUndoAutoFilter::DoChange( bool bUndo )
pDBData->GetArea( nRangeTab, nRangeX1, nRangeY1, nRangeX2, nRangeY2 );
if ( bNewFilter )
- pDoc->ApplyFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, SC_MF_AUTO );
+ rDoc.ApplyFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, SC_MF_AUTO );
else
- pDoc->RemoveFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, SC_MF_AUTO );
+ rDoc.RemoveFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, SC_MF_AUTO );
pDocShell->PostPaint( nRangeX1, nRangeY1, nRangeTab, nRangeX2, nRangeY1, nRangeTab, PAINT_GRID );
}
@@ -1127,14 +1127,14 @@ void ScUndoDBData::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- bool bOldAutoCalc = pDoc->GetAutoCalc();
- pDoc->SetAutoCalc( false ); // Avoid unnecessary calculations
- pDoc->CompileDBFormula( true ); // CreateFormulaString
- pDoc->SetDBCollection( new ScDBCollection(*pUndoColl), true );
- pDoc->CompileDBFormula( false ); // CompileFormulaString
- pDoc->SetAutoCalc( bOldAutoCalc );
+ bool bOldAutoCalc = rDoc.GetAutoCalc();
+ rDoc.SetAutoCalc( false ); // Avoid unnecessary calculations
+ rDoc.CompileDBFormula( true ); // CreateFormulaString
+ rDoc.SetDBCollection( new ScDBCollection(*pUndoColl), true );
+ rDoc.CompileDBFormula( false ); // CompileFormulaString
+ rDoc.SetAutoCalc( bOldAutoCalc );
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
@@ -1145,14 +1145,14 @@ void ScUndoDBData::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- bool bOldAutoCalc = pDoc->GetAutoCalc();
- pDoc->SetAutoCalc( false ); // Avoid unnecessary calculations
- pDoc->CompileDBFormula( true ); // CreateFormulaString
- pDoc->SetDBCollection( new ScDBCollection(*pRedoColl), true );
- pDoc->CompileDBFormula( false ); // CompileFormulaString
- pDoc->SetAutoCalc( bOldAutoCalc );
+ bool bOldAutoCalc = rDoc.GetAutoCalc();
+ rDoc.SetAutoCalc( false ); // Avoid unnecessary calculations
+ rDoc.CompileDBFormula( true ); // CreateFormulaString
+ rDoc.SetDBCollection( new ScDBCollection(*pRedoColl), true );
+ rDoc.CompileDBFormula( false ); // CompileFormulaString
+ rDoc.SetAutoCalc( bOldAutoCalc );
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
@@ -1205,7 +1205,7 @@ void ScUndoImportData::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
ScUndoUtil::MarkSimpleBlock( pDocShell, aImportParam.nCol1,aImportParam.nRow1,nTab,
@@ -1218,7 +1218,7 @@ void ScUndoImportData::Undo()
if (pUndoDBData && pRedoDBData)
{
pRedoDBData->GetArea( nTable, nCol1, nRow1, nCol2, nRow2 );
- pCurrentData = ScUndoUtil::GetOldDBData( pRedoDBData, pDoc, nTab,
+ pCurrentData = ScUndoUtil::GetOldDBData( pRedoDBData, &rDoc, nTab,
nCol1, nRow1, nCol2, nRow2 );
if ( !bRedoFilled )
@@ -1227,15 +1227,15 @@ void ScUndoImportData::Undo()
// imported data is deleted later anyway,
// so now delete each column after copying to save memory (#41216#)
- bool bOldAutoCalc = pDoc->GetAutoCalc();
- pDoc->SetAutoCalc( false ); // outside of the loop
+ bool bOldAutoCalc = rDoc.GetAutoCalc();
+ rDoc.SetAutoCalc( false ); // outside of the loop
for (SCCOL nCopyCol = nCol1; nCopyCol <= nCol2; nCopyCol++)
{
- pDoc->CopyToDocument( nCopyCol,nRow1,nTab, nCopyCol,nRow2,nTab,
+ rDoc.CopyToDocument( nCopyCol,nRow1,nTab, nCopyCol,nRow2,nTab,
IDF_CONTENTS & ~IDF_NOTE, false, pRedoDoc );
- pDoc->DeleteAreaTab( nCopyCol,nRow1, nCopyCol,nRow2, nTab, IDF_CONTENTS & ~IDF_NOTE );
+ rDoc.DeleteAreaTab( nCopyCol,nRow1, nCopyCol,nRow2, nTab, IDF_CONTENTS & ~IDF_NOTE );
}
- pDoc->SetAutoCalc( bOldAutoCalc );
+ rDoc.SetAutoCalc( bOldAutoCalc );
bRedoFilled = true;
}
}
@@ -1249,20 +1249,20 @@ void ScUndoImportData::Undo()
pUndoDBData->GetArea( aOld );
pRedoDBData->GetArea( aNew );
- pDoc->DeleteAreaTab( aNew.aStart.Col(), aNew.aStart.Row(),
+ rDoc.DeleteAreaTab( aNew.aStart.Col(), aNew.aStart.Row(),
aNew.aEnd.Col(), aNew.aEnd.Row(), nTab, IDF_ALL & ~IDF_NOTE );
aOld.aEnd.SetCol( aOld.aEnd.Col() + nFormulaCols ); // FitBlock also for formulas
aNew.aEnd.SetCol( aNew.aEnd.Col() + nFormulaCols );
- pDoc->FitBlock( aNew, aOld, false ); // backwards
+ rDoc.FitBlock( aNew, aOld, false ); // backwards
}
else
- pDoc->DeleteAreaTab( aImportParam.nCol1,aImportParam.nRow1,
+ rDoc.DeleteAreaTab( aImportParam.nCol1,aImportParam.nRow1,
nEndCol,nEndRow, nTab, IDF_ALL & ~IDF_NOTE );
pUndoDoc->CopyToDocument( aImportParam.nCol1,aImportParam.nRow1,nTab,
nEndCol+nFormulaCols,nEndRow,nTab,
- IDF_ALL & ~IDF_NOTE, false, pDoc );
+ IDF_ALL & ~IDF_NOTE, false, &rDoc );
if (pCurrentData)
{
@@ -1272,7 +1272,7 @@ void ScUndoImportData::Undo()
ScUndoUtil::MarkSimpleBlock( pDocShell, nCol1, nRow1, nTable, nCol2, nRow2, nTable );
}
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -1290,7 +1290,7 @@ void ScUndoImportData::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
ScUndoUtil::MarkSimpleBlock( pDocShell, aImportParam.nCol1,aImportParam.nRow1,nTab,
@@ -1303,7 +1303,7 @@ void ScUndoImportData::Redo()
if (pUndoDBData && pRedoDBData)
{
pUndoDBData->GetArea( nTable, nCol1, nRow1, nCol2, nRow2 );
- pCurrentData = ScUndoUtil::GetOldDBData( pUndoDBData, pDoc, nTab,
+ pCurrentData = ScUndoUtil::GetOldDBData( pUndoDBData, &rDoc, nTab,
nCol1, nRow1, nCol2, nRow2 );
}
bool bMoveCells = pUndoDBData && pRedoDBData &&
@@ -1318,19 +1318,19 @@ void ScUndoImportData::Redo()
aOld.aEnd.SetCol( aOld.aEnd.Col() + nFormulaCols ); // FitBlock also for formulas
aNew.aEnd.SetCol( aNew.aEnd.Col() + nFormulaCols );
- pDoc->FitBlock( aOld, aNew );
+ rDoc.FitBlock( aOld, aNew );
- pDoc->DeleteAreaTab( aNew.aStart.Col(), aNew.aStart.Row(),
+ rDoc.DeleteAreaTab( aNew.aStart.Col(), aNew.aStart.Row(),
aNew.aEnd.Col(), aNew.aEnd.Row(), nTab, IDF_ALL & ~IDF_NOTE );
- pRedoDoc->CopyToDocument( aNew, IDF_ALL & ~IDF_NOTE, false, pDoc ); // including formulas
+ pRedoDoc->CopyToDocument( aNew, IDF_ALL & ~IDF_NOTE, false, &rDoc ); // including formulas
}
else
{
- pDoc->DeleteAreaTab( aImportParam.nCol1,aImportParam.nRow1,
+ rDoc.DeleteAreaTab( aImportParam.nCol1,aImportParam.nRow1,
nEndCol,nEndRow, nTab, IDF_ALL & ~IDF_NOTE );
pRedoDoc->CopyToDocument( aImportParam.nCol1,aImportParam.nRow1,nTab,
- nEndCol,nEndRow,nTab, IDF_ALL & ~IDF_NOTE, false, pDoc );
+ nEndCol,nEndRow,nTab, IDF_ALL & ~IDF_NOTE, false, &rDoc );
}
if (pCurrentData)
@@ -1341,7 +1341,7 @@ void ScUndoImportData::Redo()
ScUndoUtil::MarkSimpleBlock( pDocShell, nCol1, nRow1, nTable, nCol2, nRow2, nTable );
}
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -1423,13 +1423,13 @@ void ScUndoRepeatDB::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCTAB nTab = aBlockStart.Tab();
if (bQuerySize)
{
- pDoc->FitBlock( aNewQuery, aOldQuery, false );
+ rDoc.FitBlock( aNewQuery, aOldQuery, false );
if ( aNewQuery.aEnd.Col() == aOldQuery.aEnd.Col() )
{
@@ -1437,7 +1437,7 @@ void ScUndoRepeatDB::Undo()
SCCOL nCol = aOldQuery.aEnd.Col() + 1;
SCROW nRow = aOldQuery.aStart.Row() + 1; // test the header
while ( nCol <= MAXCOL &&
- pDoc->GetCellType(ScAddress( nCol, nRow, nTab )) == CELLTYPE_FORMULA )
+ rDoc.GetCellType(ScAddress( nCol, nRow, nTab )) == CELLTYPE_FORMULA )
++nCol, ++nFormulaCols;
if ( nFormulaCols > 0 )
@@ -1447,7 +1447,7 @@ void ScUndoRepeatDB::Undo()
aOldForm.aEnd.SetCol( aOldQuery.aEnd.Col() + nFormulaCols );
ScRange aNewForm = aOldForm;
aNewForm.aEnd.SetRow( aNewQuery.aEnd.Row() );
- pDoc->FitBlock( aNewForm, aOldForm, false );
+ rDoc.FitBlock( aNewForm, aOldForm, false );
}
}
}
@@ -1456,15 +1456,15 @@ void ScUndoRepeatDB::Undo()
if (nNewEndRow > aBlockEnd.Row())
{
- pDoc->DeleteRow( 0,nTab, MAXCOL,nTab, aBlockEnd.Row()+1, static_cast<SCSIZE>(nNewEndRow-aBlockEnd.Row()) );
+ rDoc.DeleteRow( 0,nTab, MAXCOL,nTab, aBlockEnd.Row()+1, static_cast<SCSIZE>(nNewEndRow-aBlockEnd.Row()) );
}
else if (nNewEndRow < aBlockEnd.Row())
{
- pDoc->InsertRow( 0,nTab, MAXCOL,nTab, nNewEndRow+1, static_cast<SCSIZE>(nNewEndRow-aBlockEnd.Row()) );
+ rDoc.InsertRow( 0,nTab, MAXCOL,nTab, nNewEndRow+1, static_cast<SCSIZE>(nNewEndRow-aBlockEnd.Row()) );
}
// Original Outline table
- pDoc->SetOutlineTable( nTab, pUndoTable );
+ rDoc.SetOutlineTable( nTab, pUndoTable );
// Original column/row status
if (pUndoTable)
@@ -1473,13 +1473,13 @@ void ScUndoRepeatDB::Undo()
SCCOLROW nStartRow;
SCCOLROW nEndCol;
SCCOLROW nEndRow;
- pUndoTable->GetColArray()->GetRange( nStartCol, nEndCol );
- pUndoTable->GetRowArray()->GetRange( nStartRow, nEndRow );
+ pUndoTable->GetColArray().GetRange( nStartCol, nEndCol );
+ pUndoTable->GetRowArray().GetRange( nStartRow, nEndRow );
pUndoDoc->CopyToDocument( static_cast<SCCOL>(nStartCol), 0, nTab,
static_cast<SCCOL>(nEndCol), MAXROW, nTab, IDF_NONE, false,
- pDoc );
- pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pDoc );
+ &rDoc );
+ pUndoDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, &rDoc );
pViewShell->UpdateScrollBars();
}
@@ -1487,23 +1487,23 @@ void ScUndoRepeatDB::Undo()
// Original data and references
ScUndoUtil::MarkSimpleBlock( pDocShell, 0, aBlockStart.Row(), nTab,
MAXCOL, aBlockEnd.Row(), nTab );
- pDoc->DeleteAreaTab( 0, aBlockStart.Row(),
+ rDoc.DeleteAreaTab( 0, aBlockStart.Row(),
MAXCOL, aBlockEnd.Row(), nTab, IDF_ALL );
pUndoDoc->CopyToDocument( 0, aBlockStart.Row(), nTab, MAXCOL, aBlockEnd.Row(), nTab,
- IDF_NONE, false, pDoc ); // Flags
+ IDF_NONE, false, &rDoc ); // Flags
pUndoDoc->UndoToDocument( 0, aBlockStart.Row(), nTab, MAXCOL, aBlockEnd.Row(), nTab,
- IDF_ALL, false, pDoc );
+ IDF_ALL, false, &rDoc );
ScUndoUtil::MarkSimpleBlock( pDocShell, aBlockStart.Col(),aBlockStart.Row(),nTab,
aBlockEnd.Col(),aBlockEnd.Row(),nTab );
if (pUndoRange)
- pDoc->SetRangeName( new ScRangeName( *pUndoRange ) );
+ rDoc.SetRangeName( new ScRangeName( *pUndoRange ) );
if (pUndoDB)
- pDoc->SetDBCollection( new ScDBCollection( *pUndoDB ), true );
+ rDoc.SetDBCollection( new ScDBCollection( *pUndoDB ), true );
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -1520,7 +1520,7 @@ void ScUndoRepeatDB::Redo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCTAB nTab = aBlockStart.Tab();
- SCTAB nVisTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nVisTab = pViewShell->GetViewData().GetTabNo();
if ( nVisTab != nTab )
pViewShell->SetTabNo( nTab );
@@ -1585,7 +1585,7 @@ void ScUndoDataPilot::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScRange aOldRange;
ScRange aNewRange;
@@ -1593,14 +1593,14 @@ void ScUndoDataPilot::Undo()
if ( pNewDPObject && pNewUndoDoc )
{
aNewRange = pNewDPObject->GetOutRange();
- pDoc->DeleteAreaTab( aNewRange, IDF_ALL );
- pNewUndoDoc->CopyToDocument( aNewRange, IDF_ALL, false, pDoc );
+ rDoc.DeleteAreaTab( aNewRange, IDF_ALL );
+ pNewUndoDoc->CopyToDocument( aNewRange, IDF_ALL, false, &rDoc );
}
if ( pOldDPObject && pOldUndoDoc )
{
aOldRange = pOldDPObject->GetOutRange();
- pDoc->DeleteAreaTab( aOldRange, IDF_ALL );
- pOldUndoDoc->CopyToDocument( aOldRange, IDF_ALL, false, pDoc );
+ rDoc.DeleteAreaTab( aOldRange, IDF_ALL );
+ pOldUndoDoc->CopyToDocument( aOldRange, IDF_ALL, false, &rDoc );
}
// update objects in collection
@@ -1610,7 +1610,7 @@ void ScUndoDataPilot::Undo()
// find updated object
//! find by name!
- ScDPObject* pDocObj = pDoc->GetDPAtCursor(
+ ScDPObject* pDocObj = rDoc.GetDPAtCursor(
aNewRange.aStart.Col(), aNewRange.aStart.Row(), aNewRange.aStart.Tab() );
OSL_ENSURE(pDocObj, "DPObject not found");
if (pDocObj)
@@ -1628,7 +1628,7 @@ void ScUndoDataPilot::Undo()
else
{
// delete inserted object
- pDoc->GetDPCollection()->FreeTable(pDocObj);
+ rDoc.GetDPCollection()->FreeTable(pDocObj);
}
}
}
@@ -1637,7 +1637,7 @@ void ScUndoDataPilot::Undo()
// re-insert deleted object
ScDPObject* pDestObj = new ScDPObject( *pOldDPObject );
- if ( !pDoc->GetDPCollection()->InsertNewTable(pDestObj) )
+ if ( !rDoc.GetDPCollection()->InsertNewTable(pDestObj) )
{
OSL_FAIL("cannot insert DPObject");
DELETEZ( pDestObj );
@@ -1659,7 +1659,7 @@ void ScUndoDataPilot::Undo()
if (pNewDPObject)
{
// notify API objects
- pDoc->BroadcastUno( ScDataPilotModifiedHint( pNewDPObject->GetName() ) );
+ rDoc.BroadcastUno( ScDataPilotModifiedHint( pNewDPObject->GetName() ) );
}
EndUndo();
@@ -1672,7 +1672,7 @@ void ScUndoDataPilot::Redo()
//! copy output data instead of repeating the change,
//! in case external data have changed!
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScDPObject* pSourceObj = NULL;
if ( pOldDPObject )
@@ -1681,7 +1681,7 @@ void ScUndoDataPilot::Redo()
//! find by name!
ScRange aOldRange = pOldDPObject->GetOutRange();
- pSourceObj = pDoc->GetDPAtCursor(
+ pSourceObj = rDoc.GetDPAtCursor(
aOldRange.aStart.Col(), aOldRange.aStart.Row(), aOldRange.aStart.Tab() );
OSL_ENSURE(pSourceObj, "DPObject not found");
}
@@ -1734,7 +1734,7 @@ void ScUndoConsolidate::Undo()
{
BeginUndo();
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
SCTAB nTab = aDestArea.nTab;
ScRange aOldRange;
@@ -1743,23 +1743,23 @@ void ScUndoConsolidate::Undo()
if (bInsRef)
{
- pDoc->DeleteRow( 0,nTab, MAXCOL,nTab, aDestArea.nRowStart, nInsertCount );
- pDoc->SetOutlineTable( nTab, pUndoTab );
+ rDoc.DeleteRow( 0,nTab, MAXCOL,nTab, aDestArea.nRowStart, nInsertCount );
+ rDoc.SetOutlineTable( nTab, pUndoTab );
// Row status
- pUndoDoc->CopyToDocument( 0,0,nTab, MAXCOL,MAXROW,nTab, IDF_NONE, false, pDoc );
+ pUndoDoc->CopyToDocument( 0,0,nTab, MAXCOL,MAXROW,nTab, IDF_NONE, false, &rDoc );
// Data and references
- pDoc->DeleteAreaTab( 0,aDestArea.nRowStart, MAXCOL,aDestArea.nRowEnd, nTab, IDF_ALL );
+ rDoc.DeleteAreaTab( 0,aDestArea.nRowStart, MAXCOL,aDestArea.nRowEnd, nTab, IDF_ALL );
pUndoDoc->UndoToDocument( 0, aDestArea.nRowStart, nTab,
MAXCOL, aDestArea.nRowEnd, nTab,
- IDF_ALL, false, pDoc );
+ IDF_ALL, false, &rDoc );
// Original range
if (pUndoData)
{
- pDoc->DeleteAreaTab(aOldRange, IDF_ALL);
- pUndoDoc->CopyToDocument(aOldRange, IDF_ALL, false, pDoc);
+ rDoc.DeleteAreaTab(aOldRange, IDF_ALL);
+ pUndoDoc->CopyToDocument(aOldRange, IDF_ALL, false, &rDoc);
}
pDocShell->PostPaint( 0,aDestArea.nRowStart,nTab, MAXCOL,MAXROW,nTab,
@@ -1767,17 +1767,17 @@ void ScUndoConsolidate::Undo()
}
else
{
- pDoc->DeleteAreaTab( aDestArea.nColStart,aDestArea.nRowStart,
+ rDoc.DeleteAreaTab( aDestArea.nColStart,aDestArea.nRowStart,
aDestArea.nColEnd,aDestArea.nRowEnd, nTab, IDF_ALL );
pUndoDoc->CopyToDocument( aDestArea.nColStart, aDestArea.nRowStart, nTab,
aDestArea.nColEnd, aDestArea.nRowEnd, nTab,
- IDF_ALL, false, pDoc );
+ IDF_ALL, false, &rDoc );
// Original range
if (pUndoData)
{
- pDoc->DeleteAreaTab(aOldRange, IDF_ALL);
- pUndoDoc->CopyToDocument(aOldRange, IDF_ALL, false, pDoc);
+ rDoc.DeleteAreaTab(aOldRange, IDF_ALL);
+ pUndoDoc->CopyToDocument(aOldRange, IDF_ALL, false, &rDoc);
}
SCCOL nEndX = aDestArea.nColEnd;
@@ -1796,7 +1796,7 @@ void ScUndoConsolidate::Undo()
// Adjust Database range again
if (pUndoData)
{
- ScDBCollection* pColl = pDoc->GetDBCollection();
+ ScDBCollection* pColl = rDoc.GetDBCollection();
if (pColl)
{
ScDBData* pDocData = pColl->getNamedDBs().findByUpperName(pUndoData->GetUpperName());
@@ -1808,7 +1808,7 @@ void ScUndoConsolidate::Undo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
- SCTAB nViewTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nViewTab = pViewShell->GetViewData().GetTabNo();
if ( nViewTab != nTab )
pViewShell->SetTabNo( nTab );
}
@@ -1825,7 +1825,7 @@ void ScUndoConsolidate::Redo()
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
- SCTAB nViewTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nViewTab = pViewShell->GetViewData().GetTabNo();
if ( nViewTab != aParam.nTab )
pViewShell->SetTabNo( aParam.nTab );
}
@@ -1845,9 +1845,9 @@ bool ScUndoConsolidate::CanRepeat(SfxRepeatTarget& /* rTarget */) const
// Change source data of Chart
void ScUndoChartData::Init()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
aOldRangeListRef = new ScRangeList;
- pDoc->GetOldChartParameters( aChartName, *aOldRangeListRef, bOldColHeaders, bOldRowHeaders );
+ rDoc.GetOldChartParameters( aChartName, *aOldRangeListRef, bOldColHeaders, bOldRowHeaders );
}
ScUndoChartData::ScUndoChartData( ScDocShell* pNewDocShell, const OUString& rName,
@@ -1891,7 +1891,7 @@ void ScUndoChartData::Undo()
{
BeginUndo();
- pDocShell->GetDocument()->UpdateChartArea( aChartName, aOldRangeListRef,
+ pDocShell->GetDocument().UpdateChartArea( aChartName, aOldRangeListRef,
bOldColHeaders, bOldRowHeaders, false );
EndUndo();
@@ -1901,7 +1901,7 @@ void ScUndoChartData::Redo()
{
BeginRedo();
- pDocShell->GetDocument()->UpdateChartArea( aChartName, aNewRangeListRef,
+ pDocShell->GetDocument().UpdateChartArea( aChartName, aNewRangeListRef,
bNewColHeaders, bNewRowHeaders, bAddRange );
EndRedo();
@@ -1942,7 +1942,7 @@ ScUndoDataForm::ScUndoDataForm( ScDocShell* pNewDocShell,
mpMarkData->SetMarkArea(aBlockRange); // mark paste block
if ( pRefUndoData )
- pRefUndoData->DeleteUnchanged( pDocShell->GetDocument() );
+ pRefUndoData->DeleteUnchanged( &pDocShell->GetDocument() );
SetChangeTrack();
}
@@ -1962,7 +1962,7 @@ OUString ScUndoDataForm::GetComment() const
void ScUndoDataForm::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack && (nFlags & IDF_CONTENTS) )
pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc,
nStartChangeAction, nEndChangeAction, SC_CACM_PASTE );
@@ -1982,10 +1982,10 @@ void ScUndoDataForm::Undo()
void ScUndoDataForm::Redo()
{
BeginRedo();
- ScDocument* pDoc = pDocShell->GetDocument();
- EnableDrawAdjust( pDoc, false ); //! include in ScBlockUndo?
+ ScDocument& rDoc = pDocShell->GetDocument();
+ EnableDrawAdjust( &rDoc, false ); //! include in ScBlockUndo?
DoChange( false );
- EnableDrawAdjust( pDoc, true ); //! include in ScBlockUndo?
+ EnableDrawAdjust( &rDoc, true ); //! include in ScBlockUndo?
EndRedo();
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
}
@@ -2001,13 +2001,13 @@ bool ScUndoDataForm::CanRepeat(SfxRepeatTarget& rTarget) const
void ScUndoDataForm::DoChange( const bool bUndo )
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
// RefUndoData for redo is created before first undo
// (with DeleteUnchanged after the DoUndo call)
bool bCreateRedoData = ( bUndo && pRefUndoData && !pRefRedoData );
if ( bCreateRedoData )
- pRefRedoData = new ScRefUndoData( pDoc );
+ pRefRedoData = new ScRefUndoData( &rDoc );
ScRefUndoData* pWorkRefData = bUndo ? pRefUndoData : pRefRedoData;
@@ -2022,7 +2022,7 @@ void ScUndoDataForm::DoChange( const bool bUndo )
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
if ( bUndo && !bRedoFilled )
{
if (!pRedoDoc)
@@ -2031,14 +2031,14 @@ void ScUndoDataForm::DoChange( const bool bUndo )
bool bRowInfo = ( aBlockRange.aStart.Col()==0 && aBlockRange.aEnd.Col()==MAXCOL );
pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRedoDoc->InitUndoSelected( pDoc, *mpMarkData, bColInfo, bRowInfo );
+ pRedoDoc->InitUndoSelected( &rDoc, *mpMarkData, bColInfo, bRowInfo );
}
// read "redo" data from the document in the first undo
// all sheets - CopyToDocument skips those that don't exist in pRedoDoc
ScRange aCopyRange = aBlockRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, 1, false, pRedoDoc );
+ rDoc.CopyToDocument( aCopyRange, 1, false, pRedoDoc );
bRedoFilled = true;
}
@@ -2049,22 +2049,22 @@ void ScUndoDataForm::DoChange( const bool bUndo )
{
OUString aOldString = pUndoDoc->GetString(
aBlockRange.aStart.Col()+i, aBlockRange.aStart.Row(), aBlockRange.aStart.Tab());
- pDoc->SetString( aBlockRange.aStart.Col()+i , aBlockRange.aStart.Row() , aBlockRange.aStart.Tab() , aOldString );
+ rDoc.SetString( aBlockRange.aStart.Col()+i , aBlockRange.aStart.Row() , aBlockRange.aStart.Tab() , aOldString );
}
if (pWorkRefData)
{
- pWorkRefData->DoUndo( pDoc, true ); // TRUE = bSetChartRangeLists for SetChartListenerCollection
- if ( pDoc->RefreshAutoFilter( 0,0, MAXCOL,MAXROW, aBlockRange.aStart.Tab() ) )
+ pWorkRefData->DoUndo( &rDoc, true ); // TRUE = bSetChartRangeLists for SetChartListenerCollection
+ if ( rDoc.RefreshAutoFilter( 0,0, MAXCOL,MAXROW, aBlockRange.aStart.Tab() ) )
bPaintAll = true;
}
if ( bCreateRedoData && pRefRedoData )
- pRefRedoData->DeleteUnchanged( pDoc );
+ pRefRedoData->DeleteUnchanged( &rDoc );
if ( bUndo )
{
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
}
@@ -2072,7 +2072,7 @@ void ScUndoDataForm::DoChange( const bool bUndo )
SetChangeTrack();
ScRange aDrawRange( aBlockRange );
- pDoc->ExtendMerge( aDrawRange, true ); // only needed for single sheet (text/rtf etc.)
+ rDoc.ExtendMerge( aDrawRange, true ); // only needed for single sheet (text/rtf etc.)
sal_uInt16 nPaint = PAINT_GRID;
if (bPaintAll)
{
diff --git a/sc/source/ui/undo/undorangename.cxx b/sc/source/ui/undo/undorangename.cxx
index db9b0e43429e..13da03bd9200 100644
--- a/sc/source/ui/undo/undorangename.cxx
+++ b/sc/source/ui/undo/undorangename.cxx
@@ -75,7 +75,7 @@ OUString ScUndoAllRangeNames::GetComment() const
void ScUndoAllRangeNames::DoChange(const boost::ptr_map<OUString, ScRangeName>& rNames)
{
- ScDocument& rDoc = *pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
rDoc.PreprocessRangeNameUpdate();
rDoc.SetAllRangeNames(rNames);
@@ -99,15 +99,15 @@ ScUndoAddRangeData::~ScUndoAddRangeData()
void ScUndoAddRangeData::Undo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScRangeName* pRangeName = NULL;
if (mnTab == -1)
{
- pRangeName = pDoc->GetRangeName();
+ pRangeName = rDoc.GetRangeName();
}
else
{
- pRangeName = pDoc->GetRangeName( mnTab );
+ pRangeName = rDoc.GetRangeName( mnTab );
}
pRangeName->erase(*mpRangeData);
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) );
@@ -116,15 +116,15 @@ void ScUndoAddRangeData::Undo()
void ScUndoAddRangeData::Redo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScRangeName* pRangeName = NULL;
if (mnTab == -1)
{
- pRangeName = pDoc->GetRangeName();
+ pRangeName = rDoc.GetRangeName();
}
else
{
- pRangeName = pDoc->GetRangeName( mnTab );
+ pRangeName = rDoc.GetRangeName( mnTab );
}
pRangeName->insert(new ScRangeData(*mpRangeData));
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) );
diff --git a/sc/source/ui/undo/undostyl.cxx b/sc/source/ui/undo/undostyl.cxx
index b0e240fcd321..68d3510d7bd8 100644
--- a/sc/source/ui/undo/undostyl.cxx
+++ b/sc/source/ui/undo/undostyl.cxx
@@ -122,8 +122,8 @@ static void lcl_DocStyleChanged( ScDocument* pDoc, SfxStyleSheetBase* pStyle, bo
void ScUndoModifyStyle::DoChange( ScDocShell* pDocSh, const OUString& rName,
SfxStyleFamily eStyleFamily, const ScStyleSaveData& rData )
{
- ScDocument* pDoc = pDocSh->GetDocument();
- ScStyleSheetPool* pStlPool = pDoc->GetStyleSheetPool();
+ ScDocument& rDoc = pDocSh->GetDocument();
+ ScStyleSheetPool* pStlPool = rDoc.GetStyleSheetPool();
OUString aNewName = rData.GetName();
bool bDelete = aNewName.isEmpty(); // no new name -> delete style
bool bNew = ( rName.isEmpty() && !bDelete ); // creating new style
@@ -147,7 +147,7 @@ void ScUndoModifyStyle::DoChange( ScDocShell* pDocSh, const OUString& rName,
pStyle = &pStlPool->Make( aNewName, eStyleFamily, SFXSTYLEBIT_USERDEF );
if ( eStyleFamily == SFX_STYLE_FAMILY_PARA )
- pDoc->GetPool()->CellStyleCreated( aNewName );
+ rDoc.GetPool()->CellStyleCreated( aNewName );
}
if ( pStyle )
@@ -155,9 +155,9 @@ void ScUndoModifyStyle::DoChange( ScDocShell* pDocSh, const OUString& rName,
if ( bDelete )
{
if ( eStyleFamily == SFX_STYLE_FAMILY_PARA )
- lcl_DocStyleChanged( pDoc, pStyle, true ); // TRUE: remove usage of style
+ lcl_DocStyleChanged( &rDoc, pStyle, true ); // TRUE: remove usage of style
else
- pDoc->RemovePageStyleInUse( rName );
+ rDoc.RemovePageStyleInUse( rName );
// delete style
pStlPool->Remove( pStyle );
@@ -178,17 +178,17 @@ void ScUndoModifyStyle::DoChange( ScDocShell* pDocSh, const OUString& rName,
if ( eStyleFamily == SFX_STYLE_FAMILY_PARA )
{
- lcl_DocStyleChanged( pDoc, pStyle, false ); // cell styles: row heights
+ lcl_DocStyleChanged( &rDoc, pStyle, false ); // cell styles: row heights
}
else
{
// page styles
if ( bNew && aNewName != rName )
- pDoc->RenamePageStyleInUse( rName, aNewName );
+ rDoc.RenamePageStyleInUse( rName, aNewName );
if (pNewSet)
- pDoc->ModifyStyleSheet( *pStyle, *pNewSet );
+ rDoc.ModifyStyleSheet( *pStyle, *pNewSet );
pDocSh->PageStyleModified( aNewName, true );
}
@@ -257,7 +257,7 @@ void ScUndoApplyPageStyle::Undo()
BeginUndo();
for( ApplyStyleVec::const_iterator aIt = maEntries.begin(), aEnd = maEntries.end(); aIt != aEnd; ++aIt )
{
- pDocShell->GetDocument()->SetPageStyle( aIt->mnTab, aIt->maOldStyle );
+ pDocShell->GetDocument().SetPageStyle( aIt->mnTab, aIt->maOldStyle );
ScPrintFunc( pDocShell, pDocShell->GetPrinter(), aIt->mnTab ).UpdatePages();
}
EndUndo();
@@ -268,7 +268,7 @@ void ScUndoApplyPageStyle::Redo()
BeginRedo();
for( ApplyStyleVec::const_iterator aIt = maEntries.begin(), aEnd = maEntries.end(); aIt != aEnd; ++aIt )
{
- pDocShell->GetDocument()->SetPageStyle( aIt->mnTab, maNewStyle );
+ pDocShell->GetDocument().SetPageStyle( aIt->mnTab, maNewStyle );
ScPrintFunc( pDocShell, pDocShell->GetPrinter(), aIt->mnTab ).UpdatePages();
}
EndRedo();
diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index 816e2b845414..1a3b9f6c276b 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -84,7 +84,7 @@ ScUndoInsertTab::ScUndoInsertTab( ScDocShell* pNewDocShell,
nTab( nTabNum ),
bAppend( bApp )
{
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
SetChangeTrack();
}
@@ -103,7 +103,7 @@ OUString ScUndoInsertTab::GetComment() const
void ScUndoInsertTab::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
ScRange aRange( 0, 0, nTab, MAXCOL, MAXROW, nTab );
@@ -125,9 +125,9 @@ void ScUndoInsertTab::Undo()
bDrawIsInUndo = false;
pDocShell->SetInUndo( false ); //! EndUndo
- DoSdrUndoAction( pDrawUndo, pDocShell->GetDocument() );
+ DoSdrUndoAction( pDrawUndo, &pDocShell->GetDocument() );
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
@@ -159,7 +159,7 @@ void ScUndoInsertTab::Redo()
void ScUndoInsertTab::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
- ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
+ ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData().GetDispatcher().
Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
@@ -176,7 +176,7 @@ ScUndoInsertTables::ScUndoInsertTables( ScDocShell* pNewDocShell,
aNameList( newNameList ),
nTab( nTabNum )
{
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
SetChangeTrack();
}
@@ -193,7 +193,7 @@ OUString ScUndoInsertTables::GetComment() const
void ScUndoInsertTables::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
nStartChangeAction = pChangeTrack->GetActionMax() + 1;
@@ -224,9 +224,9 @@ void ScUndoInsertTables::Undo()
bDrawIsInUndo = false;
pDocShell->SetInUndo( false ); //! EndUndo
- DoSdrUndoAction( pDrawUndo, pDocShell->GetDocument() );
+ DoSdrUndoAction( pDrawUndo, &pDocShell->GetDocument() );
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -254,7 +254,7 @@ void ScUndoInsertTables::Redo()
void ScUndoInsertTables::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
- ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
+ ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData().GetDispatcher().
Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
@@ -283,7 +283,7 @@ OUString ScUndoDeleteTab::GetComment() const
void ScUndoDeleteTab::SetChangeTrack()
{
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
{
sal_uLong nTmpChangeAction;
@@ -314,7 +314,7 @@ void ScUndoDeleteTab::Undo()
{
BeginUndo();
unsigned int i=0;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
bool bLink = false;
OUString aName;
@@ -325,18 +325,18 @@ void ScUndoDeleteTab::Undo()
pRefUndoDoc->GetName( nTab, aName );
bDrawIsInUndo = true;
- bool bOk = pDoc->InsertTab(nTab, aName, false, true);
+ bool bOk = rDoc.InsertTab(nTab, aName, false, true);
bDrawIsInUndo = false;
if (bOk)
{
- pRefUndoDoc->CopyToDocument(0,0,nTab, MAXCOL,MAXROW,nTab, IDF_ALL,false, pDoc );
+ pRefUndoDoc->CopyToDocument(0,0,nTab, MAXCOL,MAXROW,nTab, IDF_ALL,false, &rDoc );
OUString aOldName;
pRefUndoDoc->GetName( nTab, aOldName );
- pDoc->RenameTab( nTab, aOldName, false );
+ rDoc.RenameTab( nTab, aOldName, false );
if (pRefUndoDoc->IsLinked(nTab))
{
- pDoc->SetLink( nTab, pRefUndoDoc->GetLinkMode(nTab), pRefUndoDoc->GetLinkDoc(nTab),
+ rDoc.SetLink( nTab, pRefUndoDoc->GetLinkMode(nTab), pRefUndoDoc->GetLinkDoc(nTab),
pRefUndoDoc->GetLinkFlt(nTab), pRefUndoDoc->GetLinkOpt(nTab),
pRefUndoDoc->GetLinkTab(nTab), pRefUndoDoc->GetLinkRefreshDelay(nTab) );
bLink = true;
@@ -344,22 +344,22 @@ void ScUndoDeleteTab::Undo()
if ( pRefUndoDoc->IsScenario(nTab) )
{
- pDoc->SetScenario( nTab, true );
+ rDoc.SetScenario( nTab, true );
OUString aComment;
Color aColor;
sal_uInt16 nScenFlags;
pRefUndoDoc->GetScenarioData( nTab, aComment, aColor, nScenFlags );
- pDoc->SetScenarioData( nTab, aComment, aColor, nScenFlags );
+ rDoc.SetScenarioData( nTab, aComment, aColor, nScenFlags );
bool bActive = pRefUndoDoc->IsActiveScenario( nTab );
- pDoc->SetActiveScenario( nTab, bActive );
+ rDoc.SetActiveScenario( nTab, bActive );
}
- pDoc->SetVisible( nTab, pRefUndoDoc->IsVisible( nTab ) );
- pDoc->SetTabBgColor( nTab, pRefUndoDoc->GetTabBgColor(nTab) );
- pDoc->SetSheetEvents( nTab, pRefUndoDoc->GetSheetEvents( nTab ) );
- pDoc->SetLayoutRTL( nTab, pRefUndoDoc->IsLayoutRTL( nTab ) );
+ rDoc.SetVisible( nTab, pRefUndoDoc->IsVisible( nTab ) );
+ rDoc.SetTabBgColor( nTab, pRefUndoDoc->GetTabBgColor(nTab) );
+ rDoc.SetSheetEvents( nTab, pRefUndoDoc->GetSheetEvents( nTab ) );
+ rDoc.SetLayoutRTL( nTab, pRefUndoDoc->IsLayoutRTL( nTab ) );
if ( pRefUndoDoc->IsTabProtected( nTab ) )
- pDoc->SetTabProtection(nTab, pRefUndoDoc->GetTabProtection(nTab));
+ rDoc.SetTabProtection(nTab, pRefUndoDoc->GetTabProtection(nTab));
}
}
if (bLink)
@@ -369,7 +369,7 @@ void ScUndoDeleteTab::Undo()
EndUndo(); // Draw-Undo has to be called before Broadcast!
- ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
@@ -387,13 +387,13 @@ void ScUndoDeleteTab::Undo()
// not ShowTable due to SetTabNo(..., sal_True):
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
- pViewShell->SetTabNo( lcl_GetVisibleTabBefore( *pDoc, theTabs[0] ), true );
+ pViewShell->SetTabNo( lcl_GetVisibleTabBefore( rDoc, theTabs[0] ), true );
}
void ScUndoDeleteTab::Redo()
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- pViewShell->SetTabNo( lcl_GetVisibleTabBefore( *pDocShell->GetDocument(), theTabs.front() ) );
+ pViewShell->SetTabNo( lcl_GetVisibleTabBefore( pDocShell->GetDocument(), theTabs.front() ) );
RedoSdrUndoAction( pDrawUndo ); // Draw Redo first
@@ -414,7 +414,7 @@ void ScUndoDeleteTab::Repeat(SfxRepeatTarget& rTarget)
if (rTarget.ISA(ScTabViewTarget))
{
ScTabViewShell* pViewShell = ((ScTabViewTarget&)rTarget).GetViewShell();
- pViewShell->DeleteTable( pViewShell->GetViewData()->GetTabNo(), true );
+ pViewShell->DeleteTable( pViewShell->GetViewData().GetTabNo(), true );
}
}
@@ -445,8 +445,8 @@ OUString ScUndoRenameTab::GetComment() const
void ScUndoRenameTab::DoChange( SCTAB nTabP, const OUString& rName ) const
{
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->RenameTab( nTabP, rName );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.RenameTab( nTabP, rName );
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) ); // Navigator
@@ -507,28 +507,28 @@ OUString ScUndoMoveTab::GetComment() const
void ScUndoMoveTab::DoChange( bool bUndo ) const
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (bUndo) // UnDo
{
size_t i = mpNewTabs->size();
boost::scoped_ptr<ScProgress> pProgress(new ScProgress(pDocShell , ScGlobal::GetRscString(STR_UNDO_MOVE_TAB),
- i * pDoc->GetCodeCount()));
+ i * rDoc.GetCodeCount()));
for (; i > 0; --i)
{
SCTAB nDestTab = (*mpNewTabs)[i-1];
SCTAB nOldTab = (*mpOldTabs)[i-1];
if (nDestTab > MAXTAB) // appended ?
- nDestTab = pDoc->GetTableCount() - 1;
+ nDestTab = rDoc.GetTableCount() - 1;
- pDoc->MoveTab( nDestTab, nOldTab, pProgress.get() );
- pViewShell->GetViewData()->MoveTab( nDestTab, nOldTab );
+ rDoc.MoveTab( nDestTab, nOldTab, pProgress.get() );
+ pViewShell->GetViewData().MoveTab( nDestTab, nOldTab );
pViewShell->SetTabNo( nOldTab, true );
if (mpOldNames)
{
const OUString& rOldName = (*mpOldNames)[i-1];
- pDoc->RenameTab(nOldTab, rOldName);
+ rDoc.RenameTab(nOldTab, rOldName);
}
}
}
@@ -536,22 +536,22 @@ void ScUndoMoveTab::DoChange( bool bUndo ) const
{
size_t n = mpNewTabs->size();
boost::scoped_ptr<ScProgress> pProgress(new ScProgress(pDocShell , ScGlobal::GetRscString(STR_UNDO_MOVE_TAB),
- n * pDoc->GetCodeCount()));
+ n * rDoc.GetCodeCount()));
for (size_t i = 0; i < n; ++i)
{
SCTAB nDestTab = (*mpNewTabs)[i];
SCTAB nNewTab = nDestTab;
SCTAB nOldTab = (*mpOldTabs)[i];
if (nDestTab > MAXTAB) // appended ?
- nDestTab = pDoc->GetTableCount() - 1;
+ nDestTab = rDoc.GetTableCount() - 1;
- pDoc->MoveTab( nOldTab, nNewTab, pProgress.get() );
- pViewShell->GetViewData()->MoveTab( nOldTab, nNewTab );
+ rDoc.MoveTab( nOldTab, nNewTab, pProgress.get() );
+ pViewShell->GetViewData().MoveTab( nOldTab, nNewTab );
pViewShell->SetTabNo( nDestTab, true );
if (mpNewNames)
{
const OUString& rNewName = (*mpNewNames)[i];
- pDoc->RenameTab(nNewTab, rNewName);
+ rDoc.RenameTab(nNewTab, rNewName);
}
}
}
@@ -593,7 +593,7 @@ ScUndoCopyTab::ScUndoCopyTab(
mpNewNames(pNewNames),
pDrawUndo( NULL )
{
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
if (mpNewNames && mpNewTabs->size() != mpNewNames->size())
// The sizes differ. Something is wrong.
@@ -626,19 +626,19 @@ void ScUndoCopyTab::DoChange() const
void ScUndoCopyTab::Undo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- DoSdrUndoAction( pDrawUndo, pDoc ); // before the sheets are deleted
+ DoSdrUndoAction( pDrawUndo, &rDoc ); // before the sheets are deleted
vector<SCTAB>::const_reverse_iterator itr, itrEnd = mpNewTabs->rend();
for (itr = mpNewTabs->rbegin(); itr != itrEnd; ++itr)
{
SCTAB nDestTab = *itr;
if (nDestTab > MAXTAB) // append?
- nDestTab = pDoc->GetTableCount() - 1;
+ nDestTab = rDoc.GetTableCount() - 1;
bDrawIsInUndo = true;
- pDoc->DeleteTab(nDestTab);
+ rDoc.DeleteTab(nDestTab);
bDrawIsInUndo = false;
}
@@ -649,7 +649,7 @@ void ScUndoCopyTab::Undo()
{
SCTAB nDestTab = *itr;
if (nDestTab > MAXTAB) // append?
- nDestTab = pDoc->GetTableCount() - 1;
+ nDestTab = rDoc.GetTableCount() - 1;
pDocShell->Broadcast( ScTablesHint( SC_TAB_DELETED, nDestTab ) );
}
@@ -659,7 +659,7 @@ void ScUndoCopyTab::Undo()
void ScUndoCopyTab::Redo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCTAB nDestTab = 0;
@@ -669,39 +669,39 @@ void ScUndoCopyTab::Redo()
SCTAB nNewTab = nDestTab;
SCTAB nOldTab = (*mpOldTabs)[i];
if (nDestTab > MAXTAB) // appended ?
- nDestTab = pDoc->GetTableCount() - 1;
+ nDestTab = rDoc.GetTableCount() - 1;
bDrawIsInUndo = true;
- pDoc->CopyTab( nOldTab, nNewTab );
+ rDoc.CopyTab( nOldTab, nNewTab );
bDrawIsInUndo = false;
- pViewShell->GetViewData()->MoveTab( nOldTab, nNewTab );
+ pViewShell->GetViewData().MoveTab( nOldTab, nNewTab );
SCTAB nAdjSource = nOldTab;
if ( nNewTab <= nOldTab )
++nAdjSource; // new position of source table after CopyTab
- if ( pDoc->IsScenario(nAdjSource) )
+ if ( rDoc.IsScenario(nAdjSource) )
{
- pDoc->SetScenario(nNewTab, true );
+ rDoc.SetScenario(nNewTab, true );
OUString aComment;
Color aColor;
sal_uInt16 nScenFlags;
- pDoc->GetScenarioData(nAdjSource, aComment, aColor, nScenFlags );
- pDoc->SetScenarioData(nNewTab, aComment, aColor, nScenFlags );
- bool bActive = pDoc->IsActiveScenario(nAdjSource);
- pDoc->SetActiveScenario(nNewTab, bActive );
- bool bVisible=pDoc->IsVisible(nAdjSource);
- pDoc->SetVisible(nNewTab,bVisible );
+ rDoc.GetScenarioData(nAdjSource, aComment, aColor, nScenFlags );
+ rDoc.SetScenarioData(nNewTab, aComment, aColor, nScenFlags );
+ bool bActive = rDoc.IsActiveScenario(nAdjSource);
+ rDoc.SetActiveScenario(nNewTab, bActive );
+ bool bVisible = rDoc.IsVisible(nAdjSource);
+ rDoc.SetVisible(nNewTab,bVisible );
}
- if ( pDoc->IsTabProtected( nAdjSource ) )
- pDoc->CopyTabProtection(nAdjSource, nNewTab);
+ if ( rDoc.IsTabProtected( nAdjSource ) )
+ rDoc.CopyTabProtection(nAdjSource, nNewTab);
if (mpNewNames)
{
const OUString& rName = (*mpNewNames)[i];
- pDoc->RenameTab(nNewTab, rName);
+ rDoc.RenameTab(nNewTab, rName);
}
}
@@ -755,15 +755,13 @@ OUString ScUndoTabColor::GetComment() const
void ScUndoTabColor::DoChange(bool bUndoType) const
{
- ScDocument* pDoc = pDocShell->GetDocument();
- if (!pDoc)
- return;
+ ScDocument& rDoc = pDocShell->GetDocument();
size_t nTabColorCount = aTabColorList.size();
for (size_t i = 0; i < nTabColorCount; ++i)
{
const ScUndoTabColorInfo& rTabColor = aTabColorList[i];
- pDoc->SetTabBgColor(rTabColor.mnTabId,
+ rDoc.SetTabBgColor(rTabColor.mnTabId,
bUndoType ? rTabColor.maOldTabBgColor : rTabColor.maNewTabBgColor);
}
@@ -807,7 +805,7 @@ ScUndoMakeScenario::ScUndoMakeScenario( ScDocShell* pNewDocShell,
nFlags( nF ),
pDrawUndo( NULL )
{
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScUndoMakeScenario::~ScUndoMakeScenario()
@@ -822,15 +820,15 @@ OUString ScUndoMakeScenario::GetComment() const
void ScUndoMakeScenario::Undo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
pDocShell->SetInUndo( true );
bDrawIsInUndo = true;
- pDoc->DeleteTab( nDestTab );
+ rDoc.DeleteTab( nDestTab );
bDrawIsInUndo = false;
pDocShell->SetInUndo( false );
- DoSdrUndoAction( pDrawUndo, pDoc );
+ DoSdrUndoAction( pDrawUndo, &rDoc );
pDocShell->PostPaint(0,0,nDestTab,MAXCOL,MAXROW,MAXTAB, PAINT_ALL);
pDocShell->PostDataChanged();
@@ -887,7 +885,7 @@ ScUndoImportTab::ScUndoImportTab( ScDocShell* pShell,
pRedoDoc( NULL ),
pDrawUndo( NULL )
{
- pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
+ pDrawUndo = GetSdrUndoAction( &pDocShell->GetDocument() );
}
ScUndoImportTab::~ScUndoImportTab()
@@ -904,8 +902,8 @@ OUString ScUndoImportTab::GetComment() const
void ScUndoImportTab::DoChange() const
{
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
if (pViewShell)
{
if(nTab<nTabCount)
@@ -928,48 +926,48 @@ void ScUndoImportTab::Undo()
// Inserted range names, etc.
SCTAB i;
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
bool bMakeRedo = !pRedoDoc;
if (bMakeRedo)
{
pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRedoDoc->InitUndo( pDoc, nTab,nTab+nCount-1, true,true );
+ pRedoDoc->InitUndo( &rDoc, nTab,nTab+nCount-1, true,true );
OUString aOldName;
for (i=0; i<nCount; i++)
{
SCTAB nTabPos=nTab+i;
- pDoc->CopyToDocument(0,0,nTabPos, MAXCOL,MAXROW,nTabPos, IDF_ALL,false, pRedoDoc );
- pDoc->GetName( nTabPos, aOldName );
+ rDoc.CopyToDocument(0,0,nTabPos, MAXCOL,MAXROW,nTabPos, IDF_ALL,false, pRedoDoc );
+ rDoc.GetName( nTabPos, aOldName );
pRedoDoc->RenameTab( nTabPos, aOldName, false );
- pRedoDoc->SetTabBgColor( nTabPos, pDoc->GetTabBgColor(nTabPos) );
+ pRedoDoc->SetTabBgColor( nTabPos, rDoc.GetTabBgColor(nTabPos) );
- if ( pDoc->IsScenario(nTabPos) )
+ if ( rDoc.IsScenario(nTabPos) )
{
pRedoDoc->SetScenario(nTabPos, true );
OUString aComment;
Color aColor;
sal_uInt16 nScenFlags;
- pDoc->GetScenarioData(nTabPos, aComment, aColor, nScenFlags );
+ rDoc.GetScenarioData(nTabPos, aComment, aColor, nScenFlags );
pRedoDoc->SetScenarioData(nTabPos, aComment, aColor, nScenFlags );
- bool bActive = pDoc->IsActiveScenario(nTabPos);
+ bool bActive = rDoc.IsActiveScenario(nTabPos);
pRedoDoc->SetActiveScenario(nTabPos, bActive );
- bool bVisible=pDoc->IsVisible(nTabPos);
+ bool bVisible = rDoc.IsVisible(nTabPos);
pRedoDoc->SetVisible(nTabPos,bVisible );
}
- if ( pDoc->IsTabProtected( nTabPos ) )
- pRedoDoc->SetTabProtection(nTabPos, pDoc->GetTabProtection(nTabPos));
+ if ( rDoc.IsTabProtected( nTabPos ) )
+ pRedoDoc->SetTabProtection(nTabPos, rDoc.GetTabProtection(nTabPos));
}
}
- DoSdrUndoAction( pDrawUndo, pDoc ); // before the sheets are deleted
+ DoSdrUndoAction( pDrawUndo, &rDoc ); // before the sheets are deleted
bDrawIsInUndo = true;
for (i=0; i<nCount; i++)
- pDoc->DeleteTab( nTab );
+ rDoc.DeleteTab( nTab );
bDrawIsInUndo = false;
DoChange();
@@ -983,7 +981,7 @@ void ScUndoImportTab::Redo()
return;
}
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
OUString aName;
SCTAB i;
for (i=0; i<nCount; i++) // first insert all sheets (#63304#)
@@ -991,31 +989,31 @@ void ScUndoImportTab::Redo()
SCTAB nTabPos=nTab+i;
pRedoDoc->GetName(nTabPos,aName);
bDrawIsInUndo = true;
- pDoc->InsertTab(nTabPos,aName);
+ rDoc.InsertTab(nTabPos,aName);
bDrawIsInUndo = false;
}
for (i=0; i<nCount; i++) // then copy into inserted sheets
{
SCTAB nTabPos=nTab+i;
- pRedoDoc->CopyToDocument(0,0,nTabPos, MAXCOL,MAXROW,nTabPos, IDF_ALL,false, pDoc );
- pDoc->SetTabBgColor( nTabPos, pRedoDoc->GetTabBgColor(nTabPos) );
+ pRedoDoc->CopyToDocument(0,0,nTabPos, MAXCOL,MAXROW,nTabPos, IDF_ALL,false, &rDoc );
+ rDoc.SetTabBgColor( nTabPos, pRedoDoc->GetTabBgColor(nTabPos) );
if ( pRedoDoc->IsScenario(nTabPos) )
{
- pDoc->SetScenario(nTabPos, true );
+ rDoc.SetScenario(nTabPos, true );
OUString aComment;
Color aColor;
sal_uInt16 nScenFlags;
pRedoDoc->GetScenarioData(nTabPos, aComment, aColor, nScenFlags );
- pDoc->SetScenarioData(nTabPos, aComment, aColor, nScenFlags );
+ rDoc.SetScenarioData(nTabPos, aComment, aColor, nScenFlags );
bool bActive = pRedoDoc->IsActiveScenario(nTabPos);
- pDoc->SetActiveScenario(nTabPos, bActive );
+ rDoc.SetActiveScenario(nTabPos, bActive );
bool bVisible=pRedoDoc->IsVisible(nTabPos);
- pDoc->SetVisible(nTabPos,bVisible );
+ rDoc.SetVisible(nTabPos,bVisible );
}
if ( pRedoDoc->IsTabProtected( nTabPos ) )
- pDoc->SetTabProtection(nTabPos, pRedoDoc->GetTabProtection(nTabPos));
+ rDoc.SetTabProtection(nTabPos, pRedoDoc->GetTabProtection(nTabPos));
}
RedoSdrUndoAction( pDrawUndo ); // after the sheets are inserted
@@ -1026,7 +1024,7 @@ void ScUndoImportTab::Redo()
void ScUndoImportTab::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
- ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
+ ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData().GetDispatcher().
Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
@@ -1035,39 +1033,39 @@ bool ScUndoImportTab::CanRepeat(SfxRepeatTarget& rTarget) const
return rTarget.ISA(ScTabViewTarget);
}
-ScUndoRemoveLink::ScUndoRemoveLink( ScDocShell* pShell, const OUString& rDoc ) :
+ScUndoRemoveLink::ScUndoRemoveLink( ScDocShell* pShell, const OUString& rDocName ) :
ScSimpleUndo( pShell ),
- aDocName( rDoc ),
+ aDocName( rDocName ),
nRefreshDelay( 0 ),
nCount( 0 )
{
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
pTabs = new SCTAB[nTabCount];
pModes = new sal_uInt8[nTabCount];
pTabNames = new OUString[nTabCount];
for (SCTAB i=0; i<nTabCount; i++)
{
- sal_uInt8 nMode = pDoc->GetLinkMode(i);
+ sal_uInt8 nMode = rDoc.GetLinkMode(i);
if (nMode)
- if (pDoc->GetLinkDoc(i) == aDocName)
+ if (rDoc.GetLinkDoc(i) == aDocName)
{
if (!nCount)
{
- aFltName = pDoc->GetLinkFlt(i);
- aOptions = pDoc->GetLinkOpt(i);
- nRefreshDelay = pDoc->GetLinkRefreshDelay(i);
+ aFltName = rDoc.GetLinkFlt(i);
+ aOptions = rDoc.GetLinkOpt(i);
+ nRefreshDelay = rDoc.GetLinkRefreshDelay(i);
}
else
{
- OSL_ENSURE(OUString(aFltName) == pDoc->GetLinkFlt(i) &&
- OUString(aOptions) == pDoc->GetLinkOpt(i),
+ OSL_ENSURE(OUString(aFltName) == rDoc.GetLinkFlt(i) &&
+ OUString(aOptions) == rDoc.GetLinkOpt(i),
"different Filter for a Document?");
}
pTabs[nCount] = i;
pModes[nCount] = nMode;
- pTabNames[nCount] = pDoc->GetLinkTab(i);
+ pTabNames[nCount] = rDoc.GetLinkTab(i);
++nCount;
}
}
@@ -1087,13 +1085,13 @@ OUString ScUndoRemoveLink::GetComment() const
void ScUndoRemoveLink::DoChange( bool bLink ) const
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
OUString aEmpty;
for (sal_uInt16 i=0; i<nCount; i++)
if (bLink) // establish link
- pDoc->SetLink( pTabs[i], pModes[i], aDocName, aFltName, aOptions, pTabNames[i], nRefreshDelay );
+ rDoc.SetLink( pTabs[i], pModes[i], aDocName, aFltName, aOptions, pTabNames[i], nRefreshDelay );
else // remove link
- pDoc->SetLink( pTabs[i], SC_LINK_NONE, aEmpty, aEmpty, aEmpty, aEmpty, 0 );
+ rDoc.SetLink( pTabs[i], SC_LINK_NONE, aEmpty, aEmpty, aEmpty, aEmpty, 0 );
pDocShell->UpdateLinks();
}
@@ -1130,7 +1128,7 @@ ScUndoShowHideTab::~ScUndoShowHideTab()
void ScUndoShowHideTab::DoChange( bool bShowP ) const
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
SCTAB nTab;
@@ -1138,7 +1136,7 @@ void ScUndoShowHideTab::DoChange( bool bShowP ) const
for(std::vector<SCTAB>::const_iterator itr = undoTabs.begin(), itrEnd = undoTabs.end(); itr != itrEnd; ++itr)
{
nTab = *itr;
- pDoc->SetVisible( nTab, bShowP );
+ rDoc.SetVisible( nTab, bShowP );
if (pViewShell)
pViewShell->SetTabNo(nTab,true);
}
@@ -1160,7 +1158,7 @@ void ScUndoShowHideTab::Redo()
void ScUndoShowHideTab::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
- ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
+ ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData().GetDispatcher().
Execute( bShow ? FID_TABLE_SHOW : FID_TABLE_HIDE,
SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
@@ -1199,7 +1197,7 @@ ScUndoDocProtect::~ScUndoDocProtect()
void ScUndoDocProtect::DoProtect(bool bProtect)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
if (bProtect)
{
@@ -1208,12 +1206,12 @@ void ScUndoDocProtect::DoProtect(bool bProtect)
auto_ptr<ScDocProtection> pCopy(new ScDocProtection(*mpProtectSettings));
SAL_WNODEPRECATED_DECLARATIONS_POP
pCopy->setProtected(true);
- pDoc->SetDocProtection(pCopy.get());
+ rDoc.SetDocProtection(pCopy.get());
}
else
{
// remove protection.
- pDoc->SetDocProtection(NULL);
+ rDoc.SetDocProtection(NULL);
}
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -1271,7 +1269,7 @@ ScUndoTabProtect::~ScUndoTabProtect()
void ScUndoTabProtect::DoProtect(bool bProtect)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
if (bProtect)
{
@@ -1280,12 +1278,12 @@ void ScUndoTabProtect::DoProtect(bool bProtect)
auto_ptr<ScTableProtection> pCopy(new ScTableProtection(*mpProtectSettings));
SAL_WNODEPRECATED_DECLARATIONS_POP
pCopy->setProtected(true);
- pDoc->SetTabProtection(mnTab, pCopy.get());
+ rDoc.SetTabProtection(mnTab, pCopy.get());
}
else
{
// remove protection.
- pDoc->SetTabProtection(mnTab, NULL);
+ rDoc.SetTabProtection(mnTab, NULL);
}
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -1345,11 +1343,11 @@ ScUndoPrintRange::~ScUndoPrintRange()
void ScUndoPrintRange::DoChange(bool bUndo)
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
if (bUndo)
- pDoc->RestorePrintRanges( *pOldRanges );
+ rDoc.RestorePrintRanges( *pOldRanges );
else
- pDoc->RestorePrintRanges( *pNewRanges );
+ rDoc.RestorePrintRanges( *pNewRanges );
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
@@ -1416,10 +1414,10 @@ OUString ScUndoScenarioFlags::GetComment() const
void ScUndoScenarioFlags::Undo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- pDoc->RenameTab( nTab, aOldName );
- pDoc->SetScenarioData( nTab, aOldComment, aOldColor, nOldFlags );
+ rDoc.RenameTab( nTab, aOldName );
+ rDoc.SetScenarioData( nTab, aOldComment, aOldColor, nOldFlags );
pDocShell->PostPaintGridAll();
// The sheet name might be used in a formula ...
@@ -1433,10 +1431,10 @@ void ScUndoScenarioFlags::Undo()
void ScUndoScenarioFlags::Redo()
{
- ScDocument* pDoc = pDocShell->GetDocument();
+ ScDocument& rDoc = pDocShell->GetDocument();
- pDoc->RenameTab( nTab, aNewName );
- pDoc->SetScenarioData( nTab, aNewComment, aNewColor, nNewFlags );
+ rDoc.RenameTab( nTab, aNewName );
+ rDoc.SetScenarioData( nTab, aNewComment, aNewColor, nNewFlags );
pDocShell->PostPaintGridAll();
// The sheet name might be used in a formula ...
@@ -1480,8 +1478,8 @@ OUString ScUndoRenameObject::GetComment() const
SdrObject* ScUndoRenameObject::GetObject()
{
- ScDocument* pDoc = pDocShell->GetDocument();
- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
if ( pDrawLayer )
{
sal_uInt16 nCount = pDrawLayer->GetPageCount();
@@ -1550,8 +1548,8 @@ void ScUndoLayoutRTL::DoChange( bool bNew )
{
pDocShell->SetInUndo( true );
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->SetLayoutRTL( nTab, bNew );
+ ScDocument& rDoc = pDocShell->GetDocument();
+ rDoc.SetLayoutRTL( nTab, bNew );
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
@@ -1575,7 +1573,7 @@ void ScUndoLayoutRTL::Redo()
void ScUndoLayoutRTL::Repeat(SfxRepeatTarget& rTarget)
{
if (rTarget.ISA(ScTabViewTarget))
- ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
+ ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData().GetDispatcher().
Execute( FID_TAB_RTL, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
}
diff --git a/sc/source/ui/undo/undoutil.cxx b/sc/source/ui/undo/undoutil.cxx
index 51ba554e5439..0e0891cb29b8 100644
--- a/sc/source/ui/undo/undoutil.cxx
+++ b/sc/source/ui/undo/undoutil.cxx
@@ -38,14 +38,14 @@ void ScUndoUtil::MarkSimpleBlock( ScDocShell* pDocShell,
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
- SCTAB nViewTab = pViewShell->GetViewData()->GetTabNo();
+ SCTAB nViewTab = pViewShell->GetViewData().GetTabNo();
if ( nViewTab < nStartZ || nViewTab > nEndZ )
pViewShell->SetTabNo( nStartZ );
pViewShell->DoneBlockMode();
pViewShell->MoveCursorAbs( nStartX, nStartY, SC_FOLLOW_JUMP, false, false );
pViewShell->InitOwnBlockMode();
- pViewShell->GetViewData()->GetMarkData().
+ pViewShell->GetViewData().GetMarkData().
SetMarkArea( ScRange( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ) );
pViewShell->MarkDataChanged();
}