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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 16 20:29:12 UTC 2020


 sc/inc/formulacell.hxx                       |    4 ++--
 sc/source/core/data/clipcontext.cxx          |    2 +-
 sc/source/core/data/column.cxx               |    4 ++--
 sc/source/core/data/column3.cxx              |   14 +++++++-------
 sc/source/core/data/conditio.cxx             |    8 ++++----
 sc/source/core/data/documen4.cxx             |    4 ++--
 sc/source/core/data/documentimport.cxx       |    8 ++++----
 sc/source/core/data/formulacell.cxx          |   12 ++++++------
 sc/source/core/data/table2.cxx               |    4 ++--
 sc/source/core/data/table3.cxx               |    2 +-
 sc/source/core/data/validat.cxx              |    2 +-
 sc/source/core/tool/consoli.cxx              |    4 ++--
 sc/source/filter/excel/excform.cxx           |    6 +++---
 sc/source/filter/excel/impop.cxx             |    4 ++--
 sc/source/filter/excel/xipivot.cxx           |    2 +-
 sc/source/filter/lotus/lotimpop.cxx          |    2 +-
 sc/source/filter/lotus/op.cxx                |    4 ++--
 sc/source/filter/oox/formulabuffer.cxx       |    8 ++++----
 sc/source/filter/oox/revisionfragment.cxx    |    2 +-
 sc/source/filter/orcus/interface.cxx         |    2 +-
 sc/source/filter/qpro/qpro.cxx               |    2 +-
 sc/source/filter/xcl97/XclImpChangeTrack.cxx |    2 +-
 sc/source/filter/xml/xmlcelli.cxx            |    2 +-
 sc/source/ui/docshell/impex.cxx              |    2 +-
 sc/source/ui/unoobj/cellsuno.cxx             |    2 +-
 sc/source/ui/unoobj/funcuno.cxx              |    2 +-
 sc/source/ui/view/viewfun4.cxx               |    2 +-
 sc/source/ui/view/viewfunc.cxx               |    2 +-
 28 files changed, 57 insertions(+), 57 deletions(-)

New commits:
commit eb55bc5eae82873492cfd7577fb553b1c5abff6b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Sep 15 14:56:12 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Sep 16 22:28:09 2020 +0200

    ScFormulaCell ctor variants never called with null ScDocument*
    
    Change-Id: Ie0814a8948e2a4bcf723f0418c496fbbe85495ae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102878
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index e959b976d4da..778de268aaf6 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -185,11 +185,11 @@ public:
      * formula cell being constructed.  The caller <i>must not</i> pass a NULL
      * token array pointer.
      */
-    ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos, std::unique_ptr<ScTokenArray> pArray,
+    ScFormulaCell( ScDocument& rDoc, const ScAddress& rPos, std::unique_ptr<ScTokenArray> pArray,
                    const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT,
                    ScMatrixMode cMatInd = ScMatrixMode::NONE );
 
-    ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos, const ScTokenArray& rArray,
+    ScFormulaCell( ScDocument& rDoc, const ScAddress& rPos, const ScTokenArray& rArray,
                    const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT,
                    ScMatrixMode cMatInd = ScMatrixMode::NONE );
 
diff --git a/sc/source/core/data/clipcontext.cxx b/sc/source/core/data/clipcontext.cxx
index f40b6f921898..f0e5db210fbd 100644
--- a/sc/source/core/data/clipcontext.cxx
+++ b/sc/source/core/data/clipcontext.cxx
@@ -154,7 +154,7 @@ void CopyFromClipContext::setSingleCell( const ScAddress& rSrcPos, const ScColum
 
         ScTokenArray aArr(*mpClipDoc);
         aArr.AddSingleReference(aRef);
-        rSrcCell.set(new ScFormulaCell(mpClipDoc, rSrcPos, aArr));
+        rSrcCell.set(new ScFormulaCell(*mpClipDoc, rSrcPos, aArr));
         return;
     }
 
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index f5dbcb96f16f..a50cdffc702f 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1293,7 +1293,7 @@ class CopyAsLinkHandler
 
         ScTokenArray aArr(mrDestCol.GetDoc());
         aArr.AddSingleReference(aRef);
-        return new ScFormulaCell(&mrDestCol.GetDoc(), ScAddress(mrDestCol.GetCol(), nRow, mrDestCol.GetTab()), aArr);
+        return new ScFormulaCell(mrDestCol.GetDoc(), ScAddress(mrDestCol.GetCol(), nRow, mrDestCol.GetTab()), aArr);
     }
 
     void createRefBlock(const sc::CellStoreType::value_type& aNode, size_t nOffset, size_t nDataSize)
