summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-15 16:01:38 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-17 12:35:51 +0200
commit0e6d7959afc72475c8cfabfd8dce9141e6932794 (patch)
treeff994665cdef37ec241680957019137087ee1989
parent806b82d89f3bdf7ac0f9c25df15d40f8817f3353 (diff)
Tokens2RangeStringXML ctor never called with null ScDocument*
and some more similar Change-Id: Ia92791f4d225352fdb0992e1f2fe4652fe8d3504 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102904 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/inc/consoli.hxx2
-rw-r--r--sc/inc/tokenarray.hxx8
-rw-r--r--sc/source/core/data/document10.cxx20
-rw-r--r--sc/source/core/data/formulacell.cxx24
-rw-r--r--sc/source/core/tool/consoli.cxx44
-rw-r--r--sc/source/core/tool/token.cxx26
-rw-r--r--sc/source/ui/docshell/docsh5.cxx2
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx28
-rw-r--r--sc/source/ui/vba/vbarange.cxx16
9 files changed, 85 insertions, 85 deletions
diff --git a/sc/inc/consoli.hxx b/sc/inc/consoli.hxx
index c00081a305b3..8d6bf621b3ef 100644
--- a/sc/inc/consoli.hxx
+++ b/sc/inc/consoli.hxx
@@ -83,7 +83,7 @@ public:
SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
void AddName( const OUString& rName );
- void OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow, SCTAB nTab );
+ void OutputToDocument( ScDocument& rDestDoc, SCCOL nCol, SCROW nRow, SCTAB nTab );
void GetSize( SCCOL& rCols, SCROW& rRows ) const;
SCROW GetInsertCount() const;
diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index 3af5fbcb5ca1..eb3fa0dc4a8f 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -135,18 +135,18 @@ public:
/**
* Make all absolute references external references pointing to the old document
*
- * @param pOldDoc old document
- * @param pNewDoc new document
+ * @param rOldDoc old document
+ * @param rNewDoc new document
* @param rPos position of the cell to determine if the reference is in the copied area
* @param bRangeName set for range names, range names have special handling for absolute sheet ref + relative col/row ref
*/
- void ReadjustAbsolute3DReferences( const ScDocument* pOldDoc, ScDocument* pNewDoc, const ScAddress& rPos, bool bRangeName = false );
+ void ReadjustAbsolute3DReferences( const ScDocument& rOldDoc, ScDocument& rNewDoc, const ScAddress& rPos, bool bRangeName = false );
/**
* Make all absolute references pointing to the copied range if the range is copied too
* @param bCheckCopyArea should reference pointing into the copy area be adjusted independently from being absolute, should be true only for copy&paste between documents
*/
- void AdjustAbsoluteRefs( const ScDocument* pOldDoc, const ScAddress& rOldPos, const ScAddress& rNewPos, bool bCheckCopyArea );
+ void AdjustAbsoluteRefs( const ScDocument& rOldDoc, const ScAddress& rOldPos, const ScAddress& rNewPos, bool bCheckCopyArea );
/** When copying a sheet-local named expression, move sheet references that
point to the originating sheet to point to the new sheet instead.
diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx
index c0b909b349d0..1a90b64938cf 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -666,7 +666,7 @@ MightReferenceSheet mightRangeNameReferenceSheet( ScRangeData* pData, SCTAB nRef
MightReferenceSheet::CODE : MightReferenceSheet::NONE;
}
-ScRangeData* copyRangeName( const ScRangeData* pOldRangeData, ScDocument& rNewDoc, const ScDocument* pOldDoc,
+ScRangeData* copyRangeName( const ScRangeData* pOldRangeData, ScDocument& rNewDoc, const ScDocument& rOldDoc,
const ScAddress& rNewPos, const ScAddress& rOldPos, bool bGlobalNamesToLocal,
SCTAB nOldSheet, const SCTAB nNewSheet, bool bSameDoc)
{
@@ -689,8 +689,8 @@ ScRangeData* copyRangeName( const ScRangeData* pOldRangeData, ScDocument& rNewDo
}
if (!bSameDoc)
{
- pRangeNameToken->ReadjustAbsolute3DReferences(pOldDoc, &rNewDoc, pRangeData->GetPos(), true);
- pRangeNameToken->AdjustAbsoluteRefs(pOldDoc, rOldPos, rNewPos, true);
+ pRangeNameToken->ReadjustAbsolute3DReferences(rOldDoc, rNewDoc, pRangeData->GetPos(), true);
+ pRangeNameToken->AdjustAbsoluteRefs(rOldDoc, rOldPos, rNewPos, true);
}
bool bInserted;
@@ -722,12 +722,12 @@ typedef std::map< SheetIndex, SheetIndex > SheetIndexMap;
ScRangeData* copyRangeNames( SheetIndexMap& rSheetIndexMap, std::vector<ScRangeData*>& rRangeDataVec,
const sc::UpdatedRangeNames& rReferencingNames, SCTAB nTab,
- const ScRangeData* pOldRangeData, ScDocument& rNewDoc, const ScDocument* pOldDoc,
+ const ScRangeData* pOldRangeData, ScDocument& rNewDoc, const ScDocument& rOldDoc,
const ScAddress& rNewPos, const ScAddress& rOldPos, bool bGlobalNamesToLocal,
const SCTAB nOldSheet, const SCTAB nNewSheet, bool bSameDoc)
{
ScRangeData* pRangeData = nullptr;
- const ScRangeName* pOldRangeName = (nTab < 0 ? pOldDoc->GetRangeName() : pOldDoc->GetRangeName(nTab));
+ const ScRangeName* pOldRangeName = (nTab < 0 ? rOldDoc.GetRangeName() : rOldDoc.GetRangeName(nTab));
if (pOldRangeName)
{
const ScRangeName* pNewRangeName = (nNewSheet < 0 ? rNewDoc.GetRangeName() : rNewDoc.GetRangeName(nNewSheet));
@@ -743,7 +743,7 @@ ScRangeData* copyRangeNames( SheetIndexMap& rSheetIndexMap, std::vector<ScRangeD
// none.
if (pCopyData == pOldRangeData)
{
- pRangeData = copyRangeName( pCopyData, rNewDoc, pOldDoc, rNewPos, rOldPos,
+ pRangeData = copyRangeName( pCopyData, rNewDoc, rOldDoc, rNewPos, rOldPos,
bGlobalNamesToLocal, nOldSheet, nNewSheet, bSameDoc);
if (pRangeData)
{
@@ -764,7 +764,7 @@ ScRangeData* copyRangeNames( SheetIndexMap& rSheetIndexMap, std::vector<ScRangeD
}
else
{
- ScRangeData* pTmpData = copyRangeName( pCopyData, rNewDoc, pOldDoc, rNewPos, rOldPos,
+ ScRangeData* pTmpData = copyRangeName( pCopyData, rNewDoc, rOldDoc, rNewPos, rOldPos,
bGlobalNamesToLocal, nOldSheet, nNewSheet, bSameDoc);
if (pTmpData)
{
@@ -883,7 +883,7 @@ bool ScDocument::CopyAdjustRangeName( SCTAB& rSheet, sal_uInt16& rIndex, ScRange
const SCTAB nTmpOldSheet = (nOldSheet < 0 ? nOldTab : nOldSheet);
nNewSheet = rNewPos.Tab();
rpRangeData = copyRangeNames( aSheetIndexMap, aRangeDataVec, aReferencingNames, nOldTab,
- pOldRangeData, rNewDoc, this, rNewPos, rOldPos,
+ pOldRangeData, rNewDoc, *this, rNewPos, rOldPos,
bGlobalNamesToLocal, nTmpOldSheet, nNewSheet, bSameDoc);
}
if ((bGlobalNamesToLocal || !bSameDoc) && !aReferencingNames.isEmpty(-1))
@@ -891,7 +891,7 @@ bool ScDocument::CopyAdjustRangeName( SCTAB& rSheet, sal_uInt16& rIndex, ScRange
const SCTAB nTmpOldSheet = -1;
const SCTAB nTmpNewSheet = (bGlobalNamesToLocal ? rNewPos.Tab() : -1);
ScRangeData* pTmpData = copyRangeNames( aSheetIndexMap, aRangeDataVec, aReferencingNames, -1,
- pOldRangeData, rNewDoc, this, rNewPos, rOldPos,
+ pOldRangeData, rNewDoc, *this, rNewPos, rOldPos,
bGlobalNamesToLocal, nTmpOldSheet, nTmpNewSheet, bSameDoc);
if (!rpRangeData)
{
@@ -930,7 +930,7 @@ bool ScDocument::CopyAdjustRangeName( SCTAB& rSheet, sal_uInt16& rIndex, ScRange
else
{
nNewSheet = ((nOldSheet < 0 && !bGlobalNamesToLocal) ? -1 : rNewPos.Tab());
- rpRangeData = copyRangeName( pOldRangeData, rNewDoc, this, rNewPos, rOldPos, bGlobalNamesToLocal,
+ rpRangeData = copyRangeName( pOldRangeData, rNewDoc, *this, rNewPos, rOldPos, bGlobalNamesToLocal,
nOldSheet, nNewSheet, bSameDoc);
}
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index ece248cef842..17b4dd5f4ef1 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -429,13 +429,13 @@ bool lcl_isReference(const FormulaToken& rToken)
rToken.GetType() == svDoubleRef;
}
-void adjustRangeName(formula::FormulaToken* pToken, ScDocument& rNewDoc, const ScDocument* pOldDoc,
+void adjustRangeName(formula::FormulaToken* pToken, ScDocument& rNewDoc, const ScDocument& rOldDoc,
const ScAddress& rNewPos, const ScAddress& rOldPos, bool bGlobalNamesToLocal)
{
ScRangeData* pRangeData = nullptr;
SCTAB nSheet = pToken->GetSheet();
sal_uInt16 nIndex = pToken->GetIndex();
- if (!pOldDoc->CopyAdjustRangeName( nSheet, nIndex, pRangeData, rNewDoc, rNewPos, rOldPos, bGlobalNamesToLocal, true))
+ if (!rOldDoc.CopyAdjustRangeName( nSheet, nIndex, pRangeData, rNewDoc, rNewPos, rOldPos, bGlobalNamesToLocal, true))
return; // nothing to do
if (!pRangeData)
@@ -450,9 +450,9 @@ void adjustRangeName(formula::FormulaToken* pToken, ScDocument& rNewDoc, const S
pToken->SetSheet(nSheet);
}
-void adjustDBRange(formula::FormulaToken* pToken, ScDocument& rNewDoc, const ScDocument* pOldDoc)
+void adjustDBRange(formula::FormulaToken* pToken, ScDocument& rNewDoc, const ScDocument& rOldDoc)
{
- ScDBCollection* pOldDBCollection = pOldDoc->GetDBCollection();
+ ScDBCollection* pOldDBCollection = rOldDoc.GetDBCollection();
if (!pOldDBCollection)
return;//strange error case, don't do anything
ScDBCollection::NamedDBs& aOldNamedDBs = pOldDBCollection->getNamedDBs();
@@ -856,19 +856,19 @@ ScFormulaCell::ScFormulaCell(const ScFormulaCell& rCell, ScDocument& rDoc, const
{
OpCode eOpCode = pToken->GetOpCode();
if (eOpCode == ocName)
- adjustRangeName(pToken, rDoc, &rCell.rDocument, aPos, rCell.aPos, bGlobalNamesToLocal);
+ adjustRangeName(pToken, rDoc, rCell.rDocument, aPos, rCell.aPos, bGlobalNamesToLocal);
else if (eOpCode == ocDBArea || eOpCode == ocTableRef)
- adjustDBRange(pToken, rDoc, &rCell.rDocument);
+ adjustDBRange(pToken, rDoc, rCell.rDocument);
}
}
bool bCopyBetweenDocs = rDocument.GetPool() != rCell.rDocument.GetPool();
if (bCopyBetweenDocs && !(nCloneFlags & ScCloneFlags::NoMakeAbsExternal))
{
- pCode->ReadjustAbsolute3DReferences( &rCell.rDocument, &rDoc, rCell.aPos);
+ pCode->ReadjustAbsolute3DReferences(rCell.rDocument, rDoc, rCell.aPos);
}
- pCode->AdjustAbsoluteRefs( &rCell.rDocument, rCell.aPos, aPos, bCopyBetweenDocs );
+ pCode->AdjustAbsoluteRefs( rCell.rDocument, rCell.aPos, aPos, bCopyBetweenDocs );
}
if (!rDocument.IsClipOrUndo())
@@ -3908,7 +3908,7 @@ void ScFormulaCell::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY
}
// See also ScDocument::FindRangeNamesReferencingSheet()
-static void lcl_FindRangeNamesInUse(sc::UpdatedRangeNames& rIndexes, const ScTokenArray* pCode, const ScDocument* pDoc,
+static void lcl_FindRangeNamesInUse(sc::UpdatedRangeNames& rIndexes, const ScTokenArray* pCode, const ScDocument& rDoc,
int nRecursion)
{
FormulaTokenArrayPlainIterator aIter(*pCode);
@@ -3922,9 +3922,9 @@ static void lcl_FindRangeNamesInUse(sc::UpdatedRangeNames& rIndexes, const ScTok
if (nRecursion < 126) // whatever... 42*3
{
- ScRangeData* pSubName = pDoc->FindRangeNameBySheetAndIndex( nTab, nTokenIndex);
+ ScRangeData* pSubName = rDoc.FindRangeNameBySheetAndIndex( nTab, nTokenIndex);
if (pSubName)
- lcl_FindRangeNamesInUse(rIndexes, pSubName->GetCode(), pDoc, nRecursion+1);
+ lcl_FindRangeNamesInUse(rIndexes, pSubName->GetCode(), rDoc, nRecursion+1);
}
}
}
@@ -3932,7 +3932,7 @@ static void lcl_FindRangeNamesInUse(sc::UpdatedRangeNames& rIndexes, const ScTok
void ScFormulaCell::FindRangeNamesInUse(sc::UpdatedRangeNames& rIndexes) const
{
- lcl_FindRangeNamesInUse( rIndexes, pCode, &rDocument, 0);
+ lcl_FindRangeNamesInUse( rIndexes, pCode, rDocument, 0);
}
void ScFormulaCell::SetChanged(bool b)
diff --git a/sc/source/core/tool/consoli.cxx b/sc/source/core/tool/consoli.cxx
index b3ba355536b0..7b02c05c2fb5 100644
--- a/sc/source/core/tool/consoli.cxx
+++ b/sc/source/core/tool/consoli.cxx
@@ -390,7 +390,7 @@ SCROW ScConsData::GetInsertCount() const
// store completed data to document
//TODO: optimize on columns?
-void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow, SCTAB nTab )
+void ScConsData::OutputToDocument( ScDocument& rDestDoc, SCCOL nCol, SCROW nRow, SCTAB nTab )
{
OpCode eOpCode = eOpCodeTable[eFunction];
@@ -400,7 +400,7 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow,
// left top corner
if ( bColByName && bRowByName && !aCornerText.isEmpty() )
- pDestDoc->SetString( nCol, nRow, nTab, aCornerText );
+ rDestDoc.SetString( nCol, nRow, nTab, aCornerText );
// title
@@ -411,10 +411,10 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow,
if (bColByName)
for (SCSIZE i=0; i<nColCount; i++)
- pDestDoc->SetString( sal::static_int_cast<SCCOL>(nStartCol+i), nRow, nTab, maColHeaders[i] );
+ rDestDoc.SetString( sal::static_int_cast<SCCOL>(nStartCol+i), nRow, nTab, maColHeaders[i] );
if (bRowByName)
for (SCSIZE j=0; j<nRowCount; j++)
- pDestDoc->SetString( nCol, sal::static_int_cast<SCROW>(nStartRow+j), nTab, maRowHeaders[j] );
+ rDestDoc.SetString( nCol, sal::static_int_cast<SCROW>(nStartRow+j), nTab, maRowHeaders[j] );
nCol = nStartCol;
nRow = nStartRow;
@@ -429,11 +429,11 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow,
{
double fVal = ppFunctionData[nArrX][nArrY].getResult();
if (ppFunctionData[nArrX][nArrY].getError())
- pDestDoc->SetError( sal::static_int_cast<SCCOL>(nCol+nArrX),
- sal::static_int_cast<SCROW>(nRow+nArrY), nTab, FormulaError::NoValue );
+ rDestDoc.SetError( sal::static_int_cast<SCCOL>(nCol+nArrX),
+ sal::static_int_cast<SCROW>(nRow+nArrY), nTab, FormulaError::NoValue );
else
- pDestDoc->SetValue( sal::static_int_cast<SCCOL>(nCol+nArrX),
- sal::static_int_cast<SCROW>(nRow+nArrY), nTab, fVal );
+ rDestDoc.SetValue( sal::static_int_cast<SCCOL>(nCol+nArrX),
+ sal::static_int_cast<SCROW>(nRow+nArrY), nTab, fVal );
}
}
@@ -460,7 +460,7 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow,
if (nNeeded)
{
- pDestDoc->InsertRow( 0,nTab, pDestDoc->MaxCol(),nTab, nRow+nArrY, nNeeded );
+ rDestDoc.InsertRow( 0,nTab, rDestDoc.MaxCol(),nTab, nRow+nArrY, nNeeded );
for (nArrX=0; nArrX<nColCount; nArrX++)
if (ppUsed[nArrX][nArrY])
@@ -475,15 +475,15 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow,
{
// insert reference (absolute, 3d)
- aSRef.SetAddress(pDestDoc->GetSheetLimits(), ScAddress(aRef.nCol,aRef.nRow,aRef.nTab), ScAddress());
+ aSRef.SetAddress(rDestDoc.GetSheetLimits(), ScAddress(aRef.nCol,aRef.nRow,aRef.nTab), ScAddress());
- ScTokenArray aRefArr(*pDestDoc);
+ ScTokenArray aRefArr(rDestDoc);
aRefArr.AddSingleReference(aSRef);
aRefArr.AddOpCode(ocStop);
ScAddress aDest( sal::static_int_cast<SCCOL>(nCol+nArrX),
sal::static_int_cast<SCROW>(nRow+nArrY+nPos), nTab );
- ScFormulaCell* pCell = new ScFormulaCell(*pDestDoc, aDest, aRefArr);
- pDestDoc->SetFormulaCell(aDest, pCell);
+ ScFormulaCell* pCell = new ScFormulaCell(rDestDoc, aDest, aRefArr);
+ rDestDoc.SetFormulaCell(aDest, pCell);
}
}
@@ -494,30 +494,30 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow,
ScRange aRange(sal::static_int_cast<SCCOL>(nCol+nArrX), nRow+nArrY, nTab);
aRange.aEnd.SetRow(nRow+nArrY+nNeeded-1);
- aCRef.SetRange(pDestDoc->GetSheetLimits(), aRange, aDest);
+ aCRef.SetRange(rDestDoc.GetSheetLimits(), aRange, aDest);
- ScTokenArray aArr(*pDestDoc);
+ ScTokenArray aArr(rDestDoc);
aArr.AddOpCode(eOpCode); // selected function
aArr.AddOpCode(ocOpen);
aArr.AddDoubleReference(aCRef);
aArr.AddOpCode(ocClose);
aArr.AddOpCode(ocStop);
- ScFormulaCell* pCell = new ScFormulaCell(*pDestDoc, aDest, aArr);
- pDestDoc->SetFormulaCell(aDest, pCell);
+ ScFormulaCell* pCell = new ScFormulaCell(rDestDoc, aDest, aArr);
+ rDestDoc.SetFormulaCell(aDest, pCell);
}
}
// insert outline
- ScOutlineArray& rOutArr = pDestDoc->GetOutlineTable( nTab, true )->GetRowArray();
+ ScOutlineArray& rOutArr = rDestDoc.GetOutlineTable( nTab, true )->GetRowArray();
SCROW nOutStart = nRow+nArrY;
SCROW nOutEnd = nRow+nArrY+nNeeded-1;
bool bSize = false;
rOutArr.Insert( nOutStart, nOutEnd, bSize );
for (SCROW nOutRow=nOutStart; nOutRow<=nOutEnd; nOutRow++)
- pDestDoc->ShowRow( nOutRow, nTab, false );
- pDestDoc->SetDrawPageSize(nTab);
- pDestDoc->UpdateOutlineRow( nOutStart, nOutEnd, nTab, false );
+ rDestDoc.ShowRow( nOutRow, nTab, false );
+ rDestDoc.SetDrawPageSize(nTab);
+ rDestDoc.UpdateOutlineRow( nOutStart, nOutEnd, nTab, false );
// sub title
@@ -533,7 +533,7 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow,
if ( bDo && nTPos < nNeeded )
{
aString = maRowHeaders[nArrY] + " / " + maTitles[nPos];
- pDestDoc->SetString( nCol-1, nRow+nArrY+nTPos, nTab, aString );
+ rDestDoc.SetString( nCol-1, nRow+nArrY+nTPos, nTab, aString );
}
}
}
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 0502c748bbbe..6bf0342a6809 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -2418,11 +2418,11 @@ bool IsInCopyRange( const ScRange& rRange, const ScDocument* pClipDoc )
return rClipParam.maRanges.In(rRange);
}
-bool SkipReference(formula::FormulaToken* pToken, const ScAddress& rPos, const ScDocument* pOldDoc, bool bRangeName, bool bCheckCopyArea)
+bool SkipReference(formula::FormulaToken* pToken, const ScAddress& rPos, const ScDocument& rOldDoc, bool bRangeName, bool bCheckCopyArea)
{
ScRange aRange;
- if (!ScRefTokenHelper::getRangeFromToken(pOldDoc, aRange, pToken, rPos))
+ if (!ScRefTokenHelper::getRangeFromToken(&rOldDoc, aRange, pToken, rPos))
return true;
if (bRangeName && aRange.aStart.Tab() == rPos.Tab())
@@ -2448,7 +2448,7 @@ bool SkipReference(formula::FormulaToken* pToken, const ScAddress& rPos, const S
}
}
- if (bCheckCopyArea && IsInCopyRange(aRange, pOldDoc))
+ if (bCheckCopyArea && IsInCopyRange(aRange, &rOldDoc))
return true;
return false;
@@ -2472,7 +2472,7 @@ void AdjustSingleRefData( ScSingleRefData& rRef, const ScAddress& rOldPos, const
}
-void ScTokenArray::ReadjustAbsolute3DReferences( const ScDocument* pOldDoc, ScDocument* pNewDoc, const ScAddress& rPos, bool bRangeName )
+void ScTokenArray::ReadjustAbsolute3DReferences( const ScDocument& rOldDoc, ScDocument& rNewDoc, const ScAddress& rPos, bool bRangeName )
{
for ( sal_uInt16 j=0; j<nLen; ++j )
{
@@ -2480,7 +2480,7 @@ void ScTokenArray::ReadjustAbsolute3DReferences( const ScDocument* pOldDoc, ScDo
{
case svDoubleRef :
{
- if (SkipReference(pCode[j], rPos, pOldDoc, bRangeName, true))
+ if (SkipReference(pCode[j], rPos, rOldDoc, bRangeName, true))
continue;
ScComplexRefData& rRef = *pCode[j]->GetDoubleRef();
@@ -2491,16 +2491,16 @@ void ScTokenArray::ReadjustAbsolute3DReferences( const ScDocument* pOldDoc, ScDo
{
OUString aTabName;
sal_uInt16 nFileId;
- GetExternalTableData(pOldDoc, pNewDoc, rRef1.Tab(), aTabName, nFileId);
+ GetExternalTableData(&rOldDoc, &rNewDoc, rRef1.Tab(), aTabName, nFileId);
ReplaceToken( j, new ScExternalDoubleRefToken( nFileId,
- pNewDoc->GetSharedStringPool().intern( aTabName), rRef), CODE_AND_RPN);
+ rNewDoc.GetSharedStringPool().intern( aTabName), rRef), CODE_AND_RPN);
// ATTENTION: rRef can't be used after this point
}
}
break;
case svSingleRef :
{
- if (SkipReference(pCode[j], rPos, pOldDoc, bRangeName, true))
+ if (SkipReference(pCode[j], rPos, rOldDoc, bRangeName, true))
continue;
ScSingleRefData& rRef = *pCode[j]->GetSingleRef();
@@ -2509,9 +2509,9 @@ void ScTokenArray::ReadjustAbsolute3DReferences( const ScDocument* pOldDoc, ScDo
{
OUString aTabName;
sal_uInt16 nFileId;
- GetExternalTableData(pOldDoc, pNewDoc, rRef.Tab(), aTabName, nFileId);
+ GetExternalTableData(&rOldDoc, &rNewDoc, rRef.Tab(), aTabName, nFileId);
ReplaceToken( j, new ScExternalSingleRefToken( nFileId,
- pNewDoc->GetSharedStringPool().intern( aTabName), rRef), CODE_AND_RPN);
+ rNewDoc.GetSharedStringPool().intern( aTabName), rRef), CODE_AND_RPN);
// ATTENTION: rRef can't be used after this point
}
}
@@ -2524,7 +2524,7 @@ void ScTokenArray::ReadjustAbsolute3DReferences( const ScDocument* pOldDoc, ScDo
}
}
-void ScTokenArray::AdjustAbsoluteRefs( const ScDocument* pOldDoc, const ScAddress& rOldPos, const ScAddress& rNewPos,
+void ScTokenArray::AdjustAbsoluteRefs( const ScDocument& rOldDoc, const ScAddress& rOldPos, const ScAddress& rNewPos,
bool bCheckCopyRange)
{
TokenPointers aPtrs( pCode.get(), nLen, pRPN, nRPN, true);
@@ -2542,7 +2542,7 @@ void ScTokenArray::AdjustAbsoluteRefs( const ScDocument* pOldDoc, const ScAddres
{
case svDoubleRef :
{
- if (!SkipReference(p, rOldPos, pOldDoc, false, bCheckCopyRange))
+ if (!SkipReference(p, rOldPos, rOldDoc, false, bCheckCopyRange))
continue;
ScComplexRefData& rRef = *p->GetDoubleRef();
@@ -2555,7 +2555,7 @@ void ScTokenArray::AdjustAbsoluteRefs( const ScDocument* pOldDoc, const ScAddres
break;
case svSingleRef :
{
- if (!SkipReference(p, rOldPos, pOldDoc, false, bCheckCopyRange))
+ if (!SkipReference(p, rOldPos, rOldDoc, false, bCheckCopyRange))
continue;
ScSingleRefData& rRef = *p->GetSingleRef();
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 039130929030..fde5d60e5a10 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -627,7 +627,7 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
pDestData->SetHeader( rParam.bByRow );
}
- aData.OutputToDocument( &m_aDocument, rParam.nCol, rParam.nRow, rParam.nTab );
+ aData.OutputToDocument( m_aDocument, rParam.nCol, rParam.nRow, rParam.nTab );
SCCOL nPaintStartCol = rParam.nCol;
SCROW nPaintStartRow = rParam.nRow;
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 75593140747d..a888ebc4ccbe 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -813,9 +813,9 @@ void Chart2Positioner::createPositionMap()
class Tokens2RangeString
{
public:
- Tokens2RangeString(ScDocument* pDoc, FormulaGrammar::Grammar eGram, sal_Unicode cRangeSep) :
+ Tokens2RangeString(ScDocument& rDoc, FormulaGrammar::Grammar eGram, sal_Unicode cRangeSep) :
mpRangeStr(std::make_shared<OUStringBuffer>()),
- mpDoc(pDoc),
+ mpDoc(&rDoc),
meGrammar(eGram),
mcRangeSep(cRangeSep),
mbFirst(true)
@@ -858,9 +858,9 @@ private:
class Tokens2RangeStringXML
{
public:
- explicit Tokens2RangeStringXML(ScDocument* pDoc) :
+ explicit Tokens2RangeStringXML(ScDocument& rDoc) :
mpRangeStr(std::make_shared<OUStringBuffer>()),
- mpDoc(pDoc),
+ mpDoc(&rDoc),
mbFirst(true)
{
}
@@ -873,7 +873,7 @@ public:
mpRangeStr->append(mcRangeSep);
ScTokenRef aStart, aEnd;
- bool bValidToken = splitRangeToken(mpDoc, rToken, aStart, aEnd);
+ bool bValidToken = splitRangeToken(*mpDoc, rToken, aStart, aEnd);
OSL_ENSURE(bValidToken, "invalid token");
if (!bValidToken)
return;
@@ -897,7 +897,7 @@ public:
}
private:
- static bool splitRangeToken(const ScDocument* pDoc, const ScTokenRef& pToken, ScTokenRef& rStart, ScTokenRef& rEnd)
+ static bool splitRangeToken(const ScDocument& rDoc, const ScTokenRef& pToken, ScTokenRef& rStart, ScTokenRef& rEnd)
{
ScComplexRefData aData;
bool bIsRefToken = ScRefTokenHelper::getDoubleRefDataFromToken(aData, pToken);
@@ -921,12 +921,12 @@ private:
if (bExternal)
rStart.reset(new ScExternalSingleRefToken(nFileId, aTabName, aData.Ref1));
else
- rStart.reset(new ScSingleRefToken(pDoc->GetSheetLimits(), aData.Ref1));
+ rStart.reset(new ScSingleRefToken(rDoc.GetSheetLimits(), aData.Ref1));
if (bExternal)
rEnd.reset(new ScExternalSingleRefToken(nFileId, aTabName, aData.Ref2));
else
- rEnd.reset(new ScSingleRefToken(pDoc->GetSheetLimits(), aData.Ref2));
+ rEnd.reset(new ScSingleRefToken(rDoc.GetSheetLimits(), aData.Ref2));
return true;
}
@@ -945,11 +945,11 @@ private:
bool mbFirst;
};
-void lcl_convertTokensToString(OUString& rStr, const vector<ScTokenRef>& rTokens, ScDocument* pDoc)
+void lcl_convertTokensToString(OUString& rStr, const vector<ScTokenRef>& rTokens, ScDocument& rDoc)
{
const sal_Unicode cRangeSep = ScCompiler::GetNativeSymbolChar(ocSep);
- FormulaGrammar::Grammar eGrammar = pDoc->GetGrammar();
- Tokens2RangeString func(pDoc, eGrammar, cRangeSep);
+ FormulaGrammar::Grammar eGrammar = rDoc.GetGrammar();
+ Tokens2RangeString func(rDoc, eGrammar, cRangeSep);
func = ::std::for_each(rTokens.begin(), rTokens.end(), func);
func.getString(rStr);
}
@@ -1895,7 +1895,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL ScChart2DataProvider::detectArgum
}
// Get range string.
- lcl_convertTokensToString(sRangeRep, aAllTokens, m_pDocument);
+ lcl_convertTokensToString(sRangeRep, aAllTokens, *m_pDocument);
// add cell range property
aResult.emplace_back( "CellRangeRepresentation", -1,
@@ -2168,7 +2168,7 @@ OUString SAL_CALL ScChart2DataProvider::convertRangeToXML( const OUString& sRang
if (aRefTokens.empty())
throw lang::IllegalArgumentException();
- Tokens2RangeStringXML converter(m_pDocument);
+ Tokens2RangeStringXML converter(*m_pDocument);
converter = ::std::for_each(aRefTokens.begin(), aRefTokens.end(), converter);
converter.getString(aRet);
@@ -2962,7 +2962,7 @@ OUString SAL_CALL ScChart2DataSequence::getSourceRangeRepresentation()
OUString aStr;
OSL_ENSURE( m_pDocument, "No Document -> no SourceRangeRepresentation" );
if (m_pDocument)
- lcl_convertTokensToString(aStr, m_aTokens, m_pDocument);
+ lcl_convertTokensToString(aStr, m_aTokens, *m_pDocument);
return aStr;
}
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 819f5a9fd5bb..0efbaa4965b9 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -855,10 +855,10 @@ namespace {
class CellFormulaValueSetter : public CellValueSetter
{
private:
- ScDocument* m_pDoc;
+ ScDocument& m_rDoc;
formula::FormulaGrammar::Grammar m_eGrammar;
public:
- CellFormulaValueSetter( const uno::Any& aValue, ScDocument* pDoc, formula::FormulaGrammar::Grammar eGram ):CellValueSetter( aValue ), m_pDoc( pDoc ), m_eGrammar( eGram ){}
+ CellFormulaValueSetter( const uno::Any& aValue, ScDocument& rDoc, formula::FormulaGrammar::Grammar eGram ):CellValueSetter( aValue ), m_rDoc( rDoc ), m_eGrammar( eGram ){}
protected:
bool processValue( const uno::Any& aValue, const uno::Reference< table::XCell >& xCell ) override
{
@@ -877,7 +877,7 @@ protected:
if ( pUnoRangesBase )
{
ScRangeList aCellRanges = pUnoRangesBase->GetRangeList();
- ScCompiler aCompiler( m_pDoc, aCellRanges.front().aStart, m_eGrammar );
+ ScCompiler aCompiler( &m_rDoc, aCellRanges.front().aStart, m_eGrammar );
// compile the string in the format passed in
std::unique_ptr<ScTokenArray> pArray(aCompiler.CompileString(sFormula));
// set desired convention to that of the document
@@ -904,10 +904,10 @@ protected:
class CellFormulaValueGetter : public CellValueGetter
{
private:
- ScDocument* m_pDoc;
+ ScDocument& m_rDoc;
formula::FormulaGrammar::Grammar m_eGrammar;
public:
- CellFormulaValueGetter(ScDocument* pDoc, formula::FormulaGrammar::Grammar eGram ) : CellValueGetter( ), m_pDoc( pDoc ), m_eGrammar( eGram ) {}
+ CellFormulaValueGetter(ScDocument& rDoc, formula::FormulaGrammar::Grammar eGram ) : CellValueGetter( ), m_rDoc( rDoc ), m_eGrammar( eGram ) {}
virtual void visitNode( sal_Int32 /*x*/, sal_Int32 /*y*/, const uno::Reference< table::XCell >& xCell ) override
{
uno::Any aValue;
@@ -920,7 +920,7 @@ public:
pUnoRangesBase )
{
ScRangeList aCellRanges = pUnoRangesBase->GetRangeList();
- ScCompiler aCompiler( m_pDoc, aCellRanges.front().aStart, formula::FormulaGrammar::GRAM_DEFAULT );
+ ScCompiler aCompiler( &m_rDoc, aCellRanges.front().aStart, formula::FormulaGrammar::GRAM_DEFAULT );
std::unique_ptr<ScTokenArray> pArray(aCompiler.CompileString(sVal));
// set desired convention
aCompiler.SetGrammar( m_eGrammar );
@@ -1647,7 +1647,7 @@ ScVbaRange::setFormulaValue( const uno::Any& rFormula, formula::FormulaGrammar::
aVisitor.visit( valueProcessor );
return;
}
- CellFormulaValueSetter formulaValueSetter( rFormula, &getScDocument(), eGram );
+ CellFormulaValueSetter formulaValueSetter( rFormula, getScDocument(), eGram );
setValue( rFormula, formulaValueSetter );
}
@@ -1663,7 +1663,7 @@ ScVbaRange::getFormulaValue( formula::FormulaGrammar::Grammar eGram )
uno::Reference< excel::XRange > xRange( getArea( 0 ), uno::UNO_SET_THROW );
return xRange->getFormula();
}
- CellFormulaValueGetter valueGetter( &getScDocument(), eGram );
+ CellFormulaValueGetter valueGetter( getScDocument(), eGram );
return getValue( valueGetter );
}