[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Sep 13 13:18:17 UTC 2020


 sc/inc/refdata.hxx                          |    4 +-
 sc/qa/unit/ucalc.cxx                        |    4 +-
 sc/qa/unit/ucalc_formula.cxx                |    8 ++--
 sc/qa/unit/ucalc_sharedformula.cxx          |    2 -
 sc/source/core/data/colorscale.cxx          |   12 +++---
 sc/source/core/data/conditio.cxx            |    4 +-
 sc/source/core/data/documen4.cxx            |    2 -
 sc/source/core/data/formulacell.cxx         |   54 ++++++++++++++--------------
 sc/source/core/data/formulaiter.cxx         |    8 ++--
 sc/source/core/data/grouptokenconverter.cxx |    4 +-
 sc/source/core/tool/compiler.cxx            |   16 ++++----
 sc/source/core/tool/interpr1.cxx            |   18 ++++-----
 sc/source/core/tool/interpr2.cxx            |   12 +++---
 sc/source/core/tool/interpr4.cxx            |    6 +--
 sc/source/core/tool/rangenam.cxx            |   14 +++----
 sc/source/core/tool/refdata.cxx             |    8 ++--
 sc/source/core/tool/reftokenhelper.cxx      |    6 +--
 sc/source/core/tool/refupdat.cxx            |    2 -
 sc/source/core/tool/sharedformula.cxx       |    6 +--
 sc/source/core/tool/token.cxx               |   18 ++++-----
 sc/source/filter/excel/excform.cxx          |   14 +++----
 sc/source/filter/excel/excform8.cxx         |   14 +++----
 sc/source/filter/excel/xechart.cxx          |    4 +-
 sc/source/filter/excel/xeformula.cxx        |   12 +++---
 sc/source/filter/excel/xelink.cxx           |    4 +-
 sc/source/filter/excel/xetable.cxx          |    2 -
 sc/source/filter/excel/xichart.cxx          |    4 +-
 sc/source/filter/excel/xlformula.cxx        |    2 -
 sc/source/filter/lotus/tool.cxx             |    4 +-
 sc/source/filter/qpro/qproform.cxx          |    2 -
 sc/source/ui/miscdlgs/anyrefdg.cxx          |    4 +-
 31 files changed, 137 insertions(+), 137 deletions(-)

New commits:
commit fb2ceb28a820e7775456a137541ef5978a6746b4
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Sep 12 16:53:45 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Sep 13 15:17:36 2020 +0200

    toAbs always dereferences its ScDocument*
    
    Change-Id: I6bddbca2289074ecf333227b3fc1a49da4b431a6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102529
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx
index 055095f485a2..5874f673e128 100644
--- a/sc/inc/refdata.hxx
+++ b/sc/inc/refdata.hxx
@@ -102,7 +102,7 @@ public:
     bool ValidExternal(const ScDocument* pDoc) const;
 
     ScAddress toAbs( ScSheetLimits& rLimits, const ScAddress& rPos ) const;
-    ScAddress toAbs( const ScDocument* pDoc, const ScAddress& rPos ) const;
+    ScAddress toAbs( const ScDocument& rDoc, const ScAddress& rPos ) const;
     void SetAddress( ScSheetLimits& rLimits, const ScAddress& rAddr, const ScAddress& rPos );
     SCROW Row() const;
     SCCOL Col() const;
@@ -169,7 +169,7 @@ struct ScComplexRefData
     }
 
     SC_DLLPUBLIC ScRange toAbs( ScSheetLimits& rLimits, const ScAddress& rPos ) const;
-    SC_DLLPUBLIC ScRange toAbs( const ScDocument* pDoc, const ScAddress& rPos ) const;
+    SC_DLLPUBLIC ScRange toAbs( const ScDocument& rDoc, const ScAddress& rPos ) const;
 
     /** Set a new range, assuming that the ordering of the range matches the
         ordering of the reference data flags already set. */
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index b084cb78350c..fa0bb5cdc0e5 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4648,7 +4648,7 @@ bool hasRange(const ScDocument* pDoc, const std::vector<ScTokenRef>& rRefTokens,
                 if (rRange.aStart != rRange.aEnd)
                     break;
 
-                ScAddress aThis = aData.toAbs(pDoc, rPos);
+                ScAddress aThis = aData.toAbs(*pDoc, rPos);
                 if (aThis == rRange.aStart)
                     return true;
             }
