[Libreoffice-commits] core.git: sc/inc sc/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 15 07:43:47 UTC 2020
sc/inc/formulacell.hxx | 2 -
sc/source/core/data/colorscale.cxx | 2 -
sc/source/core/data/column3.cxx | 6 ++---
sc/source/core/data/formulacell.cxx | 38 +++++++++++++++++-----------------
sc/source/core/tool/sharedformula.cxx | 2 -
5 files changed, 25 insertions(+), 25 deletions(-)
New commits:
commit eae8f8b8b45460e4cab11818adb3713b17929713
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Sep 14 10:50:57 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Sep 15 09:43:03 2020 +0200
EndListeningTo always dereferences its argument
Change-Id: I0e61c1c367a0ffcd8acbf3202293833886a59c42
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102661
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 49d6ddb9b762..296211687c39 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -463,7 +463,7 @@ public:
void StartListeningTo( ScDocument& rDoc );
void StartListeningTo( sc::StartListeningContext& rCxt );
void EndListeningTo(
- ScDocument* pDoc, ScTokenArray* pArr = nullptr, ScAddress aPos = ScAddress() );
+ ScDocument& rDoc, ScTokenArray* pArr = nullptr, ScAddress aPos = ScAddress() );
void EndListeningTo( sc::EndListeningContext& rCxt );
bool IsShared() const;
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index deec68636033..f920985d7263 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -200,7 +200,7 @@ ScColorScaleEntry::ScColorScaleEntry(ScDocument* pDoc, const ScColorScaleEntry&
ScColorScaleEntry::~ScColorScaleEntry() COVERITY_NOEXCEPT_FALSE
{
if(mpCell)
- mpCell->EndListeningTo(mpCell->GetDocument());
+ mpCell->EndListeningTo(*mpCell->GetDocument());
}
void ScColorScaleEntry::SetFormula( const OUString& rFormula, ScDocument* pDoc, const ScAddress& rAddr, formula::FormulaGrammar::Grammar eGrammar )
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 55a1f59575bd..f6a42fce7a72 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -125,7 +125,7 @@ void ScColumn::DeleteContent( SCROW nRow, bool bBroadcast )
if (it->type == sc::element_type_formula)
{
ScFormulaCell* p = sc::formula_block::at(*it->data, aPos.second);
- p->EndListeningTo(GetDoc());
+ p->EndListeningTo(*GetDoc());
sc::SharedFormulaUtil::unshareFormulaCell(aPos, *p);
}
maCells.set_empty(nRow, nRow);
@@ -334,7 +334,7 @@ void ScColumn::DetachFormulaCell(
// Have the dying formula cell stop listening.
// If in a shared formula group this ends the group listening.
- rCell.EndListeningTo(GetDoc());
+ rCell.EndListeningTo(*GetDoc());
}
sc::SharedFormulaUtil::unshareFormulaCell(aPos, rCell);
@@ -392,7 +392,7 @@ public:
if (mpCxt)
pCell->EndListeningTo(*mpCxt);
else
- pCell->EndListeningTo(mpDoc);
+ pCell->EndListeningTo(*mpDoc);
}
};
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 1ea54895f4ee..50fd18bf4293 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1211,7 +1211,7 @@ void ScFormulaCell::CompileTokenArray( bool bNoListening )
bNoListening = true;
if( !bNoListening && pCode->GetCodeLen() )
- EndListeningTo( pDocument );
+ EndListeningTo( *pDocument );
ScCompiler aComp(pDocument, aPos, *pCode, pDocument->GetGrammar(), true, cMatrixFlag != ScMatrixMode::NONE);
bSubTotal = aComp.CompileTokenArray();
if( pCode->GetCodeError() == FormulaError::NONE )
@@ -1251,7 +1251,7 @@ void ScFormulaCell::CompileTokenArray( sc::CompileFormulaContext& rCxt, bool bNo
bNoListening = true;
if( !bNoListening && pCode->GetCodeLen() )
- EndListeningTo( pDocument );
+ EndListeningTo( *pDocument );
ScCompiler aComp(rCxt, aPos, *pCode, true, cMatrixFlag != ScMatrixMode::NONE);
bSubTotal = aComp.CompileTokenArray();
if( pCode->GetCodeError() == FormulaError::NONE )
@@ -2317,7 +2317,7 @@ void ScFormulaCell::InterpretTail( ScInterpreterContext& rContext, ScInterpretTa
if (pCode->IsRecalcModeAlways())
{
// The formula was previously volatile, but no more.
- EndListeningTo(pDocument);
+ EndListeningTo(*pDocument);
pCode->SetExclusiveRecalcModeNormal();
}
else
@@ -2370,7 +2370,7 @@ void ScFormulaCell::HandleStuffAfterParallelCalculation(ScInterpreter* pInterpre
if (pCode->IsRecalcModeAlways())
{
// The formula was previously volatile, but no more.
- EndListeningTo(pDocument);
+ EndListeningTo(*pDocument);
pCode->SetExclusiveRecalcModeNormal();
}
else
@@ -2465,7 +2465,7 @@ void ScFormulaCell::Notify( const SfxHint& rHint )
break;
case sc::RefHint::StopListening:
{
- EndListeningTo( pDocument);
+ EndListeningTo(*pDocument);
}
break;
default:
@@ -3336,7 +3336,7 @@ bool ScFormulaCell::UpdateReferenceOnShift(
|| (bValChanged && bInDeleteUndo) || bHasRelName);
if ( bNewListening )
- EndListeningTo(pDocument, pOldCode.get(), aOldPos);
+ EndListeningTo(*pDocument, pOldCode.get(), aOldPos);
}
// NeedDirty for changes except for Copy and Move/Insert without RelNames
@@ -3467,7 +3467,7 @@ bool ScFormulaCell::UpdateReferenceOnMove(
&& !(pDocument->IsInsertingFromOtherDoc() && rCxt.maRange.In(aPos));
if ( bNewListening )
- EndListeningTo(pDocument, pOldCode.get(), aOldPos);
+ EndListeningTo(*pDocument, pOldCode.get(), aOldPos);
}
bool bNeedDirty = false;
@@ -3614,7 +3614,7 @@ void ScFormulaCell::UpdateInsertTab( const sc::RefUpdateInsertTabContext& rCxt )
return;
}
- EndListeningTo( pDocument );
+ EndListeningTo( *pDocument );
ScAddress aOldPos = aPos;
// IncTab _after_ EndListeningTo and _before_ Compiler UpdateInsertTab!
if (bPosChanged)
@@ -3643,7 +3643,7 @@ void ScFormulaCell::UpdateDeleteTab( const sc::RefUpdateDeleteTabContext& rCxt )
return;
}
- EndListeningTo( pDocument );
+ EndListeningTo( *pDocument );
// IncTab _after_ EndListeningTo and _before_ Compiler UpdateDeleteTab!
ScAddress aOldPos = aPos;
if (bPosChanged)
@@ -3669,7 +3669,7 @@ void ScFormulaCell::UpdateMoveTab( const sc::RefUpdateMoveTabContext& rCxt, SCTA
return;
}
- EndListeningTo(pDocument);
+ EndListeningTo(*pDocument);
ScAddress aOldPos = aPos;
// SetTab _after_ EndListeningTo and _before_ Compiler UpdateMoveTab !
aPos.SetTab(nTabNo);
@@ -3798,7 +3798,7 @@ void ScFormulaCell::TransposeReference()
void ScFormulaCell::UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
ScDocument* pUndoDoc )
{
- EndListeningTo( pDocument );
+ EndListeningTo( *pDocument );
ScAddress aOldPos = aPos;
bool bPosChanged = false; // Whether this cell has been moved
@@ -3868,7 +3868,7 @@ void ScFormulaCell::UpdateTranspose( const ScRange& rSource, const ScAddress& rD
void ScFormulaCell::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY )
{
- EndListeningTo( pDocument );
+ EndListeningTo( *pDocument );
bool bRefChanged = false;
@@ -5356,23 +5356,23 @@ void endListeningArea(
}
-void ScFormulaCell::EndListeningTo( ScDocument* pDoc, ScTokenArray* pArr,
+void ScFormulaCell::EndListeningTo( ScDocument& rDoc, ScTokenArray* pArr,
ScAddress aCellPos )
{
if (mxGroup)
- mxGroup->endAllGroupListening(*pDoc);
+ mxGroup->endAllGroupListening(rDoc);
- if (pDoc->IsClipOrUndo() || IsInChangeTrack())
+ if (rDoc.IsClipOrUndo() || IsInChangeTrack())
return;
if (!HasBroadcaster())
return;
- pDoc->SetDetectiveDirty(true); // It has changed something
+ rDoc.SetDetectiveDirty(true); // It has changed something
if ( GetCode()->IsRecalcModeAlways() )
{
- pDoc->EndListeningArea(BCA_LISTEN_ALWAYS, false, this);
+ rDoc.EndListeningArea(BCA_LISTEN_ALWAYS, false, this);
return;
}
@@ -5391,11 +5391,11 @@ void ScFormulaCell::EndListeningTo( ScDocument* pDoc, ScTokenArray* pArr,
{
ScAddress aCell = t->GetSingleRef()->toAbs(*pDocument, aCellPos);
if (aCell.IsValid())
- pDoc->EndListeningCell(aCell, this);
+ rDoc.EndListeningCell(aCell, this);
}
break;
case svDoubleRef:
- endListeningArea(this, *pDoc, aCellPos, *t);
+ endListeningArea(this, rDoc, aCellPos, *t);
break;
default:
; // nothing
diff --git a/sc/source/core/tool/sharedformula.cxx b/sc/source/core/tool/sharedformula.cxx
index 104c9d8d4629..9383abb3cb94 100644
--- a/sc/source/core/tool/sharedformula.cxx
+++ b/sc/source/core/tool/sharedformula.cxx
@@ -85,7 +85,7 @@ bool SharedFormulaUtil::splitFormulaCellGroup(const CellStoreType::position_type
if (pCxt)
rPrevTop.EndListeningTo(*pCxt);
else
- rPrevTop.EndListeningTo( rPrevTop.GetDocument(), nullptr, ScAddress( ScAddress::UNINITIALIZED));
+ rPrevTop.EndListeningTo( *rPrevTop.GetDocument(), nullptr, ScAddress( ScAddress::UNINITIALIZED));
rPrevTop.SetNeedsListening(true);
// The new group or remaining single cell needs a new listening.
More information about the Libreoffice-commits
mailing list