summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-15 15:54:53 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-17 10:49:28 +0200
commitf7df7a6efcc6fe31915e031e6dbab0ad8633ac48 (patch)
tree433a6e050e4ae80b91829acdc84113cb8f29729d /sc/source
parent5774c6f4bb365a690049713307481d9a63aa20a6 (diff)
TokenStringContext never called with a null ScDocument*
so we can drop the nullptr check Change-Id: I588619f3e6f701a003447c59f5c0530801b5e1ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102886 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/column2.cxx2
-rw-r--r--sc/source/core/data/formulacell.cxx2
-rw-r--r--sc/source/core/tool/formulalogger.cxx2
-rw-r--r--sc/source/core/tool/tokenstringcontext.cxx17
-rw-r--r--sc/source/filter/oox/formulabuffer.cxx2
-rw-r--r--sc/source/ui/view/cellsh1.cxx2
6 files changed, 12 insertions, 15 deletions
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 8e209b65eeb1..ce221435a30a 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1732,7 +1732,7 @@ struct ColumnStorageDumper
void printFormula(const ScFormulaCell* pCell) const
{
- sc::TokenStringContext aCxt(&mrDoc, mrDoc.GetGrammar());
+ sc::TokenStringContext aCxt(mrDoc, mrDoc.GetGrammar());
OUString aFormula = pCell->GetCode()->CreateString(aCxt, pCell->aPos);
cout << " * formula: " << aFormula << endl;
}
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 915a0468b242..ece248cef842 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -5522,7 +5522,7 @@ void ScFormulaCell::Dump() const
cout << " * shared calc state: " << mxGroup->meCalcState << endl;
}
- sc::TokenStringContext aCxt(&rDocument, rDocument.GetGrammar());
+ sc::TokenStringContext aCxt(rDocument, rDocument.GetGrammar());
cout << " * code: " << pCode->CreateString(aCxt, aPos) << endl;
FormulaError nErrCode = pCode->GetCodeError();
diff --git a/sc/source/core/tool/formulalogger.cxx b/sc/source/core/tool/formulalogger.cxx
index 3f600cdb9743..f32017b4d4c3 100644
--- a/sc/source/core/tool/formulalogger.cxx
+++ b/sc/source/core/tool/formulalogger.cxx
@@ -78,7 +78,7 @@ struct FormulaLogger::GroupScope::Impl
if (!mbOutputEnabled)
return;
- sc::TokenStringContext aCxt(&rDoc, rDoc.GetGrammar());
+ sc::TokenStringContext aCxt(rDoc, rDoc.GetGrammar());
OUString aFormula = rCell.GetCode()->CreateString(aCxt, rCell.aPos);
mrLogger.write(maPrefix);
diff --git a/sc/source/core/tool/tokenstringcontext.cxx b/sc/source/core/tool/tokenstringcontext.cxx
index 8e15db4ee592..8d3503804d08 100644
--- a/sc/source/core/tool/tokenstringcontext.cxx
+++ b/sc/source/core/tool/tokenstringcontext.cxx
@@ -32,7 +32,7 @@ void insertAllNames( TokenStringContext::IndexNameMapType& rMap, const ScRangeNa
}
-TokenStringContext::TokenStringContext( const ScDocument* pDoc, formula::FormulaGrammar::Grammar eGram ) :
+TokenStringContext::TokenStringContext( const ScDocument& rDoc, formula::FormulaGrammar::Grammar eGram ) :
meGram(eGram),
mpRefConv(ScCompiler::GetRefConvention(formula::FormulaGrammar::extractRefConvention(eGram)))
{
@@ -46,25 +46,22 @@ TokenStringContext::TokenStringContext( const ScDocument* pDoc, formula::Formula
maErrRef = ScResId(STR_NO_REF_TABLE);
}
- if (!pDoc)
- return;
-
// Fetch all sheet names.
- maTabNames = pDoc->GetAllTableNames();
+ maTabNames = rDoc.GetAllTableNames();
{
for (auto& rTabName : maTabNames)
ScCompiler::CheckTabQuotes(rTabName, formula::FormulaGrammar::extractRefConvention(eGram));
}
// Fetch all named range names.
- const ScRangeName* pNames = pDoc->GetRangeName();
+ const ScRangeName* pNames = rDoc.GetRangeName();
if (pNames)
// global names
insertAllNames(maGlobalRangeNames, *pNames);
{
ScRangeName::TabNameCopyMap aTabRangeNames;
- pDoc->GetAllTabRangeNames(aTabRangeNames);
+ rDoc.GetAllTabRangeNames(aTabRangeNames);
for (const auto& [nTab, pSheetNames] : aTabRangeNames)
{
if (!pSheetNames)
@@ -77,7 +74,7 @@ TokenStringContext::TokenStringContext( const ScDocument* pDoc, formula::Formula
}
// Fetch all named database ranges names.
- const ScDBCollection* pDBs = pDoc->GetDBCollection();
+ const ScDBCollection* pDBs = rDoc.GetDBCollection();
if (pDBs)
{
const ScDBCollection::NamedDBs& rNamedDBs = pDBs->getNamedDBs();
@@ -89,10 +86,10 @@ TokenStringContext::TokenStringContext( const ScDocument* pDoc, formula::Formula
}
// Fetch all relevant bits for external references.
- if (!pDoc->HasExternalRefManager())
+ if (!rDoc.HasExternalRefManager())
return;
- const ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
+ const ScExternalRefManager* pRefMgr = rDoc.GetExternalRefManager();
maExternalFileNames = pRefMgr->getAllCachedExternalFileNames();
for (size_t i = 0, n = maExternalFileNames.size(); i < n; ++i)
{
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index f900d0fe1835..50e93944850a 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -55,7 +55,7 @@ public:
};
explicit CachedTokenArray( ScDocument& rDoc ) :
- maCxt(&rDoc, formula::FormulaGrammar::GRAM_OOXML) {}
+ maCxt(rDoc, formula::FormulaGrammar::GRAM_OOXML) {}
Item* get( const ScAddress& rPos, const OUString& rFormula )
{
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 41da6c45b114..df150de2b0cd 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -3119,7 +3119,7 @@ void ScCellShell::ExecuteFillSingleEdit()
{
aInit = "=";
const ScTokenArray* pCode = aCell.mpFormula->GetCode();
- sc::TokenStringContext aCxt(&rDoc, rDoc.GetGrammar());
+ sc::TokenStringContext aCxt(rDoc, rDoc.GetGrammar());
aInit += pCode->CreateString(aCxt, aCurPos);
}
else