@@ -2325,7 +2325,7 @@ class UpdateRefOnNonCopy
 
         // Insert the old formula group into the undo document.
         ScAddress aUndoPos = rOldPos;
-        ScFormulaCell* pFC = new ScFormulaCell(mpUndoDoc, aUndoPos, rOldCode.Clone());
+        ScFormulaCell* pFC = new ScFormulaCell(*mpUndoDoc, aUndoPos, rOldCode.Clone());
 
         if (nLength == 1)
         {
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index b963b1040806..2aff621e44f3 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1099,7 +1099,7 @@ class CopyCellsFromClipHandler
         aArr.AddSingleReference(aRef);
 
         mrDestCol.SetFormulaCell(
-            maDestBlockPos, nDestRow, new ScFormulaCell(&mrDestCol.GetDoc(), aDestPos, aArr));
+            maDestBlockPos, nDestRow, new ScFormulaCell(mrDestCol.GetDoc(), aDestPos, aArr));
     }
 
     void duplicateNotes(SCROW nStartRow, size_t nDataSize, bool bCloneCaption )
@@ -1431,7 +1431,7 @@ void ScColumn::CopyFromClip(
 
             ScTokenArray aArr(GetDoc());
             aArr.AddSingleReference( aRef );
-            SetFormulaCell(nDestRow, new ScFormulaCell(&rDocument, aDestPos, aArr));
+            SetFormulaCell(nDestRow, new ScFormulaCell(rDocument, aDestPos, aArr));
         }
 
         // Don't forget to copy the cell text attributes.
@@ -1609,7 +1609,7 @@ public:
                 miNewCellsPos = maNewCells.set(
                     miNewCellsPos, nRow-mnRowOffset,
                     new ScFormulaCell(
-                        &mrDestColumn.GetDoc(), ScAddress(mrDestColumn.GetCol(), nRow, mrDestColumn.GetTab()), aArr));
+                        mrDestColumn.GetDoc(), ScAddress(mrDestColumn.GetCol(), nRow, mrDestColumn.GetTab()), aArr));
             }
             break;
             case sc::element_type_string:
@@ -1666,7 +1666,7 @@ public:
                 miNewCellsPos = maNewCells.set(
                     miNewCellsPos, nRow-mnRowOffset,
                     new ScFormulaCell(
-                        &mrDestColumn.GetDoc(), ScAddress(mrDestColumn.GetCol(), nRow, mrDestColumn.GetTab()), aArr));
+                        mrDestColumn.GetDoc(), ScAddress(mrDestColumn.GetCol(), nRow, mrDestColumn.GetTab()), aArr));
             }
             break;
             case sc::element_type_formula:
@@ -1696,7 +1696,7 @@ public:
                 miNewCellsPos = maNewCells.set(
                     miNewCellsPos, nRow-mnRowOffset,
                     new ScFormulaCell(
-                        &mrDestColumn.GetDoc(), ScAddress(mrDestColumn.GetCol(), nRow, mrDestColumn.GetTab()), aArr));
+                        mrDestColumn.GetDoc(), ScAddress(mrDestColumn.GetCol(), nRow, mrDestColumn.GetTab()), aArr));
             }
             break;
             case sc::element_type_string:
@@ -1775,7 +1775,7 @@ public:
                     miNewCellsPos = maNewCells.set(
                         miNewCellsPos, nDestRow-mnRowOffset,
                         new ScFormulaCell(
-                            &mrDestColumn.GetDoc(), ScAddress(mrDestColumn.GetCol(), nDestRow, mrDestColumn.GetTab()), aArr));
+                            mrDestColumn.GetDoc(), ScAddress(mrDestColumn.GetCol(), nDestRow, mrDestColumn.GetTab()), aArr));
                 }
                 break;
                 default:
