[Libreoffice-commits] core.git: sc/inc sc/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 15 07:43:29 UTC 2020
sc/inc/formulacell.hxx | 2 +-
sc/source/core/data/colorscale.cxx | 6 +++---
sc/source/core/data/column3.cxx | 2 +-
sc/source/core/data/conditio.cxx | 4 ++--
sc/source/core/data/formulacell.cxx | 36 ++++++++++++++++++------------------
sc/source/core/data/table4.cxx | 3 +--
6 files changed, 26 insertions(+), 27 deletions(-)
New commits:
commit 37095b7484b99a86ba81e5fb64aa5426a98e9183
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Sep 14 10:27:21 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Sep 15 09:42:47 2020 +0200
StartListeningTo always dereferences its argument
Change-Id: I4930ff5644d4ec184b4f55747d1a6b13a28bf49e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102660
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 d57dda491d11..49d6ddb9b762 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -460,7 +460,7 @@ public:
bool InterpretFormulaGroup(SCROW nStartOffset = -1, SCROW nEndOffset = -1);
// nOnlyNames may be one or more of SC_LISTENING_NAMES_*
- void StartListeningTo( ScDocument* pDoc );
+ void StartListeningTo( ScDocument& rDoc );
void StartListeningTo( sc::StartListeningContext& rCxt );
void EndListeningTo(
ScDocument* pDoc, ScTokenArray* pArr = nullptr, ScAddress aPos = ScAddress() );
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 298d15d2cf51..deec68636033 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -174,7 +174,7 @@ ScColorScaleEntry::ScColorScaleEntry(const ScColorScaleEntry& rEntry):
if(rEntry.mpCell)
{
mpCell.reset(new ScFormulaCell(*rEntry.mpCell, *rEntry.mpCell->GetDocument(), rEntry.mpCell->aPos, ScCloneFlags::NoMakeAbsExternal));
- mpCell->StartListeningTo( mpCell->GetDocument() );
+ mpCell->StartListeningTo( *mpCell->GetDocument() );
mpListener.reset(new ScFormulaListener(mpCell.get()));
}
}
@@ -190,7 +190,7 @@ ScColorScaleEntry::ScColorScaleEntry(ScDocument* pDoc, const ScColorScaleEntry&
if(rEntry.mpCell)
{
mpCell.reset(new ScFormulaCell(*rEntry.mpCell, *rEntry.mpCell->GetDocument(), rEntry.mpCell->aPos, ScCloneFlags::NoMakeAbsExternal));
- mpCell->StartListeningTo( pDoc );
+ mpCell->StartListeningTo( *pDoc );
mpListener.reset(new ScFormulaListener(mpCell.get()));
if (mpFormat)
mpListener->setCallback([&]() { mpFormat->DoRepaint();});
@@ -206,7 +206,7 @@ ScColorScaleEntry::~ScColorScaleEntry() COVERITY_NOEXCEPT_FALSE
void ScColorScaleEntry::SetFormula( const OUString& rFormula, ScDocument* pDoc, const ScAddress& rAddr, formula::FormulaGrammar::Grammar eGrammar )
{
mpCell.reset(new ScFormulaCell( pDoc, rAddr, rFormula, eGrammar ));
- mpCell->StartListeningTo( pDoc );
+ mpCell->StartListeningTo( *pDoc );
mpListener.reset(new ScFormulaListener(mpCell.get()));
if (mpFormat)
mpListener->setCallback([&]() { mpFormat->DoRepaint();});
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index f37ab25d2c51..55a1f59575bd 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -644,7 +644,7 @@ void ScColumn::AttachNewFormulaCell(
}
break;
case sc::SingleCellListening:
- rCell.StartListeningTo(pDocument);
+ rCell.StartListeningTo(*pDocument);
StartListeningUnshared( rNewSharedRows);
break;
case sc::NoListening:
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index a76cebed65f8..b3089a4053a2 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -400,7 +400,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->StartListeningTo( mpDoc );
+ pFCell1->StartListeningTo( *mpDoc );
}
if ( pFormula2 && !pFCell2 && !bRelRef2 )
@@ -408,7 +408,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->StartListeningTo( mpDoc );
+ pFCell2->StartListeningTo( *mpDoc );
}
}
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index a67dc496731a..1ea54895f4ee 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -928,7 +928,7 @@ ScFormulaCell::ScFormulaCell(const ScFormulaCell& rCell, ScDocument& rDoc, const
}
if( nCloneFlags & ScCloneFlags::StartListening )
- StartListeningTo( &rDoc );
+ StartListeningTo( rDoc );
if (bSubTotal)
pDocument->AddSubTotalCell(this);
@@ -1221,7 +1221,7 @@ void ScFormulaCell::CompileTokenArray( bool bNoListening )
aResult.SetToken( nullptr);
bCompile = false;
if ( !bNoListening )
- StartListeningTo( pDocument );
+ StartListeningTo( *pDocument );
}
if ( bWasInFormulaTree )
pDocument->PutInFormulaTree( this );
@@ -1261,7 +1261,7 @@ void ScFormulaCell::CompileTokenArray( sc::CompileFormulaContext& rCxt, bool bNo
aResult.SetToken( nullptr);
bCompile = false;
if ( !bNoListening )
- StartListeningTo( pDocument );
+ StartListeningTo( *pDocument );
}
if ( bWasInFormulaTree )
pDocument->PutInFormulaTree( this );
@@ -1276,7 +1276,7 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr
if ( cMatrixFlag == ScMatrixMode::Reference )
{ // is already token code via ScDocFunc::EnterMatrix, ScDocument::InsertMatrixFormula
// just establish listeners
- StartListeningTo( pDocument );
+ StartListeningTo( *pDocument );
return ;
}
@@ -1443,7 +1443,7 @@ void ScFormulaCell::CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartL
if( !bNewCompiled || pCode->GetCodeError() == FormulaError::NONE )
{
if (bStartListening)
- StartListeningTo(pDocument);
+ StartListeningTo(*pDocument);
if( !pCode->IsRecalcModeNormal() )
bDirty = true;
@@ -2311,7 +2311,7 @@ void ScFormulaCell::InterpretTail( ScInterpreterContext& rContext, ScInterpretTa
// The formula contains a volatile macro.
pCode->SetExclusiveRecalcModeAlways();
pDocument->PutInFormulaTree(this);
- StartListeningTo(pDocument);
+ StartListeningTo(*pDocument);
break;
case ScInterpreter::NOT_VOLATILE:
if (pCode->IsRecalcModeAlways())
@@ -2364,7 +2364,7 @@ void ScFormulaCell::HandleStuffAfterParallelCalculation(ScInterpreter* pInterpre
// The formula contains a volatile macro.
pCode->SetExclusiveRecalcModeAlways();
pDocument->PutInFormulaTree(this);
- StartListeningTo(pDocument);
+ StartListeningTo(*pDocument);
break;
case ScInterpreter::NOT_VOLATILE:
if (pCode->IsRecalcModeAlways())
@@ -2460,7 +2460,7 @@ void ScFormulaCell::Notify( const SfxHint& rHint )
break;
case sc::RefHint::StartListening:
{
- StartListeningTo( pDocument);
+ StartListeningTo(*pDocument);
}
break;
case sc::RefHint::StopListening:
@@ -3493,7 +3493,7 @@ bool ScFormulaCell::UpdateReferenceOnMove(
// InsertCol/InsertRow
if ( bNewListening )
{
- StartListeningTo( pDocument );
+ StartListeningTo( *pDocument );
}
}
@@ -3863,7 +3863,7 @@ void ScFormulaCell::UpdateTranspose( const ScRange& rSource, const ScAddress& rD
SetDirty();
}
else
- StartListeningTo( pDocument ); // Listener as previous
+ StartListeningTo( *pDocument ); // Listener as previous
}
void ScFormulaCell::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY )
@@ -3904,7 +3904,7 @@ void ScFormulaCell::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY
SetDirty();
}
else
- StartListeningTo( pDocument ); // Listener as previous
+ StartListeningTo( *pDocument ); // Listener as previous
}
// See also ScDocument::FindRangeNamesReferencingSheet()
@@ -5243,20 +5243,20 @@ void startListeningArea(
}
-void ScFormulaCell::StartListeningTo( ScDocument* pDoc )
+void ScFormulaCell::StartListeningTo( ScDocument& rDoc )
{
if (mxGroup)
- mxGroup->endAllGroupListening(*pDoc);
+ mxGroup->endAllGroupListening(rDoc);
- if (pDoc->IsClipOrUndo() || pDoc->GetNoListening() || IsInChangeTrack())
+ if (rDoc.IsClipOrUndo() || rDoc.GetNoListening() || IsInChangeTrack())
return;
- pDoc->SetDetectiveDirty(true); // It has changed something
+ rDoc.SetDetectiveDirty(true); // It has changed something
ScTokenArray* pArr = GetCode();
if( pArr->IsRecalcModeAlways() )
{
- pDoc->StartListeningArea(BCA_LISTEN_ALWAYS, false, this);
+ rDoc.StartListeningArea(BCA_LISTEN_ALWAYS, false, this);
SetNeedsListening( false);
return;
}
@@ -5271,11 +5271,11 @@ void ScFormulaCell::StartListeningTo( ScDocument* pDoc )
{
ScAddress aCell = t->GetSingleRef()->toAbs(*pDocument, aPos);
if (aCell.IsValid())
- pDoc->StartListeningCell(aCell, this);
+ rDoc.StartListeningCell(aCell, this);
}
break;
case svDoubleRef:
- startListeningArea(this, *pDoc, aPos, *t);
+ startListeningArea(this, rDoc, aPos, *t);
break;
default:
; // nothing
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 69a63c981201..ff70ede09653 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -508,8 +508,7 @@ void ScTable::FillFormula(
}
}
pDocument->SetNoListening( false );
- pDestCell->StartListeningTo( pDocument );
-
+ pDestCell->StartListeningTo( *pDocument );
}
void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
More information about the Libreoffice-commits
mailing list