summaryrefslogtreecommitdiff
path: root/sc/source/ui/docshell
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/docshell
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/docshell')
-rw-r--r--sc/source/ui/docshell/arealink.cxx60
-rw-r--r--sc/source/ui/docshell/datastream.cxx7
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx302
-rw-r--r--sc/source/ui/docshell/dbdocimp.cxx66
-rw-r--r--sc/source/ui/docshell/docfunc.cxx1056
-rw-r--r--sc/source/ui/docshell/docsh.cxx42
-rw-r--r--sc/source/ui/docshell/docsh3.cxx10
-rw-r--r--sc/source/ui/docshell/docsh4.cxx127
-rw-r--r--sc/source/ui/docshell/docsh5.cxx20
-rw-r--r--sc/source/ui/docshell/docsh6.cxx4
-rw-r--r--sc/source/ui/docshell/docsh8.cxx14
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx36
-rw-r--r--sc/source/ui/docshell/olinefun.cxx259
-rw-r--r--sc/source/ui/docshell/servobj.cxx26
-rw-r--r--sc/source/ui/docshell/tablink.cxx93
15 files changed, 1056 insertions, 1066 deletions
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index cb7344e411b7..6bfb499821ae 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -75,7 +75,7 @@ ScAreaLink::ScAreaLink( SfxObjectShell* pShell, const OUString& rFile,
OSL_ENSURE(pShell->ISA(ScDocShell), "ScAreaLink mit falscher ObjectShell");
pImpl->m_pDocSh = static_cast< ScDocShell* >( pShell );
SetRefreshHandler( LINK( this, ScAreaLink, RefreshHdl ) );
- SetRefreshControl( pImpl->m_pDocSh->GetDocument()->GetRefreshTimerControlAddress() );
+ SetRefreshControl( &pImpl->m_pDocSh->GetDocument().GetRefreshTimerControlAddress() );
}
ScAreaLink::~ScAreaLink()
@@ -109,7 +109,7 @@ void ScAreaLink::Edit(Window* pParent, const Link& /* rEndEditHdl */ )
if (bInCreate)
return SUCCESS;
- sfx2::LinkManager* pLinkManager=pImpl->m_pDocSh->GetDocument()->GetLinkManager();
+ sfx2::LinkManager* pLinkManager=pImpl->m_pDocSh->GetDocument().GetLinkManager();
if (pLinkManager!=NULL)
{
OUString aFile, aArea, aFilter;
@@ -143,8 +143,8 @@ void ScAreaLink::Closed()
{
// Verknuepfung loeschen: Undo
- ScDocument* pDoc = pImpl->m_pDocSh->GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
+ ScDocument& rDoc = pImpl->m_pDocSh->GetDocument();
+ bool bUndo (rDoc.IsUndoEnabled());
if (bAddUndo && bUndo)
{
pImpl->m_pDocSh->GetUndoManager()->AddUndoAction( new ScUndoRemoveAreaLink( pImpl->m_pDocSh,
@@ -155,8 +155,8 @@ void ScAreaLink::Closed()
}
SCTAB nDestTab = aDestArea.aStart.Tab();
- if (pDoc->IsStreamValid(nDestTab))
- pDoc->SetStreamValid(nDestTab, false);
+ if (rDoc.IsStreamValid(nDestTab))
+ rDoc.SetStreamValid(nDestTab, false);
SvBaseLink::Closed();
}
@@ -242,10 +242,10 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
if (!pFilter)
return false;
- ScDocument* pDoc = pImpl->m_pDocSh->GetDocument();
+ ScDocument& rDoc = pImpl->m_pDocSh->GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
- pDoc->SetInLinkUpdate( true );
+ bool bUndo (rDoc.IsUndoEnabled());
+ rDoc.SetInLinkUpdate( true );
// wenn neuer Filter ausgewaehlt wurde, Optionen vergessen
if ( rNewFilter != aFilterName )
@@ -258,7 +258,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
SfxObjectShellLock aRef = pSrcShell;
pSrcShell->DoLoad(pMed);
- ScDocument* pSrcDoc = pSrcShell->GetDocument();
+ ScDocument& rSrcDoc = pSrcShell->GetDocument();
// Optionen koennten gesetzt worden sein
OUString aNewOpt = ScDocumentLoader::GetOptions(*pMed);
@@ -269,7 +269,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
OUString aTempArea;
if( rNewFilter == ScDocShell::GetWebQueryFilterName() )
- aTempArea = ScFormatFilter::Get().GetHTMLRangeNameList( pSrcDoc, rNewArea );
+ aTempArea = ScFormatFilter::Get().GetHTMLRangeNameList( &rSrcDoc, rNewArea );
else
aTempArea = rNewArea;
@@ -284,7 +284,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
{
OUString aToken( aTempArea.getToken( 0, ';', nStringIx ) );
ScRange aTokenRange;
- if( FindExtRange( aTokenRange, pSrcDoc, aToken ) )
+ if( FindExtRange( aTokenRange, &rSrcDoc, aToken ) )
{
// columns: find maximum
nWidth = std::max( nWidth, (SCCOL)(aTokenRange.aEnd.Col() - aTokenRange.aStart.Col() + 1) );
@@ -310,7 +310,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
//! check CanFitBlock only if bDoInsert is set?
bool bCanDo = ValidColRow( aNewRange.aEnd.Col(), aNewRange.aEnd.Row() ) &&
- pDoc->CanFitBlock( aOldRange, aNewRange );
+ rDoc.CanFitBlock( aOldRange, aNewRange );
if (bCanDo)
{
ScDocShellModificator aModificator( *pImpl->m_pDocSh );
@@ -332,18 +332,18 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
{
if ( nNewEndX != nOldEndX || nNewEndY != nOldEndY ) // Bereich veraendert?
{
- pUndoDoc->InitUndo( pDoc, 0, pDoc->GetTableCount()-1 );
- pDoc->CopyToDocument( 0,0,0,MAXCOL,MAXROW,MAXTAB,
+ pUndoDoc->InitUndo( &rDoc, 0, rDoc.GetTableCount()-1 );
+ rDoc.CopyToDocument( 0,0,0,MAXCOL,MAXROW,MAXTAB,
IDF_FORMULA, false, pUndoDoc ); // alle Formeln
}
else
- pUndoDoc->InitUndo( pDoc, nDestTab, nDestTab ); // nur Zieltabelle
- pDoc->CopyToDocument( aOldRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nDestTab, nDestTab ); // nur Zieltabelle
+ rDoc.CopyToDocument( aOldRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
}
else // ohne Einfuegen
{
- pUndoDoc->InitUndo( pDoc, nDestTab, nDestTab ); // nur Zieltabelle
- pDoc->CopyToDocument( aMaxRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nDestTab, nDestTab ); // nur Zieltabelle
+ rDoc.CopyToDocument( aMaxRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
}
}
@@ -351,9 +351,9 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
// DeleteAreaTab loescht auch MERGE_FLAG Attribute
if (bDoInsert)
- pDoc->FitBlock( aOldRange, aNewRange ); // incl. loeschen
+ rDoc.FitBlock( aOldRange, aNewRange ); // incl. loeschen
else
- pDoc->DeleteAreaTab( aMaxRange, IDF_ALL & ~IDF_NOTE );
+ rDoc.DeleteAreaTab( aMaxRange, IDF_ALL & ~IDF_NOTE );
// Daten kopieren
@@ -366,7 +366,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
{
OUString aToken( aTempArea.getToken( 0, ';', nStringIx ) );
ScRange aTokenRange;
- if( FindExtRange( aTokenRange, pSrcDoc, aToken ) )
+ if( FindExtRange( aTokenRange, &rSrcDoc, aToken ) )
{
SCTAB nSrcTab = aTokenRange.aStart.Tab();
ScMarkData aSourceMark;
@@ -374,14 +374,14 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
aSourceMark.SetMarkArea( aTokenRange );
ScClipParam aClipParam(aTokenRange, false);
- pSrcDoc->CopyToClip(aClipParam, &aClipDoc, &aSourceMark);
+ rSrcDoc.CopyToClip(aClipParam, &aClipDoc, &aSourceMark);
if ( aClipDoc.HasAttrib( 0,0,nSrcTab, MAXCOL,MAXROW,nSrcTab,
HASATTR_MERGED | HASATTR_OVERLAPPED ) )
{
//! ResetAttrib am Dokument !!!
- ScPatternAttr aPattern( pSrcDoc->GetPool() );
+ ScPatternAttr aPattern( rSrcDoc.GetPool() );
aPattern.GetItemSet().Put( ScMergeAttr() ); // Defaults
aPattern.GetItemSet().Put( ScMergeFlagAttr() );
aClipDoc.ApplyPatternAreaTab( 0,0, MAXCOL,MAXROW, nSrcTab, aPattern );
@@ -392,7 +392,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
ScMarkData aDestMark;
aDestMark.SelectOneTable( nDestTab );
aDestMark.SetMarkArea( aNewTokenRange );
- pDoc->CopyFromClip( aNewTokenRange, aDestMark, IDF_ALL, NULL, &aClipDoc, false );
+ rDoc.CopyFromClip( aNewTokenRange, aDestMark, IDF_ALL, NULL, &aClipDoc, false );
aNewTokenRange.aStart.SetRow( aNewTokenRange.aEnd.Row() + 2 );
}
}
@@ -400,7 +400,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
else
{
OUString aErr = ScGlobal::GetRscString(STR_LINKERROR);
- pDoc->SetString( aDestPos.Col(), aDestPos.Row(), aDestPos.Tab(), aErr );
+ rDoc.SetString( aDestPos.Col(), aDestPos.Row(), aDestPos.Tab(), aErr );
}
// Undo eintragen
@@ -408,8 +408,8 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
if ( bAddUndo && bUndo)
{
ScDocument* pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRedoDoc->InitUndo( pDoc, nDestTab, nDestTab );
- pDoc->CopyToDocument( aNewRange, IDF_ALL & ~IDF_NOTE, false, pRedoDoc );
+ pRedoDoc->InitUndo( &rDoc, nDestTab, nDestTab );
+ rDoc.CopyToDocument( aNewRange, IDF_ALL & ~IDF_NOTE, false, pRedoDoc );
pImpl->m_pDocSh->GetUndoManager()->AddUndoAction(
new ScUndoUpdateAreaLink( pImpl->m_pDocSh,
@@ -468,7 +468,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
aRef->DoClose();
- pDoc->SetInLinkUpdate( false );
+ rDoc.SetInLinkUpdate( false );
if (bCanDo)
{
@@ -476,7 +476,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
//! also notify Uno objects if file name was changed!
ScLinkRefreshedHint aHint;
aHint.SetAreaLink( aDestPos );
- pDoc->BroadcastUno( aHint );
+ rDoc.BroadcastUno( aHint );
}
return bCanDo;
diff --git a/sc/source/ui/docshell/datastream.cxx b/sc/source/ui/docshell/datastream.cxx
index 5b9951c6769a..84f4db54704f 100644
--- a/sc/source/ui/docshell/datastream.cxx
+++ b/sc/source/ui/docshell/datastream.cxx
@@ -306,7 +306,7 @@ DataStream* DataStream::Set(
sal_Int32 nLimit, MoveType eMove, sal_uInt32 nSettings)
{
DataStream* pLink = new DataStream(pShell, rURL, rRange, nLimit, eMove, nSettings);
- sc::DocumentLinkManager& rMgr = pShell->GetDocument()->GetDocLinkManager();
+ sc::DocumentLinkManager& rMgr = pShell->GetDocument().GetDocLinkManager();
rMgr.setDataStream(pLink);
return pLink;
}
@@ -314,8 +314,7 @@ DataStream* DataStream::Set(
DataStream::DataStream(ScDocShell *pShell, const OUString& rURL, const ScRange& rRange,
sal_Int32 nLimit, MoveType eMove, sal_uInt32 nSettings) :
mpDocShell(pShell),
- mpDoc(mpDocShell->GetDocument()),
- maDocAccess(*mpDoc),
+ maDocAccess(mpDocShell->GetDocument()),
meOrigMove(NO_MOVE),
meMove(NO_MOVE),
mbRunning(false),
@@ -546,7 +545,7 @@ void DataStream::Text2Doc()
if (meMove == RANGE_DOWN)
{
++mnCurRow;
-// mpDocShell->GetViewData()->GetView()->AlignToCursor(
+// mpDocShell->GetViewData().GetView()->AlignToCursor(
// maStartRange.aStart.Col(), mnCurRow, SC_FOLLOW_JUMP);
}
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index deaf24481a34..d6c9a0df990a 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -58,9 +58,9 @@ bool ScDBDocFunc::AddDBRange( const OUString& rName, const ScRange& rRange, bool
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- ScDBCollection* pDocColl = pDoc->GetDBCollection();
- bool bUndo (pDoc->IsUndoEnabled());
+ ScDocument& rDoc = rDocShell.GetDocument();
+ ScDBCollection* pDocColl = rDoc.GetDBCollection();
+ bool bUndo (rDoc.IsUndoEnabled());
ScDBCollection* pUndoColl = NULL;
if (bUndo)
@@ -73,13 +73,13 @@ bool ScDBDocFunc::AddDBRange( const OUString& rName, const ScRange& rRange, bool
// #i55926# While loading XML, formula cells only have a single string token,
// so CompileDBFormula would never find any name (index) tokens, and would
// unnecessarily loop through all cells.
- bool bCompile = !pDoc->IsImportingXML();
+ bool bCompile = !rDoc.IsImportingXML();
bool bOk;
if ( bCompile )
- pDoc->CompileDBFormula( true ); // CreateFormulaString
+ rDoc.CompileDBFormula( true ); // CreateFormulaString
if ( rName == STR_DB_LOCAL_NONAME )
{
- pDoc->SetAnonymousDBData(rRange.aStart.Tab() , pNew);
+ rDoc.SetAnonymousDBData(rRange.aStart.Tab() , pNew);
bOk = true;
}
else
@@ -87,7 +87,7 @@ bool ScDBDocFunc::AddDBRange( const OUString& rName, const ScRange& rRange, bool
bOk = pDocColl->getNamedDBs().insert(pNew);
}
if ( bCompile )
- pDoc->CompileDBFormula( false ); // CompileFormulaString
+ rDoc.CompileDBFormula( false ); // CompileFormulaString
if (!bOk)
{
@@ -111,9 +111,9 @@ bool ScDBDocFunc::AddDBRange( const OUString& rName, const ScRange& rRange, bool
bool ScDBDocFunc::DeleteDBRange(const OUString& rName)
{
bool bDone = false;
- ScDocument* pDoc = rDocShell.GetDocument();
- ScDBCollection* pDocColl = pDoc->GetDBCollection();
- bool bUndo = pDoc->IsUndoEnabled();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ ScDBCollection* pDocColl = rDoc.GetDBCollection();
+ bool bUndo = rDoc.IsUndoEnabled();
ScDBCollection::NamedDBs& rDBs = pDocColl->getNamedDBs();
const ScDBData* p = rDBs.findByUpperName(ScGlobal::pCharClass->uppercase(rName));
@@ -125,9 +125,9 @@ bool ScDBDocFunc::DeleteDBRange(const OUString& rName)
if (bUndo)
pUndoColl = new ScDBCollection( *pDocColl );
- pDoc->CompileDBFormula( true ); // CreateFormulaString
+ rDoc.CompileDBFormula( true ); // CreateFormulaString
rDBs.erase(*p);
- pDoc->CompileDBFormula( false ); // CompileFormulaString
+ rDoc.CompileDBFormula( false ); // CompileFormulaString
if (bUndo)
{
@@ -147,9 +147,9 @@ bool ScDBDocFunc::DeleteDBRange(const OUString& rName)
bool ScDBDocFunc::RenameDBRange( const OUString& rOld, const OUString& rNew )
{
bool bDone = false;
- ScDocument* pDoc = rDocShell.GetDocument();
- ScDBCollection* pDocColl = pDoc->GetDBCollection();
- bool bUndo = pDoc->IsUndoEnabled();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ ScDBCollection* pDocColl = rDoc.GetDBCollection();
+ bool bUndo = rDoc.IsUndoEnabled();
ScDBCollection::NamedDBs& rDBs = pDocColl->getNamedDBs();
const ScDBData* pOld = rDBs.findByUpperName(ScGlobal::pCharClass->uppercase(rOld));
const ScDBData* pNew = rDBs.findByUpperName(ScGlobal::pCharClass->uppercase(rNew));
@@ -161,16 +161,16 @@ bool ScDBDocFunc::RenameDBRange( const OUString& rOld, const OUString& rNew )
ScDBCollection* pUndoColl = new ScDBCollection( *pDocColl );
- pDoc->CompileDBFormula(true); // CreateFormulaString
+ rDoc.CompileDBFormula(true); // CreateFormulaString
rDBs.erase(*pOld);
bool bInserted = rDBs.insert(pNewData);
if (!bInserted) // Fehler -> alten Zustand wiederherstellen
{
delete pNewData;
- pDoc->SetDBCollection(pUndoColl); // gehoert dann dem Dokument
+ rDoc.SetDBCollection(pUndoColl); // gehoert dann dem Dokument
}
- pDoc->CompileDBFormula( false ); // CompileFormulaString
+ rDoc.CompileDBFormula( false ); // CompileFormulaString
if (bInserted) // Einfuegen hat geklappt
{
@@ -195,9 +195,9 @@ bool ScDBDocFunc::RenameDBRange( const OUString& rOld, const OUString& rNew )
bool ScDBDocFunc::ModifyDBData( const ScDBData& rNewData )
{
bool bDone = false;
- ScDocument* pDoc = rDocShell.GetDocument();
- ScDBCollection* pDocColl = pDoc->GetDBCollection();
- bool bUndo = pDoc->IsUndoEnabled();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ ScDBCollection* pDocColl = rDoc.GetDBCollection();
+ bool bUndo = rDoc.IsUndoEnabled();
ScDBData* pData = NULL;
if (rNewData.GetName() == STR_DB_LOCAL_NONAME)
@@ -205,7 +205,7 @@ bool ScDBDocFunc::ModifyDBData( const ScDBData& rNewData )
ScRange aRange;
rNewData.GetArea(aRange);
SCTAB nTab = aRange.aStart.Tab();
- pData = pDoc->GetAnonymousDBData(nTab);
+ pData = rDoc.GetAnonymousDBData(nTab);
}
else
pData = pDocColl->getNamedDBs().findByUpperName(rNewData.GetUpperName());
@@ -224,7 +224,7 @@ bool ScDBDocFunc::ModifyDBData( const ScDBData& rNewData )
*pData = rNewData;
if (bAreaChanged)
- pDoc->CompileDBFormula();
+ rDoc.CompileDBFormula();
if (bUndo)
{
@@ -245,17 +245,17 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bRecord, bool bApi, bo
//! auch fuer ScDBFunc::RepeatDB benutzen!
bool bDone = false;
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScDBData* pDBData = NULL;
if (bIsUnnamed)
{
- pDBData = pDoc->GetAnonymousDBData( aTab );
+ pDBData = rDoc.GetAnonymousDBData( aTab );
}
else
{
- ScDBCollection* pColl = pDoc->GetDBCollection();
+ ScDBCollection* pColl = rDoc.GetDBCollection();
if (pColl)
pDBData = pColl->getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(rDBName));
}
@@ -281,7 +281,7 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bRecord, bool bApi, bo
ScRange aNewQuery;
if (bQuery && !aQueryParam.bInplace)
{
- ScDBData* pDest = pDoc->GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
+ ScDBData* pDest = rDoc.GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
aQueryParam.nDestTab, true );
if (pDest && pDest->IsDoSize())
{
@@ -306,9 +306,9 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bRecord, bool bApi, bo
if (bRecord)
{
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
if (pTable)
{
pUndoTab = new ScOutlineTable( *pTable );
@@ -316,31 +316,31 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bRecord, bool bApi, bo
// column/row state
SCCOLROW nOutStartCol, nOutEndCol;
SCCOLROW nOutStartRow, nOutEndRow;
- pTable->GetColArray()->GetRange( nOutStartCol, nOutEndCol );
- pTable->GetRowArray()->GetRange( nOutStartRow, nOutEndRow );
+ pTable->GetColArray().GetRange( nOutStartCol, nOutEndCol );
+ pTable->GetRowArray().GetRange( nOutStartRow, nOutEndRow );
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true );
- pDoc->CopyToDocument( static_cast<SCCOL>(nOutStartCol), 0,
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ rDoc.CopyToDocument( static_cast<SCCOL>(nOutStartCol), 0,
nTab, static_cast<SCCOL>(nOutEndCol), MAXROW, nTab,
IDF_NONE, false, pUndoDoc );
- pDoc->CopyToDocument( 0, static_cast<SCROW>(nOutStartRow),
+ rDoc.CopyToDocument( 0, static_cast<SCROW>(nOutStartRow),
nTab, MAXCOL, static_cast<SCROW>(nOutEndRow), nTab,
IDF_NONE, false, pUndoDoc );
}
else
- pUndoDoc->InitUndo( pDoc, nTab, nTab, false, true );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
// Datenbereich sichern - incl. Filter-Ergebnis
- pDoc->CopyToDocument( 0,nStartRow,nTab, MAXCOL,nEndRow,nTab, IDF_ALL, false, pUndoDoc );
+ rDoc.CopyToDocument( 0,nStartRow,nTab, MAXCOL,nEndRow,nTab, IDF_ALL, false, pUndoDoc );
// alle Formeln wegen Referenzen
- pDoc->CopyToDocument( 0,0,0, MAXCOL,MAXROW,nTabCount-1, IDF_FORMULA, false, pUndoDoc );
+ rDoc.CopyToDocument( 0,0,0, MAXCOL,MAXROW,nTabCount-1, IDF_FORMULA, false, pUndoDoc );
// DB- und andere Bereiche
- ScRangeName* pDocRange = pDoc->GetRangeName();
+ ScRangeName* pDocRange = rDoc.GetRangeName();
if (!pDocRange->empty())
pUndoRange = new ScRangeName( *pDocRange );
- ScDBCollection* pDocDB = pDoc->GetDBCollection();
+ ScDBCollection* pDocDB = rDoc.GetDBCollection();
if (!pDocDB->empty())
pUndoDB = new ScDBCollection( *pDocDB );
}
@@ -390,7 +390,7 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bRecord, bool bApi, bo
const ScRange* pNew = NULL;
if (bQuerySize)
{
- ScDBData* pDest = pDoc->GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
+ ScDBData* pDest = rDoc.GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
aQueryParam.nDestTab, true );
if (pDest)
{
@@ -427,13 +427,13 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
SCTAB nSrcTab = nTab;
- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
- ScDBData* pDBData = pDoc->GetDBAtArea( nTab, rSortParam.nCol1, rSortParam.nRow1,
+ ScDBData* pDBData = rDoc.GetDBAtArea( nTab, rSortParam.nCol1, rSortParam.nRow1,
rSortParam.nCol2, rSortParam.nRow2 );
if (!pDBData)
{
@@ -459,13 +459,13 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
}
nTab = rSortParam.nDestTab;
- pDestData = pDoc->GetDBAtCursor( rSortParam.nDestCol, rSortParam.nDestRow,
+ pDestData = rDoc.GetDBAtCursor( rSortParam.nDestCol, rSortParam.nDestRow,
rSortParam.nDestTab, true );
if (pDestData)
pDestData->GetArea(aOldDest);
}
- ScEditableTester aTester( pDoc, nTab, aLocalParam.nCol1,aLocalParam.nRow1,
+ ScEditableTester aTester( &rDoc, nTab, aLocalParam.nCol1,aLocalParam.nRow1,
aLocalParam.nCol2,aLocalParam.nRow2 );
if (!aTester.IsEditable())
{
@@ -474,7 +474,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
return false;
}
- if ( aLocalParam.bIncludePattern && pDoc->HasAttrib(
+ if ( aLocalParam.bIncludePattern && rDoc.HasAttrib(
aLocalParam.nCol1, aLocalParam.nRow1, nTab,
aLocalParam.nCol2, aLocalParam.nRow2, nTab,
HASATTR_MERGED | HASATTR_OVERLAPPED ) )
@@ -495,14 +495,14 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
// Calculate the script types for all cells in the sort range beforehand.
// This will speed up the row height adjustment that takes place after the
// sort.
- pDoc->UpdateScriptTypes(
+ rDoc.UpdateScriptTypes(
ScAddress(aLocalParam.nCol1,nStartRow,nTab),
aLocalParam.nCol2-aLocalParam.nCol1+1,
aLocalParam.nRow2-nStartRow+1);
// No point adjusting row heights after the sort when all rows have the same height.
bool bUniformRowHeight =
- pDoc->HasUniformRowHeight(nTab, nStartRow, aLocalParam.nRow2);
+ rDoc.HasUniformRowHeight(nTab, nStartRow, aLocalParam.nRow2);
bool bRepeatQuery = false; // bestehenden Filter wiederholen?
ScQueryParam aQueryParam;
@@ -527,14 +527,14 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
// Zeilenhoehen immer (wegen automatischer Anpassung)
//! auf ScBlockUndo umstellen
- pUndoDoc->InitUndo( pDoc, nTab, nTab, false, true );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
/* #i59745# Do not copy note captions to undo document. All existing
caption objects will be repositioned while sorting which is tracked
in drawing undo. When undo is executed, the old positions will be
restored, and the cells with the old notes (which still refer to the
existing captions) will be copied back into the source document. */
- pDoc->CopyToDocument( aLocalParam.nCol1, aLocalParam.nRow1, nTab,
+ rDoc.CopyToDocument( aLocalParam.nCol1, aLocalParam.nRow1, nTab,
aLocalParam.nCol2, aLocalParam.nRow2, nTab,
IDF_ALL|IDF_NOCAPTIONS, false, pUndoDoc );
@@ -547,18 +547,18 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
caption objects are reinserted with drawing undo, and the cells
with the old notes (which still refer to the existing captions)
will be copied back into the source document. */
- pDoc->CopyToDocument( aOldDest, IDF_ALL|IDF_NOCAPTIONS, false, pUndoDoc );
+ rDoc.CopyToDocument( aOldDest, IDF_ALL|IDF_NOCAPTIONS, false, pUndoDoc );
pR = &aOldDest;
}
// Zeilenhoehen immer (wegen automatischer Anpassung)
//! auf ScBlockUndo umstellen
// if (bRepeatQuery)
- pDoc->CopyToDocument( 0, aLocalParam.nRow1, nTab, MAXCOL, aLocalParam.nRow2, nTab,
+ rDoc.CopyToDocument( 0, aLocalParam.nRow1, nTab, MAXCOL, aLocalParam.nRow2, nTab,
IDF_NONE, false, pUndoDoc );
ScDBCollection* pUndoDB = NULL;
- ScDBCollection* pDocDB = pDoc->GetDBCollection();
+ ScDBCollection* pDocDB = rDoc.GetDBCollection();
if (!pDocDB->empty())
pUndoDB = new ScDBCollection( *pDocDB );
@@ -573,7 +573,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
if ( bCopy )
{
if (pDestData)
- pDoc->DeleteAreaTab(aOldDest, IDF_CONTENTS); // Zielbereich vorher loeschen
+ rDoc.DeleteAreaTab(aOldDest, IDF_CONTENTS); // Zielbereich vorher loeschen
ScRange aSource( rSortParam.nCol1,rSortParam.nRow1,nSrcTab,
rSortParam.nCol2,rSortParam.nRow2,nSrcTab );
@@ -586,7 +586,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
if (aLocalParam.GetSortKeyCount() && aLocalParam.maKeyState[0].bDoSort)
{
ScProgress aProgress(&rDocShell, ScGlobal::GetRscString(STR_PROGRESS_SORTING), 0);
- pDoc->Sort( nTab, aLocalParam, bRepeatQuery, &aProgress );
+ rDoc.Sort( nTab, aLocalParam, bRepeatQuery, &aProgress );
}
bool bSave = true;
@@ -641,7 +641,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
ScRange aDirtyRange(
aLocalParam.nCol1, nStartRow, nTab,
aLocalParam.nCol2, aLocalParam.nRow2, nTab);
- pDoc->SetDirty( aDirtyRange );
+ rDoc.SetDirty( aDirtyRange );
if (bPaint)
{
@@ -683,10 +683,10 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScDBData* pDBData = pDoc->GetDBAtArea( nTab, rQueryParam.nCol1, rQueryParam.nRow1,
+ ScDBData* pDBData = rDoc.GetDBAtArea( nTab, rQueryParam.nCol1, rQueryParam.nRow1,
rQueryParam.nCol2, rQueryParam.nRow2 );
if (!pDBData)
{
@@ -736,7 +736,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
return false;
}
- ScEditableTester aTester( pDoc, nDestTab, aLocalParam.nCol1,aLocalParam.nRow1,
+ ScEditableTester aTester( &rDoc, nDestTab, aLocalParam.nCol1,aLocalParam.nRow1,
aLocalParam.nCol2,aLocalParam.nRow2);
if (!aTester.IsEditable())
{
@@ -745,7 +745,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
return false;
}
- pDestData = pDoc->GetDBAtCursor( rQueryParam.nDestCol, rQueryParam.nDestRow,
+ pDestData = rDoc.GetDBAtCursor( rQueryParam.nDestCol, rQueryParam.nDestRow,
rQueryParam.nDestTab, true );
if (pDestData)
{
@@ -765,12 +765,12 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
SCROW nTestRow = rQueryParam.nDestRow +
( aLocalParam.bHasHeader ? 1 : 0 );
while ( nTestCol <= MAXCOL &&
- pDoc->GetCellType(ScAddress( nTestCol, nTestRow, nTab )) == CELLTYPE_FORMULA )
+ rDoc.GetCellType(ScAddress( nTestCol, nTestRow, nTab )) == CELLTYPE_FORMULA )
++nTestCol, ++nFormulaCols;
}
bKeepFmt = pDestData->IsKeepFmt();
- if ( bDoSize && !pDoc->CanFitBlock( aOldDest, aDestTotal ) )
+ if ( bDoSize && !rDoc.CanFitBlock( aOldDest, aDestTotal ) )
{
if (!bApi)
rDocShell.ErrorMessage(STR_MSSG_DOSUBTOTALS_2); // kann keine Zeilen einfuegen
@@ -802,30 +802,30 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
if (bCopy)
{
- pUndoDoc->InitUndo( pDoc, nDestTab, nDestTab, false, true );
- pDoc->CopyToDocument( aLocalParam.nCol1, aLocalParam.nRow1, nDestTab,
+ pUndoDoc->InitUndo( &rDoc, nDestTab, nDestTab, false, true );
+ rDoc.CopyToDocument( aLocalParam.nCol1, aLocalParam.nRow1, nDestTab,
aLocalParam.nCol2, aLocalParam.nRow2, nDestTab,
IDF_ALL, false, pUndoDoc );
// Attribute sichern, falls beim Filtern mitkopiert
if (pDestData)
{
- pDoc->CopyToDocument( aOldDest, IDF_ALL, false, pUndoDoc );
+ rDoc.CopyToDocument( aOldDest, IDF_ALL, false, pUndoDoc );
pOld = &aOldDest;
}
}
else
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, false, true );
- pDoc->CopyToDocument( 0, rQueryParam.nRow1, nTab, MAXCOL, rQueryParam.nRow2, nTab,
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ rDoc.CopyToDocument( 0, rQueryParam.nRow1, nTab, MAXCOL, rQueryParam.nRow2, nTab,
IDF_NONE, false, pUndoDoc );
}
- ScDBCollection* pDocDB = pDoc->GetDBCollection();
+ ScDBCollection* pDocDB = rDoc.GetDBCollection();
if (!pDocDB->empty())
pUndoDB = new ScDBCollection( *pDocDB );
- pDoc->BeginDrawUndo();
+ rDoc.BeginDrawUndo();
}
ScDocument* pAttribDoc = NULL;
@@ -845,18 +845,18 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
aAttribRange.aEnd.SetCol( aAttribRange.aEnd.Col() + nFormulaCols );
pAttribDoc = new ScDocument( SCDOCMODE_UNDO );
- pAttribDoc->InitUndo( pDoc, nDestTab, nDestTab, false, true );
- pDoc->CopyToDocument( aAttribRange, IDF_ATTRIB, false, pAttribDoc );
+ pAttribDoc->InitUndo( &rDoc, nDestTab, nDestTab, false, true );
+ rDoc.CopyToDocument( aAttribRange, IDF_ATTRIB, false, pAttribDoc );
}
if ( bDoSize )
- pDoc->FitBlock( aOldDest, aDestTotal );
+ rDoc.FitBlock( aOldDest, aDestTotal );
else
- pDoc->DeleteAreaTab(aOldDest, IDF_ALL); // einfach loeschen
+ rDoc.DeleteAreaTab(aOldDest, IDF_ALL); // einfach loeschen
}
// Filtern am Dokument ausfuehren
- SCSIZE nCount = pDoc->Query( nTab, rQueryParam, bKeepSub );
+ SCSIZE nCount = rDoc.Query( nTab, rQueryParam, bKeepSub );
if (bCopy)
{
aLocalParam.nRow2 = aLocalParam.nRow1 + nCount;
@@ -870,7 +870,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
ScRange aNewDest( aLocalParam.nCol1, aLocalParam.nRow1, nDestTab,
aLocalParam.nCol2, aLocalParam.nRow2, nDestTab );
- pDoc->FitBlock( aDestTotal, aNewDest, false ); // sal_False - nicht loeschen
+ rDoc.FitBlock( aDestTotal, aNewDest, false ); // sal_False - nicht loeschen
if ( nFormulaCols > 0 )
{
@@ -881,7 +881,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
aLocalParam.nCol2+nFormulaCols, aLocalParam.nRow2, nDestTab );
ScRange aOldForm = aNewForm;
aOldForm.aEnd.SetRow( aOldDest.aEnd.Row() );
- pDoc->FitBlock( aOldForm, aNewForm, false );
+ rDoc.FitBlock( aOldForm, aNewForm, false );
ScMarkData aMark;
aMark.SelectOneTable(nDestTab);
@@ -889,10 +889,10 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
sal_uLong nProgCount = nFormulaCols;
nProgCount *= aLocalParam.nRow2 - nFStartY;
- ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScProgress aProgress( rDoc.GetDocumentShell(),
ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
- pDoc->Fill( aLocalParam.nCol2+1, nFStartY,
+ rDoc.Fill( aLocalParam.nCol2+1, nFStartY,
aLocalParam.nCol2+nFormulaCols, nFStartY, &aProgress, aMark,
aLocalParam.nRow2 - nFStartY,
FILL_TO_BOTTOM, FILL_SIMPLE );
@@ -906,7 +906,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
{
ScRange aHdrRange = aAttribRange;
aHdrRange.aEnd.SetRow( aHdrRange.aStart.Row() );
- pAttribDoc->CopyToDocument( aHdrRange, IDF_ATTRIB, false, pDoc );
+ pAttribDoc->CopyToDocument( aHdrRange, IDF_ATTRIB, false, &rDoc );
}
// Daten
@@ -919,11 +919,11 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
OSL_ENSURE(pSrcPattern,"Pattern ist 0");
if (pSrcPattern)
{
- pDoc->ApplyPatternAreaTab( nCol, nAttrRow, nCol, aLocalParam.nRow2,
+ rDoc.ApplyPatternAreaTab( nCol, nAttrRow, nCol, aLocalParam.nRow2,
nDestTab, *pSrcPattern );
const ScStyleSheet* pStyle = pSrcPattern->GetStyleSheet();
if (pStyle)
- pDoc->ApplyStyleAreaTab( nCol, nAttrRow, nCol, aLocalParam.nRow2,
+ rDoc.ApplyStyleAreaTab( nCol, nAttrRow, nCol, aLocalParam.nRow2,
nDestTab, *pStyle );
}
}
@@ -974,13 +974,13 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
if (!bCopy)
{
- pDoc->InvalidatePageBreaks(nTab);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.InvalidatePageBreaks(nTab);
+ rDoc.UpdatePageBreaks( nTab );
}
// #i23299# Subtotal functions depend on cell's filtered states.
ScRange aDirtyRange(0 , aLocalParam.nRow1, nDestTab, MAXCOL, aLocalParam.nRow2, nDestTab);
- pDoc->SetSubTotalCellsDirty(aDirtyRange);
+ rDoc.SetSubTotalCellsDirty(aDirtyRange);
if ( bRecord )
{
@@ -1028,10 +1028,10 @@ bool ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
bool bDo = !rParam.bRemoveOnly; // sal_False = nur loeschen
bool bRet = false;
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScDBData* pDBData = pDoc->GetDBAtArea( nTab, rParam.nCol1, rParam.nRow1,
+ ScDBData* pDBData = rDoc.GetDBAtArea( nTab, rParam.nCol1, rParam.nRow1,
rParam.nCol2, rParam.nRow2 );
if (!pDBData)
{
@@ -1039,7 +1039,7 @@ bool ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
return false;
}
- ScEditableTester aTester( pDoc, nTab, 0,rParam.nRow1+1, MAXCOL,MAXROW );
+ ScEditableTester aTester( &rDoc, nTab, 0,rParam.nRow1+1, MAXCOL,MAXROW );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -1047,7 +1047,7 @@ bool ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
return false;
}
- if (pDoc->HasAttrib( rParam.nCol1, rParam.nRow1+1, nTab,
+ if (rDoc.HasAttrib( rParam.nCol1, rParam.nRow1+1, nTab,
rParam.nCol2, rParam.nRow2, nTab, HASATTR_MERGED | HASATTR_OVERLAPPED ))
{
if (!bApi)
@@ -1057,7 +1057,7 @@ bool ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
bool bOk = true;
if (rParam.bReplace)
- if (pDoc->TestRemoveSubTotals( nTab, rParam ))
+ if (rDoc.TestRemoveSubTotals( nTab, rParam ))
{
bOk = ( MessBox( rDocShell.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
// "StarCalc" "Daten loeschen?"
@@ -1081,9 +1081,9 @@ bool ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
{
bool bOldFilter = bDo && rParam.bDoSort;
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
if (pTable)
{
pUndoTab = new ScOutlineTable( *pTable );
@@ -1091,40 +1091,40 @@ bool ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
// column/row state
SCCOLROW nOutStartCol, nOutEndCol;
SCCOLROW nOutStartRow, nOutEndRow;
- pTable->GetColArray()->GetRange( nOutStartCol, nOutEndCol );
- pTable->GetRowArray()->GetRange( nOutStartRow, nOutEndRow );
+ pTable->GetColArray().GetRange( nOutStartCol, nOutEndCol );
+ pTable->GetRowArray().GetRange( nOutStartRow, nOutEndRow );
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true );
- pDoc->CopyToDocument( static_cast<SCCOL>(nOutStartCol), 0, nTab, static_cast<SCCOL>(nOutEndCol), MAXROW, nTab, IDF_NONE, false, pUndoDoc );
- pDoc->CopyToDocument( 0, nOutStartRow, nTab, MAXCOL, nOutEndRow, nTab, IDF_NONE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ rDoc.CopyToDocument( static_cast<SCCOL>(nOutStartCol), 0, nTab, static_cast<SCCOL>(nOutEndCol), MAXROW, nTab, IDF_NONE, false, pUndoDoc );
+ rDoc.CopyToDocument( 0, nOutStartRow, nTab, MAXCOL, nOutEndRow, nTab, IDF_NONE, false, pUndoDoc );
}
else
- pUndoDoc->InitUndo( pDoc, nTab, nTab, false, bOldFilter );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, bOldFilter );
// Datenbereich sichern - incl. Filter-Ergebnis
- pDoc->CopyToDocument( 0,rParam.nRow1+1,nTab, MAXCOL,rParam.nRow2,nTab,
+ rDoc.CopyToDocument( 0,rParam.nRow1+1,nTab, MAXCOL,rParam.nRow2,nTab,
IDF_ALL, false, pUndoDoc );
// alle Formeln wegen Referenzen
- pDoc->CopyToDocument( 0,0,0, MAXCOL,MAXROW,nTabCount-1,
+ rDoc.CopyToDocument( 0,0,0, MAXCOL,MAXROW,nTabCount-1,
IDF_FORMULA, false, pUndoDoc );
// DB- und andere Bereiche
- ScRangeName* pDocRange = pDoc->GetRangeName();
+ ScRangeName* pDocRange = rDoc.GetRangeName();
if (!pDocRange->empty())
pUndoRange = new ScRangeName( *pDocRange );
- ScDBCollection* pDocDB = pDoc->GetDBCollection();
+ ScDBCollection* pDocDB = rDoc.GetDBCollection();
if (!pDocDB->empty())
pUndoDB = new ScDBCollection( *pDocDB );
}
-// pDoc->SetOutlineTable( nTab, NULL );
- ScOutlineTable* pOut = pDoc->GetOutlineTable( nTab );
+// rDoc.SetOutlineTable( nTab, NULL );
+ ScOutlineTable* pOut = rDoc.GetOutlineTable( nTab );
if (pOut)
- pOut->GetRowArray()->RemoveAll(); // nur Zeilen-Outlines loeschen
+ pOut->GetRowArray().RemoveAll(); // nur Zeilen-Outlines loeschen
if (rParam.bReplace)
- pDoc->RemoveSubTotals( nTab, aNewParam );
+ rDoc.RemoveSubTotals( nTab, aNewParam );
bool bSuccess = true;
if (bDo)
{
@@ -1142,12 +1142,12 @@ bool ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
Sort( nTab, aSortParam, false, false, bApi );
}
- bSuccess = pDoc->DoSubTotals( nTab, aNewParam );
- pDoc->SetDrawPageSize(nTab);
+ bSuccess = rDoc.DoSubTotals( nTab, aNewParam );
+ rDoc.SetDrawPageSize(nTab);
}
ScRange aDirtyRange( aNewParam.nCol1, aNewParam.nRow1, nTab,
aNewParam.nCol2, aNewParam.nRow2, nTab );
- pDoc->SetDirty( aDirtyRange );
+ rDoc.SetDirty( aDirtyRange );
if (bRecord)
{
@@ -1169,7 +1169,7 @@ bool ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
// merken
pDBData->SetSubTotalParam( aNewParam );
pDBData->SetArea( nTab, aNewParam.nCol1,aNewParam.nRow1, aNewParam.nCol2,aNewParam.nRow2 );
- pDoc->CompileDBFormula();
+ rDoc.CompileDBFormula();
rDocShell.PostPaint(ScRange(0, 0, nTab, MAXCOL,MAXROW,nTab),
PAINT_GRID | PAINT_LEFT | PAINT_TOP | PAINT_SIZE);
@@ -1199,8 +1199,8 @@ bool lcl_EmptyExcept( ScDocument* pDoc, const ScRange& rRange, const ScRange& rE
bool isEditable(ScDocShell& rDocShell, const ScRangeList& rRanges, bool bApi)
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if (!rDocShell.IsEditable() || pDoc->GetChangeTrack())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (!rDocShell.IsEditable() || rDoc.GetChangeTrack())
{
// not recorded -> disallow
if (!bApi)
@@ -1212,7 +1212,7 @@ bool isEditable(ScDocShell& rDocShell, const ScRangeList& rRanges, bool bApi)
for (size_t i = 0, n = rRanges.size(); i < n; ++i)
{
const ScRange* p = rRanges[i];
- ScEditableTester aTester(pDoc, *p);
+ ScEditableTester aTester(&rDoc, *p);
if (!aTester.IsEditable())
{
if (!bApi)
@@ -1237,7 +1237,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
bool checkNewOutputRange(ScDPObject& rDPObj, ScDocShell& rDocShell, ScRange& rNewOut, bool bApi)
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
bool bOverflow = false;
rNewOut = rDPObj.GetNewOutputRange(bOverflow);
@@ -1265,7 +1265,7 @@ bool checkNewOutputRange(ScDPObject& rDPObj, ScDocShell& rDocShell, ScRange& rNe
return false;
}
- ScEditableTester aTester(pDoc, rNewOut);
+ ScEditableTester aTester(&rDoc, rNewOut);
if (!aTester.IsEditable())
{
// destination area isn't editable
@@ -1318,12 +1318,12 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
ScDPObject aUndoDPObj(*pOldObj); // for undo or revert on failure
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
if (bRecord)
- createUndoDoc(pOldUndoDoc, pDoc, pOldObj->GetOutRange());
+ createUndoDoc(pOldUndoDoc, &rDoc, pOldObj->GetOutRange());
pNewObj->WriteSourceDataTo(*pOldObj); // copy source data
@@ -1339,7 +1339,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
// make sure the table has a name (not set by dialog)
if (pOldObj->GetName().isEmpty())
- pOldObj->SetName( pDoc->GetDPCollection()->CreateNewName() );
+ pOldObj->SetName( rDoc.GetDPCollection()->CreateNewName() );
ScRange aNewOut;
if (!checkNewOutputRange(*pOldObj, rDocShell, aNewOut, bApi))
@@ -1352,7 +1352,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
if (!bApi)
{
// OutRange of pOldObj (pDestObj) is still old area
- if (!lcl_EmptyExcept(pDoc, aNewOut, pOldObj->GetOutRange()))
+ if (!lcl_EmptyExcept(&rDoc, aNewOut, pOldObj->GetOutRange()))
{
QueryBox aBox( rDocShell.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY) );
@@ -1366,7 +1366,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
}
if (bRecord)
- createUndoDoc(pNewUndoDoc, pDoc, aNewOut);
+ createUndoDoc(pNewUndoDoc, &rDoc, aNewOut);
pOldObj->Output(aNewOut.aStart);
rDocShell.PostPaintGridAll(); //! only necessary parts
@@ -1379,7 +1379,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
}
// notify API objects
- pDoc->BroadcastUno( ScDataPilotModifiedHint(pOldObj->GetName()) );
+ rDoc.BroadcastUno( ScDataPilotModifiedHint(pOldObj->GetName()) );
aModificator.SetDocumentModified();
return true;
@@ -1401,8 +1401,8 @@ bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
if (bRecord)
pUndoDPObj.reset(new ScDPObject(rDPObj)); // copy old settings for undo
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
// delete table
@@ -1411,16 +1411,16 @@ bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
SCTAB nTab = aRange.aStart.Tab();
if (bRecord)
- createUndoDoc(pOldUndoDoc, pDoc, aRange);
+ createUndoDoc(pOldUndoDoc, &rDoc, aRange);
- pDoc->DeleteAreaTab( aRange.aStart.Col(), aRange.aStart.Row(),
+ rDoc.DeleteAreaTab( aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(),
nTab, IDF_ALL );
- pDoc->RemoveFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(),
+ rDoc.RemoveFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(),
nTab, SC_MF_AUTO );
- pDoc->GetDPCollection()->FreeTable(&rDPObj); // object is deleted here
+ rDoc.GetDPCollection()->FreeTable(&rDPObj); // object is deleted here
rDocShell.PostPaintGridAll(); //! only necessary parts
rDocShell.PostPaint(aRange, PAINT_GRID);
@@ -1451,8 +1451,8 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
std::auto_ptr<ScDocument> pNewUndoDoc;
SAL_WNODEPRECATED_DECLARATIONS_POP
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
// output range must be set at pNewObj
@@ -1465,10 +1465,10 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
// #i94570# When changing the output position in the dialog, a new table is created
// with the settings from the old table, including the name.
// So we have to check for duplicate names here (before inserting).
- if (pDoc->GetDPCollection()->GetByName(rDestObj.GetName()))
+ if (rDoc.GetDPCollection()->GetByName(rDestObj.GetName()))
rDestObj.SetName(OUString()); // ignore the invalid name, create a new name below
- if (!pDoc->GetDPCollection()->InsertNewTable(pDestObj.release()))
+ if (!rDoc.GetDPCollection()->InsertNewTable(pDestObj.release()))
// Insertion into collection failed.
return false;
@@ -1478,7 +1478,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
// make sure the table has a name (not set by dialog)
if (rDestObj.GetName().isEmpty())
- rDestObj.SetName(pDoc->GetDPCollection()->CreateNewName());
+ rDestObj.SetName(rDoc.GetDPCollection()->CreateNewName());
bool bOverflow = false;
ScRange aNewOut = rDestObj.GetNewOutputRange(bOverflow);
@@ -1492,7 +1492,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
}
{
- ScEditableTester aTester(pDoc, aNewOut);
+ ScEditableTester aTester(&rDoc, aNewOut);
if (!aTester.IsEditable())
{
// destination area isn't editable
@@ -1506,7 +1506,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
// test if new output area is empty except for old area
if (!bApi)
{
- bool bEmpty = pDoc->IsBlockEmpty(
+ bool bEmpty = rDoc.IsBlockEmpty(
aNewOut.aStart.Tab(), aNewOut.aStart.Col(), aNewOut.aStart.Row(),
aNewOut.aEnd.Col(), aNewOut.aEnd.Row());
@@ -1525,7 +1525,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
}
if (bRecord)
- createUndoDoc(pNewUndoDoc, pDoc, aNewOut);
+ createUndoDoc(pNewUndoDoc, &rDoc, aNewOut);
rDestObj.Output(aNewOut.aStart);
rDocShell.PostPaintGridAll(); //! only necessary parts
@@ -1537,7 +1537,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
}
// notify API objects
- pDoc->BroadcastUno(ScDataPilotModifiedHint(rDestObj.GetName()));
+ rDoc.BroadcastUno(ScDataPilotModifiedHint(rDestObj.GetName()));
aModificator.SetDocumentModified();
return true;
@@ -1558,12 +1558,12 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
ScDPObject aUndoDPObj(rDPObj); // For undo or revert on failure.
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
if (bRecord)
- createUndoDoc(pOldUndoDoc, pDoc, rDPObj.GetOutRange());
+ createUndoDoc(pOldUndoDoc, &rDoc, rDPObj.GetOutRange());
rDPObj.SetAllowMove(false);
rDPObj.ReloadGroupTableData();
@@ -1574,7 +1574,7 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
// make sure the table has a name (not set by dialog)
if (rDPObj.GetName().isEmpty())
- rDPObj.SetName( pDoc->GetDPCollection()->CreateNewName() );
+ rDPObj.SetName( rDoc.GetDPCollection()->CreateNewName() );
ScRange aNewOut;
if (!checkNewOutputRange(rDPObj, rDocShell, aNewOut, bApi))
@@ -1586,7 +1586,7 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
// test if new output area is empty except for old area
if (!bApi)
{
- if (!lcl_EmptyExcept(pDoc, aNewOut, rDPObj.GetOutRange()))
+ if (!lcl_EmptyExcept(&rDoc, aNewOut, rDPObj.GetOutRange()))
{
QueryBox aBox( rDocShell.GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY) );
@@ -1599,7 +1599,7 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
}
if (bRecord)
- createUndoDoc(pNewUndoDoc, pDoc, aNewOut);
+ createUndoDoc(pNewUndoDoc, &rDoc, aNewOut);
rDPObj.Output(aNewOut.aStart);
rDocShell.PostPaintGridAll(); //! only necessary parts
@@ -1612,14 +1612,14 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
}
// notify API objects
- pDoc->BroadcastUno( ScDataPilotModifiedHint(rDPObj.GetName()) );
+ rDoc.BroadcastUno( ScDataPilotModifiedHint(rDPObj.GetName()) );
aModificator.SetDocumentModified();
return true;
}
sal_uLong ScDBDocFunc::RefreshPivotTables(ScDPObject* pDPObj, bool bApi)
{
- ScDPCollection* pDPs = rDocShell.GetDocument()->GetDPCollection();
+ ScDPCollection* pDPs = rDocShell.GetDocument().GetDPCollection();
if (!pDPs)
return 0;
@@ -1645,7 +1645,7 @@ void ScDBDocFunc::RefreshPivotTableGroups(ScDPObject* pDPObj)
if (!pDPObj)
return;
- ScDPCollection* pDPs = rDocShell.GetDocument()->GetDPCollection();
+ ScDPCollection* pDPs = rDocShell.GetDocument().GetDPCollection();
if (!pDPs)
return;
@@ -1681,8 +1681,8 @@ void ScDBDocFunc::UpdateImport( const OUString& rTarget, const svx::ODataAccessD
{
// rTarget is the name of a database range
- ScDocument* pDoc = rDocShell.GetDocument();
- ScDBCollection& rDBColl = *pDoc->GetDBCollection();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ ScDBCollection& rDBColl = *rDoc.GetDBCollection();
const ScDBData* pData = rDBColl.getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(rTarget));
if (!pData)
{
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index 6f7d16161c78..8aec5c0c9feb 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -119,17 +119,17 @@ bool ScDBDocFunc::DoImportUno( const ScAddress& rPos,
bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
const svx::ODataAccessDescriptor* pDescriptor, bool bRecord, bool bAddrInsert )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
ScChangeTrack *pChangeTrack = NULL;
ScRange aChangedRange;
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScDBData* pDBData = NULL;
if ( !bAddrInsert )
{
- pDBData = pDoc->GetDBAtArea( nTab, rParam.nCol1, rParam.nRow1,
+ pDBData = rDoc.GetDBAtArea( nTab, rParam.nCol1, rParam.nRow1,
rParam.nCol2, rParam.nRow2 );
if (!pDBData)
{
@@ -187,7 +187,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
// ImportDoc - also used for Redo
ScDocument* pImportDoc = new ScDocument( SCDOCMODE_UNDO );
- pImportDoc->InitUndo( pDoc, nTab, nTab );
+ pImportDoc->InitUndo( &rDoc, nTab, nTab );
// get data from database into import document
@@ -413,7 +413,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
SCCOL nTestCol = rParam.nCol2 + 1; // right of the data
SCROW nTestRow = rParam.nRow1 + 1; // below the title row
while ( nTestCol <= MAXCOL &&
- pDoc->GetCellType(ScAddress( nTestCol, nTestRow, nTab )) == CELLTYPE_FORMULA )
+ rDoc.GetCellType(ScAddress( nTestCol, nTestRow, nTab )) == CELLTYPE_FORMULA )
++nTestCol, ++nFormulaCols;
}
@@ -421,14 +421,14 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
{
// old and new range editable?
ScEditableTester aTester;
- aTester.TestBlock( pDoc, nTab, rParam.nCol1,rParam.nRow1,rParam.nCol2,rParam.nRow2 );
- aTester.TestBlock( pDoc, nTab, rParam.nCol1,rParam.nRow1,nEndCol,nEndRow );
+ aTester.TestBlock( &rDoc, nTab, rParam.nCol1,rParam.nRow1,rParam.nCol2,rParam.nRow2 );
+ aTester.TestBlock( &rDoc, nTab, rParam.nCol1,rParam.nRow1,nEndCol,nEndRow );
if ( !aTester.IsEditable() )
{
nErrStringId = aTester.GetMessageId();
bSuccess = false;
}
- else if ( (pChangeTrack = pDoc->GetChangeTrack()) != NULL )
+ else if ( (pChangeTrack = rDoc.GetChangeTrack()) != NULL )
aChangedRange = ScRange(rParam.nCol1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab );
}
@@ -439,7 +439,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
rParam.nCol2+nFormulaCols, rParam.nRow2, nTab );
ScRange aNew( rParam.nCol1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab );
- if (!pDoc->CanFitBlock( aOld, aNew ))
+ if (!rDoc.CanFitBlock( aOld, aNew ))
{
nErrStringId = STR_MSSG_DOSUBTOTALS_2; // can't insert cells
bSuccess = false;
@@ -460,14 +460,14 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
SCCOL nMinEndCol = std::min( rParam.nCol2, nEndCol ); // not too much
nMinEndCol = sal::static_int_cast<SCCOL>( nMinEndCol + nFormulaCols ); // only if column count unchanged
pImportDoc->DeleteAreaTab( 0,0, MAXCOL,MAXROW, nTab, IDF_ATTRIB );
- pDoc->CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
+ rDoc.CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
nMinEndCol, rParam.nRow1, nTab,
IDF_ATTRIB, false, pImportDoc );
SCROW nDataStartRow = rParam.nRow1+1;
for (SCCOL nCopyCol=rParam.nCol1; nCopyCol<=nMinEndCol; nCopyCol++)
{
- const ScPatternAttr* pSrcPattern = pDoc->GetPattern(
+ const ScPatternAttr* pSrcPattern = rDoc.GetPattern(
nCopyCol, nDataStartRow, nTab );
pImportDoc->ApplyPatternAreaTab( nCopyCol, nDataStartRow, nCopyCol, nEndRow,
nTab, *pSrcPattern );
@@ -479,7 +479,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
}
// don't set cell protection attribute if table is protected
- if (pDoc->IsTabProtected(nTab))
+ if (rDoc.IsTabProtected(nTab))
{
ScPatternAttr aPattern(pImportDoc->GetPool());
aPattern.GetItemSet().Put( ScProtectionAttr( false,false,false,false ) );
@@ -498,7 +498,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
if ( bRecord )
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nTab, nTab );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab );
if ( !bAddrInsert )
pUndoDBData = new ScDBData( *pDBData );
@@ -513,15 +513,15 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
sal_uInt16 nCopyFlags = IDF_ALL & ~IDF_NOTE;
// nFormulaCols is set only if column count is unchanged
- pDoc->CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
+ rDoc.CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab,
nCopyFlags, false, pUndoDoc );
if ( rParam.nCol2 > nEndCol )
- pDoc->CopyToDocument( nEndCol+1, rParam.nRow1, nTab,
+ rDoc.CopyToDocument( nEndCol+1, rParam.nRow1, nTab,
nUndoEndCol, nUndoEndRow, nTab,
nCopyFlags, false, pUndoDoc );
if ( rParam.nRow2 > nEndRow )
- pDoc->CopyToDocument( rParam.nCol1, nEndRow+1, nTab,
+ rDoc.CopyToDocument( rParam.nCol1, nEndRow+1, nTab,
nUndoEndCol+nFormulaCols, nUndoEndRow, nTab,
nCopyFlags, false, pUndoDoc );
}
@@ -537,48 +537,48 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
ScRange aDelRange( rParam.nCol1, rParam.nRow1, nTab,
rParam.nCol2, rParam.nRow2, nTab );
- pDoc->DeleteAreaTab( aDelRange, IDF_ALL & ~IDF_NOTE ); // ohne die Formeln
+ rDoc.DeleteAreaTab( aDelRange, IDF_ALL & ~IDF_NOTE ); // ohne die Formeln
ScRange aOld( rParam.nCol1, rParam.nRow1, nTab,
rParam.nCol2+nFormulaCols, rParam.nRow2, nTab );
ScRange aNew( rParam.nCol1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab );
- pDoc->FitBlock( aOld, aNew, false ); // Formeln nicht loeschen
+ rDoc.FitBlock( aOld, aNew, false ); // Formeln nicht loeschen
}
else if ( nEndCol < rParam.nCol2 ) // DeleteArea calls PutInOrder
- pDoc->DeleteArea( nEndCol+1, rParam.nRow1, rParam.nCol2, rParam.nRow2,
+ rDoc.DeleteArea( nEndCol+1, rParam.nRow1, rParam.nCol2, rParam.nRow2,
aNewMark, IDF_CONTENTS & ~IDF_NOTE );
// CopyToDocument doesn't remove contents
- pDoc->DeleteAreaTab( rParam.nCol1, rParam.nRow1, nEndCol, nEndRow, nTab, IDF_CONTENTS & ~IDF_NOTE );
+ rDoc.DeleteAreaTab( rParam.nCol1, rParam.nRow1, nEndCol, nEndRow, nTab, IDF_CONTENTS & ~IDF_NOTE );
// remove each column from ImportDoc after copying to reduce memory usage
- 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 = rParam.nCol1; nCopyCol <= nEndCol; nCopyCol++)
{
pImportDoc->CopyToDocument( nCopyCol, rParam.nRow1, nTab, nCopyCol, nEndRow, nTab,
- IDF_ALL, false, pDoc );
+ IDF_ALL, false, &rDoc );
pImportDoc->DeleteAreaTab( nCopyCol, rParam.nRow1, nCopyCol, nEndRow, nTab, IDF_CONTENTS );
}
- pDoc->SetAutoCalc( bOldAutoCalc );
+ rDoc.SetAutoCalc( bOldAutoCalc );
if (nFormulaCols > 0) // copy formulas
{
if (bKeepFormat) // formats for formulas
pImportDoc->CopyToDocument( nEndCol+1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab,
- IDF_ATTRIB, false, pDoc );
+ IDF_ATTRIB, false, &rDoc );
// fill formulas
ScMarkData aMark;
aMark.SelectOneTable(nTab);
sal_uLong nProgCount = nFormulaCols;
nProgCount *= nEndRow-rParam.nRow1-1;
- ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScProgress aProgress( rDoc.GetDocumentShell(),
ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
- pDoc->Fill( nEndCol+1, rParam.nRow1+1, nEndCol+nFormulaCols, rParam.nRow1+1,
+ rDoc.Fill( nEndCol+1, rParam.nRow1+1, nEndCol+nFormulaCols, rParam.nRow1+1,
&aProgress, aMark, nEndRow-rParam.nRow1-1, FILL_TO_BOTTOM, FILL_SIMPLE );
}
@@ -587,10 +587,10 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
if (!bMoveCells) // move has happened above
{
if ( rParam.nCol2 > nEndCol )
- pDoc->DeleteArea( nEndCol+1, rParam.nRow1, rParam.nCol2, rParam.nRow2,
+ rDoc.DeleteArea( nEndCol+1, rParam.nRow1, rParam.nCol2, rParam.nRow2,
aNewMark, IDF_CONTENTS );
if ( rParam.nRow2 > nEndRow )
- pDoc->DeleteArea( rParam.nCol1, nEndRow+1, rParam.nCol2, rParam.nRow2,
+ rDoc.DeleteArea( rParam.nCol1, nEndRow+1, rParam.nCol2, rParam.nRow2,
aNewMark, IDF_CONTENTS );
}
@@ -601,7 +601,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
pDBData->SetByRow( true );
pDBData->SetArea( nTab, rParam.nCol1,rParam.nRow1, nEndCol,nEndRow );
pDBData->SetImportSelection( bRealSelection );
- pDoc->CompileDBFormula();
+ rDoc.CompileDBFormula();
}
if (bRecord)
@@ -610,7 +610,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
pImportDoc = NULL;
if (nFormulaCols > 0) // include filled formulas for redo
- pDoc->CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
+ rDoc.CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab,
IDF_ALL & ~IDF_NOTE, false, pRedoDoc );
@@ -624,12 +624,12 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
}
sc::SetFormulaDirtyContext aCxt;
- pDoc->SetAllFormulasDirty(aCxt);
+ rDoc.SetAllFormulasDirty(aCxt);
rDocShell.PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID);
aModificator.SetDocumentModified();
ScDBRangeRefreshedHint aHint( rParam );
- pDoc->BroadcastUno( aHint );
+ rDoc.BroadcastUno( aHint );
if (pWaitWin)
pWaitWin->LeaveWait();
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index b67ef09bbfbf..fbac2b51c6ef 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -102,7 +102,7 @@ using ::std::vector;
IMPL_LINK( ScDocFunc, NotifyDrawUndo, SdrUndoAction*, pUndoAction )
{
// #i101118# if drawing layer collects the undo actions, add it there
- ScDrawLayer* pDrawLayer = rDocShell.GetDocument()->GetDrawLayer();
+ ScDrawLayer* pDrawLayer = rDocShell.GetDocument().GetDrawLayer();
if( pDrawLayer && pDrawLayer->IsRecording() )
pDrawLayer->AddCalcUndo( pUndoAction );
else
@@ -110,11 +110,11 @@ IMPL_LINK( ScDocFunc, NotifyDrawUndo, SdrUndoAction*, pUndoAction )
rDocShell.SetDrawModified();
// the affected sheet isn't known, so all stream positions are invalidated
- ScDocument* pDoc = rDocShell.GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
for (SCTAB nTab=0; nTab<nTabCount; nTab++)
- if (pDoc->IsStreamValid(nTab))
- pDoc->SetStreamValid(nTab, false);
+ if (rDoc.IsStreamValid(nTab))
+ rDoc.SetStreamValid(nTab, false);
return 0;
}
@@ -134,13 +134,13 @@ static void lcl_PaintAbove( ScDocShell& rDocShell, const ScRange& rRange )
bool ScDocFunc::AdjustRowHeight( const ScRange& rRange, bool bPaint )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if ( pDoc->IsImportingXML() )
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if ( rDoc.IsImportingXML() )
{
// for XML import, all row heights are updated together after importing
return false;
}
- if ( !pDoc->IsAdjustHeightEnabled() )
+ if ( !rDoc.IsAdjustHeightEnabled() )
{
return false;
}
@@ -153,7 +153,7 @@ bool ScDocFunc::AdjustRowHeight( const ScRange& rRange, bool bPaint )
Fraction aOne(1,1);
sc::RowHeightContext aCxt(aProv.GetPPTX(), aProv.GetPPTY(), aOne, aOne, aProv.GetDevice());
- bool bChanged = pDoc->SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab);
+ bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab);
if ( bPaint && bChanged )
rDocShell.PostPaint(ScRange(0, nStartRow, nTab, MAXCOL, MAXROW, nTab),
@@ -168,23 +168,23 @@ bool ScDocFunc::DetectiveAddPred(const ScAddress& rPos)
ScDocShellModificator aModificator( rDocShell );
rDocShell.MakeDrawLayer();
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo (rDoc.IsUndoEnabled());
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
SCCOL nCol = rPos.Col();
SCROW nRow = rPos.Row();
SCTAB nTab = rPos.Tab();
if (bUndo)
pModel->BeginCalcUndo(false);
- bool bDone = ScDetectiveFunc( pDoc,nTab ).ShowPred( nCol, nRow );
+ bool bDone = ScDetectiveFunc( &rDoc,nTab ).ShowPred( nCol, nRow );
SdrUndoGroup* pUndo = NULL;
if (bUndo)
pUndo = pModel->GetCalcUndo();
if (bDone)
{
ScDetOpData aOperation( ScAddress(nCol,nRow,nTab), SCDETOP_ADDPRED );
- pDoc->AddDetectiveOperation( aOperation );
+ rDoc.AddDetectiveOperation( aOperation );
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
@@ -203,10 +203,10 @@ bool ScDocFunc::DetectiveAddPred(const ScAddress& rPos)
bool ScDocFunc::DetectiveDelPred(const ScAddress& rPos)
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- bool bUndo(pDoc->IsUndoEnabled());
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ bool bUndo(rDoc.IsUndoEnabled());
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
if (!pModel)
return false;
@@ -218,14 +218,14 @@ bool ScDocFunc::DetectiveDelPred(const ScAddress& rPos)
if (bUndo)
pModel->BeginCalcUndo(false);
- bool bDone = ScDetectiveFunc( pDoc,nTab ).DeletePred( nCol, nRow );
+ bool bDone = ScDetectiveFunc( &rDoc,nTab ).DeletePred( nCol, nRow );
SdrUndoGroup* pUndo = NULL;
if (bUndo)
pUndo = pModel->GetCalcUndo();
if (bDone)
{
ScDetOpData aOperation( ScAddress(nCol,nRow,nTab), SCDETOP_DELPRED );
- pDoc->AddDetectiveOperation( aOperation );
+ rDoc.AddDetectiveOperation( aOperation );
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
@@ -247,24 +247,24 @@ bool ScDocFunc::DetectiveAddSucc(const ScAddress& rPos)
ScDocShellModificator aModificator( rDocShell );
rDocShell.MakeDrawLayer();
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- bool bUndo(pDoc->IsUndoEnabled());
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ bool bUndo(rDoc.IsUndoEnabled());
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
SCCOL nCol = rPos.Col();
SCROW nRow = rPos.Row();
SCTAB nTab = rPos.Tab();
if (bUndo)
pModel->BeginCalcUndo(false);
- bool bDone = ScDetectiveFunc( pDoc,nTab ).ShowSucc( nCol, nRow );
+ bool bDone = ScDetectiveFunc( &rDoc,nTab ).ShowSucc( nCol, nRow );
SdrUndoGroup* pUndo = NULL;
if (bUndo)
pUndo = pModel->GetCalcUndo();
if (bDone)
{
ScDetOpData aOperation( ScAddress(nCol,nRow,nTab), SCDETOP_ADDSUCC );
- pDoc->AddDetectiveOperation( aOperation );
+ rDoc.AddDetectiveOperation( aOperation );
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
@@ -283,10 +283,10 @@ bool ScDocFunc::DetectiveAddSucc(const ScAddress& rPos)
bool ScDocFunc::DetectiveDelSucc(const ScAddress& rPos)
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ bool bUndo (rDoc.IsUndoEnabled());
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
if (!pModel)
return false;
@@ -298,14 +298,14 @@ bool ScDocFunc::DetectiveDelSucc(const ScAddress& rPos)
if (bUndo)
pModel->BeginCalcUndo(false);
- bool bDone = ScDetectiveFunc( pDoc,nTab ).DeleteSucc( nCol, nRow );
+ bool bDone = ScDetectiveFunc( &rDoc,nTab ).DeleteSucc( nCol, nRow );
SdrUndoGroup* pUndo = NULL;
if (bUndo)
pUndo = pModel->GetCalcUndo();
if (bDone)
{
ScDetOpData aOperation( ScAddress(nCol,nRow,nTab), SCDETOP_DELSUCC );
- pDoc->AddDetectiveOperation( aOperation );
+ rDoc.AddDetectiveOperation( aOperation );
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
@@ -327,24 +327,24 @@ bool ScDocFunc::DetectiveAddError(const ScAddress& rPos)
ScDocShellModificator aModificator( rDocShell );
rDocShell.MakeDrawLayer();
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ bool bUndo (rDoc.IsUndoEnabled());
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
SCCOL nCol = rPos.Col();
SCROW nRow = rPos.Row();
SCTAB nTab = rPos.Tab();
if (bUndo)
pModel->BeginCalcUndo(false);
- bool bDone = ScDetectiveFunc( pDoc,nTab ).ShowError( nCol, nRow );
+ bool bDone = ScDetectiveFunc( &rDoc,nTab ).ShowError( nCol, nRow );
SdrUndoGroup* pUndo = NULL;
if (bUndo)
pUndo = pModel->GetCalcUndo();
if (bDone)
{
ScDetOpData aOperation( ScAddress(nCol,nRow,nTab), SCDETOP_ADDERROR );
- pDoc->AddDetectiveOperation( aOperation );
+ rDoc.AddDetectiveOperation( aOperation );
if (bUndo)
{
rDocShell.GetUndoManager()->AddUndoAction(
@@ -366,10 +366,10 @@ bool ScDocFunc::DetectiveMarkInvalid(SCTAB nTab)
ScDocShellModificator aModificator( rDocShell );
rDocShell.MakeDrawLayer();
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ bool bUndo (rDoc.IsUndoEnabled());
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
Window* pWaitWin = rDocShell.GetActiveDialogParent();
if (pWaitWin)
@@ -377,7 +377,7 @@ bool ScDocFunc::DetectiveMarkInvalid(SCTAB nTab)
if (bUndo)
pModel->BeginCalcUndo(false);
bool bOverflow;
- bool bDone = ScDetectiveFunc( pDoc,nTab ).MarkInvalid( bOverflow );
+ bool bDone = ScDetectiveFunc( &rDoc,nTab ).MarkInvalid( bOverflow );
SdrUndoGroup* pUndo = NULL;
if (bUndo)
pUndo = pModel->GetCalcUndo();
@@ -405,10 +405,10 @@ bool ScDocFunc::DetectiveMarkInvalid(SCTAB nTab)
bool ScDocFunc::DetectiveDelAll(SCTAB nTab)
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ bool bUndo (rDoc.IsUndoEnabled());
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
if (!pModel)
return false;
@@ -416,18 +416,18 @@ bool ScDocFunc::DetectiveDelAll(SCTAB nTab)
if (bUndo)
pModel->BeginCalcUndo(false);
- bool bDone = ScDetectiveFunc( pDoc,nTab ).DeleteAll( SC_DET_DETECTIVE );
+ bool bDone = ScDetectiveFunc( &rDoc,nTab ).DeleteAll( SC_DET_DETECTIVE );
SdrUndoGroup* pUndo = NULL;
if (bUndo)
pUndo = pModel->GetCalcUndo();
if (bDone)
{
- ScDetOpList* pOldList = pDoc->GetDetOpList();
+ ScDetOpList* pOldList = rDoc.GetDetOpList();
ScDetOpList* pUndoList = NULL;
if (bUndo)
pUndoList = pOldList ? new ScDetOpList(*pOldList) : NULL;
- pDoc->ClearDetectiveOperations();
+ rDoc.ClearDetectiveOperations();
if (bUndo)
{
@@ -448,22 +448,22 @@ bool ScDocFunc::DetectiveDelAll(SCTAB nTab)
bool ScDocFunc::DetectiveRefresh( bool bAutomatic )
{
bool bDone = false;
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
- ScDetOpList* pList = pDoc->GetDetOpList();
+ bool bUndo (rDoc.IsUndoEnabled());
+ ScDetOpList* pList = rDoc.GetDetOpList();
if ( pList && pList->Count() )
{
rDocShell.MakeDrawLayer();
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
if (bUndo)
pModel->BeginCalcUndo(false);
// Loeschen auf allen Tabellen
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
for (SCTAB nTab=0; nTab<nTabCount; nTab++)
- ScDetectiveFunc( pDoc,nTab ).DeleteAll( SC_DET_ARROWS ); // don't remove circles
+ ScDetectiveFunc( &rDoc,nTab ).DeleteAll( SC_DET_ARROWS ); // don't remove circles
// Wiederholen
@@ -474,7 +474,7 @@ bool ScDocFunc::DetectiveRefresh( bool bAutomatic )
if (pData)
{
ScAddress aPos = pData->GetPos();
- ScDetectiveFunc aFunc( pDoc, aPos.Tab() );
+ ScDetectiveFunc aFunc( &rDoc, aPos.Tab() );
SCCOL nCol = aPos.Col();
SCROW nRow = aPos.Row();
switch (pData->GetOperation())
@@ -522,13 +522,13 @@ static void lcl_collectAllPredOrSuccRanges(
const ScRangeList& rSrcRanges, vector<ScTokenRef>& rRefTokens, ScDocShell& rDocShell,
bool bPred)
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
vector<ScTokenRef> aRefTokens;
ScRangeList aSrcRanges(rSrcRanges);
if (aSrcRanges.empty())
return;
ScRange* p = aSrcRanges.front();
- ScDetectiveFunc aDetFunc(pDoc, p->aStart.Tab());
+ ScDetectiveFunc aDetFunc(&rDoc, p->aStart.Tab());
ScRangeList aDestRanges;
for (size_t i = 0, n = aSrcRanges.size(); i < n; ++i)
{
@@ -568,12 +568,12 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags,
return false;
}
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScEditableTester aTester( pDoc, rMark );
+ ScEditableTester aTester( &rDoc, rMark );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -591,7 +591,7 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags,
aMultiMark.MarkToMulti();
aMultiMark.GetMultiMarkArea( aMarkRange );
ScRange aExtendedRange(aMarkRange);
- if ( pDoc->ExtendMerge( aExtendedRange, true ) )
+ if ( rDoc.ExtendMerge( aExtendedRange, true ) )
bMulti = false;
// keine Objekte auf geschuetzten Tabellen
@@ -599,10 +599,10 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags,
if ( nFlags & IDF_OBJECTS )
{
bObjects = true;
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
- if (pDoc->IsTabProtected(*itr))
+ if (rDoc.IsTabProtected(*itr))
bObjects = false;
}
@@ -618,14 +618,14 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags,
bool bDrawUndo = bObjects || (nFlags & IDF_NOTE);
if (bRecord && bDrawUndo)
- pDoc->BeginDrawUndo();
+ rDoc.BeginDrawUndo();
if (bObjects)
{
if (bMulti)
- pDoc->DeleteObjectsInSelection( aMultiMark );
+ rDoc.DeleteObjectsInSelection( aMultiMark );
else
- pDoc->DeleteObjectsInArea( aMarkRange.aStart.Col(), aMarkRange.aStart.Row(),
+ rDoc.DeleteObjectsInArea( aMarkRange.aStart.Col(), aMarkRange.aStart.Row(),
aMarkRange.aEnd.Col(), aMarkRange.aEnd.Row(),
aMultiMark );
}
@@ -633,7 +633,7 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags,
if ( bRecord )
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, aMarkRange.aStart.Tab(), aMarkRange.aEnd.Tab() );
+ pUndoDoc->InitUndo( &rDoc, aMarkRange.aStart.Tab(), aMarkRange.aEnd.Tab() );
// bei "Format/Standard" alle Attribute kopieren, weil CopyToDocument
// nur mit IDF_HARDATTR zu langsam ist:
@@ -646,11 +646,11 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags,
nUndoDocFlags |= IDF_CONTENTS; // copy all cells with their notes
// note captions are handled in drawing undo
nUndoDocFlags |= IDF_NOCAPTIONS;
- pDoc->CopyToDocument( aExtendedRange, nUndoDocFlags, bMulti, pUndoDoc, &aMultiMark );
+ rDoc.CopyToDocument( aExtendedRange, nUndoDocFlags, bMulti, pUndoDoc, &aMultiMark );
}
//! HideAllCursors(); // falls Zusammenfassung aufgehoben wird
- pDoc->DeleteSelection( nFlags, aMultiMark );
+ rDoc.DeleteSelection( nFlags, aMultiMark );
// add undo action after drawing undo is complete (objects and note captions)
if( bRecord )
@@ -673,11 +673,11 @@ bool ScDocFunc::TransliterateText( const ScMarkData& rMark, sal_Int32 nType,
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScEditableTester aTester( pDoc, rMark );
+ ScEditableTester aTester( &rDoc, rMark );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -694,10 +694,10 @@ bool ScDocFunc::TransliterateText( const ScMarkData& rMark, sal_Int32 nType,
if (bRecord)
{
SCTAB nStartTab = aMarkRange.aStart.Tab();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nStartTab, nStartTab );
+ pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab );
ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
if (*itr != nStartTab)
@@ -706,13 +706,13 @@ bool ScDocFunc::TransliterateText( const ScMarkData& rMark, sal_Int32 nType,
ScRange aCopyRange = aMarkRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, IDF_CONTENTS, true, pUndoDoc, &aMultiMark );
+ rDoc.CopyToDocument( aCopyRange, IDF_CONTENTS, true, pUndoDoc, &aMultiMark );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoTransliterate( &rDocShell, aMultiMark, pUndoDoc, nType ) );
}
- pDoc->TransliterateText( aMultiMark, nType );
+ rDoc.TransliterateText( aMultiMark, nType );
if (!AdjustRowHeight( aMarkRange ))
rDocShell.PostPaint( aMarkRange, PAINT_GRID );
@@ -725,10 +725,10 @@ bool ScDocFunc::TransliterateText( const ScMarkData& rMark, sal_Int32 nType,
bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, const OUString& rText, bool bApi )
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- bool bUndo(pDoc->IsUndoEnabled());
- ScEditableTester aTester( pDoc, rPos.Tab(), rPos.Col(),rPos.Row(), rPos.Col(),rPos.Row() );
+ bool bUndo(rDoc.IsUndoEnabled());
+ ScEditableTester aTester( &rDoc, rPos.Tab(), rPos.Col(),rPos.Row(), rPos.Col(),rPos.Row() );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -736,7 +736,7 @@ bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, con
return false;
}
- bool bEditDeleted = (pDoc->GetCellType(rPos) == CELLTYPE_EDIT);
+ bool bEditDeleted = (rDoc.GetCellType(rPos) == CELLTYPE_EDIT);
ScUndoEnterData::ValuesType aOldValues;
if (bUndo)
@@ -744,10 +744,10 @@ bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, con
ScUndoEnterData::Value aOldValue;
aOldValue.mnTab = rPos.Tab();
- aOldValue.maCell.assign(*pDoc, rPos);
+ aOldValue.maCell.assign(rDoc, rPos);
const SfxPoolItem* pItem;
- const ScPatternAttr* pPattern = pDoc->GetPattern( rPos.Col(),rPos.Row(),rPos.Tab() );
+ const ScPatternAttr* pPattern = rDoc.GetPattern( rPos.Col(),rPos.Row(),rPos.Tab() );
if ( SFX_ITEM_SET == pPattern->GetItemSet().GetItemState(
ATTR_VALUE_FORMAT,false,&pItem) )
{
@@ -760,7 +760,7 @@ bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, con
aOldValues.push_back(aOldValue);
}
- o_rbNumFmtSet = pDoc->SetString( rPos.Col(), rPos.Row(), rPos.Tab(), rText );
+ o_rbNumFmtSet = rDoc.SetString( rPos.Col(), rPos.Row(), rPos.Tab(), rText );
if (bUndo)
{
@@ -769,7 +769,7 @@ bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, con
new ScUndoEnterData(&rDocShell, rPos, aOldValues, rText, NULL));
}
- if ( bEditDeleted || pDoc->HasAttrib( ScRange(rPos), HASATTR_NEEDHEIGHT ) )
+ if ( bEditDeleted || rDoc.HasAttrib( ScRange(rPos), HASATTR_NEEDHEIGHT ) )
AdjustRowHeight( ScRange(rPos) );
rDocShell.PostPaintCell( rPos );
@@ -785,22 +785,22 @@ bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, con
bool ScDocFunc::SetValueCell( const ScAddress& rPos, double fVal, bool bInteraction )
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo = pDoc->IsUndoEnabled();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo = rDoc.IsUndoEnabled();
- bool bHeight = pDoc->HasAttrib(rPos, HASATTR_NEEDHEIGHT);
+ bool bHeight = rDoc.HasAttrib(rPos, HASATTR_NEEDHEIGHT);
ScCellValue aOldVal;
if (bUndo)
- aOldVal.assign(*pDoc, rPos);
+ aOldVal.assign(rDoc, rPos);
- pDoc->SetValue(rPos, fVal);
+ rDoc.SetValue(rPos, fVal);
if (bUndo)
{
svl::IUndoManager* pUndoMgr = rDocShell.GetUndoManager();
ScCellValue aNewVal;
- aNewVal.assign(*pDoc, rPos);
+ aNewVal.assign(rDoc, rPos);
pUndoMgr->AddUndoAction(new ScUndoSetCell(&rDocShell, rPos, aOldVal, aNewVal));
}
@@ -829,18 +829,18 @@ bool ScDocFunc::SetValueCells( const ScAddress& rPos, const std::vector<double>&
aRange.aEnd.SetRow(nLastRow);
ScDocShellModificator aModificator(rDocShell);
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (pDoc->IsUndoEnabled())
+ if (rDoc.IsUndoEnabled())
{
sc::UndoSetCells* pUndoObj = new sc::UndoSetCells(&rDocShell, rPos);
- pDoc->TransferCellValuesTo(rPos, aVals.size(), pUndoObj->GetOldValues());
+ rDoc.TransferCellValuesTo(rPos, aVals.size(), pUndoObj->GetOldValues());
pUndoObj->SetNewValues(aVals);
svl::IUndoManager* pUndoMgr = rDocShell.GetUndoManager();
pUndoMgr->AddUndoAction(pUndoObj);
}
- pDoc->SetValues(rPos, aVals);
+ rDoc.SetValues(rPos, aVals);
rDocShell.PostPaint(aRange, PAINT_GRID);
aModificator.SetDocumentModified();
@@ -855,24 +855,24 @@ bool ScDocFunc::SetValueCells( const ScAddress& rPos, const std::vector<double>&
bool ScDocFunc::SetStringCell( const ScAddress& rPos, const OUString& rStr, bool bInteraction )
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo = pDoc->IsUndoEnabled();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo = rDoc.IsUndoEnabled();
- bool bHeight = pDoc->HasAttrib(rPos, HASATTR_NEEDHEIGHT);
+ bool bHeight = rDoc.HasAttrib(rPos, HASATTR_NEEDHEIGHT);
ScCellValue aOldVal;
if (bUndo)
- aOldVal.assign(*pDoc, rPos);
+ aOldVal.assign(rDoc, rPos);
ScSetStringParam aParam;
aParam.setTextInput();
- pDoc->SetString(rPos, rStr, &aParam);
+ rDoc.SetString(rPos, rStr, &aParam);
if (bUndo)
{
svl::IUndoManager* pUndoMgr = rDocShell.GetUndoManager();
ScCellValue aNewVal;
- aNewVal.assign(*pDoc, rPos);
+ aNewVal.assign(rDoc, rPos);
pUndoMgr->AddUndoAction(new ScUndoSetCell(&rDocShell, rPos, aOldVal, aNewVal));
}
@@ -892,22 +892,22 @@ bool ScDocFunc::SetStringCell( const ScAddress& rPos, const OUString& rStr, bool
bool ScDocFunc::SetEditCell( const ScAddress& rPos, const EditTextObject& rStr, bool bInteraction )
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo = pDoc->IsUndoEnabled();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo = rDoc.IsUndoEnabled();
- bool bHeight = pDoc->HasAttrib(rPos, HASATTR_NEEDHEIGHT);
+ bool bHeight = rDoc.HasAttrib(rPos, HASATTR_NEEDHEIGHT);
ScCellValue aOldVal;
if (bUndo)
- aOldVal.assign(*pDoc, rPos);
+ aOldVal.assign(rDoc, rPos);
- pDoc->SetEditText(rPos, rStr.Clone());
+ rDoc.SetEditText(rPos, rStr.Clone());
if (bUndo)
{
svl::IUndoManager* pUndoMgr = rDocShell.GetUndoManager();
ScCellValue aNewVal;
- aNewVal.assign(*pDoc, rPos);
+ aNewVal.assign(rDoc, rPos);
pUndoMgr->AddUndoAction(new ScUndoSetCell(&rDocShell, rPos, aOldVal, aNewVal));
}
@@ -926,11 +926,11 @@ bool ScDocFunc::SetEditCell( const ScAddress& rPos, const EditTextObject& rStr,
bool ScDocFunc::SetStringOrEditCell( const ScAddress& rPos, const OUString& rStr, bool bInteraction )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
if (ScStringUtil::isMultiline(rStr))
{
- ScFieldEditEngine& rEngine = pDoc->GetEditEngine();
+ ScFieldEditEngine& rEngine = rDoc.GetEditEngine();
rEngine.SetText(rStr);
boost::scoped_ptr<EditTextObject> pEditText(rEngine.CreateTextObject());
return SetEditCell(rPos, *pEditText, bInteraction);
@@ -946,34 +946,34 @@ bool ScDocFunc::SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell, boo
SAL_WNODEPRECATED_DECLARATIONS_POP
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo = pDoc->IsUndoEnabled();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo = rDoc.IsUndoEnabled();
- bool bHeight = pDoc->HasAttrib(rPos, HASATTR_NEEDHEIGHT);
+ bool bHeight = rDoc.HasAttrib(rPos, HASATTR_NEEDHEIGHT);
ScCellValue aOldVal;
if (bUndo)
- aOldVal.assign(*pDoc, rPos);
+ aOldVal.assign(rDoc, rPos);
- pCell = pDoc->SetFormulaCell(rPos, xCell.release());
+ pCell = rDoc.SetFormulaCell(rPos, xCell.release());
// For performance reasons API calls may disable calculation while
// operating and recalculate once when done. If through user interaction
// and AutoCalc is disabled, calculate the formula (without its
// dependencies) once so the result matches the current document's content.
- if (bInteraction && !pDoc->GetAutoCalc() && pCell)
+ if (bInteraction && !rDoc.GetAutoCalc() && pCell)
{
// calculate just the cell once and set Dirty again
pCell->Interpret();
pCell->SetDirtyVar();
- pDoc->PutInFormulaTree( pCell);
+ rDoc.PutInFormulaTree( pCell);
}
if (bUndo)
{
svl::IUndoManager* pUndoMgr = rDocShell.GetUndoManager();
ScCellValue aNewVal;
- aNewVal.assign(*pDoc, rPos);
+ aNewVal.assign(rDoc, rPos);
pUndoMgr->AddUndoAction(new ScUndoSetCell(&rDocShell, rPos, aOldVal, aNewVal));
}
@@ -993,7 +993,7 @@ bool ScDocFunc::SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell, boo
void ScDocFunc::NotifyInputHandler( const ScAddress& rPos )
{
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
- if ( pViewSh && pViewSh->GetViewData()->GetDocShell() == &rDocShell )
+ if ( pViewSh && pViewSh->GetViewData().GetDocShell() == &rDocShell )
{
ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl();
if ( pInputHdl && pInputHdl->GetCursorPos() == rPos )
@@ -1025,7 +1025,7 @@ bool ScDocFunc::PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
// PutData ruft PutCell oder SetNormalString
bool bRet = false;
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
ScEditAttrTester aTester( &rEngine );
bool bEditCell = aTester.NeedsObject();
if ( bEditCell )
@@ -1033,7 +1033,7 @@ bool ScDocFunc::PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
// #i61702# With bLoseContent set, the content of rEngine isn't restored
// (used in loading XML, where after the removeActionLock call the API object's
// EditEngine isn't accessed again.
- bool bLoseContent = pDoc->IsImportingXML();
+ bool bLoseContent = rDoc.IsImportingXML();
bool bUpdateMode(rEngine.GetUpdateMode());
if (bUpdateMode)
@@ -1097,9 +1097,9 @@ bool ScDocFunc::PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
if ( bRet && aTester.NeedsCellAttr() )
{
const SfxItemSet& rEditAttr = aTester.GetAttribs();
- ScPatternAttr aPattern( pDoc->GetPool() );
+ ScPatternAttr aPattern( rDoc.GetPool() );
aPattern.GetFromEditItemSet( &rEditAttr );
- aPattern.DeleteUnchanged( pDoc->GetPattern( rPos.Col(), rPos.Row(), rPos.Tab() ) );
+ aPattern.DeleteUnchanged( rDoc.GetPattern( rPos.Col(), rPos.Row(), rPos.Tab() ) );
aPattern.GetItemSet().ClearItem( ATTR_HOR_JUSTIFY ); // wasn't removed above if no edit object
if ( aPattern.GetItemSet().Count() > 0 )
{
@@ -1132,19 +1132,19 @@ bool ScDocFunc::SetCellText(
{
if ( bEnglish )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
::boost::scoped_ptr<ScExternalRefManager::ApiGuard> pExtRefGuard;
if (bApi)
- pExtRefGuard.reset(new ScExternalRefManager::ApiGuard(pDoc));
+ pExtRefGuard.reset(new ScExternalRefManager::ApiGuard(&rDoc));
ScInputStringType aRes =
- ScStringUtil::parseInputString(*pDoc->GetFormatTable(), rText, LANGUAGE_ENGLISH_US);
+ ScStringUtil::parseInputString(*rDoc.GetFormatTable(), rText, LANGUAGE_ENGLISH_US);
switch (aRes.meType)
{
case ScInputStringType::Formula:
- bSet = SetFormulaCell(rPos, new ScFormulaCell(pDoc, rPos, aRes.maText, eGrammar), !bApi);
+ bSet = SetFormulaCell(rPos, new ScFormulaCell(&rDoc, rPos, aRes.maText, eGrammar), !bApi);
break;
case ScInputStringType::Number:
bSet = SetValueCell(rPos, aRes.mfValue, !bApi);
@@ -1173,7 +1173,7 @@ bool ScDocFunc::SetCellText(
bool ScDocFunc::ShowNote( const ScAddress& rPos, bool bShow )
{
- ScDocument& rDoc = *rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
ScPostIt* pNote = rDoc.GetNote( rPos );
if( !pNote || (bShow == pNote->IsCaptionShown()) ) return false;
@@ -1194,8 +1194,8 @@ bool ScDocFunc::SetNoteText( const ScAddress& rPos, const OUString& rText, bool
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- ScEditableTester aTester( pDoc, rPos.Tab(), rPos.Col(),rPos.Row(), rPos.Col(),rPos.Row() );
+ ScDocument& rDoc = rDocShell.GetDocument();
+ ScEditableTester aTester( &rDoc, rPos.Tab(), rPos.Col(),rPos.Row(), rPos.Col(),rPos.Row() );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -1205,13 +1205,13 @@ bool ScDocFunc::SetNoteText( const ScAddress& rPos, const OUString& rText, bool
OUString aNewText = convertLineEnd(rText, GetSystemLineEnd()); //! ist das noetig ???
- if( ScPostIt* pNote = (!aNewText.isEmpty()) ? pDoc->GetOrCreateNote( rPos ) : pDoc->GetNote(rPos) )
+ if( ScPostIt* pNote = (!aNewText.isEmpty()) ? rDoc.GetOrCreateNote( rPos ) : rDoc.GetNote(rPos) )
pNote->SetText( rPos, aNewText );
//! Undo !!!
- if (pDoc->IsStreamValid(rPos.Tab()))
- pDoc->SetStreamValid(rPos.Tab(), false);
+ if (rDoc.IsStreamValid(rPos.Tab()))
+ rDoc.SetStreamValid(rPos.Tab(), false);
rDocShell.PostPaintCell( rPos );
aModificator.SetDocumentModified();
@@ -1224,7 +1224,7 @@ bool ScDocFunc::ReplaceNote( const ScAddress& rPos, const OUString& rNoteText, c
bool bDone = false;
ScDocShellModificator aModificator( rDocShell );
- ScDocument& rDoc = *rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
ScEditableTester aTester( &rDoc, rPos.Tab(), rPos.Col(),rPos.Row(), rPos.Col(),rPos.Row() );
if (aTester.IsEditable())
{
@@ -1282,15 +1282,15 @@ bool ScDocFunc::ReplaceNote( const ScAddress& rPos, const OUString& rNoteText, c
bool ScDocFunc::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& rPattern,
bool bRecord, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if ( bRecord && !pDoc->IsUndoEnabled() )
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if ( bRecord && !rDoc.IsUndoEnabled() )
bRecord = false;
- bool bImportingXML = pDoc->IsImportingXML();
+ bool bImportingXML = rDoc.IsImportingXML();
// Cell formats can still be set if the range isn't editable only because of matrix formulas.
// #i62483# When loading XML, the check can be skipped altogether.
bool bOnlyNotBecauseOfMatrix;
- if ( !bImportingXML && !pDoc->IsSelectionEditable( rMark, &bOnlyNotBecauseOfMatrix )
+ if ( !bImportingXML && !rDoc.IsSelectionEditable( rMark, &bOnlyNotBecauseOfMatrix )
&& !bOnlyNotBecauseOfMatrix )
{
if (!bApi)
@@ -1312,8 +1312,8 @@ bool ScDocFunc::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& r
if ( bRecord )
{
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, aMultiRange.aStart.Tab(), aMultiRange.aEnd.Tab() );
- pDoc->CopyToDocument( aMultiRange, IDF_ATTRIB, bMulti, pUndoDoc, &rMark );
+ pUndoDoc->InitUndo( &rDoc, aMultiRange.aStart.Tab(), aMultiRange.aEnd.Tab() );
+ rDoc.CopyToDocument( aMultiRange, IDF_ATTRIB, bMulti, pUndoDoc, &rMark );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoSelectionAttr(
@@ -1327,7 +1327,7 @@ bool ScDocFunc::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& r
sal_uInt16 nExtFlags = 0;
if ( !bImportingXML )
rDocShell.UpdatePaintExt( nExtFlags, aMultiRange ); // content before the change
- pDoc->ApplySelectionPattern( rPattern, rMark );
+ rDoc.ApplySelectionPattern( rPattern, rMark );
if ( !bImportingXML )
rDocShell.UpdatePaintExt( nExtFlags, aMultiRange ); // content after the change
@@ -1345,15 +1345,15 @@ bool ScDocFunc::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& r
bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
bool bRecord, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if ( bRecord && !pDoc->IsUndoEnabled() )
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if ( bRecord && !rDoc.IsUndoEnabled() )
bRecord = false;
- bool bImportingXML = pDoc->IsImportingXML();
+ bool bImportingXML = rDoc.IsImportingXML();
// Cell formats can still be set if the range isn't editable only because of matrix formulas.
// #i62483# When loading XML, the check can be skipped altogether.
bool bOnlyNotBecauseOfMatrix;
- if ( !bImportingXML && !pDoc->IsSelectionEditable( rMark, &bOnlyNotBecauseOfMatrix )
+ if ( !bImportingXML && !rDoc.IsSelectionEditable( rMark, &bOnlyNotBecauseOfMatrix )
&& !bOnlyNotBecauseOfMatrix )
{
if (!bApi)
@@ -1361,7 +1361,7 @@ bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
return false;
}
- ScStyleSheet* pStyleSheet = (ScStyleSheet*) pDoc->GetStyleSheetPool()->Find(
+ ScStyleSheet* pStyleSheet = (ScStyleSheet*) rDoc.GetStyleSheetPool()->Find(
rStyleName, SFX_STYLE_FAMILY_PARA );
if (!pStyleSheet)
return false;
@@ -1379,8 +1379,8 @@ bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
{
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
SCTAB nStartTab = aMultiRange.aStart.Tab();
- SCTAB nTabCount = pDoc->GetTableCount();
- pUndoDoc->InitUndo( pDoc, nStartTab, nStartTab );
+ SCTAB nTabCount = rDoc.GetTableCount();
+ pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab );
ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
if (*itr != nStartTab)
@@ -1389,7 +1389,7 @@ bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
ScRange aCopyRange = aMultiRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, bMulti, pUndoDoc, &rMark );
+ rDoc.CopyToDocument( aCopyRange, IDF_ATTRIB, bMulti, pUndoDoc, &rMark );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoSelectionStyle(
@@ -1397,7 +1397,7 @@ bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
}
- pDoc->ApplySelectionStyle( (ScStyleSheet&)*pStyleSheet, rMark );
+ rDoc.ApplySelectionStyle( (ScStyleSheet&)*pStyleSheet, rMark );
if (!AdjustRowHeight( aMultiRange ))
rDocShell.PostPaint( aMultiRange, PAINT_GRID, 0 );
@@ -1602,8 +1602,8 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
return false;
}
- ScDocument* pDoc = rDocShell.GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
SCCOL nPaintStartCol = nStartCol;
SCROW nPaintStartRow = nStartRow;
SCCOL nPaintEndCol = nEndCol;
@@ -1617,11 +1617,11 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nCursorRow = 0;
if( pViewSh )
{
- nCursorCol = pViewSh->GetViewData()->GetCurX();
- nCursorRow = pViewSh->GetViewData()->GetCurY();
+ nCursorCol = pViewSh->GetViewData().GetCurX();
+ nCursorRow = pViewSh->GetViewData().GetCurY();
}
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScMarkData aMark;
@@ -1632,7 +1632,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCTAB nCount = 0;
for( i=0; i<nTabCount; i++ )
{
- if( !pDoc->IsScenario(i) )
+ if( !rDoc.IsScenario(i) )
{
nCount++;
if( nCount == nEndTab+1 )
@@ -1647,7 +1647,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
ScMarkData aFullMark( aMark ); // including scenario sheets
ScMarkData::iterator itr = aMark.begin(), itrEnd = aMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
- for( SCTAB j = *itr+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ for( SCTAB j = *itr+1; j<nTabCount && rDoc.IsScenario(j); j++ )
aFullMark.SelectTable( j, true );
SCTAB nSelCount = aMark.GetSelectCount();
@@ -1662,10 +1662,10 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
ScRange aExtendMergeRange( rRange );
- if( rRange.aStart == rRange.aEnd && pDoc->HasAttrib(rRange, HASATTR_MERGED) )
+ if( rRange.aStart == rRange.aEnd && rDoc.HasAttrib(rRange, HASATTR_MERGED) )
{
- pDoc->ExtendMerge( aExtendMergeRange );
- pDoc->ExtendOverlapped( aExtendMergeRange );
+ rDoc.ExtendMerge( aExtendMergeRange );
+ rDoc.ExtendOverlapped( aExtendMergeRange );
nMergeTestEndCol = aExtendMergeRange.aEnd.Col();
nMergeTestEndRow = aExtendMergeRange.aEnd.Row();
nPaintEndCol = nMergeTestEndCol;
@@ -1691,7 +1691,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCCOL nEditTestEndCol = (eCmd==INS_INSCOLS) ? MAXCOL : nMergeTestEndCol;
SCROW nEditTestEndRow = (eCmd==INS_INSROWS) ? MAXROW : nMergeTestEndRow;
- ScEditableTester aTester( pDoc, nMergeTestStartCol, nMergeTestStartRow, nEditTestEndCol, nEditTestEndRow, aMark );
+ ScEditableTester aTester( &rDoc, nMergeTestStartCol, nMergeTestStartRow, nEditTestEndCol, nEditTestEndRow, aMark );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -1700,7 +1700,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
}
// Check if this insertion is allowed with respect to pivot table.
- if (!canInsertCellsByPivot(rRange, aMark, eCmd, pDoc))
+ if (!canInsertCellsByPivot(rRange, aMark, eCmd, &rDoc))
{
if (!bApi)
rDocShell.ErrorMessage(STR_NO_INSERT_DELETE_OVER_PIVOT_TABLE);
@@ -1714,13 +1714,13 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
if ( bRecord )
{
pRefUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRefUndoDoc->InitUndo( pDoc, 0, nTabCount-1, false, false );
+ pRefUndoDoc->InitUndo( &rDoc, 0, nTabCount-1, false, false );
// pRefUndoDoc is filled in InsertCol / InsertRow
- pUndoData = new ScRefUndoData( pDoc );
+ pUndoData = new ScRefUndoData( &rDoc );
- pDoc->BeginDrawUndo();
+ rDoc.BeginDrawUndo();
}
// #i8302 : we unmerge overwhelming ranges, before insertion all the actions are put in the same ListAction
@@ -1735,7 +1735,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
for (; itr != itrEnd && nTabCount; ++itr)
{
i = *itr;
- if( pDoc->HasAttrib( nMergeTestStartCol, nMergeTestStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i, HASATTR_MERGED | HASATTR_OVERLAPPED ) )
+ if( rDoc.HasAttrib( nMergeTestStartCol, nMergeTestStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i, HASATTR_MERGED | HASATTR_OVERLAPPED ) )
{
if (eCmd==INS_CELLSRIGHT)
bNeedRefresh = true;
@@ -1745,8 +1745,8 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCCOL nMergeEndCol = nMergeTestEndCol;
SCROW nMergeEndRow = nMergeTestEndRow;
- pDoc->ExtendMerge( nMergeStartCol, nMergeStartRow, nMergeEndCol, nMergeEndRow, i );
- pDoc->ExtendOverlapped( nMergeStartCol, nMergeStartRow, nMergeEndCol, nMergeEndRow, i );
+ rDoc.ExtendMerge( nMergeStartCol, nMergeStartRow, nMergeEndCol, nMergeEndRow, i );
+ rDoc.ExtendOverlapped( nMergeStartCol, nMergeStartRow, nMergeEndCol, nMergeEndRow, i );
if(( eCmd == INS_CELLSDOWN && ( nMergeStartCol != nMergeTestStartCol || nMergeEndCol != nMergeTestEndCol )) ||
(eCmd == INS_CELLSRIGHT && ( nMergeStartRow != nMergeTestStartRow || nMergeEndRow != nMergeTestEndRow )) )
@@ -1762,7 +1762,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nTestRow1 = -1;
SCROW nTestRow2 = -1;
- ScDocAttrIterator aTestIter( pDoc, i, nMergeTestStartCol, nMergeTestStartRow, nMergeTestEndCol, nMergeTestEndRow );
+ ScDocAttrIterator aTestIter( &rDoc, i, nMergeTestStartCol, nMergeTestStartRow, nMergeTestEndCol, nMergeTestEndRow );
ScRange aExtendRange( nMergeTestStartCol, nMergeTestStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i );
const ScPatternAttr* pPattern = NULL;
const ScMergeAttr* pMergeFlag = NULL;
@@ -1775,16 +1775,16 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == SC_MF_HOR || nNewFlags == SC_MF_VER )
{
ScRange aRange( nTestCol, nTestRow1, i );
- pDoc->ExtendOverlapped(aRange);
- pDoc->ExtendMerge(aRange, true);
+ rDoc.ExtendOverlapped(aRange);
+ rDoc.ExtendMerge(aRange, true);
if( nTestRow1 < nTestRow2 && nNewFlags == SC_MF_HOR )
{
for( SCROW nTestRow = nTestRow1; nTestRow <= nTestRow2; nTestRow++ )
{
ScRange aTestRange( nTestCol, nTestRow, i );
- pDoc->ExtendOverlapped( aTestRange );
- pDoc->ExtendMerge( aTestRange, true);
+ rDoc.ExtendOverlapped( aTestRange );
+ rDoc.ExtendMerge( aTestRange, true);
ScRange aMergeRange( aTestRange.aStart.Col(),aTestRange.aStart.Row(), i );
if( !aExtendRange.In( aMergeRange ) )
{
@@ -1841,7 +1841,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
for( ::std::vector<ScRange>::const_iterator iIter( qIncreaseRange.begin()); iIter != qIncreaseRange.end(); ++iIter )
{
ScRange aRange( *iIter );
- if( pDoc->HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
+ if( rDoc.HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
{
UnmergeCells( aRange, true );
}
@@ -1862,22 +1862,22 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
switch (eCmd)
{
case INS_CELLSDOWN:
- bSuccess = pDoc->InsertRow( nStartCol, 0, nEndCol, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &aFullMark );
+ bSuccess = rDoc.InsertRow( nStartCol, 0, nEndCol, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &aFullMark );
nPaintEndRow = MAXROW;
break;
case INS_INSROWS:
- bSuccess = pDoc->InsertRow( 0, 0, MAXCOL, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &aFullMark );
+ bSuccess = rDoc.InsertRow( 0, 0, MAXCOL, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &aFullMark );
nPaintStartCol = 0;
nPaintEndCol = MAXCOL;
nPaintEndRow = MAXROW;
nPaintFlags |= PAINT_LEFT;
break;
case INS_CELLSRIGHT:
- bSuccess = pDoc->InsertCol( nStartRow, 0, nEndRow, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &aFullMark );
+ bSuccess = rDoc.InsertCol( nStartRow, 0, nEndRow, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &aFullMark );
nPaintEndCol = MAXCOL;
break;
case INS_INSCOLS:
- bSuccess = pDoc->InsertCol( 0, 0, MAXROW, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &aFullMark );
+ bSuccess = rDoc.InsertCol( 0, 0, MAXROW, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &aFullMark );
nPaintStartRow = 0;
nPaintEndRow = MAXROW;
nPaintEndCol = MAXCOL;
@@ -1904,7 +1904,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
SCTAB nCount = 0;
- for( SCTAB j=*itr+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ for( SCTAB j=*itr+1; j<nTabCount && rDoc.IsScenario(j); j++ )
nCount ++;
pScenarios[nUndoPos] = nCount;
@@ -1927,7 +1927,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
while( !qIncreaseRange.empty() )
{
ScRange aRange = qIncreaseRange.back();
- if( !pDoc->HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
+ if( !rDoc.HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
{
switch (eCmd)
{
@@ -1958,22 +1958,22 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
i = *itr;
- pDoc->SetDrawPageSize(i);
+ rDoc.SetDrawPageSize(i);
if (bNeedRefresh)
- pDoc->ExtendMerge( nMergeTestStartCol, nMergeTestStartRow, nMergeTestEndCol, nMergeTestEndRow, i, true );
+ rDoc.ExtendMerge( nMergeTestStartCol, nMergeTestStartRow, nMergeTestEndCol, nMergeTestEndRow, i, true );
else
- pDoc->RefreshAutoFilter( nMergeTestStartCol, nMergeTestStartRow, nMergeTestEndCol, nMergeTestEndRow, i );
+ rDoc.RefreshAutoFilter( nMergeTestStartCol, nMergeTestStartRow, nMergeTestEndCol, nMergeTestEndRow, i );
if ( eCmd == INS_INSROWS || eCmd == INS_INSCOLS )
- pDoc->UpdatePageBreaks( i );
+ rDoc.UpdatePageBreaks( i );
sal_uInt16 nExtFlags = 0;
rDocShell.UpdatePaintExt( nExtFlags, nPaintStartCol, nPaintStartRow, i, nPaintEndCol, nPaintEndRow, i );
SCTAB nScenarioCount = 0;
- for( SCTAB j = i+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ for( SCTAB j = i+1; j<nTabCount && rDoc.IsScenario(j); j++ )
nScenarioCount ++;
bool bAdjusted = ( eCmd == INS_INSROWS ) ? AdjustRowHeight(ScRange(0, nStartRow, i, MAXCOL, nEndRow, i+nScenarioCount )) :
@@ -2042,15 +2042,15 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
return false;
}
- ScDocument* pDoc = rDocShell.GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
SCCOL nPaintStartCol = nStartCol;
SCROW nPaintStartRow = nStartRow;
SCCOL nPaintEndCol = nEndCol;
SCROW nPaintEndRow = nEndRow;
sal_uInt16 nPaintFlags = PAINT_GRID;
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScMarkData aMark;
@@ -2061,7 +2061,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCTAB nCount = 0;
for(SCTAB i=0; i<nTabCount; i++ )
{
- if( !pDoc->IsScenario(i) )
+ if( !rDoc.IsScenario(i) )
{
nCount++;
if( nCount == nEndTab+1 )
@@ -2076,7 +2076,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
ScMarkData aFullMark( aMark ); // including scenario sheets
ScMarkData::iterator itr = aMark.begin(), itrEnd = aMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
- for( SCTAB j = *itr+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ for( SCTAB j = *itr+1; j<nTabCount && rDoc.IsScenario(j); j++ )
aFullMark.SelectTable( j, true );
SCTAB nSelCount = aMark.GetSelectCount();
@@ -2088,10 +2088,10 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
ScRange aExtendMergeRange( rRange );
- if( rRange.aStart == rRange.aEnd && pDoc->HasAttrib(rRange, HASATTR_MERGED) )
+ if( rRange.aStart == rRange.aEnd && rDoc.HasAttrib(rRange, HASATTR_MERGED) )
{
- pDoc->ExtendMerge( aExtendMergeRange );
- pDoc->ExtendOverlapped( aExtendMergeRange );
+ rDoc.ExtendMerge( aExtendMergeRange );
+ rDoc.ExtendOverlapped( aExtendMergeRange );
nUndoEndCol = aExtendMergeRange.aEnd.Col();
nUndoEndRow = aExtendMergeRange.aEnd.Row();
nPaintEndCol = nUndoEndCol;
@@ -2116,7 +2116,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nEditTestEndY = nUndoEndRow;
if ( eCmd==DEL_DELROWS || eCmd==DEL_CELLSUP )
nEditTestEndY = MAXROW;
- ScEditableTester aTester( pDoc, nUndoStartCol, nUndoStartRow, nEditTestEndX, nEditTestEndY, aMark );
+ ScEditableTester aTester( &rDoc, nUndoStartCol, nUndoStartRow, nEditTestEndX, nEditTestEndY, aMark );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -2124,7 +2124,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
return false;
}
- if (!canDeleteCellsByPivot(rRange, aMark, eCmd, pDoc))
+ if (!canDeleteCellsByPivot(rRange, aMark, eCmd, &rDoc))
{
if (!bApi)
rDocShell.ErrorMessage(STR_NO_INSERT_DELETE_OVER_PIVOT_TABLE);
@@ -2150,15 +2150,15 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
SCTAB i = *itr;
- if ( pDoc->HasAttrib( nUndoStartCol, nUndoStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i, HASATTR_MERGED | HASATTR_OVERLAPPED ))
+ if ( rDoc.HasAttrib( nUndoStartCol, nUndoStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i, HASATTR_MERGED | HASATTR_OVERLAPPED ))
{
SCCOL nMergeStartCol = nUndoStartCol;
SCROW nMergeStartRow = nUndoStartRow;
SCCOL nMergeEndCol = nMergeTestEndCol;
SCROW nMergeEndRow = nMergeTestEndRow;
- pDoc->ExtendMerge( nMergeStartCol, nMergeStartRow, nMergeEndCol, nMergeEndRow, i );
- pDoc->ExtendOverlapped( nMergeStartCol, nMergeStartRow, nMergeEndCol, nMergeEndRow, i );
+ rDoc.ExtendMerge( nMergeStartCol, nMergeStartRow, nMergeEndCol, nMergeEndRow, i );
+ rDoc.ExtendOverlapped( nMergeStartCol, nMergeStartRow, nMergeEndCol, nMergeEndRow, i );
if( ( eCmd == DEL_CELLSUP && ( nMergeStartCol != nUndoStartCol || nMergeEndCol != nMergeTestEndCol))||
( eCmd == DEL_CELLSLEFT && ( nMergeStartRow != nUndoStartRow || nMergeEndRow != nMergeTestEndRow)))
{
@@ -2174,7 +2174,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nTestRow1 = -1;
SCROW nTestRow2 = -1;
- ScDocAttrIterator aTestIter( pDoc, i, nUndoStartCol, nUndoStartRow, nMergeTestEndCol, nMergeTestEndRow );
+ ScDocAttrIterator aTestIter( &rDoc, i, nUndoStartCol, nUndoStartRow, nMergeTestEndCol, nMergeTestEndRow );
ScRange aExtendRange( nUndoStartCol, nUndoStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i );
const ScPatternAttr* pPattern = NULL;
const ScMergeAttr* pMergeFlag = NULL;
@@ -2187,16 +2187,16 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == SC_MF_HOR || nNewFlags == SC_MF_VER )
{
ScRange aRange( nTestCol, nTestRow1, i );
- pDoc->ExtendOverlapped( aRange );
- pDoc->ExtendMerge( aRange, true );
+ rDoc.ExtendOverlapped( aRange );
+ rDoc.ExtendMerge( aRange, true );
if( nTestRow1 < nTestRow2 && nNewFlags == SC_MF_HOR )
{
for( SCROW nTestRow = nTestRow1; nTestRow <= nTestRow2; nTestRow++ )
{
ScRange aTestRange( nTestCol, nTestRow, i );
- pDoc->ExtendOverlapped( aTestRange );
- pDoc->ExtendMerge( aTestRange, true );
+ rDoc.ExtendOverlapped( aTestRange );
+ rDoc.ExtendMerge( aTestRange, true );
ScRange aMergeRange( aTestRange.aStart.Col(),aTestRange.aStart.Row(), i );
if( !aExtendRange.In( aMergeRange ) )
{
@@ -2258,7 +2258,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
for( ::std::vector<ScRange>::const_iterator iIter( qDecreaseRange.begin()); iIter != qDecreaseRange.end(); ++iIter )
{
ScRange aRange( *iIter );
- if( pDoc->HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
+ if( rDoc.HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
{
UnmergeCells( aRange, true );
}
@@ -2290,25 +2290,25 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
// so it's no longer necessary to copy more than the deleted range into pUndoDoc.
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, 0, nTabCount-1, (eCmd==DEL_DELCOLS), (eCmd==DEL_DELROWS) );
+ pUndoDoc->InitUndo( &rDoc, 0, nTabCount-1, (eCmd==DEL_DELCOLS), (eCmd==DEL_DELROWS) );
itr = aMark.begin();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
SCTAB nScenarioCount = 0;
- for( SCTAB j = *itr+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ for( SCTAB j = *itr+1; j<nTabCount && rDoc.IsScenario(j); j++ )
nScenarioCount ++;
- pDoc->CopyToDocument( nUndoStartCol, nUndoStartRow, *itr, nUndoEndCol, nUndoEndRow, *itr+nScenarioCount,
+ rDoc.CopyToDocument( nUndoStartCol, nUndoStartRow, *itr, nUndoEndCol, nUndoEndRow, *itr+nScenarioCount,
IDF_ALL | IDF_NOCAPTIONS, false, pUndoDoc );
}
pRefUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRefUndoDoc->InitUndo( pDoc, 0, nTabCount-1, false, false );
+ pRefUndoDoc->InitUndo( &rDoc, 0, nTabCount-1, false, false );
- pUndoData = new ScRefUndoData( pDoc );
+ pUndoData = new ScRefUndoData( &rDoc );
- pDoc->BeginDrawUndo();
+ rDoc.BeginDrawUndo();
}
sal_uInt16 nExtFlags = 0;
@@ -2322,22 +2322,22 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
switch (eCmd)
{
case DEL_CELLSUP:
- pDoc->DeleteRow( nStartCol, 0, nEndCol, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, NULL, &aFullMark );
+ rDoc.DeleteRow( nStartCol, 0, nEndCol, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, NULL, &aFullMark );
nPaintEndRow = MAXROW;
break;
case DEL_DELROWS:
- pDoc->DeleteRow( 0, 0, MAXCOL, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &bUndoOutline, &aFullMark );
+ rDoc.DeleteRow( 0, 0, MAXCOL, MAXTAB, nStartRow, static_cast<SCSIZE>(nEndRow-nStartRow+1), pRefUndoDoc, &bUndoOutline, &aFullMark );
nPaintStartCol = 0;
nPaintEndCol = MAXCOL;
nPaintEndRow = MAXROW;
nPaintFlags |= PAINT_LEFT;
break;
case DEL_CELLSLEFT:
- pDoc->DeleteCol( nStartRow, 0, nEndRow, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, NULL, &aFullMark );
+ rDoc.DeleteCol( nStartRow, 0, nEndRow, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, NULL, &aFullMark );
nPaintEndCol = MAXCOL;
break;
case DEL_DELCOLS:
- pDoc->DeleteCol( 0, 0, MAXROW, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &bUndoOutline, &aFullMark );
+ rDoc.DeleteCol( 0, 0, MAXROW, MAXTAB, nStartCol, static_cast<SCSIZE>(nEndCol-nStartCol+1), pRefUndoDoc, &bUndoOutline, &aFullMark );
nPaintStartRow = 0;
nPaintEndRow = MAXROW;
nPaintEndCol = MAXCOL;
@@ -2371,7 +2371,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
SCTAB nCount = 0;
- for( SCTAB j=*itr+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ for( SCTAB j=*itr+1; j<nTabCount && rDoc.IsScenario(j); j++ )
nCount ++;
pScenarios[nUndoPos] = nCount;
@@ -2431,7 +2431,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
break;
}
- if( !pDoc->HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
+ if( !rDoc.HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) )
{
ScCellMergeOption aMergeOption(aRange);
MergeCells( aMergeOption, false, true, true );
@@ -2451,37 +2451,37 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
nMergeTestEndCol = MAXCOL;
if ( eCmd==DEL_DELROWS || eCmd==DEL_CELLSUP )
nMergeTestEndRow = MAXROW;
- ScPatternAttr aPattern( pDoc->GetPool() );
+ ScPatternAttr aPattern( rDoc.GetPool() );
aPattern.GetItemSet().Put( ScMergeFlagAttr() );
- pDoc->ApplyPatternArea( nExtendStartCol, nExtendStartRow, nMergeTestEndCol, nMergeTestEndRow, aMark, aPattern );
+ rDoc.ApplyPatternArea( nExtendStartCol, nExtendStartRow, nMergeTestEndCol, nMergeTestEndRow, aMark, aPattern );
itr = aMark.begin(), itrEnd = aMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
SCTAB nScenarioCount = 0;
- for( SCTAB j = *itr+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ for( SCTAB j = *itr+1; j<nTabCount && rDoc.IsScenario(j); j++ )
nScenarioCount ++;
ScRange aMergedRange( nExtendStartCol, nExtendStartRow, *itr, nMergeTestEndCol, nMergeTestEndRow, *itr+nScenarioCount );
- pDoc->ExtendMerge( aMergedRange, true );
+ rDoc.ExtendMerge( aMergedRange, true );
}
}
itr = aMark.begin(), itrEnd = aMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
{
- pDoc->SetDrawPageSize(*itr);
+ rDoc.SetDrawPageSize(*itr);
if ( eCmd == DEL_DELCOLS || eCmd == DEL_DELROWS )
- pDoc->UpdatePageBreaks( *itr );
+ rDoc.UpdatePageBreaks( *itr );
rDocShell.UpdatePaintExt( nExtFlags, nPaintStartCol, nPaintStartRow, *itr, nPaintEndCol, nPaintEndRow, *itr );
SCTAB nScenarioCount = 0;
- for( SCTAB j = *itr+1; j<nTabCount && pDoc->IsScenario(j); j++ )
+ for( SCTAB j = *itr+1; j<nTabCount && rDoc.IsScenario(j); j++ )
nScenarioCount ++;
// ganze Zeilen loeschen: nichts anpassen
@@ -2527,13 +2527,13 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
// zugehoerige Szenarien auch anpassen - nur wenn innerhalb einer Tabelle verschoben wird!
bool bScenariosAdded = false;
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- SCTAB nTabCount = pDoc->GetTableCount();
- if ( nDestTab == nStartTab && !pDoc->IsScenario(nEndTab) )
- while ( nEndTab+1 < nTabCount && pDoc->IsScenario(nEndTab+1) )
+ SCTAB nTabCount = rDoc.GetTableCount();
+ if ( nDestTab == nStartTab && !rDoc.IsScenario(nEndTab) )
+ while ( nEndTab+1 < nTabCount && rDoc.IsScenario(nEndTab+1) )
{
++nEndTab;
bScenariosAdded = true;
@@ -2551,7 +2551,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
aSourceMark.SetMarkArea( rSource );
ScDocShellRef aDragShellRef;
- if ( pDoc->HasOLEObjectsInArea( rSource ) )
+ if ( rDoc.HasOLEObjectsInArea( rSource ) )
{
aDragShellRef = new ScDocShell; // DocShell needs a Ref immediately
aDragShellRef->DoInitNew(NULL);
@@ -2559,7 +2559,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
ScDrawLayer::SetGlobalDrawPersist(aDragShellRef);
ScClipParam aClipParam(ScRange(nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nStartTab), bCut);
- pDoc->CopyToClip(aClipParam, pClipDoc, &aSourceMark, false, bScenariosAdded, true);
+ rDoc.CopyToClip(aClipParam, pClipDoc, &aSourceMark, false, bScenariosAdded, true);
ScDrawLayer::SetGlobalDrawPersist(NULL);
@@ -2570,7 +2570,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
{
SCCOL nTmpEndCol = nOldEndCol;
SCROW nTmpEndRow = nOldEndRow;
- if (pDoc->ExtendMerge( nStartCol, nStartRow, nTmpEndCol, nTmpEndRow, nTab ))
+ if (rDoc.ExtendMerge( nStartCol, nStartRow, nTmpEndCol, nTmpEndRow, nTab ))
bClipOver = true;
if ( nTmpEndCol > nEndCol ) nEndCol = nTmpEndCol;
if ( nTmpEndRow > nEndRow ) nEndRow = nTmpEndRow;
@@ -2607,10 +2607,10 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
ScEditableTester aTester;
for (nTab=nDestTab; nTab<=nDestEndTab; nTab++)
- aTester.TestBlock( pDoc, nTab, nDestCol,nDestRow, nUndoEndCol,nUndoEndRow );
+ aTester.TestBlock( &rDoc, nTab, nDestCol,nDestRow, nUndoEndCol,nUndoEndRow );
if (bCut)
for (nTab=nStartTab; nTab<=nEndTab; nTab++)
- aTester.TestBlock( pDoc, nTab, nStartCol,nStartRow, nEndCol,nEndRow );
+ aTester.TestBlock( &rDoc, nTab, nStartCol,nStartRow, nEndCol,nEndRow );
if (!aTester.IsEditable())
{
@@ -2623,7 +2623,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
// Test auf zusammengefasste - beim Verschieben erst nach dem Loeschen
if (bClipOver && !bCut)
- if (pDoc->HasAttrib( nDestCol,nDestRow,nDestTab, nUndoEndCol,nUndoEndRow,nDestEndTab,
+ if (rDoc.HasAttrib( nDestCol,nDestRow,nDestTab, nUndoEndCol,nUndoEndRow,nDestEndTab,
HASATTR_MERGED | HASATTR_OVERLAPPED ))
{ // "Zusammenfassen nicht verschachteln !"
if (!bApi)
@@ -2653,25 +2653,25 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
sal_uInt16 nUndoFlags = (IDF_ALL & ~IDF_OBJECTS) | IDF_NOCAPTIONS;
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab, bWholeCols, bWholeRows );
+ pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab, bWholeCols, bWholeRows );
if (bCut)
{
- pDoc->CopyToDocument( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab,
+ rDoc.CopyToDocument( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab,
nUndoFlags, false, pUndoDoc );
pRefUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRefUndoDoc->InitUndo( pDoc, 0, nTabCount-1, false, false );
+ pRefUndoDoc->InitUndo( &rDoc, 0, nTabCount-1, false, false );
}
if ( nDestTab != nStartTab )
pUndoDoc->AddUndoTab( nDestTab, nDestEndTab, bWholeCols, bWholeRows );
- pDoc->CopyToDocument( nDestCol, nDestRow, nDestTab,
+ rDoc.CopyToDocument( nDestCol, nDestRow, nDestTab,
nDestEndCol, nDestEndRow, nDestEndTab,
nUndoFlags, false, pUndoDoc );
- pUndoData = new ScRefUndoData( pDoc );
+ pUndoData = new ScRefUndoData( &rDoc );
- pDoc->BeginDrawUndo();
+ rDoc.BeginDrawUndo();
}
bool bSourceHeight = false; // Hoehen angepasst?
@@ -2680,24 +2680,24 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
ScMarkData aDelMark; // only for tables
for (nTab=nStartTab; nTab<=nEndTab; nTab++)
{
- pDoc->DeleteAreaTab( nStartCol,nStartRow, nOldEndCol,nOldEndRow, nTab, IDF_ALL );
+ rDoc.DeleteAreaTab( nStartCol,nStartRow, nOldEndCol,nOldEndRow, nTab, IDF_ALL );
aDelMark.SelectTable( nTab, true );
}
- pDoc->DeleteObjectsInArea( nStartCol,nStartRow, nOldEndCol,nOldEndRow, aDelMark );
+ rDoc.DeleteObjectsInArea( nStartCol,nStartRow, nOldEndCol,nOldEndRow, aDelMark );
// Test auf zusammengefasste
if (bClipOver)
- if (pDoc->HasAttrib( nDestCol,nDestRow,nDestTab,
+ if (rDoc.HasAttrib( nDestCol,nDestRow,nDestTab,
nUndoEndCol,nUndoEndRow,nDestEndTab,
HASATTR_MERGED | HASATTR_OVERLAPPED ))
{
- pDoc->CopyFromClip( rSource, aSourceMark, IDF_ALL, pRefUndoDoc, pClipDoc );
+ rDoc.CopyFromClip( rSource, aSourceMark, IDF_ALL, pRefUndoDoc, pClipDoc );
for (nTab=nStartTab; nTab<=nEndTab; nTab++)
{
SCCOL nTmpEndCol = nEndCol;
SCROW nTmpEndRow = nEndRow;
- pDoc->ExtendMerge( nStartCol, nStartRow, nTmpEndCol, nTmpEndRow, nTab, true );
+ rDoc.ExtendMerge( nStartCol, nStartRow, nTmpEndCol, nTmpEndRow, nTab, true );
}
// Fehlermeldung erst nach dem Wiederherstellen des Inhalts
@@ -2725,7 +2725,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
function ScDocument::UpdateReference() is called which calls
ScDrawLayer::MoveCells() which may move away inserted objects to wrong
positions (e.g. if source and destination range overlaps).*/
- pDoc->CopyFromClip( aPasteDest, aDestMark, IDF_ALL & ~(IDF_OBJECTS),
+ rDoc.CopyFromClip( aPasteDest, aDestMark, IDF_ALL & ~(IDF_OBJECTS),
NULL, pClipDoc, true, false, bIncludeFiltered );
@@ -2742,7 +2742,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
and row heights. There are no cell notes or drawing objects, if the
clipdoc does not contain a drawing layer.*/
if ( pClipDoc->GetDrawLayer() )
- pDoc->CopyFromClip( aPasteDest, aDestMark, IDF_OBJECTS,
+ rDoc.CopyFromClip( aPasteDest, aDestMark, IDF_OBJECTS,
pRefUndoDoc, pClipDoc, true, false, bIncludeFiltered );
if (bRecord)
@@ -2773,14 +2773,14 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
{
SCCOL nTmpEndCol = nDestEndCol;
SCROW nTmpEndRow = nDestEndRow;
- pDoc->ExtendMerge( nDestCol, nDestRow, nTmpEndCol, nTmpEndRow, nTab, true );
+ rDoc.ExtendMerge( nDestCol, nDestRow, nTmpEndCol, nTmpEndRow, nTab, true );
if (nTmpEndCol > nDestPaintEndCol) nDestPaintEndCol = nTmpEndCol;
if (nTmpEndRow > nDestPaintEndRow) nDestPaintEndRow = nTmpEndRow;
}
if (bCut)
for (nTab=nStartTab; nTab<=nEndTab; nTab++)
- pDoc->RefreshAutoFilter( nStartCol, nStartRow, nEndCol, nEndRow, nTab );
+ rDoc.RefreshAutoFilter( nStartCol, nStartRow, nEndCol, nEndRow, nTab );
if (bPaint)
{
@@ -2962,29 +2962,29 @@ bool ScDocFunc::InsertTable( SCTAB nTab, const OUString& rName, bool bRecord, bo
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
// Strange loop, also basic is loaded too early ( InsertTable )
// is called via the xml import for sheets in described in ODF
bool bInsertDocModule = false;
- if( !rDocShell.GetDocument()->IsImportingXML() )
+ if( !rDocShell.GetDocument().IsImportingXML() )
{
- bInsertDocModule = pDoc && pDoc->IsInVBAMode();
+ bInsertDocModule = rDoc.IsInVBAMode();
}
- if ( bInsertDocModule || ( bRecord && !pDoc->IsUndoEnabled() ) )
+ if ( bInsertDocModule || ( bRecord && !rDoc.IsUndoEnabled() ) )
bRecord = false;
if (bRecord)
- pDoc->BeginDrawUndo(); // InsertTab erzeugt ein SdrUndoNewPage
+ rDoc.BeginDrawUndo(); // InsertTab erzeugt ein SdrUndoNewPage
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
bool bAppend = ( nTab >= nTabCount );
if ( bAppend )
nTab = nTabCount; // wichtig fuer Undo
- if (pDoc->InsertTab( nTab, rName ))
+ if (rDoc.InsertTab( nTab, rName ))
{
if (bRecord)
rDocShell.GetUndoManager()->AddUndoAction(
@@ -2994,7 +2994,7 @@ bool ScDocFunc::InsertTable( SCTAB nTab, const OUString& rName, bool bRecord, bo
if( bInsertDocModule )
{
OUString sSource, sCodeName;
- VBA_InsertModule( *pDoc, nTab, sCodeName, sSource );
+ VBA_InsertModule( rDoc, nTab, sCodeName, sSource );
}
rDocShell.Broadcast( ScTablesHint( SC_TAB_INSERTED, nTab ) );
@@ -3016,55 +3016,55 @@ bool ScDocFunc::DeleteTable( SCTAB nTab, bool bRecord, bool /* bApi */ )
ScDocShellModificator aModificator( rDocShell );
bool bSuccess = false;
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bVbaEnabled = pDoc && pDoc->IsInVBAMode();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bVbaEnabled = rDoc.IsInVBAMode();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
if ( bVbaEnabled )
bRecord = false;
- bool bWasLinked = pDoc->IsLinked(nTab);
+ bool bWasLinked = rDoc.IsLinked(nTab);
ScDocument* pUndoDoc = NULL;
ScRefUndoData* pUndoData = NULL;
if (bRecord)
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- SCTAB nCount = pDoc->GetTableCount();
+ SCTAB nCount = rDoc.GetTableCount();
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true ); // nur nTab mit Flags
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true ); // nur nTab mit Flags
pUndoDoc->AddUndoTab( 0, nCount-1 ); // alle Tabs fuer Referenzen
- pDoc->CopyToDocument(0,0,nTab, MAXCOL,MAXROW,nTab, IDF_ALL,false, pUndoDoc );
+ rDoc.CopyToDocument(0,0,nTab, MAXCOL,MAXROW,nTab, IDF_ALL,false, pUndoDoc );
OUString aOldName;
- pDoc->GetName( nTab, aOldName );
+ rDoc.GetName( nTab, aOldName );
pUndoDoc->RenameTab( nTab, aOldName, false );
if (bWasLinked)
- pUndoDoc->SetLink( nTab, pDoc->GetLinkMode(nTab), pDoc->GetLinkDoc(nTab),
- pDoc->GetLinkFlt(nTab), pDoc->GetLinkOpt(nTab),
- pDoc->GetLinkTab(nTab),
- pDoc->GetLinkRefreshDelay(nTab) );
+ pUndoDoc->SetLink( nTab, rDoc.GetLinkMode(nTab), rDoc.GetLinkDoc(nTab),
+ rDoc.GetLinkFlt(nTab), rDoc.GetLinkOpt(nTab),
+ rDoc.GetLinkTab(nTab),
+ rDoc.GetLinkRefreshDelay(nTab) );
- if ( pDoc->IsScenario(nTab) )
+ if ( rDoc.IsScenario(nTab) )
{
pUndoDoc->SetScenario( nTab, true );
OUString aComment;
Color aColor;
sal_uInt16 nScenFlags;
- pDoc->GetScenarioData( nTab, aComment, aColor, nScenFlags );
+ rDoc.GetScenarioData( nTab, aComment, aColor, nScenFlags );
pUndoDoc->SetScenarioData( nTab, aComment, aColor, nScenFlags );
- bool bActive = pDoc->IsActiveScenario( nTab );
+ bool bActive = rDoc.IsActiveScenario( nTab );
pUndoDoc->SetActiveScenario( nTab, bActive );
}
- pUndoDoc->SetVisible( nTab, pDoc->IsVisible( nTab ) );
- pUndoDoc->SetTabBgColor( nTab, pDoc->GetTabBgColor(nTab) );
- pUndoDoc->SetSheetEvents( nTab, pDoc->GetSheetEvents( nTab ) );
+ pUndoDoc->SetVisible( nTab, rDoc.IsVisible( nTab ) );
+ pUndoDoc->SetTabBgColor( nTab, rDoc.GetTabBgColor(nTab) );
+ pUndoDoc->SetSheetEvents( nTab, rDoc.GetSheetEvents( nTab ) );
// Drawing-Layer muss sein Undo selbst in der Hand behalten !!!
- pDoc->BeginDrawUndo(); // DeleteTab erzeugt ein SdrUndoDelPage
+ rDoc.BeginDrawUndo(); // DeleteTab erzeugt ein SdrUndoDelPage
- pUndoData = new ScRefUndoData( pDoc );
+ pUndoData = new ScRefUndoData( &rDoc );
}
- if (pDoc->DeleteTab(nTab))
+ if (rDoc.DeleteTab(nTab))
{
if (bRecord)
{
@@ -3077,7 +3077,7 @@ bool ScDocFunc::DeleteTable( SCTAB nTab, bool bRecord, bool /* bApi */ )
if( bVbaEnabled )
{
OUString sCodeName;
- if( pDoc->GetCodeName( nTab, sCodeName ) )
+ if( rDoc.GetCodeName( nTab, sCodeName ) )
{
VBA_DeleteModule( rDocShell, sCodeName );
}
@@ -3112,12 +3112,12 @@ bool ScDocFunc::DeleteTable( SCTAB nTab, bool bRecord, bool /* bApi */ )
bool ScDocFunc::SetTableVisible( SCTAB nTab, bool bVisible, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo(pDoc->IsUndoEnabled());
- if ( pDoc->IsVisible( nTab ) == bVisible )
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo(rDoc.IsUndoEnabled());
+ if ( rDoc.IsVisible( nTab ) == bVisible )
return true; // nichts zu tun - ok
- if ( !pDoc->IsDocEditable() )
+ if ( !rDoc.IsDocEditable() )
{
if (!bApi)
rDocShell.ErrorMessage(STR_PROTECTIONERR);
@@ -3126,14 +3126,14 @@ bool ScDocFunc::SetTableVisible( SCTAB nTab, bool bVisible, bool bApi )
ScDocShellModificator aModificator( rDocShell );
- if ( !bVisible && !pDoc->IsImportingXML() ) // #i57869# allow hiding in any order for loading
+ if ( !bVisible && !rDoc.IsImportingXML() ) // #i57869# allow hiding in any order for loading
{
// nicht alle Tabellen ausblenden
sal_uInt16 nVisCount = 0;
- SCTAB nCount = pDoc->GetTableCount();
+ SCTAB nCount = rDoc.GetTableCount();
for (SCTAB i=0; i<nCount && nVisCount<2; i++)
- if (pDoc->IsVisible(i))
+ if (rDoc.IsVisible(i))
++nVisCount;
if (nVisCount <= 1)
@@ -3144,7 +3144,7 @@ bool ScDocFunc::SetTableVisible( SCTAB nTab, bool bVisible, bool bApi )
}
}
- pDoc->SetVisible( nTab, bVisible );
+ rDoc.SetVisible( nTab, bVisible );
if (bUndo)
{
std::vector<SCTAB> undoTabs;
@@ -3165,16 +3165,16 @@ bool ScDocFunc::SetTableVisible( SCTAB nTab, bool bVisible, bool bApi )
bool ScDocFunc::SetLayoutRTL( SCTAB nTab, bool bRTL, bool /* bApi */ )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo(pDoc->IsUndoEnabled());
- if ( pDoc->IsLayoutRTL( nTab ) == bRTL )
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo(rDoc.IsUndoEnabled());
+ if ( rDoc.IsLayoutRTL( nTab ) == bRTL )
return true; // nothing to do - ok
//! protection (sheet or document?)
ScDocShellModificator aModificator( rDocShell );
- pDoc->SetLayoutRTL( nTab, bRTL );
+ rDoc.SetLayoutRTL( nTab, bRTL );
if (bUndo)
{
@@ -3196,10 +3196,10 @@ bool ScDocFunc::SetLayoutRTL( SCTAB nTab, bool bRTL, bool /* bApi */ )
bool ScDocFunc::RenameTable( SCTAB nTab, const OUString& rName, bool bRecord, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- if ( !pDoc->IsDocEditable() )
+ if ( !rDoc.IsDocEditable() )
{
if (!bApi)
rDocShell.ErrorMessage(STR_PROTECTIONERR);
@@ -3210,8 +3210,8 @@ bool ScDocFunc::RenameTable( SCTAB nTab, const OUString& rName, bool bRecord, bo
bool bSuccess = false;
OUString sOldName;
- pDoc->GetName(nTab, sOldName);
- if (pDoc->RenameTab( nTab, rName ))
+ rDoc.GetName(nTab, sOldName);
+ if (rDoc.RenameTab( nTab, rName ))
{
if (bRecord)
{
@@ -3230,10 +3230,10 @@ bool ScDocFunc::RenameTable( SCTAB nTab, const OUString& rName, bool bRecord, bo
bool ScDocFunc::SetTabBgColor( SCTAB nTab, const Color& rColor, bool bRecord, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- if ( !pDoc->IsDocEditable() || pDoc->IsTabProtected(nTab) )
+ if ( !rDoc.IsDocEditable() || rDoc.IsTabProtected(nTab) )
{
if (!bApi)
rDocShell.ErrorMessage(STR_PROTECTIONERR); //TODO Check to see what this string is...
@@ -3241,11 +3241,11 @@ bool ScDocFunc::SetTabBgColor( SCTAB nTab, const Color& rColor, bool bRecord, bo
}
Color aOldTabBgColor;
- aOldTabBgColor = pDoc->GetTabBgColor(nTab);
+ aOldTabBgColor = rDoc.GetTabBgColor(nTab);
bool bSuccess = false;
- pDoc->SetTabBgColor(nTab, rColor);
- if ( pDoc->GetTabBgColor(nTab) == rColor)
+ rDoc.SetTabBgColor(nTab, rColor);
+ if ( rDoc.GetTabBgColor(nTab) == rColor)
bSuccess = true;
if (bSuccess)
{
@@ -3267,11 +3267,11 @@ bool ScDocFunc::SetTabBgColor( SCTAB nTab, const Color& rColor, bool bRecord, bo
bool ScDocFunc::SetTabBgColor(
ScUndoTabColorInfo::List& rUndoTabColorList, bool bRecord, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- if ( !pDoc->IsDocEditable() )
+ if ( !rDoc.IsDocEditable() )
{
if (!bApi)
rDocShell.ErrorMessage(STR_PROTECTIONERR); //TODO Get a better String Error...
@@ -3287,12 +3287,12 @@ bool ScDocFunc::SetTabBgColor(
{
ScUndoTabColorInfo& rInfo = rUndoTabColorList[i];
nTab = rInfo.mnTabId;
- if ( !pDoc->IsTabProtected(nTab) )
+ if ( !rDoc.IsTabProtected(nTab) )
{
aNewTabBgColor = rInfo.maNewTabBgColor;
- rInfo.maOldTabBgColor = pDoc->GetTabBgColor(nTab);
- pDoc->SetTabBgColor(nTab, aNewTabBgColor);
- if ( pDoc->GetTabBgColor(nTab) != aNewTabBgColor)
+ rInfo.maOldTabBgColor = rDoc.GetTabBgColor(nTab);
+ rDoc.SetTabBgColor(nTab, aNewTabBgColor);
+ if ( rDoc.GetTabBgColor(nTab) != aNewTabBgColor)
{
bSuccess = false;
break;
@@ -3337,9 +3337,9 @@ static sal_uInt16 lcl_GetOptimalColWidth( ScDocShell& rDocShell, SCCOL nCol, SCT
double nPPTX = aProv.GetPPTX();
double nPPTY = aProv.GetPPTY();
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
Fraction aOne(1,1);
- sal_uInt16 nTwips = pDoc->GetOptimalColWidth( nCol, nTab, pDev, nPPTX, nPPTY, aOne, aOne,
+ sal_uInt16 nTwips = rDoc.GetOptimalColWidth( nCol, nTab, pDev, nPPTX, nPPTY, aOne, aOne,
bFormula, NULL );
return nTwips;
@@ -3354,12 +3354,12 @@ bool ScDocFunc::SetWidthOrHeight(
if (rRanges.empty())
return true;
- ScDocument* pDoc = rDocShell.GetDocument();
- if ( bRecord && !pDoc->IsUndoEnabled() )
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if ( bRecord && !rDoc.IsUndoEnabled() )
bRecord = false;
// import into read-only document is possible
- if ( !pDoc->IsChangeReadOnlyEnabled() && !rDocShell.IsEditable() )
+ if ( !rDoc.IsChangeReadOnlyEnabled() && !rDocShell.IsEditable() )
{
if (!bApi)
rDocShell.ErrorMessage(STR_PROTECTIONERR); //! eigene Meldung?
@@ -3382,23 +3382,23 @@ bool ScDocFunc::SetWidthOrHeight(
if ( bRecord )
{
- pDoc->BeginDrawUndo(); // Drawing Updates
+ rDoc.BeginDrawUndo(); // Drawing Updates
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
if (bWidth)
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, false );
- pDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab, static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, false );
+ rDoc.CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab, static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false, pUndoDoc );
}
else
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, false, true );
- pDoc->CopyToDocument( 0, static_cast<SCROW>(nStart), nTab, MAXCOL, static_cast<SCROW>(nEnd), nTab, IDF_NONE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ rDoc.CopyToDocument( 0, static_cast<SCROW>(nStart), nTab, MAXCOL, static_cast<SCROW>(nEnd), nTab, IDF_NONE, false, pUndoDoc );
}
aUndoRanges = rRanges;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
if (pTable)
pUndoTab = new ScOutlineTable( *pTable );
}
@@ -3422,11 +3422,11 @@ bool ScDocFunc::SetWidthOrHeight(
// dann SetOptimalHeight mit bShrink = FALSE
for (SCROW nRow=nStartNo; nRow<=nEndNo; nRow++)
{
- sal_uInt8 nOld = pDoc->GetRowFlags(nRow,nTab);
+ sal_uInt8 nOld = rDoc.GetRowFlags(nRow,nTab);
SCROW nLastRow = -1;
- bool bHidden = pDoc->RowHidden(nRow, nTab, NULL, &nLastRow);
+ bool bHidden = rDoc.RowHidden(nRow, nTab, NULL, &nLastRow);
if ( !bHidden && ( nOld & CR_MANUALSIZE ) )
- pDoc->SetRowFlags( nRow, nTab, nOld & ~CR_MANUALSIZE );
+ rDoc.SetRowFlags( nRow, nTab, nOld & ~CR_MANUALSIZE );
}
}
@@ -3434,10 +3434,10 @@ bool ScDocFunc::SetWidthOrHeight(
Fraction aOne(1,1);
sc::RowHeightContext aCxt(aProv.GetPPTX(), aProv.GetPPTY(), aOne, aOne, aProv.GetDevice());
aCxt.setForceAutoSize(bAll);
- pDoc->SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab);
+ rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab);
if (bAll)
- pDoc->ShowRows( nStartNo, nEndNo, nTab, true );
+ rDoc.ShowRows( nStartNo, nEndNo, nTab, true );
// Manual-Flag wird bei bAll=sal_True schon in SetOptimalHeight gesetzt
// (an bei Extra-Height, sonst aus).
@@ -3446,22 +3446,22 @@ bool ScDocFunc::SetWidthOrHeight(
{
if (nSizeTwips)
{
- pDoc->SetRowHeightRange( nStartNo, nEndNo, nTab, nSizeTwips );
- pDoc->SetManualHeight( nStartNo, nEndNo, nTab, true ); // height was set manually
+ rDoc.SetRowHeightRange( nStartNo, nEndNo, nTab, nSizeTwips );
+ rDoc.SetManualHeight( nStartNo, nEndNo, nTab, true ); // height was set manually
}
if ( eMode != SC_SIZE_ORIGINAL )
- pDoc->ShowRows( nStartNo, nEndNo, nTab, nSizeTwips != 0 );
+ rDoc.ShowRows( nStartNo, nEndNo, nTab, nSizeTwips != 0 );
}
else if ( eMode==SC_SIZE_SHOW )
{
- pDoc->ShowRows( nStartNo, nEndNo, nTab, true );
+ rDoc.ShowRows( nStartNo, nEndNo, nTab, true );
}
}
else // Spaltenbreiten
{
for (SCCOL nCol=static_cast<SCCOL>(nStartNo); nCol<=static_cast<SCCOL>(nEndNo); nCol++)
{
- if ( eMode != SC_SIZE_VISOPT || !pDoc->ColHidden(nCol, nTab) )
+ if ( eMode != SC_SIZE_VISOPT || !rDoc.ColHidden(nCol, nTab) )
{
sal_uInt16 nThisSize = nSizeTwips;
@@ -3469,10 +3469,10 @@ bool ScDocFunc::SetWidthOrHeight(
nThisSize = nSizeTwips +
lcl_GetOptimalColWidth( rDocShell, nCol, nTab, bFormula );
if ( nThisSize )
- pDoc->SetColWidth( nCol, nTab, nThisSize );
+ rDoc.SetColWidth( nCol, nTab, nThisSize );
if ( eMode != SC_SIZE_ORIGINAL )
- pDoc->ShowCol( nCol, nTab, bShow );
+ rDoc.ShowCol( nCol, nTab, bShow );
}
}
}
@@ -3482,16 +3482,16 @@ bool ScDocFunc::SetWidthOrHeight(
if ( eMode != SC_SIZE_ORIGINAL )
{
if (bWidth)
- bOutline = bOutline || pDoc->UpdateOutlineCol(
+ bOutline = bOutline || rDoc.UpdateOutlineCol(
static_cast<SCCOL>(nStartNo),
static_cast<SCCOL>(nEndNo), nTab, bShow );
else
- bOutline = bOutline || pDoc->UpdateOutlineRow(
+ bOutline = bOutline || rDoc.UpdateOutlineRow(
static_cast<SCROW>(nStartNo),
static_cast<SCROW>(nEndNo), nTab, bShow );
}
}
- pDoc->SetDrawPageSize(nTab);
+ rDoc.SetDrawPageSize(nTab);
if (!bOutline)
DELETEZ(pUndoTab);
@@ -3506,7 +3506,7 @@ bool ScDocFunc::SetWidthOrHeight(
aUndoRanges, pUndoTab, eMode, nSizeTwips, bWidth));
}
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.UpdatePageBreaks( nTab );
rDocShell.PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PAINT_ALL);
aModificator.SetDocumentModified();
@@ -3520,8 +3520,8 @@ bool ScDocFunc::InsertPageBreak( bool bColumn, const ScAddress& rPos,
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
SCTAB nTab = rPos.Tab();
SfxBindings* pBindings = rDocShell.GetViewBindings();
@@ -3532,8 +3532,8 @@ bool ScDocFunc::InsertPageBreak( bool bColumn, const ScAddress& rPos,
return false; // erste Spalte / Zeile
ScBreakType nBreak = bColumn ?
- pDoc->HasColBreak(static_cast<SCCOL>(nPos), nTab) :
- pDoc->HasRowBreak(static_cast<SCROW>(nPos), nTab);
+ rDoc.HasColBreak(static_cast<SCCOL>(nPos), nTab) :
+ rDoc.HasRowBreak(static_cast<SCROW>(nPos), nTab);
if (nBreak & BREAK_MANUAL)
return true;
@@ -3542,15 +3542,15 @@ bool ScDocFunc::InsertPageBreak( bool bColumn, const ScAddress& rPos,
new ScUndoPageBreak( &rDocShell, rPos.Col(), rPos.Row(), nTab, bColumn, true ) );
if (bColumn)
- pDoc->SetColBreak(static_cast<SCCOL>(nPos), nTab, false, true);
+ rDoc.SetColBreak(static_cast<SCCOL>(nPos), nTab, false, true);
else
- pDoc->SetRowBreak(static_cast<SCROW>(nPos), nTab, false, true);
+ rDoc.SetRowBreak(static_cast<SCROW>(nPos), nTab, false, true);
- pDoc->InvalidatePageBreaks(nTab);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.InvalidatePageBreaks(nTab);
+ rDoc.UpdatePageBreaks( nTab );
- if (pDoc->IsStreamValid(nTab))
- pDoc->SetStreamValid(nTab, false);
+ if (rDoc.IsStreamValid(nTab))
+ rDoc.SetStreamValid(nTab, false);
if (bColumn)
{
@@ -3584,8 +3584,8 @@ bool ScDocFunc::RemovePageBreak( bool bColumn, const ScAddress& rPos,
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
SCTAB nTab = rPos.Tab();
SfxBindings* pBindings = rDocShell.GetViewBindings();
@@ -3595,9 +3595,9 @@ bool ScDocFunc::RemovePageBreak( bool bColumn, const ScAddress& rPos,
ScBreakType nBreak;
if (bColumn)
- nBreak = pDoc->HasColBreak(static_cast<SCCOL>(nPos), nTab);
+ nBreak = rDoc.HasColBreak(static_cast<SCCOL>(nPos), nTab);
else
- nBreak = pDoc->HasRowBreak(static_cast<SCROW>(nPos), nTab);
+ nBreak = rDoc.HasRowBreak(static_cast<SCROW>(nPos), nTab);
if ((nBreak & BREAK_MANUAL) == 0)
// There is no manual break.
return false;
@@ -3607,14 +3607,14 @@ bool ScDocFunc::RemovePageBreak( bool bColumn, const ScAddress& rPos,
new ScUndoPageBreak( &rDocShell, rPos.Col(), rPos.Row(), nTab, bColumn, false ) );
if (bColumn)
- pDoc->RemoveColBreak(static_cast<SCCOL>(nPos), nTab, false, true);
+ rDoc.RemoveColBreak(static_cast<SCCOL>(nPos), nTab, false, true);
else
- pDoc->RemoveRowBreak(static_cast<SCROW>(nPos), nTab, false, true);
+ rDoc.RemoveRowBreak(static_cast<SCROW>(nPos), nTab, false, true);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.UpdatePageBreaks( nTab );
- if (pDoc->IsStreamValid(nTab))
- pDoc->SetStreamValid(nTab, false);
+ if (rDoc.IsStreamValid(nTab))
+ rDoc.SetStreamValid(nTab, false);
if (bColumn)
{
@@ -3645,12 +3645,12 @@ bool ScDocFunc::RemovePageBreak( bool bColumn, const ScAddress& rPos,
void ScDocFunc::ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- pDoc->SetTabProtection(nTab, &rProtect);
- if (pDoc->IsUndoEnabled())
+ rDoc.SetTabProtection(nTab, &rProtect);
+ if (rDoc.IsUndoEnabled())
{
- ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
OSL_ENSURE(pProtect, "ScDocFunc::Unprotect: ScTableProtection pointer is NULL!");
if (pProtect)
{
@@ -3672,17 +3672,17 @@ void ScDocFunc::ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect )
bool ScDocFunc::Protect( SCTAB nTab, const OUString& rPassword, bool /*bApi*/ )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
if (nTab == TABLEID_DOC)
{
// document protection
ScDocProtection aProtection;
aProtection.setProtected(true);
aProtection.setPassword(rPassword);
- pDoc->SetDocProtection(&aProtection);
- if (pDoc->IsUndoEnabled())
+ rDoc.SetDocProtection(&aProtection);
+ if (rDoc.IsUndoEnabled())
{
- ScDocProtection* pProtect = pDoc->GetDocProtection();
+ ScDocProtection* pProtect = rDoc.GetDocProtection();
OSL_ENSURE(pProtect, "ScDocFunc::Unprotect: ScDocProtection pointer is NULL!");
if (pProtect)
{
@@ -3703,10 +3703,10 @@ bool ScDocFunc::Protect( SCTAB nTab, const OUString& rPassword, bool /*bApi*/ )
ScTableProtection aProtection;
aProtection.setProtected(true);
aProtection.setPassword(rPassword);
- pDoc->SetTabProtection(nTab, &aProtection);
- if (pDoc->IsUndoEnabled())
+ rDoc.SetTabProtection(nTab, &aProtection);
+ if (rDoc.IsUndoEnabled())
{
- ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
OSL_ENSURE(pProtect, "ScDocFunc::Unprotect: ScTableProtection pointer is NULL!");
if (pProtect)
{
@@ -3730,13 +3730,13 @@ bool ScDocFunc::Protect( SCTAB nTab, const OUString& rPassword, bool /*bApi*/ )
bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
if (nTab == TABLEID_DOC)
{
// document protection
- ScDocProtection* pDocProtect = pDoc->GetDocProtection();
+ ScDocProtection* pDocProtect = rDoc.GetDocProtection();
if (!pDocProtect || !pDocProtect->isProtected())
// already unprotected (should not happen)!
return true;
@@ -3756,8 +3756,8 @@ bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi )
return false;
}
- pDoc->SetDocProtection(NULL);
- if (pDoc->IsUndoEnabled())
+ rDoc.SetDocProtection(NULL);
+ if (rDoc.IsUndoEnabled())
{
pProtectCopy->setProtected(false);
rDocShell.GetUndoManager()->AddUndoAction(
@@ -3769,7 +3769,7 @@ bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi )
{
// sheet protection
- ScTableProtection* pTabProtect = pDoc->GetTabProtection(nTab);
+ ScTableProtection* pTabProtect = rDoc.GetTabProtection(nTab);
if (!pTabProtect || !pTabProtect->isProtected())
// already unprotected (should not happen)!
return true;
@@ -3788,8 +3788,8 @@ bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi )
return false;
}
- pDoc->SetTabProtection(nTab, NULL);
- if (pDoc->IsUndoEnabled())
+ rDoc.SetTabProtection(nTab, NULL);
+ if (rDoc.IsUndoEnabled())
{
pProtectCopy->setProtected(false);
rDocShell.GetUndoManager()->AddUndoAction(
@@ -3809,9 +3809,9 @@ bool ScDocFunc::ClearItems( const ScMarkData& rMark, const sal_uInt16* pWhich, b
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
- ScEditableTester aTester( pDoc, rMark );
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo (rDoc.IsUndoEnabled());
+ ScEditableTester aTester( &rDoc, rMark );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -3835,14 +3835,14 @@ bool ScDocFunc::ClearItems( const ScMarkData& rMark, const sal_uInt16* pWhich, b
SCTAB nEndTab = aMarkRange.aEnd.Tab();
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab );
- pDoc->CopyToDocument( aMarkRange, IDF_ATTRIB, true, pUndoDoc, (ScMarkData*)&aMultiMark );
+ pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab );
+ rDoc.CopyToDocument( aMarkRange, IDF_ATTRIB, true, pUndoDoc, (ScMarkData*)&aMultiMark );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoClearItems( &rDocShell, aMultiMark, pUndoDoc, pWhich ) );
}
- pDoc->ClearSelectionItems( pWhich, aMultiMark );
+ rDoc.ClearSelectionItems( pWhich, aMultiMark );
rDocShell.PostPaint( aMarkRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
aModificator.SetDocumentModified();
@@ -3856,9 +3856,9 @@ bool ScDocFunc::ChangeIndent( const ScMarkData& rMark, bool bIncrement, bool bAp
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo(pDoc->IsUndoEnabled());
- ScEditableTester aTester( pDoc, rMark );
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo(rDoc.IsUndoEnabled());
+ ScEditableTester aTester( &rDoc, rMark );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -3872,10 +3872,10 @@ bool ScDocFunc::ChangeIndent( const ScMarkData& rMark, bool bIncrement, bool bAp
if (bUndo)
{
SCTAB nStartTab = aMarkRange.aStart.Tab();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nStartTab, nStartTab );
+ pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab );
ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
if (*itr != nStartTab)
@@ -3884,13 +3884,13 @@ bool ScDocFunc::ChangeIndent( const ScMarkData& rMark, bool bIncrement, bool bAp
ScRange aCopyRange = aMarkRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, true, pUndoDoc, (ScMarkData*)&rMark );
+ rDoc.CopyToDocument( aCopyRange, IDF_ATTRIB, true, pUndoDoc, (ScMarkData*)&rMark );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoIndent( &rDocShell, rMark, pUndoDoc, bIncrement ) );
}
- pDoc->ChangeSelectionIndent( bIncrement, rMark );
+ rDoc.ChangeSelectionIndent( bIncrement, rMark );
rDocShell.PostPaint( aMarkRange, PAINT_GRID, SC_PF_LINES | SC_PF_TESTMERGE );
aModificator.SetDocumentModified();
@@ -3924,7 +3924,7 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
ScDocShellModificator aModificator( rDocShell );
bool bSuccess = false;
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
SCCOL nStartCol = rRange.aStart.Col();
SCROW nStartRow = rRange.aStart.Row();
SCTAB nStartTab = rRange.aStart.Tab();
@@ -3932,7 +3932,7 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nEndTab = rRange.aEnd.Tab();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScMarkData aMark;
if (pTabMark)
@@ -3944,19 +3944,19 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
}
ScAutoFormat* pAutoFormat = ScGlobal::GetOrCreateAutoFormat();
- ScEditableTester aTester( pDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
+ ScEditableTester aTester( &rDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
if ( nFormatNo < pAutoFormat->size() && aTester.IsEditable() )
{
WaitObject aWait( rDocShell.GetActiveDialogParent() );
bool bSize = pAutoFormat->findByIndex(nFormatNo)->GetIncludeWidthHeight();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
ScDocument* pUndoDoc = NULL;
if ( bRecord )
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nStartTab, nStartTab, bSize, bSize );
+ pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab, bSize, bSize );
ScMarkData::iterator itr = aMark.begin(), itrEnd = aMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
if (*itr != nStartTab)
@@ -3965,18 +3965,18 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
ScRange aCopyRange = rRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aStart.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, IDF_ATTRIB, false, pUndoDoc, &aMark );
+ rDoc.CopyToDocument( aCopyRange, IDF_ATTRIB, false, pUndoDoc, &aMark );
if (bSize)
{
- pDoc->CopyToDocument( nStartCol,0,0, nEndCol,MAXROW,nTabCount-1,
+ rDoc.CopyToDocument( nStartCol,0,0, nEndCol,MAXROW,nTabCount-1,
IDF_NONE, false, pUndoDoc, &aMark );
- pDoc->CopyToDocument( 0,nStartRow,0, MAXCOL,nEndRow,nTabCount-1,
+ rDoc.CopyToDocument( 0,nStartRow,0, MAXCOL,nEndRow,nTabCount-1,
IDF_NONE, false, pUndoDoc, &aMark );
}
- pDoc->BeginDrawUndo();
+ rDoc.BeginDrawUndo();
}
- pDoc->AutoFormat( nStartCol, nStartRow, nEndCol, nEndRow, nFormatNo, aMark );
+ rDoc.AutoFormat( nStartCol, nStartRow, nEndCol, nEndRow, nFormatNo, aMark );
if (bSize)
{
@@ -4029,7 +4029,7 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
ScDocShellModificator aModificator( rDocShell );
bool bSuccess = false;
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
SCCOL nStartCol = rRange.aStart.Col();
SCROW nStartRow = rRange.aStart.Row();
SCTAB nStartTab = rRange.aStart.Tab();
@@ -4037,7 +4037,7 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nEndTab = rRange.aEnd.Tab();
- bool bUndo(pDoc->IsUndoEnabled());
+ bool bUndo(rDoc.IsUndoEnabled());
ScMarkData aMark;
if (pTabMark)
@@ -4048,7 +4048,7 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
aMark.SelectTable( nTab, true );
}
- ScEditableTester aTester( pDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
+ ScEditableTester aTester( &rDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
if ( aTester.IsEditable() )
{
WaitObject aWait( rDocShell.GetActiveDialogParent() );
@@ -4059,35 +4059,35 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
{
//! auch bei Undo selektierte Tabellen beruecksichtigen
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab );
- pDoc->CopyToDocument( rRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab );
+ rDoc.CopyToDocument( rRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
}
// use TokenArray if given, string (and flags) otherwise
if ( pTokenArray )
{
- pDoc->InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
+ rDoc.InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
aMark, EMPTY_OUSTRING, pTokenArray, eGrammar);
}
- else if ( pDoc->IsImportingXML() )
+ else if ( rDoc.IsImportingXML() )
{
ScTokenArray* pCode = lcl_ScDocFunc_CreateTokenArrayXML( rString, rFormulaNmsp, eGrammar );
- pDoc->InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
+ rDoc.InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
aMark, EMPTY_OUSTRING, pCode, eGrammar);
delete pCode;
- pDoc->IncXMLImportedFormulaCount( rString.getLength() );
+ rDoc.IncXMLImportedFormulaCount( rString.getLength() );
}
else if (bEnglish)
{
- ScCompiler aComp( pDoc, rRange.aStart);
+ ScCompiler aComp( &rDoc, rRange.aStart);
aComp.SetGrammar(eGrammar);
ScTokenArray* pCode = aComp.CompileString( rString );
- pDoc->InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
+ rDoc.InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
aMark, EMPTY_OUSTRING, pCode, eGrammar);
delete pCode;
}
else
- pDoc->InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
+ rDoc.InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
aMark, rString, NULL, eGrammar);
if (bUndo)
@@ -4115,7 +4115,7 @@ bool ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
ScDocShellModificator aModificator( rDocShell );
bool bSuccess = false;
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
SCCOL nStartCol = rRange.aStart.Col();
SCROW nStartRow = rRange.aStart.Row();
SCTAB nStartTab = rRange.aStart.Tab();
@@ -4123,7 +4123,7 @@ bool ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nEndTab = rRange.aEnd.Tab();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScMarkData aMark;
@@ -4135,17 +4135,17 @@ bool ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
aMark.SelectTable( nTab, true );
}
- ScEditableTester aTester( pDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
+ ScEditableTester aTester( &rDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
if ( aTester.IsEditable() )
{
WaitObject aWait( rDocShell.GetActiveDialogParent() );
- pDoc->SetDirty( rRange );
+ rDoc.SetDirty( rRange );
if ( bRecord )
{
//! auch bei Undo selektierte Tabellen beruecksichtigen
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab );
- pDoc->CopyToDocument( rRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab );
+ rDoc.CopyToDocument( rRange, IDF_ALL & ~IDF_NOTE, false, pUndoDoc );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoTabOp( &rDocShell,
@@ -4157,7 +4157,7 @@ bool ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
rParam.aRefColCell,
rParam.meMode) );
}
- pDoc->InsertTableOp(rParam, nStartCol, nStartRow, nEndCol, nEndRow, aMark);
+ rDoc.InsertTableOp(rParam, nStartCol, nStartRow, nEndCol, nEndRow, aMark);
rDocShell.PostPaintGridAll();
aModificator.SetDocumentModified();
bSuccess = true;
@@ -4253,7 +4253,7 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
FillDir eDir, bool bRecord, bool bApi )
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
bool bSuccess = false;
ScRange aRange = rRange;
@@ -4266,7 +4266,7 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nEndRow = aRange.aEnd.Row();
SCTAB nEndTab = aRange.aEnd.Tab();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScMarkData aMark;
@@ -4278,7 +4278,7 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
aMark.SelectTable( nTab, true );
}
- ScEditableTester aTester( pDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
+ ScEditableTester aTester( &rDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
if ( aTester.IsEditable() )
{
WaitObject aWait( rDocShell.GetActiveDialogParent() );
@@ -4310,11 +4310,11 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
ScDocument* pUndoDoc = NULL;
if ( bRecord )
{
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
SCTAB nDestStartTab = aDestArea.aStart.Tab();
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nDestStartTab, nDestStartTab );
+ pUndoDoc->InitUndo( &rDoc, nDestStartTab, nDestStartTab );
ScMarkData::iterator itr = aMark.begin(), itrEnd = aMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
if (*itr != nDestStartTab)
@@ -4323,7 +4323,7 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
ScRange aCopyRange = aDestArea;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, IDF_AUTOFILL, false, pUndoDoc, &aMark );
+ rDoc.CopyToDocument( aCopyRange, IDF_AUTOFILL, false, pUndoDoc, &aMark );
}
sal_uLong nProgCount;
@@ -4332,10 +4332,10 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
else
nProgCount = aSourceArea.aEnd.Row() - aSourceArea.aStart.Row() + 1;
nProgCount *= nCount;
- ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScProgress aProgress( rDoc.GetDocumentShell(),
ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
- pDoc->Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
+ rDoc.Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), &aProgress,
aMark, nCount, eDir, FILL_SIMPLE );
AdjustRowHeight(aRange);
@@ -4366,7 +4366,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
ScDocShellModificator aModificator( rDocShell );
bool bSuccess = false;
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
SCCOL nStartCol = rRange.aStart.Col();
SCROW nStartRow = rRange.aStart.Row();
SCTAB nStartTab = rRange.aStart.Tab();
@@ -4374,7 +4374,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nEndTab = rRange.aEnd.Tab();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScMarkData aMark;
@@ -4386,7 +4386,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
aMark.SelectTable( nTab, true );
}
- ScEditableTester aTester( pDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
+ ScEditableTester aTester( &rDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
if ( aTester.IsEditable() )
{
WaitObject aWait( rDocShell.GetActiveDialogParent() );
@@ -4394,7 +4394,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
ScRange aSourceArea = rRange;
ScRange aDestArea = rRange;
- SCSIZE nCount = pDoc->GetEmptyLinesInBlock(
+ SCSIZE nCount = rDoc.GetEmptyLinesInBlock(
aSourceArea.aStart.Col(), aSourceArea.aStart.Row(), aSourceArea.aStart.Tab(),
aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), aSourceArea.aEnd.Tab(),
DirFromFillDir(eDir) );
@@ -4425,17 +4425,17 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
ScDocument* pUndoDoc = NULL;
if ( bRecord )
{
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
SCTAB nDestStartTab = aDestArea.aStart.Tab();
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nDestStartTab, nDestStartTab );
+ pUndoDoc->InitUndo( &rDoc, nDestStartTab, nDestStartTab );
ScMarkData::iterator itr = aMark.begin(), itrEnd = aMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
if (*itr != nDestStartTab)
pUndoDoc->AddUndoTab( *itr, *itr );
- pDoc->CopyToDocument(
+ rDoc.CopyToDocument(
aDestArea.aStart.Col(), aDestArea.aStart.Row(), 0,
aDestArea.aEnd.Col(), aDestArea.aEnd.Row(), nTabCount-1,
IDF_AUTOFILL, false, pUndoDoc, &aMark );
@@ -4449,7 +4449,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
SCCOL nValX = (eDir == FILL_TO_LEFT) ? aDestArea.aEnd.Col() : aDestArea.aStart.Col();
SCROW nValY = (eDir == FILL_TO_TOP ) ? aDestArea.aEnd.Row() : aDestArea.aStart.Row();
SCTAB nTab = aDestArea.aStart.Tab();
- pDoc->SetValue( nValX, nValY, nTab, fStart );
+ rDoc.SetValue( nValX, nValY, nTab, fStart );
}
sal_uLong nProgCount;
@@ -4458,10 +4458,10 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
else
nProgCount = aSourceArea.aEnd.Row() - aSourceArea.aStart.Row() + 1;
nProgCount *= nCount;
- ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScProgress aProgress( rDoc.GetDocumentShell(),
ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
- pDoc->Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
+ rDoc.Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), &aProgress,
aMark, nCount, eDir, eCmd, eDateCmd, fStep, fMax );
AdjustRowHeight(rRange);
@@ -4497,7 +4497,7 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e
{
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
SCCOL nStartCol = rRange.aStart.Col();
SCROW nStartRow = rRange.aStart.Row();
SCTAB nStartTab = rRange.aStart.Tab();
@@ -4505,7 +4505,7 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nEndTab = rRange.aEnd.Tab();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScMarkData aMark;
@@ -4554,7 +4554,7 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e
//! Quellbereich darf geschuetzt sein !!!
//! aber kein Matrixfragment enthalten !!!
- ScEditableTester aTester( pDoc, aDestArea );
+ ScEditableTester aTester( &rDoc, aDestArea );
if ( !aTester.IsEditable() )
{
if (!bApi)
@@ -4562,7 +4562,7 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e
return false;
}
- if ( pDoc->HasSelectedBlockMatrixFragment( nStartCol, nStartRow,
+ if ( rDoc.HasSelectedBlockMatrixFragment( nStartCol, nStartRow,
nEndCol, nEndRow, aMark ) )
{
if (!bApi)
@@ -4575,18 +4575,18 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e
ScDocument* pUndoDoc = NULL;
if ( bRecord )
{
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
SCTAB nDestStartTab = aDestArea.aStart.Tab();
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nDestStartTab, nDestStartTab );
+ pUndoDoc->InitUndo( &rDoc, nDestStartTab, nDestStartTab );
ScMarkData::iterator itr = aMark.begin(), itrEnd = aMark.end();
for (; itr != itrEnd && nTabCount; ++itr)
if (*itr != nDestStartTab)
pUndoDoc->AddUndoTab( *itr, *itr );
// do not clone note captions in undo document
- pDoc->CopyToDocument(
+ rDoc.CopyToDocument(
aDestArea.aStart.Col(), aDestArea.aStart.Row(), 0,
aDestArea.aEnd.Col(), aDestArea.aEnd.Row(), nTabCount-1,
IDF_AUTOFILL, false, pUndoDoc, &aMark );
@@ -4598,10 +4598,10 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e
else
nProgCount = aSourceArea.aEnd.Row() - aSourceArea.aStart.Row() + 1;
nProgCount *= nCount;
- ScProgress aProgress( pDoc->GetDocumentShell(),
+ ScProgress aProgress( rDoc.GetDocumentShell(),
ScGlobal::GetRscString(STR_FILL_SERIES_PROGRESS), nProgCount );
- pDoc->Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
+ rDoc.Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), &aProgress,
aMark, nCount, eDir, eCmd, eDateCmd, fStep, fMax );
@@ -4637,16 +4637,16 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo
return true;
}
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
set<SCTAB>::const_iterator itrBeg = rOption.maTabs.begin(), itrEnd = rOption.maTabs.end();
SCTAB nTab1 = *itrBeg, nTab2 = *rOption.maTabs.rbegin();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
for (set<SCTAB>::const_iterator itr = itrBeg; itr != itrEnd; ++itr)
{
- ScEditableTester aTester( pDoc, *itr, nStartCol, nStartRow, nEndCol, nEndRow );
+ ScEditableTester aTester( &rDoc, *itr, nStartCol, nStartRow, nEndCol, nEndRow );
if (!aTester.IsEditable())
{
if (!bApi)
@@ -4654,7 +4654,7 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo
return false;
}
- if ( pDoc->HasAttrib( nStartCol, nStartRow, *itr, nEndCol, nEndRow, *itr,
+ if ( rDoc.HasAttrib( nStartCol, nStartRow, *itr, nEndCol, nEndRow, *itr,
HASATTR_MERGED | HASATTR_OVERLAPPED ) )
{
// "Zusammenfassen nicht verschachteln !"
@@ -4670,8 +4670,8 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo
{
SCTAB nTab = *itr;
bool bNeedContents = bContents &&
- ( !pDoc->IsBlockEmpty( nTab, nStartCol,nStartRow+1, nStartCol,nEndRow, true ) ||
- !pDoc->IsBlockEmpty( nTab, nStartCol+1,nStartRow, nEndCol,nEndRow, true ) );
+ ( !rDoc.IsBlockEmpty( nTab, nStartCol,nStartRow+1, nStartCol,nEndRow, true ) ||
+ !rDoc.IsBlockEmpty( nTab, nStartCol+1,nStartRow, nEndCol,nEndRow, true ) );
if (bRecord)
{
@@ -4679,28 +4679,28 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo
bool bHasNotes = false;
for( ScAddress aPos( nStartCol, nStartRow, nTab ); !bHasNotes && (aPos.Col() <= nEndCol); aPos.IncCol() )
for( aPos.SetRow( nStartRow ); !bHasNotes && (aPos.Row() <= nEndRow); aPos.IncRow() )
- bHasNotes = ((aPos.Col() != nStartCol) || (aPos.Row() != nStartRow)) && (pDoc->HasNote(aPos));
+ bHasNotes = ((aPos.Col() != nStartCol) || (aPos.Row() != nStartRow)) && (rDoc.HasNote(aPos));
if (!pUndoDoc)
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo(pDoc, nTab1, nTab2);
+ pUndoDoc->InitUndo(&rDoc, nTab1, nTab2);
}
// note captions are collected by drawing undo
- pDoc->CopyToDocument( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab,
+ rDoc.CopyToDocument( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab,
IDF_ALL|IDF_NOCAPTIONS, false, pUndoDoc );
if( bHasNotes )
- pDoc->BeginDrawUndo();
+ rDoc.BeginDrawUndo();
}
if (bNeedContents)
- pDoc->DoMergeContents( nTab, nStartCol,nStartRow, nEndCol,nEndRow );
- pDoc->DoMerge( nTab, nStartCol,nStartRow, nEndCol,nEndRow );
+ rDoc.DoMergeContents( nTab, nStartCol,nStartRow, nEndCol,nEndRow );
+ rDoc.DoMerge( nTab, nStartCol,nStartRow, nEndCol,nEndRow );
if (rOption.mbCenter)
{
- pDoc->ApplyAttr( nStartCol, nStartRow, nTab, SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY ) );
- pDoc->ApplyAttr( nStartCol, nStartRow, nTab, SvxVerJustifyItem( SVX_VER_JUSTIFY_CENTER, ATTR_VER_JUSTIFY ) );
+ rDoc.ApplyAttr( nStartCol, nStartRow, nTab, SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY ) );
+ rDoc.ApplyAttr( nStartCol, nStartRow, nTab, SvxVerJustifyItem( SVX_VER_JUSTIFY_CENTER, ATTR_VER_JUSTIFY ) );
}
if ( !AdjustRowHeight( ScRange( 0,nStartRow,nTab, MAXCOL,nEndRow,nTab ) ) )
@@ -4709,7 +4709,7 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo
if (bNeedContents || rOption.mbCenter)
{
ScRange aRange(nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab);
- pDoc->SetDirty(aRange);
+ rDoc.SetDirty(aRange);
}
bNeedContentsUndo |= bNeedContents;
@@ -4717,7 +4717,7 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo
if (pUndoDoc)
{
- SdrUndoGroup* pDrawUndo = pDoc->GetDrawLayer() ? pDoc->GetDrawLayer()->GetCalcUndo() : NULL;
+ SdrUndoGroup* pDrawUndo = rDoc.GetDrawLayer() ? rDoc.GetDrawLayer()->GetCalcUndo() : NULL;
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoMerge(&rDocShell, rOption, bNeedContentsUndo, pUndoDoc, pDrawUndo) );
}
@@ -4754,9 +4754,9 @@ bool ScDocFunc::UnmergeCells( const ScCellMergeOption& rOption, bool bRecord )
return true;
ScDocShellModificator aModificator( rDocShell );
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScDocument* pUndoDoc = NULL;
@@ -4765,36 +4765,36 @@ bool ScDocFunc::UnmergeCells( const ScCellMergeOption& rOption, bool bRecord )
{
SCTAB nTab = *itr;
ScRange aRange = rOption.getSingleRange(nTab);
- if ( !pDoc->HasAttrib(aRange, HASATTR_MERGED) )
+ if ( !rDoc.HasAttrib(aRange, HASATTR_MERGED) )
continue;
ScRange aExtended = aRange;
- pDoc->ExtendMerge(aExtended);
+ rDoc.ExtendMerge(aExtended);
ScRange aRefresh = aExtended;
- pDoc->ExtendOverlapped(aRefresh);
+ rDoc.ExtendOverlapped(aRefresh);
if (bRecord)
{
if (!pUndoDoc)
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo(pDoc, *rOption.maTabs.begin(), *rOption.maTabs.rbegin());
+ pUndoDoc->InitUndo(&rDoc, *rOption.maTabs.begin(), *rOption.maTabs.rbegin());
}
- pDoc->CopyToDocument(aExtended, IDF_ATTRIB, false, pUndoDoc);
+ rDoc.CopyToDocument(aExtended, IDF_ATTRIB, false, pUndoDoc);
}
- 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( aRange.aStart.Col(), aRange.aStart.Row(),
+ rDoc.ApplyPatternAreaTab( aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(), nTab,
aPattern );
- pDoc->RemoveFlagsTab( aExtended.aStart.Col(), aExtended.aStart.Row(),
+ rDoc.RemoveFlagsTab( aExtended.aStart.Col(), aExtended.aStart.Row(),
aExtended.aEnd.Col(), aExtended.aEnd.Row(), nTab,
SC_MF_HOR | SC_MF_VER );
- pDoc->ExtendMerge( aRefresh, true );
+ rDoc.ExtendMerge( aRefresh, true );
if ( !AdjustRowHeight( aExtended ) )
rDocShell.PostPaint( aExtended, PAINT_GRID );
@@ -4820,19 +4820,19 @@ bool ScDocFunc::SetNewRangeNames( ScRangeName* pNewRanges, bool bModifyDoc, SCTA
ScDocShellModificator aModificator( rDocShell );
OSL_ENSURE( pNewRanges, "pNewRanges is 0" );
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo(pDoc->IsUndoEnabled());
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo(rDoc.IsUndoEnabled());
if (bUndo)
{
ScRangeName* pOld;
if (nTab >=0)
{
- pOld = pDoc->GetRangeName(nTab);
+ pOld = rDoc.GetRangeName(nTab);
}
else
{
- pOld = pDoc->GetRangeName();
+ pOld = rDoc.GetRangeName();
}
ScRangeName* pUndoRanges = new ScRangeName(*pOld);
ScRangeName* pRedoRanges = new ScRangeName(*pNewRanges);
@@ -4843,16 +4843,16 @@ bool ScDocFunc::SetNewRangeNames( ScRangeName* pNewRanges, bool bModifyDoc, SCTA
// #i55926# While loading XML, formula cells only have a single string token,
// so CompileNameFormula would never find any name (index) tokens, and would
// unnecessarily loop through all cells.
- bool bCompile = ( !pDoc->IsImportingXML() && pDoc->GetNamedRangesLockCount() == 0 );
+ bool bCompile = ( !rDoc.IsImportingXML() && rDoc.GetNamedRangesLockCount() == 0 );
if ( bCompile )
- pDoc->PreprocessRangeNameUpdate();
+ rDoc.PreprocessRangeNameUpdate();
if (nTab >= 0)
- pDoc->SetRangeName( nTab, pNewRanges ); // takes ownership
+ rDoc.SetRangeName( nTab, pNewRanges ); // takes ownership
else
- pDoc->SetRangeName( pNewRanges ); // takes ownership
+ rDoc.SetRangeName( pNewRanges ); // takes ownership
if ( bCompile )
- pDoc->PostprocessRangeNameUpdate();
+ rDoc.PostprocessRangeNameUpdate();
if (bModifyDoc)
{
@@ -4866,19 +4866,19 @@ bool ScDocFunc::SetNewRangeNames( ScRangeName* pNewRanges, bool bModifyDoc, SCTA
void ScDocFunc::ModifyAllRangeNames( const boost::ptr_map<OUString, ScRangeName>& rRangeMap )
{
ScDocShellModificator aModificator(rDocShell);
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (pDoc->IsUndoEnabled())
+ if (rDoc.IsUndoEnabled())
{
std::map<OUString, ScRangeName*> aOldRangeMap;
- pDoc->GetRangeNameMap(aOldRangeMap);
+ rDoc.GetRangeNameMap(aOldRangeMap);
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoAllRangeNames(&rDocShell, aOldRangeMap, rRangeMap));
}
- pDoc->PreprocessRangeNameUpdate();
- pDoc->SetAllRangeNames(rRangeMap);
- pDoc->PostprocessRangeNameUpdate();
+ rDoc.PreprocessRangeNameUpdate();
+ rDoc.SetAllRangeNames(rRangeMap);
+ rDoc.PostprocessRangeNameUpdate();
aModificator.SetDocumentModified();
SFX_APP()->Broadcast(SfxSimpleHint(SC_HINT_AREAS_CHANGED));
@@ -4892,14 +4892,14 @@ void ScDocFunc::CreateOneName( ScRangeName& rList,
if (rCancel)
return;
- ScDocument* pDoc = rDocShell.GetDocument();
- if (!pDoc->HasValueData( nPosX, nPosY, nTab ))
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (!rDoc.HasValueData( nPosX, nPosY, nTab ))
{
- OUString aName = pDoc->GetString(nPosX, nPosY, nTab);
+ OUString aName = rDoc.GetString(nPosX, nPosY, nTab);
ScRangeData::MakeValidName(aName);
if (!aName.isEmpty())
{
- OUString aContent(ScRange( nX1, nY1, nTab, nX2, nY2, nTab ).Format(SCR_ABS_3D, pDoc));
+ OUString aContent(ScRange( nX1, nY1, nTab, nX2, nY2, nTab ).Format(SCR_ABS_3D, &rDoc));
bool bInsert = false;
ScRangeData* pOld = rList.findByUpperName(ScGlobal::pCharClass->uppercase(aName));
@@ -4937,7 +4937,7 @@ void ScDocFunc::CreateOneName( ScRangeName& rList,
if (bInsert)
{
- ScRangeData* pData = new ScRangeData( pDoc, aName, aContent,
+ ScRangeData* pData = new ScRangeData( &rDoc, aName, aContent,
ScAddress( nPosX, nPosY, nTab));
if (!rList.insert(pData))
{
@@ -4973,12 +4973,12 @@ bool ScDocFunc::CreateNames( const ScRange& rRange, sal_uInt16 nFlags, bool bApi
if (bValid)
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
ScRangeName* pNames;
if (aTab >=0)
- pNames = pDoc->GetRangeName(nTab);
+ pNames = rDoc.GetRangeName(nTab);
else
- pNames = pDoc->GetRangeName();
+ pNames = rDoc.GetRangeName();
if (!pNames)
return false; // soll nicht sein
@@ -5043,13 +5043,13 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
ScDocShellModificator aModificator( rDocShell );
bool bDone = false;
- ScDocument* pDoc = rDocShell.GetDocument();
- const bool bRecord = pDoc->IsUndoEnabled();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ const bool bRecord = rDoc.IsUndoEnabled();
SCTAB nTab = rStartPos.Tab();
ScDocument* pUndoDoc = NULL;
//local names have higher priority than global names
- ScRangeName* pLocalList = pDoc->GetRangeName(nTab);
+ ScRangeName* pLocalList = rDoc.GetRangeName(nTab);
sal_uInt16 nValidCount = 0;
ScRangeName::iterator itrLocalBeg = pLocalList->begin(), itrLocalEnd = pLocalList->end();
for (ScRangeName::iterator itr = itrLocalBeg; itr != itrLocalEnd; ++itr)
@@ -5058,7 +5058,7 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
if (!r.HasType(RT_DATABASE))
++nValidCount;
}
- ScRangeName* pList = pDoc->GetRangeName();
+ ScRangeName* pList = rDoc.GetRangeName();
ScRangeName::iterator itrBeg = pList->begin(), itrEnd = pList->end();
for (ScRangeName::iterator itr = itrBeg; itr != itrEnd; ++itr)
{
@@ -5074,17 +5074,17 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
SCCOL nEndCol = nStartCol + 1;
SCROW nEndRow = nStartRow + static_cast<SCROW>(nValidCount) - 1;
- ScEditableTester aTester( pDoc, nTab, nStartCol,nStartRow, nEndCol,nEndRow );
+ ScEditableTester aTester( &rDoc, nTab, nStartCol,nStartRow, nEndCol,nEndRow );
if (aTester.IsEditable())
{
if (bRecord)
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nTab, nTab );
- pDoc->CopyToDocument( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ rDoc.CopyToDocument( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
IDF_ALL, false, pUndoDoc );
- pDoc->BeginDrawUndo(); // wegen Hoehenanpassung
+ rDoc.BeginDrawUndo(); // wegen Hoehenanpassung
}
boost::scoped_array<ScRangeData*> ppSortArray(new ScRangeData* [ nValidCount ]);
@@ -5116,8 +5116,8 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
aFormula = "=" + aContent.toString();
ScSetStringParam aParam;
aParam.setTextInput();
- pDoc->SetString(ScAddress(nStartCol,nOutRow,nTab), aName, &aParam);
- pDoc->SetString(ScAddress(nEndCol,nOutRow,nTab), aFormula, &aParam);
+ rDoc.SetString(ScAddress(nStartCol,nOutRow,nTab), aName, &aParam);
+ rDoc.SetString(ScAddress(nEndCol,nOutRow,nTab), aFormula, &aParam);
++nOutRow;
}
@@ -5126,8 +5126,8 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
if (bRecord)
{
ScDocument* pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
- pRedoDoc->InitUndo( pDoc, nTab, nTab );
- pDoc->CopyToDocument( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
+ pRedoDoc->InitUndo( &rDoc, nTab, nTab );
+ rDoc.CopyToDocument( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
IDF_ALL, false, pRedoDoc );
rDocShell.GetUndoManager()->AddUndoAction(
@@ -5150,17 +5150,17 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
bool ScDocFunc::ResizeMatrix( const ScRange& rOldRange, const ScAddress& rNewEnd, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
SCCOL nStartCol = rOldRange.aStart.Col();
SCROW nStartRow = rOldRange.aStart.Row();
SCTAB nTab = rOldRange.aStart.Tab();
- bool bUndo(pDoc->IsUndoEnabled());
+ bool bUndo(rDoc.IsUndoEnabled());
bool bRet = false;
OUString aFormula;
- pDoc->GetFormula( nStartCol, nStartRow, nTab, aFormula );
+ rDoc.GetFormula( nStartCol, nStartRow, nTab, aFormula );
if ( aFormula.startsWith("{") && aFormula.endsWith("}") )
{
OUString aUndo = ScGlobal::GetRscString( STR_UNDO_RESIZEMATRIX );
@@ -5197,10 +5197,10 @@ bool ScDocFunc::InsertAreaLink( const OUString& rFile, const OUString& rFilter,
const ScRange& rDestRange, sal_uLong nRefresh,
bool bFitBlock, bool bApi )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bool bUndo (rDoc.IsUndoEnabled());
- sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
+ sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
// #i52120# if other area links exist at the same start position,
// remove them first (file format specifies only one link definition
@@ -5264,7 +5264,7 @@ bool ScDocFunc::InsertAreaLink( const OUString& rFile, const OUString& rFilter,
}
// Update hat sein eigenes Undo
- if (pDoc->IsExecuteLinkEnabled())
+ if (rDoc.IsExecuteLinkEnabled())
{
pLink->SetDoInsert(bFitBlock); // beim ersten Update ggf. nichts einfuegen
pLink->Update(); // kein SetInCreate -> Update ausfuehren
@@ -5298,18 +5298,18 @@ void SetConditionalFormatAttributes(ScDocument* pDoc, const ScRangeList& rRanges
void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFormat* pFormat, SCTAB nTab, const ScRangeList& rRanges )
{
ScDocShellModificator aModificator(rDocShell);
- ScDocument* pDoc = rDocShell.GetDocument();
- if(pDoc->IsTabProtected(nTab))
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if(rDoc.IsTabProtected(nTab))
return;
- bool bUndo = pDoc->IsUndoEnabled();
+ bool bUndo = rDoc.IsUndoEnabled();
ScDocument* pUndoDoc = NULL;
ScRange aCombinedRange = rRanges.Combine();
ScRange aCompleteRange;
if(bUndo)
{
pUndoDoc = new ScDocument(SCDOCMODE_UNDO);
- pUndoDoc->InitUndo( pDoc, nTab, nTab );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab );
if(pFormat)
{
@@ -5317,12 +5317,12 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFor
}
if(nOldFormat)
{
- ScConditionalFormat* pOldFormat = pDoc->GetCondFormList(nTab)->GetFormat(nOldFormat);
+ ScConditionalFormat* pOldFormat = rDoc.GetCondFormList(nTab)->GetFormat(nOldFormat);
if(pOldFormat)
aCompleteRange.ExtendTo(pOldFormat->GetRange().Combine());
}
- pDoc->CopyToDocument( aCompleteRange.aStart.Col(),aCompleteRange.aStart.Row(),nTab,
+ rDoc.CopyToDocument( aCompleteRange.aStart.Col(),aCompleteRange.aStart.Row(),nTab,
aCompleteRange.aEnd.Col(),aCompleteRange.aEnd.Row(),nTab,
IDF_ALL, false, pUndoDoc );
}
@@ -5330,15 +5330,15 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFor
boost::scoped_ptr<ScRange> pRepaintRange;
if(nOldFormat)
{
- ScConditionalFormat* pOldFormat = pDoc->GetCondFormList(nTab)->GetFormat(nOldFormat);
+ ScConditionalFormat* pOldFormat = rDoc.GetCondFormList(nTab)->GetFormat(nOldFormat);
if(pOldFormat)
{
pRepaintRange.reset(new ScRange( pOldFormat->GetRange().Combine() ));
- RemoveCondFormatAttributes(pDoc, pOldFormat, nTab);
+ RemoveCondFormatAttributes(&rDoc, pOldFormat, nTab);
}
- pDoc->DeleteConditionalFormat(nOldFormat, nTab);
- pDoc->SetStreamValid(nTab, false);
+ rDoc.DeleteConditionalFormat(nOldFormat, nTab);
+ rDoc.SetStreamValid(nTab, false);
}
if(pFormat)
{
@@ -5347,17 +5347,17 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFor
else
pRepaintRange.reset(new ScRange(aCombinedRange));
- sal_uLong nIndex = pDoc->AddCondFormat(pFormat, nTab);
+ sal_uLong nIndex = rDoc.AddCondFormat(pFormat, nTab);
- SetConditionalFormatAttributes(pDoc, rRanges, nIndex, nTab);
- pDoc->SetStreamValid(nTab, false);
+ SetConditionalFormatAttributes(&rDoc, rRanges, nIndex, nTab);
+ rDoc.SetStreamValid(nTab, false);
}
if(bUndo)
{
ScDocument* pRedoDoc = new ScDocument(SCDOCMODE_UNDO);
- pRedoDoc->InitUndo( pDoc, nTab, nTab );
- pDoc->CopyToDocument( aCompleteRange.aStart.Col(),aCompleteRange.aStart.Row(),nTab,
+ pRedoDoc->InitUndo( &rDoc, nTab, nTab );
+ rDoc.CopyToDocument( aCompleteRange.aStart.Col(),aCompleteRange.aStart.Row(),nTab,
aCompleteRange.aEnd.Col(),aCompleteRange.aEnd.Row(),nTab,
IDF_ALL, false, pRedoDoc );
rDocShell.GetUndoManager()->AddUndoAction(
@@ -5374,15 +5374,15 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFor
void ScDocFunc::SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB nTab )
{
ScDocShellModificator aModificator(rDocShell);
- ScDocument* pDoc = rDocShell.GetDocument();
- if(pDoc->IsTabProtected(nTab))
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if(rDoc.IsTabProtected(nTab))
return;
// first remove all old entries
- ScConditionalFormatList* pOldList = pDoc->GetCondFormList(nTab);
+ ScConditionalFormatList* pOldList = rDoc.GetCondFormList(nTab);
for(ScConditionalFormatList::const_iterator itr = pOldList->begin(), itrEnd = pOldList->end(); itr != itrEnd; ++itr)
{
- RemoveCondFormatAttributes(pDoc, &(*itr), nTab);
+ RemoveCondFormatAttributes(&rDoc, &(*itr), nTab);
}
// then set new entries
@@ -5390,13 +5390,13 @@ void ScDocFunc::SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB
{
sal_uLong nIndex = itr->GetKey();
const ScRangeList& rRange = itr->GetRange();
- SetConditionalFormatAttributes(pDoc, rRange, nIndex, nTab);
+ SetConditionalFormatAttributes(&rDoc, rRange, nIndex, nTab);
}
- pDoc->SetCondFormList(pList, nTab);
+ rDoc.SetCondFormList(pList, nTab);
rDocShell.PostPaintGridAll();
- pDoc->SetStreamValid(nTab, false);
+ rDoc.SetStreamValid(nTab, false);
aModificator.SetDocumentModified();
SFX_APP()->Broadcast(SfxSimpleHint(SC_HINT_AREAS_CHANGED));
}
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 7ed1836346d0..8c1ea5b0b2db 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -213,7 +213,7 @@ void ScDocShell::DoEnterHandler()
{
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
if (pViewSh)
- if (pViewSh->GetViewData()->GetDocShell() == this)
+ if (pViewSh->GetViewData().GetDocShell() == this)
SC_MOD()->InputEnterHandler();
}
@@ -223,7 +223,7 @@ SCTAB ScDocShell::GetSaveTab()
ScTabViewShell* pSh = GetBestViewShell();
if (pSh)
{
- const ScMarkData& rMark = pSh->GetViewData()->GetMarkData();
+ const ScMarkData& rMark = pSh->GetViewData().GetMarkData();
nTab = rMark.GetFirstSelected();
}
return nTab;
@@ -423,7 +423,7 @@ void processDataStream( ScDocShell& rShell, const sc::ImportPostProcessData& rDa
sc::DataStream* pStrm = new sc::DataStream(&rShell, r.maURL, aTopRange, nLimit, eMove, 0);
pStrm->SetRefreshOnEmptyLine(r.mbRefreshOnEmpty);
- sc::DocumentLinkManager& rMgr = rShell.GetDocument()->GetDocLinkManager();
+ sc::DocumentLinkManager& rMgr = rShell.GetDocument().GetDocLinkManager();
rMgr.setDataStream(pStrm);
}
@@ -933,7 +933,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
break;
case SFX_EVENT_SAVEASDOC:
{
- if ( GetDocument()->GetExternalRefManager()->containsUnsavedReferences() )
+ if ( GetDocument().GetExternalRefManager()->containsUnsavedReferences() )
{
WarningBox aBox( GetActiveDialogParent(), WinBits( WB_YES_NO ),
ScGlobal::GetRscString( STR_UNSAVED_EXT_REF ) );
@@ -2223,7 +2223,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed )
ScExtDocOptions* pExtDocOpt = aDocument.GetExtDocOptions();
if( !pExtDocOpt )
aDocument.SetExtDocOptions( pExtDocOpt = new ScExtDocOptions );
- pViewShell->GetViewData()->WriteExtOptions( *pExtDocOpt );
+ pViewShell->GetViewData().WriteExtOptions( *pExtDocOpt );
/* #i104990# If the imported document contains a medium
password, determine if we can save it, otherwise ask the users
@@ -3068,43 +3068,43 @@ void ScDocShell::UseSheetSaveEntries()
ScDocShellModificator::ScDocShellModificator( ScDocShell& rDS )
:
rDocShell( rDS ),
- mpProtector(new ScRefreshTimerProtector(rDS.GetDocument()->GetRefreshTimerControlAddress()))
+ mpProtector(new ScRefreshTimerProtector(rDS.GetDocument().GetRefreshTimerControlAddress()))
{
- ScDocument* pDoc = rDocShell.GetDocument();
- bAutoCalcShellDisabled = pDoc->IsAutoCalcShellDisabled();
- bIdleEnabled = pDoc->IsIdleEnabled();
- pDoc->SetAutoCalcShellDisabled( true );
- pDoc->EnableIdle(false);
+ ScDocument& rDoc = rDocShell.GetDocument();
+ bAutoCalcShellDisabled = rDoc.IsAutoCalcShellDisabled();
+ bIdleEnabled = rDoc.IsIdleEnabled();
+ rDoc.SetAutoCalcShellDisabled( true );
+ rDoc.EnableIdle(false);
}
ScDocShellModificator::~ScDocShellModificator()
{
- ScDocument* pDoc = rDocShell.GetDocument();
- pDoc->SetAutoCalcShellDisabled( bAutoCalcShellDisabled );
+ ScDocument& rDoc = rDocShell.GetDocument();
+ rDoc.SetAutoCalcShellDisabled( bAutoCalcShellDisabled );
if ( !bAutoCalcShellDisabled && rDocShell.IsDocumentModifiedPending() )
rDocShell.SetDocumentModified(); // last one shuts off the lights
- pDoc->EnableIdle(bIdleEnabled);
+ rDoc.EnableIdle(bIdleEnabled);
}
void ScDocShellModificator::SetDocumentModified()
{
- ScDocument* pDoc = rDocShell.GetDocument();
- pDoc->ClearFormulaContext();
- if ( !pDoc->IsImportingXML() )
+ ScDocument& rDoc = rDocShell.GetDocument();
+ rDoc.ClearFormulaContext();
+ if ( !rDoc.IsImportingXML() )
{
// AutoCalcShellDisabled temporaer restaurieren
- bool bDisabled = pDoc->IsAutoCalcShellDisabled();
- pDoc->SetAutoCalcShellDisabled( bAutoCalcShellDisabled );
+ bool bDisabled = rDoc.IsAutoCalcShellDisabled();
+ rDoc.SetAutoCalcShellDisabled( bAutoCalcShellDisabled );
rDocShell.SetDocumentModified();
- pDoc->SetAutoCalcShellDisabled( bDisabled );
+ rDoc.SetAutoCalcShellDisabled( bDisabled );
}
else
{
// uno broadcast is necessary for api to work
// -> must also be done during xml import
- pDoc->BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+ rDoc.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
}
}
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 22d295e68295..d7862d17195e 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -72,7 +72,7 @@ void ScDocShell::PostEditView( ScEditEngineDefaulter* pEditEngine, const ScAddre
// Test: nur aktive ViewShell
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
- if (pViewSh && pViewSh->GetViewData()->GetDocShell() == this)
+ if (pViewSh && pViewSh->GetViewData().GetDocShell() == this)
{
ScEditViewHint aHint( pEditEngine, rCursorPos );
pViewSh->Notify( *this, aHint );
@@ -554,7 +554,7 @@ sal_uInt16 ScDocShell::SetPrinter( SfxPrinter* pNewPrinter, sal_uInt16 nDiffFlag
ScChangeAction* ScDocShell::GetChangeAction( const ScAddress& rPos )
{
- ScChangeTrack* pTrack = GetDocument()->GetChangeTrack();
+ ScChangeTrack* pTrack = GetDocument().GetChangeTrack();
if (!pTrack)
return NULL;
@@ -612,7 +612,7 @@ void ScDocShell::SetChangeComment( ScChangeAction* pAction, const OUString& rCom
SetDocumentModified();
// Dialog-Notify
- ScChangeTrack* pTrack = GetDocument()->GetChangeTrack();
+ ScChangeTrack* pTrack = GetDocument().GetChangeTrack();
if (pTrack)
{
sal_uLong nNumber = pAction->GetActionNumber();
@@ -879,7 +879,7 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck
bool bHasRejected = false;
OUString aOldUser = pThisTrack->GetUser();
pThisTrack->SetUseFixDateTime( true );
- ScMarkData& rMarkData = pViewSh->GetViewData()->GetMarkData();
+ ScMarkData& rMarkData = pViewSh->GetViewData().GetMarkData();
ScMarkData aOldMarkData( rMarkData );
pSourceAction = pFirstMergeAction;
while ( pSourceAction && pSourceAction->GetActionNumber() <= nLastMergeAction )
@@ -1151,7 +1151,7 @@ bool ScDocShell::MergeSharedDocument( ScDocShell* pSharedDocShell )
return false;
}
- ScDocument& rSharedDoc = *( pSharedDocShell->GetDocument() );
+ ScDocument& rSharedDoc = pSharedDocShell->GetDocument();
ScChangeTrack* pSharedTrack = rSharedDoc.GetChangeTrack();
if ( !pSharedTrack )
{
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index dd9eaf8a585a..04751134d07b 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -254,7 +254,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
case SID_CHART_ADDSOURCE:
if (pReqArgs)
{
- ScDocument* pDoc = GetDocument();
+ ScDocument& rDoc = GetDocument();
const SfxPoolItem* pItem;
OUString aChartName, aRangeName;
@@ -285,12 +285,12 @@ void ScDocShell::Execute( SfxRequest& rReq )
bRowInit = true;
}
- ScAddress::Details aDetails(pDoc->GetAddressConvention(), 0, 0);
- bool bValid = ( aSingleRange.ParseAny( aRangeName, pDoc, aDetails ) & SCA_VALID ) != 0;
+ ScAddress::Details aDetails(rDoc.GetAddressConvention(), 0, 0);
+ bool bValid = ( aSingleRange.ParseAny( aRangeName, &rDoc, aDetails ) & SCA_VALID ) != 0;
if (!bValid)
{
aRangeListRef = new ScRangeList;
- aRangeListRef->Parse( aRangeName, pDoc );
+ aRangeListRef->Parse( aRangeName, &rDoc );
if ( !aRangeListRef->empty() )
{
bMultiRange = true;
@@ -410,9 +410,9 @@ void ScDocShell::Execute( SfxRequest& rReq )
break;
case SID_UPDATETABLINKS:
{
- ScDocument* pDoc = GetDocument();
+ ScDocument& rDoc = GetDocument();
- ScLkUpdMode nSet=pDoc->GetLinkMode();
+ ScLkUpdMode nSet = rDoc.GetLinkMode();
sal_uInt16 nDlgRet=RET_NO;
if(nSet==LM_UNKNOWN)
@@ -557,70 +557,67 @@ void ScDocShell::Execute( SfxRequest& rReq )
case FID_CHG_RECORD:
{
- ScDocument* pDoc = GetDocument();
- if(pDoc!=NULL)
+ ScDocument& rDoc = GetDocument();
+ // get argument (recorded macro)
+ SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FID_CHG_RECORD, false );
+ bool bDo = true;
+
+ // xmlsec05/06:
+ // getting real parent window when called from Security-Options TP
+ Window* pParent = NULL;
+ const SfxPoolItem* pParentItem;
+ if( pReqArgs && SFX_ITEM_SET == pReqArgs->GetItemState( SID_ATTR_XWINDOW, false, &pParentItem ) )
+ pParent = ( ( const XWindowItem* ) pParentItem )->GetWindowPtr();
+
+ // desired state
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
+ bool bActivateTracking = (pChangeTrack == 0); // toggle
+ if ( pItem )
+ bActivateTracking = pItem->GetValue(); // from argument
+
+ if ( !bActivateTracking )
{
- // get argument (recorded macro)
- SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FID_CHG_RECORD, false );
- bool bDo = true;
-
- // xmlsec05/06:
- // getting real parent window when called from Security-Options TP
- Window* pParent = NULL;
- const SfxPoolItem* pParentItem;
- if( pReqArgs && SFX_ITEM_SET == pReqArgs->GetItemState( SID_ATTR_XWINDOW, false, &pParentItem ) )
- pParent = ( ( const XWindowItem* ) pParentItem )->GetWindowPtr();
-
- // desired state
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
- bool bActivateTracking = (pChangeTrack == 0); // toggle
- if ( pItem )
- bActivateTracking = pItem->GetValue(); // from argument
-
- if ( !bActivateTracking )
+ if ( !pItem )
{
- if ( !pItem )
- {
- // no dialog on playing the macro
- WarningBox aBox( pParent ? pParent : GetActiveDialogParent(),
- WinBits(WB_YES_NO | WB_DEF_NO),
- ScGlobal::GetRscString( STR_END_REDLINING ) );
- bDo = ( aBox.Execute() == RET_YES );
- }
+ // no dialog on playing the macro
+ WarningBox aBox( pParent ? pParent : GetActiveDialogParent(),
+ WinBits(WB_YES_NO | WB_DEF_NO),
+ ScGlobal::GetRscString( STR_END_REDLINING ) );
+ bDo = ( aBox.Execute() == RET_YES );
+ }
+ if ( bDo )
+ {
+ if ( pChangeTrack->IsProtected() )
+ bDo = ExecuteChangeProtectionDialog( NULL );
if ( bDo )
{
- if ( pChangeTrack->IsProtected() )
- bDo = ExecuteChangeProtectionDialog( NULL );
- if ( bDo )
- {
- pDoc->EndChangeTracking();
- PostPaintGridAll();
- }
+ rDoc.EndChangeTracking();
+ PostPaintGridAll();
}
}
- else
- {
- pDoc->StartChangeTracking();
- ScChangeViewSettings aChangeViewSet;
- aChangeViewSet.SetShowChanges(true);
- pDoc->SetChangeViewSettings(aChangeViewSet);
- }
+ }
+ else
+ {
+ rDoc.StartChangeTracking();
+ ScChangeViewSettings aChangeViewSet;
+ aChangeViewSet.SetShowChanges(true);
+ rDoc.SetChangeViewSettings(aChangeViewSet);
+ }
- if ( bDo )
- {
- UpdateAcceptChangesDialog();
+ if ( bDo )
+ {
+ UpdateAcceptChangesDialog();
- // Slots invalidieren
- if (pBindings)
- pBindings->InvalidateAll(false);
- if ( !pItem )
- rReq.AppendItem( SfxBoolItem( FID_CHG_RECORD, bActivateTracking ) );
- rReq.Done();
- }
- else
- rReq.Ignore();
+ // Slots invalidieren
+ if (pBindings)
+ pBindings->InvalidateAll(false);
+ if ( !pItem )
+ rReq.AppendItem( SfxBoolItem( FID_CHG_RECORD, bActivateTracking ) );
+ rReq.Done();
}
+ else
+ rReq.Ignore();
}
break;
@@ -746,9 +743,9 @@ void ScDocShell::Execute( SfxRequest& rReq )
}
#endif
if ( nSlot == SID_DOCUMENT_COMPARE )
- CompareDocument( *pOtherDocSh->GetDocument() );
+ CompareDocument( pOtherDocSh->GetDocument() );
else
- MergeDocument( *pOtherDocSh->GetDocument() );
+ MergeDocument( pOtherDocSh->GetDocument() );
// show "accept changes" dialog
//! get view for this document!
@@ -822,7 +819,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
if ( pSh )
{
//! SetTabNo in DeleteTable weglassen?
- SCTAB nDispTab = pSh->GetViewData()->GetTabNo();
+ SCTAB nDispTab = pSh->GetViewData().GetTabNo();
pSh->DeleteTable( nTab );
pSh->SetTabNo(nDispTab);
rReq.Done();
@@ -2186,7 +2183,7 @@ ScViewData* ScDocShell::GetViewData()
{
SfxViewShell* pCur = SfxViewShell::Current();
ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,pCur);
- return pViewSh ? pViewSh->GetViewData() : NULL;
+ return pViewSh ? &pViewSh->GetViewData() : NULL;
}
SCTAB ScDocShell::GetCurTab()
@@ -2202,7 +2199,7 @@ ScTabViewShell* ScDocShell::GetBestViewShell( bool bOnlyVisible )
{
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
// falsches Doc?
- if( pViewSh && pViewSh->GetViewData()->GetDocShell() != this )
+ if( pViewSh && pViewSh->GetViewData().GetDocShell() != this )
pViewSh = NULL;
if( !pViewSh )
{
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index c52e287efd37..88cab9572471 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -822,40 +822,40 @@ sal_uLong ScDocShell::TransferTab( ScDocShell& rSrcDocShell, SCTAB nSrcPos,
SCTAB nDestPos, bool bInsertNew,
bool bNotifyAndPaint )
{
- ScDocument* pSrcDoc = rSrcDocShell.GetDocument();
+ ScDocument& rSrcDoc = rSrcDocShell.GetDocument();
// set the transferred area to the copyparam to make adjusting formulas possible
ScClipParam aParam;
ScRange aRange(0, 0, nSrcPos, MAXCOL, MAXROW, nSrcPos);
aParam.maRanges.Append(aRange);
- pSrcDoc->SetClipParam(aParam);
+ rSrcDoc.SetClipParam(aParam);
- sal_uLong nErrVal = aDocument.TransferTab( pSrcDoc, nSrcPos, nDestPos,
+ sal_uLong nErrVal = aDocument.TransferTab( &rSrcDoc, nSrcPos, nDestPos,
bInsertNew ); // no insert
// TransferTab doesn't copy drawing objects with bInsertNew=FALSE
if ( nErrVal > 0 && !bInsertNew)
- aDocument.TransferDrawPage( pSrcDoc, nSrcPos, nDestPos );
+ aDocument.TransferDrawPage( &rSrcDoc, nSrcPos, nDestPos );
- if(nErrVal>0 && pSrcDoc->IsScenario( nSrcPos ))
+ if(nErrVal>0 && rSrcDoc.IsScenario( nSrcPos ))
{
OUString aComment;
Color aColor;
sal_uInt16 nFlags;
- pSrcDoc->GetScenarioData( nSrcPos, aComment,aColor, nFlags);
+ rSrcDoc.GetScenarioData( nSrcPos, aComment,aColor, nFlags);
aDocument.SetScenario(nDestPos,true);
aDocument.SetScenarioData(nDestPos,aComment,aColor,nFlags);
- bool bActive = pSrcDoc->IsActiveScenario(nSrcPos);
+ bool bActive = rSrcDoc.IsActiveScenario(nSrcPos);
aDocument.SetActiveScenario(nDestPos, bActive );
- bool bVisible=pSrcDoc->IsVisible(nSrcPos);
+ bool bVisible = rSrcDoc.IsVisible(nSrcPos);
aDocument.SetVisible(nDestPos,bVisible );
}
- if ( nErrVal > 0 && pSrcDoc->IsTabProtected( nSrcPos ) )
- aDocument.SetTabProtection(nDestPos, pSrcDoc->GetTabProtection(nSrcPos));
+ if ( nErrVal > 0 && rSrcDoc.IsTabProtected( nSrcPos ) )
+ aDocument.SetTabProtection(nDestPos, rSrcDoc.GetTabProtection(nSrcPos));
if ( bNotifyAndPaint )
{
Broadcast( ScTablesHint( SC_TAB_INSERTED, nDestPos ) );
diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index 7dd8d0eaf46e..1e21b7541ea7 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -151,7 +151,7 @@ void ScDocShell::SetVisAreaOrSize( const Rectangle& rVisArea, bool bModifyStart
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
if (pViewSh)
{
- if (pViewSh->GetViewData()->GetDocShell() == this)
+ if (pViewSh->GetViewData().GetDocShell() == this)
pViewSh->UpdateOleZoom();
}
}
@@ -279,7 +279,7 @@ void ScDocShell::LoadStylesArgs( ScDocShell& rSource, bool bReplace, bool bCellS
if ( !bCellStyles && !bPageStyles ) // nothing to do
return;
- ScStyleSheetPool* pSourcePool = rSource.GetDocument()->GetStyleSheetPool();
+ ScStyleSheetPool* pSourcePool = rSource.GetDocument().GetStyleSheetPool();
ScStyleSheetPool* pDestPool = aDocument.GetStyleSheetPool();
SfxStyleFamily eFamily = bCellStyles ?
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index ddb2e575d112..a37f78fdbc30 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -486,8 +486,8 @@ void lcl_GetColumnTypes(
OUString* pColNames, sal_Int32* pColTypes, sal_Int32* pColLengths,
sal_Int32* pColScales, bool& bHasMemo, rtl_TextEncoding eCharSet )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- SvNumberFormatter* pNumFmt = pDoc->GetFormatTable();
+ ScDocument& rDoc = rDocShell.GetDocument();
+ SvNumberFormatter* pNumFmt = rDoc.GetFormatTable();
SCTAB nTab = rDataRange.aStart.Tab();
SCCOL nFirstCol = rDataRange.aStart.Col();
@@ -514,7 +514,7 @@ void lcl_GetColumnTypes(
// Type etc.: L; D; C[,W]; N[,W[,P]]
if ( bHasFieldNames )
{
- aString = pDoc->GetString(nCol, nFirstRow, nTab);
+ aString = rDoc.GetString(nCol, nFirstRow, nTab);
aString = aString.toAsciiUpperCase();
sal_Int32 nToken = comphelper::string::getTokenCount(aString, ',');
if ( nToken > 1 )
@@ -615,13 +615,13 @@ void lcl_GetColumnTypes(
if ( !bTypeDefined )
{ // Field type.
ScRefCellValue aCell;
- aCell.assign(*pDoc, ScAddress(nCol, nFirstDataRow, nTab));
+ aCell.assign(rDoc, ScAddress(nCol, nFirstDataRow, nTab));
if (aCell.isEmpty() || aCell.hasString())
nDbType = sdbc::DataType::VARCHAR;
else
{
sal_uInt32 nFormat;
- pDoc->GetNumberFormat( nCol, nFirstDataRow, nTab, nFormat );
+ rDoc.GetNumberFormat( nCol, nFirstDataRow, nTab, nFormat );
switch ( pNumFmt->GetType( nFormat ) )
{
case NUMBERFORMAT_LOGICAL :
@@ -646,7 +646,7 @@ void lcl_GetColumnTypes(
// Field length.
if ( nDbType == sdbc::DataType::VARCHAR && !nFieldLen )
{ // Determine maximum field width.
- nFieldLen = pDoc->GetMaxStringLen( nTab, nCol, nFirstDataRow,
+ nFieldLen = rDoc.GetMaxStringLen( nTab, nCol, nFirstDataRow,
nLastRow, eCharSet );
if ( nFieldLen == 0 )
nFieldLen = 1;
@@ -655,7 +655,7 @@ void lcl_GetColumnTypes(
{ // Determine maximum field width and precision.
sal_Int32 nLen;
sal_uInt16 nPrec;
- nLen = pDoc->GetMaxNumberStringLen( nPrec, nTab, nCol,
+ nLen = rDoc.GetMaxNumberStringLen( nPrec, nTab, nCol,
nFirstDataRow, nLastRow );
// dBaseIII precision limit: 15
if ( nPrecision > 15 )
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index fae875483756..5269d78b58c4 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2239,7 +2239,7 @@ ScDocument* ScExternalRefManager::getInMemorySrcDocument(sal_uInt16 nFileId)
if (pFileName->equalsIgnoreAsciiCase(pMedium->GetName()))
{
// Found !
- pSrcDoc = pShell->GetDocument();
+ pSrcDoc = &pShell->GetDocument();
break;
}
}
@@ -2254,7 +2254,7 @@ ScDocument* ScExternalRefManager::getInMemorySrcDocument(sal_uInt16 nFileId)
aSrcDoc.maShell = pShell;
maUnsavedDocShells.insert(DocShellMap::value_type(nFileId, aSrcDoc));
StartListening(*pShell);
- pSrcDoc = pShell->GetDocument();
+ pSrcDoc = &pShell->GetDocument();
break;
}
}
@@ -2279,7 +2279,7 @@ ScDocument* ScExternalRefManager::getSrcDocument(sal_uInt16 nFileId)
SfxObjectShell* p = itr->second.maShell;
itr->second.maLastAccess = Time( Time::SYSTEM );
- return static_cast<ScDocShell*>(p)->GetDocument();
+ return &static_cast<ScDocShell*>(p)->GetDocument();
}
itrEnd = maUnsavedDocShells.end();
@@ -2290,7 +2290,7 @@ ScDocument* ScExternalRefManager::getSrcDocument(sal_uInt16 nFileId)
SfxObjectShell* p = itr->second.maShell;
itr->second.maLastAccess = Time( Time::SYSTEM );
- return static_cast<ScDocShell*>(p)->GetDocument();
+ return &static_cast<ScDocShell*>(p)->GetDocument();
}
const OUString* pFile = getExternalFileName(nFileId);
@@ -2313,7 +2313,7 @@ ScDocument* ScExternalRefManager::getSrcDocument(sal_uInt16 nFileId)
return NULL;
}
- return cacheNewDocShell(nFileId, aSrcDoc);
+ return &cacheNewDocShell(nFileId, aSrcDoc);
}
SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUString& rFilter)
@@ -2376,17 +2376,17 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
// increment the recursive link count of the source document.
ScExtDocOptions* pExtOpt = mpDoc->GetExtDocOptions();
sal_uInt32 nLinkCount = pExtOpt ? pExtOpt->GetDocSettings().mnLinkCnt : 0;
- ScDocument* pSrcDoc = pNewShell->GetDocument();
- pSrcDoc->EnableExecuteLink(false); // to prevent circular access of external references.
- pSrcDoc->EnableUndo(false);
- pSrcDoc->EnableAdjustHeight(false);
- pSrcDoc->EnableUserInteraction(false);
+ ScDocument& rSrcDoc = pNewShell->GetDocument();
+ rSrcDoc.EnableExecuteLink(false); // to prevent circular access of external references.
+ rSrcDoc.EnableUndo(false);
+ rSrcDoc.EnableAdjustHeight(false);
+ rSrcDoc.EnableUserInteraction(false);
- ScExtDocOptions* pExtOptNew = pSrcDoc->GetExtDocOptions();
+ ScExtDocOptions* pExtOptNew = rSrcDoc.GetExtDocOptions();
if (!pExtOptNew)
{
pExtOptNew = new ScExtDocOptions;
- pSrcDoc->SetExtDocOptions(pExtOptNew);
+ rSrcDoc.SetExtDocOptions(pExtOptNew);
}
pExtOptNew->GetDocSettings().mnLinkCnt = nLinkCount + 1;
@@ -2406,7 +2406,7 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
return aRef;
}
-ScDocument* ScExternalRefManager::cacheNewDocShell( sal_uInt16 nFileId, SrcShell& rSrcShell )
+ScDocument& ScExternalRefManager::cacheNewDocShell( sal_uInt16 nFileId, SrcShell& rSrcShell )
{
if (mbDocTimerEnabled && maDocShells.empty())
// If this is the first source document insertion, start up the timer.
@@ -2414,9 +2414,9 @@ ScDocument* ScExternalRefManager::cacheNewDocShell( sal_uInt16 nFileId, SrcShell
maDocShells.insert(DocShellMap::value_type(nFileId, rSrcShell));
SfxObjectShell& rShell = *rSrcShell.maShell;
- ScDocument* pSrcDoc = static_cast<ScDocShell&>(rShell).GetDocument();
- initDocInCache(maRefCache, pSrcDoc, nFileId);
- return pSrcDoc;
+ ScDocument& rSrcDoc = static_cast<ScDocShell&>(rShell).GetDocument();
+ initDocInCache(maRefCache, &rSrcDoc, nFileId);
+ return rSrcDoc;
}
bool ScExternalRefManager::isFileLoadable(const OUString& rFile) const
@@ -2742,13 +2742,13 @@ bool ScExternalRefManager::refreshSrcDocument(sal_uInt16 nFileId)
return false;
ScDocShell& rDocSh = static_cast<ScDocShell&>(*xDocShell);
- ScDocument* pSrcDoc = rDocSh.GetDocument();
+ ScDocument& rSrcDoc = rDocSh.GetDocument();
// Clear the existing cache, and refill it. Make sure we keep the
// existing cache table instances here.
maRefCache.clearCacheTables(nFileId);
RefCacheFiller aAction(mpDoc->GetSharedStringPool(), maRefCache, nFileId);
- aCachedArea.executeColumnAction(*pSrcDoc, aAction);
+ aCachedArea.executeColumnAction(rSrcDoc, aAction);
DocShellMap::iterator it = maDocShells.find(nFileId);
if (it != maDocShells.end())
diff --git a/sc/source/ui/docshell/olinefun.cxx b/sc/source/ui/docshell/olinefun.cxx
index 57656d4f7bdc..3aa5cf6b0c64 100644
--- a/sc/source/ui/docshell/olinefun.cxx
+++ b/sc/source/ui/docshell/olinefun.cxx
@@ -46,7 +46,7 @@ static void lcl_InvalidateOutliner( SfxBindings* pBindings )
static void lcl_PaintWidthHeight( ScDocShell& rDocShell, SCTAB nTab,
bool bColumns, SCCOLROW nStart, SCCOLROW nEnd )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
sal_uInt16 nParts = PAINT_GRID;
SCCOL nStartCol = 0;
@@ -65,7 +65,7 @@ static void lcl_PaintWidthHeight( ScDocShell& rDocShell, SCTAB nTab,
nStartRow = nStart;
nEndRow = nEnd;
}
- if (pDoc->HasAttrib( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
+ if (rDoc.HasAttrib( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
HASATTR_MERGED | HASATTR_OVERLAPPED ))
{
nStartCol = 0;
@@ -83,24 +83,24 @@ bool ScOutlineDocFunc::MakeOutline( const ScRange& rRange, bool bColumns, bool b
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nTab = rRange.aStart.Tab();
- ScDocument* pDoc = rDocShell.GetDocument();
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab, true );
+ ScDocument& rDoc = rDocShell.GetDocument();
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab, true );
ScOutlineTable* pUndoTab = NULL;
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
if (bRecord)
pUndoTab = new ScOutlineTable( *pTable );
- ScOutlineArray* pArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
+ ScOutlineArray& rArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
bool bRes;
bool bSize = false;
if ( bColumns )
- bRes = pArray->Insert( nStartCol, nEndCol, bSize );
+ bRes = rArray.Insert( nStartCol, nEndCol, bSize );
else
- bRes = pArray->Insert( nStartRow, nEndRow, bSize );
+ bRes = rArray.Insert( nStartRow, nEndRow, bSize );
if ( bRes )
{
@@ -112,8 +112,8 @@ bool ScOutlineDocFunc::MakeOutline( const ScRange& rRange, bool bColumns, bool b
pUndoTab, bColumns, true ) );
}
- if (pDoc->IsStreamValid(nTab))
- pDoc->SetStreamValid(nTab, false);
+ if (rDoc.IsStreamValid(nTab))
+ rDoc.SetStreamValid(nTab, false);
sal_uInt16 nParts = 0; // Datenbereich nicht geaendert
if ( bColumns )
@@ -148,25 +148,25 @@ bool ScOutlineDocFunc::RemoveOutline( const ScRange& rRange, bool bColumns, bool
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nTab = rRange.aStart.Tab();
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
if (pTable)
{
ScOutlineTable* pUndoTab = NULL;
if (bRecord)
pUndoTab = new ScOutlineTable( *pTable );
- ScOutlineArray* pArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
+ ScOutlineArray& rArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
bool bRes;
bool bSize = false;
if ( bColumns )
- bRes = pArray->Remove( nStartCol, nEndCol, bSize );
+ bRes = rArray.Remove( nStartCol, nEndCol, bSize );
else
- bRes = pArray->Remove( nStartRow, nEndRow, bSize );
+ bRes = rArray.Remove( nStartRow, nEndRow, bSize );
if ( bRes )
{
@@ -178,8 +178,8 @@ bool ScOutlineDocFunc::RemoveOutline( const ScRange& rRange, bool bColumns, bool
pUndoTab, bColumns, false ) );
}
- if (pDoc->IsStreamValid(nTab))
- pDoc->SetStreamValid(nTab, false);
+ if (rDoc.IsStreamValid(nTab))
+ rDoc.SetStreamValid(nTab, false);
sal_uInt16 nParts = 0; // Datenbereich nicht geaendert
if ( bColumns )
@@ -209,27 +209,27 @@ bool ScOutlineDocFunc::RemoveOutline( const ScRange& rRange, bool bColumns, bool
bool ScOutlineDocFunc::RemoveAllOutlines( SCTAB nTab, bool bRecord )
{
bool bSuccess = false;
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
if (pTable)
{
if (bRecord)
{
SCCOLROW nCol1, nCol2, nRow1, nRow2;
- pTable->GetColArray()->GetRange( nCol1, nCol2 );
- pTable->GetRowArray()->GetRange( nRow1, nRow2 );
+ pTable->GetColArray().GetRange( nCol1, nCol2 );
+ pTable->GetRowArray().GetRange( nRow1, nRow2 );
SCCOL nStartCol = static_cast<SCCOL>(nCol1);
SCROW nStartRow = nRow1;
SCCOL nEndCol = static_cast<SCCOL>(nCol2);
SCROW nEndRow = nRow2;
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true );
- pDoc->CopyToDocument( nStartCol, 0, nTab, nEndCol, MAXROW, nTab, IDF_NONE, false, pUndoDoc );
- pDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ rDoc.CopyToDocument( nStartCol, 0, nTab, nEndCol, MAXROW, nTab, IDF_NONE, false, pUndoDoc );
+ rDoc.CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pUndoDoc );
ScOutlineTable* pUndoTab = new ScOutlineTable( *pTable );
@@ -240,14 +240,14 @@ bool ScOutlineDocFunc::RemoveAllOutlines( SCTAB nTab, bool bRecord )
pUndoDoc, pUndoTab ) );
}
- SelectLevel( nTab, true, pTable->GetColArray()->GetDepth(), false, false );
- SelectLevel( nTab, false, pTable->GetRowArray()->GetDepth(), false, false );
- pDoc->SetOutlineTable( nTab, NULL );
+ SelectLevel( nTab, true, pTable->GetColArray().GetDepth(), false, false );
+ SelectLevel( nTab, false, pTable->GetRowArray().GetDepth(), false, false );
+ rDoc.SetOutlineTable( nTab, NULL );
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.UpdatePageBreaks( nTab );
- if (pDoc->IsStreamValid(nTab))
- pDoc->SetStreamValid(nTab, false);
+ if (rDoc.IsStreamValid(nTab))
+ rDoc.SetStreamValid(nTab, false);
rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab,
PAINT_GRID | PAINT_LEFT | PAINT_TOP | PAINT_SIZE );
@@ -267,11 +267,11 @@ bool ScOutlineDocFunc::AutoOutline( const ScRange& rRange, bool bRecord )
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nTab = rRange.aStart.Tab();
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
ScDocument* pUndoDoc = NULL;
ScOutlineTable* pUndoTab = NULL;
@@ -283,26 +283,26 @@ bool ScOutlineDocFunc::AutoOutline( const ScRange& rRange, bool bRecord )
pUndoTab = new ScOutlineTable( *pTable );
SCCOLROW nCol1, nCol2, nRow1, nRow2;
- pTable->GetColArray()->GetRange( nCol1, nCol2 );
- pTable->GetRowArray()->GetRange( nRow1, nRow2 );
+ pTable->GetColArray().GetRange( nCol1, nCol2 );
+ pTable->GetRowArray().GetRange( nRow1, nRow2 );
SCCOL nOutStartCol = static_cast<SCCOL>(nCol1);
SCROW nOutStartRow = nRow1;
SCCOL nOutEndCol = static_cast<SCCOL>(nCol2);
SCROW nOutEndRow = nRow2;
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true );
- pDoc->CopyToDocument( nOutStartCol, 0, nTab, nOutEndCol, MAXROW, nTab, IDF_NONE, false, pUndoDoc );
- pDoc->CopyToDocument( 0, nOutStartRow, nTab, MAXCOL, nOutEndRow, nTab, IDF_NONE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ rDoc.CopyToDocument( nOutStartCol, 0, nTab, nOutEndCol, MAXROW, nTab, IDF_NONE, false, pUndoDoc );
+ rDoc.CopyToDocument( 0, nOutStartRow, nTab, MAXCOL, nOutEndRow, nTab, IDF_NONE, false, pUndoDoc );
}
// einblenden
- SelectLevel( nTab, true, pTable->GetColArray()->GetDepth(), false, false );
- SelectLevel( nTab, false, pTable->GetRowArray()->GetDepth(), false, false );
- pDoc->SetOutlineTable( nTab, NULL );
+ SelectLevel( nTab, true, pTable->GetColArray().GetDepth(), false, false );
+ SelectLevel( nTab, false, pTable->GetRowArray().GetDepth(), false, false );
+ rDoc.SetOutlineTable( nTab, NULL );
}
- pDoc->DoAutoOutline( nStartCol,nStartRow, nEndCol,nEndRow, nTab );
+ rDoc.DoAutoOutline( nStartCol,nStartRow, nEndCol,nEndRow, nTab );
if (bRecord)
{
@@ -313,8 +313,8 @@ bool ScOutlineDocFunc::AutoOutline( const ScRange& rRange, bool bRecord )
pUndoDoc, pUndoTab ) );
}
- if (pDoc->IsStreamValid(nTab))
- pDoc->SetStreamValid(nTab, false);
+ if (rDoc.IsStreamValid(nTab))
+ rDoc.SetStreamValid(nTab, false);
rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_LEFT | PAINT_TOP | PAINT_SIZE );
rDocShell.SetDocumentModified();
@@ -326,19 +326,17 @@ bool ScOutlineDocFunc::AutoOutline( const ScRange& rRange, bool bRecord )
bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, bool bColumns, sal_uInt16 nLevel,
bool bRecord, bool bPaint )
{
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab ); // ist schon da
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab ); // ist schon da
if (!pTable)
return false;
- ScOutlineArray* pArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
- if (!pArray)
- return false;
+ ScOutlineArray& rArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
SCCOLROW nStart, nEnd;
- pArray->GetRange( nStart, nEnd );
+ rArray.GetRange( nStart, nEnd );
if ( bRecord )
{
@@ -346,15 +344,15 @@ bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
if (bColumns)
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, false );
- pDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, false );
+ rDoc.CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false,
pUndoDoc );
}
else
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, false, true );
- pDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ rDoc.CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pUndoDoc );
}
rDocShell.GetUndoManager()->AddUndoAction(
@@ -364,7 +362,7 @@ bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
bColumns, nLevel ) );
}
- ScSubOutlineIterator aIter( pArray ); // alle Eintraege
+ ScSubOutlineIterator aIter( &rArray ); // alle Eintraege
ScOutlineEntry* pEntry;
while ((pEntry=aIter.GetNext()) != NULL)
{
@@ -390,22 +388,22 @@ bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
for (SCCOLROW i=nThisStart; i<=nThisEnd; i++)
{
if ( bColumns )
- pDoc->ShowCol( static_cast<SCCOL>(i), nTab, bShow );
+ rDoc.ShowCol( static_cast<SCCOL>(i), nTab, bShow );
else
{
// show several rows together, don't show filtered rows
SCROW nFilterEnd = i;
- bool bFiltered = pDoc->RowFiltered( i, nTab, NULL, &nFilterEnd );
+ bool bFiltered = rDoc.RowFiltered( i, nTab, NULL, &nFilterEnd );
nFilterEnd = std::min( nThisEnd, nFilterEnd );
if ( !bShow || !bFiltered )
- pDoc->ShowRows( i, nFilterEnd, nTab, bShow );
+ rDoc.ShowRows( i, nFilterEnd, nTab, bShow );
i = nFilterEnd;
}
}
}
- pDoc->SetDrawPageSize(nTab);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.SetDrawPageSize(nTab);
+ rDoc.UpdatePageBreaks( nTab );
if (bPaint)
lcl_PaintWidthHeight( rDocShell, nTab, bColumns, nStart, nEnd );
@@ -426,15 +424,14 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord )
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nTab = rRange.aStart.Tab();
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
if (pTable)
{
- ScOutlineArray* pArray;
ScOutlineEntry* pEntry;
SCCOLROW nStart;
SCCOLROW nEnd;
@@ -446,9 +443,9 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord )
{
ScOutlineTable* pUndoTab = new ScOutlineTable( *pTable );
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true );
- pDoc->CopyToDocument( nStartCol, 0, nTab, nEndCol, MAXROW, nTab, IDF_NONE, false, pUndoDoc );
- pDoc->CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ rDoc.CopyToDocument( nStartCol, 0, nTab, nEndCol, MAXROW, nTab, IDF_NONE, false, pUndoDoc );
+ rDoc.CopyToDocument( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab, IDF_NONE, false, pUndoDoc );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoOutlineBlock( &rDocShell,
@@ -460,8 +457,8 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord )
nMin=MAXCOL;
nMax=0;
- pArray = pTable->GetColArray();
- ScSubOutlineIterator aColIter( pArray );
+ ScOutlineArray& rColArray = pTable->GetColArray();
+ ScSubOutlineIterator aColIter( &rColArray );
while ((pEntry=aColIter.GetNext()) != NULL)
{
nStart = pEntry->GetStart();
@@ -475,14 +472,14 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord )
}
}
for ( i=nMin; i<=nMax; i++ )
- pDoc->ShowCol( static_cast<SCCOL>(i), nTab, true );
+ rDoc.ShowCol( static_cast<SCCOL>(i), nTab, true );
// Zeilen
nMin=MAXROW;
nMax=0;
- pArray = pTable->GetRowArray();
- ScSubOutlineIterator aRowIter( pArray );
+ ScOutlineArray& rRowArray = pTable->GetRowArray();
+ ScSubOutlineIterator aRowIter( &rRowArray );
while ((pEntry=aRowIter.GetNext()) != NULL)
{
nStart = pEntry->GetStart();
@@ -499,15 +496,15 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord )
{
// show several rows together, don't show filtered rows
SCROW nFilterEnd = i;
- bool bFiltered = pDoc->RowFiltered( i, nTab, NULL, &nFilterEnd );
+ bool bFiltered = rDoc.RowFiltered( i, nTab, NULL, &nFilterEnd );
nFilterEnd = std::min( nMax, nFilterEnd );
if ( !bFiltered )
- pDoc->ShowRows( i, nFilterEnd, nTab, true );
+ rDoc.ShowRows( i, nFilterEnd, nTab, true );
i = nFilterEnd;
}
- pDoc->SetDrawPageSize(nTab);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.SetDrawPageSize(nTab);
+ rDoc.UpdatePageBreaks( nTab );
rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_LEFT | PAINT_TOP );
rDocShell.SetDocumentModified();
@@ -529,11 +526,11 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord )
SCROW nEndRow = rRange.aEnd.Row();
SCTAB nTab = rRange.aStart.Tab();
- ScDocument* pDoc = rDocShell.GetDocument();
+ ScDocument& rDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
if (pTable)
{
@@ -547,24 +544,24 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord )
SCCOLROW nEffStartCol = nStartCol;
SCCOLROW nEffEndCol = nEndCol;
- ScOutlineArray* pColArray = pTable->GetColArray();
- pColArray->FindTouchedLevel( nStartCol, nEndCol, nColLevel );
- pColArray->ExtendBlock( nColLevel, nEffStartCol, nEffEndCol );
+ ScOutlineArray& rColArray = pTable->GetColArray();
+ rColArray.FindTouchedLevel( nStartCol, nEndCol, nColLevel );
+ rColArray.ExtendBlock( nColLevel, nEffStartCol, nEffEndCol );
SCCOLROW nEffStartRow = nStartRow;
SCCOLROW nEffEndRow = nEndRow;
- ScOutlineArray* pRowArray = pTable->GetRowArray();
- pRowArray->FindTouchedLevel( nStartRow, nEndRow, nRowLevel );
- pRowArray->ExtendBlock( nRowLevel, nEffStartRow, nEffEndRow );
+ ScOutlineArray& rRowArray = pTable->GetRowArray();
+ rRowArray.FindTouchedLevel( nStartRow, nEndRow, nRowLevel );
+ rRowArray.ExtendBlock( nRowLevel, nEffStartRow, nEffEndRow );
if ( bRecord )
{
ScOutlineTable* pUndoTab = new ScOutlineTable( *pTable );
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true );
- pDoc->CopyToDocument( static_cast<SCCOL>(nEffStartCol), 0, nTab,
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ rDoc.CopyToDocument( static_cast<SCCOL>(nEffStartCol), 0, nTab,
static_cast<SCCOL>(nEffEndCol), MAXROW, nTab, IDF_NONE,
false, pUndoDoc );
- pDoc->CopyToDocument( 0, nEffStartRow, nTab, MAXCOL, nEffEndRow, nTab, IDF_NONE, false, pUndoDoc );
+ rDoc.CopyToDocument( 0, nEffStartRow, nTab, MAXCOL, nEffEndRow, nTab, IDF_NONE, false, pUndoDoc );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoOutlineBlock( &rDocShell,
@@ -574,10 +571,10 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord )
// Spalten
- nCount = pColArray->GetCount(nColLevel);
+ nCount = rColArray.GetCount(nColLevel);
for ( i=0; i<nCount; i++ )
{
- pEntry = pColArray->GetEntry(nColLevel,i);
+ pEntry = rColArray.GetEntry(nColLevel,i);
nStart = pEntry->GetStart();
nEnd = pEntry->GetEnd();
@@ -587,10 +584,10 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord )
// Zeilen
- nCount = pRowArray->GetCount(nRowLevel);
+ nCount = rRowArray.GetCount(nRowLevel);
for ( i=0; i<nCount; i++ )
{
- pEntry = pRowArray->GetEntry(nRowLevel,i);
+ pEntry = rRowArray.GetEntry(nRowLevel,i);
nStart = pEntry->GetStart();
nEnd = pEntry->GetEnd();
@@ -598,8 +595,8 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord )
HideOutline( nTab, false, nRowLevel, i, false, false );
}
- pDoc->SetDrawPageSize(nTab);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.SetDrawPageSize(nTab);
+ rDoc.UpdatePageBreaks( nTab );
rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_LEFT | PAINT_TOP );
@@ -615,13 +612,13 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord )
bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry,
bool bRecord, bool bPaint )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
- ScOutlineArray* pArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
- ScOutlineEntry* pEntry = pArray->GetEntry( nLevel, nEntry );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
+ ScOutlineArray& rArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
+ ScOutlineEntry* pEntry = rArray.GetEntry( nLevel, nEntry );
SCCOLROW nStart = pEntry->GetStart();
SCCOLROW nEnd = pEntry->GetEnd();
@@ -630,15 +627,15 @@ bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
if (bColumns)
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, false );
- pDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, false );
+ rDoc.CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false,
pUndoDoc );
}
else
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, false, true );
- pDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ rDoc.CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pUndoDoc );
}
rDocShell.GetUndoManager()->AddUndoAction(
@@ -652,20 +649,20 @@ bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
for ( i = nStart; i <= nEnd; i++ )
{
if ( bColumns )
- pDoc->ShowCol( static_cast<SCCOL>(i), nTab, true );
+ rDoc.ShowCol( static_cast<SCCOL>(i), nTab, true );
else
{
// show several rows together, don't show filtered rows
SCROW nFilterEnd = i;
- bool bFiltered = pDoc->RowFiltered( i, nTab, NULL, &nFilterEnd );
+ bool bFiltered = rDoc.RowFiltered( i, nTab, NULL, &nFilterEnd );
nFilterEnd = std::min( nEnd, nFilterEnd );
if ( !bFiltered )
- pDoc->ShowRows( i, nFilterEnd, nTab, true );
+ rDoc.ShowRows( i, nFilterEnd, nTab, true );
i = nFilterEnd;
}
}
- ScSubOutlineIterator aIter( pArray, nLevel, nEntry );
+ ScSubOutlineIterator aIter( &rArray, nLevel, nEntry );
while ((pEntry=aIter.GetNext()) != NULL)
{
if ( pEntry->IsHidden() )
@@ -674,17 +671,17 @@ bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
SCCOLROW nSubEnd = pEntry->GetEnd();
if ( bColumns )
for ( i = nSubStart; i <= nSubEnd; i++ )
- pDoc->ShowCol( static_cast<SCCOL>(i), nTab, false );
+ rDoc.ShowCol( static_cast<SCCOL>(i), nTab, false );
else
- pDoc->ShowRows( nSubStart, nSubEnd, nTab, false );
+ rDoc.ShowRows( nSubStart, nSubEnd, nTab, false );
}
}
- pArray->SetVisibleBelow( nLevel, nEntry, true, true );
+ rArray.SetVisibleBelow( nLevel, nEntry, true, true );
- pDoc->SetDrawPageSize(nTab);
- pDoc->InvalidatePageBreaks(nTab);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.SetDrawPageSize(nTab);
+ rDoc.InvalidatePageBreaks(nTab);
+ rDoc.UpdatePageBreaks( nTab );
if (bPaint)
lcl_PaintWidthHeight( rDocShell, nTab, bColumns, nStart, nEnd );
@@ -699,13 +696,13 @@ bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
bool ScOutlineDocFunc::HideOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry,
bool bRecord, bool bPaint )
{
- ScDocument* pDoc = rDocShell.GetDocument();
- if (bRecord && !pDoc->IsUndoEnabled())
+ ScDocument& rDoc = rDocShell.GetDocument();
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
- ScOutlineArray* pArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
- ScOutlineEntry* pEntry = pArray->GetEntry( nLevel, nEntry );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
+ ScOutlineArray& rArray = bColumns ? pTable->GetColArray() : pTable->GetRowArray();
+ ScOutlineEntry* pEntry = rArray.GetEntry( nLevel, nEntry );
SCCOLROW nStart = pEntry->GetStart();
SCCOLROW nEnd = pEntry->GetEnd();
@@ -714,15 +711,15 @@ bool ScOutlineDocFunc::HideOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
if (bColumns)
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, false );
- pDoc->CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, false );
+ rDoc.CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
static_cast<SCCOL>(nEnd), MAXROW, nTab, IDF_NONE, false,
pUndoDoc );
}
else
{
- pUndoDoc->InitUndo( pDoc, nTab, nTab, false, true );
- pDoc->CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ rDoc.CopyToDocument( 0, nStart, nTab, MAXCOL, nEnd, nTab, IDF_NONE, false, pUndoDoc );
}
rDocShell.GetUndoManager()->AddUndoAction(
@@ -735,15 +732,15 @@ bool ScOutlineDocFunc::HideOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
SCCOLROW i;
if ( bColumns )
for ( i = nStart; i <= nEnd; i++ )
- pDoc->ShowCol( static_cast<SCCOL>(i), nTab, false );
+ rDoc.ShowCol( static_cast<SCCOL>(i), nTab, false );
else
- pDoc->ShowRows( nStart, nEnd, nTab, false );
+ rDoc.ShowRows( nStart, nEnd, nTab, false );
- pArray->SetVisibleBelow( nLevel, nEntry, false );
+ rArray.SetVisibleBelow( nLevel, nEntry, false );
- pDoc->SetDrawPageSize(nTab);
- pDoc->InvalidatePageBreaks(nTab);
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.SetDrawPageSize(nTab);
+ rDoc.InvalidatePageBreaks(nTab);
+ rDoc.UpdatePageBreaks( nTab );
if (bPaint)
lcl_PaintWidthHeight( rDocShell, nTab, bColumns, nStart, nEnd );
diff --git a/sc/source/ui/docshell/servobj.cxx b/sc/source/ui/docshell/servobj.cxx
index 2cafae98e2ea..416e6359311e 100644
--- a/sc/source/ui/docshell/servobj.cxx
+++ b/sc/source/ui/docshell/servobj.cxx
@@ -33,8 +33,8 @@ static bool lcl_FillRangeFromName( ScRange& rRange, ScDocShell* pDocSh, const OU
{
if (pDocSh)
{
- ScDocument* pDoc = pDocSh->GetDocument();
- ScRangeName* pNames = pDoc->GetRangeName();
+ ScDocument& rDoc = pDocSh->GetDocument();
+ ScRangeName* pNames = rDoc.GetRangeName();
if (pNames)
{
const ScRangeData* pData = pNames->findByUpperName(ScGlobal::pCharClass->uppercase(rName));
@@ -78,17 +78,17 @@ ScServerObject::ScServerObject( ScDocShell* pShell, const OUString& rItem ) :
else
{
// parse ref
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nTab = ScDocShell::GetCurTab();
aRange.aStart.SetTab( nTab );
// For DDE link, we always must parse references using OOO A1 convention.
- if ( aRange.Parse( rItem, pDoc, FormulaGrammar::CONV_OOO ) & SCA_VALID )
+ if ( aRange.Parse( rItem, &rDoc, FormulaGrammar::CONV_OOO ) & SCA_VALID )
{
// area reference
}
- else if ( aRange.aStart.Parse( rItem, pDoc, FormulaGrammar::CONV_OOO ) & SCA_VALID )
+ else if ( aRange.aStart.Parse( rItem, &rDoc, FormulaGrammar::CONV_OOO ) & SCA_VALID )
{
// cell reference
aRange.aEnd = aRange.aStart;
@@ -99,8 +99,8 @@ ScServerObject::ScServerObject( ScDocShell* pShell, const OUString& rItem ) :
}
}
- pDocSh->GetDocument()->GetLinkManager()->InsertServer( this );
- pDocSh->GetDocument()->StartListeningArea( aRange, &aForwarder );
+ pDocSh->GetDocument().GetLinkManager()->InsertServer( this );
+ pDocSh->GetDocument().StartListeningArea( aRange, &aForwarder );
StartListening(*pDocSh); // um mitzubekommen, wenn die DocShell geloescht wird
StartListening(*SFX_APP()); // for SC_HINT_AREAS_CHANGED
@@ -118,8 +118,8 @@ void ScServerObject::Clear()
ScDocShell* pTemp = pDocSh;
pDocSh = NULL;
- pTemp->GetDocument()->EndListeningArea( aRange, &aForwarder );
- pTemp->GetDocument()->GetLinkManager()->RemoveServer( this );
+ pTemp->GetDocument().EndListeningArea( aRange, &aForwarder );
+ pTemp->GetDocument().GetLinkManager()->RemoveServer( this );
EndListening(*pTemp);
EndListening(*SFX_APP());
}
@@ -154,18 +154,18 @@ bool ScServerObject::GetData(
// refresh the listeners now (this is called from a timer)
EndListeningAll();
- pDocSh->GetDocument()->StartListeningArea( aRange, &aForwarder );
+ pDocSh->GetDocument().StartListeningArea( aRange, &aForwarder );
StartListening(*pDocSh);
StartListening(*SFX_APP());
bRefreshListener = false;
}
OUString aDdeTextFmt = pDocSh->GetDdeTextFmt();
- ScDocument* pDoc = pDocSh->GetDocument();
+ ScDocument& rDoc = pDocSh->GetDocument();
if( FORMAT_STRING == SotExchange::GetFormatIdFromMimeType( rMimeType ))
{
- ScImportExport aObj( pDoc, aRange );
+ ScImportExport aObj( &rDoc, aRange );
if( aDdeTextFmt[0] == 'F' )
aObj.SetFormulas( true );
if( aDdeTextFmt.equalsAscii( "SYLK" ) ||
@@ -188,7 +188,7 @@ bool ScServerObject::GetData(
return aObj.ExportData( rMimeType, rData );
}
- ScImportExport aObj( pDoc, aRange );
+ ScImportExport aObj( &rDoc, aRange );
aObj.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::ToSpace, ' ', false ) );
if( aObj.IsRef() )
return aObj.ExportData( rMimeType, rData );
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index f1af923f6f84..9059a27a67f1 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -89,7 +89,7 @@ ScTableLink::ScTableLink(SfxObjectShell* pShell, const OUString& rFile,
{
pImpl->m_pDocSh = static_cast< ScDocShell* >( pShell );
SetRefreshHandler( LINK( this, ScTableLink, RefreshHdl ) );
- SetRefreshControl( pImpl->m_pDocSh->GetDocument()->GetRefreshTimerControlAddress() );
+ SetRefreshControl( &pImpl->m_pDocSh->GetDocument().GetRefreshTimerControlAddress() );
}
ScTableLink::~ScTableLink()
@@ -98,11 +98,11 @@ ScTableLink::~ScTableLink()
StopRefreshTimer();
OUString aEmpty;
- ScDocument* pDoc = pImpl->m_pDocSh->GetDocument();
- SCTAB nCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pImpl->m_pDocSh->GetDocument();
+ SCTAB nCount = rDoc.GetTableCount();
for (SCTAB nTab=0; nTab<nCount; nTab++)
- if (pDoc->IsLinked(nTab) && aFileName.equals(pDoc->GetLinkDoc(nTab)))
- pDoc->SetLink( nTab, SC_LINK_NONE, aEmpty, aEmpty, aEmpty, aEmpty, 0 );
+ if (rDoc.IsLinked(nTab) && aFileName.equals(rDoc.GetLinkDoc(nTab)))
+ rDoc.SetLink( nTab, SC_LINK_NONE, aEmpty, aEmpty, aEmpty, aEmpty, 0 );
delete pImpl;
}
@@ -123,7 +123,7 @@ void ScTableLink::Edit( Window* pParent, const Link& rEndEditHdl )
::sfx2::SvBaseLink::UpdateResult ScTableLink::DataChanged(
const OUString&, const ::com::sun::star::uno::Any& )
{
- sfx2::LinkManager* pLinkManager=pImpl->m_pDocSh->GetDocument()->GetLinkManager();
+ sfx2::LinkManager* pLinkManager=pImpl->m_pDocSh->GetDocument().GetLinkManager();
if (pLinkManager!=NULL)
{
OUString aFile, aFilter;
@@ -142,8 +142,8 @@ void ScTableLink::Edit( Window* pParent, const Link& rEndEditHdl )
void ScTableLink::Closed()
{
// Verknuepfung loeschen: Undo
- ScDocument* pDoc = pImpl->m_pDocSh->GetDocument();
- bool bUndo (pDoc->IsUndoEnabled());
+ ScDocument& rDoc = pImpl->m_pDocSh->GetDocument();
+ bool bUndo (rDoc.IsUndoEnabled());
if (bAddUndo && bUndo)
{
@@ -160,7 +160,7 @@ void ScTableLink::Closed()
bool ScTableLink::IsUsed() const
{
- return pImpl->m_pDocSh->GetDocument()->HasLink( aFileName, aFilterName, aOptions );
+ return pImpl->m_pDocSh->GetDocument().HasLink( aFileName, aFilterName, aOptions );
}
bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
@@ -178,10 +178,10 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
if (!pFilter)
return false;
- ScDocument* pDoc = pImpl->m_pDocSh->GetDocument();
- pDoc->SetInLinkUpdate( true );
+ ScDocument& rDoc = pImpl->m_pDocSh->GetDocument();
+ rDoc.SetInLinkUpdate( true );
- bool bUndo(pDoc->IsUndoEnabled());
+ bool bUndo(rDoc.IsUndoEnabled());
// wenn neuer Filter ausgewaehlt wurde, Optionen vergessen
if (!aFilterName.equals(rNewFilter))
@@ -221,36 +221,36 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
ScDocShellModificator aModificator( *pImpl->m_pDocSh );
bool bNotFound = false;
- ScDocument* pSrcDoc = pSrcShell->GetDocument();
+ ScDocument& rSrcDoc = pSrcShell->GetDocument();
// from text filters that don't set the table name,
// use the one table regardless of link table name
- bool bAutoTab = (pSrcDoc->GetTableCount() == 1) &&
+ bool bAutoTab = (rSrcDoc.GetTableCount() == 1) &&
ScDocShell::HasAutomaticTableName( rNewFilter );
- SCTAB nCount = pDoc->GetTableCount();
+ SCTAB nCount = rDoc.GetTableCount();
for (SCTAB nTab=0; nTab<nCount; nTab++)
{
- sal_uInt8 nMode = pDoc->GetLinkMode(nTab);
- if (nMode && aFileName.equals(pDoc->GetLinkDoc(nTab)))
+ sal_uInt8 nMode = rDoc.GetLinkMode(nTab);
+ if (nMode && aFileName.equals(rDoc.GetLinkDoc(nTab)))
{
- OUString aTabName = pDoc->GetLinkTab(nTab);
+ OUString aTabName = rDoc.GetLinkTab(nTab);
// Undo
if (bAddUndo && bUndo)
{
if (bFirst)
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
else
pUndoDoc->AddUndoTab( nTab, nTab, true, true );
bFirst = false;
ScRange aRange(0,0,nTab,MAXCOL,MAXROW,nTab);
- pDoc->CopyToDocument(aRange, IDF_ALL, false, pUndoDoc);
- pUndoDoc->TransferDrawPage( pDoc, nTab, nTab );
+ rDoc.CopyToDocument(aRange, IDF_ALL, false, pUndoDoc);
+ pUndoDoc->TransferDrawPage( &rDoc, nTab, nTab );
pUndoDoc->SetLink( nTab, nMode, aFileName, aFilterName,
aOptions, aTabName, GetRefreshDelay() );
- pUndoDoc->SetTabBgColor( nTab, pDoc->GetTabBgColor(nTab) );
+ pUndoDoc->SetTabBgColor( nTab, rDoc.GetTabBgColor(nTab) );
}
// Tabellenname einer ExtDocRef anpassen
@@ -258,11 +258,11 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
if ( bNewUrlName && nMode == SC_LINK_VALUE )
{
OUString aName;
- pDoc->GetName( nTab, aName );
+ rDoc.GetName( nTab, aName );
if ( ScGlobal::GetpTransliteration()->isEqual(
ScGlobal::GetDocTabName( aFileName, aTabName ), aName ) )
{
- pDoc->RenameTab( nTab,
+ rDoc.RenameTab( nTab,
ScGlobal::GetDocTabName( aNewUrl, aTabName ),
false, true ); // kein RefUpdate, kein ValidTabName
}
@@ -274,22 +274,22 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
bool bFound = false;
/* #i71497# check if external document is loaded successfully,
otherwise we may find the empty default sheet "Sheet1" in
- pSrcDoc, even if the document does not exist. */
+ rSrcDoc, even if the document does not exist. */
if( pMed->GetError() == 0 )
{
// no sheet name -> use first sheet
if ( !aTabName.isEmpty() && !bAutoTab )
- bFound = pSrcDoc->GetTable( aTabName, nSrcTab );
+ bFound = rSrcDoc.GetTable( aTabName, nSrcTab );
else
bFound = true;
}
if (bFound)
- pDoc->TransferTab( pSrcDoc, nSrcTab, nTab, false, // nicht neu einfuegen
+ rDoc.TransferTab( &rSrcDoc, nSrcTab, nTab, false, // nicht neu einfuegen
(nMode == SC_LINK_VALUE) ); // nur Werte?
else
{
- pDoc->DeleteAreaTab( 0,0,MAXCOL,MAXROW, nTab, IDF_ALL );
+ rDoc.DeleteAreaTab( 0,0,MAXCOL,MAXROW, nTab, IDF_ALL );
bool bShowError = true;
if ( nMode == SC_LINK_VALUE )
@@ -299,7 +299,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
ScRangeList aErrorCells; // cells on the linked sheets that need error values
- ScCellIterator aIter(pDoc, ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB)); // all sheets
+ ScCellIterator aIter(&rDoc, ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB)); // all sheets
for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
{
if (aIter.getType() != CELLTYPE_FORMULA)
@@ -339,7 +339,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
for (SCCOL nCol=nStartCol; nCol<=nEndCol; nCol++)
{
ScAddress aDestPos( nCol, nRow, nTab );
- pDoc->SetFormula(aDestPos, aTokenArr);
+ rDoc.SetFormula(aDestPos, aTokenArr);
}
}
@@ -352,11 +352,11 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
{
// Normal link or no references: put error message on sheet.
- pDoc->SetString( 0,0,nTab, ScGlobal::GetRscString(STR_LINKERROR) );
- pDoc->SetString( 0,1,nTab, ScGlobal::GetRscString(STR_LINKERRORFILE) );
- pDoc->SetString( 1,1,nTab, aNewUrl );
- pDoc->SetString( 0,2,nTab, ScGlobal::GetRscString(STR_LINKERRORTAB) );
- pDoc->SetString( 1,2,nTab, aTabName );
+ rDoc.SetString( 0,0,nTab, ScGlobal::GetRscString(STR_LINKERROR) );
+ rDoc.SetString( 0,1,nTab, ScGlobal::GetRscString(STR_LINKERRORFILE) );
+ rDoc.SetString( 1,1,nTab, aNewUrl );
+ rDoc.SetString( 0,2,nTab, ScGlobal::GetRscString(STR_LINKERRORTAB) );
+ rDoc.SetString( 1,2,nTab, aTabName );
}
bNotFound = true;
@@ -365,7 +365,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
if ( bNewUrlName || !aFilterName.equals(rNewFilter) ||
!aOptions.equals(aNewOpt) || pNewOptions ||
nNewRefresh != GetRefreshDelay() )
- pDoc->SetLink( nTab, nMode, aNewUrl, rNewFilter, aNewOpt,
+ rDoc.SetLink( nTab, nMode, aNewUrl, rNewFilter, aNewOpt,
aTabName, nNewRefresh );
}
}
@@ -403,13 +403,13 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
//! Fehler ausgeben ?
}
- pDoc->SetInLinkUpdate( false );
+ rDoc.SetInLinkUpdate( false );
// notify Uno objects (for XRefreshListener)
//! also notify Uno objects if file name was changed!
ScLinkRefreshedHint aHint;
aHint.SetSheetLink( aFileName );
- pDoc->BroadcastUno( aHint );
+ rDoc.BroadcastUno( aHint );
return true;
}
@@ -535,17 +535,14 @@ ScDocumentLoader::ScDocumentLoader( const OUString& rFileName,
pDocShell = new ScDocShell( SFX_CREATE_MODE_INTERNAL );
aRef = pDocShell;
- ScDocument* pDoc = pDocShell->GetDocument();
- if( pDoc )
+ ScDocument& rDoc = pDocShell->GetDocument();
+ ScExtDocOptions* pExtDocOpt = rDoc.GetExtDocOptions();
+ if( !pExtDocOpt )
{
- ScExtDocOptions* pExtDocOpt = pDoc->GetExtDocOptions();
- if( !pExtDocOpt )
- {
- pExtDocOpt = new ScExtDocOptions;
- pDoc->SetExtDocOptions( pExtDocOpt );
- }
- pExtDocOpt->GetDocSettings().mnLinkCnt = nRekCnt;
+ pExtDocOpt = new ScExtDocOptions;
+ rDoc.SetExtDocOptions( pExtDocOpt );
}
+ pExtDocOpt->GetDocSettings().mnLinkCnt = nRekCnt;
pDocShell->DoLoad( pMedium );
@@ -577,7 +574,7 @@ void ScDocumentLoader::ReleaseDocRef()
ScDocument* ScDocumentLoader::GetDocument()
{
- return pDocShell ? pDocShell->GetDocument() : 0;
+ return pDocShell ? &pDocShell->GetDocument() : 0;
}
bool ScDocumentLoader::IsError() const