@@ -2275,7 +2275,7 @@ void ScColumn::SetFormula( SCROW nRow, const ScTokenArray& rArray, formula::Form
 
     std::vector<SCROW> aNewSharedRows;
     sc::CellStoreType::iterator it = GetPositionToInsert(nRow, aNewSharedRows, true);
-    ScFormulaCell* pCell = new ScFormulaCell(&GetDoc(), aPos, rArray, eGram);
+    ScFormulaCell* pCell = new ScFormulaCell(GetDoc(), aPos, rArray, eGram);
     sal_uInt32 nCellFormat = GetNumberFormat(GetDoc().GetNonThreadedContext(), nRow);
     if( (nCellFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
         pCell->SetNeedNumberFormat(true);
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index bd239fc84fe4..2fa970066e9c 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -399,7 +399,7 @@ void ScConditionEntry::MakeCells( const ScAddress& rPos )
     {
         // pFCell1 will hold a flat-copied ScTokenArray sharing ref-counted
         // code tokens with pFormula1
-        pFCell1.reset( new ScFormulaCell(mpDoc, rPos, *pFormula1) );
+        pFCell1.reset( new ScFormulaCell(*mpDoc, rPos, *pFormula1) );
         pFCell1->StartListeningTo( *mpDoc );
     }
 
@@ -407,7 +407,7 @@ void ScConditionEntry::MakeCells( const ScAddress& rPos )
     {
         // pFCell2 will hold a flat-copied ScTokenArray sharing ref-counted
         // code tokens with pFormula2
-        pFCell2.reset( new ScFormulaCell(mpDoc, rPos, *pFormula2) );
+        pFCell2.reset( new ScFormulaCell(*mpDoc, rPos, *pFormula2) );
         pFCell2->StartListeningTo( *mpDoc );
     }
 }
@@ -650,7 +650,7 @@ void ScConditionEntry::Interpret( const ScAddress& rPos )
     ScFormulaCell* pEff1 = pFCell1.get();
     if ( bRelRef1 )
     {
-        pTemp1.reset(pFormula1 ? new ScFormulaCell(mpDoc, rPos, *pFormula1) : new ScFormulaCell(*mpDoc, rPos));
+        pTemp1.reset(pFormula1 ? new ScFormulaCell(*mpDoc, rPos, *pFormula1) : new ScFormulaCell(*mpDoc, rPos));
         pEff1 = pTemp1.get();
     }
     if ( pEff1 )
@@ -680,7 +680,7 @@ void ScConditionEntry::Interpret( const ScAddress& rPos )
     ScFormulaCell* pEff2 = pFCell2.get(); //@ 1!=2
     if ( bRelRef2 )
     {
-        pTemp2.reset(pFormula2 ? new ScFormulaCell(mpDoc, rPos, *pFormula2) : new ScFormulaCell(*mpDoc, rPos));
+        pTemp2.reset(pFormula2 ? new ScFormulaCell(*mpDoc, rPos, *pFormula2) : new ScFormulaCell(*mpDoc, rPos));
         pEff2 = pTemp2.get();
     }
     if ( pEff2 )
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index c7ba80d4ab31..f9934976ce9a 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -279,7 +279,7 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1,
     ScFormulaCell* pCell;
     ScAddress aPos( nCol1, nRow1, nTab1 );
     if (pArr)
-        pCell = new ScFormulaCell(this, aPos, *pArr, eGram, ScMatrixMode::Formula);
+        pCell = new ScFormulaCell(*this, aPos, *pArr, eGram, ScMatrixMode::Formula);
     else
         pCell = new ScFormulaCell(*this, aPos, rFormula, eGram, ScMatrixMode::Formula);
     pCell->SetMatColsRows( nCol2 - nCol1 + 1, nRow2 - nRow1 + 1 );
@@ -345,7 +345,7 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1,
                 aRefData.SetAddress(GetSheetLimits(), aBasePos, aPos);
                 *t->GetSingleRef() = aRefData;
                 std::unique_ptr<ScTokenArray> pTokArr(aArr.Clone());
-                pCell = new ScFormulaCell(this, aPos, *pTokArr, eGram, ScMatrixMode::Reference);
+                pCell = new ScFormulaCell(*this, aPos, *pTokArr, eGram, ScMatrixMode::Reference);
                 pTab->SetFormulaCell(nCol, nRow, pCell);
             }
         }
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index fb44fb958545..ed018a124711 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -343,7 +343,7 @@ void ScDocumentImport::setFormulaCell(const ScAddress& rPos, std::unique_ptr<ScT
         return;
 
     std::unique_ptr<ScFormulaCell> pFC =
-        std::make_unique<ScFormulaCell>(&mpImpl->mrDoc, rPos, std::move(pArray));
+        std::make_unique<ScFormulaCell>(mpImpl->mrDoc, rPos, std::move(pArray));
 
     mpImpl->mrDoc.CheckLinkFormulaNeedingCheck( *pFC->GetCode());
 
@@ -391,7 +391,7 @@ void ScDocumentImport::setMatrixCells(
     sc::CellStoreType& rCells = pTab->aCol[rBasePos.Col()].maCells;
 
     // Set the master cell.
-    ScFormulaCell* pCell = new ScFormulaCell(&mpImpl->mrDoc, rBasePos, rArray, eGram, ScMatrixMode::Formula);
+    ScFormulaCell* pCell = new ScFormulaCell(mpImpl->mrDoc, rBasePos, rArray, eGram, ScMatrixMode::Formula);
 
     mpImpl->mrDoc.CheckLinkFormulaNeedingCheck( *pCell->GetCode());
 
@@ -422,7 +422,7 @@ void ScDocumentImport::setMatrixCells(
         aRefData.SetAddress(mpImpl->mrDoc.GetSheetLimits(), rBasePos, aPos);
         *t->GetSingleRef() = aRefData;
         std::unique_ptr<ScTokenArray> pTokArr(aArr.Clone());
-        pCell = new ScFormulaCell(&mpImpl->mrDoc, aPos, *pTokArr, eGram, ScMatrixMode::Reference);
+        pCell = new ScFormulaCell(mpImpl->mrDoc, aPos, *pTokArr, eGram, ScMatrixMode::Reference);
         pBlockPos->miCellPos =
             rCells.set(pBlockPos->miCellPos, aPos.Row(), pCell);
     }
@@ -442,7 +442,7 @@ void ScDocumentImport::setMatrixCells(
             aRefData.SetAddress(mpImpl->mrDoc.GetSheetLimits(), rBasePos, aPos);
             *t->GetSingleRef() = aRefData;
             std::unique_ptr<ScTokenArray> pTokArr(aArr.Clone());
-            pCell = new ScFormulaCell(&mpImpl->mrDoc, aPos, *pTokArr, eGram, ScMatrixMode::Reference);
+            pCell = new ScFormulaCell(mpImpl->mrDoc, aPos, *pTokArr, eGram, ScMatrixMode::Reference);
             pBlockPos->miCellPos =
                 rColCells.set(pBlockPos->miCellPos, aPos.Row(), pCell);
         }
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 98ea70caac6a..30442b6d2337 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -669,7 +669,7 @@ ScFormulaCell::ScFormulaCell( ScDocument& rDoc, const ScAddress& rPos,
 }
 
 ScFormulaCell::ScFormulaCell(
-    ScDocument* pDoc, const ScAddress& rPos, std::unique_ptr<ScTokenArray> pArray,
+    ScDocument& rDoc, const ScAddress& rPos, std::unique_ptr<ScTokenArray> pArray,
     const FormulaGrammar::Grammar eGrammar, ScMatrixMode cMatInd ) :
     bDirty( true ),
     bTableOpDirty( false ),
@@ -690,7 +690,7 @@ ScFormulaCell::ScFormulaCell(
     nFormatType ( SvNumFormatType::NUMBER ),
     eTempGrammar( eGrammar),
     pCode(pArray.release()),
-    pDocument( pDoc ),
+    pDocument( &rDoc ),
     pPrevious(nullptr),
     pNext(nullptr),
     pPreviousTrack(nullptr),
@@ -721,7 +721,7 @@ ScFormulaCell::ScFormulaCell(
 }
 
 ScFormulaCell::ScFormulaCell(
-    ScDocument* pDoc, const ScAddress& rPos, const ScTokenArray& rArray,
+    ScDocument& rDoc, const ScAddress& rPos, const ScTokenArray& rArray,
     const FormulaGrammar::Grammar eGrammar, ScMatrixMode cMatInd ) :
     bDirty( true ),
     bTableOpDirty( false ),
@@ -742,7 +742,7 @@ ScFormulaCell::ScFormulaCell(
     nFormatType ( SvNumFormatType::NUMBER ),
     eTempGrammar( eGrammar),
     pCode(new ScTokenArray(rArray)), // also implicitly does Finalize() on the array
-    pDocument( pDoc ),
+    pDocument( &rDoc ),
     pPrevious(nullptr),
     pNext(nullptr),
     pPreviousTrack(nullptr),
@@ -3247,7 +3247,7 @@ void setOldCodeToUndo(
 
     ScFormulaCell* pFCell =
         new ScFormulaCell(
-            &rUndoDoc, aUndoPos, pOldCode ? *pOldCode : ScTokenArray(rUndoDoc), eTempGrammar, cMatrixFlag);
+            rUndoDoc, aUndoPos, pOldCode ? *pOldCode : ScTokenArray(rUndoDoc), eTempGrammar, cMatrixFlag);
 
     pFCell->SetResultToken(nullptr);  // to recognize it as changed later (Cut/Paste!)
     rUndoDoc.SetFormulaCell(aUndoPos, pFCell);
@@ -3852,7 +3852,7 @@ void ScFormulaCell::UpdateTranspose( const ScRange& rSource, const ScAddress& rD
         if (pUndoDoc)
         {
             ScFormulaCell* pFCell = new ScFormulaCell(
-                    pUndoDoc, aPos, pOld ? *pOld : ScTokenArray(*pUndoDoc), eTempGrammar, cMatrixFlag);
+                    *pUndoDoc, aPos, pOld ? *pOld : ScTokenArray(*pUndoDoc), eTempGrammar, cMatrixFlag);
 
             pFCell->aResult.SetToken( nullptr);  // to recognize it as changed later (Cut/Paste!)
             pUndoDoc->SetFormulaCell(aPos, pFCell);
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index a5ecf2b228f9..3f91e77fab27 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -815,7 +815,7 @@ class TransClipHandler
 
         ScTokenArray aArr(mrClipTab.GetDoc());
         aArr.AddSingleReference(aRef);
-        return new ScFormulaCell(&mrClipTab.GetDoc(), rDestPos, aArr);
+        return new ScFormulaCell(mrClipTab.GetDoc(), rDestPos, aArr);
     }
 
     void setLink(size_t nRow)
@@ -917,7 +917,7 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
 
                 pTransClip->SetFormulaCell(
                     static_cast<SCCOL>(nRow-nRow1), static_cast<SCROW>(nCol-nCol1),
-                    new ScFormulaCell(&rDestDoc, aDestPos, aArr));
+                    new ScFormulaCell(rDestDoc, aDestPos, aArr));
             }
         }
         else
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 1c8d5db104bc..990eaa8b1fe2 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2173,7 +2173,7 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam )
             aArr.AddOpCode( ocClose );
             aArr.AddOpCode( ocStop );
             ScFormulaCell* pCell = new ScFormulaCell(
-                &rDocument, ScAddress(nResCols[nResult], rRowEntry.nDestRow, nTab), aArr);
+                rDocument, ScAddress(nResCols[nResult], rRowEntry.nDestRow, nTab), aArr);
             if ( rParam.bIncludePattern )
                 pCell->SetNeedNumberFormat(true);
 
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 9356de1f2ce9..db1e4b8cd57d 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -686,7 +686,7 @@ bool ScValidationData::GetSelectionFromFormula(
         return false;
 
     ScFormulaCell aValidationSrc(
-        pDocument, rPos, rTokArr, formula::FormulaGrammar::GRAM_DEFAULT, ScMatrixMode::Formula);
+        *pDocument, rPos, rTokArr, formula::FormulaGrammar::GRAM_DEFAULT, ScMatrixMode::Formula);
 
     // Make sure the formula gets interpreted and a result is delivered,
     // regardless of the AutoCalc setting.
