diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-09-12 16:53:45 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-09-13 15:17:36 +0200 |
commit | fb2ceb28a820e7775456a137541ef5978a6746b4 (patch) | |
tree | 10a82d1c0007d01c0efa10826e5bb78729d3f6c9 /sc/source/core | |
parent | 0dcebd1b6e2e6f03d83bc46cab7be42a8905df3c (diff) |
toAbs always dereferences its ScDocument*
Change-Id: I6bddbca2289074ecf333227b3fc1a49da4b431a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102529
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/core')
-rw-r--r-- | sc/source/core/data/colorscale.cxx | 12 | ||||
-rw-r--r-- | sc/source/core/data/conditio.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/documen4.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 54 | ||||
-rw-r--r-- | sc/source/core/data/formulaiter.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/data/grouptokenconverter.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 16 | ||||
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 18 | ||||
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 12 | ||||
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/tool/rangenam.cxx | 14 | ||||
-rw-r--r-- | sc/source/core/tool/refdata.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/tool/reftokenhelper.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/tool/refupdat.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/sharedformula.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/tool/token.cxx | 18 |
16 files changed, 95 insertions, 95 deletions
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index cae3b073d465..cb887d70a2a7 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -54,8 +54,8 @@ void ScFormulaListener::startListening(const ScTokenArray* pArr, const ScRange& { case formula::svSingleRef: { - ScAddress aCell = t->GetSingleRef()->toAbs(mpDoc, rRange.aStart); - ScAddress aCell2 = t->GetSingleRef()->toAbs(mpDoc, rRange.aEnd); + ScAddress aCell = t->GetSingleRef()->toAbs(*mpDoc, rRange.aStart); + ScAddress aCell2 = t->GetSingleRef()->toAbs(*mpDoc, rRange.aEnd); ScRange aRange(aCell, aCell2); if (aRange.IsValid()) mpDoc->StartListeningArea(aRange, false, this); @@ -65,10 +65,10 @@ void ScFormulaListener::startListening(const ScTokenArray* pArr, const ScRange& { const ScSingleRefData& rRef1 = *t->GetSingleRef(); const ScSingleRefData& rRef2 = *t->GetSingleRef2(); - ScAddress aCell1 = rRef1.toAbs(mpDoc, rRange.aStart); - ScAddress aCell2 = rRef2.toAbs(mpDoc, rRange.aStart); - ScAddress aCell3 = rRef1.toAbs(mpDoc, rRange.aEnd); - ScAddress aCell4 = rRef2.toAbs(mpDoc, rRange.aEnd); + ScAddress aCell1 = rRef1.toAbs(*mpDoc, rRange.aStart); + ScAddress aCell2 = rRef2.toAbs(*mpDoc, rRange.aStart); + ScAddress aCell3 = rRef1.toAbs(*mpDoc, rRange.aEnd); + ScAddress aCell4 = rRef2.toAbs(*mpDoc, rRange.aEnd); ScRange aRange1(aCell1, aCell3); ScRange aRange2(aCell2, aCell4); aRange1.ExtendTo(aRange2); diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 94a8dd4be086..12857f329295 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1336,7 +1336,7 @@ ScAddress ScConditionEntry::GetValidSrcPos() const for ( auto t: pFormula->References() ) { ScSingleRefData& rRef1 = *t->GetSingleRef(); - ScAddress aAbs = rRef1.toAbs(mpDoc, aSrcPos); + ScAddress aAbs = rRef1.toAbs(*mpDoc, aSrcPos); if (!rRef1.IsTabDeleted()) { if (aAbs.Tab() < nMinTab) @@ -1347,7 +1347,7 @@ ScAddress ScConditionEntry::GetValidSrcPos() const if ( t->GetType() == svDoubleRef ) { ScSingleRefData& rRef2 = t->GetDoubleRef()->Ref2; - aAbs = rRef2.toAbs(mpDoc, aSrcPos); + aAbs = rRef2.toAbs(*mpDoc, aSrcPos); if (!rRef2.IsTabDeleted()) { if (aAbs.Tab() < nMinTab) diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index bbed307d5cc6..2261d9424745 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -463,7 +463,7 @@ bool setCacheTableReferenced(const ScDocument* pDoc, formula::FormulaToken& rTok case svExternalDoubleRef: { const ScComplexRefData& rRef = *rToken.GetDoubleRef(); - ScRange aAbs = rRef.toAbs(pDoc, rPos); + ScRange aAbs = rRef.toAbs(*pDoc, rPos); size_t nSheets = aAbs.aEnd.Tab() - aAbs.aStart.Tab() + 1; return rRefMgr.setCacheTableReferenced( rToken.GetIndex(), rToken.GetString().getString(), nSheets); diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 79b7738e3471..2081439e4eb9 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -232,17 +232,17 @@ typedef SCCOLROW(*DimensionSelector)(const ScDocument*, const ScAddress&, const SCCOLROW lcl_GetCol(const ScDocument* pDoc, const ScAddress& rPos, const ScSingleRefData& rData) { - return rData.toAbs(pDoc, rPos).Col(); + return rData.toAbs(*pDoc, rPos).Col(); } SCCOLROW lcl_GetRow(const ScDocument* pDoc, const ScAddress& rPos, const ScSingleRefData& rData) { - return rData.toAbs(pDoc, rPos).Row(); + return rData.toAbs(*pDoc, rPos).Row(); } SCCOLROW lcl_GetTab(const ScDocument* pDoc, const ScAddress& rPos, const ScSingleRefData& rData) { - return rData.toAbs(pDoc, rPos).Tab(); + return rData.toAbs(*pDoc, rPos).Tab(); } /** Check if both references span the same range in selected dimension. @@ -369,10 +369,10 @@ lcl_fillRangeFromRefList( { const ScSingleRefData aStart( SingleDoubleRefProvider(*rReferences.front()).Ref1); - rRange.aStart = aStart.toAbs(pDoc, aPos); + rRange.aStart = aStart.toAbs(*pDoc, aPos); const ScSingleRefData aEnd( SingleDoubleRefProvider(*rReferences.back()).Ref2); - rRange.aEnd = aEnd.toAbs(pDoc, aPos); + rRange.aEnd = aEnd.toAbs(*pDoc, aPos); } bool @@ -991,7 +991,7 @@ void ScFormulaCell::GetFormula( OUStringBuffer& rBuffer, * Can we live without in all cases? */ ScFormulaCell* pCell = nullptr; ScSingleRefData& rRef = *p->GetSingleRef(); - ScAddress aAbs = rRef.toAbs(pDocument, aPos); + ScAddress aAbs = rRef.toAbs(*pDocument, aPos); if (pDocument->ValidAddress(aAbs)) pCell = pDocument->GetFormulaCell(aAbs); @@ -1057,7 +1057,7 @@ OUString ScFormulaCell::GetFormula( sc::CompileFormulaContext& rCxt, const ScInt * Can we live without in all cases? */ ScFormulaCell* pCell = nullptr; ScSingleRefData& rRef = *p->GetSingleRef(); - ScAddress aAbs = rRef.toAbs(pDocument, aPos); + ScAddress aAbs = rRef.toAbs(*pDocument, aPos); if (pDocument->ValidAddress(aAbs)) pCell = pDocument->GetFormulaCell(aAbs); @@ -2847,7 +2847,7 @@ bool ScFormulaCell::GetMatrixOrigin( const ScDocument* pDoc, ScAddress& rPos ) c if( t ) { ScSingleRefData& rRef = *t->GetSingleRef(); - ScAddress aAbs = rRef.toAbs(pDoc, aPos); + ScAddress aAbs = rRef.toAbs(*pDoc, aPos); if (pDoc->ValidAddress(aAbs)) { rPos = aAbs; @@ -3031,8 +3031,8 @@ bool ScFormulaCell::HasOneReference( ScRange& r ) const if( p && !aIter.GetNextReferenceRPN() ) // only one! { SingleDoubleRefProvider aProv( *p ); - r.aStart = aProv.Ref1.toAbs(pDocument, aPos); - r.aEnd = aProv.Ref2.toAbs(pDocument, aPos); + r.aStart = aProv.Ref1.toAbs(*pDocument, aPos); + r.aEnd = aProv.Ref2.toAbs(*pDocument, aPos); return true; } else @@ -3171,7 +3171,7 @@ bool checkCompileColRowName( ScSingleRefData& rRef = *t->GetSingleRef(); if (rCxt.mnRowDelta > 0 && rRef.IsColRel()) { // ColName - ScAddress aAdr = rRef.toAbs(&rDoc, aPos); + ScAddress aAdr = rRef.toAbs(rDoc, aPos); ScRangePair* pR = pColList->Find( aAdr ); if ( pR ) { // defined @@ -3186,7 +3186,7 @@ bool checkCompileColRowName( } if (rCxt.mnColDelta > 0 && rRef.IsRowRel()) { // RowName - ScAddress aAdr = rRef.toAbs(&rDoc, aPos); + ScAddress aAdr = rRef.toAbs(rDoc, aPos); ScRangePair* pR = pRowList->Find( aAdr ); if ( pR ) { // defined @@ -3214,7 +3214,7 @@ bool checkCompileColRowName( for (; t; t = aIter.GetNextColRowName()) { const ScSingleRefData& rRef = *t->GetSingleRef(); - ScAddress aAbs = rRef.toAbs(&rDoc, aPos); + ScAddress aAbs = rRef.toAbs(rDoc, aPos); if (rDoc.ValidAddress(aAbs)) { if (rCxt.maRange.In(aAbs)) @@ -3837,7 +3837,7 @@ void ScFormulaCell::UpdateTranspose( const ScRange& rSource, const ScAddress& rD { SingleDoubleRefModifier aMod(*t); ScComplexRefData& rRef = aMod.Ref(); - ScRange aAbs = rRef.toAbs(pDocument, aOldPos); + ScRange aAbs = rRef.toAbs(*pDocument, aOldPos); bool bMod = (ScRefUpdate::UpdateTranspose(pDocument, rSource, rDest, aAbs) != UR_NOTHING || bPosChanged); if (bMod) { @@ -3887,7 +3887,7 @@ void ScFormulaCell::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY { SingleDoubleRefModifier aMod(*t); ScComplexRefData& rRef = aMod.Ref(); - ScRange aAbs = rRef.toAbs(pDocument, aPos); + ScRange aAbs = rRef.toAbs(*pDocument, aPos); bool bMod = (ScRefUpdate::UpdateGrow(rArea, nGrowX, nGrowY, aAbs) != UR_NOTHING); if (bMod) { @@ -4461,7 +4461,7 @@ struct ScDependantsCalculator ScSingleRefData aRef = *p->GetSingleRef(); // =Sheet1!A1 if( aRef.IsDeleted()) return false; - ScAddress aRefPos = aRef.toAbs(&mrDoc, mrPos); + ScAddress aRefPos = aRef.toAbs(mrDoc, mrPos); if (!mrDoc.TableExists(aRefPos.Tab())) return false; // or true? @@ -4497,7 +4497,7 @@ struct ScDependantsCalculator ScComplexRefData aRef = *p->GetDoubleRef(); if( aRef.IsDeleted()) return false; - ScRange aAbs = aRef.toAbs(&mrDoc, mrPos); + ScRange aAbs = aRef.toAbs(mrDoc, mrPos); // Multiple sheet if (aRef.Ref1.Tab() != aRef.Ref2.Tab()) @@ -5155,7 +5155,7 @@ bool ScFormulaCell::InterpretInvariantFormulaGroup() case svSingleRef: { ScSingleRefData aRef = *p->GetSingleRef(); - ScAddress aRefPos = aRef.toAbs(pDocument, aPos); + ScAddress aRefPos = aRef.toAbs(*pDocument, aPos); formula::FormulaTokenRef pNewToken = pDocument->ResolveStaticReference(aRefPos); if (!pNewToken) return false; @@ -5166,7 +5166,7 @@ bool ScFormulaCell::InterpretInvariantFormulaGroup() case svDoubleRef: { ScComplexRefData aRef = *p->GetDoubleRef(); - ScRange aRefRange = aRef.toAbs(pDocument, aPos); + ScRange aRefRange = aRef.toAbs(*pDocument, aPos); formula::FormulaTokenRef pNewToken = pDocument->ResolveStaticReference(aRefRange); if (!pNewToken) return false; @@ -5222,8 +5222,8 @@ void startListeningArea( { const ScSingleRefData& rRef1 = *rToken.GetSingleRef(); const ScSingleRefData& rRef2 = *rToken.GetSingleRef2(); - ScAddress aCell1 = rRef1.toAbs(&rDoc, rPos); - ScAddress aCell2 = rRef2.toAbs(&rDoc, rPos); + ScAddress aCell1 = rRef1.toAbs(rDoc, rPos); + ScAddress aCell2 = rRef2.toAbs(rDoc, rPos); if (!(aCell1.IsValid() && aCell2.IsValid())) return; @@ -5269,7 +5269,7 @@ void ScFormulaCell::StartListeningTo( ScDocument* pDoc ) { case svSingleRef: { - ScAddress aCell = t->GetSingleRef()->toAbs(pDocument, aPos); + ScAddress aCell = t->GetSingleRef()->toAbs(*pDocument, aPos); if (aCell.IsValid()) pDoc->StartListeningCell(aCell, this); } @@ -5312,7 +5312,7 @@ void ScFormulaCell::StartListeningTo( sc::StartListeningContext& rCxt ) { case svSingleRef: { - ScAddress aCell = t->GetSingleRef()->toAbs(pDocument, aPos); + ScAddress aCell = t->GetSingleRef()->toAbs(*pDocument, aPos); if (aCell.IsValid()) rDoc.StartListeningCell(rCxt, aCell, *this); } @@ -5334,8 +5334,8 @@ void endListeningArea( { const ScSingleRefData& rRef1 = *rToken.GetSingleRef(); const ScSingleRefData& rRef2 = *rToken.GetSingleRef2(); - ScAddress aCell1 = rRef1.toAbs(&rDoc, rPos); - ScAddress aCell2 = rRef2.toAbs(&rDoc, rPos); + ScAddress aCell1 = rRef1.toAbs(rDoc, rPos); + ScAddress aCell2 = rRef2.toAbs(rDoc, rPos); if (!(aCell1.IsValid() && aCell2.IsValid())) return; @@ -5389,7 +5389,7 @@ void ScFormulaCell::EndListeningTo( ScDocument* pDoc, ScTokenArray* pArr, { case svSingleRef: { - ScAddress aCell = t->GetSingleRef()->toAbs(pDocument, aCellPos); + ScAddress aCell = t->GetSingleRef()->toAbs(*pDocument, aCellPos); if (aCell.IsValid()) pDoc->EndListeningCell(aCell, this); } @@ -5436,7 +5436,7 @@ void ScFormulaCell::EndListeningTo( sc::EndListeningContext& rCxt ) { case svSingleRef: { - ScAddress aCell = t->GetSingleRef()->toAbs(pDocument, aCellPos); + ScAddress aCell = t->GetSingleRef()->toAbs(*pDocument, aCellPos); if (aCell.IsValid()) rDoc.EndListeningCell(rCxt, aCell, *this); } diff --git a/sc/source/core/data/formulaiter.cxx b/sc/source/core/data/formulaiter.cxx index 7c27eb133864..386803372756 100644 --- a/sc/source/core/data/formulaiter.cxx +++ b/sc/source/core/data/formulaiter.cxx @@ -36,13 +36,13 @@ ScDetectiveRefIter::ScDetectiveRefIter( const ScDocument* pDoc, ScFormulaCell* p static bool lcl_ScDetectiveRefIter_SkipRef( const ScDocument* pDoc, formula::FormulaToken* p, const ScAddress& rPos ) { ScSingleRefData& rRef1 = *p->GetSingleRef(); - ScAddress aAbs1 = rRef1.toAbs(pDoc, rPos); + ScAddress aAbs1 = rRef1.toAbs(*pDoc, rPos); if (!pDoc->ValidAddress(aAbs1)) return true; if ( p->GetType() == svDoubleRef || p->GetType() == svExternalDoubleRef ) { ScSingleRefData& rRef2 = p->GetDoubleRef()->Ref2; - ScAddress aAbs2 = rRef2.toAbs(pDoc, rPos); + ScAddress aAbs2 = rRef2.toAbs(*pDoc, rPos); if (!pDoc->ValidAddress(aAbs2)) return true; } @@ -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(*mpDoc, aPos); + rRange.aEnd = aProv.Ref2.toAbs(*mpDoc, aPos); bRet = true; } diff --git a/sc/source/core/data/grouptokenconverter.cxx b/sc/source/core/data/grouptokenconverter.cxx index 2118f9b0afc0..6b71284a9325 100644 --- a/sc/source/core/data/grouptokenconverter.cxx +++ b/sc/source/core/data/grouptokenconverter.cxx @@ -121,7 +121,7 @@ bool ScGroupTokenConverter::convert( const ScTokenArray& rCode, sc::FormulaLogge ScSingleRefData aRef = *p->GetSingleRef(); if( aRef.IsDeleted()) return false; - ScAddress aRefPos = aRef.toAbs(&mrDoc, mrPos); + ScAddress aRefPos = aRef.toAbs(mrDoc, mrPos); if (aRef.IsRowRel()) { if (isSelfReferenceRelative(aRefPos, aRef.Row())) @@ -192,7 +192,7 @@ bool ScGroupTokenConverter::convert( const ScTokenArray& rCode, sc::FormulaLogge ScComplexRefData aRef = *p->GetDoubleRef(); if( aRef.IsDeleted()) return false; - ScRange aAbs = aRef.toAbs(&mrDoc, mrPos); + ScRange aAbs = aRef.toAbs(mrDoc, mrPos); // Multiple sheets not handled by vector/matrix. if (aRef.Ref1.Tab() != aRef.Ref2.Tab()) diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 16163871d66b..93df9f18cf98 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -5162,7 +5162,7 @@ void ScCompiler::CreateStringFromSingleRef( OUStringBuffer& rBuffer, const Formu aRef.Ref1 = aRef.Ref2 = rRef; if ( eOp == ocColRowName ) { - ScAddress aAbs = rRef.toAbs(pDoc, aPos); + ScAddress aAbs = rRef.toAbs(*pDoc, aPos); if (pDoc->HasStringData(aAbs.Col(), aAbs.Row(), aAbs.Tab())) { OUString aStr = pDoc->GetString(aAbs, mpInterpreterContext); @@ -5179,7 +5179,7 @@ void ScCompiler::CreateStringFromSingleRef( OUStringBuffer& rBuffer, const Formu else if (pArr && (p = maArrIterator.PeekPrevNoSpaces()) && p->GetOpCode() == ocTableRefOpen) { OUString aStr; - ScAddress aAbs = rRef.toAbs(pDoc, aPos); + ScAddress aAbs = rRef.toAbs(*pDoc, aPos); const ScDBData* pData = pDoc->GetDBAtCursor( aAbs.Col(), aAbs.Row(), aAbs.Tab(), ScDBDataPortion::AREA); SAL_WARN_IF( !pData, "sc.core", "ScCompiler::CreateStringFromSingleRef - TableRef without ScDBData: " << aAbs.Format( ScRefFlags::VALID | ScRefFlags::TAB_3D, pDoc)); @@ -5367,7 +5367,7 @@ void ScCompiler::fillAddInToken(::std::vector< css::sheet::FormulaOpCodeMapEntry bool ScCompiler::HandleColRowName() { ScSingleRefData& rRef = *mpToken->GetSingleRef(); - const ScAddress aAbs = rRef.toAbs(pDoc, aPos); + const ScAddress aAbs = rRef.toAbs(*pDoc, aPos); if (!pDoc->ValidAddress(aAbs)) { SetError( FormulaError::NoRef ); @@ -5804,7 +5804,7 @@ bool ScCompiler::HandleTableRef() { case svSingleRef: { - aColRange.aStart = aColRange.aEnd = mpToken->GetSingleRef()->toAbs(pDoc, aPos); + aColRange.aStart = aColRange.aEnd = mpToken->GetSingleRef()->toAbs(*pDoc, aPos); if ( GetTokenIfOpCode( ocTableRefClose) && (nLevel--) && GetTokenIfOpCode( ocRange) && GetTokenIfOpCode( ocTableRefOpen) && (++nLevel) && @@ -5814,7 +5814,7 @@ bool ScCompiler::HandleTableRef() aColRange = ScRange( ScAddress::INITIALIZE_INVALID); else { - aColRange.aEnd = mpToken->GetSingleRef()->toAbs(pDoc, aPos); + aColRange.aEnd = mpToken->GetSingleRef()->toAbs(*pDoc, aPos); aColRange.PutInOrder(); bCol2Rel = mpToken->GetSingleRef()->IsColRel(); bCol2RelName = mpToken->GetSingleRef()->IsRelName(); @@ -6122,7 +6122,7 @@ void ScCompiler::ReplaceDoubleRefII(FormulaToken** ppDoubleRefTok) if (!rRange.Ref1.IsRowRel() && !rRange.Ref2.IsRowRel()) return; - ScRange aAbsRange = rRange.toAbs(pDoc, aPos); + ScRange aAbsRange = rRange.toAbs(*pDoc, aPos); if (aAbsRange.aStart == aAbsRange.aEnd) return; // Nothing to do (trivial case). @@ -6212,7 +6212,7 @@ static void lcl_GetColRowDeltas(const ScRange& rRange, SCCOL& rXDelta, SCROW& rY bool ScCompiler::AdjustSumRangeShape(const ScComplexRefData& rBaseRange, ScComplexRefData& rSumRange) { - ScRange aAbs = rSumRange.toAbs(pDoc, aPos); + ScRange aAbs = rSumRange.toAbs(*pDoc, aPos); // Current sum-range end col/row SCCOL nEndCol = aAbs.aEnd.Col(); @@ -6229,7 +6229,7 @@ bool ScCompiler::AdjustSumRangeShape(const ScComplexRefData& rBaseRange, ScCompl lcl_GetColRowDeltas(aAbs, nXDeltaSum, nYDeltaSum); - aAbs = rBaseRange.toAbs(pDoc, aPos); + aAbs = rBaseRange.toAbs(*pDoc, aPos); SCCOL nXDelta = 0; SCROW nYDelta = 0; diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 1493b56d241d..121f17757b45 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -4247,7 +4247,7 @@ void ScInterpreter::ScColumns() OUString aTabName; ScComplexRefData aRef; PopExternalDoubleRef( nFileId, aTabName, aRef); - ScRange aAbs = aRef.toAbs(&mrDoc, aPos); + ScRange aAbs = aRef.toAbs(mrDoc, aPos); nVal += static_cast<sal_uLong>(aAbs.aEnd.Tab() - aAbs.aStart.Tab() + 1) * static_cast<sal_uLong>(aAbs.aEnd.Col() - aAbs.aStart.Col() + 1); } @@ -4304,7 +4304,7 @@ void ScInterpreter::ScRows() OUString aTabName; ScComplexRefData aRef; PopExternalDoubleRef( nFileId, aTabName, aRef); - ScRange aAbs = aRef.toAbs(&mrDoc, aPos); + ScRange aAbs = aRef.toAbs(mrDoc, aPos); nVal += static_cast<sal_uLong>(aAbs.aEnd.Tab() - aAbs.aStart.Tab() + 1) * static_cast<sal_uLong>(aAbs.aEnd.Row() - aAbs.aStart.Row() + 1); } @@ -4351,7 +4351,7 @@ void ScInterpreter::ScSheets() OUString aTabName; ScComplexRefData aRef; PopExternalDoubleRef( nFileId, aTabName, aRef); - ScRange aAbs = aRef.toAbs(&mrDoc, aPos); + ScRange aAbs = aRef.toAbs(mrDoc, aPos); nVal += static_cast<sal_uLong>(aAbs.aEnd.Tab() - aAbs.aStart.Tab() + 1); } break; @@ -4416,7 +4416,7 @@ void ScInterpreter::ScColumn() OUString aTabName; ScSingleRefData aRef; PopExternalSingleRef( nFileId, aTabName, aRef ); - ScAddress aAbsRef = aRef.toAbs(&mrDoc, aPos); + ScAddress aAbsRef = aRef.toAbs(mrDoc, aPos); nVal = static_cast<double>( aAbsRef.Col() + 1 ); } break; @@ -4440,7 +4440,7 @@ void ScInterpreter::ScColumn() OUString aTabName; ScComplexRefData aRef; PopExternalDoubleRef( nFileId, aTabName, aRef ); - ScRange aAbs = aRef.toAbs(&mrDoc, aPos); + ScRange aAbs = aRef.toAbs(mrDoc, aPos); nCol1 = aAbs.aStart.Col(); nCol2 = aAbs.aEnd.Col(); } @@ -4520,7 +4520,7 @@ void ScInterpreter::ScRow() OUString aTabName; ScSingleRefData aRef; PopExternalSingleRef( nFileId, aTabName, aRef ); - ScAddress aAbsRef = aRef.toAbs(&mrDoc, aPos); + ScAddress aAbsRef = aRef.toAbs(mrDoc, aPos); nVal = static_cast<double>( aAbsRef.Row() + 1 ); } break; @@ -4543,7 +4543,7 @@ void ScInterpreter::ScRow() OUString aTabName; ScComplexRefData aRef; PopExternalDoubleRef( nFileId, aTabName, aRef ); - ScRange aAbs = aRef.toAbs(&mrDoc, aPos); + ScRange aAbs = aRef.toAbs(mrDoc, aPos); nRow1 = aAbs.aStart.Row(); nRow2 = aAbs.aEnd.Row(); } @@ -8415,7 +8415,7 @@ void ScInterpreter::ScOffset() OUString aTabName; ScSingleRefData aRef; PopExternalSingleRef(nFileId, aTabName, aRef); - ScAddress aAbsRef = aRef.toAbs(&mrDoc, aPos); + ScAddress aAbsRef = aRef.toAbs(mrDoc, aPos); nCol1 = aAbsRef.Col(); nRow1 = aAbsRef.Row(); nTab1 = aAbsRef.Tab(); @@ -8468,7 +8468,7 @@ void ScInterpreter::ScOffset() OUString aTabName; ScComplexRefData aRef; PopExternalDoubleRef(nFileId, aTabName, aRef); - ScRange aAbs = aRef.toAbs(&mrDoc, aPos); + ScRange aAbs = aRef.toAbs(mrDoc, aPos); nCol1 = aAbs.aStart.Col(); nRow1 = aAbs.aStart.Row(); nTab1 = aAbs.aStart.Tab(); diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 61d730798cf3..4526bd89a0db 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -2465,12 +2465,12 @@ void ScInterpreter::ScIntersect() ScRefList* pRefList = xRes->GetRefList(); for (const auto& rRef1 : *x1->GetRefList()) { - const ScAddress& r11 = rRef1.Ref1.toAbs(&mrDoc, aPos); - const ScAddress& r12 = rRef1.Ref2.toAbs(&mrDoc, aPos); + const ScAddress& r11 = rRef1.Ref1.toAbs(mrDoc, aPos); + const ScAddress& r12 = rRef1.Ref2.toAbs(mrDoc, aPos); for (const auto& rRef2 : *x2->GetRefList()) { - const ScAddress& r21 = rRef2.Ref1.toAbs(&mrDoc, aPos); - const ScAddress& r22 = rRef2.Ref2.toAbs(&mrDoc, aPos); + const ScAddress& r21 = rRef2.Ref1.toAbs(mrDoc, aPos); + const ScAddress& r22 = rRef2.Ref2.toAbs(mrDoc, aPos); SCCOL nCol1 = ::std::max( r11.Col(), r21.Col()); SCROW nRow1 = ::std::max( r11.Row(), r21.Row()); SCTAB nTab1 = ::std::max( r11.Tab(), r21.Tab()); @@ -2516,14 +2516,14 @@ void ScInterpreter::ScIntersect() case svDoubleRef: { { - const ScAddress& r = pt[i]->GetSingleRef()->toAbs(&mrDoc, aPos); + const ScAddress& r = pt[i]->GetSingleRef()->toAbs(mrDoc, aPos); nC1[i] = r.Col(); nR1[i] = r.Row(); nT1[i] = r.Tab(); } if (sv[i] == svDoubleRef) { - const ScAddress& r = pt[i]->GetSingleRef2()->toAbs(&mrDoc, aPos); + const ScAddress& r = pt[i]->GetSingleRef2()->toAbs(mrDoc, aPos); nC2[i] = r.Col(); nR2[i] = r.Row(); nT2[i] = r.Tab(); diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 367824956cea..d63698c0411f 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -1180,7 +1180,7 @@ void ScInterpreter::PopExternalSingleRef( return; } - ScAddress aAddr = rRef.toAbs(&mrDoc, aPos); + ScAddress aAddr = rRef.toAbs(mrDoc, aPos); ScExternalRefCache::CellFormat aFmt; ScExternalRefCache::TokenRef xNew = pRefMgr->getSingleRefToken( rFileId, rTabName, aAddr, &aPos, nullptr, &aFmt); @@ -1281,7 +1281,7 @@ void ScInterpreter::GetExternalDoubleRef( } ScComplexRefData aData(rData); - ScRange aRange = aData.toAbs(&mrDoc, aPos); + ScRange aRange = aData.toAbs(mrDoc, aPos); if (!mrDoc.ValidColRow(aRange.aStart.Col(), aRange.aStart.Row()) || !mrDoc.ValidColRow(aRange.aEnd.Col(), aRange.aEnd.Row())) { SetError(FormulaError::NoRef); @@ -3677,7 +3677,7 @@ void ScInterpreter::ScDBArea() void ScInterpreter::ScColRowNameAuto() { ScComplexRefData aRefData( *pCur->GetDoubleRef() ); - ScRange aAbs = aRefData.toAbs(&mrDoc, aPos); + ScRange aAbs = aRefData.toAbs(mrDoc, aPos); if (!mrDoc.ValidRange(aAbs)) { PushError( FormulaError::NoRef ); diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx index f96cdbe0dec6..956f9439f902 100644 --- a/sc/source/core/tool/rangenam.cxx +++ b/sc/source/core/tool/rangenam.cxx @@ -292,7 +292,7 @@ void ScRangeData::UpdateTranspose( const ScRange& rSource, const ScAddress& rDes (!rRef.Ref2.IsColRel() && !rRef.Ref2.IsRowRel() && (!rRef.Ref2.IsFlag3D() || !rRef.Ref2.IsTabRel())))) { - ScRange aAbs = rRef.toAbs(pDoc, aPos); + ScRange aAbs = rRef.toAbs(*pDoc, aPos); if (ScRefUpdate::UpdateTranspose(pDoc, rSource, rDest, aAbs) != UR_NOTHING) { rRef.SetRange(pDoc->GetSheetLimits(), aAbs, aPos); @@ -324,7 +324,7 @@ void ScRangeData::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY ) (!rRef.Ref2.IsColRel() && !rRef.Ref2.IsRowRel() && (!rRef.Ref2.IsFlag3D() || !rRef.Ref2.IsTabRel())))) { - ScRange aAbs = rRef.toAbs(pDoc, aPos); + ScRange aAbs = rRef.toAbs(*pDoc, aPos); if (ScRefUpdate::UpdateGrow(rArea, nGrowX, nGrowY, aAbs) != UR_NOTHING) { rRef.SetRange(pDoc->GetSheetLimits(), aAbs, aPos); @@ -533,7 +533,7 @@ void ScRangeData::ValidateTabRefs() while ( ( t = aIter.GetNextReference() ) != nullptr ) { ScSingleRefData& rRef1 = *t->GetSingleRef(); - ScAddress aAbs = rRef1.toAbs(pDoc, aPos); + ScAddress aAbs = rRef1.toAbs(*pDoc, aPos); if ( rRef1.IsTabRel() && !rRef1.IsTabDeleted() ) { if (aAbs.Tab() < nMinTab) @@ -544,7 +544,7 @@ void ScRangeData::ValidateTabRefs() if ( t->GetType() == svDoubleRef ) { ScSingleRefData& rRef2 = t->GetDoubleRef()->Ref2; - aAbs = rRef2.toAbs(pDoc, aPos); + aAbs = rRef2.toAbs(*pDoc, aPos); if ( rRef2.IsTabRel() && !rRef2.IsTabDeleted() ) { if (aAbs.Tab() < nMinTab) @@ -576,7 +576,7 @@ void ScRangeData::ValidateTabRefs() ScSingleRefData& rRef = *t->GetSingleRef(); if (!rRef.IsTabDeleted()) { - ScAddress aAbs = rRef.toAbs(pDoc, aOldPos); + ScAddress aAbs = rRef.toAbs(*pDoc, aOldPos); rRef.SetAddress(pDoc->GetSheetLimits(), aAbs, aPos); } } @@ -586,12 +586,12 @@ void ScRangeData::ValidateTabRefs() ScComplexRefData& rRef = *t->GetDoubleRef(); if (!rRef.Ref1.IsTabDeleted()) { - ScAddress aAbs = rRef.Ref1.toAbs(pDoc, aOldPos); + ScAddress aAbs = rRef.Ref1.toAbs(*pDoc, aOldPos); rRef.Ref1.SetAddress(pDoc->GetSheetLimits(), aAbs, aPos); } if (!rRef.Ref2.IsTabDeleted()) { - ScAddress aAbs = rRef.Ref2.toAbs(pDoc, aOldPos); + ScAddress aAbs = rRef.Ref2.toAbs(*pDoc, aOldPos); rRef.Ref2.SetAddress(pDoc->GetSheetLimits(), aAbs, aPos); } } diff --git a/sc/source/core/tool/refdata.cxx b/sc/source/core/tool/refdata.cxx index 9458ff546438..0451a5d4edbe 100644 --- a/sc/source/core/tool/refdata.cxx +++ b/sc/source/core/tool/refdata.cxx @@ -185,9 +185,9 @@ bool ScSingleRefData::ValidExternal(const ScDocument* pDoc) const return ColValid(pDoc) && RowValid(pDoc) && mnTab >= -1; } -ScAddress ScSingleRefData::toAbs( const ScDocument* pDoc, const ScAddress& rPos ) const +ScAddress ScSingleRefData::toAbs( const ScDocument& rDoc, const ScAddress& rPos ) const { - return toAbs(pDoc->GetSheetLimits(), rPos); + return toAbs(rDoc.GetSheetLimits(), rPos); } ScAddress ScSingleRefData::toAbs( ScSheetLimits& rLimits, const ScAddress& rPos ) const @@ -485,9 +485,9 @@ bool ScComplexRefData::ValidExternal(const ScDocument* pDoc) const return Ref1.ValidExternal(pDoc) && Ref2.ColValid(pDoc) && Ref2.RowValid(pDoc) && Ref1.Tab() <= Ref2.Tab(); } -ScRange ScComplexRefData::toAbs( const ScDocument* pDoc, const ScAddress& rPos ) const +ScRange ScComplexRefData::toAbs( const ScDocument& rDoc, const ScAddress& rPos ) const { - return toAbs(pDoc->GetSheetLimits(), rPos); + return toAbs(rDoc.GetSheetLimits(), rPos); } ScRange ScComplexRefData::toAbs( ScSheetLimits& rLimits, const ScAddress& rPos ) const diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx index 222b1bb3e211..bddb458f5004 100644 --- a/sc/source/core/tool/reftokenhelper.cxx +++ b/sc/source/core/tool/reftokenhelper.cxx @@ -135,7 +135,7 @@ bool ScRefTokenHelper::getRangeFromToken( return false; const ScSingleRefData& rRefData = *pToken->GetSingleRef(); - rRange.aStart = rRefData.toAbs(pDoc, rPos); + rRange.aStart = rRefData.toAbs(*pDoc, rPos); rRange.aEnd = rRange.aStart; return true; } @@ -147,7 +147,7 @@ bool ScRefTokenHelper::getRangeFromToken( return false; const ScComplexRefData& rRefData = *pToken->GetDoubleRef(); - rRange = rRefData.toAbs(pDoc, rPos); + rRange = rRefData.toAbs(*pDoc, rPos); return true; } default: @@ -343,7 +343,7 @@ private: if (!ScRefTokenHelper::getDoubleRefDataFromToken(aOldData, pOldToken)) continue; - ScRange aOld = aOldData.toAbs(pDoc, rPos), aNew = aData.toAbs(pDoc, rPos); + ScRange aOld = aOldData.toAbs(*pDoc, rPos), aNew = aData.toAbs(*pDoc, rPos); if (aNew.aStart.Tab() != aOld.aStart.Tab() || aNew.aEnd.Tab() != aOld.aEnd.Tab()) // Sheet ranges differ. diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx index 3dfe38634478..f3d0014e7924 100644 --- a/sc/source/core/tool/refupdat.cxx +++ b/sc/source/core/tool/refupdat.cxx @@ -463,7 +463,7 @@ ScRefUpdateRes ScRefUpdate::Update( UpdateRefMode eUpdateRefMode, void ScRefUpdate::MoveRelWrap( const ScDocument* pDoc, const ScAddress& rPos, SCCOL nMaxCol, SCROW nMaxRow, ScComplexRefData& rRef ) { - ScRange aAbsRange = rRef.toAbs(pDoc, rPos); + ScRange aAbsRange = rRef.toAbs(*pDoc, rPos); if( rRef.Ref1.IsColRel() ) { SCCOL nCol = aAbsRange.aStart.Col(); diff --git a/sc/source/core/tool/sharedformula.cxx b/sc/source/core/tool/sharedformula.cxx index 35e93a4155b5..104c9d8d4629 100644 --- a/sc/source/core/tool/sharedformula.cxx +++ b/sc/source/core/tool/sharedformula.cxx @@ -411,7 +411,7 @@ void SharedFormulaUtil::startListeningAsGroup( sc::StartListeningContext& rCxt, case formula::svSingleRef: { const ScSingleRefData* pRef = t->GetSingleRef(); - ScAddress aPos = pRef->toAbs(&rDoc, rTopCell.aPos); + ScAddress aPos = pRef->toAbs(rDoc, rTopCell.aPos); ScFormulaCell** pp = ppSharedTop; ScFormulaCell** ppEnd = ppSharedTop + xGroup->mnLength; for (; pp != ppEnd; ++pp) @@ -429,8 +429,8 @@ void SharedFormulaUtil::startListeningAsGroup( sc::StartListeningContext& rCxt, { const ScSingleRefData& rRef1 = *t->GetSingleRef(); const ScSingleRefData& rRef2 = *t->GetSingleRef2(); - ScAddress aPos1 = rRef1.toAbs(&rDoc, rTopCell.aPos); - ScAddress aPos2 = rRef2.toAbs(&rDoc, rTopCell.aPos); + ScAddress aPos1 = rRef1.toAbs(rDoc, rTopCell.aPos); + ScAddress aPos2 = rRef2.toAbs(rDoc, rTopCell.aPos); ScRange aOrigRange(aPos1, aPos2); ScRange aListenedRange = aOrigRange; diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 7772ca629fff..329c8e3b53d9 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -3544,7 +3544,7 @@ bool adjustSingleRefInName( ScSingleRefData& rRef, const sc::RefUpdateContext& rCxt, const ScAddress& rPos, ScComplexRefData* pEndOfComplex ) { - ScAddress aAbs = rRef.toAbs(&rCxt.mrDoc, rPos); + ScAddress aAbs = rRef.toAbs(rCxt.mrDoc, rPos); if (aAbs.Tab() < rCxt.maRange.aStart.Tab() || rCxt.maRange.aEnd.Tab() < aAbs.Tab()) { @@ -3552,7 +3552,7 @@ bool adjustSingleRefInName( return false; } - if (!rCxt.maRange.In(rRef.toAbs(&rCxt.mrDoc, rPos))) + if (!rCxt.maRange.In(rRef.toAbs(rCxt.mrDoc, rPos))) return false; bool bChanged = false; @@ -3611,7 +3611,7 @@ bool adjustDoubleRefInName( { if (rCxt.mnRowDelta > 0 && !rRef.Ref1.IsRowRel() && !rRef.Ref2.IsRowRel()) { - ScRange aAbs = rRef.toAbs(&rCxt.mrDoc, rPos); + ScRange aAbs = rRef.toAbs(rCxt.mrDoc, rPos); // Expand only if at least two rows tall. if (aAbs.aStart.Row() < aAbs.aEnd.Row()) { @@ -3628,7 +3628,7 @@ bool adjustDoubleRefInName( } if (rCxt.mnColDelta > 0 && !rRef.Ref1.IsColRel() && !rRef.Ref2.IsColRel()) { - ScRange aAbs = rRef.toAbs(&rCxt.mrDoc, rPos); + ScRange aAbs = rRef.toAbs(rCxt.mrDoc, rPos); // Expand only if at least two columns wide. if (aAbs.aStart.Col() < aAbs.aEnd.Col()) { @@ -3721,7 +3721,7 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceInName( // Don't modify relative references in names. break; - ScAddress aAbs = rRef.toAbs(&rCxt.mrDoc, rPos); + ScAddress aAbs = rRef.toAbs(rCxt.mrDoc, rPos); if (aAbs.Col() < rCxt.maRange.aStart.Col() || rCxt.maRange.aEnd.Col() < aAbs.Col()) // column of the reference is not in the deleted column range. @@ -3750,7 +3750,7 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceInName( // Don't modify relative references in names. break; - ScAddress aAbs = rRef.toAbs(&rCxt.mrDoc, rPos); + ScAddress aAbs = rRef.toAbs(rCxt.mrDoc, rPos); if (aAbs.Row() < rCxt.maRange.aStart.Row() || rCxt.maRange.aEnd.Row() < aAbs.Row()) // row of the reference is not in the deleted row range. @@ -3779,7 +3779,7 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceInName( case svDoubleRef: { ScComplexRefData& rRef = *p->GetDoubleRef(); - ScRange aAbs = rRef.toAbs(&rCxt.mrDoc, rPos); + ScRange aAbs = rRef.toAbs(rCxt.mrDoc, rPos); if (aAbs.aStart.Tab() > rCxt.maRange.aEnd.Tab() || aAbs.aEnd.Tab() < rCxt.maRange.aStart.Tab()) // Sheet references not affected. @@ -3991,7 +3991,7 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceInMovedName( const sc::RefUpdat if (rRef.IsColRel() || rRef.IsRowRel() || rRef.IsTabRel()) continue; - ScAddress aAbs = rRef.toAbs(&rCxt.mrDoc, rPos); + ScAddress aAbs = rRef.toAbs(rCxt.mrDoc, rPos); if (aOldRange.In(aAbs)) { ScAddress aErrorPos( ScAddress::UNINITIALIZED ); @@ -4010,7 +4010,7 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceInMovedName( const sc::RefUpdat rRef.Ref2.IsColRel() || rRef.Ref2.IsRowRel() || rRef.Ref2.IsTabRel()) continue; - ScRange aAbs = rRef.toAbs(&rCxt.mrDoc, rPos); + ScRange aAbs = rRef.toAbs(rCxt.mrDoc, rPos); if (aOldRange.In(aAbs)) { ScRange aErrorRange( ScAddress::UNINITIALIZED ); |