@@ -4656,7 +4656,7 @@ bool hasRange(const ScDocument* pDoc, const std::vector<ScTokenRef>& rRefTokens,
             case formula::svDoubleRef:
             {
                 ScComplexRefData aData = *p->GetDoubleRef();
-                ScRange aThis = aData.toAbs(pDoc, rPos);
+                ScRange aThis = aData.toAbs(*pDoc, rPos);
                 if (aThis == rRange)
                     return true;
             }
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 17af3994f141..93cec516acdd 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -966,14 +966,14 @@ void Test::testFormulaRefData()
     aRef.InitAddress(ScAddress(6,5,0));
 
     aDoubleRef.Extend(pDoc->GetSheetLimits(), aRef, ScAddress());
-    ScRange aTest = aDoubleRef.toAbs(pDoc.get(), ScAddress());
+    ScRange aTest = aDoubleRef.toAbs(*pDoc, ScAddress());
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong start position of extended range.", ScAddress(2,2,0), aTest.aStart);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong end position of extended range.", ScAddress(6,5,0), aTest.aEnd);
 
     ScComplexRefData aDoubleRef2;
     aDoubleRef2.InitRangeRel(pDoc.get(), ScRange(1,2,0,8,6,0), ScAddress(5,5,0));
     aDoubleRef.Extend(pDoc->GetSheetLimits(), aDoubleRef2, ScAddress(5,5,0));
-    aTest = aDoubleRef.toAbs(pDoc.get(), ScAddress(5,5,0));
+    aTest = aDoubleRef.toAbs(*pDoc, ScAddress(5,5,0));
 
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong start position of extended range.", ScAddress(1,2,0), aTest.aStart);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong end position of extended range.", ScAddress(8,6,0), aTest.aEnd);
@@ -1192,7 +1192,7 @@ void Test::testFormulaCompilerImplicitIntersection2Param()
             CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong type of token(third argument to SUMIF)", svDoubleRef, ppTokens[2]->GetType());
 
             ScComplexRefData aSumRangeData = *ppTokens[2]->GetDoubleRef();
-            ScRange aSumRange = aSumRangeData.toAbs(m_pDoc, rCase.aCellAddress);
+            ScRange aSumRange = aSumRangeData.toAbs(*m_pDoc, rCase.aCellAddress);
             CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong sum-range in RPN array", rCase.aSumRange, aSumRange);
 
             CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong IsRel type for start column address in sum-range", rCase.bStartColRel, aSumRangeData.Ref1.IsColRel());
@@ -1373,7 +1373,7 @@ void Test::testFormulaCompilerImplicitIntersection1ParamWithChange()
             CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong type of RPN token(argument to COS)", svSingleRef, ppRPNTokens[0]->GetType());
 
             ScSingleRefData aArgAddrRPN = *ppRPNTokens[0]->GetSingleRef();
-            ScAddress aArgAddrActual = aArgAddrRPN.toAbs(m_pDoc, rCase.aCellAddress);
+            ScAddress aArgAddrActual = aArgAddrRPN.toAbs(*m_pDoc, rCase.aCellAddress);
             CPPUNIT_ASSERT_EQUAL_MESSAGE("Computed implicit intersection singleref is wrong", rCase.aArgAddr, aArgAddrActual);
         }
     }
diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx
index aeb114723f2a..88d1fbae110a 100644
--- a/sc/qa/unit/ucalc_sharedformula.cxx
+++ b/sc/qa/unit/ucalc_sharedformula.cxx
@@ -1048,7 +1048,7 @@ void Test::testSharedFormulasDeleteColumns()
     CPPUNIT_ASSERT_EQUAL(svSingleRef, pToken->GetType());
     const ScSingleRefData* pSRef = pToken->GetSingleRef();
     CPPUNIT_ASSERT(pSRef->IsColDeleted());
-    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), pSRef->toAbs(m_pDoc, ScAddress(1,0,0)).Row());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), pSRef->toAbs(*m_pDoc, ScAddress(1,0,0)).Row());
 
     // The formula string should show #REF! in lieu of the column position (only for Calc A1 syntax).
     sc::CompileFormulaContext aCFCxt(m_pDoc, FormulaGrammar::GRAM_ENGLISH);
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 );
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index 9a897f9278e8..0ebce2e682c6 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -1050,7 +1050,7 @@ ConvErr ExcelToSc::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std:
 
                 ExcRelToScRel( nUINT16, nByte, aSRD, bRangeName );
 