diff --git a/sc/source/core/tool/consoli.cxx b/sc/source/core/tool/consoli.cxx
index a2955029e72e..b3ba355536b0 100644
--- a/sc/source/core/tool/consoli.cxx
+++ b/sc/source/core/tool/consoli.cxx
@@ -482,7 +482,7 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow,
                                 aRefArr.AddOpCode(ocStop);
                                 ScAddress aDest( sal::static_int_cast<SCCOL>(nCol+nArrX),
                                                  sal::static_int_cast<SCROW>(nRow+nArrY+nPos), nTab );
-                                ScFormulaCell* pCell = new ScFormulaCell(pDestDoc, aDest, aRefArr);
+                                ScFormulaCell* pCell = new ScFormulaCell(*pDestDoc, aDest, aRefArr);
                                 pDestDoc->SetFormulaCell(aDest, pCell);
                             }
                         }
@@ -502,7 +502,7 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow,
                         aArr.AddDoubleReference(aCRef);
                         aArr.AddOpCode(ocClose);
                         aArr.AddOpCode(ocStop);
-                        ScFormulaCell* pCell = new ScFormulaCell(pDestDoc, aDest, aArr);
+                        ScFormulaCell* pCell = new ScFormulaCell(*pDestDoc, aDest, aArr);
                         pDestDoc->SetFormulaCell(aDest, pCell);
                     }
                 }
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index be3401760fd0..020f185a2d58 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -123,11 +123,11 @@ void ImportExcel::Formula(
                 ScFormulaCell* pCell;
                 if (pSharedCode->NeedsWrapReference(aScPos, EXC_MAXCOL8, EXC_MAXROW8))
                 {
-                    pCell = new ScFormulaCell(&rD, aScPos, pSharedCode->Clone());
+                    pCell = new ScFormulaCell(rD, aScPos, pSharedCode->Clone());
                     pCell->GetCode()->WrapReference(aScPos, EXC_MAXCOL8, EXC_MAXROW8);
                 }
                 else
-                    pCell = new ScFormulaCell(&rD, aScPos, *pSharedCode);
+                    pCell = new ScFormulaCell(rD, aScPos, *pSharedCode);
                 rDoc.getDoc().EnsureTable(aScPos.Tab());
                 rDoc.setFormulaCell(aScPos, pCell);
                 pCell->SetNeedNumberFormat(false);
@@ -154,7 +154,7 @@ void ImportExcel::Formula(
 
     if (pResult)
     {
-        pCell = new ScFormulaCell(&rDoc.getDoc(), aScPos, std::move(pResult));
+        pCell = new ScFormulaCell(rDoc.getDoc(), aScPos, std::move(pResult));
         pCell->GetCode()->WrapReference(aScPos, EXC_MAXCOL8, EXC_MAXROW8);
         rDoc.getDoc().CheckLinkFormulaNeedingCheck( *pCell->GetCode());
         rDoc.getDoc().EnsureTable(aScPos.Tab());
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 1b6efa743a44..8d32b1c16ce3 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -363,7 +363,7 @@ void ImportExcel::ReadBoolErr()
     double fValue;
     std::unique_ptr<ScTokenArray> pScTokArr = ErrorToFormula( nType != EXC_BOOLERR_BOOL, nValue, fValue );
     ScFormulaCell* pCell = pScTokArr
-        ? new ScFormulaCell(&rD, aScPos, std::move(pScTokArr))
+        ? new ScFormulaCell(rD, aScPos, std::move(pScTokArr))
         : new ScFormulaCell(rD, aScPos);
     pCell->SetHybridDouble( fValue );
     GetDocImport().setFormulaCell(aScPos, pCell);
@@ -843,7 +843,7 @@ void ImportExcel::Shrfmla()
 
     ScDocumentImport& rDoc = GetDocImport();
 
-    ScFormulaCell* pCell = new ScFormulaCell(&rD, aPos, std::move(pResult));
+    ScFormulaCell* pCell = new ScFormulaCell(rD, aPos, std::move(pResult));
     pCell->GetCode()->WrapReference(aPos, EXC_MAXCOL8, EXC_MAXROW8);
     rDoc.getDoc().CheckLinkFormulaNeedingCheck( *pCell->GetCode());
     rDoc.getDoc().EnsureTable(aPos.Tab());
diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx
index 8d822d10daf6..165401da9d04 100644
--- a/sc/source/filter/excel/xipivot.cxx
+++ b/sc/source/filter/excel/xipivot.cxx
@@ -120,7 +120,7 @@ void XclImpPCItem::WriteToSource( XclImpRoot& rRoot, const ScAddress& rScPos ) c
         std::unique_ptr<ScTokenArray> pScTokArr = rRoot.GetOldFmlaConverter().GetBoolErr(
             XclTools::ErrorToEnum( fValue, true, nErrCode ) );
         ScFormulaCell* pCell = pScTokArr
-            ? new ScFormulaCell(&rDoc.getDoc(), rScPos, std::move(pScTokArr))
+            ? new ScFormulaCell(rDoc.getDoc(), rScPos, std::move(pScTokArr))
             : new ScFormulaCell(rDoc.getDoc(), rScPos);
         pCell->SetHybridDouble( fValue );
         rDoc.setFormulaCell(rScPos, pCell);
diff --git a/sc/source/filter/lotus/lotimpop.cxx b/sc/source/filter/lotus/lotimpop.cxx
index 952d47b2e0aa..159b13786f6b 100644
--- a/sc/source/filter/lotus/lotimpop.cxx
+++ b/sc/source/filter/lotus/lotimpop.cxx
@@ -254,7 +254,7 @@ void ImportLotus::Formulacell( sal_uInt16 n )
     if (!aConv.good())
         return;
 
-    ScFormulaCell* pCell = pErg ? new ScFormulaCell(&rD, aAddr, std::move(pErg)) : new ScFormulaCell(rD, aAddr);
+    ScFormulaCell* pCell = pErg ? new ScFormulaCell(rD, aAddr, std::move(pErg)) : new ScFormulaCell(rD, aAddr);
     pCell->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE );
     rD.EnsureTable(aAddr.Tab());
     rD.SetFormulaCell(aAddr, pCell);
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index e64ecd07458e..4ffa17facae1 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -153,7 +153,7 @@ void OP_Formula(LotusContext &rContext, SvStream& r, sal_uInt16 /*n*/)
 
     if (rContext.rDoc.ValidColRow(nCol, nRow))
     {
-        ScFormulaCell* pCell = new ScFormulaCell(&rContext.rDoc, aAddress, std::move(pResult));
+        ScFormulaCell* pCell = new ScFormulaCell(rContext.rDoc, aAddress, std::move(pResult));
         pCell->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE );
         rContext.rDoc.EnsureTable(0);
         rContext.rDoc.SetFormulaCell(ScAddress(nCol, nRow, 0), pCell);
@@ -411,7 +411,7 @@ void OP_Formula123(LotusContext& rContext, SvStream& r, sal_uInt16 n)
 
     if (rContext.rDoc.ValidColRow(nCol, nRow) && nTab <= rContext.rDoc.GetMaxTableNumber())
     {
-        ScFormulaCell* pCell = new ScFormulaCell(&rContext.rDoc, aAddress, std::move(pResult));
+        ScFormulaCell* pCell = new ScFormulaCell(rContext.rDoc, aAddress, std::move(pResult));
         pCell->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE );
         rContext.rDoc.EnsureTable(nTab);
         rContext.rDoc.SetFormulaCell(ScAddress(nCol,nRow,nTab), pCell);
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index 85cc5629c3f4..f900d0fe1835 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -148,9 +148,9 @@ void applySharedFormulas(
             // (while editing) will mess things up. Pass the cloned array as a
             // pointer and not as reference to avoid any further allocation.
             if (rOrigin.Col() != aPos.Col())
-                pCell = new ScFormulaCell(&rDoc.getDoc(), aPos, pArray->Clone());
+                pCell = new ScFormulaCell(rDoc.getDoc(), aPos, pArray->Clone());
             else
-                pCell = new ScFormulaCell(&rDoc.getDoc(), aPos, *pArray);
+                pCell = new ScFormulaCell(rDoc.getDoc(), aPos, *pArray);
 
             rDoc.setFormulaCell(aPos, pCell);
             if (rDesc.maCellValue.isEmpty())
@@ -224,7 +224,7 @@ void applyCellFormulas(
                 pCell = new ScFormulaCell(rDoc.getDoc(), aPos, xGroup);
             }
             else
-                pCell = new ScFormulaCell(&rDoc.getDoc(), aPos, p->mpCell->GetCode()->Clone());
+                pCell = new ScFormulaCell(rDoc.getDoc(), aPos, p->mpCell->GetCode()->Clone());
 
             rDoc.setFormulaCell(aPos, pCell);
 
@@ -243,7 +243,7 @@ void applyCellFormulas(
 
         aCompiler.CompileTokenArray(); // Generate RPN tokens.
 
-        ScFormulaCell* pCell = new ScFormulaCell(&rDoc.getDoc(), aPos, std::move(pCode));
+        ScFormulaCell* pCell = new ScFormulaCell(rDoc.getDoc(), aPos, std::move(pCode));
         rDoc.setFormulaCell(aPos, pCell);
         rCache.store(aPos, pCell);
     }
diff --git a/sc/source/filter/oox/revisionfragment.cxx b/sc/source/filter/oox/revisionfragment.cxx
index ed0e5ddd9be6..72269cf8d3b3 100644
--- a/sc/source/filter/oox/revisionfragment.cxx
+++ b/sc/source/filter/oox/revisionfragment.cxx
@@ -123,7 +123,7 @@ protected:
                 if (!pArray)
                     break;
 
-                mrCellValue.set(new ScFormulaCell(&rDoc, mrPos, std::move(pArray)));
+                mrCellValue.set(new ScFormulaCell(rDoc, mrPos, std::move(pArray)));
             }
             break;
             default:
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 95cec29ba5bc..2b1b0aa459a0 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -410,7 +410,7 @@ void ScOrcusFactory::finalize()
         if (!pArray)
             return std::unique_ptr<ScFormulaCell>();
 
-        return std::make_unique<ScFormulaCell>(&maDoc.getDoc(), rToken.maPos, *pArray);
+        return std::make_unique<ScFormulaCell>(maDoc.getDoc(), rToken.maPos, *pArray);
     };
 
     int nCellCount = 0;
diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx
index aabf79e64b45..3e6756767eac 100644
--- a/sc/source/filter/qpro/qpro.cxx
+++ b/sc/source/filter/qpro/qpro.cxx
@@ -113,7 +113,7 @@ ErrCode ScQProReader::readSheet( SCTAB nTab, ScDocument& rDoc, ScQProStyle *pSty
                     eRet = SCERR_IMPORT_FORMAT;
                 else
                 {
-                    ScFormulaCell* pFormula = new ScFormulaCell(&rDoc, aAddr, std::move(pArray));
+                    ScFormulaCell* pFormula = new ScFormulaCell(rDoc, aAddr, std::move(pArray));
                     nStyle = nStyle >> 3;
                     pFormula->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE );
                     pStyle->SetFormat( &rDoc, nCol, nRow, nTab, nStyle );
diff --git a/sc/source/filter/xcl97/XclImpChangeTrack.cxx b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
index 435cca766496..e3451aca4001 100644
--- a/sc/source/filter/xcl97/XclImpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
@@ -272,7 +272,7 @@ void XclImpChangeTrack::ReadCell(
             if( pStrm->IsValid() && pTokenArray )
             {
                 rCell.meType = CELLTYPE_FORMULA;
-                rCell.mpFormula = new ScFormulaCell(&GetDoc(), rPosition, std::move(pTokenArray));
+                rCell.mpFormula = new ScFormulaCell(GetDoc(), rPosition, std::move(pTokenArray));
             }
         }
         break;
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index d78796bf75a9..0f07c4c59bf3 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1390,7 +1390,7 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos )
         }
     }
 
