summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-13 20:07:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-14 09:59:12 +0200
commit2082fb359493d74ca4c066536c230d249eef4466 (patch)
treeffe0133b98e156afec766565999b548d23a8e94d
parent2a6a86822f5173b820632bea173bc58e703d43d3 (diff)
setOldCodeToUndo always dereferences its ScDocument* arg
Change-Id: Ie79920a66a710c2073e3814327d42779755b6baa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102612 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/source/core/data/formulacell.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index b9886d3abda2..010b4b4a8de2 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3233,7 +3233,7 @@ bool checkCompileColRowName(
}
void setOldCodeToUndo(
- ScDocument* pUndoDoc, const ScAddress& aUndoPos, const ScTokenArray* pOldCode, FormulaGrammar::Grammar eTempGrammar, ScMatrixMode cMatrixFlag)
+ ScDocument& rUndoDoc, const ScAddress& aUndoPos, const ScTokenArray* pOldCode, FormulaGrammar::Grammar eTempGrammar, ScMatrixMode cMatrixFlag)
{
// Copy the cell to aUndoPos, which is its current position in the document,
// so this works when UpdateReference is called before moving the cells
@@ -3242,15 +3242,15 @@ void setOldCodeToUndo(
// If there is already a formula cell in the undo document, don't overwrite it,
// the first (oldest) is the important cell.
- if (pUndoDoc->GetCellType(aUndoPos) == CELLTYPE_FORMULA)
+ if (rUndoDoc.GetCellType(aUndoPos) == CELLTYPE_FORMULA)
return;
ScFormulaCell* pFCell =
new ScFormulaCell(
- pUndoDoc, aUndoPos, pOldCode ? *pOldCode : ScTokenArray(*pUndoDoc), eTempGrammar, cMatrixFlag);
+ &rUndoDoc, aUndoPos, pOldCode ? *pOldCode : ScTokenArray(rUndoDoc), eTempGrammar, cMatrixFlag);
pFCell->SetResultToken(nullptr); // to recognize it as changed later (Cut/Paste!)
- pUndoDoc->SetFormulaCell(aUndoPos, pFCell);
+ rUndoDoc.SetFormulaCell(aUndoPos, pFCell);
}
}
@@ -3343,7 +3343,7 @@ bool ScFormulaCell::UpdateReferenceOnShift(
bool bNeedDirty = (bValChanged || bRecompile || bOnRefMove);
if (pUndoDoc && (bValChanged || bOnRefMove))
- setOldCodeToUndo(pUndoDoc, aUndoPos, pOldCode.get(), eTempGrammar, cMatrixFlag);
+ setOldCodeToUndo(*pUndoDoc, aUndoPos, pOldCode.get(), eTempGrammar, cMatrixFlag);
bCompile |= bRecompile;
if (bCompile)
@@ -3477,7 +3477,7 @@ bool ScFormulaCell::UpdateReferenceOnMove(
bNeedDirty = true;
if (pUndoDoc && !bCellInMoveTarget && (bValChanged || bRefModified || bOnRefMove))
- setOldCodeToUndo(pUndoDoc, aUndoPos, pOldCode.get(), eTempGrammar, cMatrixFlag);
+ setOldCodeToUndo(*pUndoDoc, aUndoPos, pOldCode.get(), eTempGrammar, cMatrixFlag);
bValChanged = false;
@@ -3548,7 +3548,7 @@ bool ScFormulaCell::UpdateReferenceOnCopy(
bool bNeedDirty = bOnRefMove;
if (pUndoDoc && bOnRefMove)
- setOldCodeToUndo(pUndoDoc, aUndoPos, pOldCode.get(), eTempGrammar, cMatrixFlag);
+ setOldCodeToUndo(*pUndoDoc, aUndoPos, pOldCode.get(), eTempGrammar, cMatrixFlag);
if (bCompile)
{