From 08e85556d2ae66bdf43d908e1b9dfca4c78295e2 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 16 Sep 2020 11:55:20 +0100 Subject: ScCellIterator never passed a null ScDocument* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5d8ea1533fe861cf969c2999343da217c82d54e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103006 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sc/inc/autonamecache.hxx | 4 +- sc/inc/detfunc.hxx | 4 +- sc/inc/dociter.hxx | 8 +- sc/inc/formulaiter.hxx | 4 +- sc/inc/rangeseq.hxx | 8 +- sc/source/core/data/autonamecache.cxx | 6 +- sc/source/core/data/dociter.cxx | 44 +++++------ sc/source/core/data/documen3.cxx | 4 +- sc/source/core/data/document.cxx | 10 +-- sc/source/core/data/formulaiter.cxx | 10 +-- sc/source/core/data/table2.cxx | 2 +- sc/source/core/tool/chgtrack.cxx | 4 +- sc/source/core/tool/compiler.cxx | 6 +- sc/source/core/tool/detfunc.cxx | 106 +++++++++++++------------- sc/source/core/tool/interpr1.cxx | 2 +- sc/source/core/tool/interpr4.cxx | 10 +-- sc/source/core/tool/interpr5.cxx | 2 +- sc/source/core/tool/interpr6.cxx | 2 +- sc/source/core/tool/rangeseq.cxx | 26 +++---- sc/source/filter/oox/formulabuffer.cxx | 2 +- sc/source/filter/xcl97/xcl97rec.cxx | 2 +- sc/source/filter/xml/XMLExportDataPilot.cxx | 2 +- sc/source/filter/xml/xmlcelli.cxx | 2 +- sc/source/filter/xml/xmlexprt.cxx | 2 +- sc/source/ui/Accessibility/AccessibleCell.cxx | 6 +- sc/source/ui/app/scmod.cxx | 2 +- sc/source/ui/app/transobj.cxx | 4 +- sc/source/ui/dialogs/searchresults.cxx | 16 ++-- sc/source/ui/docshell/dbdocfun.cxx | 8 +- sc/source/ui/docshell/docfunc.cxx | 24 +++--- sc/source/ui/docshell/tablink.cxx | 4 +- sc/source/ui/inc/searchresults.hxx | 2 +- sc/source/ui/unoobj/cellsuno.cxx | 20 ++--- sc/source/ui/view/viewfun2.cxx | 2 +- sc/source/ui/view/viewfun3.cxx | 2 +- sc/source/ui/view/viewfun4.cxx | 2 +- 36 files changed, 182 insertions(+), 182 deletions(-) (limited to 'sc') diff --git a/sc/inc/autonamecache.hxx b/sc/inc/autonamecache.hxx index 3be8f87c922a..2f76b6d1e04b 100644 --- a/sc/inc/autonamecache.hxx +++ b/sc/inc/autonamecache.hxx @@ -32,11 +32,11 @@ typedef std::unordered_map< OUString, ScAutoNameAddresses > ScAutoNameHashMap; class SC_DLLPUBLIC ScAutoNameCache { ScAutoNameHashMap aNames; - ScDocument* pDoc; + ScDocument& rDoc; SCTAB nCurrentTab; public: - ScAutoNameCache( ScDocument* pD ); + ScAutoNameCache( ScDocument& pD ); ~ScAutoNameCache(); const ScAutoNameAddresses& GetNameOccurrences( const OUString& rName, SCTAB nTab ); diff --git a/sc/inc/detfunc.hxx b/sc/inc/detfunc.hxx index b8d1d2c0bc81..38de23a954ae 100644 --- a/sc/inc/detfunc.hxx +++ b/sc/inc/detfunc.hxx @@ -53,7 +53,7 @@ class SC_DLLPUBLIC ScDetectiveFunc static Color nCommentColor; static bool bColorsInitialized; - ScDocument* pDoc; + ScDocument& rDoc; SCTAB nTab; enum class DrawPosMode @@ -117,7 +117,7 @@ class SC_DLLPUBLIC ScDetectiveFunc void Modified(); public: - ScDetectiveFunc(ScDocument* pDocument, SCTAB nTable) : pDoc(pDocument),nTab(nTable) {} + ScDetectiveFunc(ScDocument& rDocument, SCTAB nTable) : rDoc(rDocument),nTab(nTable) {} bool ShowSucc( SCCOL nCol, SCROW nRow ); bool ShowPred( SCCOL nCol, SCROW nRow ); diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index 1418b0facfb2..fdb5b04a5e92 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -209,7 +209,7 @@ class ScCellIterator { typedef std::pair PositionType; - ScDocument* mpDoc; + ScDocument& mrDoc; ScAddress maStartPos; ScAddress maEndPos; ScAddress maCurPos; @@ -229,7 +229,7 @@ class ScCellIterator bool getCurrent(); public: - ScCellIterator( ScDocument* pDoc, const ScRange& rRange, SubtotalFlags nSubTotalFlags = SubtotalFlags::NONE ); + ScCellIterator( ScDocument& rDoc, const ScRange& rRange, SubtotalFlags nSubTotalFlags = SubtotalFlags::NONE ); const ScAddress& GetPos() const { return maCurPos; } @@ -395,7 +395,7 @@ public: class ScDocAttrIterator // all attribute areas { private: - ScDocument* pDoc; + ScDocument& rDoc; SCTAB nTab; SCCOL nEndCol; SCROW nStartRow; @@ -405,7 +405,7 @@ private: pColIter; public: - ScDocAttrIterator(ScDocument* pDocument, SCTAB nTable, + ScDocAttrIterator(ScDocument& rDocument, SCTAB nTable, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); ~ScDocAttrIterator(); diff --git a/sc/inc/formulaiter.hxx b/sc/inc/formulaiter.hxx index 2695255424f0..f49ca5c423a8 100644 --- a/sc/inc/formulaiter.hxx +++ b/sc/inc/formulaiter.hxx @@ -32,11 +32,11 @@ class ScFormulaCell; class ScDetectiveRefIter { private: - const ScDocument* mpDoc; + const ScDocument& mrDoc; formula::FormulaTokenArrayPlainIterator maIter; ScAddress aPos; public: - ScDetectiveRefIter( const ScDocument* pDoc, ScFormulaCell* pCell ); + ScDetectiveRefIter( const ScDocument& rDoc, ScFormulaCell* pCell ); bool GetNextRef( ScRange& rRange ); formula::FormulaToken* GetNextRefToken(); }; diff --git a/sc/inc/rangeseq.hxx b/sc/inc/rangeseq.hxx index dc3118ae0ed6..a9a055aba8aa 100644 --- a/sc/inc/rangeseq.hxx +++ b/sc/inc/rangeseq.hxx @@ -34,19 +34,19 @@ class ScRangeToSequence { public: static bool FillLongArray( css::uno::Any& rAny, - ScDocument* pDoc, const ScRange& rRange ); + ScDocument& rDoc, const ScRange& rRange ); static bool FillLongArray( css::uno::Any& rAny, const ScMatrix* pMatrix ); static bool FillDoubleArray( css::uno::Any& rAny, - ScDocument* pDoc, const ScRange& rRange ); + ScDocument& rDoc, const ScRange& rRange ); static bool FillDoubleArray( css::uno::Any& rAny, const ScMatrix* pMatrix ); static bool FillStringArray( css::uno::Any& rAny, - ScDocument* pDoc, const ScRange& rRange ); + ScDocument& rDoc, const ScRange& rRange ); static bool FillStringArray( css::uno::Any& rAny, const ScMatrix* pMatrix, SvNumberFormatter* pFormatter ); static bool FillMixedArray( css::uno::Any& rAny, - ScDocument* pDoc, const ScRange& rRange, + ScDocument& rDoc, const ScRange& rRange, bool bAllowNV = false ); /** @param bDataTypes diff --git a/sc/source/core/data/autonamecache.cxx b/sc/source/core/data/autonamecache.cxx index bd30352f1d1f..a2be03c25796 100644 --- a/sc/source/core/data/autonamecache.cxx +++ b/sc/source/core/data/autonamecache.cxx @@ -24,8 +24,8 @@ #include #include -ScAutoNameCache::ScAutoNameCache( ScDocument* pD ) : - pDoc( pD ), +ScAutoNameCache::ScAutoNameCache( ScDocument& rD ) : + rDoc( rD ), nCurrentTab( 0 ) // doesn't matter - aNames is empty { } @@ -49,7 +49,7 @@ const ScAutoNameAddresses& ScAutoNameCache::GetNameOccurrences( const OUString& ScAutoNameAddresses& rAddresses = aNames[rName]; - ScCellIterator aIter( pDoc, ScRange( 0, 0, nCurrentTab, pDoc->MaxCol(), pDoc->MaxRow(), nCurrentTab ) ); + ScCellIterator aIter( rDoc, ScRange( 0, 0, nCurrentTab, rDoc.MaxCol(), rDoc.MaxRow(), nCurrentTab ) ); for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next()) { // don't check code length here, always use the stored result diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index d7ff6613eecc..58594fd35d7d 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -831,8 +831,8 @@ sc::FormulaGroupEntry* ScFormulaGroupIterator::next() return &maEntries[mnIndex++]; } -ScCellIterator::ScCellIterator( ScDocument* pDoc, const ScRange& rRange, SubtotalFlags nSubTotalFlags ) : - mpDoc(pDoc), +ScCellIterator::ScCellIterator( ScDocument& rDoc, const ScRange& rRange, SubtotalFlags nSubTotalFlags ) : + mrDoc(rDoc), maStartPos(rRange.aStart), maEndPos(rRange.aEnd), mnSubTotalFlags(nSubTotalFlags) @@ -869,36 +869,36 @@ void ScCellIterator::setPos(size_t nPos) const ScColumn* ScCellIterator::getColumn() const { - return &mpDoc->maTabs[maCurPos.Tab()]->aCol[maCurPos.Col()]; + return &mrDoc.maTabs[maCurPos.Tab()]->aCol[maCurPos.Col()]; } void ScCellIterator::init() { - SCTAB nDocMaxTab = mpDoc->GetTableCount() - 1; + SCTAB nDocMaxTab = mrDoc.GetTableCount() - 1; PutInOrder(maStartPos, maEndPos); - if (!mpDoc->ValidCol(maStartPos.Col())) maStartPos.SetCol(mpDoc->MaxCol()); - if (!mpDoc->ValidCol(maEndPos.Col())) maEndPos.SetCol(mpDoc->MaxCol()); - if (!mpDoc->ValidRow(maStartPos.Row())) maStartPos.SetRow(mpDoc->MaxRow()); - if (!mpDoc->ValidRow(maEndPos.Row())) maEndPos.SetRow(mpDoc->MaxRow()); + if (!mrDoc.ValidCol(maStartPos.Col())) maStartPos.SetCol(mrDoc.MaxCol()); + if (!mrDoc.ValidCol(maEndPos.Col())) maEndPos.SetCol(mrDoc.MaxCol()); + if (!mrDoc.ValidRow(maStartPos.Row())) maStartPos.SetRow(mrDoc.MaxRow()); + if (!mrDoc.ValidRow(maEndPos.Row())) maEndPos.SetRow(mrDoc.MaxRow()); if (!ValidTab(maStartPos.Tab(), nDocMaxTab)) maStartPos.SetTab(nDocMaxTab); if (!ValidTab(maEndPos.Tab(), nDocMaxTab)) maEndPos.SetTab(nDocMaxTab); - while (maEndPos.Tab() > 0 && !mpDoc->maTabs[maEndPos.Tab()]) + while (maEndPos.Tab() > 0 && !mrDoc.maTabs[maEndPos.Tab()]) maEndPos.IncTab(-1); // Only the tables in use if (maStartPos.Tab() > maEndPos.Tab()) maStartPos.SetTab(maEndPos.Tab()); - if (!mpDoc->maTabs[maStartPos.Tab()]) + if (!mrDoc.maTabs[maStartPos.Tab()]) { assert(!"Table not found"); - maStartPos = ScAddress(mpDoc->MaxCol()+1, mpDoc->MaxRow()+1, MAXTAB+1); // -> Abort on GetFirst. + maStartPos = ScAddress(mrDoc.MaxCol()+1, mrDoc.MaxRow()+1, MAXTAB+1); // -> Abort on GetFirst. } else { - maStartPos.SetCol(mpDoc->maTabs[maStartPos.Tab()]->ClampToAllocatedColumns(maStartPos.Col())); + maStartPos.SetCol(mrDoc.maTabs[maStartPos.Tab()]->ClampToAllocatedColumns(maStartPos.Col())); } maCurPos = maStartPos; @@ -924,7 +924,7 @@ bool ScCellIterator::getCurrent() do { maCurPos.IncCol(); - if (maCurPos.Col() >= mpDoc->GetAllocatedColumnsCount(maCurPos.Tab()) + if (maCurPos.Col() >= mrDoc.GetAllocatedColumnsCount(maCurPos.Tab()) || maCurPos.Col() > maEndPos.Col()) { maCurPos.SetCol(maStartPos.Col()); @@ -982,7 +982,7 @@ bool ScCellIterator::getCurrent() OUString ScCellIterator::getString() const { - return maCurCell.getString(mpDoc); + return maCurCell.getString(&mrDoc); } ScCellValue ScCellIterator::getCellValue() const @@ -1023,7 +1023,7 @@ bool ScCellIterator::isEmpty() const bool ScCellIterator::equalsWithoutFormat( const ScAddress& rPos ) const { - ScRefCellValue aOther(*mpDoc, rPos); + ScRefCellValue aOther(mrDoc, rPos); return maCurCell.equalsWithoutFormat(aOther); } @@ -2628,21 +2628,21 @@ bool ScUsedAreaIterator::GetNext() return bFound; } -ScDocAttrIterator::ScDocAttrIterator(ScDocument* pDocument, SCTAB nTable, +ScDocAttrIterator::ScDocAttrIterator(ScDocument& rDocument, SCTAB nTable, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) : - pDoc( pDocument ), + rDoc( rDocument ), nTab( nTable ), nEndCol( nCol2 ), nStartRow( nRow1 ), nEndRow( nRow2 ), nCol( nCol1 ) { - if ( ValidTab(nTab) && nTab < pDoc->GetTableCount() && pDoc->maTabs[nTab] - && nCol < pDoc->maTabs[nTab]->GetAllocatedColumnsCount()) + if ( ValidTab(nTab) && nTab < rDoc.GetTableCount() && rDoc.maTabs[nTab] + && nCol < rDoc.maTabs[nTab]->GetAllocatedColumnsCount()) { - nEndCol = pDoc->maTabs[nTab]->ClampToAllocatedColumns(nEndCol); - pColIter = pDoc->maTabs[nTab]->aCol[nCol].CreateAttrIterator( nStartRow, nEndRow ); + nEndCol = rDoc.maTabs[nTab]->ClampToAllocatedColumns(nEndCol); + pColIter = rDoc.maTabs[nTab]->aCol[nCol].CreateAttrIterator( nStartRow, nEndRow ); } } @@ -2663,7 +2663,7 @@ const ScPatternAttr* ScDocAttrIterator::GetNext( SCCOL& rCol, SCROW& rRow1, SCRO ++nCol; if ( nCol <= nEndCol ) - pColIter = pDoc->maTabs[nTab]->aCol[nCol].CreateAttrIterator( nStartRow, nEndRow ); + pColIter = rDoc.maTabs[nTab]->aCol[nCol].CreateAttrIterator( nStartRow, nEndRow ); else pColIter.reset(); } diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index f0d1e28c1947..a278e2af7355 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -762,7 +762,7 @@ bool ScDocument::DoSubTotals( SCTAB nTab, ScSubTotalParam& rParam ) bool ScDocument::HasSubTotalCells( const ScRange& rRange ) { - ScCellIterator aIter( this, rRange ); + ScCellIterator aIter(*this, rRange); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { if (aIter.getType() != CELLTYPE_FORMULA) @@ -1655,7 +1655,7 @@ void ScDocument::GetFormulaEntries( ScTypedCaseStrSet& rStrings ) { const ScRangePair & rPair = (*pList)[i]; const ScRange & rRange = rPair.GetRange(0); - ScCellIterator aIter( this, rRange ); + ScCellIterator aIter( *this, rRange ); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { if (!aIter.hasString()) diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 553b7e5f42af..00080411135d 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3978,7 +3978,7 @@ void ScDocument::CompileXML() // set AutoNameCache to speed up automatic name lookup OSL_ENSURE( !pAutoNameCache, "AutoNameCache already set" ); - pAutoNameCache.reset( new ScAutoNameCache( this ) ); + pAutoNameCache.reset( new ScAutoNameCache( *this ) ); if (pRangeName) pRangeName->CompileUnresolvedXML(aCxt); @@ -4653,7 +4653,7 @@ SCROW ScDocument::GetNextDifferentChangedRow( SCTAB nTab, SCROW nStart) const void ScDocument::GetColDefault( SCTAB nTab, SCCOL nCol, SCROW nLastRow, SCROW& nDefault) { nDefault = 0; - ScDocAttrIterator aDocAttrItr(this, nTab, nCol, 0, nCol, nLastRow); + ScDocAttrIterator aDocAttrItr(*this, nTab, nCol, 0, nCol, nLastRow); SCCOL nColumn; SCROW nStartRow; SCROW nEndRow; @@ -6407,9 +6407,9 @@ void ScDocument::RemoveSubTotalCell(ScFormulaCell* pCell) namespace { -bool lcl_hasDirtyRange(const ScDocument* pDoc, ScFormulaCell* pCell, const ScRange& rDirtyRange) +bool lcl_hasDirtyRange(const ScDocument& rDoc, ScFormulaCell* pCell, const ScRange& rDirtyRange) { - ScDetectiveRefIter aRefIter(pDoc, pCell); + ScDetectiveRefIter aRefIter(rDoc, pCell); ScRange aRange; while (aRefIter.GetNextRef(aRange)) { @@ -6433,7 +6433,7 @@ void ScDocument::SetSubTotalCellsDirty(const ScRange& rDirtyRange) if (pCell->IsSubTotal()) { aNewSet.insert(pCell); - if (lcl_hasDirtyRange(this, pCell, rDirtyRange)) + if (lcl_hasDirtyRange(*this, pCell, rDirtyRange)) pCell->SetDirty(); } } diff --git a/sc/source/core/data/formulaiter.cxx b/sc/source/core/data/formulaiter.cxx index f05eea9e2d99..d7f183b2a0a2 100644 --- a/sc/source/core/data/formulaiter.cxx +++ b/sc/source/core/data/formulaiter.cxx @@ -26,8 +26,8 @@ using namespace formula; -ScDetectiveRefIter::ScDetectiveRefIter( const ScDocument* pDoc, ScFormulaCell* pCell ) : - mpDoc(pDoc), +ScDetectiveRefIter::ScDetectiveRefIter( const ScDocument& rDoc, ScFormulaCell* pCell ) : + mrDoc(rDoc), maIter(*pCell->GetCode()), aPos(pCell->aPos) { @@ -56,8 +56,8 @@ bool ScDetectiveRefIter::GetNextRef( ScRange& rRange ) if( p ) { SingleDoubleRefProvider aProv( *p ); - rRange.aStart = aProv.Ref1.toAbs(*mpDoc, aPos); - rRange.aEnd = aProv.Ref2.toAbs(*mpDoc, aPos); + rRange.aStart = aProv.Ref1.toAbs(mrDoc, aPos); + rRange.aEnd = aProv.Ref2.toAbs(mrDoc, aPos); bRet = true; } @@ -67,7 +67,7 @@ bool ScDetectiveRefIter::GetNextRef( ScRange& rRange ) formula::FormulaToken* ScDetectiveRefIter::GetNextRefToken() { formula::FormulaToken* p = maIter.GetNextReferenceRPN(); - while (p && lcl_ScDetectiveRefIter_SkipRef(*mpDoc, p, aPos)) + while (p && lcl_ScDetectiveRefIter_SkipRef(mrDoc, p, aPos)) { p = maIter.GetNextReferenceRPN(); } diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 3f91e77fab27..c64dbf9b0d72 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -2239,7 +2239,7 @@ void ScTable::FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCC if (!ColHidden(nCol)) { SCSIZE nArrY = 0; - ScDocAttrIterator aIter( &rDocument, nTab, nCol, nY1, nCol, nY2 ); + ScDocAttrIterator aIter( rDocument, nTab, nCol, nY1, nCol, nY2 ); SCCOL nAttrCol; SCROW nAttrRow1, nAttrRow2; const ScPatternAttr* pPattern = aIter.GetNext( nAttrCol, nAttrRow1, nAttrRow2 ); diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index 84848a57e540..3818e5b74bee 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -2555,7 +2555,7 @@ void ScChangeTrack::LookUpContents( const ScRange& rOrgRange, ScAddress aPos; ScBigAddress aBigPos; - ScCellIterator aIter( pRefDoc, rOrgRange ); + ScCellIterator aIter( *pRefDoc, rOrgRange ); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { if (!ScChangeActionContent::GetContentCellType(aIter.getRefCellValue())) @@ -2771,7 +2771,7 @@ void ScChangeTrack::AppendContentRange( const ScRange& rRange, void ScChangeTrack::AppendContentsIfInRefDoc( ScDocument& rRefDoc, sal_uLong& nStartAction, sal_uLong& nEndAction ) { - ScCellIterator aIter(&rRefDoc, ScRange(0,0,0,rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB)); + ScCellIterator aIter(rRefDoc, ScRange(0,0,0,rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB)); if (aIter.first()) { nStartAction = GetActionMax() + 1; diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index c5c8c5d28ced..ffb01aa90b19 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -3579,7 +3579,7 @@ bool ScCompiler::IsColRowName( const OUString& rName ) if ( jThisTab && (rNameRange.aStart.Tab() > nThisTab || nThisTab > rNameRange.aEnd.Tab()) ) continue; // for - ScCellIterator aIter( &rDoc, rNameRange ); + ScCellIterator aIter( rDoc, rNameRange ); for (bool bHas = aIter.first(); bHas && !bInList; bHas = aIter.next()) { // Don't crash if cell (via CompileNameFormula) encounters @@ -3687,7 +3687,7 @@ bool ScCompiler::IsColRowName( const OUString& rName ) } else { - ScCellIterator aIter( &rDoc, ScRange( aOne, aTwo ) ); + ScCellIterator aIter( rDoc, ScRange( aOne, aTwo ) ); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { if ( bFound ) @@ -3942,7 +3942,7 @@ bool ScCompiler::IsTableRefColumn( const OUString& rName ) const if (pDBData->HasHeader()) { // Quite similar to IsColRowName() but limited to one row of headers. - ScCellIterator aIter( &rDoc, aRange); + ScCellIterator aIter( rDoc, aRange); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { CellType eType = aIter.getType(); diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index 2df199e2f7dd..7393144f764c 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -279,7 +279,7 @@ void ScCommentData::UpdateCaptionSet( const SfxItemSet& rItemSet ) void ScDetectiveFunc::Modified() { - pDoc->SetStreamValid(nTab, false); + rDoc.SetStreamValid(nTab, false); } static bool Intersect( SCCOL nStartCol1, SCROW nStartRow1, SCCOL nEndCol1, SCROW nEndRow1, @@ -294,7 +294,7 @@ bool ScDetectiveFunc::HasError( const ScRange& rRange, ScAddress& rErrPos ) rErrPos = rRange.aStart; FormulaError nError = FormulaError::NONE; - ScCellIterator aIter( pDoc, rRange); + ScCellIterator aIter( rDoc, rRange); for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next()) { if (aIter.getType() != CELLTYPE_FORMULA) @@ -310,9 +310,9 @@ bool ScDetectiveFunc::HasError( const ScRange& rRange, ScAddress& rErrPos ) Point ScDetectiveFunc::GetDrawPos( SCCOL nCol, SCROW nRow, DrawPosMode eMode ) const { - OSL_ENSURE( pDoc->ValidColRow( nCol, nRow ), "ScDetectiveFunc::GetDrawPos - invalid cell address" ); - nCol = pDoc->SanitizeCol( nCol ); - nRow = pDoc->SanitizeRow( nRow ); + OSL_ENSURE( rDoc.ValidColRow( nCol, nRow ), "ScDetectiveFunc::GetDrawPos - invalid cell address" ); + nCol = rDoc.SanitizeCol( nCol ); + nRow = rDoc.SanitizeRow( nRow ); Point aPos; @@ -325,19 +325,19 @@ Point ScDetectiveFunc::GetDrawPos( SCCOL nCol, SCROW nRow, DrawPosMode eMode ) c ++nRow; break; case DrawPosMode::DetectiveArrow: - aPos.AdjustX(pDoc->GetColWidth( nCol, nTab ) / 4 ); - aPos.AdjustY(pDoc->GetRowHeight( nRow, nTab ) / 2 ); + aPos.AdjustX(rDoc.GetColWidth( nCol, nTab ) / 4 ); + aPos.AdjustY(rDoc.GetRowHeight( nRow, nTab ) / 2 ); break; } for ( SCCOL i = 0; i < nCol; ++i ) - aPos.AdjustX(pDoc->GetColWidth( i, nTab ) ); - aPos.AdjustY(pDoc->GetRowHeight( 0, nRow - 1, nTab ) ); + aPos.AdjustX(rDoc.GetColWidth( i, nTab ) ); + aPos.AdjustY(rDoc.GetRowHeight( 0, nRow - 1, nTab ) ); aPos.setX( static_cast< long >( aPos.X() * HMM_PER_TWIPS ) ); aPos.setY( static_cast< long >( aPos.Y() * HMM_PER_TWIPS ) ); - if ( pDoc->IsNegativePage( nTab ) ) + if ( rDoc.IsNegativePage( nTab ) ) aPos.setX( aPos.X() * -1 ); return aPos; @@ -394,7 +394,7 @@ bool ScDetectiveFunc::HasArrow( const ScAddress& rStart, if (!bEndAlien) aEndRect = GetDrawRect( nEndCol, nEndRow ); - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); SdrPage* pPage = pModel->GetPage(static_cast(nTab)); OSL_ENSURE(pPage,"Page ?"); @@ -453,7 +453,7 @@ void ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow, bool bFromOtherTab, bool bRed, ScDetectiveData& rData ) { - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); SdrPage* pPage = pModel->GetPage(static_cast(nTab)); bool bArea = ( nRefStartCol != nRefEndCol || nRefStartRow != nRefEndRow ); @@ -482,7 +482,7 @@ void ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow, if (bFromOtherTab) { - bool bNegativePage = pDoc->IsNegativePage( nTab ); + bool bNegativePage = rDoc.IsNegativePage( nTab ); long nPageSign = bNegativePage ? -1 : 1; aStartPos = Point( aEndPos.X() - 1000 * nPageSign, aEndPos.Y() - 1000 ); @@ -532,7 +532,7 @@ void ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, bool bRed, ScDetectiveData& rData ) { - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); SdrPage* pPage = pModel->GetPage(static_cast(nTab)); bool bArea = ( nStartCol != nEndCol || nStartRow != nEndRow ); @@ -554,7 +554,7 @@ void ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow, pData->maEnd.Set( nEndCol, nEndRow, nTab); } - bool bNegativePage = pDoc->IsNegativePage( nTab ); + bool bNegativePage = rDoc.IsNegativePage( nTab ); long nPageSign = bNegativePage ? -1 : 1; Point aStartPos = GetDrawPos( nStartCol, nStartRow, DrawPosMode::DetectiveArrow ); @@ -635,7 +635,7 @@ bool ScDetectiveFunc::DrawAlienEntry( const ScRange& rRef, void ScDetectiveFunc::DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rData ) { - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); SdrPage* pPage = pModel->GetPage(static_cast(nTab)); tools::Rectangle aRect = GetDrawRect( nCol, nRow ); @@ -668,7 +668,7 @@ void ScDetectiveFunc::DeleteArrowsAt( SCCOL nCol, SCROW nRow, bool bDestPnt ) { tools::Rectangle aRect = GetDrawRect( nCol, nRow ); - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); SdrPage* pPage = pModel->GetPage(static_cast(nTab)); OSL_ENSURE(pPage,"Page ?"); @@ -741,7 +741,7 @@ void ScDetectiveFunc::DeleteBox( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nR Point aEndCorner = aCornerRect.BottomRight(); tools::Rectangle aObjRect; - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); SdrPage* pPage = pModel->GetPage(static_cast(nTab)); OSL_ENSURE(pPage,"Page ?"); @@ -786,7 +786,7 @@ sal_uInt16 ScDetectiveFunc::InsertPredLevelArea( const ScRange& rRef, { sal_uInt16 nResult = DET_INS_EMPTY; - ScCellIterator aIter( pDoc, rRef); + ScCellIterator aIter( rDoc, rRef); for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next()) { if (aIter.getType() != CELLTYPE_FORMULA) @@ -817,7 +817,7 @@ sal_uInt16 ScDetectiveFunc::InsertPredLevelArea( const ScRange& rRef, sal_uInt16 ScDetectiveFunc::InsertPredLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData, sal_uInt16 nLevel ) { - ScRefCellValue aCell(*pDoc, ScAddress(nCol, nRow, nTab)); + ScRefCellValue aCell(rDoc, ScAddress(nCol, nRow, nTab)); if (aCell.meType != CELLTYPE_FORMULA) return DET_INS_EMPTY; @@ -831,7 +831,7 @@ sal_uInt16 ScDetectiveFunc::InsertPredLevel( SCCOL nCol, SCROW nRow, ScDetective sal_uInt16 nResult = DET_INS_EMPTY; - ScDetectiveRefIter aIter(pDoc, pFCell); + ScDetectiveRefIter aIter(rDoc, pFCell); ScRange aRef; while ( aIter.GetNextRef( aRef ) ) { @@ -885,7 +885,7 @@ sal_uInt16 ScDetectiveFunc::FindPredLevelArea( const ScRange& rRef, { sal_uInt16 nResult = nLevel; - ScCellIterator aCellIter( pDoc, rRef); + ScCellIterator aCellIter( rDoc, rRef); for (bool bHasCell = aCellIter.first(); bHasCell; bHasCell = aCellIter.next()) { if (aCellIter.getType() != CELLTYPE_FORMULA) @@ -905,7 +905,7 @@ sal_uInt16 ScDetectiveFunc::FindPredLevel( SCCOL nCol, SCROW nRow, sal_uInt16 nL { OSL_ENSURE( nLevel<1000, "Level" ); - ScRefCellValue aCell(*pDoc, ScAddress(nCol, nRow, nTab)); + ScRefCellValue aCell(rDoc, ScAddress(nCol, nRow, nTab)); if (aCell.meType != CELLTYPE_FORMULA) return nLevel; @@ -925,7 +925,7 @@ sal_uInt16 ScDetectiveFunc::FindPredLevel( SCCOL nCol, SCROW nRow, sal_uInt16 nL DeleteArrowsAt( nCol, nRow, true ); // arrows, that are pointing here } - ScDetectiveRefIter aIter(pDoc, pFCell); + ScDetectiveRefIter aIter(rDoc, pFCell); ScRange aRef; while ( aIter.GetNextRef( aRef) ) { @@ -962,7 +962,7 @@ sal_uInt16 ScDetectiveFunc::FindPredLevel( SCCOL nCol, SCROW nRow, sal_uInt16 nL sal_uInt16 ScDetectiveFunc::InsertErrorLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData, sal_uInt16 nLevel ) { - ScRefCellValue aCell(*pDoc, ScAddress(nCol, nRow, nTab)); + ScRefCellValue aCell(rDoc, ScAddress(nCol, nRow, nTab)); if (aCell.meType != CELLTYPE_FORMULA) return DET_INS_EMPTY; @@ -976,7 +976,7 @@ sal_uInt16 ScDetectiveFunc::InsertErrorLevel( SCCOL nCol, SCROW nRow, ScDetectiv sal_uInt16 nResult = DET_INS_EMPTY; - ScDetectiveRefIter aIter(pDoc, pFCell); + ScDetectiveRefIter aIter(rDoc, pFCell); ScRange aRef; ScAddress aErrorPos; bool bHasError = false; @@ -1013,7 +1013,7 @@ sal_uInt16 ScDetectiveFunc::InsertSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCo // over the entire document. sal_uInt16 nResult = DET_INS_EMPTY; - ScCellIterator aCellIter(pDoc, ScRange(0,0,0,pDoc->MaxCol(),pDoc->MaxRow(),MAXTAB)); // all sheets + ScCellIterator aCellIter(rDoc, ScRange(0,0,0,rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB)); // all sheets for (bool bHas = aCellIter.first(); bHas; bHas = aCellIter.next()) { if (aCellIter.getType() != CELLTYPE_FORMULA) @@ -1026,7 +1026,7 @@ sal_uInt16 ScDetectiveFunc::InsertSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCo pFCell->Interpret(); // can't be called after SetRunning pFCell->SetRunning(true); - ScDetectiveRefIter aIter(pDoc, pFCell); + ScDetectiveRefIter aIter(rDoc, pFCell); ScRange aRef; while ( aIter.GetNextRef( aRef) ) { @@ -1101,7 +1101,7 @@ sal_uInt16 ScDetectiveFunc::FindSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2 sal_uInt16 nResult = nLevel; bool bDelete = ( nDeleteLevel && nLevel == nDeleteLevel-1 ); - ScCellIterator aCellIter( pDoc, ScRange(0, 0, nTab, pDoc->MaxCol(), pDoc->MaxRow(), nTab) ); + ScCellIterator aCellIter( rDoc, ScRange(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab) ); for (bool bHas = aCellIter.first(); bHas; bHas = aCellIter.next()) { if (aCellIter.getType() != CELLTYPE_FORMULA) @@ -1114,7 +1114,7 @@ sal_uInt16 ScDetectiveFunc::FindSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2 pFCell->Interpret(); // can't be called after SetRunning pFCell->SetRunning(true); - ScDetectiveRefIter aIter(pDoc, pFCell); + ScDetectiveRefIter aIter(rDoc, pFCell); ScRange aRef; while ( aIter.GetNextRef( aRef) ) { @@ -1155,7 +1155,7 @@ sal_uInt16 ScDetectiveFunc::FindSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2 bool ScDetectiveFunc::ShowPred( SCCOL nCol, SCROW nRow ) { - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); if (!pModel) return false; @@ -1175,7 +1175,7 @@ bool ScDetectiveFunc::ShowPred( SCCOL nCol, SCROW nRow ) bool ScDetectiveFunc::ShowSucc( SCCOL nCol, SCROW nRow ) { - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); if (!pModel) return false; @@ -1195,7 +1195,7 @@ bool ScDetectiveFunc::ShowSucc( SCCOL nCol, SCROW nRow ) bool ScDetectiveFunc::ShowError( SCCOL nCol, SCROW nRow ) { - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); if (!pModel) return false; @@ -1214,7 +1214,7 @@ bool ScDetectiveFunc::ShowError( SCCOL nCol, SCROW nRow ) bool ScDetectiveFunc::DeleteSucc( SCCOL nCol, SCROW nRow ) { - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); if (!pModel) return false; @@ -1227,7 +1227,7 @@ bool ScDetectiveFunc::DeleteSucc( SCCOL nCol, SCROW nRow ) bool ScDetectiveFunc::DeletePred( SCCOL nCol, SCROW nRow ) { - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); if (!pModel) return false; @@ -1240,7 +1240,7 @@ bool ScDetectiveFunc::DeletePred( SCCOL nCol, SCROW nRow ) bool ScDetectiveFunc::DeleteAll( ScDetectiveDelete eWhat ) { - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); if (!pModel) return false; @@ -1298,7 +1298,7 @@ bool ScDetectiveFunc::DeleteAll( ScDetectiveDelete eWhat ) bool ScDetectiveFunc::MarkInvalid(bool& rOverflow) { rOverflow = false; - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); if (!pModel) return false; @@ -1308,7 +1308,7 @@ bool ScDetectiveFunc::MarkInvalid(bool& rOverflow) long nInsCount = 0; // search for valid places - ScDocAttrIterator aAttrIter( pDoc, nTab, 0,0,pDoc->MaxCol(),pDoc->MaxRow() ); + ScDocAttrIterator aAttrIter( rDoc, nTab, 0,0,rDoc.MaxCol(),rDoc.MaxRow() ); SCCOL nCol; SCROW nRow1; SCROW nRow2; @@ -1318,7 +1318,7 @@ bool ScDetectiveFunc::MarkInvalid(bool& rOverflow) sal_uLong nIndex = pPattern->GetItem(ATTR_VALIDDATA).GetValue(); if (nIndex) { - const ScValidationData* pData = pDoc->GetValidationEntry( nIndex ); + const ScValidationData* pData = rDoc.GetValidationEntry( nIndex ); if ( pData ) { // pass cells in this area @@ -1326,7 +1326,7 @@ bool ScDetectiveFunc::MarkInvalid(bool& rOverflow) bool bMarkEmpty = !pData->IsIgnoreBlank(); SCROW nNextRow = nRow1; SCROW nRow; - ScCellIterator aCellIter( pDoc, ScRange(nCol, nRow1, nTab, nCol, nRow2, nTab) ); + ScCellIterator aCellIter( rDoc, ScRange(nCol, nRow1, nTab, nCol, nRow2, nTab) ); for (bool bHas = aCellIter.first(); bHas && nInsCount < SC_DET_MAXCIRCLE; bHas = aCellIter.next()) { SCROW nCellRow = aCellIter.GetPos().Row(); @@ -1365,18 +1365,18 @@ bool ScDetectiveFunc::MarkInvalid(bool& rOverflow) void ScDetectiveFunc::GetAllPreds(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, vector& rRefTokens) { - ScCellIterator aIter(pDoc, ScRange(nCol1, nRow1, nTab, nCol2, nRow2, nTab)); + ScCellIterator aIter(rDoc, ScRange(nCol1, nRow1, nTab, nCol2, nRow2, nTab)); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { if (aIter.getType() != CELLTYPE_FORMULA) continue; ScFormulaCell* pFCell = aIter.getFormulaCell(); - ScDetectiveRefIter aRefIter(pDoc, pFCell); + ScDetectiveRefIter aRefIter(rDoc, pFCell); for (formula::FormulaToken* p = aRefIter.GetNextRefToken(); p; p = aRefIter.GetNextRefToken()) { ScTokenRef pRef(p->Clone()); - ScRefTokenHelper::join(pDoc, rRefTokens, pRef, aIter.GetPos()); + ScRefTokenHelper::join(&rDoc, rRefTokens, pRef, aIter.GetPos()); } } } @@ -1386,25 +1386,25 @@ void ScDetectiveFunc::GetAllSuccs(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW n { vector aSrcRange; aSrcRange.push_back( - ScRefTokenHelper::createRefToken(pDoc, ScRange(nCol1, nRow1, nTab, nCol2, nRow2, nTab))); + ScRefTokenHelper::createRefToken(&rDoc, ScRange(nCol1, nRow1, nTab, nCol2, nRow2, nTab))); - ScCellIterator aIter(pDoc, ScRange(0, 0, nTab, pDoc->MaxCol(), pDoc->MaxRow(), nTab)); + ScCellIterator aIter(rDoc, ScRange(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab)); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { if (aIter.getType() != CELLTYPE_FORMULA) continue; ScFormulaCell* pFCell = aIter.getFormulaCell(); - ScDetectiveRefIter aRefIter(pDoc, pFCell); + ScDetectiveRefIter aRefIter(rDoc, pFCell); for (formula::FormulaToken* p = aRefIter.GetNextRefToken(); p; p = aRefIter.GetNextRefToken()) { const ScAddress& aPos = aIter.GetPos(); ScTokenRef pRef(p->Clone()); - if (ScRefTokenHelper::intersects(pDoc, aSrcRange, pRef, aPos)) + if (ScRefTokenHelper::intersects(&rDoc, aSrcRange, pRef, aPos)) { // This address is absolute. - pRef = ScRefTokenHelper::createRefToken(pDoc, aPos); - ScRefTokenHelper::join(pDoc, rRefTokens, pRef, ScAddress()); + pRef = ScRefTokenHelper::createRefToken(&rDoc, aPos); + ScRefTokenHelper::join(&rDoc, rRefTokens, pRef, ScAddress()); } } } @@ -1458,11 +1458,11 @@ void ScDetectiveFunc::UpdateAllArrowColors() { // no undo actions necessary - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); if (!pModel) return; - for( SCTAB nObjTab = 0, nTabCount = pDoc->GetTableCount(); nObjTab < nTabCount; ++nObjTab ) + for( SCTAB nObjTab = 0, nTabCount = rDoc.GetTableCount(); nObjTab < nTabCount; ++nObjTab ) { SdrPage* pPage = pModel->GetPage( static_cast< sal_uInt16 >( nObjTab ) ); OSL_ENSURE( pPage, "Page ?" ); @@ -1537,7 +1537,7 @@ void ScDetectiveFunc::FindFrameForObject( const SdrObject* pObject, ScRange& rRa // find the rectangle for an arrow (always the object directly before the arrow) // rRange must be initialized to the source cell of the arrow (start of area) - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); if (!pModel) return; SdrPage* pPage = pModel->GetPage(static_cast(nTab)); @@ -1633,7 +1633,7 @@ void ScDetectiveFunc::InsertObject( ScDetectiveObjType eType, const ScAddress& rPosition, const ScRange& rSource, bool bRedLine ) { - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); if (!pModel) return; ScDetectiveData aData( pModel ); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index cc2c337f3930..5616cc35bb6f 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -5156,7 +5156,7 @@ void ScInterpreter::ScCountEmptyCells() static_cast(aRange.aEnd.Col() - aRange.aStart.Col() + 1) * static_cast(aRange.aEnd.Tab() - aRange.aStart.Tab() + 1); - ScCellIterator aIter( &mrDoc, aRange, mnSubTotalFlags); + ScCellIterator aIter( mrDoc, aRange, mnSubTotalFlags); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { const ScRefCellValue& rCell = aIter.getRefCellValue(); diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index d63698c0411f..95670a9df55c 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -2796,7 +2796,7 @@ void ScInterpreter::ScExternal() { ScRange aRange; PopDoubleRef( aRange ); - if (!ScRangeToSequence::FillLongArray( aParam, &mrDoc, aRange )) + if (!ScRangeToSequence::FillLongArray( aParam, mrDoc, aRange )) SetError(FormulaError::IllegalParameter); } break; @@ -2827,7 +2827,7 @@ void ScInterpreter::ScExternal() { ScRange aRange; PopDoubleRef( aRange ); - if (!ScRangeToSequence::FillDoubleArray( aParam, &mrDoc, aRange )) + if (!ScRangeToSequence::FillDoubleArray( aParam, mrDoc, aRange )) SetError(FormulaError::IllegalParameter); } break; @@ -2858,7 +2858,7 @@ void ScInterpreter::ScExternal() { ScRange aRange; PopDoubleRef( aRange ); - if (!ScRangeToSequence::FillStringArray( aParam, &mrDoc, aRange )) + if (!ScRangeToSequence::FillStringArray( aParam, mrDoc, aRange )) SetError(FormulaError::IllegalParameter); } break; @@ -2909,7 +2909,7 @@ void ScInterpreter::ScExternal() { ScRange aRange; PopDoubleRef( aRange ); - if (!ScRangeToSequence::FillMixedArray( aParam, &mrDoc, aRange )) + if (!ScRangeToSequence::FillMixedArray( aParam, mrDoc, aRange )) SetError(FormulaError::IllegalParameter); } break; @@ -2953,7 +2953,7 @@ void ScInterpreter::ScExternal() { ScRange aRange; PopDoubleRef( aRange ); - if (!ScRangeToSequence::FillMixedArray( aParam, &mrDoc, aRange )) + if (!ScRangeToSequence::FillMixedArray( aParam, mrDoc, aRange )) SetError(FormulaError::IllegalParameter); } break; diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 098d987aec2a..6de3e2d2150b 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -372,7 +372,7 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken SCROW nThisRow = nRow2; SCCOL nThisCol = nCol1 - 1; - ScCellIterator aCellIter( &mrDoc, ScRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2)); + ScCellIterator aCellIter( mrDoc, ScRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2)); for (bool bHas = aCellIter.first(); bHas; bHas = aCellIter.next()) { nThisCol = aCellIter.GetPos().Col(); diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx index 5fb8e3bd1124..f482b16e3549 100644 --- a/sc/source/core/tool/interpr6.cxx +++ b/sc/source/core/tool/interpr6.cxx @@ -810,7 +810,7 @@ void ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero ) } if( eFunc == ifCOUNT2 ) { - ScCellIterator aIter( &mrDoc, aRange, mnSubTotalFlags ); + ScCellIterator aIter( mrDoc, aRange, mnSubTotalFlags ); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { if ( !aIter.isEmpty() ) diff --git a/sc/source/core/tool/rangeseq.cxx b/sc/source/core/tool/rangeseq.cxx index cc20b1c7cb2f..04b4750fe517 100644 --- a/sc/source/core/tool/rangeseq.cxx +++ b/sc/source/core/tool/rangeseq.cxx @@ -33,10 +33,10 @@ using namespace com::sun::star; -static bool lcl_HasErrors( ScDocument* pDoc, const ScRange& rRange ) +static bool lcl_HasErrors( ScDocument& rDoc, const ScRange& rRange ) { // no need to look at empty cells - just use ScCellIterator - ScCellIterator aIter( pDoc, rRange ); + ScCellIterator aIter( rDoc, rRange ); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { if (aIter.getType() != CELLTYPE_FORMULA) @@ -59,7 +59,7 @@ static long lcl_DoubleToLong( double fVal ) return 0; // out of range } -bool ScRangeToSequence::FillLongArray( uno::Any& rAny, ScDocument* pDoc, const ScRange& rRange ) +bool ScRangeToSequence::FillLongArray( uno::Any& rAny, ScDocument& rDoc, const ScRange& rRange ) { SCTAB nTab = rRange.aStart.Tab(); SCCOL nStartCol = rRange.aStart.Col(); @@ -74,14 +74,14 @@ bool ScRangeToSequence::FillLongArray( uno::Any& rAny, ScDocument* pDoc, const S uno::Sequence aColSeq( nColCount ); sal_Int32* pColAry = aColSeq.getArray(); for (long nCol = 0; nCol < nColCount; nCol++) - pColAry[nCol] = lcl_DoubleToLong( pDoc->GetValue( + pColAry[nCol] = lcl_DoubleToLong( rDoc.GetValue( ScAddress( static_cast(nStartCol+nCol), static_cast(nStartRow+nRow), nTab ) ) ); pRowAry[nRow] = aColSeq; } rAny <<= aRowSeq; - return !lcl_HasErrors( pDoc, rRange ); + return !lcl_HasErrors( rDoc, rRange ); } bool ScRangeToSequence::FillLongArray( uno::Any& rAny, const ScMatrix* pMatrix ) @@ -112,7 +112,7 @@ bool ScRangeToSequence::FillLongArray( uno::Any& rAny, const ScMatrix* pMatrix ) return true; } -bool ScRangeToSequence::FillDoubleArray( uno::Any& rAny, ScDocument* pDoc, const ScRange& rRange ) +bool ScRangeToSequence::FillDoubleArray( uno::Any& rAny, ScDocument& rDoc, const ScRange& rRange ) { SCTAB nTab = rRange.aStart.Tab(); SCCOL nStartCol = rRange.aStart.Col(); @@ -127,14 +127,14 @@ bool ScRangeToSequence::FillDoubleArray( uno::Any& rAny, ScDocument* pDoc, const uno::Sequence aColSeq( nColCount ); double* pColAry = aColSeq.getArray(); for (long nCol = 0; nCol < nColCount; nCol++) - pColAry[nCol] = pDoc->GetValue( + pColAry[nCol] = rDoc.GetValue( ScAddress( static_cast(nStartCol+nCol), static_cast(nStartRow+nRow), nTab ) ); pRowAry[nRow] = aColSeq; } rAny <<= aRowSeq; - return !lcl_HasErrors( pDoc, rRange ); + return !lcl_HasErrors( rDoc, rRange ); } bool ScRangeToSequence::FillDoubleArray( uno::Any& rAny, const ScMatrix* pMatrix ) @@ -165,7 +165,7 @@ bool ScRangeToSequence::FillDoubleArray( uno::Any& rAny, const ScMatrix* pMatrix return true; } -bool ScRangeToSequence::FillStringArray( uno::Any& rAny, ScDocument* pDoc, const ScRange& rRange ) +bool ScRangeToSequence::FillStringArray( uno::Any& rAny, ScDocument& rDoc, const ScRange& rRange ) { SCTAB nTab = rRange.aStart.Tab(); SCCOL nStartCol = rRange.aStart.Col(); @@ -183,7 +183,7 @@ bool ScRangeToSequence::FillStringArray( uno::Any& rAny, ScDocument* pDoc, const OUString* pColAry = aColSeq.getArray(); for (long nCol = 0; nCol < nColCount; nCol++) { - FormulaError nErrCode = pDoc->GetStringForFormula( + FormulaError nErrCode = rDoc.GetStringForFormula( ScAddress(static_cast(nStartCol+nCol), static_cast(nStartRow+nRow), nTab), pColAry[nCol] ); if ( nErrCode != FormulaError::NONE ) @@ -236,7 +236,7 @@ bool ScRangeToSequence::FillStringArray( uno::Any& rAny, const ScMatrix* pMatrix return true; } -bool ScRangeToSequence::FillMixedArray( uno::Any& rAny, ScDocument* pDoc, const ScRange& rRange, +bool ScRangeToSequence::FillMixedArray( uno::Any& rAny, ScDocument& rDoc, const ScRange& rRange, bool bAllowNV ) { SCTAB nTab = rRange.aStart.Tab(); @@ -258,7 +258,7 @@ bool ScRangeToSequence::FillMixedArray( uno::Any& rAny, ScDocument* pDoc, const uno::Any& rElement = pColAry[nCol]; ScAddress aPos( static_cast(nStartCol+nCol), static_cast(nStartRow+nRow), nTab ); - ScRefCellValue aCell(*pDoc, aPos); + ScRefCellValue aCell(rDoc, aPos); if (aCell.isEmpty()) { @@ -274,7 +274,7 @@ bool ScRangeToSequence::FillMixedArray( uno::Any& rAny, ScDocument* pDoc, const else if (aCell.hasNumeric()) rElement <<= aCell.getValue(); else - rElement <<= aCell.getString(pDoc); + rElement <<= aCell.getString(&rDoc); } pRowAry[nRow] = aColSeq; } diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index e47fb744d281..ba6c017f4f3c 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -370,7 +370,7 @@ void FormulaBuffer::finalizeImport() ISegmentProgressBarRef xFormulaBar = getProgressBar().createSegment( getProgressBar().getFreeLength() ); ScDocumentImport& rDoc = getDocImport(); - rDoc.getDoc().SetAutoNameCache(std::make_unique(&rDoc.getDoc())); + rDoc.getDoc().SetAutoNameCache(std::make_unique(rDoc.getDoc())); ScExternalRefManager::ApiGuard aExtRefGuard(&rDoc.getDoc()); SCTAB nTabCount = rDoc.getDoc().GetTableCount(); diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 0f8afceceb8f..6ffdd64e3c26 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1279,7 +1279,7 @@ void XclObjAny::SaveXml( XclExpXmlStream& rStrm ) if (pObject) { ScDocument& rDoc = rStrm.GetRoot().GetDoc(); - ScDetectiveFunc aDetFunc(&rDoc, mnScTab); + ScDetectiveFunc aDetFunc(rDoc, mnScTab); ScAddress aPosition; ScRange aSourceRange; bool bRedLine; diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx index 1b108f3ffaa5..3950582bb468 100644 --- a/sc/source/filter/xml/XMLExportDataPilot.cxx +++ b/sc/source/filter/xml/XMLExportDataPilot.cxx @@ -759,7 +759,7 @@ void ScXMLExportDataPilot::WriteDataPilots() ScRange aOutRange((*pDPs)[i].GetOutRange()); OUString sTargetRangeAddress; ScRangeStringConverter::GetStringFromRange( sTargetRangeAddress, aOutRange, pDoc, ::formula::FormulaGrammar::CONV_OOO ); - ScDocAttrIterator aAttrItr(pDoc, aOutRange.aStart.Tab(), + ScDocAttrIterator aAttrItr(*pDoc, aOutRange.aStart.Tab(), aOutRange.aStart.Col(), aOutRange.aStart.Row(), aOutRange.aEnd.Col(), aOutRange.aEnd.Row()); SCCOL nCol; diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 0f07c4c59bf3..695276add693 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -961,7 +961,7 @@ void ScXMLTableRowCellContext::SetDetectiveObj( const ScAddress& rPosition ) return; LockSolarMutex(); - ScDetectiveFunc aDetFunc( pDoc, rPosition.Tab() ); + ScDetectiveFunc aDetFunc( *pDoc, rPosition.Tab() ); uno::Reference xShapesIndex = rXMLImport.GetTables().GetCurrentXShapes(); // make draw page for(const auto& rDetectiveObj : *pDetectiveObjVec) { diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index b2c06583719d..ce93ca8ee6fd 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -2690,7 +2690,7 @@ void ScXMLExport::CollectInternalShape( uno::Reference< drawing::XShape > const // other objects from internal layer only (detective) else if( pObject->GetLayer() == SC_LAYER_INTERN ) { - ScDetectiveFunc aDetFunc( pDoc, static_cast(nCurrentTable) ); + ScDetectiveFunc aDetFunc( *pDoc, static_cast(nCurrentTable) ); ScAddress aPosition; ScRange aSourceRange; bool bRedLine; diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx index e036a9fbd41e..d400e1123c93 100644 --- a/sc/source/ui/Accessibility/AccessibleCell.cxx +++ b/sc/source/ui/Accessibility/AccessibleCell.cxx @@ -387,14 +387,14 @@ void ScAccessibleCell::FillDependents(utl::AccessibleRelationSetHelper* pRelatio return; ScRange aRange(0, 0, maCellAddress.Tab(), mpDoc->MaxCol(), mpDoc->MaxRow(), maCellAddress.Tab()); - ScCellIterator aCellIter(mpDoc, aRange); + ScCellIterator aCellIter(*mpDoc, aRange); for (bool bHasCell = aCellIter.first(); bHasCell; bHasCell = aCellIter.next()) { if (aCellIter.getType() == CELLTYPE_FORMULA) { bool bFound = false; - ScDetectiveRefIter aIter(mpDoc, aCellIter.getFormulaCell()); + ScDetectiveRefIter aIter(*mpDoc, aCellIter.getFormulaCell()); ScRange aRef; while ( !bFound && aIter.GetNextRef( aRef ) ) { @@ -416,7 +416,7 @@ void ScAccessibleCell::FillPrecedents(utl::AccessibleRelationSetHelper* pRelatio if (aCell.meType == CELLTYPE_FORMULA) { ScFormulaCell* pCell = aCell.mpFormula; - ScDetectiveRefIter aIter(mpDoc, pCell); + ScDetectiveRefIter aIter(*mpDoc, pCell); ScRange aRef; while ( aIter.GetNextRef( aRef ) ) { diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 9426658f1894..06196ffd0b34 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -200,7 +200,7 @@ void ScModule::ConfigurationChanged( utl::ConfigurationBroadcaster* p, Configura { ScDocShell* pDocSh = static_cast(pObjSh); if ( bArrows ) - ScDetectiveFunc( &pDocSh->GetDocument(), 0 ).UpdateAllArrowColors(); + ScDetectiveFunc( pDocSh->GetDocument(), 0 ).UpdateAllArrowColors(); if ( bComments ) ScDetectiveFunc::UpdateAllComments( pDocSh->GetDocument() ); } diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 6e9e1e95aaa3..965e0b8e54a9 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -855,7 +855,7 @@ void ScTransferObj::StripRefs( ScDocument* pDoc, ScRange aRef; - ScCellIterator aIter( pDoc, ScRange(nStartX, nStartY, nSrcTab, nEndX, nEndY, nSrcTab) ); + ScCellIterator aIter( *pDoc, ScRange(nStartX, nStartY, nSrcTab, nEndX, nEndY, nSrcTab) ); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { if (aIter.getType() != CELLTYPE_FORMULA) @@ -863,7 +863,7 @@ void ScTransferObj::StripRefs( ScDocument* pDoc, ScFormulaCell* pFCell = aIter.getFormulaCell(); bool bOut = false; - ScDetectiveRefIter aRefIter( pDoc, pFCell ); + ScDetectiveRefIter aRefIter( *pDoc, pFCell ); while ( !bOut && aRefIter.GetNextRef( aRef ) ) { if ( aRef.aStart.Tab() != nSrcTab || aRef.aEnd.Tab() != nSrcTab || diff --git a/sc/source/ui/dialogs/searchresults.cxx b/sc/source/ui/dialogs/searchresults.cxx index c855b7db87d7..8713def944f5 100644 --- a/sc/source/ui/dialogs/searchresults.cxx +++ b/sc/source/ui/dialogs/searchresults.cxx @@ -92,10 +92,10 @@ namespace }; } -void SearchResultsDlg::FillResults( ScDocument* pDoc, const ScRangeList &rMatchedRanges, bool bCellNotes ) +void SearchResultsDlg::FillResults( ScDocument& rDoc, const ScRangeList &rMatchedRanges, bool bCellNotes ) { ListWrapper aList(*mxList); - std::vector aTabNames = pDoc->GetAllTableNames(); + std::vector aTabNames = rDoc.GetAllTableNames(); SCTAB nTabCount = aTabNames.size(); // tdf#92160 - too many results blow the widget's mind @@ -122,10 +122,10 @@ void SearchResultsDlg::FillResults( ScDocument* pDoc, const ScRangeList &rMatche { for (aPos.SetRow( rRange.aStart.Row()); aPos.Row() <= rRange.aEnd.Row(); aPos.IncRow()) { - const ScPostIt* pNote = pDoc->GetNote( aPos); + const ScPostIt* pNote = rDoc.GetNote( aPos); if (pNote) aList.Insert(aTabNames[aPos.Tab()], aPos, - pDoc->GetAddressConvention(), + rDoc.GetAddressConvention(), pNote->GetText()); } } @@ -136,7 +136,7 @@ void SearchResultsDlg::FillResults( ScDocument* pDoc, const ScRangeList &rMatche { for (size_t i = 0, n = nMatchMax; i < n; ++i) { - ScCellIterator aIter(pDoc, rMatchedRanges[i]); + ScCellIterator aIter(rDoc, rMatchedRanges[i]); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { const ScAddress& aPos = aIter.GetPos(); @@ -145,8 +145,8 @@ void SearchResultsDlg::FillResults( ScDocument* pDoc, const ScRangeList &rMatche continue; aList.Insert(aTabNames[aPos.Tab()], aPos, - pDoc->GetAddressConvention(), - pDoc->GetString(aPos)); + rDoc.GetAddressConvention(), + rDoc.GetString(aPos)); } } } @@ -157,7 +157,7 @@ void SearchResultsDlg::FillResults( ScDocument* pDoc, const ScRangeList &rMatche aSearchResults += " " + ScGlobal::ReplaceOrAppend( aSkipped, "%1", OUString::number( ListWrapper::mnMaximum ) ); mxSearchResults->set_label(aSearchResults); - mpDoc = pDoc; + mpDoc = &rDoc; } void SearchResultsDlg::Close() diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 246d41749553..4683ee74ea0e 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -1140,9 +1140,9 @@ void ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam, namespace { -bool lcl_EmptyExcept( ScDocument* pDoc, const ScRange& rRange, const ScRange& rExcept ) +bool lcl_EmptyExcept( ScDocument& rDoc, const ScRange& rRange, const ScRange& rExcept ) { - ScCellIterator aIter( pDoc, rRange ); + ScCellIterator aIter( rDoc, rRange ); for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next()) { if (!aIter.isEmpty()) // real content? @@ -1303,7 +1303,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb if (!bApi) { // OutRange of pOldObj (pDestObj) is still old area - if (!lcl_EmptyExcept(&rDoc, aNewOut, pOldObj->GetOutRange())) + if (!lcl_EmptyExcept(rDoc, aNewOut, pOldObj->GetOutRange())) { std::unique_ptr xQueryBox(Application::CreateMessageDialog(ScDocShell::GetActiveDialogParent(), VclMessageType::Question, VclButtonsType::YesNo, @@ -1572,7 +1572,7 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi) // test if new output area is empty except for old area if (!bApi) { - if (!lcl_EmptyExcept(&rDoc, aNewOut, rDPObj.GetOutRange())) + if (!lcl_EmptyExcept(rDoc, aNewOut, rDPObj.GetOutRange())) { std::unique_ptr xQueryBox(Application::CreateMessageDialog(ScDocShell::GetActiveDialogParent(), VclMessageType::Question, VclButtonsType::YesNo, diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index e70b6c7c1c02..3257e4744eff 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -203,7 +203,7 @@ bool ScDocFunc::DetectiveAddPred(const ScAddress& rPos) if (bUndo) pModel->BeginCalcUndo(false); - bool bDone = ScDetectiveFunc( &rDoc,nTab ).ShowPred( nCol, nRow ); + bool bDone = ScDetectiveFunc(rDoc, nTab).ShowPred( nCol, nRow ); std::unique_ptr pUndo; if (bUndo) pUndo = pModel->GetCalcUndo(); @@ -242,7 +242,7 @@ bool ScDocFunc::DetectiveDelPred(const ScAddress& rPos) if (bUndo) pModel->BeginCalcUndo(false); - bool bDone = ScDetectiveFunc( &rDoc,nTab ).DeletePred( nCol, nRow ); + bool bDone = ScDetectiveFunc(rDoc, nTab).DeletePred( nCol, nRow ); std::unique_ptr pUndo; if (bUndo) pUndo = pModel->GetCalcUndo(); @@ -279,7 +279,7 @@ bool ScDocFunc::DetectiveAddSucc(const ScAddress& rPos) if (bUndo) pModel->BeginCalcUndo(false); - bool bDone = ScDetectiveFunc( &rDoc,nTab ).ShowSucc( nCol, nRow ); + bool bDone = ScDetectiveFunc(rDoc, nTab).ShowSucc( nCol, nRow ); std::unique_ptr pUndo; if (bUndo) pUndo = pModel->GetCalcUndo(); @@ -318,7 +318,7 @@ bool ScDocFunc::DetectiveDelSucc(const ScAddress& rPos) if (bUndo) pModel->BeginCalcUndo(false); - bool bDone = ScDetectiveFunc( &rDoc,nTab ).DeleteSucc( nCol, nRow ); + bool bDone = ScDetectiveFunc(rDoc, nTab).DeleteSucc( nCol, nRow ); std::unique_ptr pUndo; if (bUndo) pUndo = pModel->GetCalcUndo(); @@ -355,7 +355,7 @@ bool ScDocFunc::DetectiveAddError(const ScAddress& rPos) if (bUndo) pModel->BeginCalcUndo(false); - bool bDone = ScDetectiveFunc( &rDoc,nTab ).ShowError( nCol, nRow ); + bool bDone = ScDetectiveFunc(rDoc, nTab).ShowError( nCol, nRow ); std::unique_ptr pUndo; if (bUndo) pUndo = pModel->GetCalcUndo(); @@ -391,7 +391,7 @@ bool ScDocFunc::DetectiveMarkInvalid(SCTAB nTab) if (bUndo) pModel->BeginCalcUndo(false); bool bOverflow; - bool bDone = ScDetectiveFunc( &rDoc,nTab ).MarkInvalid( bOverflow ); + bool bDone = ScDetectiveFunc(rDoc, nTab).MarkInvalid( bOverflow ); std::unique_ptr pUndo; if (bUndo) pUndo = pModel->GetCalcUndo(); @@ -429,7 +429,7 @@ bool ScDocFunc::DetectiveDelAll(SCTAB nTab) if (bUndo) pModel->BeginCalcUndo(false); - bool bDone = ScDetectiveFunc( &rDoc,nTab ).DeleteAll( ScDetectiveDelete::Detective ); + bool bDone = ScDetectiveFunc(rDoc, nTab).DeleteAll( ScDetectiveDelete::Detective ); std::unique_ptr pUndo; if (bUndo) pUndo = pModel->GetCalcUndo(); @@ -474,7 +474,7 @@ bool ScDocFunc::DetectiveRefresh( bool bAutomatic ) SCTAB nTabCount = rDoc.GetTableCount(); for (SCTAB nTab=0; nTabGetObject(i); const ScAddress& aPos = rData.GetPos(); - ScDetectiveFunc aFunc( &rDoc, aPos.Tab() ); + ScDetectiveFunc aFunc( rDoc, aPos.Tab() ); SCCOL nCol = aPos.Col(); SCROW nRow = aPos.Row(); switch (rData.GetOperation()) @@ -535,7 +535,7 @@ static void lcl_collectAllPredOrSuccRanges( if (rSrcRanges.empty()) return; ScRange const & rFrontRange = rSrcRanges.front(); - ScDetectiveFunc aDetFunc(&rDoc, rFrontRange.aStart.Tab()); + ScDetectiveFunc aDetFunc(rDoc, rFrontRange.aStart.Tab()); for (size_t i = 0, n = rSrcRanges.size(); i < n; ++i) { ScRange const & r = rSrcRanges[i]; @@ -1955,7 +1955,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, SCROW nTestRow1 = -1; SCROW nTestRow2 = -1; - ScDocAttrIterator aTestIter( &rDoc, i, nMergeTestStartCol, nMergeTestStartRow, nMergeTestEndCol, nMergeTestEndRow ); + ScDocAttrIterator aTestIter( rDoc, i, nMergeTestStartCol, nMergeTestStartRow, nMergeTestEndCol, nMergeTestEndRow ); ScRange aExtendRange( nMergeTestStartCol, nMergeTestStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i ); const ScPatternAttr* pPattern = nullptr; while ( ( pPattern = aTestIter.GetNext( nTestCol, nTestRow1, nTestRow2 ) ) != nullptr ) @@ -2437,7 +2437,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, SCROW nTestRow1 = -1; SCROW nTestRow2 = -1; - ScDocAttrIterator aTestIter( &rDoc, i, nUndoStartCol, nUndoStartRow, nMergeTestEndCol, nMergeTestEndRow ); + ScDocAttrIterator aTestIter( rDoc, i, nUndoStartCol, nUndoStartRow, nMergeTestEndCol, nMergeTestEndRow ); ScRange aExtendRange( nUndoStartCol, nUndoStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i ); const ScPatternAttr* pPattern = nullptr; while ( ( pPattern = aTestIter.GetNext( nTestCol, nTestRow1, nTestRow2 ) ) != nullptr ) diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx index b337605e0308..6880ff6224db 100644 --- a/sc/source/ui/docshell/tablink.cxx +++ b/sc/source/ui/docshell/tablink.cxx @@ -294,14 +294,14 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter, ScRangeList aErrorCells; // cells on the linked sheets that need error values - ScCellIterator aIter(&rDoc, ScRange(0,0,0,rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB)); // all sheets + ScCellIterator aIter(rDoc, ScRange(0,0,0,rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB)); // all sheets for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { if (aIter.getType() != CELLTYPE_FORMULA) continue; ScFormulaCell* pCell = aIter.getFormulaCell(); - ScDetectiveRefIter aRefIter(&rDoc, pCell); + ScDetectiveRefIter aRefIter(rDoc, pCell); ScRange aRefRange; while ( aRefIter.GetNextRef( aRefRange ) ) { diff --git a/sc/source/ui/inc/searchresults.hxx b/sc/source/ui/inc/searchresults.hxx index cf48fb239ece..63da68d77466 100644 --- a/sc/source/ui/inc/searchresults.hxx +++ b/sc/source/ui/inc/searchresults.hxx @@ -38,7 +38,7 @@ public: virtual void Close() override; - void FillResults( ScDocument* pDoc, const ScRangeList& rMatchedRanges, bool bCellNotes ); + void FillResults( ScDocument& rDoc, const ScRangeList& rMatchedRanges, bool bCellNotes ); }; class SearchResultsDlgWrapper : public SfxChildWindow diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index adc05f6fc4f9..0ca416e05ef6 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -3389,7 +3389,7 @@ uno::Reference SAL_CALL ScCellRangesBase::queryEmptyCel { ScRange const & rRange = aRanges[ i ]; - ScCellIterator aIter( &rDoc, rRange ); + ScCellIterator aIter(rDoc, rRange); for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next()) { // notes count as non-empty @@ -3424,7 +3424,7 @@ uno::Reference SAL_CALL ScCellRangesBase::queryContentC { ScRange const & rRange = aRanges[ i ]; - ScCellIterator aIter( &rDoc, rRange ); + ScCellIterator aIter(rDoc, rRange); for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next()) { bool bAdd = false; @@ -3513,7 +3513,7 @@ uno::Reference SAL_CALL ScCellRangesBase::queryFormulaC { ScRange const & rRange = aRanges[ i ]; - ScCellIterator aIter( &rDoc, rRange ); + ScCellIterator aIter(rDoc, rRange); for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next()) { if (aIter.getType() == CELLTYPE_FORMULA) @@ -3573,7 +3573,7 @@ uno::Reference ScCellRangesBase::QueryDifferences_Impl( aCmpRange = ScRange( 0,nCmpPos,nTab, rDoc.MaxCol(),nCmpPos,nTab ); else aCmpRange = ScRange( static_cast(nCmpPos),0,nTab, static_cast(nCmpPos),rDoc.MaxRow(),nTab ); - ScCellIterator aCmpIter( &rDoc, aCmpRange ); + ScCellIterator aCmpIter(rDoc, aCmpRange); for (bool bHasCell = aCmpIter.first(); bHasCell; bHasCell = aCmpIter.next()) { SCCOLROW nCellPos = bColumnDiff ? static_cast(aCmpIter.GetPos().Col()) : static_cast(aCmpIter.GetPos().Row()); @@ -3611,7 +3611,7 @@ uno::Reference ScCellRangesBase::QueryDifferences_Impl( { ScRange const & rRange = aRanges[ i ]; - ScCellIterator aIter( &rDoc, rRange ); + ScCellIterator aIter( rDoc, rRange ); for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next()) { if (bColumnDiff) @@ -3697,13 +3697,13 @@ uno::Reference SAL_CALL ScCellRangesBase::queryPreceden for (size_t nR = 0, nCount = aNewRanges.size(); nR SAL_CALL ScCellRangesBase::queryDependen SCTAB nTab = lcl_FirstTab(aNewRanges); //! all tables - ScCellIterator aCellIter( &rDoc, ScRange(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab) ); + ScCellIterator aCellIter( rDoc, ScRange(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab) ); for (bool bHasCell = aCellIter.first(); bHasCell; bHasCell = aCellIter.next()) { if (aCellIter.getType() != CELLTYPE_FORMULA) continue; bool bMark = false; - ScDetectiveRefIter aIter(&rDoc, aCellIter.getFormulaCell()); + ScDetectiveRefIter aIter(rDoc, aCellIter.getFormulaCell()); ScRange aRefRange; while ( aIter.GetNextRef( aRefRange) && !bMark ) { @@ -4986,7 +4986,7 @@ uno::Sequence< uno::Sequence > SAL_CALL ScCellRangeObj::getDataArray() { uno::Any aAny; // bAllowNV = TRUE: errors as void - if ( ScRangeToSequence::FillMixedArray( aAny, &pDocSh->GetDocument(), aRange, true ) ) + if ( ScRangeToSequence::FillMixedArray( aAny, pDocSh->GetDocument(), aRange, true ) ) { uno::Sequence< uno::Sequence > aSeq; if ( aAny >>= aSeq ) diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 2bdd53892bf3..c0f28d7017a8 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -1985,7 +1985,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, { sc::SearchResultsDlg* pDlg = static_cast(pWnd->GetController().get()); if (pDlg) - pDlg->FillResults(&rDoc, aMatchedRanges, + pDlg->FillResults(rDoc, aMatchedRanges, pSearchItem->GetCellType() == SvxSearchCellType::NOTE); } } diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index a56a0f497b6f..d4463cee1828 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -1214,7 +1214,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, if (bClipOver) if (lcl_SelHasAttrib( &rDoc, nStartCol,nStartRow, nUndoEndCol,nUndoEndRow, aFilteredMark, HasAttrFlags::Overlapped )) { // "Cell merge not possible if cells already merged" - ScDocAttrIterator aIter( &rDoc, nStartTab, nStartCol, nStartRow, nUndoEndCol, nUndoEndRow ); + ScDocAttrIterator aIter( rDoc, nStartTab, nStartCol, nStartRow, nUndoEndCol, nUndoEndRow ); const ScPatternAttr* pPattern = nullptr; SCCOL nCol = -1; SCROW nRow1 = -1; diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index c3bb7fff8f9e..99a702b20f76 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -238,7 +238,7 @@ void ScViewFunc::DoRefConversion() ScRange aRange = (*xRanges)[j]; aRange.aStart.SetTab(i); aRange.aEnd.SetTab(i); - ScCellIterator aIter( &rDoc, aRange ); + ScCellIterator aIter( rDoc, aRange ); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { if (aIter.getType() != CELLTYPE_FORMULA) -- cgit