-    ScFormulaCell* pNewCell = new ScFormulaCell(pDoc, rCellPos, std::move(pCode), eGrammar, ScMatrixMode::NONE);
+    ScFormulaCell* pNewCell = new ScFormulaCell(*pDoc, rCellPos, std::move(pCode), eGrammar, ScMatrixMode::NONE);
     SetFormulaCell(pNewCell);
     rDocImport.setFormulaCell(rCellPos, pNewCell);
 }
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index e4d384ff1e61..b4beea0c2f3d 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1956,7 +1956,7 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm )
                             else
                             {
                                 ScFormulaCell* pFCell = new ScFormulaCell(
-                                        &rDoc, aPos, *xCode, eGrammar, ScMatrixMode::NONE);
+                                        rDoc, aPos, *xCode, eGrammar, ScMatrixMode::NONE);
                                 rDoc.SetFormulaCell(aPos, pFCell);
                             }
                         }
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 997f953e806c..adc05f6fc4f9 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -6354,7 +6354,7 @@ void SAL_CALL ScCellObj::setTokens( const uno::Sequence<sheet::FormulaToken>& rT
         ScTokenArray aTokenArray(rDoc);
         (void)ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens );
 
-        ScFormulaCell* pNewCell = new ScFormulaCell(&rDoc, aCellPos, aTokenArray);
+        ScFormulaCell* pNewCell = new ScFormulaCell(rDoc, aCellPos, aTokenArray);
         (void)pDocSh->GetDocFunc().SetFormulaCell(aCellPos, pNewCell, false);
     }
 }
diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx
index 963afdb560a6..7e853fea6f07 100644
--- a/sc/source/ui/unoobj/funcuno.cxx
+++ b/sc/source/ui/unoobj/funcuno.cxx
@@ -595,7 +595,7 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const OUString& aName,
         // GRAM_API doesn't really matter for the token array but fits with
         // other API compatibility grammars.
         ScFormulaCell* pFormula = new ScFormulaCell(
-            pDoc, aFormulaPos, aTokenArr, formula::FormulaGrammar::GRAM_API,
+            *pDoc, aFormulaPos, aTokenArr, formula::FormulaGrammar::GRAM_API,
             mbArray ? ScMatrixMode::Formula : ScMatrixMode::NONE );
         pFormula = pDoc->SetFormulaCell(aFormulaPos, pFormula);
         if (mbArray && pFormula)
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index c9c852c9a8a6..24dd97e9ba9e 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -268,7 +268,7 @@ void ScViewFunc::DoRefConversion()
                     std::unique_ptr<ScTokenArray> pArr(aComp.CompileString(aNew));
                     ScFormulaCell* pNewCell =
                         new ScFormulaCell(
-                            &rDoc, aPos, *pArr, formula::FormulaGrammar::GRAM_DEFAULT, eMatrixMode);
+                            rDoc, aPos, *pArr, formula::FormulaGrammar::GRAM_DEFAULT, eMatrixMode);
 
                     rDoc.SetFormulaCell(aPos, pNewCell);
                     bOk = true;
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index b60bf2c35a64..fd9650c149c0 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -506,7 +506,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
             }
         }
 
-        ScFormulaCell aCell(&rDoc, aPos, std::move( pArr ), formula::FormulaGrammar::GRAM_DEFAULT, ScMatrixMode::NONE);
+        ScFormulaCell aCell(rDoc, aPos, std::move( pArr ), formula::FormulaGrammar::GRAM_DEFAULT, ScMatrixMode::NONE);
 
         SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
         for (const auto& rTab : rMark)


More information about the Libreoffice-commits mailing list