summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-22 20:44:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-23 09:41:31 +0200
commit02ab482b8fb8faa04e62f97d952f7e98cf0490fb (patch)
treeef8535acbd906fe8e0c7279983d0604e3722a04c /sc/source
parent8db6083692e92389d50565bbf8643c60572e4aca (diff)
ScRefAddress::GetRefString never passed a null ScDocument*
so the nullptr check can be removed and some more along that vein Change-Id: Ic0c1f98564b6bd457edd0d3ba2a4382b7945e806 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103217 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/documen4.cxx22
-rw-r--r--sc/source/core/data/documentimport.cxx22
-rw-r--r--sc/source/core/data/markdata.cxx13
-rw-r--r--sc/source/core/data/table1.cxx18
-rw-r--r--sc/source/core/data/tabprotection.cxx10
-rw-r--r--sc/source/core/tool/address.cxx30
-rw-r--r--sc/source/core/tool/compiler.cxx2
-rw-r--r--sc/source/core/tool/interpr4.cxx4
-rw-r--r--sc/source/core/tool/rangeutl.cxx6
-rw-r--r--sc/source/core/tool/refdata.cxx12
-rw-r--r--sc/source/core/tool/token.cxx6
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.cxx4
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.hxx2
-rw-r--r--sc/source/ui/condformat/condformatmgr.cxx10
-rw-r--r--sc/source/ui/formdlg/formula.cxx2
-rw-r--r--sc/source/ui/inc/condformatmgr.hxx6
-rw-r--r--sc/source/ui/view/cellsh1.cxx2
-rw-r--r--sc/source/ui/view/viewfun2.cxx2
-rw-r--r--sc/source/ui/view/viewfunc.cxx4
19 files changed, 87 insertions, 90 deletions
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index f9934976ce9a..cec8bc9081f1 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -394,12 +394,12 @@ void ScDocument::InsertTableOp(const ScTabOpParam& rParam, // multiple (repeate
if (rParam.meMode == ScTabOpParam::Column) // column only
{
aRef.Set( rParam.aRefFormulaCell.GetAddress(), true, false, false );
- aForString.append(aRef.GetRefString(this, nTab1));
+ aForString.append(aRef.GetRefString(*this, nTab1));
aForString.append(sSep);
- aForString.append(rParam.aRefColCell.GetRefString(this, nTab1));
+ aForString.append(rParam.aRefColCell.GetRefString(*this, nTab1));
aForString.append(sSep);
aRef.Set( nCol1, nRow1, nTab1, false, true, true );
- aForString.append(aRef.GetRefString(this, nTab1));
+ aForString.append(aRef.GetRefString(*this, nTab1));
nCol1++;
nCol2 = std::min( nCol2, static_cast<SCCOL>(rParam.aRefFormulaEnd.Col() -
rParam.aRefFormulaCell.Col() + nCol1 + 1));
@@ -407,29 +407,29 @@ void ScDocument::InsertTableOp(const ScTabOpParam& rParam, // multiple (repeate
else if (rParam.meMode == ScTabOpParam::Row) // row only
{
aRef.Set( rParam.aRefFormulaCell.GetAddress(), false, true, false );
- aForString.append(aRef.GetRefString(this, nTab1));
+ aForString.append(aRef.GetRefString(*this, nTab1));
aForString.append(sSep);
- aForString.append(rParam.aRefRowCell.GetRefString(this, nTab1));
+ aForString.append(rParam.aRefRowCell.GetRefString(*this, nTab1));
aForString.append(sSep);
aRef.Set( nCol1, nRow1, nTab1, true, false, true );
- aForString.append(aRef.GetRefString(this, nTab1));
+ aForString.append(aRef.GetRefString(*this, nTab1));
nRow1++;
nRow2 = std::min( nRow2, static_cast<SCROW>(rParam.aRefFormulaEnd.Row() -
rParam.aRefFormulaCell.Row() + nRow1 + 1));
}
else // both
{
- aForString.append(rParam.aRefFormulaCell.GetRefString(this, nTab1));
+ aForString.append(rParam.aRefFormulaCell.GetRefString(*this, nTab1));
aForString.append(sSep);
- aForString.append(rParam.aRefColCell.GetRefString(this, nTab1));
+ aForString.append(rParam.aRefColCell.GetRefString(*this, nTab1));
aForString.append(sSep);
aRef.Set( nCol1, nRow1 + 1, nTab1, false, true, true );
- aForString.append(aRef.GetRefString(this, nTab1));
+ aForString.append(aRef.GetRefString(*this, nTab1));
aForString.append(sSep);
- aForString.append(rParam.aRefRowCell.GetRefString(this, nTab1));
+ aForString.append(rParam.aRefRowCell.GetRefString(*this, nTab1));
aForString.append(sSep);
aRef.Set( nCol1 + 1, nRow1, nTab1, true, false, true );
- aForString.append(aRef.GetRefString(this, nTab1));
+ aForString.append(aRef.GetRefString(*this, nTab1));
nCol1++; nRow1++;
}
aForString.append(ScCompiler::GetNativeSymbol( ocClose ));
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index ed018a124711..f4cb0e24c0c0 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -472,12 +472,12 @@ void ScDocumentImport::setTableOpCells(const ScRange& rRange, const ScTabOpParam
if (rParam.meMode == ScTabOpParam::Column) // column only
{
aRef.Set(rParam.aRefFormulaCell.GetAddress(), true, false, false);
- aFormulaBuf.append(aRef.GetRefString(&rDoc, nTab));
+ aFormulaBuf.append(aRef.GetRefString(rDoc, nTab));
aFormulaBuf.append(aSep);
- aFormulaBuf.append(rParam.aRefColCell.GetRefString(&rDoc, nTab));
+ aFormulaBuf.append(rParam.aRefColCell.GetRefString(rDoc, nTab));
aFormulaBuf.append(aSep);
aRef.Set(nCol1, nRow1, nTab, false, true, true);
- aFormulaBuf.append(aRef.GetRefString(&rDoc, nTab));
+ aFormulaBuf.append(aRef.GetRefString(rDoc, nTab));
nCol1++;
nCol2 = std::min( nCol2, static_cast<SCCOL>(rParam.aRefFormulaEnd.Col() -
rParam.aRefFormulaCell.Col() + nCol1 + 1));
@@ -485,29 +485,29 @@ void ScDocumentImport::setTableOpCells(const ScRange& rRange, const ScTabOpParam
else if (rParam.meMode == ScTabOpParam::Row) // row only
{
aRef.Set(rParam.aRefFormulaCell.GetAddress(), false, true, false);
- aFormulaBuf.append(aRef.GetRefString(&rDoc, nTab));
+ aFormulaBuf.append(aRef.GetRefString(rDoc, nTab));
aFormulaBuf.append(aSep);
- aFormulaBuf.append(rParam.aRefRowCell.GetRefString(&rDoc, nTab));
+ aFormulaBuf.append(rParam.aRefRowCell.GetRefString(rDoc, nTab));
aFormulaBuf.append(aSep);
aRef.Set(nCol1, nRow1, nTab, true, false, true);
- aFormulaBuf.append(aRef.GetRefString(&rDoc, nTab));
+ aFormulaBuf.append(aRef.GetRefString(rDoc, nTab));
++nRow1;
nRow2 = std::min(
nRow2, rParam.aRefFormulaEnd.Row() - rParam.aRefFormulaCell.Row() + nRow1 + 1);
}
else // both
{
- aFormulaBuf.append(rParam.aRefFormulaCell.GetRefString(&rDoc, nTab));
+ aFormulaBuf.append(rParam.aRefFormulaCell.GetRefString(rDoc, nTab));
aFormulaBuf.append(aSep);
- aFormulaBuf.append(rParam.aRefColCell.GetRefString(&rDoc, nTab));
+ aFormulaBuf.append(rParam.aRefColCell.GetRefString(rDoc, nTab));
aFormulaBuf.append(aSep);
aRef.Set(nCol1, nRow1 + 1, nTab, false, true, true);
- aFormulaBuf.append(aRef.GetRefString(&rDoc, nTab));
+ aFormulaBuf.append(aRef.GetRefString(rDoc, nTab));
aFormulaBuf.append(aSep);
- aFormulaBuf.append(rParam.aRefRowCell.GetRefString(&rDoc, nTab));
+ aFormulaBuf.append(rParam.aRefRowCell.GetRefString(rDoc, nTab));
aFormulaBuf.append(aSep);
aRef.Set(nCol1 + 1, nRow1, nTab, true, false, true);
- aFormulaBuf.append(aRef.GetRefString(&rDoc, nTab));
+ aFormulaBuf.append(aRef.GetRefString(rDoc, nTab));
++nCol1;
++nRow1;
}
diff --git a/sc/source/core/data/markdata.cxx b/sc/source/core/data/markdata.cxx
index 0740246bc220..f44a33c7f8bd 100644
--- a/sc/source/core/data/markdata.cxx
+++ b/sc/source/core/data/markdata.cxx
@@ -648,31 +648,30 @@ void ScMarkData::DeleteTab( SCTAB nTab )
maTabMarked.swap(tabMarked);
}
-void ScMarkData::ShiftCols(const ScDocument* pDoc, SCCOL nStartCol, long nColOffset)
+void ScMarkData::ShiftCols(const ScDocument& rDoc, SCCOL nStartCol, long nColOffset)
{
if (bMarked)
{
- aMarkRange.IncColIfNotLessThan(pDoc, nStartCol, nColOffset);
+ aMarkRange.IncColIfNotLessThan(rDoc, nStartCol, nColOffset);
}
else if (bMultiMarked)
{
aMultiSel.ShiftCols(nStartCol, nColOffset);
- aMultiRange.IncColIfNotLessThan(pDoc, nStartCol, nColOffset);
+ aMultiRange.IncColIfNotLessThan(rDoc, nStartCol, nColOffset);
}
}
-void ScMarkData::ShiftRows(const ScDocument* pDoc, SCROW nStartRow, long nRowOffset)
+void ScMarkData::ShiftRows(const ScDocument& rDoc, SCROW nStartRow, long nRowOffset)
{
if (bMarked)
{
- aMarkRange.IncRowIfNotLessThan(pDoc, nStartRow, nRowOffset);
+ aMarkRange.IncRowIfNotLessThan(rDoc, nStartRow, nRowOffset);
}
else if (bMultiMarked)
{
aMultiSel.ShiftRows(nStartRow, nRowOffset);
- aMultiRange.IncRowIfNotLessThan(pDoc, nStartRow, nRowOffset);
+ aMultiRange.IncRowIfNotLessThan(rDoc, nStartRow, nRowOffset);
}
-
}
static void lcl_AddRanges(ScRange& rRangeDest, const ScRange& rNewRange )
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index c0c07ef172d0..898ca28a5081 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1827,7 +1827,7 @@ void ScTable::UpdateReference(
mpCondFormatList->UpdateReference(rCxt);
if (pTabProtection)
- pTabProtection->updateReference( eUpdateRefMode, &rDocument, rCxt.maRange, nDx, nDy, nDz);
+ pTabProtection->updateReference( eUpdateRefMode, rDocument, rCxt.maRange, nDx, nDy, nDz);
}
void ScTable::UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
@@ -1862,7 +1862,7 @@ void ScTable::UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt )
mpCondFormatList->UpdateInsertTab(rCxt);
if (pTabProtection)
- pTabProtection->updateReference( URM_INSDEL, &rDocument,
+ pTabProtection->updateReference( URM_INSDEL, rDocument,
ScRange( 0, 0, rCxt.mnInsertPos, rDocument.MaxCol(), rDocument.MaxRow(), MAXTAB),
0, 0, rCxt.mnSheets);
@@ -1891,7 +1891,7 @@ void ScTable::UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt )
mpCondFormatList->UpdateDeleteTab(rCxt);
if (pTabProtection)
- pTabProtection->updateReference( URM_INSDEL, &rDocument,
+ pTabProtection->updateReference( URM_INSDEL, rDocument,
ScRange( 0, 0, rCxt.mnDeletePos, rDocument.MaxCol(), rDocument.MaxRow(), MAXTAB),
0, 0, -rCxt.mnSheets);
@@ -1915,7 +1915,7 @@ void ScTable::UpdateMoveTab(
mpCondFormatList->UpdateMoveTab(rCxt);
if (pTabProtection)
- pTabProtection->updateReference( URM_REORDER, &rDocument,
+ pTabProtection->updateReference( URM_REORDER, rDocument,
ScRange( 0, 0, rCxt.mnOldPos, rDocument.MaxCol(), rDocument.MaxRow(), MAXTAB),
0, 0, rCxt.mnNewPos - rCxt.mnOldPos);
@@ -2012,7 +2012,7 @@ void ScTable::ExtendPrintArea( OutputDevice* pDev,
for (SCCOL nDataCol = nCol; 0 <= nDataCol && nDataCol >= aColData.mnCol1; --nDataCol)
{
SCCOL nPrintCol = nDataCol;
- VisibleDataCellIterator aIter(&rDocument, *mpHiddenRows, aCol[nDataCol]);
+ VisibleDataCellIterator aIter(rDocument, *mpHiddenRows, aCol[nDataCol]);
ScRefCellValue aCell = aIter.reset(nStartRow);
if (aCell.isEmpty())
// No visible cells found in this column. Skip it.
@@ -2239,8 +2239,8 @@ void ScTable::RestorePrintRanges( const ScPrintSaverTab& rSaveTab )
UpdatePageBreaks(nullptr);
}
-ScTable::VisibleDataCellIterator::VisibleDataCellIterator(const ScDocument* pDoc, ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn) :
- mpDocument(pDoc),
+ScTable::VisibleDataCellIterator::VisibleDataCellIterator(const ScDocument& rDoc, ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn) :
+ mrDocument(rDoc),
mrRowSegs(rRowSegs),
mrColumn(rColumn),
mnCurRow(ROW_NOT_FOUND),
@@ -2254,7 +2254,7 @@ ScTable::VisibleDataCellIterator::~VisibleDataCellIterator()
ScRefCellValue ScTable::VisibleDataCellIterator::reset(SCROW nRow)
{
- if (nRow > mpDocument->MaxRow())
+ if (nRow > mrDocument.MaxRow())
{
mnCurRow = ROW_NOT_FOUND;
return ScRefCellValue();
@@ -2279,7 +2279,7 @@ ScRefCellValue ScTable::VisibleDataCellIterator::reset(SCROW nRow)
// the next segment.
mnCurRow = aData.mnRow2 + 1;
mnUBound = mnCurRow; // get range data on the next iteration.
- if (mnCurRow > mpDocument->MaxRow())
+ if (mnCurRow > mrDocument.MaxRow())
{
// Make sure the row doesn't exceed our current limit.
mnCurRow = ROW_NOT_FOUND;
diff --git a/sc/source/core/data/tabprotection.cxx b/sc/source/core/data/tabprotection.cxx
index 3f0d0dae595c..6c3de2bde15b 100644
--- a/sc/source/core/data/tabprotection.cxx
+++ b/sc/source/core/data/tabprotection.cxx
@@ -139,7 +139,7 @@ public:
void setEnhancedProtection( const ::std::vector< ScEnhancedProtection > & rProt );
const ::std::vector< ScEnhancedProtection > & getEnhancedProtection() const { return maEnhancedProtection;}
- bool updateReference( UpdateRefMode, const ScDocument*, const ScRange& rWhere, SCCOL nDx, SCROW nDy, SCTAB nDz );
+ bool updateReference( UpdateRefMode, const ScDocument&, const ScRange& rWhere, SCCOL nDx, SCROW nDy, SCTAB nDz );
bool isBlockEditable( const ScRange& rRange ) const;
bool isSelectionEditable( const ScRangeList& rRangeList ) const;
@@ -428,14 +428,14 @@ void ScTableProtectionImpl::setEnhancedProtection( const ::std::vector< ScEnhanc
maEnhancedProtection = rProt;
}
-bool ScTableProtectionImpl::updateReference( UpdateRefMode eMode, const ScDocument* pDoc,
+bool ScTableProtectionImpl::updateReference( UpdateRefMode eMode, const ScDocument& rDoc,
const ScRange& rWhere, SCCOL nDx, SCROW nDy, SCTAB nDz )
{
bool bChanged = false;
for (auto& rEnhancedProtection : maEnhancedProtection)
{
if (rEnhancedProtection.maRangeList.is())
- bChanged |= rEnhancedProtection.maRangeList->UpdateReference( eMode, pDoc, rWhere, nDx, nDy, nDz);
+ bChanged |= rEnhancedProtection.maRangeList->UpdateReference( eMode, &rDoc, rWhere, nDx, nDy, nDz);
}
return bChanged;
}
@@ -705,10 +705,10 @@ const ::std::vector< ScEnhancedProtection > & ScTableProtection::getEnhancedProt
return mpImpl->getEnhancedProtection();
}
-bool ScTableProtection::updateReference( UpdateRefMode eMode, const ScDocument* pDoc, const ScRange& rWhere,
+bool ScTableProtection::updateReference( UpdateRefMode eMode, const ScDocument& rDoc, const ScRange& rWhere,
SCCOL nDx, SCROW nDy, SCTAB nDz )
{
- return mpImpl->updateReference( eMode, pDoc, rWhere, nDx, nDy, nDz);
+ return mpImpl->updateReference( eMode, rDoc, rWhere, nDx, nDy, nDz);
}
bool ScTableProtection::isBlockEditable( const ScRange& rRange ) const
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 1fb89ad7af15..0a75ff057703 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -2404,43 +2404,43 @@ bool ScRange::MoveSticky( const ScDocument& rDoc, SCCOL dx, SCROW dy, SCTAB dz,
return b1 && b2;
}
-void ScRange::IncColIfNotLessThan(const ScDocument* pDoc, SCCOL nStartCol, SCCOL nOffset)
+void ScRange::IncColIfNotLessThan(const ScDocument& rDoc, SCCOL nStartCol, SCCOL nOffset)
{
if (aStart.Col() >= nStartCol)
{
aStart.IncCol(nOffset);
if (aStart.Col() < 0)
aStart.SetCol(0);
- else if(aStart.Col() > (pDoc ? pDoc->MaxCol() : MAXCOL))
- aStart.SetCol(pDoc ? pDoc->MaxCol() : MAXCOL);
+ else if(aStart.Col() > rDoc.MaxCol())
+ aStart.SetCol(rDoc.MaxCol());
}
if (aEnd.Col() >= nStartCol)
{
aEnd.IncCol(nOffset);
if (aEnd.Col() < 0)
aEnd.SetCol(0);
- else if(aEnd.Col() > (pDoc ? pDoc->MaxCol() : MAXCOL))
- aEnd.SetCol(pDoc ? pDoc->MaxCol() : MAXCOL);
+ else if(aEnd.Col() > rDoc.MaxCol())
+ aEnd.SetCol(rDoc.MaxCol());
}
}
-void ScRange::IncRowIfNotLessThan(const ScDocument* pDoc, SCROW nStartRow, SCROW nOffset)
+void ScRange::IncRowIfNotLessThan(const ScDocument& rDoc, SCROW nStartRow, SCROW nOffset)
{
if (aStart.Row() >= nStartRow)
{
aStart.IncRow(nOffset);
if (aStart.Row() < 0)
aStart.SetRow(0);
- else if(aStart.Row() > pDoc->MaxRow())
- aStart.SetRow(pDoc->MaxRow());
+ else if(aStart.Row() > rDoc.MaxRow())
+ aStart.SetRow(rDoc.MaxRow());
}
if (aEnd.Row() >= nStartRow)
{
aEnd.IncRow(nOffset);
if (aEnd.Row() < 0)
aEnd.SetRow(0);
- else if(aEnd.Row() > pDoc->MaxRow())
- aEnd.SetRow(pDoc->MaxRow());
+ else if(aEnd.Row() > rDoc.MaxRow())
+ aEnd.SetRow(rDoc.MaxRow());
}
}
@@ -2508,12 +2508,10 @@ OUString ScAddress::GetColRowString() const
return aString.makeStringAndClear();
}
-OUString ScRefAddress::GetRefString( const ScDocument* pDoc, SCTAB nActTab,
- const ScAddress::Details& rDetails ) const
+OUString ScRefAddress::GetRefString( const ScDocument& rDoc, SCTAB nActTab,
+ const ScAddress::Details& rDetails ) const
{
- if ( !pDoc )
- return EMPTY_OUSTRING;
- if ( Tab()+1 > pDoc->GetTableCount() )
+ if ( Tab()+1 > rDoc.GetTableCount() )
return ScCompiler::GetNativeSymbol(ocErrRef);
ScRefFlags nFlags = ScRefFlags::VALID;
@@ -2528,7 +2526,7 @@ OUString ScRefAddress::GetRefString( const ScDocument* pDoc, SCTAB nActTab,
if ( !bRelRow )
nFlags |= ScRefFlags::ROW_ABS;
- return aAdr.Format(nFlags, pDoc, rDetails);
+ return aAdr.Format(nFlags, &rDoc, rDetails);
}
bool AlphaToCol(const ScDocument& rDoc, SCCOL& rCol, const OUString& rStr)
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 423582cea2a0..9ab2b6107cf5 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4371,7 +4371,7 @@ bool ScCompiler::NextNewToken( bool bInArray )
// If a syntactically correct reference was recognized but invalid
// e.g. because of non-existing sheet name => entire reference
// ocBad to preserve input instead of #REF!.A1
- if (!maRawToken.IsValidReference(&rDoc))
+ if (!maRawToken.IsValidReference(rDoc))
{
aUpper = aOrg; // ensure for ocBad
break; // do; create ocBad token or set error.
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 95670a9df55c..8d08d1ba9516 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1860,7 +1860,7 @@ void ScInterpreter::PushSingleRef( const ScRefAddress& rRef )
if (!IfErrorPushError())
{
ScSingleRefData aRef;
- aRef.InitFromRefAddress( &mrDoc, rRef, aPos);
+ aRef.InitFromRefAddress( mrDoc, rRef, aPos);
PushTempTokenWithoutError( new ScSingleRefToken( mrDoc.GetSheetLimits(), aRef ) );
}
}
@@ -1870,7 +1870,7 @@ void ScInterpreter::PushDoubleRef( const ScRefAddress& rRef1, const ScRefAddress
if (!IfErrorPushError())
{
ScComplexRefData aRef;
- aRef.InitFromRefAddresses( &mrDoc, rRef1, rRef2, aPos);
+ aRef.InitFromRefAddresses( mrDoc, rRef1, rRef2, aPos);
PushTempTokenWithoutError( new ScDoubleRefToken( mrDoc.GetSheetLimits(), aRef ) );
}
}
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index d069c63280a8..1530fddcea19 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -192,9 +192,9 @@ bool ScRangeUtil::IsAbsArea( const OUString& rAreaStr,
if ( pCompleteStr )
{
- *pCompleteStr = startPos.GetRefString( &rDoc, MAXTAB+1, rDetails );
+ *pCompleteStr = startPos.GetRefString( rDoc, MAXTAB+1, rDetails );
*pCompleteStr += ":";
- *pCompleteStr += endPos.GetRefString( &rDoc, nTab, rDetails );
+ *pCompleteStr += endPos.GetRefString( rDoc, nTab, rDetails );
}
if ( pStartPos && pEndPos )
@@ -226,7 +226,7 @@ bool ScRangeUtil::IsAbsPos( const OUString& rPosStr,
if ( pPosTripel )
*pPosTripel = thePos;
if ( pCompleteStr )
- *pCompleteStr = thePos.GetRefString( &rDoc, MAXTAB+1, rDetails );
+ *pCompleteStr = thePos.GetRefString( rDoc, MAXTAB+1, rDetails );
}
return bIsAbsPos;
diff --git a/sc/source/core/tool/refdata.cxx b/sc/source/core/tool/refdata.cxx
index 8f49acb3160b..4d07d5ca2e3f 100644
--- a/sc/source/core/tool/refdata.cxx
+++ b/sc/source/core/tool/refdata.cxx
@@ -37,23 +37,23 @@ void ScSingleRefData::InitAddress( SCCOL nColP, SCROW nRowP, SCTAB nTabP )
mnTab = nTabP;
}
-void ScSingleRefData::InitAddressRel( const ScDocument* pDoc, const ScAddress& rAdr, const ScAddress& rPos )
+void ScSingleRefData::InitAddressRel( const ScDocument& rDoc, const ScAddress& rAdr, const ScAddress& rPos )
{
InitFlags();
SetColRel(true);
SetRowRel(true);
SetTabRel(true);
- SetAddress(pDoc->GetSheetLimits(), rAdr, rPos);
+ SetAddress(rDoc.GetSheetLimits(), rAdr, rPos);
}
-void ScSingleRefData::InitFromRefAddress( const ScDocument* pDoc, const ScRefAddress& rRef, const ScAddress& rPos )
+void ScSingleRefData::InitFromRefAddress( const ScDocument& rDoc, const ScRefAddress& rRef, const ScAddress& rPos )
{
InitFlags();
SetColRel( rRef.IsRelCol());
SetRowRel( rRef.IsRelRow());
SetTabRel( rRef.IsRelTab());
SetFlag3D( rRef.Tab() != rPos.Tab());
- SetAddress( pDoc->GetSheetLimits(), rRef.GetAddress(), rPos);
+ SetAddress( rDoc.GetSheetLimits(), rRef.GetAddress(), rPos);
}
void ScSingleRefData::SetAbsCol( SCCOL nVal )
@@ -377,7 +377,7 @@ void ScSingleRefData::Dump( int nIndent ) const
}
#endif
-void ScComplexRefData::InitFromRefAddresses( const ScDocument* pDoc, const ScRefAddress& rRef1, const ScRefAddress& rRef2, const ScAddress& rPos )
+void ScComplexRefData::InitFromRefAddresses( const ScDocument& rDoc, const ScRefAddress& rRef1, const ScRefAddress& rRef2, const ScAddress& rPos )
{
InitFlags();
Ref1.SetColRel( rRef1.IsRelCol());
@@ -388,7 +388,7 @@ void ScComplexRefData::InitFromRefAddresses( const ScDocument* pDoc, const ScRef
Ref2.SetRowRel( rRef2.IsRelRow());
Ref2.SetTabRel( rRef2.IsRelTab());
Ref2.SetFlag3D( rRef1.Tab() != rRef2.Tab());
- SetRange( pDoc->GetSheetLimits(), ScRange( rRef1.GetAddress(), rRef2.GetAddress()), rPos);
+ SetRange( rDoc.GetSheetLimits(), ScRange( rRef1.GetAddress(), rRef2.GetAddress()), rPos);
}
ScComplexRefData& ScComplexRefData::Extend( ScSheetLimits& rLimits, const ScSingleRefData & rRef, const ScAddress & rPos )
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 3466c6ba94d0..ea41da8d9552 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -334,14 +334,14 @@ void ScRawToken::SetExternal( const OUString& rStr )
maExternalName = rStr;
}
-bool ScRawToken::IsValidReference(const ScDocument* pDoc) const
+bool ScRawToken::IsValidReference(const ScDocument& rDoc) const
{
switch (eType)
{
case svSingleRef:
- return aRef.Ref1.Valid(pDoc);
+ return aRef.Ref1.Valid(&rDoc);
case svDoubleRef:
- return aRef.Valid(pDoc);
+ return aRef.Valid(&rDoc);
case svExternalSingleRef:
case svExternalDoubleRef:
return true;
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index a9e9ae359993..fc68fdcac16b 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -973,9 +973,9 @@ VclPtr<AbstractScSortWarningDlg> ScAbstractDialogFactory_Impl::CreateScSortWarni
return VclPtr<AbstractScSortWarningDlg_Impl>::Create(std::make_unique<ScSortWarningDlg>(pParent, rExtendText, rCurrentText));
}
-VclPtr<AbstractScCondFormatManagerDlg> ScAbstractDialogFactory_Impl::CreateScCondFormatMgrDlg(weld::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList )
+VclPtr<AbstractScCondFormatManagerDlg> ScAbstractDialogFactory_Impl::CreateScCondFormatMgrDlg(weld::Window* pParent, ScDocument& rDoc, const ScConditionalFormatList* pFormatList )
{
- return VclPtr<AbstractScCondFormatManagerDlg_Impl>::Create(std::make_shared<ScCondFormatManagerDlg>(pParent, pDoc, pFormatList));
+ return VclPtr<AbstractScCondFormatManagerDlg_Impl>::Create(std::make_shared<ScCondFormatManagerDlg>(pParent, rDoc, pFormatList));
}
VclPtr<AbstractScDataPilotDatabaseDlg> ScAbstractDialogFactory_Impl::CreateScDataPilotDatabaseDlg(weld::Window* pParent)
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 65853602d8c5..fc2e992ee4be 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -690,7 +690,7 @@ public:
virtual VclPtr<AbstractScSortWarningDlg> CreateScSortWarningDlg(weld::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText ) override;
- virtual VclPtr<AbstractScCondFormatManagerDlg> CreateScCondFormatMgrDlg(weld::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList ) override;
+ virtual VclPtr<AbstractScCondFormatManagerDlg> CreateScCondFormatMgrDlg(weld::Window* pParent, ScDocument& rDoc, const ScConditionalFormatList* pFormatList ) override;
virtual VclPtr<AbstractScDataPilotDatabaseDlg> CreateScDataPilotDatabaseDlg(weld::Window* pParent) override;
diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
index 03e691ac2ed8..4e9e3224ab94 100644
--- a/sc/source/ui/condformat/condformatmgr.cxx
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -16,9 +16,9 @@
#include <conditio.hxx>
ScCondFormatManagerWindow::ScCondFormatManagerWindow(weld::TreeView& rTreeView,
- ScDocument* pDoc, ScConditionalFormatList* pFormatList)
+ ScDocument& rDoc, ScConditionalFormatList* pFormatList)
: mrTreeView(rTreeView)
- , mpDoc(pDoc)
+ , mrDoc(rDoc)
, mpFormatList(pFormatList)
{
mrTreeView.set_size_request(mrTreeView.get_approximate_digit_width() * 70,
@@ -41,7 +41,7 @@ void ScCondFormatManagerWindow::Init()
for(const auto& rItem : *mpFormatList)
{
const ScRangeList& aRange = rItem->GetRange();
- aRange.Format(sRangeStr, ScRefFlags::VALID, *mpDoc, mpDoc->GetAddressConvention());
+ aRange.Format(sRangeStr, ScRefFlags::VALID, mrDoc, mrDoc.GetAddressConvention());
mrTreeView.append(OUString::number(rItem->GetKey()), sRangeStr);
mrTreeView.set_text(nRow, ScCondFormatHelper::GetExpression(*rItem, aRange.GetTopLeftCorner()), 1);
++nRow;
@@ -83,7 +83,7 @@ void ScCondFormatManagerWindow::setColSizes()
mrTreeView.set_column_fixed_widths(aWidths);
}
-ScCondFormatManagerDlg::ScCondFormatManagerDlg(weld::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList)
+ScCondFormatManagerDlg::ScCondFormatManagerDlg(weld::Window* pParent, ScDocument& rDoc, const ScConditionalFormatList* pFormatList)
: GenericDialogController(pParent, "modules/scalc/ui/condformatmanager.ui", "CondFormatManager")
, m_bModified(false)
, m_xFormatList( pFormatList ? new ScConditionalFormatList(*pFormatList) : nullptr)
@@ -91,7 +91,7 @@ ScCondFormatManagerDlg::ScCondFormatManagerDlg(weld::Window* pParent, ScDocument
, m_xBtnRemove(m_xBuilder->weld_button("remove"))
, m_xBtnEdit(m_xBuilder->weld_button("edit"))
, m_xTreeView(m_xBuilder->weld_tree_view("CONTAINER"))
- , m_xCtrlManager(new ScCondFormatManagerWindow(*m_xTreeView, pDoc, m_xFormatList.get()))
+ , m_xCtrlManager(new ScCondFormatManagerWindow(*m_xTreeView, rDoc, m_xFormatList.get()))
{
m_xBtnRemove->connect_clicked(LINK(this, ScCondFormatManagerDlg, RemoveBtnHdl));
m_xBtnEdit->connect_clicked(LINK(this, ScCondFormatManagerDlg, EditBtnClickHdl));
diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index 20f60edbc6c4..e150cfa1e9bd 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -442,7 +442,7 @@ void ScFormulaDlg::SetReference( const ScRange& rRef, ScDocument& rRefDoc )
// position.
ScTokenArray aArray(rRefDoc);
ScComplexRefData aRefData;
- aRefData.InitRangeRel(&rRefDoc, rRef, m_CursorPos);
+ aRefData.InitRangeRel(rRefDoc, rRef, m_CursorPos);
if ((eRangeFlags & eColFlags) == eColFlags)
{
aRefData.Ref1.SetAbsCol( rRef.aStart.Col() );
diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx
index f24f57952a33..2e7eaa54eaa9 100644
--- a/sc/source/ui/inc/condformatmgr.hxx
+++ b/sc/source/ui/inc/condformatmgr.hxx
@@ -25,11 +25,11 @@ private:
void setColSizes();
weld::TreeView& mrTreeView;
- ScDocument* mpDoc;
+ ScDocument& mrDoc;
ScConditionalFormatList* mpFormatList;
public:
- ScCondFormatManagerWindow(weld::TreeView& rTreeView, ScDocument* pDoc, ScConditionalFormatList* pFormatList);
+ ScCondFormatManagerWindow(weld::TreeView& rTreeView, ScDocument& rDoc, ScConditionalFormatList* pFormatList);
void DeleteSelection();
ScConditionalFormat* GetSelection();
@@ -38,7 +38,7 @@ public:
class ScCondFormatManagerDlg : public weld::GenericDialogController
{
public:
- ScCondFormatManagerDlg(weld::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList);
+ ScCondFormatManagerDlg(weld::Window* pParent, ScDocument& rDoc, const ScConditionalFormatList* pFormatList);
virtual ~ScCondFormatManagerDlg() override;
std::unique_ptr<ScConditionalFormatList> GetConditionalFormatList();
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 8492d8d4e227..a55673827585 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2614,7 +2614,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
pList = rDoc.GetCondFormList( aPos.Tab() );
VclPtr<AbstractScCondFormatManagerDlg> pDlg(pFact->CreateScCondFormatMgrDlg(
- pTabViewShell->GetFrameWeld(), &rDoc, pList));
+ pTabViewShell->GetFrameWeld(), rDoc, pList));
if (pDlgItem)
pDlg->SetModified();
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index c0f28d7017a8..0d981959ca59 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -831,7 +831,7 @@ OUString ScViewFunc::GetAutoSumFormula( const ScRangeList& rRangeList, bool bSub
if (i != 0)
pArray->AddOpCode(ocSep);
ScComplexRefData aRef;
- aRef.InitRangeRel(&rDoc, r, rAddr);
+ aRef.InitRangeRel(rDoc, r, rAddr);
pArray->AddDoubleReference(aRef);
}
}
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 31a357325aa5..b15e7751b752 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1500,7 +1500,7 @@ void ScViewFunc::OnLOKInsertDeleteColumn(SCCOL nStartCol, long nOffset)
aMultiMark.MarkToMulti();
if (aMultiMark.IsMultiMarked())
{
- aMultiMark.ShiftCols(&pTabViewShell->GetViewData().GetDocument(), nStartCol, nOffset);
+ aMultiMark.ShiftCols(pTabViewShell->GetViewData().GetDocument(), nStartCol, nOffset);
pTabViewShell->SetMarkData(aMultiMark);
}
}
@@ -1556,7 +1556,7 @@ void ScViewFunc::OnLOKInsertDeleteRow(SCROW nStartRow, long nOffset)
aMultiMark.MarkToMulti();
if (aMultiMark.IsMultiMarked())
{
- aMultiMark.ShiftRows(&pTabViewShell->GetViewData().GetDocument(), nStartRow, nOffset);
+ aMultiMark.ShiftRows(pTabViewShell->GetViewData().GetDocument(), nStartRow, nOffset);
pTabViewShell->SetMarkData(aMultiMark);
}
}