sc/inc/unoreflist.hxx | 2 - sc/qa/unit/helper/qahelper.cxx | 2 - sc/qa/unit/ucalc_copypaste.cxx | 4 +- sc/source/ui/docshell/docfunc.cxx | 6 +-- sc/source/ui/inc/areasave.hxx | 8 ++-- sc/source/ui/inc/refundo.hxx | 6 +-- sc/source/ui/undo/areasave.cxx | 20 +++++------ sc/source/ui/undo/refundo.cxx | 62 ++++++++++++++++++------------------- sc/source/ui/undo/undobase.cxx | 4 +- sc/source/ui/undo/undoblk.cxx | 8 ++-- sc/source/ui/undo/undodat.cxx | 8 ++-- sc/source/ui/unoobj/unoreflist.cxx | 4 +- sc/source/ui/view/viewfun2.cxx | 2 - sc/source/ui/view/viewfun3.cxx | 2 - sc/source/ui/view/viewfunc.cxx | 2 - 15 files changed, 70 insertions(+), 70 deletions(-)
New commits: commit b046d0cfd4ef5c517b9e11c5fa4d659e65cd868e Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu May 22 12:29:19 2025 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu May 22 20:51:24 2025 +0200 ScRefUndoData: pass ScDocument by ref Change-Id: If389a4581933daccf6f4f5e9c6cda1a24e179d5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185656 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> Tested-by: Jenkins diff --git a/sc/inc/unoreflist.hxx b/sc/inc/unoreflist.hxx index fb045c943441..e75ca01e84a4 100644 --- a/sc/inc/unoreflist.hxx +++ b/sc/inc/unoreflist.hxx @@ -49,7 +49,7 @@ public: ~ScUnoRefList(); void Add( sal_Int64 nId, const ScRangeList& rOldRanges ); - void Undo( ScDocument* pDoc ); + void Undo( ScDocument& rDoc ); bool IsEmpty() const { return aEntries.empty(); } }; diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 4034ab23e188..54af6dbc4ded 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -811,7 +811,7 @@ ScUndoPaste* ScUcalcTestBase::createUndoPaste(ScDocShell& rDocSh, const ScRange& ScDocument& rDoc = rDocSh.GetDocument(); ScMarkData aMarkData(rDoc.GetSheetLimits()); aMarkData.SetMarkArea(rRange); - std::unique_ptr<ScRefUndoData> pRefUndoData(new ScRefUndoData(&rDoc)); + std::unique_ptr<ScRefUndoData> pRefUndoData(new ScRefUndoData(rDoc)); return new ScUndoPaste( &rDocSh, rRange, aMarkData, std::move(pUndoDoc), nullptr, InsertDeleteFlags::ALL, std::move(pRefUndoData), false); diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index 373a1c458266..dc6de60fee7a 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -175,7 +175,7 @@ void TestCopyPaste::prepareUndoBeforePaste(bool bCut, ScDocumentUniquePtr& pPast pPasteRefUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO)); pPasteRefUndoDoc->InitUndo(*m_pDoc, 0, nTabCount - 1); - pUndoData.reset(new ScRefUndoData(m_pDoc)); + pUndoData.reset(new ScRefUndoData(*m_pDoc)); } } @@ -9344,7 +9344,7 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, testCopyPasteSkipEmpty) m_pDoc->CopyToDocument(aDestRange, InsertDeleteFlags::ALL, false, *pRedoDoc, &aMark); // Create an undo object for this. - std::unique_ptr<ScRefUndoData> pRefUndoData(new ScRefUndoData(m_pDoc)); + std::unique_ptr<ScRefUndoData> pRefUndoData(new ScRefUndoData(*m_pDoc)); ScUndoPaste aUndo(m_xDocShell.get(), aDestRange, aMark, std::move(pUndoDoc), std::move(pRedoDoc), InsertDeleteFlags::ALL, std::move(pRefUndoData)); diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 62873862e11d..7df994d0de5b 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -1948,7 +1948,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, // pRefUndoDoc is filled in InsertCol / InsertRow - pUndoData.reset(new ScRefUndoData( &rDoc )); + pUndoData.reset(new ScRefUndoData( rDoc )); rDoc.BeginDrawUndo(); } @@ -2621,7 +2621,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, pRefUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO )); pRefUndoDoc->InitUndo( rDoc, 0, nTabCount-1 ); - pUndoData.reset(new ScRefUndoData( &rDoc )); + pUndoData.reset(new ScRefUndoData( rDoc )); rDoc.BeginDrawUndo(); } @@ -3394,7 +3394,7 @@ bool ScDocFunc::DeleteTable( SCTAB nTab, bool bRecord ) // Drawing-Layer has to take care of its own undo!!! rDoc.BeginDrawUndo(); // DeleteTab generates SdrUndoDelPage - pUndoData.reset(new ScRefUndoData( &rDoc )); + pUndoData.reset(new ScRefUndoData( rDoc )); } if (rDoc.DeleteTab(nTab)) diff --git a/sc/source/ui/inc/areasave.hxx b/sc/source/ui/inc/areasave.hxx index 0b317c6eed1f..1012df82ae48 100644 --- a/sc/source/ui/inc/areasave.hxx +++ b/sc/source/ui/inc/areasave.hxx @@ -44,7 +44,7 @@ public: bool IsEqualSource( const ScAreaLink& rCompare ) const; void WriteToLink( ScAreaLink& rLink ) const; - void InsertNewLink( ScDocument* pDoc ); + void InsertNewLink( ScDocument& rDoc ); }; class ScAreaLinkSaveCollection @@ -55,11 +55,11 @@ public: ScAreaLinkSaveCollection(); ~ScAreaLinkSaveCollection(); - bool IsEqual( const ScDocument* pDoc ) const; - void Restore( ScDocument* pDoc ); + bool IsEqual( ScDocument& rDoc ) const; + void Restore( ScDocument& rDoc ); // returns NULL if empty - static std::unique_ptr<ScAreaLinkSaveCollection> CreateFromDoc( const ScDocument* pDoc ); + static std::unique_ptr<ScAreaLinkSaveCollection> CreateFromDoc( ScDocument& rDoc ); ScAreaLinkSaver& operator[](size_t nIndex); const ScAreaLinkSaver& operator[](size_t nIndex) const; diff --git a/sc/source/ui/inc/refundo.hxx b/sc/source/ui/inc/refundo.hxx index bf0eb62e9161..9b6787222768 100644 --- a/sc/source/ui/inc/refundo.hxx +++ b/sc/source/ui/inc/refundo.hxx @@ -45,11 +45,11 @@ private: std::unique_ptr<ScUnoRefList> pUnoRefs; public: - ScRefUndoData( const ScDocument* pDoc ); + ScRefUndoData(ScDocument& rDoc ); ~ScRefUndoData(); - void DeleteUnchanged( const ScDocument* pDoc ); - void DoUndo( ScDocument* pDoc, bool bUndoRefFirst ); + void DeleteUnchanged(ScDocument& rDoc); + void DoUndo(ScDocument& rDoc, bool bUndoRefFirst ); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/undo/areasave.cxx b/sc/source/ui/undo/areasave.cxx index 374ae9c8a63a..8e7424f3ed6e 100644 --- a/sc/source/ui/undo/areasave.cxx +++ b/sc/source/ui/undo/areasave.cxx @@ -55,12 +55,12 @@ void ScAreaLinkSaver::WriteToLink( ScAreaLink& rLink ) const rLink.SetDestArea( aDestArea ); } -void ScAreaLinkSaver::InsertNewLink( ScDocument* pDoc ) +void ScAreaLinkSaver::InsertNewLink( ScDocument& rDoc ) { // (see ScUndoRemoveAreaLink::Undo) - sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager(); - ScDocShell* pObjSh = pDoc->GetDocumentShell(); + sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager(); + ScDocShell* pObjSh = rDoc.GetDocumentShell(); if ( pLinkManager && pObjSh ) { @@ -79,12 +79,12 @@ ScAreaLinkSaveCollection::ScAreaLinkSaveCollection() {} ScAreaLinkSaveCollection::~ScAreaLinkSaveCollection() {} -bool ScAreaLinkSaveCollection::IsEqual( const ScDocument* pDoc ) const +bool ScAreaLinkSaveCollection::IsEqual( ScDocument& rDoc ) const { // IsEqual can be checked in sequence. // Neither ref-update nor removing links will change the order. - const sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager(); + const sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager(); if (pLinkManager) { size_t nPos = 0; @@ -121,14 +121,14 @@ static ScAreaLink* lcl_FindLink( const ::sfx2::SvBaseLinks& rLinks, const ScArea return nullptr; // not found } -void ScAreaLinkSaveCollection::Restore( ScDocument* pDoc ) +void ScAreaLinkSaveCollection::Restore( ScDocument& rDoc ) { // The save collection may contain additional entries that are not in the document. // They must be inserted again. // Entries from the save collection must be searched via source data, as the order // of links changes if deleted entries are re-added to the link manager (always at the end). - sfx2::LinkManager* pLinkManager = pDoc->GetDocLinkManager().getLinkManager(false); + sfx2::LinkManager* pLinkManager = rDoc.GetDocLinkManager().getLinkManager(false); if (!pLinkManager) return; @@ -141,15 +141,15 @@ void ScAreaLinkSaveCollection::Restore( ScDocument* pDoc ) if ( pLink ) rSaver.WriteToLink( *pLink ); // restore output position else - rSaver.InsertNewLink( pDoc ); // re-insert deleted link + rSaver.InsertNewLink( rDoc ); // re-insert deleted link } } -std::unique_ptr<ScAreaLinkSaveCollection> ScAreaLinkSaveCollection::CreateFromDoc( const ScDocument* pDoc ) +std::unique_ptr<ScAreaLinkSaveCollection> ScAreaLinkSaveCollection::CreateFromDoc( ScDocument& rDoc ) { std::unique_ptr<ScAreaLinkSaveCollection> pColl; - sfx2::LinkManager* pLinkManager = const_cast<ScDocument*>(pDoc)->GetLinkManager(); + sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager(); if (pLinkManager) { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); diff --git a/sc/source/ui/undo/refundo.cxx b/sc/source/ui/undo/refundo.cxx index d87098720fd8..356d69167a84 100644 --- a/sc/source/ui/undo/refundo.cxx +++ b/sc/source/ui/undo/refundo.cxx @@ -30,34 +30,34 @@ #include <scopetools.hxx> #include <refupdatecontext.hxx> -ScRefUndoData::ScRefUndoData( const ScDocument* pDoc ) : - pPrintRanges(pDoc->CreatePrintRangeSaver()) +ScRefUndoData::ScRefUndoData( ScDocument& rDoc ) : + pPrintRanges(rDoc.CreatePrintRangeSaver()) { - const ScDBCollection* pOldDBColl = pDoc->GetDBCollection(); + const ScDBCollection* pOldDBColl = rDoc.GetDBCollection(); if (pOldDBColl && !pOldDBColl->empty()) pDBCollection.reset(new ScDBCollection(*pOldDBColl)); - const ScRangeName* pOldRanges = pDoc->GetRangeName(); + const ScRangeName* pOldRanges = rDoc.GetRangeName(); if (pOldRanges && !pOldRanges->empty()) pRangeName.reset(new ScRangeName(*pOldRanges)); // when handling Pivot solely keep the range? - const ScDPCollection* pOldDP = pDoc->GetDPCollection(); + const ScDPCollection* pOldDP = rDoc.GetDPCollection(); if (pOldDP && pOldDP->GetCount()) pDPCollection.reset(new ScDPCollection(*pOldDP)); - const ScDetOpList* pOldDetOp = pDoc->GetDetOpList(); + const ScDetOpList* pOldDetOp = rDoc.GetDetOpList(); if (pOldDetOp && pOldDetOp->Count()) pDetOpList.reset(new ScDetOpList(*pOldDetOp)); - const ScChartListenerCollection* pOldChartLisColl = pDoc->GetChartListenerCollection(); + const ScChartListenerCollection* pOldChartLisColl = rDoc.GetChartListenerCollection(); if (pOldChartLisColl) pChartListenerCollection.reset(new ScChartListenerCollection(*pOldChartLisColl)); - pAreaLinks = ScAreaLinkSaveCollection::CreateFromDoc(pDoc); // returns NULL if empty + pAreaLinks = ScAreaLinkSaveCollection::CreateFromDoc(rDoc); // returns NULL if empty - const_cast<ScDocument*>(pDoc)->BeginUnoRefUndo(); + rDoc.BeginUnoRefUndo(); } ScRefUndoData::~ScRefUndoData() @@ -71,38 +71,38 @@ ScRefUndoData::~ScRefUndoData() pAreaLinks.reset(); } -void ScRefUndoData::DeleteUnchanged( const ScDocument* pDoc ) +void ScRefUndoData::DeleteUnchanged( ScDocument& rDoc ) { if (pDBCollection) { - ScDBCollection* pNewDBColl = pDoc->GetDBCollection(); + ScDBCollection* pNewDBColl = rDoc.GetDBCollection(); if ( pNewDBColl && *pDBCollection == *pNewDBColl ) pDBCollection.reset(); } if (pRangeName) { - ScRangeName* pNewRanges = pDoc->GetRangeName(); + ScRangeName* pNewRanges = rDoc.GetRangeName(); if ( pNewRanges && *pRangeName == *pNewRanges ) pRangeName.reset(); } if (pPrintRanges) { - std::unique_ptr<ScPrintRangeSaver> pNewRanges = pDoc->CreatePrintRangeSaver(); + std::unique_ptr<ScPrintRangeSaver> pNewRanges = rDoc.CreatePrintRangeSaver(); if ( pNewRanges && *pPrintRanges == *pNewRanges ) pPrintRanges.reset(); } if (pDPCollection) { - ScDPCollection* pNewDP = const_cast<ScDocument*>(pDoc)->GetDPCollection(); //! const + ScDPCollection* pNewDP = rDoc.GetDPCollection(); //! const if ( pNewDP && pDPCollection->RefsEqual(*pNewDP) ) pDPCollection.reset(); } if (pDetOpList) { - ScDetOpList* pNewDetOp = pDoc->GetDetOpList(); + ScDetOpList* pNewDetOp = rDoc.GetDetOpList(); if ( pNewDetOp && *pDetOpList == *pNewDetOp ) pDetOpList.reset(); } @@ -110,7 +110,7 @@ void ScRefUndoData::DeleteUnchanged( const ScDocument* pDoc ) if ( pChartListenerCollection ) { ScChartListenerCollection* pNewChartListenerCollection = - pDoc->GetChartListenerCollection(); + rDoc.GetChartListenerCollection(); if ( pNewChartListenerCollection && *pChartListenerCollection == *pNewChartListenerCollection ) pChartListenerCollection.reset(); @@ -118,13 +118,13 @@ void ScRefUndoData::DeleteUnchanged( const ScDocument* pDoc ) if (pAreaLinks) { - if ( pAreaLinks->IsEqual( pDoc ) ) + if ( pAreaLinks->IsEqual( rDoc ) ) pAreaLinks.reset(); } - if ( pDoc->HasUnoRefUndo() ) + if ( rDoc.HasUnoRefUndo() ) { - pUnoRefs = const_cast<ScDocument*>(pDoc)->EndUnoRefUndo(); + pUnoRefs = rDoc.EndUnoRefUndo(); if ( pUnoRefs && pUnoRefs->IsEmpty() ) { pUnoRefs.reset(); @@ -132,45 +132,45 @@ void ScRefUndoData::DeleteUnchanged( const ScDocument* pDoc ) } } -void ScRefUndoData::DoUndo( ScDocument* pDoc, bool bUndoRefFirst ) +void ScRefUndoData::DoUndo( ScDocument& rDoc, bool bUndoRefFirst ) { if (pDBCollection) - pDoc->SetDBCollection( std::unique_ptr<ScDBCollection>(new ScDBCollection(*pDBCollection)) ); + rDoc.SetDBCollection( std::unique_ptr<ScDBCollection>(new ScDBCollection(*pDBCollection)) ); if (pRangeName) - pDoc->SetRangeName( std::unique_ptr<ScRangeName>(new ScRangeName(*pRangeName)) ); + rDoc.SetRangeName( std::unique_ptr<ScRangeName>(new ScRangeName(*pRangeName)) ); if (pPrintRanges) - pDoc->RestorePrintRanges(*pPrintRanges); + rDoc.RestorePrintRanges(*pPrintRanges); if (pDPCollection) { - ScDPCollection* pDocDP = pDoc->GetDPCollection(); + ScDPCollection* pDocDP = rDoc.GetDPCollection(); if (pDocDP) pDPCollection->WriteRefsTo( *pDocDP ); } if (pDetOpList) - pDoc->SetDetOpList( std::unique_ptr<ScDetOpList>(new ScDetOpList(*pDetOpList)) ); + rDoc.SetDetOpList( std::unique_ptr<ScDetOpList>(new ScDetOpList(*pDetOpList)) ); // bUndoRefFirst is bSetChartRangeLists if ( pChartListenerCollection ) - pDoc->SetChartListenerCollection( std::make_unique<ScChartListenerCollection>( + rDoc.SetChartListenerCollection( std::make_unique<ScChartListenerCollection>( *pChartListenerCollection ), bUndoRefFirst ); if (pDBCollection || pRangeName) { - sc::AutoCalcSwitch aACSwitch(*pDoc, false); - pDoc->CompileAll(); + sc::AutoCalcSwitch aACSwitch(rDoc, false); + rDoc.CompileAll(); sc::SetFormulaDirtyContext aCxt; - pDoc->SetAllFormulasDirty(aCxt); + rDoc.SetAllFormulasDirty(aCxt); } if (pAreaLinks) - pAreaLinks->Restore( pDoc ); + pAreaLinks->Restore( rDoc ); if ( pUnoRefs ) - pUnoRefs->Undo( pDoc ); + pUnoRefs->Undo( rDoc ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx index f939351fa19d..3a89bdded8f0 100644 --- a/sc/source/ui/undo/undobase.cxx +++ b/sc/source/ui/undo/undobase.cxx @@ -427,7 +427,7 @@ ScMoveUndo::ScMoveUndo( ScDocShell* pDocSh, ScDocumentUniquePtr pRefDoc, std::un { ScDocument& rDoc = pDocShell->GetDocument(); if (pRefUndoData) - pRefUndoData->DeleteUnchanged(&rDoc); + pRefUndoData->DeleteUnchanged(rDoc); pDrawUndo = GetSdrUndoAction( &rDoc ); } @@ -444,7 +444,7 @@ void ScMoveUndo::UndoRef() ScRange aRange(0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),pRefUndoDoc->GetTableCount()-1); pRefUndoDoc->CopyToDocument(aRange, InsertDeleteFlags::FORMULA, false, rDoc, nullptr, false); if (pRefUndoData) - pRefUndoData->DoUndo( &rDoc, false ); + pRefUndoData->DoUndo( rDoc, false ); } void ScMoveUndo::BeginUndo() diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index c1e944738b9a..9d2b767f50fe 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -926,7 +926,7 @@ ScUndoPaste::ScUndoPaste( ScDocShell* pNewDocShell, const ScRangeList& rRanges, bRedoFilled( bRedoIsFilled ) { if ( pRefUndoData ) - pRefUndoData->DeleteUnchanged( &pDocShell->GetDocument() ); + pRefUndoData->DeleteUnchanged( pDocShell->GetDocument() ); if ( pOptions ) aPasteOptions = *pOptions; // used only for Repeat @@ -970,7 +970,7 @@ void ScUndoPaste::DoChange(bool bUndo) // (with DeleteUnchanged after the DoUndo call) bool bCreateRedoData = ( bUndo && pRefUndoData && !pRefRedoData ); if ( bCreateRedoData ) - pRefRedoData.reset( new ScRefUndoData( &rDoc ) ); + pRefRedoData.reset( new ScRefUndoData( rDoc ) ); ScRefUndoData* pWorkRefData = bUndo ? pRefUndoData.get() : pRefRedoData.get(); @@ -1058,14 +1058,14 @@ void ScUndoPaste::DoChange(bool bUndo) if (pWorkRefData) { - pWorkRefData->DoUndo( &rDoc, true ); // true = bSetChartRangeLists for SetChartListenerCollection + pWorkRefData->DoUndo( rDoc, true ); // true = bSetChartRangeLists for SetChartListenerCollection if (!maBlockRanges.empty() && rDoc.RefreshAutoFilter(0, 0, rDoc.MaxCol(), rDoc.MaxRow(), maBlockRanges[0].aStart.Tab())) bPaintAll = true; } if ( bCreateRedoData && pRefRedoData ) - pRefRedoData->DeleteUnchanged( &rDoc ); + pRefRedoData->DeleteUnchanged( rDoc ); if (bUndo) // Undo: UndoToDocument after handling RefData { diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx index 340ef998e292..3baf60aaafaa 100644 --- a/sc/source/ui/undo/undodat.cxx +++ b/sc/source/ui/undo/undodat.cxx @@ -1820,7 +1820,7 @@ ScUndoDataForm::ScUndoDataForm( ScDocShell* pNewDocShell, mxMarkData->SetMarkArea(aBlockRange); // mark paste block if (xRefUndoData) - xRefUndoData->DeleteUnchanged(&pDocShell->GetDocument()); + xRefUndoData->DeleteUnchanged(pDocShell->GetDocument()); } OUString ScUndoDataForm::GetComment() const @@ -1865,7 +1865,7 @@ void ScUndoDataForm::DoChange( const bool bUndo ) // (with DeleteUnchanged after the DoUndo call) bool bCreateRedoData = (bUndo && xRefUndoData && !xRefRedoData); if (bCreateRedoData) - xRefRedoData.reset(new ScRefUndoData(&rDoc)); + xRefRedoData.reset(new ScRefUndoData(rDoc)); ScRefUndoData* pWorkRefData = bUndo ? xRefUndoData.get() : xRefRedoData.get(); @@ -1905,13 +1905,13 @@ void ScUndoDataForm::DoChange( const bool bUndo ) if (pWorkRefData) { - pWorkRefData->DoUndo( &rDoc, true ); // TRUE = bSetChartRangeLists for SetChartListenerCollection + pWorkRefData->DoUndo( rDoc, true ); // TRUE = bSetChartRangeLists for SetChartListenerCollection if ( rDoc.RefreshAutoFilter( 0,0, rDoc.MaxCol(),rDoc.MaxRow(), aBlockRange.aStart.Tab() ) ) bPaintAll = true; } if (bCreateRedoData && xRefRedoData) - xRefRedoData->DeleteUnchanged(&rDoc); + xRefRedoData->DeleteUnchanged(rDoc); if ( bUndo ) { diff --git a/sc/source/ui/unoobj/unoreflist.cxx b/sc/source/ui/unoobj/unoreflist.cxx index 101d0c9995fa..d8a68e2601ad 100644 --- a/sc/source/ui/unoobj/unoreflist.cxx +++ b/sc/source/ui/unoobj/unoreflist.cxx @@ -34,12 +34,12 @@ void ScUnoRefList::Add( sal_Int64 nId, const ScRangeList& rOldRanges ) aEntries.emplace_back( nId, rOldRanges ); } -void ScUnoRefList::Undo( ScDocument* pDoc ) +void ScUnoRefList::Undo( ScDocument& rDoc ) { for (const auto & entry: aEntries) { ScUnoRefUndoHint aHint(entry); - pDoc->BroadcastUno( aHint ); + rDoc.BroadcastUno( aHint ); } } diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 202fe6d23d53..2cefff43b28f 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -2623,7 +2623,7 @@ bool ScViewFunc::DeleteTables(const vector<SCTAB> &TheTabs, bool bRecord ) rDoc.BeginDrawUndo(); // DeleteTab creates a SdrUndoDelPage - pUndoData.reset(new ScRefUndoData( &rDoc )); + pUndoData.reset(new ScRefUndoData( rDoc )); } bool bDelDone = false; diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 2fd0bd881d3d..09e422e86f64 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -1276,7 +1276,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, pRefUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO )); pRefUndoDoc->InitUndo( rDoc, 0, nTabCount-1 ); - pUndoData.reset(new ScRefUndoData( &rDoc )); + pUndoData.reset(new ScRefUndoData( rDoc )); } } diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 45a18c7c171e..e9d764a0dde8 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -2115,7 +2115,7 @@ void ScViewFunc::DeleteMulti( bool bRows ) pUndoDoc->AddUndoTab( 0, nTabCount-1 ); rDoc.CopyToDocument( 0,0,0, rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB, InsertDeleteFlags::FORMULA,false,*pUndoDoc ); - pUndoData.reset(new ScRefUndoData( &rDoc )); + pUndoData.reset(new ScRefUndoData( rDoc )); rDoc.BeginDrawUndo(); }