-                rRangeList.Append(aSRD.toAbs(&GetDocImport().getDoc(), aEingPos), nTab);
+                rRangeList.Append(aSRD.toAbs(GetDocImport().getDoc(), aEingPos), nTab);
                 break;
             }
             case 0x45:
@@ -1080,7 +1080,7 @@ ConvErr ExcelToSc::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std:
                 else if( IsComplRowRange( nRowFirst, nRowLast ) )
                     SetComplRow( aCRD );
 
-                rRangeList.Append(aCRD.toAbs(&GetDocImport().getDoc(), aEingPos), nTab);
+                rRangeList.Append(aCRD.toAbs(GetDocImport().getDoc(), aEingPos), nTab);
             }
                 break;
             case 0x46:
@@ -1117,7 +1117,7 @@ ConvErr ExcelToSc::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std:
 
                 ExcRelToScRel( nUINT16, nByte, aSRD, bRNorSF );
 
-                rRangeList.Append(aSRD.toAbs(&GetDocImport().getDoc(), aEingPos), nTab);
+                rRangeList.Append(aSRD.toAbs(GetDocImport().getDoc(), aEingPos), nTab);
                 break;
             }
             case 0x4D:
@@ -1145,7 +1145,7 @@ ConvErr ExcelToSc::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std:
                 else if( IsComplRowRange( nRowFirst, nRowLast ) )
                     SetComplRow( aCRD );
 
-                rRangeList.Append(aCRD.toAbs(&GetDocImport().getDoc(), aEingPos), nTab);
+                rRangeList.Append(aCRD.toAbs(GetDocImport().getDoc(), aEingPos), nTab);
             }
                 break;
             case 0x49:
@@ -1215,10 +1215,10 @@ ConvErr ExcelToSc::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std:
                         aCRD.Ref2.SetAbsTab(static_cast<SCTAB>(nTabLast));
                         b3D = ( static_cast<SCTAB>(nTabLast) != aEingPos.Tab() );
                         aCRD.Ref2.SetFlag3D( b3D );
-                        rRangeList.Append(aCRD.toAbs(&GetDocImport().getDoc(), aEingPos), nTab);
+                        rRangeList.Append(aCRD.toAbs(GetDocImport().getDoc(), aEingPos), nTab);
                     }
                     else
-                        rRangeList.Append(aSRD.toAbs(&GetDocImport().getDoc(), aEingPos), nTab);
+                        rRangeList.Append(aSRD.toAbs(GetDocImport().getDoc(), aEingPos), nTab);
                 }
             }
 
@@ -1275,7 +1275,7 @@ ConvErr ExcelToSc::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std:
                     else if( IsComplRowRange( nRowFirst, nRowLast ) )
                         SetComplRow( aCRD );
 
-                    rRangeList.Append(aCRD.toAbs(&GetDocImport().getDoc(), aEingPos), nTab);
+                    rRangeList.Append(aCRD.toAbs(GetDocImport().getDoc(), aEingPos), nTab);
                 }//END in current Workbook
             }
                 break;
diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index a16dbe60a0f7..389444c7ee96 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -1068,7 +1068,7 @@ ConvErr ExcelToSc8::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std
 
                 ExcRelToScRel8( nRow, nCol, aSRD, bRangeName );
 
-                rRangeList.Append(aSRD.toAbs(&GetDocImport().getDoc(), aEingPos), nTab);
+                rRangeList.Append(aSRD.toAbs(GetDocImport().getDoc(), aEingPos), nTab);
             }
                 break;
             case 0x45:
@@ -1098,7 +1098,7 @@ ConvErr ExcelToSc8::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std
                 else if( IsComplRowRange( nRowFirst, nRowLast ) )
                     SetComplRow( aCRD );
 
-                rRangeList.Append(aCRD.toAbs(&GetDocImport().getDoc(), aEingPos), nTab);
+                rRangeList.Append(aCRD.toAbs(GetDocImport().getDoc(), aEingPos), nTab);
             }
                 break;
             case 0x46:
@@ -1142,7 +1142,7 @@ ConvErr ExcelToSc8::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std
 
                 ExcRelToScRel8( nRow, nCol, aSRD, bRNorSF );
 
-                rRangeList.Append(aSRD.toAbs(&GetDocImport().getDoc(), aEingPos), nTab);
+                rRangeList.Append(aSRD.toAbs(GetDocImport().getDoc(), aEingPos), nTab);
             }
                 break;
             case 0x4D:
