summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-16 12:06:24 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-18 19:57:50 +0200
commit4baec6159199a1b0305bdc28df1579d6e7602a95 (patch)
tree9a1590358bbcddfb68ab4463bf3c8a33156c92d9 /sc/source
parent08e85556d2ae66bdf43d908e1b9dfca4c78295e2 (diff)
ScCellValue::getString never called with a null ScDocument*
Change-Id: Idff982e715b012e35e0abd0b904f4b83d7f6f51a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103007 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/cellvalue.cxx4
-rw-r--r--sc/source/core/data/column3.cxx6
-rw-r--r--sc/source/core/data/dociter.cxx40
-rw-r--r--sc/source/core/data/table3.cxx2
-rw-r--r--sc/source/core/tool/cellform.cxx4
-rw-r--r--sc/source/core/tool/interpr1.cxx20
-rw-r--r--sc/source/ui/docshell/docsh.cxx4
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx2
-rw-r--r--sc/source/ui/unoobj/textuno.cxx2
-rw-r--r--sc/source/ui/view/tabvwsha.cxx2
-rw-r--r--sc/source/ui/view/viewfun4.cxx2
11 files changed, 44 insertions, 44 deletions
diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx
index 85d6bb808583..463b7695e786 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -491,9 +491,9 @@ void ScCellValue::release( ScColumn& rColumn, SCROW nRow, sc::StartListeningType
mfValue = 0.0;
}
-OUString ScCellValue::getString( const ScDocument* pDoc ) const
+OUString ScCellValue::getString( const ScDocument& rDoc ) const
{
- return getStringImpl(*this, pDoc);
+ return getStringImpl(*this, &rDoc);
}
bool ScCellValue::isEmpty() const
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 2aff621e44f3..5501ae479d97 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2420,7 +2420,7 @@ class FilterEntriesHandler
SvNumberFormatter* pFormatter = mrColumn.GetDoc().GetFormatTable();
OUString aStr;
sal_uLong nFormat = mrColumn.GetNumberFormat(mrColumn.GetDoc().GetNonThreadedContext(), nRow);
- ScCellFormat::GetInputString(rCell, nFormat, aStr, *pFormatter, &mrColumn.GetDoc());
+ ScCellFormat::GetInputString(rCell, nFormat, aStr, *pFormatter, mrColumn.GetDoc());
if (rCell.hasString())
{
@@ -2938,7 +2938,7 @@ double* ScColumn::GetValueCell( SCROW nRow )
void ScColumn::GetInputString( const ScRefCellValue& aCell, SCROW nRow, OUString& rString ) const
{
sal_uLong nFormat = GetNumberFormat(GetDoc().GetNonThreadedContext(), nRow);
- ScCellFormat::GetInputString(aCell, nFormat, rString, *(GetDoc().GetFormatTable()), &GetDoc());
+ ScCellFormat::GetInputString(aCell, nFormat, rString, *(GetDoc().GetFormatTable()), GetDoc());
}
double ScColumn::GetValue( SCROW nRow ) const
@@ -3256,7 +3256,7 @@ class MaxNumStringLenHandler
if (nFormat % SV_COUNTRY_LANGUAGE_OFFSET)
{
aSep = mpFormatter->GetFormatDecimalSep(nFormat);
- ScCellFormat::GetInputString(rCell, nFormat, aString, *mpFormatter, &mrColumn.GetDoc());
+ ScCellFormat::GetInputString(rCell, nFormat, aString, *mpFormatter, mrColumn.GetDoc());
const SvNumberformat* pEntry = mpFormatter->GetEntry(nFormat);
if (pEntry)
{
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 58594fd35d7d..217d997bafbd 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1045,10 +1045,10 @@ bool ScCellIterator::next()
return getCurrent();
}
-ScQueryCellIterator::ScQueryCellIterator(ScDocument* pDocument, const ScInterpreterContext& rContext, SCTAB nTable,
+ScQueryCellIterator::ScQueryCellIterator(ScDocument& rDocument, const ScInterpreterContext& rContext, SCTAB nTable,
const ScQueryParam& rParam, bool bMod ) :
maParam(rParam),
- pDoc( pDocument ),
+ rDoc( rDocument ),
mrContext( rContext ),
nTab( nTable),
nStopOnMismatch( nStopOnMismatchDisabled ),
@@ -1079,7 +1079,7 @@ void ScQueryCellIterator::InitPos()
nRow = maParam.nRow1;
if (maParam.bHasHeader && maParam.bByRow)
++nRow;
- ScColumn* pCol = &(pDoc->maTabs[nTab])->aCol[nCol];
+ ScColumn* pCol = &(rDoc.maTabs[nTab])->aCol[nCol];
maCurPos = pCol->maCells.position(nRow);
}
@@ -1106,7 +1106,7 @@ void ScQueryCellIterator::IncBlock()
bool ScQueryCellIterator::GetThis()
{
- assert(nTab < pDoc->GetTableCount() && "index out of bounds, FIX IT");
+ assert(nTab < rDoc.GetTableCount() && "index out of bounds, FIX IT");
const ScQueryEntry& rEntry = maParam.GetEntry(0);
const ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
@@ -1118,7 +1118,7 @@ bool ScQueryCellIterator::GetThis()
((maParam.bByRow && nRow == maParam.nRow1) ||
(!maParam.bByRow && nCol == maParam.nCol1));
- ScColumn* pCol = &(pDoc->maTabs[nTab])->aCol[nCol];
+ ScColumn* pCol = &(rDoc.maTabs[nTab])->aCol[nCol];
while (true)
{
bool bNextColumn = maCurPos.first == pCol->maCells.end();
@@ -1133,14 +1133,14 @@ bool ScQueryCellIterator::GetThis()
do
{
++nCol;
- if (nCol > maParam.nCol2 || nCol >= pDoc->maTabs[nTab]->GetAllocatedColumnsCount())
+ if (nCol > maParam.nCol2 || nCol >= rDoc.maTabs[nTab]->GetAllocatedColumnsCount())
return false; // Over and out
if ( bAdvanceQuery )
{
AdvanceQueryParamEntryField();
nFirstQueryField = rEntry.nField;
}
- pCol = &(pDoc->maTabs[nTab])->aCol[nCol];
+ pCol = &(rDoc.maTabs[nTab])->aCol[nCol];
}
while (!rItem.mbMatchEmpty && pCol->IsEmptyData());
@@ -1180,7 +1180,7 @@ bool ScQueryCellIterator::GetThis()
else
{
bool bTestEqualCondition = false;
- if ( pDoc->maTabs[nTab]->ValidQuery( nRow, maParam,
+ if ( rDoc.maTabs[nTab]->ValidQuery( nRow, maParam,
(nCol == static_cast<SCCOL>(nFirstQueryField) ? &aCell : nullptr),
(nTestEqualCondition ? &bTestEqualCondition : nullptr),
&mrContext) )
@@ -1228,7 +1228,7 @@ bool ScQueryCellIterator::GetThis()
bool ScQueryCellIterator::GetFirst()
{
- assert(nTab < pDoc->GetTableCount() && "index out of bounds, FIX IT");
+ assert(nTab < rDoc.GetTableCount() && "index out of bounds, FIX IT");
nCol = maParam.nCol1;
InitPos();
return GetThis();
@@ -1252,7 +1252,7 @@ void ScQueryCellIterator::AdvanceQueryParamEntryField()
ScQueryEntry& rEntry = maParam.GetEntry( j );
if ( rEntry.bDoQuery )
{
- if ( rEntry.nField < pDoc->MaxCol() )
+ if ( rEntry.nField < rDoc.MaxCol() )
rEntry.nField++;
else
{
@@ -1278,8 +1278,8 @@ bool ScQueryCellIterator::FindEqualOrSortedLastInRange( SCCOL& nFoundCol,
~BoolResetter() { mr = mb; }
} aRangeLookupResetter( maParam.mbRangeLookup, true);
- nFoundCol = pDoc->MaxCol()+1;
- nFoundRow = pDoc->MaxRow()+1;
+ nFoundCol = rDoc.MaxCol()+1;
+ nFoundRow = rDoc.MaxRow()+1;
SetStopOnMismatch( true ); // assume sorted keys
SetTestEqualCondition( true );
bIgnoreMismatchOnLeadingStrings = true;
@@ -1358,8 +1358,8 @@ bool ScQueryCellIterator::FindEqualOrSortedLastInRange( SCCOL& nFoundCol,
// Check it.
if (!GetThis())
{
- nFoundCol = pDoc->MaxCol()+1;
- nFoundRow = pDoc->MaxRow()+1;
+ nFoundCol = rDoc.MaxCol()+1;
+ nFoundRow = rDoc.MaxRow()+1;
}
}
}
@@ -1450,7 +1450,7 @@ bool ScQueryCellIterator::FindEqualOrSortedLastInRange( SCCOL& nFoundCol,
maCurPos = aPosSave;
}
}
- return (nFoundCol <= pDoc->MaxCol()) && (nFoundRow <= pDoc->MaxRow());
+ return (nFoundCol <= rDoc.MaxCol()) && (nFoundRow <= rDoc.MaxRow());
}
ScCountIfCellIterator::ScCountIfCellIterator(ScDocument* pDocument, const ScInterpreterContext& rContext, SCTAB nTable,
@@ -1796,9 +1796,9 @@ bool ScQueryCellIterator::BinarySearch()
{
// TODO: This will be extremely slow with mdds::multi_type_vector.
- assert(nTab < pDoc->GetTableCount() && "index out of bounds, FIX IT");
+ assert(nTab < rDoc.GetTableCount() && "index out of bounds, FIX IT");
nCol = maParam.nCol1;
- ScColumn* pCol = &(pDoc->maTabs[nTab])->aCol[nCol];
+ ScColumn* pCol = &(rDoc.maTabs[nTab])->aCol[nCol];
if (pCol->IsEmptyData())
return false;
@@ -1826,7 +1826,7 @@ bool ScQueryCellIterator::BinarySearch()
aCell = sc::toRefCell(aPos.first, aPos.second);
sal_uInt32 nFormat = pCol->GetNumberFormat(mrContext, nRow);
OUString aCellStr;
- ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter, pDoc);
+ ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter, rDoc);
sal_Int32 nTmp = pCollator->compareString(aCellStr, rEntry.GetQueryItem().maString.getString());
if ((rEntry.eOp == SC_LESS_EQUAL && nTmp > 0) ||
(rEntry.eOp == SC_GREATER_EQUAL && nTmp < 0) ||
@@ -1860,7 +1860,7 @@ bool ScQueryCellIterator::BinarySearch()
{
sal_uInt32 nFormat = pCol->GetNumberFormat(mrContext, aCellData.second);
OUString aStr;
- ScCellFormat::GetInputString(aCell, nFormat, aStr, rFormatter, pDoc);
+ ScCellFormat::GetInputString(aCell, nFormat, aStr, rFormatter, rDoc);
aLastInRangeString = aStr;
}
else
@@ -1950,7 +1950,7 @@ bool ScQueryCellIterator::BinarySearch()
{
OUString aCellStr;
sal_uInt32 nFormat = pCol->GetNumberFormat(mrContext, aCellData.second);
- ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter, pDoc);
+ ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter, rDoc);
nRes = pCollator->compareString(aCellStr, rEntry.GetQueryItem().maString.getString());
if (nRes < 0 && bLessEqual)
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 990eaa8b1fe2..2135a6dc5931 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2439,7 +2439,7 @@ public:
mrTab.GetNumberFormat( static_cast<SCCOL>(rEntry.nField), nRow );
OUString aStr;
SvNumberFormatter* pFormatter = pContext ? pContext->GetFormatTable() : mrDoc.GetFormatTable();
- ScCellFormat::GetInputString(rCell, nFormat, aStr, *pFormatter, &mrDoc);
+ ScCellFormat::GetInputString(rCell, nFormat, aStr, *pFormatter, mrDoc);
return compareByStringComparator(rEntry, rItem, nullptr, &aStr);
}
}
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index b2afdc9949bb..a18eae0c07d0 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -118,13 +118,13 @@ OUString ScCellFormat::GetString(
}
void ScCellFormat::GetInputString(
- const ScRefCellValue& rCell, sal_uInt32 nFormat, OUString& rString, SvNumberFormatter& rFormatter, const ScDocument* pDoc )
+ const ScRefCellValue& rCell, sal_uInt32 nFormat, OUString& rString, SvNumberFormatter& rFormatter, const ScDocument& rDoc )
{
switch (rCell.meType)
{
case CELLTYPE_STRING:
case CELLTYPE_EDIT:
- rString = rCell.getString(pDoc);
+ rString = rCell.getString(&rDoc);
break;
case CELLTYPE_VALUE:
rFormatter.GetInputLineString(rCell.mfValue, nFormat, rString );
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 5616cc35bb6f..5a1521524a36 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5053,7 +5053,7 @@ void ScInterpreter::ScMatch()
rParam.bByRow = false;
rParam.nRow2 = nRow1;
rEntry.nField = nCol1;
- ScQueryCellIterator aCellIter(&mrDoc, mrContext, nTab1, rParam, false);
+ ScQueryCellIterator aCellIter(mrDoc, mrContext, nTab1, rParam, false);
// Advance Entry.nField in Iterator if column changed
aCellIter.SetAdvanceQueryParamEntryField( true );
if (fTyp == 0.0)
@@ -5551,7 +5551,7 @@ void ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
}
else
{
- ScQueryCellIterator aCellIter(&mrDoc, mrContext, nTab1, rParam, false);
+ ScQueryCellIterator aCellIter(mrDoc, mrContext, nTab1, rParam, false);
// Increment Entry.nField in iterator when switching to next column.
aCellIter.SetAdvanceQueryParamEntryField( true );
if ( aCellIter.GetFirst() )
@@ -6170,7 +6170,7 @@ void ScInterpreter::IterateParametersIfs( double(*ResultFunc)( const sc::ParamIf
}
else
{
- ScQueryCellIterator aCellIter(&mrDoc, mrContext, nTab1, rParam, false);
+ ScQueryCellIterator aCellIter(mrDoc, mrContext, nTab1, rParam, false);
// Increment Entry.nField in iterator when switching to next column.
aCellIter.SetAdvanceQueryParamEntryField( true );
if ( aCellIter.GetFirst() )
@@ -7081,7 +7081,7 @@ void ScInterpreter::ScLookup()
if (rItem.meType == ScQueryEntry::ByString)
aParam.eSearchType = DetectSearchType(rItem.maString.getString(), mrDoc);
- ScQueryCellIterator aCellIter(&mrDoc, mrContext, nTab1, aParam, false);
+ ScQueryCellIterator aCellIter(mrDoc, mrContext, nTab1, aParam, false);
SCCOL nC;
SCROW nR;
// Advance Entry.nField in iterator upon switching columns if
@@ -7428,7 +7428,7 @@ void ScInterpreter::CalculateLookup(bool bHLookup)
rEntry.eOp = SC_LESS_EQUAL;
if ( bHLookup )
{
- ScQueryCellIterator aCellIter(&mrDoc, mrContext, nTab1, aParam, false);
+ ScQueryCellIterator aCellIter(mrDoc, mrContext, nTab1, aParam, false);
// advance Entry.nField in Iterator upon switching columns
aCellIter.SetAdvanceQueryParamEntryField( true );
if ( bSorted )
@@ -7908,7 +7908,7 @@ void ScInterpreter::ScDBCount()
// so the source range has to be restricted, like before the introduction
// of ScDBQueryParamBase.
p->nCol1 = p->nCol2 = p->mnField;
- ScQueryCellIterator aCellIter( &mrDoc, mrContext, nTab, *p, true);
+ ScQueryCellIterator aCellIter(mrDoc, mrContext, nTab, *p, true);
if ( aCellIter.GetFirst() )
{
do
@@ -9926,11 +9926,11 @@ utl::SearchParam::SearchType ScInterpreter::DetectSearchType( const OUString& rS
return utl::SearchParam::SearchType::Normal;
}
-static bool lcl_LookupQuery( ScAddress & o_rResultPos, ScDocument * pDoc, const ScInterpreterContext& rContext,
+static bool lcl_LookupQuery( ScAddress & o_rResultPos, ScDocument& rDoc, const ScInterpreterContext& rContext,
const ScQueryParam & rParam, const ScQueryEntry & rEntry )
{
bool bFound = false;
- ScQueryCellIterator aCellIter( pDoc, rContext, rParam.nTab, rParam, false);
+ ScQueryCellIterator aCellIter( rDoc, rContext, rParam.nTab, rParam, false);
if (rEntry.eOp != SC_EQUAL)
{
// range lookup <= or >=
@@ -10005,7 +10005,7 @@ bool ScInterpreter::LookupQueryWithCache( ScAddress & o_rResultPos,
* direct lookups here. We could even further attribute volatility per
* parameter so it would affect only the lookup range parameter. */
if (!bColumnsMatch || GetVolatileType() != NOT_VOLATILE)
- bFound = lcl_LookupQuery( o_rResultPos, &mrDoc, mrContext, rParam, rEntry);
+ bFound = lcl_LookupQuery( o_rResultPos, mrDoc, mrContext, rParam, rEntry);
else
{
ScRange aLookupRange( rParam.nCol1, rParam.nRow1, rParam.nTab,
@@ -10036,7 +10036,7 @@ bool ScInterpreter::LookupQueryWithCache( ScAddress & o_rResultPos,
{
case ScLookupCache::NOT_CACHED :
case ScLookupCache::CRITERIA_DIFFERENT :
- bFound = lcl_LookupQuery( o_rResultPos, &mrDoc, mrContext, rParam, rEntry);
+ bFound = lcl_LookupQuery( o_rResultPos, mrDoc, mrContext, rParam, rEntry);
if (eCacheResult == ScLookupCache::NOT_CACHED)
rCache.insert( o_rResultPos, aCriteria, aPos, bFound);
break;
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index a89ac6e6a159..0a2be452cfe6 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2095,7 +2095,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
}
else
{
- ScCellFormat::GetInputString(*pCell, nFormat, aString, rFormatter, &m_aDocument);
+ ScCellFormat::GetInputString(*pCell, nFormat, aString, rFormatter, m_aDocument);
bString = bForceQuotes = !bSaveNumberAsSuch;
}
}
@@ -2145,7 +2145,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
}
else
{
- ScCellFormat::GetInputString(*pCell, nFormat, aString, rFormatter, &m_aDocument);
+ ScCellFormat::GetInputString(*pCell, nFormat, aString, rFormatter, m_aDocument);
bString = bForceQuotes = !bSaveNumberAsSuch;
}
}
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 0ca416e05ef6..b43f49d9eb2e 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1366,7 +1366,7 @@ static OUString lcl_GetInputString( ScDocument& rDoc, const ScAddress& rPos, boo
}
}
else
- ScCellFormat::GetInputString(aCell, nNumFmt, aVal, *pFormatter, &rDoc);
+ ScCellFormat::GetInputString(aCell, nNumFmt, aVal, *pFormatter, rDoc);
// if applicable, prepend ' like in ScTabViewShell::UpdateInputHandler
if ( eType == CELLTYPE_STRING || eType == CELLTYPE_EDIT )
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index ec41bfc8953a..e69d8bb73728 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -841,7 +841,7 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder()
else
{
sal_uInt32 nFormat = rDoc.GetNumberFormat(aCellPos);
- ScCellFormat::GetInputString(aCell, nFormat, aText, *rDoc.GetFormatTable(), &rDoc);
+ ScCellFormat::GetInputString(aCell, nFormat, aText, *rDoc.GetFormatTable(), rDoc);
if (!aText.isEmpty())
pEditEngine->SetTextNewDefaults(aText, aDefaults);
else
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 6abcb03825d8..210500e651d9 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -691,7 +691,7 @@ void ScTabViewShell::UpdateInputHandler( bool bForce /* = sal_False */, bool bSt
SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
sal_uInt32 nNumFmt = rDoc.GetNumberFormat( aPos );
- ScCellFormat::GetInputString( rCell, nNumFmt, aString, *pFormatter, &rDoc );
+ ScCellFormat::GetInputString( rCell, nNumFmt, aString, *pFormatter, rDoc );
if (rCell.meType == CELLTYPE_STRING)
{
// Put a ' in front if necessary, so that the string is not
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 99a702b20f76..49f4f2531dc8 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -373,7 +373,7 @@ void ScViewFunc::DoThesaurus()
if (aOldText.meType == CELLTYPE_EDIT)
pThesaurusEngine->SetTextCurrentDefaults(*aOldText.mpEditText);
else
- pThesaurusEngine->SetTextCurrentDefaults(aOldText.getString(&rDoc));
+ pThesaurusEngine->SetTextCurrentDefaults(aOldText.getString(rDoc));
pEditView = GetViewData().GetEditView(GetViewData().GetActivePart());
if (pEditSel)