From d9ee08d6fdc23cafa606bbbebd0b64a559fcf24c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 15 Sep 2020 14:21:37 +0100 Subject: ScFormulaCell ctor variant never called with null ScDocument* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit can be shown by readjusting ScXMLChangeTrackingImportHelper members to explicitly pass the target ScDocument around and identify there is no null case path possible Change-Id: I15a4eadfe4bfadf97365f9a15c6ec5572d77d578 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102869 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- sc/source/core/data/colorscale.cxx | 2 +- sc/source/core/data/column3.cxx | 4 +- sc/source/core/data/column4.cxx | 2 +- sc/source/core/data/documen2.cxx | 6 +- sc/source/core/data/documen4.cxx | 4 +- sc/source/core/data/documentimport.cxx | 32 ++--- sc/source/core/data/formulacell.cxx | 6 +- sc/source/core/data/table6.cxx | 2 +- sc/source/core/tool/chgtrack.cxx | 160 ++++++++++----------- sc/source/filter/oox/revisionfragment.cxx | 2 +- sc/source/filter/xcl97/XclImpChangeTrack.cxx | 2 +- .../filter/xml/XMLChangeTrackingImportHelper.cxx | 66 +++++---- .../filter/xml/XMLChangeTrackingImportHelper.hxx | 13 +- sc/source/filter/xml/xmlimprt.cxx | 2 +- .../StatisticsDialogs/AnalysisOfVarianceDialog.cxx | 2 +- .../ui/StatisticsDialogs/ChiSquareTestDialog.cxx | 2 +- .../DescriptiveStatisticsDialog.cxx | 2 +- .../ExponentialSmoothingDialog.cxx | 2 +- sc/source/ui/StatisticsDialogs/FTestDialog.cxx | 2 +- .../ui/StatisticsDialogs/FourierAnalysisDialog.cxx | 2 +- .../MatrixComparisonGenerator.cxx | 2 +- .../ui/StatisticsDialogs/MovingAverageDialog.cxx | 2 +- .../ui/StatisticsDialogs/RegressionDialog.cxx | 2 +- sc/source/ui/StatisticsDialogs/TTestDialog.cxx | 2 +- .../TableFillingAndNavigationTools.cxx | 10 +- sc/source/ui/StatisticsDialogs/ZTestDialog.cxx | 2 +- sc/source/ui/docshell/docfunc.cxx | 2 +- .../ui/inc/TableFillingAndNavigationTools.hxx | 4 +- sc/source/ui/unoobj/cellsuno.cxx | 2 +- sc/source/ui/view/viewfun2.cxx | 2 +- sc/source/ui/view/viewfunc.cxx | 2 +- 31 files changed, 172 insertions(+), 175 deletions(-) (limited to 'sc/source') diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index a9b047ae8274..16386a16370e 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -205,7 +205,7 @@ ScColorScaleEntry::~ScColorScaleEntry() COVERITY_NOEXCEPT_FALSE void ScColorScaleEntry::SetFormula( const OUString& rFormula, ScDocument& rDoc, const ScAddress& rAddr, formula::FormulaGrammar::Grammar eGrammar ) { - mpCell.reset(new ScFormulaCell( &rDoc, rAddr, rFormula, eGrammar )); + mpCell.reset(new ScFormulaCell( rDoc, rAddr, rFormula, eGrammar )); mpCell->StartListeningTo( rDoc ); mpListener.reset(new ScFormulaListener(mpCell.get())); if (mpFormat) diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index f01d82c1058a..b963b1040806 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2002,7 +2002,7 @@ bool ScColumn::ParseString( else // = Formula { ScFormulaCell* pFormulaCell = new ScFormulaCell( - &GetDoc(), ScAddress(nCol, nRow, nTabP), rString, + GetDoc(), ScAddress(nCol, nRow, nTabP), rString, formula::FormulaGrammar::mergeToGrammar(formula::FormulaGrammar::GRAM_DEFAULT, eConv), ScMatrixMode::NONE); if (aParam.mbCheckLinkFormula) @@ -2293,7 +2293,7 @@ void ScColumn::SetFormula( SCROW nRow, const OUString& rFormula, formula::Formul std::vector aNewSharedRows; sc::CellStoreType::iterator it = GetPositionToInsert(nRow, aNewSharedRows, true); - ScFormulaCell* pCell = new ScFormulaCell(&GetDoc(), aPos, rFormula, eGram); + ScFormulaCell* pCell = new ScFormulaCell(GetDoc(), aPos, rFormula, eGram); sal_uInt32 nCellFormat = GetNumberFormat(GetDoc().GetNonThreadedContext(), nRow); if( (nCellFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0) pCell->SetNeedNumberFormat(true); diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index 7d8ab951eb9e..3c7339573e89 100644 --- a/sc/source/core/data/column4.cxx +++ b/sc/source/core/data/column4.cxx @@ -2050,7 +2050,7 @@ void ScColumn::RestoreFromCache(SvStream& rStrm) OUString aStr = OStringToOUString(aOStr, RTL_TEXTENCODING_UTF8); for (sal_uInt64 i = 0; i < nFormulaGroupSize; ++i) { - aFormulaCells[nRow + i] = new ScFormulaCell(&rDocument, aAddr, aStr, eGrammar); + aFormulaCells[nRow + i] = new ScFormulaCell(rDocument, aAddr, aStr, eGrammar); aAddr.IncRow(); } diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 6015aa596b55..18c55028f082 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -261,7 +261,7 @@ sal_uInt32 ScDocument::GetDocumentID() const void ScDocument::StartChangeTracking() { if (!pChangeTrack) - pChangeTrack.reset( new ScChangeTrack( this ) ); + pChangeTrack.reset( new ScChangeTrack( *this ) ); } void ScDocument::EndChangeTracking() @@ -271,8 +271,8 @@ void ScDocument::EndChangeTracking() void ScDocument::SetChangeTrack( std::unique_ptr pTrack ) { - OSL_ENSURE( pTrack->GetDocument() == this, "SetChangeTrack: different documents" ); - if ( !pTrack || pTrack == pChangeTrack || pTrack->GetDocument() != this ) + OSL_ENSURE( &pTrack->GetDocument() == this, "SetChangeTrack: different documents" ); + if ( !pTrack || pTrack == pChangeTrack || &pTrack->GetDocument() != this ) return ; EndChangeTracking(); pChangeTrack = std::move(pTrack); diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index e3c8e55e0cd2..c7ba80d4ab31 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -281,7 +281,7 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1, if (pArr) pCell = new ScFormulaCell(this, aPos, *pArr, eGram, ScMatrixMode::Formula); else - pCell = new ScFormulaCell( this, aPos, rFormula, eGram, ScMatrixMode::Formula ); + pCell = new ScFormulaCell(*this, aPos, rFormula, eGram, ScMatrixMode::Formula); pCell->SetMatColsRows( nCol2 - nCol1 + 1, nRow2 - nRow1 + 1 ); SCTAB nMax = static_cast(maTabs.size()); for (const auto& rTab : rMark) @@ -434,7 +434,7 @@ void ScDocument::InsertTableOp(const ScTabOpParam& rParam, // multiple (repeate } aForString.append(ScCompiler::GetNativeSymbol( ocClose )); - ScFormulaCell aRefCell( this, ScAddress( nCol1, nRow1, nTab1 ), aForString.makeStringAndClear(), + ScFormulaCell aRefCell( *this, ScAddress( nCol1, nRow1, nTab1 ), aForString.makeStringAndClear(), formula::FormulaGrammar::GRAM_NATIVE, ScMatrixMode::NONE ); for( j = nCol1; j <= nCol2; j++ ) for( k = nRow1; k <= nRow2; k++ ) diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx index 3b6a1e5315bf..fb44fb958545 100644 --- a/sc/source/core/data/documentimport.cxx +++ b/sc/source/core/data/documentimport.cxx @@ -290,7 +290,7 @@ void ScDocumentImport::setFormulaCell( return; std::unique_ptr pFC = - std::make_unique(&mpImpl->mrDoc, rPos, rFormula, eGrammar); + std::make_unique(mpImpl->mrDoc, rPos, rFormula, eGrammar); mpImpl->mrDoc.CheckLinkFormulaNeedingCheck( *pFC->GetCode()); @@ -319,7 +319,7 @@ void ScDocumentImport::setFormulaCell( return; std::unique_ptr pFC = - std::make_unique(&mpImpl->mrDoc, rPos, rFormula, eGrammar); + std::make_unique(mpImpl->mrDoc, rPos, rFormula, eGrammar); mpImpl->mrDoc.CheckLinkFormulaNeedingCheck( *pFC->GetCode()); @@ -461,7 +461,7 @@ void ScDocumentImport::setTableOpCells(const ScRange& rRange, const ScTabOpParam if (!pTab) return; - ScDocument* pDoc = &mpImpl->mrDoc; + ScDocument& rDoc = mpImpl->mrDoc; ScRefAddress aRef; OUStringBuffer aFormulaBuf; aFormulaBuf.append('='); @@ -472,12 +472,12 @@ void ScDocumentImport::setTableOpCells(const ScRange& rRange, const ScTabOpParam if (rParam.meMode == ScTabOpParam::Column) // column only { aRef.Set(rParam.aRefFormulaCell.GetAddress(), true, false, false); - aFormulaBuf.append(aRef.GetRefString(pDoc, nTab)); + aFormulaBuf.append(aRef.GetRefString(&rDoc, nTab)); aFormulaBuf.append(aSep); - aFormulaBuf.append(rParam.aRefColCell.GetRefString(pDoc, nTab)); + aFormulaBuf.append(rParam.aRefColCell.GetRefString(&rDoc, nTab)); aFormulaBuf.append(aSep); aRef.Set(nCol1, nRow1, nTab, false, true, true); - aFormulaBuf.append(aRef.GetRefString(pDoc, nTab)); + aFormulaBuf.append(aRef.GetRefString(&rDoc, nTab)); nCol1++; nCol2 = std::min( nCol2, static_cast(rParam.aRefFormulaEnd.Col() - rParam.aRefFormulaCell.Col() + nCol1 + 1)); @@ -485,29 +485,29 @@ void ScDocumentImport::setTableOpCells(const ScRange& rRange, const ScTabOpParam else if (rParam.meMode == ScTabOpParam::Row) // row only { aRef.Set(rParam.aRefFormulaCell.GetAddress(), false, true, false); - aFormulaBuf.append(aRef.GetRefString(pDoc, nTab)); + aFormulaBuf.append(aRef.GetRefString(&rDoc, nTab)); aFormulaBuf.append(aSep); - aFormulaBuf.append(rParam.aRefRowCell.GetRefString(pDoc, nTab)); + aFormulaBuf.append(rParam.aRefRowCell.GetRefString(&rDoc, nTab)); aFormulaBuf.append(aSep); aRef.Set(nCol1, nRow1, nTab, true, false, true); - aFormulaBuf.append(aRef.GetRefString(pDoc, nTab)); + aFormulaBuf.append(aRef.GetRefString(&rDoc, nTab)); ++nRow1; nRow2 = std::min( nRow2, rParam.aRefFormulaEnd.Row() - rParam.aRefFormulaCell.Row() + nRow1 + 1); } else // both { - aFormulaBuf.append(rParam.aRefFormulaCell.GetRefString(pDoc, nTab)); + aFormulaBuf.append(rParam.aRefFormulaCell.GetRefString(&rDoc, nTab)); aFormulaBuf.append(aSep); - aFormulaBuf.append(rParam.aRefColCell.GetRefString(pDoc, nTab)); + aFormulaBuf.append(rParam.aRefColCell.GetRefString(&rDoc, nTab)); aFormulaBuf.append(aSep); aRef.Set(nCol1, nRow1 + 1, nTab, false, true, true); - aFormulaBuf.append(aRef.GetRefString(pDoc, nTab)); + aFormulaBuf.append(aRef.GetRefString(&rDoc, nTab)); aFormulaBuf.append(aSep); - aFormulaBuf.append(rParam.aRefRowCell.GetRefString(pDoc, nTab)); + aFormulaBuf.append(rParam.aRefRowCell.GetRefString(&rDoc, nTab)); aFormulaBuf.append(aSep); aRef.Set(nCol1 + 1, nRow1, nTab, true, false, true); - aFormulaBuf.append(aRef.GetRefString(pDoc, nTab)); + aFormulaBuf.append(aRef.GetRefString(&rDoc, nTab)); ++nCol1; ++nRow1; } @@ -515,7 +515,7 @@ void ScDocumentImport::setTableOpCells(const ScRange& rRange, const ScTabOpParam aFormulaBuf.append(ScCompiler::GetNativeSymbol(ocClose)); ScFormulaCell aRefCell( - pDoc, ScAddress(nCol1, nRow1, nTab), aFormulaBuf.makeStringAndClear(), + rDoc, ScAddress(nCol1, nRow1, nTab), aFormulaBuf.makeStringAndClear(), formula::FormulaGrammar::GRAM_NATIVE, ScMatrixMode::NONE); for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol) @@ -531,7 +531,7 @@ void ScDocumentImport::setTableOpCells(const ScRange& rRange, const ScTabOpParam for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow) { ScAddress aPos(nCol, nRow, nTab); - ScFormulaCell* pCell = new ScFormulaCell(aRefCell, *pDoc, aPos); + ScFormulaCell* pCell = new ScFormulaCell(aRefCell, rDoc, aPos); pBlockPos->miCellPos = rColCells.set(pBlockPos->miCellPos, nRow, pCell); } diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 5d3502c2dfcf..98ea70caac6a 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -632,7 +632,7 @@ ScFormulaCell::ScFormulaCell( ScDocument& rDoc, const ScAddress& rPos ) : { } -ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos, +ScFormulaCell::ScFormulaCell( ScDocument& rDoc, const ScAddress& rPos, const OUString& rFormula, const FormulaGrammar::Grammar eGrammar, ScMatrixMode cMatInd ) : @@ -655,7 +655,7 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos, nFormatType ( SvNumFormatType::NUMBER ), eTempGrammar( eGrammar), pCode( nullptr ), - pDocument( pDoc ), + pDocument( &rDoc ), pPrevious(nullptr), pNext(nullptr), pPreviousTrack(nullptr), @@ -665,7 +665,7 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos, Compile( rFormula, true, eGrammar ); // bNoListening, Insert does that if (!pCode) // We need to have a non-NULL token array instance at all times. - pCode = new ScTokenArray(*pDoc); + pCode = new ScTokenArray(rDoc); } ScFormulaCell::ScFormulaCell( diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx index df3777abe02a..b52247f35e14 100644 --- a/sc/source/core/data/table6.cxx +++ b/sc/source/core/data/table6.cxx @@ -256,7 +256,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, sc::Colum aString = aString.copy( 1 ); } ScAddress aAdr( nCol, nRow, nTab ); - ScFormulaCell* pFCell = new ScFormulaCell( &rDocument, aAdr, + ScFormulaCell* pFCell = new ScFormulaCell( rDocument, aAdr, aString, rDocument.GetGrammar(), cMatrixFlag ); SCCOL nMatCols; SCROW nMatRows; diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index fcd282c243eb..6761837109bc 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -609,12 +609,12 @@ void ScChangeAction::RejectRestoreContents( ScChangeTrack* pTrack, OSL_ENSURE( !pLinkDeleted, "ScChangeAction::RejectRestoreContents: pLinkDeleted != NULL" ); // Work through list of Contents and delete - ScDocument* pDoc = pTrack->GetDocument(); + ScDocument& rDoc = pTrack->GetDocument(); for (ScChangeActionContent* pContent : aContentsList) { if ( !pContent->IsDeletedIn() && - pContent->GetBigRange().aStart.IsValid( pDoc ) ) - pContent->PutNewValueToDoc( pDoc, nDx, nDy ); + pContent->GetBigRange().aStart.IsValid( &rDoc ) ) + pContent->PutNewValueToDoc( &rDoc, nDx, nDy ); } DeleteCellEntries(); // Remove generated ones } @@ -1407,7 +1407,7 @@ void ScChangeActionContent::SetValueString( rValue = EMPTY_OUSTRING; rCell.meType = CELLTYPE_FORMULA; rCell.mpFormula = new ScFormulaCell( - pDoc, aBigRange.aStart.MakeAddress(), rStr, + *pDoc, aBigRange.aStart.MakeAddress(), rStr, pDoc->GetGrammar() ); rCell.mpFormula->SetInChangeTrack(true); } @@ -1851,14 +1851,14 @@ void ScChangeActionContent::PutValueToDoc( } } -static void lcl_InvalidateReference( const ScDocument* pDoc, formula::FormulaToken& rTok, const ScBigAddress& rPos ) +static void lcl_InvalidateReference( const ScDocument& rDoc, formula::FormulaToken& rTok, const ScBigAddress& rPos ) { ScSingleRefData& rRef1 = *rTok.GetSingleRef(); - if ( rPos.Col() < 0 || pDoc->MaxCol() < rPos.Col() ) + if ( rPos.Col() < 0 || rDoc.MaxCol() < rPos.Col() ) { rRef1.SetColDeleted( true ); } - if ( rPos.Row() < 0 || pDoc->MaxRow() < rPos.Row() ) + if ( rPos.Row() < 0 || rDoc.MaxRow() < rPos.Row() ) { rRef1.SetRowDeleted( true ); } @@ -1870,11 +1870,11 @@ static void lcl_InvalidateReference( const ScDocument* pDoc, formula::FormulaTok return; ScSingleRefData& rRef2 = rTok.GetDoubleRef()->Ref2; - if ( rPos.Col() < 0 || pDoc->MaxCol() < rPos.Col() ) + if ( rPos.Col() < 0 || rDoc.MaxCol() < rPos.Col() ) { rRef2.SetColDeleted( true ); } - if ( rPos.Row() < 0 || pDoc->MaxRow() < rPos.Row() ) + if ( rPos.Row() < 0 || rDoc.MaxRow() < rPos.Row() ) { rRef2.SetRowDeleted( true ); } @@ -1967,7 +1967,7 @@ void ScChangeActionContent::UpdateReference( const ScChangeTrack* pTrack, } ScRange aRange( aTmpRange.MakeRange() ); - sc::RefUpdateContext aRefCxt(*pTrack->GetDocument()); + sc::RefUpdateContext aRefCxt(pTrack->GetDocument()); aRefCxt.meMode = eMode; aRefCxt.maRange = aRange; aRefCxt.mnColDelta = nDx; @@ -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: @@ -2038,7 +2038,7 @@ bool ScChangeActionReject::Reject(ScDocument* /*pDoc*/) SCSIZE ScChangeTrack::ComputeContentSlot( sal_Int32 nRow ) const { - if ( nRow < 0 || nRow > pDoc->GetSheetLimits().mnMaxRow ) + if ( nRow < 0 || nRow > rDoc.GetSheetLimits().mnMaxRow ) return mnContentSlots - 1; return static_cast< SCSIZE >( nRow / mnContentRowsPerSlot ); } @@ -2046,15 +2046,15 @@ SCSIZE ScChangeTrack::ComputeContentSlot( sal_Int32 nRow ) const SCROW ScChangeTrack::InitContentRowsPerSlot() { const SCSIZE nMaxSlots = 0xffe0 / sizeof( ScChangeActionContent* ) - 2; - SCROW nRowsPerSlot = pDoc->GetSheetLimits().GetMaxRowCount() / nMaxSlots; - if ( nRowsPerSlot * nMaxSlots < sal::static_int_cast(pDoc->GetSheetLimits().GetMaxRowCount()) ) + SCROW nRowsPerSlot = rDoc.GetSheetLimits().GetMaxRowCount() / nMaxSlots; + if ( nRowsPerSlot * nMaxSlots < sal::static_int_cast(rDoc.GetSheetLimits().GetMaxRowCount()) ) ++nRowsPerSlot; return nRowsPerSlot; } -ScChangeTrack::ScChangeTrack( ScDocument* pDocP ) : +ScChangeTrack::ScChangeTrack( ScDocument& rDocP ) : aFixDateTime( DateTime::SYSTEM ), - pDoc( pDocP ) + rDoc( rDocP ) { Init(); SC_MOD()->GetUserOptions().AddListener(this); @@ -2063,10 +2063,10 @@ ScChangeTrack::ScChangeTrack( ScDocument* pDocP ) : memset( ppContentSlots.get(), 0, mnContentSlots * sizeof( ScChangeActionContent* ) ); } -ScChangeTrack::ScChangeTrack( ScDocument* pDocP, const std::set& aTempUserCollection) : +ScChangeTrack::ScChangeTrack( ScDocument& rDocP, const std::set& aTempUserCollection) : maUserCollection(aTempUserCollection), aFixDateTime( DateTime::SYSTEM ), - pDoc( pDocP ) + rDoc( rDocP ) { Init(); SC_MOD()->GetUserOptions().AddListener(this); @@ -2083,7 +2083,7 @@ ScChangeTrack::~ScChangeTrack() void ScChangeTrack::Init() { mnContentRowsPerSlot = InitContentRowsPerSlot(); - mnContentSlots = pDoc->GetSheetLimits().GetMaxRowCount() / InitContentRowsPerSlot() + 2; + mnContentSlots = rDoc.GetSheetLimits().GetMaxRowCount() / InitContentRowsPerSlot() + 2; pFirst = nullptr; pLast = nullptr; @@ -2208,7 +2208,7 @@ ScChangeAction* ScChangeTrack::GetLastSaved() const void ScChangeTrack::ConfigurationChanged( utl::ConfigurationBroadcaster*, ConfigurationHints ) { - if ( pDoc->IsInDtorClear() ) + if ( rDoc.IsInDtorClear() ) return; const SvtUserOptions& rUserOptions = SC_MOD()->GetUserOptions(); @@ -2227,9 +2227,9 @@ void ScChangeTrack::ConfigurationChanged( utl::ConfigurationBroadcaster*, Config // (Has to be done in the Notify handler, to be sure // the user collection has already been updated) - SfxObjectShell* pDocSh = pDoc->GetDocumentShell(); + SfxObjectShell* pDocSh = rDoc.GetDocumentShell(); if (pDocSh) - pDocSh->Broadcast( ScPaintHint( ScRange(0,0,0,pDoc->MaxCol(),pDoc->MaxRow(),MAXTAB), PaintPartFlags::Grid ) ); + pDocSh->Broadcast( ScPaintHint( ScRange(0,0,0,rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB), PaintPartFlags::Grid ) ); } } @@ -2457,12 +2457,12 @@ void ScChangeTrack::AppendDeleteRange( const ScRange& rRange, { if ( !pRefDoc || nTab < pRefDoc->GetTableCount() ) { - if ( nCol1 == 0 && nCol2 == pDoc->MaxCol() ) + if ( nCol1 == 0 && nCol2 == rDoc.MaxCol() ) { // Whole Row and/or Tables - if ( nRow1 == 0 && nRow2 == pDoc->MaxRow() ) + if ( nRow1 == 0 && nRow2 == rDoc.MaxRow() ) { // Whole Table // TODO: Can't we do the whole Table as a whole? - ScRange aRange( 0, 0, nTab, 0, pDoc->MaxRow(), nTab ); + ScRange aRange( 0, 0, nTab, 0, rDoc.MaxRow(), nTab ); for ( SCCOL nCol = nCol1; nCol <= nCol2; nCol++ ) { // Column by column is less than row by row aRange.aStart.SetCol( nCol ); @@ -2478,7 +2478,7 @@ void ScChangeTrack::AppendDeleteRange( const ScRange& rRange, } else { // Whole rows - ScRange aRange( 0, 0, nTab, pDoc->MaxCol(), 0, nTab ); + ScRange aRange( 0, 0, nTab, rDoc.MaxCol(), 0, nTab ); for ( SCROW nRow = nRow1; nRow <= nRow2; nRow++ ) { aRange.aStart.SetRow( nRow ); @@ -2490,9 +2490,9 @@ void ScChangeTrack::AppendDeleteRange( const ScRange& rRange, } } } - else if ( nRow1 == 0 && nRow2 == pDoc->MaxRow() ) + else if ( nRow1 == 0 && nRow2 == rDoc.MaxRow() ) { // Whole columns - ScRange aRange( 0, 0, nTab, 0, pDoc->MaxRow(), nTab ); + ScRange aRange( 0, 0, nTab, 0, rDoc.MaxRow(), nTab ); for ( SCCOL nCol = nCol1; nCol <= nCol2; nCol++ ) { aRange.aStart.SetCol( nCol ); @@ -2533,11 +2533,11 @@ void ScChangeTrack::AppendOneDeleteRange( const ScRange& rOrgRange, aTrackRange.aStart.IncTab( -nDz ); aTrackRange.aEnd.IncTab( -nDz ); } - ScChangeActionDel* pAct = new ScChangeActionDel( pDoc, aTrackRange, nDx, nDy, + ScChangeActionDel* pAct = new ScChangeActionDel( &rDoc, aTrackRange, nDx, nDy, this ); // TabDelete not Contents; they are in separate columns if ( !(rOrgRange.aStart.Col() == 0 && rOrgRange.aStart.Row() == 0 && - rOrgRange.aEnd.Col() == pDoc->MaxCol() && rOrgRange.aEnd.Row() == pDoc->MaxRow()) ) + rOrgRange.aEnd.Col() == rDoc.MaxCol() && rOrgRange.aEnd.Row() == rDoc.MaxRow()) ) LookUpContents( rOrgRange, pRefDoc, -nDx, -nDy, -nDz ); if ( nRejectingInsert ) { @@ -2606,22 +2606,22 @@ void ScChangeTrack::AppendContent( const ScAddress& rPos, const ScCellValue& rOldCell, sal_uLong nOldFormat, ScDocument* pRefDoc ) { if ( !pRefDoc ) - pRefDoc = pDoc; + pRefDoc = &rDoc; OUString aOldValue; ScChangeActionContent::GetStringOfCell(aOldValue, rOldCell, pRefDoc, nOldFormat); OUString aNewValue; ScCellValue aNewCell; - aNewCell.assign(*pDoc, rPos); - ScChangeActionContent::GetStringOfCell(aNewValue, aNewCell, pDoc, rPos); + aNewCell.assign(rDoc, rPos); + ScChangeActionContent::GetStringOfCell(aNewValue, aNewCell, &rDoc, rPos); if (aOldValue != aNewValue || IsMatrixFormulaRangeDifferent(rOldCell, aNewCell)) { // Only track real changes ScRange aRange( rPos ); ScChangeActionContent* pAct = new ScChangeActionContent( aRange ); - pAct->SetOldValue(rOldCell, pRefDoc, pDoc, nOldFormat); - pAct->SetNewValue(aNewCell, pDoc); + pAct->SetOldValue(rOldCell, pRefDoc, &rDoc, nOldFormat); + pAct->SetNewValue(aNewCell, &rDoc); Append( pAct ); } } @@ -2636,15 +2636,15 @@ void ScChangeTrack::AppendContent( const ScAddress& rPos, OUString aNewValue; ScCellValue aNewCell; - aNewCell.assign(*pDoc, rPos); - ScChangeActionContent::GetStringOfCell(aNewValue, aNewCell, pDoc, rPos); + aNewCell.assign(rDoc, rPos); + ScChangeActionContent::GetStringOfCell(aNewValue, aNewCell, &rDoc, rPos); if (aOldValue != aNewValue || IsMatrixFormulaRangeDifferent(aOldCell, aNewCell)) { // Only track real changes ScRange aRange( rPos ); ScChangeActionContent* pAct = new ScChangeActionContent( aRange ); - pAct->SetOldValue(aOldCell, pRefDoc, pDoc); - pAct->SetNewValue(aNewCell, pDoc); + pAct->SetOldValue(aOldCell, pRefDoc, &rDoc); + pAct->SetNewValue(aNewCell, &rDoc); Append( pAct ); } } @@ -2652,9 +2652,9 @@ void ScChangeTrack::AppendContent( const ScAddress& rPos, void ScChangeTrack::AppendContent( const ScAddress& rPos, const ScCellValue& rOldCell ) { if (ScChangeActionContent::NeedsNumberFormat(rOldCell)) - AppendContent(rPos, rOldCell, pDoc->GetNumberFormat(rPos), pDoc); + AppendContent(rPos, rOldCell, rDoc.GetNumberFormat(rPos), &rDoc); else - AppendContent(rPos, rOldCell, 0, pDoc); + AppendContent(rPos, rOldCell, 0, &rDoc); } void ScChangeTrack::SetLastCutMoveRange( const ScRange& rRange, @@ -2771,7 +2771,7 @@ void ScChangeTrack::AppendContentRange( const ScRange& rRange, void ScChangeTrack::AppendContentsIfInRefDoc( ScDocument* pRefDoc, sal_uLong& nStartAction, sal_uLong& nEndAction ) { - ScCellIterator aIter(pRefDoc, ScRange(0,0,0,pDoc->MaxCol(),pDoc->MaxRow(),MAXTAB)); + ScCellIterator aIter(pRefDoc, ScRange(0,0,0,rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB)); if (aIter.first()) { nStartAction = GetActionMax() + 1; @@ -2799,14 +2799,14 @@ ScChangeActionContent* ScChangeTrack::AppendContentOnTheFly( { ScRange aRange( rPos ); ScChangeActionContent* pAct = new ScChangeActionContent( aRange ); - pAct->SetOldNewCells(rOldCell, nOldFormat, rNewCell, nNewFormat, pDoc); + pAct->SetOldNewCells(rOldCell, nOldFormat, rNewCell, nNewFormat, &rDoc); Append( pAct ); return pAct; } void ScChangeTrack::AppendInsert( const ScRange& rRange, bool bEndOfList ) { - ScChangeActionIns* pAct = new ScChangeActionIns(pDoc, rRange, bEndOfList); + ScChangeActionIns* pAct = new ScChangeActionIns(&rDoc, rRange, bEndOfList); Append( pAct ); } @@ -2831,7 +2831,7 @@ ScChangeActionContent* ScChangeTrack::GenerateDelContent( pContent->SetActionNumber( --nGeneratedMin ); // Only NewValue ScChangeActionContent::SetValue( pContent->maNewValue, pContent->maNewCell, - rPos, rCell, pFromDoc, pDoc ); + rPos, rCell, pFromDoc, &rDoc ); // pNextContent and pPrevContent are not set if ( pFirstGeneratedDelContent ) { // Insert at front @@ -2917,7 +2917,7 @@ void ScChangeTrack::Dependencies( ScChangeAction* pAct ) if ( ScChangeActionContent::GetContentCellType(rCell) == SC_CACCT_MATREF ) { ScAddress aOrg; - bool bOrgFound = rCell.mpFormula->GetMatrixOrigin(pDoc, aOrg); + bool bOrgFound = rCell.mpFormula->GetMatrixOrigin(&rDoc, aOrg); ScChangeActionContent* pContent = (bOrgFound ? SearchContentAt( aOrg, pAct ) : nullptr); if ( pContent && pContent->IsMatrixOrigin() ) { @@ -3159,7 +3159,7 @@ void ScChangeTrack::Undo( sal_uLong nStartAction, sal_uLong nEndAction, bool bMe nEndLastCut = nEnd; pLastCutMove.reset(pMove); SetLastCutMoveRange( - pMove->GetFromRange().MakeRange(), pDoc ); + pMove->GetFromRange().MakeRange(), &rDoc ); } else delete pMove; @@ -3248,15 +3248,15 @@ void ScChangeTrack::UpdateReference( ScChangeAction* pAct, bool bUndo ) return ; // Formula cells are not in the Document! - bool bOldAutoCalc = pDoc->GetAutoCalc(); - pDoc->SetAutoCalc( false ); - bool bOldNoListening = pDoc->GetNoListening(); - pDoc->SetNoListening( true ); + bool bOldAutoCalc = rDoc.GetAutoCalc(); + rDoc.SetAutoCalc( false ); + bool bOldNoListening = rDoc.GetNoListening(); + rDoc.SetNoListening( true ); // Formula cells ExpandRefs synchronized to the ones in the Document! - bool bOldExpandRefs = pDoc->IsExpandRefs(); + bool bOldExpandRefs = rDoc.IsExpandRefs(); if ( (!bUndo && pAct->IsInsertType()) || (bUndo && pAct->IsDeleteType()) ) - pDoc->SetExpandRefs( SC_MOD()->GetInputOptions().GetExpandRefs() ); + rDoc.SetExpandRefs( SC_MOD()->GetInputOptions().GetExpandRefs() ); if ( pAct->IsDeleteType() ) { @@ -3280,9 +3280,9 @@ void ScChangeTrack::UpdateReference( ScChangeAction* pAct, bool bUndo ) SetInDelete( false ); SetInDeleteUndo( false ); - pDoc->SetExpandRefs( bOldExpandRefs ); - pDoc->SetNoListening( bOldNoListening ); - pDoc->SetAutoCalc( bOldAutoCalc ); + rDoc.SetExpandRefs( bOldExpandRefs ); + rDoc.SetNoListening( bOldNoListening ); + rDoc.SetAutoCalc( bOldAutoCalc ); } void ScChangeTrack::UpdateReference( ScChangeAction** ppFirstAction, @@ -4070,11 +4070,11 @@ bool ScChangeTrack::SelectContent( ScChangeAction* pAct, bool bOldest ) aBigRange.aEnd.IncRow( nR-1 ); } - 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; @@ -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(p)->Select( pDoc, this, + bOk &= static_cast(p)->Select( &rDoc, this, bOldest, &aRejectActions ); } else @@ -4102,7 +4102,7 @@ bool ScChangeTrack::SelectContent( ScChangeAction* pAct, bool bOldest ) pL = pL->GetNext(); } - bOk &= pContent->Select( pDoc, this, bOldest, nullptr ); + bOk &= pContent->Select( &rDoc, this, bOldest, nullptr ); // now the matrix is inserted and new content values are ready while ( !aRejectActions.empty() ) @@ -4111,14 +4111,14 @@ bool ScChangeTrack::SelectContent( ScChangeAction* pAct, bool bOldest ) aRejectActions.pop(); ScAddress aPos( pNew->GetBigRange().aStart.MakeAddress() ); ScCellValue aCell; - aCell.assign(*pDoc, aPos); - pNew->SetNewValue(aCell, pDoc); + aCell.assign(rDoc, aPos); + pNew->SetNewValue(aCell, &rDoc); Append( pNew ); } return bOk; } else - return pContent->Select( pDoc, 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( pDoc ); + 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( pDoc ); + bTabDelOk = pAct->Reject( &rDoc ); bOk = bTabDelOk; if ( bOk ) { @@ -4241,7 +4241,7 @@ bool ScChangeTrack::Reject( if ( bOk ) { aDelRange = pDel->GetOverAllRange(); - bOk = aDelRange.IsValid( pDoc ); + bOk = aDelRange.IsValid( &rDoc ); } bool bOneOk = false; if ( bOk ) @@ -4268,7 +4268,7 @@ bool ScChangeTrack::Reject( do { pDel = static_cast(p); - bOk = pDel->Reject( pDoc ); + bOk = pDel->Reject( &rDoc ); if ( bOk ) { if ( bOneOk ) @@ -4304,7 +4304,7 @@ bool ScChangeTrack::Reject( if ( bOneOk || (bTabDel && bTabDelOk) ) { // Delete Reject made UpdateReference Undo - ScChangeActionIns* pReject = new ScChangeActionIns( pDoc, + ScChangeActionIns* pReject = new ScChangeActionIns( &rDoc, aDelRange.MakeRange() ); pReject->SetRejectAction( nRejectAction ); pReject->SetState( SC_CAS_ACCEPTED ); @@ -4325,7 +4325,7 @@ bool ScChangeTrack::Reject( } if ( bOk ) { - bRejected = pAct->Reject( pDoc ); + bRejected = pAct->Reject( &rDoc ); if ( bRejected ) { ScChangeActionMove* pReject = new ScChangeActionMove( @@ -4348,15 +4348,15 @@ bool ScChangeTrack::Reject( aRange = pAct->GetBigRange().aStart.MakeAddress(); pReject = new ScChangeActionContent( aRange ); ScCellValue aCell; - aCell.assign(*pDoc, aRange.aStart); - pReject->SetOldValue(aCell, pDoc, pDoc); + aCell.assign(rDoc, aRange.aStart); + pReject->SetOldValue(aCell, &rDoc, &rDoc); } - bRejected = pAct->Reject( pDoc ); + bRejected = pAct->Reject( &rDoc ); if ( bRejected && !bRecursion ) { ScCellValue aCell; - aCell.assign(*pDoc, aRange.aStart); - pReject->SetNewValue(aCell, pDoc); + aCell.assign(rDoc, aRange.aStart); + pReject->SetNewValue(aCell, &rDoc); pReject->SetRejectAction( pAct->GetActionNumber() ); pReject->SetState( SC_CAS_ACCEPTED ); Append( pReject ); @@ -4380,7 +4380,7 @@ bool ScChangeTrack::IsLastAction( sal_uLong nNum ) const sal_uLong ScChangeTrack::AddLoadedGenerated( const ScCellValue& rNewCell, const ScBigRange& aBigRange, const OUString& sNewValue ) { - ScChangeActionContent* pAct = new ScChangeActionContent( --nGeneratedMin, rNewCell, aBigRange, pDoc, sNewValue ); + ScChangeActionContent* pAct = new ScChangeActionContent( --nGeneratedMin, rNewCell, aBigRange, &rDoc, sNewValue ); if ( pFirstGeneratedDelContent ) pFirstGeneratedDelContent->pPrev = pAct; pAct->pNext = pFirstGeneratedDelContent; @@ -4409,7 +4409,7 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const return nullptr; } - std::unique_ptr pClonedTrack(new ScChangeTrack( pDocument )); + std::unique_ptr pClonedTrack(new ScChangeTrack( *pDocument )); pClonedTrack->SetTimeNanoSeconds( IsTimeNanoSeconds() ); // clone generated actions @@ -4685,7 +4685,7 @@ void ScChangeTrack::MergeActionState( ScChangeAction* pAct, const ScChangeAction } /// Get info about a single ScChangeAction element. -static void lcl_getTrackedChange(ScDocument* pDoc, int nIndex, const ScChangeAction* pAction, tools::JsonWriter& rRedlines) +static void lcl_getTrackedChange(ScDocument& rDoc, int nIndex, const ScChangeAction* pAction, tools::JsonWriter& rRedlines) { if (pAction->GetType() != SC_CAT_CONTENT) return; @@ -4700,7 +4700,7 @@ static void lcl_getTrackedChange(ScDocument* pDoc, int nIndex, const ScChangeAct rRedlines.put("comment", pAction->GetComment()); OUString aDescription; - pAction->GetDescription(aDescription, pDoc, true); + pAction->GetDescription(aDescription, &rDoc, true); rRedlines.put("description", aDescription); OUString sDateTime = utl::toISO8601(pAction->GetDateTimeUTC().GetUNODateTime()); @@ -4715,12 +4715,12 @@ void ScChangeTrack::GetChangeTrackInfo(tools::JsonWriter& aRedlines) if (pAction) { int i = 0; - lcl_getTrackedChange(pDoc, i++, pAction, aRedlines); + lcl_getTrackedChange(rDoc, i++, pAction, aRedlines); ScChangeAction* pLastAction = GetLast(); while (pAction != pLastAction) { pAction = pAction->GetNext(); - lcl_getTrackedChange(pDoc, i++, pAction, aRedlines); + lcl_getTrackedChange(rDoc, i++, pAction, aRedlines); } } } diff --git a/sc/source/filter/oox/revisionfragment.cxx b/sc/source/filter/oox/revisionfragment.cxx index bb3f686e0ef8..ed0e5ddd9be6 100644 --- a/sc/source/filter/oox/revisionfragment.cxx +++ b/sc/source/filter/oox/revisionfragment.cxx @@ -245,7 +245,7 @@ void RevisionHeadersFragment::onEndElement() void RevisionHeadersFragment::finalizeImport() { ScDocument& rDoc = getScDocument(); - std::unique_ptr pCT(new ScChangeTrack(&rDoc)); + std::unique_ptr pCT(new ScChangeTrack(rDoc)); OUString aSelfUser = pCT->GetUser(); // owner of this document. pCT->SetUseFixDateTime(true); diff --git a/sc/source/filter/xcl97/XclImpChangeTrack.cxx b/sc/source/filter/xcl97/XclImpChangeTrack.cxx index 6157de77435f..435cca766496 100644 --- a/sc/source/filter/xcl97/XclImpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclImpChangeTrack.cxx @@ -59,7 +59,7 @@ XclImpChangeTrack::XclImpChangeTrack( const XclImpRoot& rRoot, const XclImpStrea xInStrm->Seek( STREAM_SEEK_TO_BEGIN ); pStrm.reset( new XclImpStream( *xInStrm, GetRoot() ) ); pStrm->CopyDecrypterFrom( rBookStrm ); - pChangeTrack.reset(new ScChangeTrack( &GetDoc() )); + pChangeTrack.reset(new ScChangeTrack( GetDoc() )); sOldUsername = pChangeTrack->GetUser(); pChangeTrack->SetUseFixDateTime( true ); diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx index c3d505143536..37becac3a72d 100644 --- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx +++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx @@ -48,7 +48,7 @@ ScMyCellInfo::ScMyCellInfo( ScMyCellInfo::~ScMyCellInfo() {} -const ScCellValue& ScMyCellInfo::CreateCell( ScDocument* pDoc ) +const ScCellValue& ScMyCellInfo::CreateCell(ScDocument& rDoc) { if (!maCell.isEmpty()) return maCell; @@ -57,9 +57,9 @@ const ScCellValue& ScMyCellInfo::CreateCell( ScDocument* pDoc ) { ScAddress aPos; sal_Int32 nOffset(0); - ScRangeStringConverter::GetAddressFromString(aPos, sFormulaAddress, pDoc, ::formula::FormulaGrammar::CONV_OOO, nOffset); + ScRangeStringConverter::GetAddressFromString(aPos, sFormulaAddress, &rDoc, ::formula::FormulaGrammar::CONV_OOO, nOffset); maCell.meType = CELLTYPE_FORMULA; - maCell.mpFormula = new ScFormulaCell(pDoc, aPos, sFormula, eGrammar, nMatrixFlag); + maCell.mpFormula = new ScFormulaCell(rDoc, aPos, sFormula, eGrammar, nMatrixFlag); maCell.mpFormula->SetMatColsRows(static_cast(nMatrixCols), static_cast(nMatrixRows)); } @@ -67,10 +67,10 @@ const ScCellValue& ScMyCellInfo::CreateCell( ScDocument* pDoc ) { sal_uInt32 nFormat(0); if (nType == css::util::NumberFormat::DATE) - nFormat = pDoc->GetFormatTable()->GetStandardFormat( SvNumFormatType::DATE, ScGlobal::eLnge ); + nFormat = rDoc.GetFormatTable()->GetStandardFormat( SvNumFormatType::DATE, ScGlobal::eLnge ); else if (nType == css::util::NumberFormat::TIME) - nFormat = pDoc->GetFormatTable()->GetStandardFormat( SvNumFormatType::TIME, ScGlobal::eLnge ); - pDoc->GetFormatTable()->GetInputLineString(fValue, nFormat, sInputString); + nFormat = rDoc.GetFormatTable()->GetStandardFormat( SvNumFormatType::TIME, ScGlobal::eLnge ); + rDoc.GetFormatTable()->GetInputLineString(fValue, nFormat, sInputString); } return maCell; @@ -142,7 +142,6 @@ ScMyRejAction::~ScMyRejAction() ScXMLChangeTrackingImportHelper::ScXMLChangeTrackingImportHelper() : aActions(), - pDoc(nullptr), pTrack(nullptr), nMultiSpanned(0), nMultiSpannedSlaveCount(0) @@ -458,13 +457,13 @@ std::unique_ptr ScXMLChangeTrackingImportHelper::CreateRejection pAction->aBigRange, aUser, aDateTime, sComment); } -std::unique_ptr ScXMLChangeTrackingImportHelper::CreateContentAction(const ScMyContentAction* pAction) +std::unique_ptr ScXMLChangeTrackingImportHelper::CreateContentAction(const ScMyContentAction* pAction, ScDocument& rDoc) { ScCellValue aCell; OUString sInputString; if (pAction->pCellInfo) { - aCell = pAction->pCellInfo->CreateCell(pDoc); + aCell = pAction->pCellInfo->CreateCell(rDoc); sInputString = pAction->pCellInfo->sInputString; } @@ -475,10 +474,10 @@ std::unique_ptr ScXMLChangeTrackingImportHelper::CreateContentAc OUString sComment (pAction->aInfo.sComment); return std::make_unique(pAction->nActionNumber, pAction->nActionState, pAction->nRejectingNumber, - pAction->aBigRange, aUser, aDateTime, sComment, aCell, pDoc, sInputString); + pAction->aBigRange, aUser, aDateTime, sComment, aCell, &rDoc, sInputString); } -void ScXMLChangeTrackingImportHelper::CreateGeneratedActions(std::vector& rList) +void ScXMLChangeTrackingImportHelper::CreateGeneratedActions(std::vector& rList, ScDocument& rDoc) { for (ScMyGenerated & rGenerated : rList) { @@ -486,7 +485,7 @@ void ScXMLChangeTrackingImportHelper::CreateGeneratedActions(std::vectorCreateCell(pDoc); + aCell = rGenerated.pCellInfo->CreateCell(rDoc); if (!aCell.isEmpty()) { @@ -575,7 +574,7 @@ void ScXMLChangeTrackingImportHelper::SetMovementDependencies(ScMyMoveAction* pA } } -void ScXMLChangeTrackingImportHelper::SetContentDependencies(const ScMyContentAction* pAction, ScChangeActionContent* pActContent) +void ScXMLChangeTrackingImportHelper::SetContentDependencies(const ScMyContentAction* pAction, ScChangeActionContent* pActContent, ScDocument& rDoc) { if (!pActContent || !pAction->nPreviousAction) return; @@ -593,10 +592,10 @@ void ScXMLChangeTrackingImportHelper::SetContentDependencies(const ScMyContentAc if (rOldCell.isEmpty()) return; - pPrevActContent->SetNewCell(rOldCell, pDoc, EMPTY_OUSTRING); + pPrevActContent->SetNewCell(rOldCell, &rDoc, EMPTY_OUSTRING); } -void ScXMLChangeTrackingImportHelper::SetDependencies(ScMyBaseAction* pAction) +void ScXMLChangeTrackingImportHelper::SetDependencies(ScMyBaseAction* pAction, ScDocument& rDoc) { ScChangeAction* pAct = pTrack->GetAction(pAction->nActionNumber); if (pAct) @@ -619,12 +618,12 @@ void ScXMLChangeTrackingImportHelper::SetDependencies(ScMyBaseAction* pAction) ScChangeActionContent* pContentAct = static_cast(pDeletedAct); if (rDeleted.pCellInfo) { - const ScCellValue& rCell = rDeleted.pCellInfo->CreateCell(pDoc); + const ScCellValue& rCell = rDeleted.pCellInfo->CreateCell(rDoc); if (!rCell.equalsWithoutFormat(pContentAct->GetNewCell())) { // #i40704# Don't overwrite SetNewCell result by calling SetNewValue, // instead pass the input string to SetNewCell. - pContentAct->SetNewCell(rCell, pDoc, rDeleted.pCellInfo->sInputString); + pContentAct->SetNewCell(rCell, &rDoc, rDeleted.pCellInfo->sInputString); } } } @@ -637,7 +636,7 @@ void ScXMLChangeTrackingImportHelper::SetDependencies(ScMyBaseAction* pAction) else if (pAction->nActionType == SC_CAT_MOVE) SetMovementDependencies(static_cast(pAction), static_cast(pAct)); else if (pAction->nActionType == SC_CAT_CONTENT) - SetContentDependencies(static_cast(pAction), static_cast(pAct)); + SetContentDependencies(static_cast(pAction), static_cast(pAct), rDoc); } else { @@ -645,7 +644,7 @@ void ScXMLChangeTrackingImportHelper::SetDependencies(ScMyBaseAction* pAction) } } -void ScXMLChangeTrackingImportHelper::SetNewCell(const ScMyContentAction* pAction) +void ScXMLChangeTrackingImportHelper::SetNewCell(const ScMyContentAction* pAction, ScDocument& rDoc) { ScChangeAction* pChangeAction = pTrack->GetAction(pAction->nActionNumber); if (!pChangeAction) @@ -658,23 +657,23 @@ void ScXMLChangeTrackingImportHelper::SetNewCell(const ScMyContentAction* pActio sal_Int32 nCol, nRow, nTab, nCol2, nRow2, nTab2; pAction->aBigRange.GetVars(nCol, nRow, nTab, nCol2, nRow2, nTab2); - if ((nCol >= 0) && (nCol <= pDoc->MaxCol()) && - (nRow >= 0) && (nRow <= pDoc->MaxRow()) && + if ((nCol >= 0) && (nCol <= rDoc.MaxCol()) && + (nRow >= 0) && (nRow <= rDoc.MaxRow()) && (nTab >= 0) && (nTab <= MAXTAB)) { ScAddress aAddress (static_cast(nCol), static_cast(nRow), static_cast(nTab)); ScCellValue aCell; - aCell.assign(*pDoc, aAddress); + aCell.assign(rDoc, aAddress); if (!aCell.isEmpty()) { ScCellValue aNewCell; if (aCell.meType != CELLTYPE_FORMULA) { aNewCell = aCell; - pChangeActionContent->SetNewCell(aNewCell, pDoc, EMPTY_OUSTRING); - pChangeActionContent->SetNewValue(aCell, pDoc); + pChangeActionContent->SetNewCell(aNewCell, &rDoc, EMPTY_OUSTRING); + pChangeActionContent->SetNewValue(aCell, &rDoc); } else { @@ -700,7 +699,7 @@ void ScXMLChangeTrackingImportHelper::SetNewCell(const ScMyContentAction* pActio } aNewCell.meType = CELLTYPE_FORMULA; - aNewCell.mpFormula = new ScFormulaCell(pDoc, aAddress, sFormula2,formula::FormulaGrammar::GRAM_ODFF, nMatrixFlag); + aNewCell.mpFormula = new ScFormulaCell(rDoc, aAddress, sFormula2,formula::FormulaGrammar::GRAM_ODFF, nMatrixFlag); if (nMatrixFlag == ScMatrixMode::Formula) { SCCOL nCols; @@ -709,7 +708,7 @@ void ScXMLChangeTrackingImportHelper::SetNewCell(const ScMyContentAction* pActio aNewCell.mpFormula->SetMatColsRows(nCols, nRows); } aNewCell.mpFormula->SetInChangeTrack(true); - pChangeActionContent->SetNewCell(aNewCell, pDoc, EMPTY_OUSTRING); + pChangeActionContent->SetNewCell(aNewCell, &rDoc, EMPTY_OUSTRING); // #i40704# don't overwrite the formula string via SetNewValue() } } @@ -720,13 +719,12 @@ void ScXMLChangeTrackingImportHelper::SetNewCell(const ScMyContentAction* pActio } } -void ScXMLChangeTrackingImportHelper::CreateChangeTrack(ScDocument* pTempDoc) +void ScXMLChangeTrackingImportHelper::CreateChangeTrack(ScDocument* pDoc) { - pDoc = pTempDoc; if (!pDoc) return; - pTrack = new ScChangeTrack(pDoc, aUsers); + pTrack = new ScChangeTrack(*pDoc, aUsers); // old files didn't store nanoseconds, disable until encountered pTrack->SetTimeNanoSeconds( false ); @@ -749,19 +747,19 @@ void ScXMLChangeTrackingImportHelper::CreateChangeTrack(ScDocument* pTempDoc) { ScMyDelAction* pDelAct = static_cast(rAction.get()); pAction = CreateDeleteAction(pDelAct); - CreateGeneratedActions(pDelAct->aGeneratedList); + CreateGeneratedActions(pDelAct->aGeneratedList, *pDoc); } break; case SC_CAT_MOVE: { ScMyMoveAction* pMovAct = static_cast(rAction.get()); pAction = CreateMoveAction(pMovAct); - CreateGeneratedActions(pMovAct->aGeneratedList); + CreateGeneratedActions(pMovAct->aGeneratedList, *pDoc); } break; case SC_CAT_CONTENT: { - pAction = CreateContentAction(static_cast(rAction.get())); + pAction = CreateContentAction(static_cast(rAction.get()), *pDoc); } break; case SC_CAT_REJECT: @@ -788,7 +786,7 @@ void ScXMLChangeTrackingImportHelper::CreateChangeTrack(ScDocument* pTempDoc) auto aItr = aActions.begin(); while (aItr != aActions.end()) { - SetDependencies(aItr->get()); + SetDependencies(aItr->get(), *pDoc); if ((*aItr)->nActionType == SC_CAT_CONTENT) ++aItr; @@ -799,7 +797,7 @@ void ScXMLChangeTrackingImportHelper::CreateChangeTrack(ScDocument* pTempDoc) for (const auto& rxAction : aActions) { OSL_ENSURE(rxAction->nActionType == SC_CAT_CONTENT, "wrong action type"); - SetNewCell(static_cast(rxAction.get())); + SetNewCell(static_cast(rxAction.get()), *pDoc); } aActions.clear(); if (aProtect.hasElements()) diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx index 58a4a87147c4..4c318df17919 100644 --- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx +++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx @@ -55,7 +55,7 @@ struct ScMyCellInfo const sal_Int32 nMatrixCols, const sal_Int32 nMatrixRows ); ~ScMyCellInfo(); - const ScCellValue& CreateCell( ScDocument* pDoc ); + const ScCellValue& CreateCell( ScDocument& rDoc ); }; struct ScMyDeleted @@ -165,7 +165,6 @@ class ScXMLChangeTrackingImportHelper std::set aUsers; std::vector> aActions; css::uno::Sequence aProtect; - ScDocument* pDoc; ScChangeTrack* pTrack; std::unique_ptr pCurrentAction; sal_Int16 nMultiSpanned; @@ -177,9 +176,9 @@ private: std::unique_ptr CreateDeleteAction(const ScMyDelAction* pAction); std::unique_ptr CreateMoveAction(const ScMyMoveAction* pAction); std::unique_ptr CreateRejectionAction(const ScMyRejAction* pAction); - std::unique_ptr CreateContentAction(const ScMyContentAction* pAction); + std::unique_ptr CreateContentAction(const ScMyContentAction* pAction, ScDocument& rDoc); - void CreateGeneratedActions(std::vector& rList); + void CreateGeneratedActions(std::vector& rList, ScDocument& rDoc); public: ScXMLChangeTrackingImportHelper(); @@ -211,10 +210,10 @@ public: void SetDeletionDependencies(ScMyDelAction* pAction, ScChangeActionDel* pDelAct); void SetMovementDependencies(ScMyMoveAction* pAction, ScChangeActionMove* pMoveAct); - void SetContentDependencies(const ScMyContentAction* pAction, ScChangeActionContent* pActContent); - void SetDependencies(ScMyBaseAction* pAction); + void SetContentDependencies(const ScMyContentAction* pAction, ScChangeActionContent* pActContent, ScDocument& rDoc); + void SetDependencies(ScMyBaseAction* pAction, ScDocument& rDoc); - void SetNewCell(const ScMyContentAction* pAction); + void SetNewCell(const ScMyContentAction* pAction, ScDocument& rDoc); void CreateChangeTrack(ScDocument* pDoc); }; diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 4270c73f7adc..142d794c26da 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -986,7 +986,7 @@ void ScXMLImport::SetConfigurationSettings(const uno::Sequence aUsers; - std::unique_ptr pTrack( new ScChangeTrack(pDoc, aUsers) ); + std::unique_ptr pTrack( new ScChangeTrack(*pDoc, aUsers) ); pTrack->SetProtection(aPass); pDoc->SetChangeTrack(std::move(pTrack)); } diff --git a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx index 23f9659c68c5..2ea07a95cbb1 100644 --- a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx @@ -539,7 +539,7 @@ void ScAnalysisOfVarianceDialog::AnovaTwoFactor(AddressWalkerWriter& output, For ScRange ScAnalysisOfVarianceDialog::ApplyOutput(ScDocShell* pDocShell) { - AddressWalkerWriter output(mOutputAddress, pDocShell, &mDocument, + AddressWalkerWriter output(mOutputAddress, pDocShell, mDocument, formula::FormulaGrammar::mergeToGrammar(formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv)); FormulaTemplate aTemplate(&mDocument); diff --git a/sc/source/ui/StatisticsDialogs/ChiSquareTestDialog.cxx b/sc/source/ui/StatisticsDialogs/ChiSquareTestDialog.cxx index e2de2db8246d..da12b328d5fb 100644 --- a/sc/source/ui/StatisticsDialogs/ChiSquareTestDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/ChiSquareTestDialog.cxx @@ -39,7 +39,7 @@ const char* ScChiSquareTestDialog::GetUndoNameId() ScRange ScChiSquareTestDialog::ApplyOutput(ScDocShell* pDocShell) { - AddressWalkerWriter aOutput(mOutputAddress, pDocShell, &mDocument, + AddressWalkerWriter aOutput(mOutputAddress, pDocShell, mDocument, formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv)); FormulaTemplate aTemplate(&mDocument); diff --git a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx index f82b04bdf17a..9c3d7fba1f8e 100644 --- a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx @@ -70,7 +70,7 @@ const char* ScDescriptiveStatisticsDialog::GetUndoNameId() ScRange ScDescriptiveStatisticsDialog::ApplyOutput(ScDocShell* pDocShell) { - AddressWalkerWriter aOutput(mOutputAddress, pDocShell, &mDocument, + AddressWalkerWriter aOutput(mOutputAddress, pDocShell, mDocument, formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv)); FormulaTemplate aTemplate(&mDocument); diff --git a/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx b/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx index 8e87c11fb80f..376b9db3b6d7 100644 --- a/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx @@ -43,7 +43,7 @@ const char* ScExponentialSmoothingDialog::GetUndoNameId() ScRange ScExponentialSmoothingDialog::ApplyOutput(ScDocShell* pDocShell) { - AddressWalkerWriter output(mOutputAddress, pDocShell, &mDocument, + AddressWalkerWriter output(mOutputAddress, pDocShell, mDocument, formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv)); FormulaTemplate aTemplate(&mDocument); diff --git a/sc/source/ui/StatisticsDialogs/FTestDialog.cxx b/sc/source/ui/StatisticsDialogs/FTestDialog.cxx index 1fc75ee7f2b2..f84c7807e537 100644 --- a/sc/source/ui/StatisticsDialogs/FTestDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/FTestDialog.cxx @@ -41,7 +41,7 @@ const char* ScFTestDialog::GetUndoNameId() ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell) { - AddressWalkerWriter aOutput(mOutputAddress, pDocShell, &mDocument, + AddressWalkerWriter aOutput(mOutputAddress, pDocShell, mDocument, formula::FormulaGrammar::mergeToGrammar(formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv)); FormulaTemplate aTemplate(&mDocument); diff --git a/sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx b/sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx index c5bf54464450..cfd42a02d28c 100644 --- a/sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx @@ -63,7 +63,7 @@ const char* ScFourierAnalysisDialog::GetUndoNameId() { return STR_FOURIER_ANALYS ScRange ScFourierAnalysisDialog::ApplyOutput(ScDocShell* pDocShell) { getOptions(); - AddressWalkerWriter aOutput(mOutputAddress, pDocShell, &mDocument, + AddressWalkerWriter aOutput(mOutputAddress, pDocShell, mDocument, formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv)); FormulaTemplate aTemplate(&mDocument); diff --git a/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx b/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx index bb8e43efeded..447a89c78608 100644 --- a/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx +++ b/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx @@ -57,7 +57,7 @@ const char* ScMatrixComparisonGenerator::GetUndoNameId() ScRange ScMatrixComparisonGenerator::ApplyOutput(ScDocShell* pDocShell) { - AddressWalkerWriter output(mOutputAddress, pDocShell, &mDocument, + AddressWalkerWriter output(mOutputAddress, pDocShell, mDocument, formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv)); FormulaTemplate aTemplate(&mDocument); diff --git a/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx b/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx index 07e104f39328..343e4512f891 100644 --- a/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx @@ -44,7 +44,7 @@ const char* ScMovingAverageDialog::GetUndoNameId() ScRange ScMovingAverageDialog::ApplyOutput(ScDocShell* pDocShell) { - AddressWalkerWriter output(mOutputAddress, pDocShell, &mDocument, + AddressWalkerWriter output(mOutputAddress, pDocShell, mDocument, formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv)); FormulaTemplate aTemplate(&mDocument); diff --git a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx index f3ba7ab8a7b4..ef5cd8f28a76 100644 --- a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx @@ -170,7 +170,7 @@ const char* ScRegressionDialog::GetUndoNameId() ScRange ScRegressionDialog::ApplyOutput(ScDocShell* pDocShell) { - AddressWalkerWriter aOutput(mOutputAddress, pDocShell, &mDocument, + AddressWalkerWriter aOutput(mOutputAddress, pDocShell, mDocument, formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv)); FormulaTemplate aTemplate(&mDocument); aTemplate.autoReplaceUses3D(mbUse3DAddresses); diff --git a/sc/source/ui/StatisticsDialogs/TTestDialog.cxx b/sc/source/ui/StatisticsDialogs/TTestDialog.cxx index 80cb6608e31d..6d720a1f273f 100644 --- a/sc/source/ui/StatisticsDialogs/TTestDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/TTestDialog.cxx @@ -41,7 +41,7 @@ const char* ScTTestDialog::GetUndoNameId() ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell) { - AddressWalkerWriter aOutput(mOutputAddress, pDocShell, &mDocument, + AddressWalkerWriter aOutput(mOutputAddress, pDocShell, mDocument, formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv)); FormulaTemplate aTemplate(&mDocument); diff --git a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx index 4ac9ee4d2f76..1d2d087bfc7a 100644 --- a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx +++ b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx @@ -149,18 +149,18 @@ void AddressWalker::push(SCCOL aRelativeCol, SCROW aRelativeRow, SCTAB aRelative mAddressStack.push_back(mCurrentAddress); } -AddressWalkerWriter::AddressWalkerWriter(const ScAddress& aInitialAddress, ScDocShell* pDocShell, ScDocument* pDocument, +AddressWalkerWriter::AddressWalkerWriter(const ScAddress& aInitialAddress, ScDocShell* pDocShell, ScDocument& rDocument, formula::FormulaGrammar::Grammar eGrammar ) : AddressWalker(aInitialAddress), mpDocShell(pDocShell), - mpDocument(pDocument), + mrDocument(rDocument), meGrammar(eGrammar) {} void AddressWalkerWriter::writeFormula(const OUString& aFormula) { mpDocShell->GetDocFunc().SetFormulaCell(mCurrentAddress, - new ScFormulaCell(mpDocument, mCurrentAddress, aFormula, meGrammar), true); + new ScFormulaCell(mrDocument, mCurrentAddress, aFormula, meGrammar), true); } void AddressWalkerWriter::writeFormulas(const std::vector& rFormulas) @@ -178,7 +178,7 @@ void AddressWalkerWriter::writeFormulas(const std::vector& rFormulas) ScAddress aAddr(mCurrentAddress); for (size_t nIdx = 0; nIdx < nLength; ++nIdx) { - aFormulaCells[nIdx] = new ScFormulaCell(mpDocument, aAddr, rFormulas[nIdx], meGrammar); + aFormulaCells[nIdx] = new ScFormulaCell(mrDocument, aAddr, rFormulas[nIdx], meGrammar); aAddr.IncRow(1); } @@ -209,7 +209,7 @@ void AddressWalkerWriter::writeString(const char* aCharArray) void AddressWalkerWriter::writeBoldString(const OUString& aString) { - ScFieldEditEngine& rEngine = mpDocument->GetEditEngine(); + ScFieldEditEngine& rEngine = mrDocument.GetEditEngine(); rEngine.SetTextCurrentDefaults(aString); SfxItemSet aItemSet = rEngine.GetEmptyItemSet(); SvxWeightItem aWeight(WEIGHT_BOLD, EE_CHAR_WEIGHT); diff --git a/sc/source/ui/StatisticsDialogs/ZTestDialog.cxx b/sc/source/ui/StatisticsDialogs/ZTestDialog.cxx index 6eb11ac5732f..974a47989283 100644 --- a/sc/source/ui/StatisticsDialogs/ZTestDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/ZTestDialog.cxx @@ -41,7 +41,7 @@ const char* ScZTestDialog::GetUndoNameId() ScRange ScZTestDialog::ApplyOutput(ScDocShell* pDocShell) { - AddressWalkerWriter aOutput(mOutputAddress, pDocShell, &mDocument, + AddressWalkerWriter aOutput(mOutputAddress, pDocShell, mDocument, formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv)); FormulaTemplate aTemplate(&mDocument); diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 57184a3223e7..a3bfe3096566 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -1238,7 +1238,7 @@ bool ScDocFunc::SetCellText( switch (aRes.meType) { case ScInputStringType::Formula: - bSet = SetFormulaCell(rPos, new ScFormulaCell(&rDoc, rPos, aRes.maText, eGrammar), !bApi); + bSet = SetFormulaCell(rPos, new ScFormulaCell(rDoc, rPos, aRes.maText, eGrammar), !bApi); break; case ScInputStringType::Number: bSet = SetValueCell(rPos, aRes.mfValue, !bApi); diff --git a/sc/source/ui/inc/TableFillingAndNavigationTools.hxx b/sc/source/ui/inc/TableFillingAndNavigationTools.hxx index 9d4e82956a66..d24535c54298 100644 --- a/sc/source/ui/inc/TableFillingAndNavigationTools.hxx +++ b/sc/source/ui/inc/TableFillingAndNavigationTools.hxx @@ -73,10 +73,10 @@ class AddressWalkerWriter : public AddressWalker { public: ScDocShell* mpDocShell; - ScDocument* mpDocument; + ScDocument& mrDocument; formula::FormulaGrammar::Grammar meGrammar; - AddressWalkerWriter(const ScAddress& aInitialAddress, ScDocShell* pDocShell, ScDocument* pDocument, + AddressWalkerWriter(const ScAddress& aInitialAddress, ScDocShell* pDocShell, ScDocument& rDocument, formula::FormulaGrammar::Grammar eGrammar ); void writeFormula(const OUString& aFormula); diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index a641502d6975..997f953e806c 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -5986,7 +5986,7 @@ void ScCellObj::InputEnglishString( const OUString& rText ) case ScInputStringType::Formula: rFunc.SetFormulaCell( aCellPos, - new ScFormulaCell(&rDoc, aCellPos, aRes.maText, formula::FormulaGrammar::GRAM_API), + new ScFormulaCell(rDoc, aCellPos, aRes.maText, formula::FormulaGrammar::GRAM_API), false); break; case ScInputStringType::Number: diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 048181f3cb7e..fcf925afaad9 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -905,7 +905,7 @@ void ScViewFunc::EnterBlock( const OUString& rString, const EditTextObject* pDat if (aNewStr[0] == '=') // Formula ? { // SetString not possible, because in Clipboard-Documents nothing will be compiled! - pInsDoc->SetFormulaCell(aPos, new ScFormulaCell(&rDoc, aPos, aNewStr)); + pInsDoc->SetFormulaCell(aPos, new ScFormulaCell(rDoc, aPos, aNewStr)); } else if ( pData ) { diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 0f363c0bd970..b60bf2c35a64 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -769,7 +769,7 @@ void ScViewFunc::EnterMatrix( const OUString& rString, ::formula::FormulaGrammar ScDocument& rDoc = rData.GetDocument(); SCTAB nTab = rData.GetTabNo(); - ScFormulaCell aFormCell( &rDoc, ScAddress(nCol,nRow,nTab), rString, eGram, ScMatrixMode::Formula ); + ScFormulaCell aFormCell( rDoc, ScAddress(nCol,nRow,nTab), rString, eGram, ScMatrixMode::Formula ); SCSIZE nSizeX; SCSIZE nSizeY; -- cgit v1.2.3