[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Sep 24 09:03:05 UTC 2020
sc/inc/bigrange.hxx | 6
sc/inc/cellform.hxx | 2
sc/inc/cellsuno.hxx | 2
sc/inc/charthelper.hxx | 2
sc/inc/chgtrack.hxx | 36 ++---
sc/inc/document.hxx | 2
sc/inc/externalrefmgr.hxx | 10 -
sc/inc/macromgr.hxx | 4
sc/qa/unit/subsequent_export-test.cxx | 2
sc/qa/unit/ucalc.cxx | 14 +-
sc/qa/unit/ucalc_condformat.cxx | 2
sc/qa/unit/ucalc_sharedformula.cxx | 4
sc/source/core/data/bigrange.cxx | 8 -
sc/source/core/data/column2.cxx | 8 -
sc/source/core/data/column3.cxx | 6
sc/source/core/data/column4.cxx | 2
sc/source/core/data/documen2.cxx | 2
sc/source/core/data/documen3.cxx | 2
sc/source/core/data/documen6.cxx | 2
sc/source/core/data/documen8.cxx | 4
sc/source/core/data/document.cxx | 12 -
sc/source/core/tool/cellform.cxx | 8 -
sc/source/core/tool/charthelper.cxx | 10 -
sc/source/core/tool/chgtrack.cxx | 162 ++++++++++++------------
sc/source/core/tool/interpr4.cxx | 16 +-
sc/source/filter/excel/xicontent.cxx | 2
sc/source/filter/html/htmlexp.cxx | 2
sc/source/filter/oox/formulabuffer.cxx | 2
sc/source/filter/xml/xmlcelli.cxx | 4
sc/source/filter/xml/xmlexprt.cxx | 2
sc/source/ui/app/scmod.cxx | 2
sc/source/ui/app/transobj.cxx | 2
sc/source/ui/docshell/arealink.cxx | 8 -
sc/source/ui/docshell/dbdocfun.cxx | 32 ++--
sc/source/ui/docshell/dbdocimp.cxx | 4
sc/source/ui/docshell/docfunc.cxx | 58 ++++----
sc/source/ui/docshell/docfuncutil.cxx | 2
sc/source/ui/docshell/docsh.cxx | 8 -
sc/source/ui/docshell/docsh3.cxx | 10 -
sc/source/ui/docshell/docsh5.cxx | 6
sc/source/ui/docshell/externalrefmgr.cxx | 82 ++++++------
sc/source/ui/docshell/impex.cxx | 12 -
sc/source/ui/docshell/macromgr.cxx | 10 -
sc/source/ui/docshell/olinefun.cxx | 20 +-
sc/source/ui/docshell/tablink.cxx | 2
sc/source/ui/inc/dbfunc.hxx | 2
sc/source/ui/inc/printfun.hxx | 8 -
sc/source/ui/miscdlgs/acredlin.cxx | 24 +--
sc/source/ui/miscdlgs/conflictsdlg.cxx | 6
sc/source/ui/miscdlgs/redcom.cxx | 4
sc/source/ui/undo/undoblk3.cxx | 2
sc/source/ui/undo/undotab.cxx | 2
sc/source/ui/unoobj/cellsuno.cxx | 28 ++--
sc/source/ui/unoobj/tokenuno.cxx | 2
sc/source/ui/view/dbfunc2.cxx | 2
sc/source/ui/view/dbfunc3.cxx | 8 -
sc/source/ui/view/dbfunc4.cxx | 8 -
sc/source/ui/view/gridwin5.cxx | 2
sc/source/ui/view/output2.cxx | 6
sc/source/ui/view/printfun.cxx | 208 +++++++++++++++----------------
sc/source/ui/view/spelldialog.cxx | 4
sc/source/ui/view/spelleng.cxx | 2
sc/source/ui/view/viewfun2.cxx | 8 -
sc/source/ui/view/viewfun3.cxx | 22 +--
sc/source/ui/view/viewfun4.cxx | 12 -
sc/source/ui/view/viewfunc.cxx | 14 +-
sc/source/ui/view/viewutil.cxx | 2
67 files changed, 489 insertions(+), 485 deletions(-)
New commits:
commit 2346b09d19d98992e2dae826d7576cfe01538461
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Sep 23 12:09:41 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Sep 24 11:02:05 2020 +0200
ScCellFormat::GetString never called with a null ScDocument*
and similar, allowing a few redundant null checks to be dropped
Change-Id: Ice0d6d57df112a09d3e1af3d34126b3519529daf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103278
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/inc/bigrange.hxx b/sc/inc/bigrange.hxx
index 136c6e054c5a..056c0d4ae304 100644
--- a/sc/inc/bigrange.hxx
+++ b/sc/inc/bigrange.hxx
@@ -60,7 +60,7 @@ public:
void GetVars( sal_Int32& nColP, sal_Int32& nRowP, sal_Int32& nTabP ) const
{ nColP = nCol; nRowP = nRow; nTabP = nTab; }
- bool IsValid( const ScDocument* pDoc ) const;
+ bool IsValid( const ScDocument& rDoc ) const;
inline ScAddress MakeAddress() const;
ScBigAddress& operator=( const ScBigAddress& r )
@@ -132,8 +132,8 @@ public:
{ aStart.GetVars( nCol1, nRow1, nTab1 );
aEnd.GetVars( nCol2, nRow2, nTab2 ); }
- bool IsValid( const ScDocument* pDoc ) const
- { return aStart.IsValid( pDoc ) && aEnd.IsValid( pDoc ); }
+ bool IsValid( const ScDocument& rDoc ) const
+ { return aStart.IsValid( rDoc ) && aEnd.IsValid( rDoc ); }
ScRange MakeRange() const
{ return ScRange( aStart.MakeAddress(),
aEnd.MakeAddress() ); }
diff --git a/sc/inc/cellform.hxx b/sc/inc/cellform.hxx
index bfc611a4a3ae..a19b61695624 100644
--- a/sc/inc/cellform.hxx
+++ b/sc/inc/cellform.hxx
@@ -35,7 +35,7 @@ public:
static void GetString(
const ScRefCellValue& rCell, sal_uInt32 nFormat, OUString& rString,
- const Color** ppColor, SvNumberFormatter& rFormatter, const ScDocument* pDoc, bool bNullVals = true,
+ const Color** ppColor, SvNumberFormatter& rFormatter, const ScDocument& rDoc, bool bNullVals = true,
bool bFormula = false, bool bUseStarFormat = false );
static OUString GetString(
diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index 630eaec251bc..aeefac9978fe 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -498,7 +498,7 @@ public:
// uses ObjectShell from document, if set (returns NULL otherwise)
static css::uno::Reference<css::table::XCellRange>
- CreateRangeFromDoc( const ScDocument* pDoc, const ScRange& rR );
+ CreateRangeFromDoc( const ScDocument& rDoc, const ScRange& rR );
virtual css::uno::Any SAL_CALL queryInterface(
const css::uno::Type & rType ) override;
diff --git a/sc/inc/charthelper.hxx b/sc/inc/charthelper.hxx
index 9af57b1db22c..3b0c6857cdf7 100644
--- a/sc/inc/charthelper.hxx
+++ b/sc/inc/charthelper.hxx
@@ -36,7 +36,7 @@ typedef ::std::vector< ScRangeList > ScRangeListVector;
class ScChartHelper
{
public:
- static sal_uInt16 DoUpdateAllCharts( ScDocument* pDoc );
+ static sal_uInt16 DoUpdateAllCharts( ScDocument& rDoc );
static void AdjustRangesOfChartsOnDestinationPage( const ScDocument& rSrcDoc, ScDocument& rDestDoc, const SCTAB nSrcTab, const SCTAB nDestTab );
static void UpdateChartsOnDestinationPage( ScDocument& rDestDoc, const SCTAB nDestTab );
static css::uno::Reference< css::chart2::XChartDocument > GetChartFromSdrObject( const SdrObject* pObject );
diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index b061aa7f2ddf..9fb9a3f87077 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -220,7 +220,7 @@ protected:
ScChangeAction( ScChangeActionType, const ScBigRange&, const sal_uLong nAction);
OUString GetRefString(
- const ScBigRange& rRange, const ScDocument* pDoc, bool bFlag3D = false) const;
+ const ScBigRange& rRange, const ScDocument& rDoc, bool bFlag3D = false) const;
void SetActionNumber( sal_uLong n ) { nAction = n; }
void SetRejectAction( sal_uLong n ) { nRejectAction = n; }
@@ -268,7 +268,7 @@ protected:
sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz );
void Accept();
- virtual bool Reject(ScDocument* pDoc) = 0;
+ virtual bool Reject(ScDocument& rDoc) = 0;
void RejectRestoreContents( ScChangeTrack*, SCCOL nDx, SCROW nDy );
// used in Reject() instead of IsRejectable()
@@ -338,11 +338,11 @@ public:
// with bSplitRange only one column/row will be considered for delete
// (for a listing of entries)
virtual void GetDescription(
- OUString& rStr, ScDocument* pDoc,
+ OUString& rStr, ScDocument& rDoc,
bool bSplitRange = false, bool bWarning = true ) const;
virtual void GetRefString(
- OUString& rStr, ScDocument* pDoc, bool bFlag3D = false ) const;
+ OUString& rStr, ScDocument& rDoc, bool bFlag3D = false ) const;
// for DocumentMerge set old date of the other
// action, fetched by GetDateTimeUTC
@@ -375,7 +375,7 @@ class SAL_DLLPUBLIC_RTTI ScChangeActionIns : public ScChangeAction
virtual void AddContent( ScChangeActionContent* ) override {}
virtual void DeleteCellEntries() override {}
- virtual bool Reject(ScDocument* pDoc) override;
+ virtual bool Reject(ScDocument& rDoc) override;
virtual const ScChangeTrack* GetChangeTrack() const override { return nullptr; }
@@ -393,7 +393,7 @@ public:
bool bEndOfList = false );
virtual void GetDescription(
- OUString& rStr, ScDocument* pDoc, bool bSplitRange = false, bool bWarning = true) const override;
+ OUString& rStr, ScDocument& rDoc, bool bSplitRange = false, bool bWarning = true) const override;
SC_DLLPUBLIC bool IsEndOfList() const;
};
@@ -452,7 +452,7 @@ class ScChangeActionDel final : public ScChangeAction
UpdateRefMode, const ScBigRange&,
sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz ) override;
- virtual bool Reject(ScDocument* pDoc) override;
+ virtual bool Reject(ScDocument& rDoc) override;
virtual const ScChangeTrack* GetChangeTrack() const override { return pTrack; }
@@ -488,7 +488,7 @@ public:
short GetCutOffCount() const { return nCutOff; }
virtual void GetDescription(
- OUString& rStr, ScDocument* pDoc, bool bSplitRange = false, bool bWarning = true ) const override;
+ OUString& rStr, ScDocument& rDoc, bool bSplitRange = false, bool bWarning = true ) const override;
void SetCutOffInsert( ScChangeActionIns* p, short n )
{ pCutOff = p; nCutOff = n; } // only to use in the XML import
@@ -537,7 +537,7 @@ class ScChangeActionMove final : public ScChangeAction
UpdateRefMode, const ScBigRange&,
sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz ) override;
- virtual bool Reject(ScDocument* pDoc) override;
+ virtual bool Reject(ScDocument& rDoc) override;
virtual const ScChangeTrack* GetChangeTrack() const override { return pTrack; }
@@ -559,11 +559,11 @@ public:
SC_DLLPUBLIC void GetDelta( sal_Int32& nDx, sal_Int32& nDy, sal_Int32& nDz ) const;
virtual void GetDescription(
- OUString& rStr, ScDocument* pDoc, bool bSplitRange = false,
+ OUString& rStr, ScDocument& rDoc, bool bSplitRange = false,
bool bWarning = true ) const override;
virtual void GetRefString(
- OUString& rStr, ScDocument* pDoc, bool bFlag3D = false ) const override;
+ OUString& rStr, ScDocument& rDoc, bool bFlag3D = false ) const override;
};
ScChangeActionDelMoveEntry::ScChangeActionDelMoveEntry(
@@ -669,13 +669,13 @@ class SAL_DLLPUBLIC_RTTI ScChangeActionContent : public ScChangeAction
UpdateRefMode, const ScBigRange&,
sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz ) override;
- virtual bool Reject(ScDocument* pDoc) override;
+ virtual bool Reject(ScDocument& rDoc) override;
virtual const ScChangeTrack* GetChangeTrack() const override { return nullptr; }
// pRejectActions!=NULL: reject actions get
// stacked, no SetNewValue, no Append
- bool Select( ScDocument*, ScChangeTrack*,
+ bool Select( ScDocument&, ScChangeTrack*,
bool bOldest, ::std::stack<ScChangeActionContent*>* pRejectActions );
void PutValueToDoc(
@@ -746,10 +746,10 @@ public:
const ScCellValue& GetOldCell() const { return maOldCell;}
const ScCellValue& GetNewCell() const { return maNewCell;}
virtual void GetDescription(
- OUString& rStr, ScDocument* pDoc, bool bSplitRange = false, bool bWarning = true ) const override;
+ OUString& rStr, ScDocument& rDoc, bool bSplitRange = false, bool bWarning = true ) const override;
virtual void GetRefString(
- OUString& rStr, ScDocument* pDoc, bool bFlag3D = false ) const override;
+ OUString& rStr, ScDocument& rDoc, bool bFlag3D = false ) const override;
static ScChangeActionContentCellType GetContentCellType( const ScCellValue& rCell );
static ScChangeActionContentCellType GetContentCellType( const ScRefCellValue& rIter );
@@ -769,7 +769,7 @@ class ScChangeActionReject final : public ScChangeAction
virtual void AddContent( ScChangeActionContent* ) override {}
virtual void DeleteCellEntries() override {}
- virtual bool Reject(ScDocument* pDoc) override;
+ virtual bool Reject(ScDocument& rDoc) override;
virtual const ScChangeTrack* GetChangeTrack() const override { return nullptr; }
@@ -821,10 +821,10 @@ enum ScChangeTrackMergeState
class SAL_DLLPUBLIC_RTTI ScChangeTrack : public utl::ConfigurationListener
{
friend void ScChangeAction::RejectRestoreContents( ScChangeTrack*, SCCOL, SCROW );
- friend bool ScChangeActionDel::Reject( ScDocument* pDoc );
+ friend bool ScChangeActionDel::Reject( ScDocument& pDoc );
friend void ScChangeActionDel::DeleteCellEntries();
friend void ScChangeActionMove::DeleteCellEntries();
- friend bool ScChangeActionMove::Reject( ScDocument* pDoc );
+ friend bool ScChangeActionMove::Reject( ScDocument& pDoc );
SCROW mnContentRowsPerSlot;
SCSIZE mnContentSlots;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index a614eb21643e..62315b51429f 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1664,7 +1664,7 @@ public:
void TransliterateText( const ScMarkData& rMultiMark, TransliterationFlags nType );
- SC_DLLPUBLIC void InitUndo( const ScDocument* pSrcDoc, SCTAB nTab1, SCTAB nTab2,
+ SC_DLLPUBLIC void InitUndo( const ScDocument& rSrcDoc, SCTAB nTab1, SCTAB nTab2,
bool bColInfo = false, bool bRowInfo = false );
void AddUndoTab( SCTAB nTab1, SCTAB nTab2,
bool bColInfo = false, bool bRowInfo = false );
diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx
index 2dd8f60ecb9a..8eee7a1588c8 100644
--- a/sc/inc/externalrefmgr.hxx
+++ b/sc/inc/externalrefmgr.hxx
@@ -392,7 +392,7 @@ public:
class SC_DLLPUBLIC ApiGuard
{
public:
- ApiGuard(const ScDocument* pDoc);
+ ApiGuard(const ScDocument& rDoc);
~ApiGuard();
private:
ScExternalRefManager* mpMgr;
@@ -431,7 +431,7 @@ public:
};
public:
- explicit ScExternalRefManager(ScDocument* pDoc);
+ explicit ScExternalRefManager(ScDocument& rDoc);
virtual ~ScExternalRefManager() override;
virtual OUString getCacheTableName(sal_uInt16 nFileId, size_t nTabIndex) const override;
@@ -721,7 +721,7 @@ private:
bool getSrcDocTable( const ScDocument& rSrcDoc, const OUString& rTabName, SCTAB& rTab, sal_uInt16 nFileId ) const;
ScExternalRefCache::TokenRef getSingleRefTokenFromSrcDoc(
- sal_uInt16 nFileId, ScDocument* pSrcDoc, const ScAddress& rPos,
+ sal_uInt16 nFileId, ScDocument& rSrcDoc, const ScAddress& rPos,
ScExternalRefCache::CellFormat* pFmt);
/**
@@ -789,7 +789,7 @@ private:
*/
void purgeStaleSrcDocument(sal_Int32 nTimeOut);
- sal_uInt32 getMappedNumberFormat(sal_uInt16 nFileId, sal_uInt32 nNumFmt, const ScDocument* pSrcDoc);
+ sal_uInt32 getMappedNumberFormat(sal_uInt16 nFileId, sal_uInt32 nNumFmt, const ScDocument& rSrcDoc);
/**
* If in maUnsavedDocShells move it to maDocShells and create a correct
@@ -800,7 +800,7 @@ private:
void transformUnsavedRefToSavedRef( SfxObjectShell* pShell );
private:
- ScDocument* mpDoc;
+ ScDocument& mrDoc;
/** cache of referenced ranges and names from source documents. */
ScExternalRefCache maRefCache;
diff --git a/sc/inc/macromgr.hxx b/sc/inc/macromgr.hxx
index 5904a1ce564f..f8e905957692 100644
--- a/sc/inc/macromgr.hxx
+++ b/sc/inc/macromgr.hxx
@@ -25,7 +25,7 @@ class ScUserMacroDepTracker;
class ScMacroManager
{
public:
- explicit ScMacroManager(ScDocument* pDoc);
+ explicit ScMacroManager(ScDocument& rDoc);
~ScMacroManager();
SC_DLLPUBLIC void InitUserFuncData();
@@ -42,7 +42,7 @@ private:
css::uno::Reference< css::container::XContainerListener > mxContainerListener;
::std::unique_ptr<ScUserMacroDepTracker> mpDepTracker;
- ScDocument* mpDoc;
+ ScDocument& mrDoc;
};
#endif
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 37e32930848d..ba235b6b7e66 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -2903,7 +2903,7 @@ void ScExportTest::testTrackChangesSimpleXLSX()
ScChangeAction* pAction = pCT->GetAction(1);
CPPUNIT_ASSERT(pAction);
OUString aDesc;
- pAction->GetDescription(aDesc, pDoc);
+ pAction->GetDescription(aDesc, *pDoc);
CPPUNIT_ASSERT_EQUAL(OUString("Cell B2 changed from '<empty>' to '1'"), aDesc);
bGood = aTest.checkRevisionUserAndTime(*pDoc, aOwnerName);
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index b3faa7fce4ff..be42ed93ff42 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -333,7 +333,7 @@ void Test::testSharedStringPoolUndoDoc()
m_pDoc->SetString(ScAddress(0,3,0), "A3");
ScDocument aUndoDoc(SCDOCMODE_UNDO);
- aUndoDoc.InitUndo(m_pDoc, 0, 0);
+ aUndoDoc.InitUndo(*m_pDoc, 0, 0);
bool bSuccess = aTest.check(*m_pDoc, aUndoDoc);
CPPUNIT_ASSERT_MESSAGE("Check failed with undo document.", bSuccess);
@@ -3381,7 +3381,7 @@ void Test::testCopyPaste()
aRange = ScRange(0,1,1,2,1,1);//target: Sheet2.A2:C2
ScDocumentUniquePtr pUndoDoc(new ScDocument(SCDOCMODE_UNDO));
- pUndoDoc->InitUndo(m_pDoc, 1, 1, true, true);
+ pUndoDoc->InitUndo(*m_pDoc, 1, 1, true, true);
std::unique_ptr<ScUndoPaste> pUndo(createUndoPaste(getDocShell(), aRange, std::move(pUndoDoc)));
ScMarkData aMark(m_pDoc->GetSheetLimits());
aMark.SetMarkArea(aRange);
@@ -3774,7 +3774,7 @@ void Test::testCopyPasteSkipEmpty()
// Create undo document.
ScDocumentUniquePtr pUndoDoc(new ScDocument(SCDOCMODE_UNDO));
- pUndoDoc->InitUndo(m_pDoc, 0, 0);
+ pUndoDoc->InitUndo(*m_pDoc, 0, 0);
m_pDoc->CopyToDocument(aDestRange, InsertDeleteFlags::ALL, false, *pUndoDoc, &aMark);
// Paste clipboard content onto A1:A5 but skip empty cells.
@@ -3782,7 +3782,7 @@ void Test::testCopyPasteSkipEmpty()
// Create redo document.
ScDocumentUniquePtr pRedoDoc(new ScDocument(SCDOCMODE_UNDO));
- pRedoDoc->InitUndo(m_pDoc, 0, 0);
+ pRedoDoc->InitUndo(*m_pDoc, 0, 0);
m_pDoc->CopyToDocument(aDestRange, InsertDeleteFlags::ALL, false, *pRedoDoc, &aMark);
// Create an undo object for this.
@@ -3886,7 +3886,7 @@ void Test::testCutPasteRefUndo()
// Set up undo document for reference update.
ScDocumentUniquePtr pUndoDoc(new ScDocument(SCDOCMODE_UNDO));
- pUndoDoc->InitUndo(m_pDoc, 0, 0);
+ pUndoDoc->InitUndo(*m_pDoc, 0, 0);
// Do the pasting of 12 into C2. This should update A2 to reference C2.
m_pDoc->CopyFromClip(ScAddress(2,1,0), aMark, InsertDeleteFlags::CONTENTS, pUndoDoc.get(), &aClipDoc);
@@ -4081,7 +4081,7 @@ void Test::testUndoCut()
// Set up an undo object for cutting A1:A3.
ScDocumentUniquePtr pUndoDoc(new ScDocument(SCDOCMODE_UNDO));
- pUndoDoc->InitUndo(m_pDoc, 0 ,0);
+ pUndoDoc->InitUndo(*m_pDoc, 0 ,0);
m_pDoc->CopyToDocument(aRange, InsertDeleteFlags::ALL, false, *pUndoDoc);
ASSERT_DOUBLES_EQUAL( 1.0, pUndoDoc->GetValue(ScAddress(0,0,0)));
ASSERT_DOUBLES_EQUAL( 10.0, pUndoDoc->GetValue(ScAddress(0,1,0)));
@@ -6023,7 +6023,7 @@ void Test::testDeleteContents()
aMark.SetMarkArea(aRange);
ScDocumentUniquePtr pUndoDoc(new ScDocument(SCDOCMODE_UNDO));
- pUndoDoc->InitUndo(m_pDoc, 0, 0);
+ pUndoDoc->InitUndo(*m_pDoc, 0, 0);
m_pDoc->CopyToDocument(aRange, InsertDeleteFlags::CONTENTS, false, *pUndoDoc, &aMark);
ScUndoDeleteContents aUndo(&getDocShell(), aMark, aRange, std::move(pUndoDoc), false, InsertDeleteFlags::CONTENTS, true);
diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index 118377c970e6..212723a26d61 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -67,7 +67,7 @@ void Test::testCopyPasteSkipEmptyConditionalFormatting()
// Create undo document.
ScDocument* pUndoDoc = new ScDocument(SCDOCMODE_UNDO);
- pUndoDoc->InitUndo(m_pDoc, 0, 0);
+ pUndoDoc->InitUndo(*m_pDoc, 0, 0);
m_pDoc->CopyToDocument(aDestRange, InsertDeleteFlags::CONTENTS, false, *pUndoDoc, &aMark);
// Paste clipboard content onto A1:A5 but skip empty cells.
diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx
index 2d80c37b0054..c965a71196a7 100644
--- a/sc/qa/unit/ucalc_sharedformula.cxx
+++ b/sc/qa/unit/ucalc_sharedformula.cxx
@@ -1312,7 +1312,7 @@ void Test::testSharedFormulasCopyPaste()
ScRange aRange(1,0,0,1,9,0); // B1:B10
ScDocument* pUndoDoc = new ScDocument(SCDOCMODE_UNDO);
- pUndoDoc->InitUndo(m_pDoc, 0, 0, true, true);
+ pUndoDoc->InitUndo(*m_pDoc, 0, 0, true, true);
m_pDoc->CopyToDocument(aRange, InsertDeleteFlags::CONTENTS, false, *pUndoDoc);
std::unique_ptr<ScUndoPaste> pUndo(createUndoPaste(getDocShell(), aRange, ScDocumentUniquePtr(pUndoDoc)));
@@ -2271,7 +2271,7 @@ void Test::testSharedFormulaUpdateOnReplacement()
aMark.SelectOneTable(0);
aMark.SetMultiMarkArea(aUndoRange);
ScDocumentUniquePtr pUndoDoc(new ScDocument(SCDOCMODE_UNDO));
- pUndoDoc->InitUndo(m_pDoc, 0, 0);
+ pUndoDoc->InitUndo(*m_pDoc, 0, 0);
m_pDoc->CopyToDocument(aUndoRange, InsertDeleteFlags::CONTENTS, false, *pUndoDoc, &aMark);
ScUndoDeleteContents aUndo(&getDocShell(), aMark, aUndoRange, std::move(pUndoDoc), false, InsertDeleteFlags::CONTENTS, true);
diff --git a/sc/source/core/data/bigrange.cxx b/sc/source/core/data/bigrange.cxx
index 14cc64556309..58a11eb03735 100644
--- a/sc/source/core/data/bigrange.cxx
+++ b/sc/source/core/data/bigrange.cxx
@@ -10,14 +10,14 @@
#include <bigrange.hxx>
#include <document.hxx>
-bool ScBigAddress::IsValid( const ScDocument* pDoc ) const
+bool ScBigAddress::IsValid( const ScDocument& rDoc ) const
{ // min/max interval bounds define whole col/row/tab
return
- ((0 <= nCol && nCol <= pDoc->MaxCol())
+ ((0 <= nCol && nCol <= rDoc.MaxCol())
|| nCol == nInt32Min || nCol == nInt32Max) &&
- ((0 <= nRow && nRow <= pDoc->MaxRow())
+ ((0 <= nRow && nRow <= rDoc.MaxRow())
|| nRow == nInt32Min || nRow == nInt32Max) &&
- ((0 <= nTab && nTab < pDoc->GetTableCount())
+ ((0 <= nTab && nTab < rDoc.GetTableCount())
|| nTab == nInt32Min || nTab == nInt32Max)
;
}
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index ce221435a30a..013d6d444093 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -285,7 +285,7 @@ long ScColumn::GetNeededSize(
const Color* pColor;
OUString aValStr;
ScCellFormat::GetString(
- aCell, nFormat, aValStr, &pColor, *pFormatter, &rDocument, true, rOptions.bFormula);
+ aCell, nFormat, aValStr, &pColor, *pFormatter, rDocument, true, rOptions.bFormula);
if (!aValStr.isEmpty())
{
@@ -462,7 +462,7 @@ long ScColumn::GetNeededSize(
const Color* pColor;
OUString aString;
ScCellFormat::GetString(
- aCell, nFormat, aString, &pColor, *pFormatter, &rDocument, true,
+ aCell, nFormat, aString, &pColor, *pFormatter, rDocument, true,
rOptions.bFormula);
if (!aString.isEmpty())
@@ -616,7 +616,7 @@ class MaxStrLenFinder
const Color* pColor;
OUString aValStr;
ScCellFormat::GetString(
- rCell, mnFormat, aValStr, &pColor, *mrDoc.GetFormatTable(), &mrDoc);
+ rCell, mnFormat, aValStr, &pColor, *mrDoc.GetFormatTable(), mrDoc);
if (aValStr.getLength() > mnMaxLen)
{
@@ -704,7 +704,7 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
{
ScRefCellValue aCell = GetCellValue(pParam->mnMaxTextRow);
ScCellFormat::GetString(
- aCell, nFormat, aLongStr, &pColor, *pFormatter, &rDocument);
+ aCell, nFormat, aLongStr, &pColor, *pFormatter, rDocument);
}
else
{
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 5501ae479d97..4142683c199c 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -791,7 +791,7 @@ bool ScColumn::UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, sc::CellSt
OUString aStr;
const Color* pColor;
sal_uInt32 nFormat = pPattern->GetNumberFormat(pFormatter, pCondSet);
- ScCellFormat::GetString(aCell, nFormat, aStr, &pColor, *pFormatter, &rDocument);
+ ScCellFormat::GetString(aCell, nFormat, aStr, &pColor, *pFormatter, rDocument);
// Store the real script type to the array.
rAttr.mnScriptType = rDocument.GetStringScriptType(aStr);
@@ -2919,7 +2919,7 @@ void ScColumn::GetString( const ScRefCellValue& aCell, SCROW nRow, OUString& rSt
sal_uInt32 nFormat = GetNumberFormat( pContext ? *pContext : GetDoc().GetNonThreadedContext(), nRow);
const Color* pColor = nullptr;
ScCellFormat::GetString(aCell, nFormat, rString, &pColor,
- pContext ? *(pContext->GetFormatTable()) : *(GetDoc().GetFormatTable()), &GetDoc());
+ pContext ? *(pContext->GetFormatTable()) : *(GetDoc().GetFormatTable()), GetDoc());
}
double* ScColumn::GetValueCell( SCROW nRow )
@@ -3146,7 +3146,7 @@ class MaxStringLenHandler
const Color* pColor;
OUString aString;
sal_uInt32 nFormat = mrColumn.GetAttr(nRow, ATTR_VALUE_FORMAT).GetValue();
- ScCellFormat::GetString(rCell, nFormat, aString, &pColor, *mpFormatter, &mrColumn.GetDoc());
+ ScCellFormat::GetString(rCell, nFormat, aString, &pColor, *mpFormatter, mrColumn.GetDoc());
sal_Int32 nLen = 0;
if (mbOctetEncoding)
{
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index bd919be1d9e9..a33c3d4b9175 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -1018,7 +1018,7 @@ private:
OUString aStr;
const Color* pColor;
sal_uInt32 nFormat = pPat->GetNumberFormat(mpFormatter, pCondSet);
- ScCellFormat::GetString(rCell, nFormat, aStr, &pColor, *mpFormatter, &mrCol.GetDoc());
+ ScCellFormat::GetString(rCell, nFormat, aStr, &pColor, *mpFormatter, mrCol.GetDoc());
rAttr.mnScriptType = mrCol.GetDoc().GetStringScriptType(aStr);
mbUpdated = true;
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index a21837999732..7274dd77b2d0 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1343,7 +1343,7 @@ void ScDocument::GetCellChangeTrackNote( const ScAddress &aCellPos, OUString &aT
aTrackText += aComStr;
aTrackText += "\n( ";
}
- pFound->GetDescription( aTrackText, this );
+ pFound->GetDescription( aTrackText, *this );
if (!aComStr.isEmpty())
{
aTrackText += ")";
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 69c93b30e221..727eff32345c 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -605,7 +605,7 @@ ScExternalRefManager* ScDocument::GetExternalRefManager() const
{
ScDocument* pThis = const_cast<ScDocument*>(this);
if (!pExternalRefMgr)
- pThis->pExternalRefMgr.reset( new ScExternalRefManager( pThis));
+ pThis->pExternalRefMgr.reset( new ScExternalRefManager(*pThis));
return pExternalRefMgr.get();
}
diff --git a/sc/source/core/data/documen6.cxx b/sc/source/core/data/documen6.cxx
index e1b15bff8ad5..a4b58131e29b 100644
--- a/sc/source/core/data/documen6.cxx
+++ b/sc/source/core/data/documen6.cxx
@@ -118,7 +118,7 @@ SvtScriptType ScDocument::GetCellScriptType( const ScAddress& rPos, sal_uInt32 n
const Color* pColor;
OUString aStr;
if( pCell )
- ScCellFormat::GetString(*pCell, nNumberFormat, aStr, &pColor, *mxPoolHelper->GetFormTable(), this);
+ ScCellFormat::GetString(*pCell, nNumberFormat, aStr, &pColor, *mxPoolHelper->GetFormTable(), *this);
else
aStr = ScCellFormat::GetString(*this, rPos, nNumberFormat, &pColor, *mxPoolHelper->GetFormTable());
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 7efb5a8f978d..0cef7c94acae 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -228,7 +228,7 @@ void ScDocument::ModifyStyleSheet( SfxStyleSheetBase& rStyleSheet,
{
const SfxPoolItem *pItem = nullptr;
if( rChanges.GetItemState(ATTR_WRITINGDIR, true, &pItem ) == SfxItemState::SET )
- ScChartHelper::DoUpdateAllCharts( this );
+ ScChartHelper::DoUpdateAllCharts( *this );
}
}
break;
@@ -377,7 +377,7 @@ EEHorizontalTextDirection ScDocument::GetEditTextDirection(SCTAB nTab) const
ScMacroManager* ScDocument::GetMacroManager()
{
if (!mpMacroMgr)
- mpMacroMgr.reset(new ScMacroManager(this));
+ mpMacroMgr.reset(new ScMacroManager(*this));
return mpMacroMgr.get();
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 3baa8c292123..432673951492 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2007,7 +2007,7 @@ void ScDocument::InitUndoSelected(const ScDocument& rSrcDoc, const ScMarkData& r
}
}
-void ScDocument::InitUndo( const ScDocument* pSrcDoc, SCTAB nTab1, SCTAB nTab2,
+void ScDocument::InitUndo( const ScDocument& rSrcDoc, SCTAB nTab1, SCTAB nTab2,
bool bColInfo, bool bRowInfo )
{
if (!bIsUndo)
@@ -2019,10 +2019,10 @@ void ScDocument::InitUndo( const ScDocument* pSrcDoc, SCTAB nTab1, SCTAB nTab2,
Clear();
// Undo document shares its pooled resources with the source document.
- SharePooledResources(pSrcDoc);
+ SharePooledResources(&rSrcDoc);
- if (pSrcDoc->mpShell->GetMedium())
- maFileURL = pSrcDoc->mpShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
+ if (rSrcDoc.mpShell->GetMedium())
+ maFileURL = rSrcDoc.mpShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
if ( nTab2 >= static_cast<SCTAB>(maTabs.size()))
maTabs.resize(nTab2 + 1);
@@ -3262,7 +3262,7 @@ void ScDocument::FillTab( const ScRange& rSrcArea, const ScMarkData& rMark,
if (!pMixDoc)
{
pMixDoc.reset(new ScDocument(SCDOCMODE_UNDO));
- pMixDoc->InitUndo( this, i, i );
+ pMixDoc->InitUndo( *this, i, i );
}
else
pMixDoc->AddUndoTab( i, i );
@@ -3330,7 +3330,7 @@ void ScDocument::FillTabMarked( SCTAB nSrcTab, const ScMarkData& rMark,
if (!pMixDoc)
{
pMixDoc.reset(new ScDocument(SCDOCMODE_UNDO));
- pMixDoc->InitUndo( this, i, i );
+ pMixDoc->InitUndo( *this, i, i );
}
else
pMixDoc->AddUndoTab( i, i );
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index a18eae0c07d0..315bc9ca2a2a 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -31,7 +31,7 @@
#include <editutil.hxx>
void ScCellFormat::GetString( const ScRefCellValue& rCell, sal_uInt32 nFormat, OUString& rString,
- const Color** ppColor, SvNumberFormatter& rFormatter, const ScDocument* pDoc,
+ const Color** ppColor, SvNumberFormatter& rFormatter, const ScDocument& rDoc,
bool bNullVals, bool bFormula, bool bUseStarFormat )
{
*ppColor = nullptr;
@@ -42,7 +42,7 @@ void ScCellFormat::GetString( const ScRefCellValue& rCell, sal_uInt32 nFormat, O
rFormatter.GetOutputString(rCell.mpString->getString(), nFormat, rString, ppColor, bUseStarFormat);
break;
case CELLTYPE_EDIT:
- rFormatter.GetOutputString(rCell.getString(pDoc), nFormat, rString, ppColor );
+ rFormatter.GetOutputString(rCell.getString(&rDoc), nFormat, rString, ppColor );
break;
case CELLTYPE_VALUE:
{
@@ -113,7 +113,7 @@ OUString ScCellFormat::GetString(
*ppColor = nullptr;
ScRefCellValue aCell(rDoc, rPos);
- GetString(aCell, nFormat, aString, ppColor, rFormatter, &rDoc, bNullVals, bFormula);
+ GetString(aCell, nFormat, aString, ppColor, rFormatter, rDoc, bNullVals, bFormula);
return aString;
}
@@ -176,7 +176,7 @@ OUString ScCellFormat::GetOutputString( ScDocument& rDoc, const ScAddress& rPos,
// like in GetString for document (column)
const Color* pColor;
sal_uInt32 nNumFmt = rDoc.GetNumberFormat(rPos);
- GetString(rCell, nNumFmt, aVal, &pColor, *rDoc.GetFormatTable(), &rDoc);
+ GetString(rCell, nNumFmt, aVal, &pColor, *rDoc.GetFormatTable(), rDoc);
}
return aVal;
}
diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx
index 47af430a8ac6..54ace0282c44 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -40,9 +40,9 @@ using ::com::sun::star::uno::Reference;
namespace
{
-sal_uInt16 lcl_DoUpdateCharts( ScDocument* pDoc )
+sal_uInt16 lcl_DoUpdateCharts( ScDocument& rDoc )
{
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
if (!pModel)
return 0;
@@ -61,7 +61,7 @@ sal_uInt16 lcl_DoUpdateCharts( ScDocument* pDoc )
if ( pObject->GetObjIdentifier() == OBJ_OLE2 && ScDocument::IsChart( pObject ) )
{
OUString aName = static_cast<SdrOle2Obj*>(pObject)->GetPersistName();
- pDoc->UpdateChart( aName );
+ rDoc.UpdateChart( aName );
++nFound;
}
pObject = aIter.Next();
@@ -104,9 +104,9 @@ bool lcl_AdjustRanges( ScRangeList& rRanges, SCTAB nSourceTab, SCTAB nDestTab, S
// ScChartHelper
//static
-sal_uInt16 ScChartHelper::DoUpdateAllCharts( ScDocument* pDoc )
+sal_uInt16 ScChartHelper::DoUpdateAllCharts( ScDocument& rDoc )
{
- return lcl_DoUpdateCharts( pDoc );
+ return lcl_DoUpdateCharts( rDoc );
}
void ScChartHelper::AdjustRangesOfChartsOnDestinationPage( const ScDocument& rSrcDoc, ScDocument& rDestDoc, const SCTAB nSrcTab, const SCTAB nDestTab )
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 3818e5b74bee..06ad5357a0d9 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -425,7 +425,7 @@ void ScChangeAction::UpdateReference( const ScChangeTrack* /* pTrack */,
}
void ScChangeAction::GetDescription(
- OUString& rStr, ScDocument* /* pDoc */, bool /* bSplitRange */, bool bWarning ) const
+ OUString& rStr, ScDocument& /* rDoc */, bool /* bSplitRange */, bool bWarning ) const
{
if (!IsRejecting() || !bWarning)
return;
@@ -502,10 +502,10 @@ void ScChangeAction::GetDescription(
}
OUString ScChangeAction::GetRefString(
- const ScBigRange& rRange, const ScDocument* pDoc, bool bFlag3D ) const
+ const ScBigRange& rRange, const ScDocument& rDoc, bool bFlag3D ) const
{
OUStringBuffer aBuf;
- ScRefFlags nFlags = ( rRange.IsValid( pDoc ) ? ScRefFlags::VALID : ScRefFlags::ZERO );
+ ScRefFlags nFlags = ( rRange.IsValid( rDoc ) ? ScRefFlags::VALID : ScRefFlags::ZERO );
if ( nFlags == ScRefFlags::ZERO )
aBuf.append(ScCompiler::GetNativeSymbol(ocErrRef));
else
@@ -518,7 +518,7 @@ OUString ScChangeAction::GetRefString(
if ( bFlag3D )
{
OUString aTmp;
- pDoc->GetName( aTmpRange.aStart.Tab(), aTmp );
+ rDoc.GetName( aTmpRange.aStart.Tab(), aTmp );
aBuf.append(aTmp);
aBuf.append('.');
}
@@ -531,7 +531,7 @@ OUString ScChangeAction::GetRefString(
if ( bFlag3D )
{
OUString aTmp;
- pDoc->GetName( aTmpRange.aStart.Tab(), aTmp );
+ rDoc.GetName( aTmpRange.aStart.Tab(), aTmp );
aBuf.append(aTmp);
aBuf.append('.');
}
@@ -544,7 +544,7 @@ OUString ScChangeAction::GetRefString(
if ( bFlag3D || GetType() == SC_CAT_INSERT_TABS )
nFlags |= ScRefFlags::TAB_3D;
- aBuf.append(aTmpRange.Format(*pDoc, nFlags, pDoc->GetAddressConvention()));
+ aBuf.append(aTmpRange.Format(rDoc, nFlags, rDoc.GetAddressConvention()));
}
}
if ( (bFlag3D && IsDeleteType()) || IsDeletedIn() )
@@ -567,9 +567,9 @@ void ScChangeAction::SetComment( const OUString& rStr )
}
void ScChangeAction::GetRefString(
- OUString& rStr, ScDocument* pDoc, bool bFlag3D ) const
+ OUString& rStr, ScDocument& rDoc, bool bFlag3D ) const
{
- rStr = GetRefString( GetBigRange(), pDoc, bFlag3D );
+ rStr = GetRefString( GetBigRange(), rDoc, bFlag3D );
}
void ScChangeAction::Accept()
@@ -613,7 +613,7 @@ void ScChangeAction::RejectRestoreContents( ScChangeTrack* pTrack,
for (ScChangeActionContent* pContent : aContentsList)
{
if ( !pContent->IsDeletedIn() &&
- pContent->GetBigRange().aStart.IsValid( &rDoc ) )
+ pContent->GetBigRange().aStart.IsValid( rDoc ) )
pContent->PutNewValueToDoc( &rDoc, nDx, nDy );
}
DeleteCellEntries(); // Remove generated ones
@@ -692,9 +692,9 @@ ScChangeActionIns::~ScChangeActionIns()
}
void ScChangeActionIns::GetDescription(
- OUString& rStr, ScDocument* pDoc, bool bSplitRange, bool bWarning ) const
+ OUString& rStr, ScDocument& rDoc, bool bSplitRange, bool bWarning ) const
{
- ScChangeAction::GetDescription( rStr, pDoc, bSplitRange, bWarning );
+ ScChangeAction::GetDescription( rStr, rDoc, bSplitRange, bWarning );
const char* pWhatId;
switch ( GetType() )
@@ -717,7 +717,7 @@ void ScChangeActionIns::GetDescription(
// Construct a range string to replace '#1' first.
OUStringBuffer aBuf(ScResId(pWhatId));
aBuf.append(' ');
- aBuf.append(GetRefString(GetBigRange(), pDoc));
+ aBuf.append(GetRefString(GetBigRange(), rDoc));
OUString aRangeStr = aBuf.makeStringAndClear();
aRsc = aRsc.replaceAt(nPos, 2, aRangeStr); // replace '#1' with the range string.
@@ -731,26 +731,26 @@ bool ScChangeActionIns::IsEndOfList() const
return mbEndOfList;
}
-bool ScChangeActionIns::Reject( ScDocument* pDoc )
+bool ScChangeActionIns::Reject( ScDocument& rDoc )
{
- if ( !aBigRange.IsValid( pDoc ) )
+ if ( !aBigRange.IsValid( rDoc ) )
return false;
ScRange aRange( aBigRange.MakeRange() );
- if ( !pDoc->IsBlockEditable( aRange.aStart.Tab(), aRange.aStart.Col(),
+ if ( !rDoc.IsBlockEditable( aRange.aStart.Tab(), aRange.aStart.Col(),
aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row() ) )
return false;
switch ( GetType() )
{
case SC_CAT_INSERT_COLS :
- pDoc->DeleteCol( aRange );
+ rDoc.DeleteCol( aRange );
break;
case SC_CAT_INSERT_ROWS :
- pDoc->DeleteRow( aRange );
+ rDoc.DeleteRow( aRange );
break;
case SC_CAT_INSERT_TABS :
- pDoc->DeleteTab( aRange.aStart.Tab() );
+ rDoc.DeleteTab( aRange.aStart.Tab() );
break;
default:
{
@@ -928,9 +928,9 @@ ScBigRange ScChangeActionDel::GetOverAllRange() const
}
void ScChangeActionDel::GetDescription(
- OUString& rStr, ScDocument* pDoc, bool bSplitRange, bool bWarning ) const
+ OUString& rStr, ScDocument& rDoc, bool bSplitRange, bool bWarning ) const
{
- ScChangeAction::GetDescription( rStr, pDoc, bSplitRange, bWarning );
+ ScChangeAction::GetDescription( rStr, rDoc, bSplitRange, bWarning );
const char* pWhatId;
switch ( GetType() )
@@ -966,7 +966,7 @@ void ScChangeActionDel::GetDescription(
OUStringBuffer aBuf;
aBuf.append(ScResId(pWhatId));
aBuf.append(' ');
- aBuf.append(GetRefString(aTmpRange, pDoc));
+ aBuf.append(GetRefString(aTmpRange, rDoc));
OUString aRangeStr = aBuf.makeStringAndClear();
aRsc = aRsc.replaceAt(nPos, 2, aRangeStr); // replace '#1' with the string.
@@ -974,20 +974,20 @@ void ScChangeActionDel::GetDescription(
rStr = aBuf.makeStringAndClear(); // append to the original.
}
-bool ScChangeActionDel::Reject( ScDocument* pDoc )
+bool ScChangeActionDel::Reject( ScDocument& rDoc )
{
- if ( !aBigRange.IsValid( pDoc ) && GetType() != SC_CAT_DELETE_TABS )
+ if ( !aBigRange.IsValid( rDoc ) && GetType() != SC_CAT_DELETE_TABS )
return false;
if ( IsTopDelete() )
{ // Restore whole section in one go
bool bOk = true;
ScBigRange aTmpRange( GetOverAllRange() );
- if ( !aTmpRange.IsValid( pDoc ) )
+ if ( !aTmpRange.IsValid( rDoc ) )
{
if ( GetType() == SC_CAT_DELETE_TABS )
{ // Do we attach a Tab?
- if ( aTmpRange.aStart.Tab() > pDoc->GetMaxTableNumber() )
+ if ( aTmpRange.aStart.Tab() > rDoc.GetMaxTableNumber() )
bOk = false;
}
else
@@ -1004,20 +1004,20 @@ bool ScChangeActionDel::Reject( ScDocument* pDoc )
switch ( GetType() )
{
case SC_CAT_DELETE_COLS :
- if ( aRange.aStart.Col() != 0 || aRange.aEnd.Col() != pDoc->MaxCol() )
+ if ( aRange.aStart.Col() != 0 || aRange.aEnd.Col() != rDoc.MaxCol() )
{ // Only if not TabDelete
- bOk = pDoc->CanInsertCol( aRange ) && pDoc->InsertCol( aRange );
+ bOk = rDoc.CanInsertCol( aRange ) && rDoc.InsertCol( aRange );
}
break;
case SC_CAT_DELETE_ROWS :
- bOk = pDoc->CanInsertRow( aRange ) && pDoc->InsertRow( aRange );
+ bOk = rDoc.CanInsertRow( aRange ) && rDoc.InsertRow( aRange );
break;
case SC_CAT_DELETE_TABS :
{
//TODO: Remember table names?
OUString aName;
- pDoc->CreateValidTabName( aName );
- bOk = pDoc->ValidNewTabName( aName ) && pDoc->InsertTab( aRange.aStart.Tab(), aName );
+ rDoc.CreateValidTabName( aName );
+ bOk = rDoc.ValidNewTabName( aName ) && rDoc.InsertTab( aRange.aStart.Tab(), aName );
}
break;
default:
@@ -1174,15 +1174,15 @@ void ScChangeActionMove::GetDelta( sal_Int32& nDx, sal_Int32& nDy, sal_Int32& nD
}
void ScChangeActionMove::GetDescription(
- OUString& rStr, ScDocument* pDoc, bool bSplitRange, bool bWarning ) const
+ OUString& rStr, ScDocument& rDoc, bool bSplitRange, bool bWarning ) const
{
- ScChangeAction::GetDescription( rStr, pDoc, bSplitRange, bWarning );
+ ScChangeAction::GetDescription( rStr, rDoc, bSplitRange, bWarning );
bool bFlag3D = GetFromRange().aStart.Tab() != GetBigRange().aStart.Tab();
OUString aRsc = ScResId(STR_CHANGED_MOVE);
- OUString aTmpStr = ScChangeAction::GetRefString(GetFromRange(), pDoc, bFlag3D);
+ OUString aTmpStr = ScChangeAction::GetRefString(GetFromRange(), rDoc, bFlag3D);
sal_Int32 nPos = aRsc.indexOf("#1");
if (nPos >= 0)
{
@@ -1190,7 +1190,7 @@ void ScChangeActionMove::GetDescription(
nPos += aTmpStr.getLength();
}
- aTmpStr = ScChangeAction::GetRefString(GetBigRange(), pDoc, bFlag3D);
+ aTmpStr = ScChangeAction::GetRefString(GetBigRange(), rDoc, bFlag3D);
nPos = nPos >= 0 ? aRsc.indexOf("#2", nPos) : -1;
if (nPos >= 0)
{
@@ -1201,47 +1201,47 @@ void ScChangeActionMove::GetDescription(
}
void ScChangeActionMove::GetRefString(
- OUString& rStr, ScDocument* pDoc, bool bFlag3D ) const
+ OUString& rStr, ScDocument& rDoc, bool bFlag3D ) const
{
if ( !bFlag3D )
bFlag3D = ( GetFromRange().aStart.Tab() != GetBigRange().aStart.Tab() );
// overwrite existing string value.
- rStr = ScChangeAction::GetRefString(GetFromRange(), pDoc, bFlag3D)
+ rStr = ScChangeAction::GetRefString(GetFromRange(), rDoc, bFlag3D)
+ ", "
- + ScChangeAction::GetRefString(GetBigRange(), pDoc, bFlag3D);
+ + ScChangeAction::GetRefString(GetBigRange(), rDoc, bFlag3D);
}
-bool ScChangeActionMove::Reject( ScDocument* pDoc )
+bool ScChangeActionMove::Reject( ScDocument& rDoc )
{
- if ( !(aBigRange.IsValid( pDoc ) && aFromRange.IsValid( pDoc )) )
+ if ( !(aBigRange.IsValid( rDoc ) && aFromRange.IsValid( rDoc )) )
return false;
ScRange aToRange( aBigRange.MakeRange() );
ScRange aFrmRange( aFromRange.MakeRange() );
- bool bOk = pDoc->IsBlockEditable( aToRange.aStart.Tab(),
+ bool bOk = rDoc.IsBlockEditable( aToRange.aStart.Tab(),
aToRange.aStart.Col(), aToRange.aStart.Row(),
aToRange.aEnd.Col(), aToRange.aEnd.Row() );
if ( bOk )
- bOk = pDoc->IsBlockEditable( aFrmRange.aStart.Tab(),
+ bOk = rDoc.IsBlockEditable( aFrmRange.aStart.Tab(),
aFrmRange.aStart.Col(), aFrmRange.aStart.Row(),
aFrmRange.aEnd.Col(), aFrmRange.aEnd.Row() );
if ( !bOk )
return false;
- pTrack->LookUpContents( aToRange, pDoc, 0, 0, 0 ); // Contents to be moved
+ pTrack->LookUpContents( aToRange, &rDoc, 0, 0, 0 ); // Contents to be moved
- pDoc->DeleteAreaTab( aToRange, InsertDeleteFlags::ALL );
- pDoc->DeleteAreaTab( aFrmRange, InsertDeleteFlags::ALL );
+ rDoc.DeleteAreaTab( aToRange, InsertDeleteFlags::ALL );
+ rDoc.DeleteAreaTab( aFrmRange, InsertDeleteFlags::ALL );
// Adjust formula in the Document
- sc::RefUpdateContext aCxt(*pDoc);
+ sc::RefUpdateContext aCxt(rDoc);
aCxt.meMode = URM_MOVE;
aCxt.maRange = aFrmRange;
aCxt.mnColDelta = aFrmRange.aStart.Col() - aToRange.aStart.Col();
aCxt.mnRowDelta = aFrmRange.aStart.Row() - aToRange.aStart.Row();
aCxt.mnTabDelta = aFrmRange.aStart.Tab() - aToRange.aStart.Tab();
- pDoc->UpdateReference(aCxt);
+ rDoc.UpdateReference(aCxt);
// Free LinkDependent, set succeeding UpdateReference Undo
// ToRange->FromRange Dependents
@@ -1257,8 +1257,8 @@ bool ScChangeActionMove::Reject( ScDocument* pDoc )
{
ScChangeActionContent* pContent = static_cast<ScChangeActionContent*>(p);
if ( !pContent->IsDeletedIn() &&
- pContent->GetBigRange().aStart.IsValid( pDoc ) )
- pContent->PutNewValueToDoc( pDoc, 0, 0 );
+ pContent->GetBigRange().aStart.IsValid( rDoc ) )
+ pContent->PutNewValueToDoc( &rDoc, 0, 0 );
// Delete the ones created in LookUpContents
if ( pTrack->IsGenerated( pContent->GetActionNumber() ) &&
!pContent->IsDeletedIn() )
@@ -1431,14 +1431,14 @@ void ScChangeActionContent::GetNewString( OUString& rStr, const ScDocument* pDoc
}
void ScChangeActionContent::GetDescription(
- OUString& rStr, ScDocument* pDoc, bool bSplitRange, bool bWarning ) const
+ OUString& rStr, ScDocument& rDoc, bool bSplitRange, bool bWarning ) const
{
- ScChangeAction::GetDescription( rStr, pDoc, bSplitRange, bWarning );
+ ScChangeAction::GetDescription( rStr, rDoc, bSplitRange, bWarning );
OUString aRsc = ScResId(STR_CHANGED_CELL);
OUString aTmpStr;
- GetRefString(aTmpStr, pDoc);
+ GetRefString(aTmpStr, rDoc);
sal_Int32 nPos = aRsc.indexOf("#1", 0);
if (nPos >= 0)
@@ -1447,7 +1447,7 @@ void ScChangeActionContent::GetDescription(
nPos += aTmpStr.getLength();
}
- GetOldString( aTmpStr, pDoc );
+ GetOldString( aTmpStr, &rDoc );
if (aTmpStr.isEmpty())
aTmpStr = ScResId( STR_CHANGED_BLANK );
@@ -1458,7 +1458,7 @@ void ScChangeActionContent::GetDescription(
nPos += aTmpStr.getLength();
}
- GetNewString( aTmpStr, pDoc );
+ GetNewString( aTmpStr, &rDoc );
if (aTmpStr.isEmpty())
aTmpStr = ScResId( STR_CHANGED_BLANK );
@@ -1472,9 +1472,9 @@ void ScChangeActionContent::GetDescription(
}
void ScChangeActionContent::GetRefString(
- OUString& rStr, ScDocument* pDoc, bool bFlag3D ) const
+ OUString& rStr, ScDocument& rDoc, bool bFlag3D ) const
{
- ScRefFlags nFlags = ( GetBigRange().IsValid( pDoc ) ? ScRefFlags::VALID : ScRefFlags::ZERO );
+ ScRefFlags nFlags = ( GetBigRange().IsValid( rDoc ) ? ScRefFlags::VALID : ScRefFlags::ZERO );
if ( nFlags != ScRefFlags::ZERO )
{
const ScCellValue& rCell = GetNewCell();
@@ -1486,7 +1486,7 @@ void ScChangeActionContent::GetRefString(
rCell.mpFormula->GetMatColsRows( nC, nR );
aLocalBigRange.aEnd.IncCol( nC-1 );
aLocalBigRange.aEnd.IncRow( nR-1 );
- rStr = ScChangeAction::GetRefString( aLocalBigRange, pDoc, bFlag3D );
+ rStr = ScChangeAction::GetRefString( aLocalBigRange, rDoc, bFlag3D );
return ;
}
@@ -1494,7 +1494,7 @@ void ScChangeActionContent::GetRefString(
ScAddress aTmpAddress( GetBigRange().aStart.MakeAddress() );
if ( bFlag3D )
nFlags |= ScRefFlags::TAB_3D;
- rStr = aTmpAddress.Format(nFlags, pDoc, pDoc->GetAddressConvention());
+ rStr = aTmpAddress.Format(nFlags, &rDoc, rDoc.GetAddressConvention());
if ( IsDeletedIn() )
{
// Insert the parentheses.
@@ -1505,12 +1505,12 @@ void ScChangeActionContent::GetRefString(
rStr = ScCompiler::GetNativeSymbol(ocErrRef);
}
-bool ScChangeActionContent::Reject( ScDocument* pDoc )
+bool ScChangeActionContent::Reject( ScDocument& rDoc )
{
- if ( !aBigRange.IsValid( pDoc ) )
+ if ( !aBigRange.IsValid( rDoc ) )
return false;
- PutOldValueToDoc( pDoc, 0, 0 );
+ PutOldValueToDoc( &rDoc, 0, 0 );
SetState( SC_CAS_REJECTED );
RemoveAllLinks();
@@ -1518,10 +1518,10 @@ bool ScChangeActionContent::Reject( ScDocument* pDoc )
return true;
}
-bool ScChangeActionContent::Select( ScDocument* pDoc, ScChangeTrack* pTrack,
+bool ScChangeActionContent::Select( ScDocument& rDoc, ScChangeTrack* pTrack,
bool bOldest, ::std::stack<ScChangeActionContent*>* pRejectActions )
{
- if ( !aBigRange.IsValid( pDoc ) )
+ if ( !aBigRange.IsValid( rDoc ) )
return false;
ScChangeActionContent* pContent = this;
@@ -1555,13 +1555,13 @@ bool ScChangeActionContent::Select( ScDocument* pDoc, ScChangeTrack* pTrack,
ScChangeActionContent* pNew = new ScChangeActionContent( aRange );
ScCellValue aCell;
- aCell.assign(*pDoc, rPos);
- pNew->SetOldValue(aCell, pDoc, pDoc);
+ aCell.assign(rDoc, rPos);
+ pNew->SetOldValue(aCell, &rDoc, &rDoc);
if ( bOldest )
- PutOldValueToDoc( pDoc, 0, 0 );
+ PutOldValueToDoc( &rDoc, 0, 0 );
else
- PutNewValueToDoc( pDoc, 0, 0 );
+ PutNewValueToDoc( &rDoc, 0, 0 );
pNew->SetRejectAction( bOldest ? GetActionNumber() : pEnd->GetActionNumber() );
pNew->SetState( SC_CAS_ACCEPTED );
@@ -1569,8 +1569,8 @@ bool ScChangeActionContent::Select( ScDocument* pDoc, ScChangeTrack* pTrack,
pRejectActions->push( pNew );
else
{
- aCell.assign(*pDoc, rPos);
- pNew->SetNewValue(aCell, pDoc);
+ aCell.assign(rDoc, rPos);
+ pNew->SetNewValue(aCell, &rDoc);
pTrack->Append( pNew );
}
}
@@ -1979,7 +1979,7 @@ void ScChangeActionContent::UpdateReference( const ScChangeTrack* pTrack,
if ( bNewFormula )
maNewCell.mpFormula->UpdateReference(aRefCxt);
- if ( aBigRange.aStart.IsValid( &pTrack->GetDocument() ) )
+ if ( aBigRange.aStart.IsValid( pTrack->GetDocument() ) )
return;
//FIXME:
@@ -2031,7 +2031,7 @@ ScChangeActionReject::ScChangeActionReject(
{
}
-bool ScChangeActionReject::Reject(ScDocument* /*pDoc*/)
+bool ScChangeActionReject::Reject(ScDocument& /*rDoc*/)
{
return false;
}
@@ -4070,7 +4070,7 @@ bool ScChangeTrack::SelectContent( ScChangeAction* pAct, bool bOldest )
aBigRange.aEnd.IncRow( nR-1 );
}
- if ( !aBigRange.IsValid( &rDoc ) )
+ if ( !aBigRange.IsValid( rDoc ) )
return false;
ScRange aRange( aBigRange.MakeRange() );
@@ -4091,7 +4091,7 @@ bool ScChangeTrack::SelectContent( ScChangeAction* pAct, bool bOldest )
if ( p->GetType() == SC_CAT_CONTENT )
{
// we don't need no recursion here, do we?
- bOk &= static_cast<ScChangeActionContent*>(p)->Select( &rDoc, this,
+ bOk &= static_cast<ScChangeActionContent*>(p)->Select( rDoc, this,
bOldest, &aRejectActions );
}
else
@@ -4102,7 +4102,7 @@ bool ScChangeTrack::SelectContent( ScChangeAction* pAct, bool bOldest )
pL = pL->GetNext();
}
- bOk &= pContent->Select( &rDoc, this, bOldest, nullptr );
+ bOk &= pContent->Select( rDoc, this, bOldest, nullptr );
// now the matrix is inserted and new content values are ready
while ( !aRejectActions.empty() )
@@ -4118,7 +4118,7 @@ bool ScChangeTrack::SelectContent( ScChangeAction* pAct, bool bOldest )
return bOk;
}
else
- return pContent->Select( &rDoc, this, bOldest, nullptr );
+ return pContent->Select( rDoc, this, bOldest, nullptr );
}
void ScChangeTrack::AcceptAll()
@@ -4208,7 +4208,7 @@ bool ScChangeTrack::Reject(
}
if ( bOk )
{
- bRejected = pAct->Reject( &rDoc );
+ bRejected = pAct->Reject( rDoc );
if ( bRejected )
{
// pRefDoc NULL := Do not save deleted Cells
@@ -4227,7 +4227,7 @@ bool ScChangeTrack::Reject(
{
bTabDel = true;
aDelRange = pAct->GetBigRange();
- bTabDelOk = pAct->Reject( &rDoc );
+ bTabDelOk = pAct->Reject( rDoc );
bOk = bTabDelOk;
if ( bOk )
{
@@ -4241,7 +4241,7 @@ bool ScChangeTrack::Reject(
if ( bOk )
{
aDelRange = pDel->GetOverAllRange();
- bOk = aDelRange.IsValid( &rDoc );
+ bOk = aDelRange.IsValid( rDoc );
}
bool bOneOk = false;
if ( bOk )
@@ -4268,7 +4268,7 @@ bool ScChangeTrack::Reject(
do
{
pDel = static_cast<ScChangeActionDel*>(p);
- bOk = pDel->Reject( &rDoc );
+ bOk = pDel->Reject( rDoc );
if ( bOk )
{
if ( bOneOk )
@@ -4325,7 +4325,7 @@ bool ScChangeTrack::Reject(
}
if ( bOk )
{
- bRejected = pAct->Reject( &rDoc );
+ bRejected = pAct->Reject( rDoc );
if ( bRejected )
{
ScChangeActionMove* pReject = new ScChangeActionMove(
@@ -4351,7 +4351,7 @@ bool ScChangeTrack::Reject(
aCell.assign(rDoc, aRange.aStart);
pReject->SetOldValue(aCell, &rDoc, &rDoc);
}
- bRejected = pAct->Reject( &rDoc );
+ bRejected = pAct->Reject( rDoc );
if ( bRejected && !bRecursion )
{
ScCellValue aCell;
@@ -4700,7 +4700,7 @@ static void lcl_getTrackedChange(ScDocument& rDoc, int nIndex, const ScChangeAct
rRedlines.put("comment", pAction->GetComment());
OUString aDescription;
- pAction->GetDescription(aDescription, &rDoc, true);
+ pAction->GetDescription(aDescription, rDoc, true);
rRedlines.put("description", aDescription);
OUString sDateTime = utl::toISO8601(pAction->GetDateTimeUTC().GetUNODateTime());
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 8d08d1ba9516..0d39921474f8 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -2976,7 +2976,7 @@ void ScInterpreter::ScExternal()
PopSingleRef( aAdr );
ScRange aRange( aAdr );
uno::Reference<table::XCellRange> xObj =
- ScCellRangeObj::CreateRangeFromDoc( &mrDoc, aRange );
+ ScCellRangeObj::CreateRangeFromDoc( mrDoc, aRange );
if (xObj.is())
aParam <<= xObj;
else
@@ -2988,7 +2988,7 @@ void ScInterpreter::ScExternal()
ScRange aRange;
PopDoubleRef( aRange );
uno::Reference<table::XCellRange> xObj =
- ScCellRangeObj::CreateRangeFromDoc( &mrDoc, aRange );
+ ScCellRangeObj::CreateRangeFromDoc( mrDoc, aRange );
if (xObj.is())
{
aParam <<= xObj;
@@ -3139,17 +3139,17 @@ static uno::Any lcl_getSheetModule( const uno::Reference<table::XCellRange>& xCe
return uno::makeAny( xIf );
}
-static bool lcl_setVBARange( const ScRange& aRange, const ScDocument* pDok, SbxVariable* pPar )
+static bool lcl_setVBARange( const ScRange& aRange, const ScDocument& rDok, SbxVariable* pPar )
{
bool bOk = false;
try
{
uno::Reference< uno::XInterface > xVBARange;
- uno::Reference<table::XCellRange> xCellRange = ScCellRangeObj::CreateRangeFromDoc( pDok, aRange );
+ uno::Reference<table::XCellRange> xCellRange = ScCellRangeObj::CreateRangeFromDoc( rDok, aRange );
uno::Sequence< uno::Any > aArgs(2);
- aArgs[0] = lcl_getSheetModule( xCellRange, pDok );
+ aArgs[0] = lcl_getSheetModule( xCellRange, &rDok );
aArgs[1] <<= xCellRange;
- xVBARange = ooo::vba::createVBAUnoAPIServiceWithArgs( pDok->GetDocumentShell(), "ooo.vba.excel.Range", aArgs );
+ xVBARange = ooo::vba::createVBAUnoAPIServiceWithArgs( rDok.GetDocumentShell(), "ooo.vba.excel.Range", aArgs );
if ( xVBARange.is() )
{
SbxObjectRef aObj = GetSbUnoObject( "A-Range", uno::Any( xVBARange ) );
@@ -3303,7 +3303,7 @@ void ScInterpreter::ScMacro()
if ( bUseVBAObjects )
{
ScRange aRange( aAdr );
- bOk = lcl_setVBARange( aRange, &mrDoc, pPar );
+ bOk = lcl_setVBARange( aRange, mrDoc, pPar );
}
else
{
@@ -3330,7 +3330,7 @@ void ScInterpreter::ScMacro()
if ( bUseVBAObjects )
{
ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
- bOk = lcl_setVBARange( aRange, &mrDoc, pPar );
+ bOk = lcl_setVBARange( aRange, mrDoc, pPar );
}
else
{
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 10e6f85acb1e..6c6ec113873d 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -168,7 +168,7 @@ void lclInsertUrl( XclImpRoot& rRoot, const OUString& rUrl, SCCOL nScCol, SCROW
SvNumberFormatter* pFormatter = rDoc.getDoc().GetFormatTable();
const Color* pColor;
OUString aDisplText;
- ScCellFormat::GetString(aCell, nNumFmt, aDisplText, &pColor, *pFormatter, &rDoc.getDoc());
+ ScCellFormat::GetString(aCell, nNumFmt, aDisplText, &pColor, *pFormatter, rDoc.getDoc());
if (aDisplText.isEmpty())
aDisplText = rUrl;
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index ae3a8502653f..6122c9b6c45c 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -1139,7 +1139,7 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC
break;
[[fallthrough]];
default:
- ScCellFormat::GetString(aCell, nFormat, aStrOut, &pColor, *pFormatter, pDoc);
+ ScCellFormat::GetString(aCell, nFormat, aStrOut, &pColor, *pFormatter, *pDoc);
}
if ( !bFieldText )
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index ba6c017f4f3c..486ee3cf7d7d 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -371,7 +371,7 @@ void FormulaBuffer::finalizeImport()
ScDocumentImport& rDoc = getDocImport();
rDoc.getDoc().SetAutoNameCache(std::make_unique<ScAutoNameCache>(rDoc.getDoc()));
- ScExternalRefManager::ApiGuard aExtRefGuard(&rDoc.getDoc());
+ ScExternalRefManager::ApiGuard aExtRefGuard(rDoc.getDoc());
SCTAB nTabCount = rDoc.getDoc().GetTableCount();
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 695276add693..a8f88c493685 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1303,7 +1303,7 @@ OUString getOutputString( ScDocument* pDoc, const ScAddress& aCellPos )
const Color* pColor;
sal_uInt32 nNumFmt = pDoc->GetNumberFormat(aCellPos);
OUString aStr;
- ScCellFormat::GetString(aCell, nNumFmt, aStr, &pColor, *pDoc->GetFormatTable(), pDoc);
+ ScCellFormat::GetString(aCell, nNumFmt, aStr, &pColor, *pDoc->GetFormatTable(), *pDoc);
return aStr;
}
}
@@ -1355,7 +1355,7 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos )
OUString aText = maFormula->first;
- ScExternalRefManager::ApiGuard aExtRefGuard(pDoc);
+ ScExternalRefManager::ApiGuard aExtRefGuard(*pDoc);
if ( aText.isEmpty() )
return;
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index aa886af6b412..18d94fec4e11 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -221,7 +221,7 @@ OUString lcl_GetFormattedString(ScDocument* pDoc, const ScRefCellValue& rCell, c
SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
sal_uInt32 nFormat = pDoc->GetNumberFormat(rAddr);
- ScCellFormat::GetString(rCell, nFormat, aStr, &pColor, *pFormatter, pDoc);
+ ScCellFormat::GetString(rCell, nFormat, aStr, &pColor, *pFormatter, *pDoc);
return aStr;
}
case CELLTYPE_EDIT:
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 06196ffd0b34..7f272e131192 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1230,7 +1230,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
if ( pViewSh )
pViewSh->UpdateCharts( true );
else
- ScDBFunc::DoUpdateCharts( ScAddress(), pDoc, true );
+ ScDBFunc::DoUpdateCharts( ScAddress(), *pDoc, true );
if (pBindings)
pBindings->Invalidate( SID_ATTR_SIZE ); //SvxPosSize StatusControl Update
}
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 5de58eb6dd00..dae7c230aade 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -319,7 +319,7 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt
sal_uInt32 nNumFmt = pPattern->GetNumberFormat(pFormatter);
OUString aText;
const Color* pColor;
- ScCellFormat::GetString(aCell, nNumFmt, aText, &pColor, *pFormatter, m_pDoc.get());
+ ScCellFormat::GetString(aCell, nNumFmt, aText, &pColor, *pFormatter, *m_pDoc);
if (!aText.isEmpty())
aEngine.SetTextCurrentDefaults(aText);
}
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index ac742334ef57..ab8a3585e4d6 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -342,17 +342,17 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
{
if ( nNewEndX != nOldEndX || nNewEndY != nOldEndY ) // range changed?
{
- pUndoDoc->InitUndo( &rDoc, 0, rDoc.GetTableCount()-1 );
+ pUndoDoc->InitUndo( rDoc, 0, rDoc.GetTableCount()-1 );
rDoc.CopyToDocument(0, 0, 0, rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB,
InsertDeleteFlags::FORMULA, false, *pUndoDoc); // all formulas
}
else
- pUndoDoc->InitUndo( &rDoc, nDestTab, nDestTab ); // only destination table
+ pUndoDoc->InitUndo( rDoc, nDestTab, nDestTab ); // only destination table
rDoc.CopyToDocument(aOldRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, *pUndoDoc);
}
else // without insertion
{
- pUndoDoc->InitUndo( &rDoc, nDestTab, nDestTab ); // only destination table
+ pUndoDoc->InitUndo( rDoc, nDestTab, nDestTab ); // only destination table
rDoc.CopyToDocument(aMaxRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, *pUndoDoc);
}
}
@@ -413,7 +413,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
if ( bAddUndo && bUndo)
{
ScDocumentUniquePtr pRedoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pRedoDoc->InitUndo( &rDoc, nDestTab, nDestTab );
+ pRedoDoc->InitUndo( rDoc, nDestTab, nDestTab );
rDoc.CopyToDocument(aNewRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, *pRedoDoc);
m_pDocSh->GetUndoManager()->AddUndoAction(
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 4683ee74ea0e..4ead59d46fbc 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -359,7 +359,7 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bApi, bool bIsUnnamed,
pTable->GetColArray().GetRange( nOutStartCol, nOutEndCol );
pTable->GetRowArray().GetRange( nOutStartRow, nOutEndRow );
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true, true );
rDoc.CopyToDocument(static_cast<SCCOL>(nOutStartCol), 0,
nTab, static_cast<SCCOL>(nOutEndCol), rDoc.MaxRow(), nTab,
InsertDeleteFlags::NONE, false, *pUndoDoc);
@@ -368,7 +368,7 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bApi, bool bIsUnnamed,
InsertDeleteFlags::NONE, false, *pUndoDoc);
}
else
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, false, true );
// secure data range - incl. filtering result
rDoc.CopyToDocument(0, nStartRow, nTab, rDoc.MaxCol(), nEndRow, nTab, InsertDeleteFlags::ALL, false, *pUndoDoc);
@@ -755,7 +755,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
if (bCopy)
{
- pUndoDoc->InitUndo( &rDoc, nDestTab, nDestTab, false, true );
+ pUndoDoc->InitUndo( rDoc, nDestTab, nDestTab, false, true );
rDoc.CopyToDocument(aLocalParam.nCol1, aLocalParam.nRow1, nDestTab,
aLocalParam.nCol2, aLocalParam.nRow2, nDestTab,
InsertDeleteFlags::ALL, false, *pUndoDoc);
@@ -769,7 +769,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
}
else
{
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, false, true );
rDoc.CopyToDocument(0, rQueryParam.nRow1, nTab, rDoc.MaxCol(), rQueryParam.nRow2, nTab,
InsertDeleteFlags::NONE, false, *pUndoDoc);
}
@@ -798,7 +798,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
aAttribRange.aEnd.SetCol( aAttribRange.aEnd.Col() + nFormulaCols );
pAttribDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pAttribDoc->InitUndo( &rDoc, nDestTab, nDestTab, false, true );
+ pAttribDoc->InitUndo( rDoc, nDestTab, nDestTab, false, true );
rDoc.CopyToDocument(aAttribRange, InsertDeleteFlags::ATTRIB, false, *pAttribDoc);
}
@@ -1056,12 +1056,12 @@ void ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
pTable->GetColArray().GetRange( nOutStartCol, nOutEndCol );
pTable->GetRowArray().GetRange( nOutStartRow, nOutEndRow );
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true, true );
rDoc.CopyToDocument(static_cast<SCCOL>(nOutStartCol), 0, nTab, static_cast<SCCOL>(nOutEndCol), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
rDoc.CopyToDocument(0, nOutStartRow, nTab, rDoc.MaxCol(), nOutEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
}
else
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, bOldFilter );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, false, bOldFilter );
// secure data range - incl. filtering result
rDoc.CopyToDocument(0, rParam.nRow1+1,nTab, rDoc.MaxCol(),rParam.nRow2,nTab,
@@ -1183,12 +1183,12 @@ bool isEditable(ScDocShell& rDocShell, const ScRangeList& rRanges, bool bApi)
return true;
}
-void createUndoDoc(ScDocumentUniquePtr& pUndoDoc, ScDocument* pDoc, const ScRange& rRange)
+void createUndoDoc(ScDocumentUniquePtr& pUndoDoc, ScDocument& rDoc, const ScRange& rRange)
{
SCTAB nTab = rRange.aStart.Tab();
pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO));
- pUndoDoc->InitUndo(pDoc, nTab, nTab);
- pDoc->CopyToDocument(rRange, InsertDeleteFlags::ALL, false, *pUndoDoc);
+ pUndoDoc->InitUndo(rDoc, nTab, nTab);
+ rDoc.CopyToDocument(rRange, InsertDeleteFlags::ALL, false, *pUndoDoc);
}
bool checkNewOutputRange(ScDPObject& rDPObj, ScDocShell& rDocShell, ScRange& rNewOut, bool bApi)
@@ -1274,7 +1274,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
bRecord = false;
if (bRecord)
- createUndoDoc(pOldUndoDoc, &rDoc, pOldObj->GetOutRange());
+ createUndoDoc(pOldUndoDoc, rDoc, pOldObj->GetOutRange());
pNewObj->WriteSourceDataTo(*pOldObj); // copy source data
@@ -1319,7 +1319,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
}
if (bRecord)
- createUndoDoc(pNewUndoDoc, &rDoc, aNewOut);
+ createUndoDoc(pNewUndoDoc, rDoc, aNewOut);
pOldObj->Output(aNewOut.aStart);
rDocShell.PostPaintGridAll(); //! only necessary parts
@@ -1393,7 +1393,7 @@ bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
SCTAB nTab = aRange.aStart.Tab();
if (bRecord)
- createUndoDoc(pOldUndoDoc, &rDoc, aRange);
+ createUndoDoc(pOldUndoDoc, rDoc, aRange);
rDoc.DeleteAreaTab( aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(),
@@ -1513,7 +1513,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
}
if (bRecord)
- createUndoDoc(pNewUndoDoc, &rDoc, aNewOut);
+ createUndoDoc(pNewUndoDoc, rDoc, aNewOut);
rDestObj.Output(aNewOut.aStart);
rDocShell.PostPaintGridAll(); //! only necessary parts
@@ -1549,7 +1549,7 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
bRecord = false;
if (bRecord)
- createUndoDoc(pOldUndoDoc, &rDoc, rDPObj.GetOutRange());
+ createUndoDoc(pOldUndoDoc, rDoc, rDPObj.GetOutRange());
rDPObj.SetAllowMove(false);
rDPObj.ReloadGroupTableData();
@@ -1587,7 +1587,7 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
}
if (bRecord)
- createUndoDoc(pNewUndoDoc, &rDoc, aNewOut);
+ createUndoDoc(pNewUndoDoc, rDoc, aNewOut);
rDPObj.Output(aNewOut.aStart);
rDocShell.PostPaintGridAll(); //! only necessary parts
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index 6a460119289b..8a19581362aa 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -181,7 +181,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
// ImportDoc - also used for Redo
ScDocumentUniquePtr pImportDoc(new ScDocument( SCDOCMODE_UNDO ));
- pImportDoc->InitUndo( &rDoc, nTab, nTab );
+ pImportDoc->InitUndo( rDoc, nTab, nTab );
// get data from database into import document
@@ -466,7 +466,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
if ( bRecord )
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
pUndoDBData.reset(new ScDBData( *pDBData ));
}
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 3257e4744eff..826755bb9fa5 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -753,7 +753,7 @@ bool ScDocFunc::TransliterateText( const ScMarkData& rMark, TransliterationFlags
SCTAB nTabCount = rDoc.GetTableCount();
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nStartTab );
for (const auto& rTab : rMark)
{
if (rTab >= nTabCount)
@@ -1230,7 +1230,7 @@ bool ScDocFunc::SetCellText(
::std::unique_ptr<ScExternalRefManager::ApiGuard> pExtRefGuard;
if (bApi)
- pExtRefGuard.reset(new ScExternalRefManager::ApiGuard(&rDoc));
+ pExtRefGuard.reset(new ScExternalRefManager::ApiGuard(rDoc));
ScInputStringType aRes =
ScStringUtil::parseInputString(*rDoc.GetFormatTable(), rText, LANGUAGE_ENGLISH_US);
@@ -1437,7 +1437,7 @@ bool ScDocFunc::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& r
if ( bRecord )
{
ScDocumentUniquePtr pUndoDoc( new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, aMultiRange.aStart.Tab(), aMultiRange.aEnd.Tab() );
+ pUndoDoc->InitUndo( rDoc, aMultiRange.aStart.Tab(), aMultiRange.aEnd.Tab() );
rDoc.CopyToDocument(aMultiRange, InsertDeleteFlags::ATTRIB, bMulti, *pUndoDoc, &rMark);
rDocShell.GetUndoManager()->AddUndoAction(
@@ -1511,7 +1511,7 @@ bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
SCTAB nStartTab = aMultiRange.aStart.Tab();
SCTAB nTabCount = rDoc.GetTableCount();
- pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nStartTab );
for (const auto& rTab : rMark)
{
if (rTab >= nTabCount)
@@ -1901,7 +1901,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
if ( bRecord )
{
pRefUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pRefUndoDoc->InitUndo( &rDoc, 0, nTabCount-1 );
+ pRefUndoDoc->InitUndo( rDoc, 0, nTabCount-1 );
// pRefUndoDoc is filled in InsertCol / InsertRow
@@ -2032,7 +2032,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
if (bRecord && !pUndoRemoveMerge)
{
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, *aMark.begin(), *aMark.rbegin());
+ pUndoDoc->InitUndo( rDoc, *aMark.begin(), *aMark.rbegin());
pUndoRemoveMerge.reset( new ScUndoRemoveMerge( &rDocShell, rRange, std::move(pUndoDoc) ));
}
@@ -2519,7 +2519,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
if (bRecord && !pUndoRemoveMerge)
{
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, *aMark.begin(), *aMark.rbegin());
+ pUndoDoc->InitUndo( rDoc, *aMark.begin(), *aMark.rbegin());
pUndoRemoveMerge.reset( new ScUndoRemoveMerge( &rDocShell, rRange, std::move(pUndoDoc) ));
}
@@ -2560,7 +2560,7 @@ 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.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, 0, nTabCount-1, (eCmd==DelCellCmd::Cols), (eCmd==DelCellCmd::Rows) );
+ pUndoDoc->InitUndo( rDoc, 0, nTabCount-1, (eCmd==DelCellCmd::Cols), (eCmd==DelCellCmd::Rows) );
for (const auto& rTab : aMark)
{
if (rTab >= nTabCount)
@@ -2576,7 +2576,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
}
pRefUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pRefUndoDoc->InitUndo( &rDoc, 0, nTabCount-1 );
+ pRefUndoDoc->InitUndo( rDoc, 0, nTabCount-1 );
pUndoData.reset(new ScRefUndoData( &rDoc ));
@@ -2972,7 +2972,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
InsertDeleteFlags nUndoFlags = (InsertDeleteFlags::ALL & ~InsertDeleteFlags::OBJECTS) | InsertDeleteFlags::NOCAPTIONS;
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab, bWholeCols, bWholeRows );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nEndTab, bWholeCols, bWholeRows );
if (bCut)
{
@@ -3315,7 +3315,7 @@ bool ScDocFunc::DeleteTable( SCTAB nTab, bool bRecord )
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
SCTAB nCount = rDoc.GetTableCount();
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true ); // only nTab with Flags
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true, true ); // only nTab with Flags
pUndoDoc->AddUndoTab( 0, nCount-1 ); // all sheets for references
rDoc.CopyToDocument(0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, InsertDeleteFlags::ALL,false, *pUndoDoc );
@@ -3664,12 +3664,12 @@ bool ScDocFunc::SetWidthOrHeight(
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
if (bWidth)
{
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true );
rDoc.CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab, static_cast<SCCOL>(nEnd), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc );
}
else
{
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, false, true );
rDoc.CopyToDocument( 0, static_cast<SCROW>(nStart), nTab, rDoc.MaxCol(), static_cast<SCROW>(nEnd), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc );
}
@@ -4110,7 +4110,7 @@ void ScDocFunc::ClearItems( const ScMarkData& rMark, const sal_uInt16* pWhich, b
SCTAB nEndTab = aMarkRange.aEnd.Tab();
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nEndTab );
rDoc.CopyToDocument( aMarkRange, InsertDeleteFlags::ATTRIB, true, *pUndoDoc, &aMultiMark );
rDocShell.GetUndoManager()->AddUndoAction(
@@ -4148,7 +4148,7 @@ bool ScDocFunc::ChangeIndent( const ScMarkData& rMark, bool bIncrement, bool bAp
SCTAB nTabCount = rDoc.GetTableCount();
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nStartTab );
for (const auto& rTab : rMark)
{
if (rTab >= nTabCount)
@@ -4233,7 +4233,7 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
if ( bRecord )
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab, bSize, bSize );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nStartTab, bSize, bSize );
for (const auto& rTab : aMark)
{
if (rTab >= nTabCount)
@@ -4346,7 +4346,7 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
{
//! take selected sheets into account also when undoing
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nEndTab );
rDoc.CopyToDocument( rRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, *pUndoDoc );
}
@@ -4430,7 +4430,7 @@ bool ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
{
//! take selected sheets into account also when undoing
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nEndTab );
rDoc.CopyToDocument( rRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, *pUndoDoc );
rDocShell.GetUndoManager()->AddUndoAction(
@@ -4601,7 +4601,7 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
SCTAB nDestStartTab = aDestArea.aStart.Tab();
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nDestStartTab, nDestStartTab );
+ pUndoDoc->InitUndo( rDoc, nDestStartTab, nDestStartTab );
for (const auto& rTab : aMark)
{
if (rTab >= nTabCount)
@@ -4721,7 +4721,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
SCTAB nDestStartTab = aDestArea.aStart.Tab();
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nDestStartTab, nDestStartTab );
+ pUndoDoc->InitUndo( rDoc, nDestStartTab, nDestStartTab );
for (const auto& rTab : aMark)
{
if (rTab >= nTabCount)
@@ -4877,7 +4877,7 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e
SCTAB nDestStartTab = aDestArea.aStart.Tab();
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nDestStartTab, nDestStartTab );
+ pUndoDoc->InitUndo( rDoc, nDestStartTab, nDestStartTab );
for (const auto& rTab : aMark)
{
if (rTab >= nTabCount)
@@ -4987,7 +4987,7 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo
if (!pUndoDoc)
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo(&rDoc, nTab1, nTab2);
+ pUndoDoc->InitUndo(rDoc, nTab1, nTab2);
}
// note captions are collected by drawing undo
rDoc.CopyToDocument( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab,
@@ -5082,7 +5082,7 @@ bool ScDocFunc::UnmergeCells( const ScCellMergeOption& rOption, bool bRecord, Sc
if (!pUndoDoc)
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo(&rDoc, *rOption.maTabs.begin(), *rOption.maTabs.rbegin());
+ pUndoDoc->InitUndo(rDoc, *rOption.maTabs.begin(), *rOption.maTabs.rbegin());
}
rDoc.CopyToDocument(aExtended, InsertDeleteFlags::ATTRIB, false, *pUndoDoc);
}
@@ -5390,7 +5390,7 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
if (bRecord)
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
rDoc.CopyToDocument(nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
InsertDeleteFlags::ALL, false, *pUndoDoc);
@@ -5436,7 +5436,7 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
if (bRecord)
{
ScDocumentUniquePtr pRedoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pRedoDoc->InitUndo( &rDoc, nTab, nTab );
+ pRedoDoc->InitUndo( rDoc, nTab, nTab );
rDoc.CopyToDocument(nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
InsertDeleteFlags::ALL, false, *pRedoDoc);
@@ -5604,7 +5604,7 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, std::unique_ptr<
if(bUndo)
{
pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
if(pFormat)
{
@@ -5651,7 +5651,7 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, std::unique_ptr<
if(bUndo)
{
ScDocumentUniquePtr pRedoDoc(new ScDocument(SCDOCMODE_UNDO));
- pRedoDoc->InitUndo( &rDoc, nTab, nTab );
+ pRedoDoc->InitUndo( rDoc, nTab, nTab );
rDoc.CopyToDocument(aCompleteRange.aStart.Col(),aCompleteRange.aStart.Row(),nTab,
aCompleteRange.aEnd.Col(),aCompleteRange.aEnd.Row(),nTab,
InsertDeleteFlags::ALL, false, *pRedoDoc);
@@ -5678,7 +5678,7 @@ void ScDocFunc::SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB
if (bUndo)
{
pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
ScConditionalFormatList* pOld = rDoc.GetCondFormList(nTab);
@@ -5702,7 +5702,7 @@ void ScDocFunc::SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB
if(bUndo)
{
ScDocumentUniquePtr pRedoDoc(new ScDocument(SCDOCMODE_UNDO));
- pRedoDoc->InitUndo( &rDoc, nTab, nTab );
+ pRedoDoc->InitUndo( rDoc, nTab, nTab );
pRedoDoc->SetCondFormList(new ScConditionalFormatList(pRedoDoc.get(), *pList), nTab);
rDocShell.GetUndoManager()->AddUndoAction(
diff --git a/sc/source/ui/docshell/docfuncutil.cxx b/sc/source/ui/docshell/docfuncutil.cxx
index d65d5b696b7a..ce1a25d61878 100644
--- a/sc/source/ui/docshell/docfuncutil.cxx
+++ b/sc/source/ui/docshell/docfuncutil.cxx
@@ -50,7 +50,7 @@ ScDocumentUniquePtr DocFuncUtil::createDeleteContentsUndoDoc(
{
ScDocumentUniquePtr pUndoDoc(new ScDocument(SCDOCMODE_UNDO));
SCTAB nTab = rRange.aStart.Tab();
- pUndoDoc->InitUndo(&rDoc, nTab, nTab);
+ pUndoDoc->InitUndo(rDoc, nTab, nTab);
SCTAB nTabCount = rDoc.GetTableCount();
for (const auto& rTab : rMark)
if (rTab != nTab)
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 0a2be452cfe6..e1532db4a063 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2090,7 +2090,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
if ( bFixedWidth || bSaveAsShown )
{
const Color* pDummy;
- ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, &m_aDocument);
+ ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, m_aDocument);
bString = bSaveAsShown && rFormatter.IsTextFormat( nFormat);
}
else
@@ -2105,7 +2105,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
{
sal_uInt32 nFormat = m_aDocument.GetNumberFormat(aPos);
const Color* pDummy;
- ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, &m_aDocument);
+ ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, m_aDocument);
}
else
aString = pCell->mpFormula->GetString().getString();
@@ -2118,7 +2118,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
{
sal_uInt32 nFormat = m_aDocument.GetNumberFormat(aPos);
const Color* pDummy;
- ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, &m_aDocument);
+ ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, m_aDocument);
}
else
aString = pCell->mpString->getString();
@@ -2140,7 +2140,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
if ( bFixedWidth || bSaveAsShown )
{
const Color* pDummy;
- ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, &m_aDocument);
+ ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, m_aDocument);
bString = bSaveAsShown && rFormatter.IsTextFormat( nFormat);
}
else
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 074726c75e49..271d630094ae 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -732,9 +732,9 @@ static bool lcl_Equal( const ScChangeAction* pA, const ScChangeAction* pB, bool
// don't compare state if an old change has been accepted
}
-static bool lcl_FindAction( ScDocument* pDoc, const ScChangeAction* pAction, ScDocument* pSearchDoc, const ScChangeAction* pFirstSearchAction, const ScChangeAction* pLastSearchAction, bool bIgnore100Sec )
+static bool lcl_FindAction( ScDocument& rDoc, const ScChangeAction* pAction, ScDocument& rSearchDoc, const ScChangeAction* pFirstSearchAction, const ScChangeAction* pLastSearchAction, bool bIgnore100Sec )
{
- if ( !pDoc || !pAction || !pSearchDoc || !pFirstSearchAction || !pLastSearchAction )
+ if ( !pAction || !pFirstSearchAction || !pLastSearchAction )
{
return false;
}
@@ -751,9 +751,9 @@ static bool lcl_FindAction( ScDocument* pDoc, const ScChangeAction* pAction, ScD
pAction->GetBigRange() == pA->GetBigRange() )
{
OUString aActionDesc;
- pAction->GetDescription(aActionDesc, pDoc, true);
+ pAction->GetDescription(aActionDesc, rDoc, true);
OUString aADesc;
- pA->GetDescription(aADesc, pSearchDoc, true);
+ pA->GetDescription(aADesc, rSearchDoc, true);
if (aActionDesc == aADesc)
{
OSL_FAIL( "lcl_FindAction(): found equal action!" );
@@ -894,7 +894,7 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck
bool bMergeAction = false;
if ( bShared )
{
- if ( !bCheckDuplicates || !lcl_FindAction( &rOtherDoc, pSourceAction, &m_aDocument, pFirstSearchAction, pLastSearchAction, bIgnore100Sec ) )
+ if ( !bCheckDuplicates || !lcl_FindAction( rOtherDoc, pSourceAction, m_aDocument, pFirstSearchAction, pLastSearchAction, bIgnore100Sec ) )
{
bMergeAction = true;
}
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index fde5d60e5a10..cbdc901fa45c 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -577,7 +577,7 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
std::unique_ptr<ScOutlineTable> pUndoTab(pTable ? new ScOutlineTable( *pTable ) : nullptr);
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &m_aDocument, 0, nTabCount-1, false, true );
+ pUndoDoc->InitUndo( m_aDocument, 0, nTabCount-1, false, true );
// row state
m_aDocument.CopyToDocument(0, 0, nDestTab, m_aDocument.MaxCol(), m_aDocument.MaxRow(), nDestTab,
@@ -603,7 +603,7 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
else
{
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &m_aDocument, aDestArea.nTab, aDestArea.nTab );
+ pUndoDoc->InitUndo( m_aDocument, aDestArea.nTab, aDestArea.nTab );
m_aDocument.CopyToDocument(aDestArea.nColStart, aDestArea.nRowStart, aDestArea.nTab,
aDestArea.nColEnd, aDestArea.nRowEnd, aDestArea.nTab,
@@ -692,7 +692,7 @@ void ScDocShell::UseScenario( SCTAB nTab, const OUString& rName, bool bRecord )
if (bRecord)
{
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &m_aDocument, nTab,nEndTab ); // also all scenarios
+ pUndoDoc->InitUndo( m_aDocument, nTab,nEndTab ); // also all scenarios
// shown table:
m_aDocument.CopyToDocument(nStartCol, nStartRow, nTab,
nEndCol, nEndRow, nTab, InsertDeleteFlags::ALL,
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 3537b141a3d7..81e87dcb0a60 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -1473,7 +1473,7 @@ void ScExternalRefLink::SetDoRefresh(bool b)
mbDoRefresh = b;
}
-static FormulaToken* convertToToken( ScDocument* pHostDoc, const ScDocument* pSrcDoc, ScRefCellValue& rCell )
+static FormulaToken* convertToToken( ScDocument& rHostDoc, const ScDocument& rSrcDoc, ScRefCellValue& rCell )
{
if (rCell.hasEmptyValue())
{
@@ -1486,8 +1486,8 @@ static FormulaToken* convertToToken( ScDocument* pHostDoc, const ScDocument* pSr
case CELLTYPE_EDIT:
case CELLTYPE_STRING:
{
- OUString aStr = rCell.getString(pSrcDoc);
- svl::SharedString aSS = pHostDoc->GetSharedStringPool().intern(aStr);
+ OUString aStr = rCell.getString(&rSrcDoc);
+ svl::SharedString aSS = rHostDoc.GetSharedStringPool().intern(aStr);
return new formula::FormulaStringToken(aSS);
}
case CELLTYPE_VALUE:
@@ -1505,7 +1505,7 @@ static FormulaToken* convertToToken( ScDocument* pHostDoc, const ScDocument* pSr
}
else
{
- svl::SharedString aSS = pHostDoc->GetSharedStringPool().intern( pFCell->GetString().getString());
+ svl::SharedString aSS = rHostDoc.GetSharedStringPool().intern( pFCell->GetString().getString());
return new formula::FormulaStringToken(aSS);
}
}
@@ -1517,7 +1517,7 @@ static FormulaToken* convertToToken( ScDocument* pHostDoc, const ScDocument* pSr
}
static std::unique_ptr<ScTokenArray> convertToTokenArray(
- ScDocument* pHostDoc, const ScDocument& rSrcDoc, ScRange& rRange, vector<ScExternalRefCache::SingleRangeData>& rCacheData )
+ ScDocument& rHostDoc, const ScDocument& rSrcDoc, ScRange& rRange, vector<ScExternalRefCache::SingleRangeData>& rCacheData )
{
ScAddress& s = rRange.aStart;
ScAddress& e = rRange.aEnd;
@@ -1573,7 +1573,7 @@ static std::unique_ptr<ScTokenArray> convertToTokenArray(
xMat->GetDimensions( nMatCols, nMatRows);
if (nMatCols == nMatrixColumns && nMatRows == nMatrixRows)
{
- rSrcDoc.FillMatrix(*xMat, nTab, nCol1, nRow1, nCol2, nRow2, &pHostDoc->GetSharedStringPool());
+ rSrcDoc.FillMatrix(*xMat, nTab, nCol1, nRow1, nCol2, nRow2, &rHostDoc.GetSharedStringPool());
}
else if ((nCol1 == 0 && nCol2 == MAXCOL) || (nRow1 == 0 && nRow2 == MAXROW))
{
@@ -1585,7 +1585,7 @@ static std::unique_ptr<ScTokenArray> convertToTokenArray(
xMat = new ScMatrix( nMatrixColumns, nMatrixRows);
xMat->GetDimensions( nMatCols, nMatRows);
if (nMatCols == nMatrixColumns && nMatRows == nMatrixRows)
- rSrcDoc.FillMatrix(*xMat, nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2, &pHostDoc->GetSharedStringPool());
+ rSrcDoc.FillMatrix(*xMat, nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2, &rHostDoc.GetSharedStringPool());
}
}
@@ -1634,8 +1634,8 @@ bool isLinkUpdateAllowedInDoc(const ScDocument& rDoc)
}
}
-ScExternalRefManager::ScExternalRefManager(ScDocument* pDoc) :
- mpDoc(pDoc),
+ScExternalRefManager::ScExternalRefManager(ScDocument& rDoc) :
+ mrDoc(rDoc),
mbInReferenceMarking(false),
mbUserInteractionEnabled(true),
mbDocTimerEnabled(true)
@@ -1674,8 +1674,8 @@ ScExternalRefManager::LinkListener::~LinkListener()
{
}
-ScExternalRefManager::ApiGuard::ApiGuard(const ScDocument* pDoc) :
- mpMgr(pDoc->GetExternalRefManager()),
+ScExternalRefManager::ApiGuard::ApiGuard(const ScDocument& rDoc) :
+ mpMgr(rDoc.GetExternalRefManager()),
mbOldInteractionEnabled(mpMgr->mbUserInteractionEnabled)
{
// We don't want user interaction handled in the API.
@@ -1901,7 +1901,7 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
ScExternalRefCache::TokenRef pToken =
getSingleRefTokenFromSrcDoc(
- nFileId, pSrcDoc, ScAddress(rCell.Col(),rCell.Row(),nTab), pFmt);
+ nFileId, *pSrcDoc, ScAddress(rCell.Col(),rCell.Row(),nTab), pFmt);
putCellDataIntoCache(maRefCache, pToken, nFileId, rTabName, rCell, pFmt);
return pToken;
@@ -1923,7 +1923,7 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
if (!pSrcDoc)
{
// Source document not reachable.
- if (!isLinkUpdateAllowedInDoc(*mpDoc))
+ if (!isLinkUpdateAllowedInDoc(mrDoc))
{
// Indicate with specific error.
pToken.reset(new FormulaErrorToken(FormulaError::LinkFormulaNeedingCheck));
@@ -1965,7 +1965,7 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
}
pToken = getSingleRefTokenFromSrcDoc(
- nFileId, pSrcDoc, ScAddress(rCell.Col(),rCell.Row(),nTab), pFmt);
+ nFileId, *pSrcDoc, ScAddress(rCell.Col(),rCell.Row(),nTab), pFmt);
putCellDataIntoCache(maRefCache, pToken, nFileId, rTabName, rCell, pFmt);
return pToken;
@@ -2156,7 +2156,7 @@ void ScExternalRefManager::insertRefCell(sal_uInt16 nFileId, const ScAddress& rC
itr = r.first;
}
- insertRefCellByIterator(itr, mpDoc->GetFormulaCell(rCell));
+ insertRefCellByIterator(itr, mrDoc.GetFormulaCell(rCell));
}
void ScExternalRefManager::insertRefCellFromTemplate( ScFormulaCell* pTemplateCell, ScFormulaCell* pCell )
@@ -2173,7 +2173,7 @@ void ScExternalRefManager::insertRefCellFromTemplate( ScFormulaCell* pTemplateCe
bool ScExternalRefManager::hasCellExternalReference(const ScAddress& rCell)
{
- ScFormulaCell* pCell = mpDoc->GetFormulaCell(rCell);
+ ScFormulaCell* pCell = mrDoc.GetFormulaCell(rCell);
if (pCell)
return std::any_of(maRefCells.begin(), maRefCells.end(),
@@ -2207,7 +2207,7 @@ void ScExternalRefManager::fillCellFormat(sal_uLong nFmtIndex, ScExternalRefCach
if (!pFmt)
return;
- SvNumFormatType nFmtType = mpDoc->GetFormatTable()->GetType(nFmtIndex);
+ SvNumFormatType nFmtType = mrDoc.GetFormatTable()->GetType(nFmtIndex);
if (nFmtType != SvNumFormatType::UNDEFINED)
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list