@@ -1170,7 +1170,7 @@ ConvErr ExcelToSc8::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std
                 else if( IsComplRowRange( nRowFirst, nRowLast ) )
                     SetComplRow( aCRD );
 
-                rRangeList.Append(aCRD.toAbs(&GetDocImport().getDoc(), aEingPos), nTab);
+                rRangeList.Append(aCRD.toAbs(GetDocImport().getDoc(), aEingPos), nTab);
             }
                 break;
             case 0x4E:
@@ -1212,10 +1212,10 @@ ConvErr ExcelToSc8::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std
                         aCRD.Ref1 = aSRD;
                         aCRD.Ref2 = aSRD;
                         aCRD.Ref2.SetAbsTab(nLastScTab);
-                        rRangeList.Append(aCRD.toAbs(&GetDocImport().getDoc(), aEingPos), nTab);
+                        rRangeList.Append(aCRD.toAbs(GetDocImport().getDoc(), aEingPos), nTab);
                     }
                     else
-                        rRangeList.Append(aSRD.toAbs(&GetDocImport().getDoc(), aEingPos), nTab);
+                        rRangeList.Append(aSRD.toAbs(GetDocImport().getDoc(), aEingPos), nTab);
                 }
             }
                 break;
@@ -1250,7 +1250,7 @@ ConvErr ExcelToSc8::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std
                     else if( IsComplRowRange( nRw1, nRw2 ) )
                         SetComplRow( aCRD );
 
-                    rRangeList.Append(aCRD.toAbs(&GetDocImport().getDoc(), aEingPos), nTab);
+                    rRangeList.Append(aCRD.toAbs(GetDocImport().getDoc(), aEingPos), nTab);
                 }
             }
                 break;
diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx
index ff3f8c2ea30e..8c25aa3d13d2 100644
--- a/sc/source/filter/excel/xechart.cxx
+++ b/sc/source/filter/excel/xechart.cxx
@@ -917,8 +917,8 @@ sal_uInt16 XclExpChSourceLink::ConvertDataSequence( Reference< XDataSequence > c
             {
                 // split 3-dimensional ranges into single sheets
                 const ScComplexRefData& rComplexRef = *pToken->GetDoubleRef();
-                ScAddress aAbs1 = rComplexRef.Ref1.toAbs(&GetRoot().GetDoc(), ScAddress());
-                ScAddress aAbs2 = rComplexRef.Ref2.toAbs(&GetRoot().GetDoc(), ScAddress());
+                ScAddress aAbs1 = rComplexRef.Ref1.toAbs(GetRoot().GetDoc(), ScAddress());
+                ScAddress aAbs2 = rComplexRef.Ref2.toAbs(GetRoot().GetDoc(), ScAddress());
                 for (SCTAB nScTab = aAbs1.Tab(); nScTab <= aAbs2.Tab(); ++nScTab)
                 {
                     // split 2-dimensional ranges into single columns
diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx
index ab942848c013..07089c681f81 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -1839,7 +1839,7 @@ SCTAB XclExpFmlaCompImpl::GetScTab( const ScSingleRefData& rRefData ) const
     if (!mxData->mpScBasePos)
         return SCTAB_INVALID;
 
-    return rRefData.toAbs(&GetRoot().GetDoc(), *mxData->mpScBasePos).Tab();
+    return rRefData.toAbs(GetRoot().GetDoc(), *mxData->mpScBasePos).Tab();
 }
 
 bool XclExpFmlaCompImpl::IsRef2D( const ScSingleRefData& rRefData, bool bCheck3DFlag ) const
@@ -1876,7 +1876,7 @@ void XclExpFmlaCompImpl::ConvertRefData(
     if( mxData->mpScBasePos )
     {
         // *** reference position exists (cell, matrix) - convert to absolute ***
-        ScAddress aAbs = rRefData.toAbs(&GetRoot().GetDoc(), *mxData->mpScBasePos);
+        ScAddress aAbs = rRefData.toAbs(GetRoot().GetDoc(), *mxData->mpScBasePos);
 
         // convert column index
         if (bTruncMaxCol && (aAbs.Col() == mnMaxScCol))
@@ -2060,7 +2060,7 @@ void XclExpFmlaCompImpl::ProcessExternalCellRef( const XclExpScToken& rTokData )
         sal_uInt16 nFileId = rTokData.mpScToken->GetIndex();
         OUString aTabName = rTokData.mpScToken->GetString().getString();
         if( mxData->mrCfg.mbFromCell && mxData->mpScBasePos )
-            mxData->mpLinkMgr->StoreCell(nFileId, aTabName, aRefData.toAbs(&GetRoot().GetDoc(), *mxData->mpScBasePos));
+            mxData->mpLinkMgr->StoreCell(nFileId, aTabName, aRefData.toAbs(GetRoot().GetDoc(), *mxData->mpScBasePos));
 
         // 1-based EXTERNSHEET index and 0-based Excel sheet indexes
         sal_uInt16 nExtSheet, nFirstSBTab, nLastSBTab;
@@ -2096,7 +2096,7 @@ void XclExpFmlaCompImpl::ProcessExternalRangeRef( const XclExpScToken& rTokData
         sal_uInt16 nFileId = rTokData.mpScToken->GetIndex();
         OUString aTabName = rTokData.mpScToken->GetString().getString();
         if( mxData->mrCfg.mbFromCell && mxData->mpScBasePos )
-            mxData->mpLinkMgr->StoreCellRange(nFileId, aTabName, aRefData.toAbs(&GetRoot().GetDoc(), *mxData->mpScBasePos));
+            mxData->mpLinkMgr->StoreCellRange(nFileId, aTabName, aRefData.toAbs(GetRoot().GetDoc(), *mxData->mpScBasePos));
 
         // 1-based EXTERNSHEET index and 0-based Excel sheet indexes
         sal_uInt16 nExtSheet, nFirstSBTab, nLastSBTab;
@@ -2175,14 +2175,14 @@ void XclExpFmlaCompImpl::ProcessExternalName( const XclExpScToken& rTokData )
                             {
                                 ScSingleRefData aRefData = *pScToken->GetSingleRef();
                                 mxData->mpLinkMgr->StoreCell(
-                                    nFileId, pScToken->GetString().getString(), aRefData.toAbs(&GetRoot().GetDoc(), *mxData->mpScBasePos));
+                                    nFileId, pScToken->GetString().getString(), aRefData.toAbs(GetRoot().GetDoc(), *mxData->mpScBasePos));
                             }
                             break;
                             case svExternalDoubleRef:
                             {
                                 ScComplexRefData aRefData = *pScToken->GetDoubleRef();
                                 mxData->mpLinkMgr->StoreCellRange(
-                                    nFileId, pScToken->GetString().getString(), aRefData.toAbs(&GetRoot().GetDoc(), *mxData->mpScBasePos));
+                                    nFileId, pScToken->GetString().getString(), aRefData.toAbs(GetRoot().GetDoc(), *mxData->mpScBasePos));
                             }
                             break;
                             default:
diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index 52ca00f0f465..644c7a57a35f 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -2391,8 +2391,8 @@ void XclExpLinkManagerImpl8::FindExtSheet(
 
 void XclExpLinkManagerImpl8::StoreCellRange( const ScSingleRefData& rRef1, const ScSingleRefData& rRef2, const ScAddress& rPos )
 {
-    ScAddress aAbs1 = rRef1.toAbs(&GetRoot().GetDoc(), rPos);
-    ScAddress aAbs2 = rRef2.toAbs(&GetRoot().GetDoc(), rPos);
+    ScAddress aAbs1 = rRef1.toAbs(GetRoot().GetDoc(), rPos);
+    ScAddress aAbs2 = rRef2.toAbs(GetRoot().GetDoc(), rPos);
     if (!(!rRef1.IsDeleted() && !rRef2.IsDeleted() && (aAbs1.Tab() >= 0) && (aAbs2.Tab() >= 0)))
         return;
 
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 3891e80601c8..1b96f91ac788 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -167,7 +167,7 @@ XclExpArrayRef XclExpArrayBuffer::FindArray( const ScTokenArray& rScTokArr, cons
         return xRec;
 
     const ScSingleRefData& rRef = *pToken->GetSingleRef();
-    ScAddress aAbsPos = rRef.toAbs(&GetRoot().GetDoc(), rBasePos);
+    ScAddress aAbsPos = rRef.toAbs(GetRoot().GetDoc(), rBasePos);
     XclExpArrayMap::const_iterator it = maRecMap.find(aAbsPos);
 
     if (it != maRecMap.end())
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 43f6d7c2ccb8..10650658d8be 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -801,8 +801,8 @@ sal_uInt16 XclImpChSourceLink::GetCellCount() const
                 {
                     // cell range
                     const ScComplexRefData& rComplexRef = *pToken->GetDoubleRef();
-                    ScAddress aAbs1 = rComplexRef.Ref1.toAbs(&GetRoot().GetDoc(), ScAddress());
-                    ScAddress aAbs2 = rComplexRef.Ref2.toAbs(&GetRoot().GetDoc(), ScAddress());
+                    ScAddress aAbs1 = rComplexRef.Ref1.toAbs(GetRoot().GetDoc(), ScAddress());
+                    ScAddress aAbs2 = rComplexRef.Ref2.toAbs(GetRoot().GetDoc(), ScAddress());
                     sal_uInt32 nTabs = static_cast<sal_uInt32>(aAbs2.Tab() - aAbs1.Tab() + 1);
                     sal_uInt32 nCols = static_cast<sal_uInt32>(aAbs2.Col() - aAbs1.Col() + 1);
                     sal_uInt32 nRows = static_cast<sal_uInt32>(aAbs2.Row() - aAbs1.Row() + 1);
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index f636c5c99bb7..01f1dc2ad724 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -931,7 +931,7 @@ bool lclGetAddress( const ScDocument* pDoc, ScAddress& rAddress, const FormulaTo
     if( bIsSingleRef )
     {
         const ScSingleRefData& rRef = *rToken.GetSingleRef();
-        rAddress = rRef.toAbs(pDoc, rPos);
+        rAddress = rRef.toAbs(*pDoc, rPos);
         bIsSingleRef = !rRef.IsDeleted();
     }
     return bIsSingleRef;
diff --git a/sc/source/filter/lotus/tool.cxx b/sc/source/filter/lotus/tool.cxx
index 52248f796f0f..423c246b6e12 100644
--- a/sc/source/filter/lotus/tool.cxx
+++ b/sc/source/filter/lotus/tool.cxx
@@ -444,8 +444,8 @@ void RangeNameBufferWK3::Add( const ScDocument* pDoc, const OUString& rOrgName,
 
     const ScSingleRefData& rRef1 = rCRD.Ref1;
     const ScSingleRefData& rRef2 = rCRD.Ref2;
-    ScAddress aAbs1 = rRef1.toAbs(pDoc, ScAddress());
-    ScAddress aAbs2 = rRef2.toAbs(pDoc, ScAddress());
+    ScAddress aAbs1 = rRef1.toAbs(*pDoc, ScAddress());
+    ScAddress aAbs2 = rRef2.toAbs(*pDoc, ScAddress());
     if (aAbs1 == aAbs2)
     {
         pScTokenArray->AddSingleReference( rCRD.Ref1 );
diff --git a/sc/source/filter/qpro/qproform.cxx b/sc/source/filter/qpro/qproform.cxx
index 2cb650eb45fc..456d9f0760bb 100644
--- a/sc/source/filter/qpro/qproform.cxx
+++ b/sc/source/filter/qpro/qproform.cxx
@@ -57,7 +57,7 @@ void QProToSc::ReadSRD( const ScDocument* pDoc, ScSingleRefData& rSRD, sal_Int8
     {
         rSRD.SetAbsTab(nPage);
     }
-    if (rSRD.toAbs(pDoc, aEingPos).Tab() != aEingPos.Tab())
+    if (rSRD.toAbs(*pDoc, aEingPos).Tab() != aEingPos.Tab())
         rSRD.SetFlag3D(true);
 }
 
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 1f3a98560d8f..5610e6d63296 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -212,12 +212,12 @@ void ScFormulaReferenceHelper::ShowFormulaReference(const OUString& rStr)
             if(bDoubleRef)
             {
                 ScComplexRefData aRef( *pToken->GetDoubleRef() );
-                aRange = aRef.toAbs(pDoc, aPos);
+                aRange = aRef.toAbs(*pDoc, aPos);
             }
             else
             {
                 ScSingleRefData aRef( *pToken->GetSingleRef() );
-                aRange.aStart = aRef.toAbs(pDoc, aPos);
+                aRange.aStart = aRef.toAbs(*pDoc, aPos);
                 aRange.aEnd = aRange.aStart;
             }
             Color aColName=ScRangeFindList::GetColorName(nIndex++);


More information about the Libreoffice-commits mailing list