sc/inc/address.hxx | 6 +++--- sc/inc/compiler.hxx | 2 +- sc/inc/markdata.hxx | 4 ++-- sc/inc/refdata.hxx | 12 ++++++------ sc/inc/scabstdlg.hxx | 2 +- sc/inc/table.hxx | 4 ++-- sc/inc/tabprotection.hxx | 2 +- sc/qa/unit/ucalc_formula.cxx | 2 +- sc/source/core/data/documen4.cxx | 22 +++++++++++----------- sc/source/core/data/documentimport.cxx | 22 +++++++++++----------- sc/source/core/data/markdata.cxx | 13 ++++++------- sc/source/core/data/table1.cxx | 18 +++++++++--------- sc/source/core/data/tabprotection.cxx | 10 +++++----- sc/source/core/tool/address.cxx | 30 ++++++++++++++---------------- sc/source/core/tool/compiler.cxx | 2 +- sc/source/core/tool/interpr4.cxx | 4 ++-- sc/source/core/tool/rangeutl.cxx | 6 +++--- sc/source/core/tool/refdata.cxx | 12 ++++++------ sc/source/core/tool/token.cxx | 6 +++--- sc/source/ui/attrdlg/scdlgfact.cxx | 4 ++-- sc/source/ui/attrdlg/scdlgfact.hxx | 2 +- sc/source/ui/condformat/condformatmgr.cxx | 10 +++++----- sc/source/ui/formdlg/formula.cxx | 2 +- sc/source/ui/inc/condformatmgr.hxx | 6 +++--- sc/source/ui/view/cellsh1.cxx | 2 +- sc/source/ui/view/viewfun2.cxx | 2 +- sc/source/ui/view/viewfunc.cxx | 4 ++-- 27 files changed, 104 insertions(+), 107 deletions(-)
New commits: commit 02ab482b8fb8faa04e62f97d952f7e98cf0490fb Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Sep 22 20:44:41 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Sep 23 09:41:31 2020 +0200 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 <caol...@redhat.com> diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index fd40f29b3c12..4b2ad09691ba 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -637,8 +637,8 @@ public: [[nodiscard]] SC_DLLPUBLIC bool MoveSticky( const ScDocument& rDoc, SCCOL aDeltaX, SCROW aDeltaY, SCTAB aDeltaZ, ScRange& rErrorRange ); - SC_DLLPUBLIC void IncColIfNotLessThan(const ScDocument* pDoc, SCCOL nStartCol, SCCOL nOffset); - SC_DLLPUBLIC void IncRowIfNotLessThan(const ScDocument* pDoc, SCROW nStartRow, SCROW nOffset); + SC_DLLPUBLIC void IncColIfNotLessThan(const ScDocument& rDoc, SCCOL nStartCol, SCCOL nOffset); + SC_DLLPUBLIC void IncRowIfNotLessThan(const ScDocument& rDoc, SCROW nStartRow, SCROW nOffset); SC_DLLPUBLIC void ExtendTo( const ScRange& rRange ); SC_DLLPUBLIC bool Intersects( const ScRange& rRange ) const; // do two ranges intersect? @@ -905,7 +905,7 @@ public: inline bool operator == ( const ScRefAddress& r ) const; - OUString GetRefString( const ScDocument* pDocument, SCTAB nActTab, + OUString GetRefString( const ScDocument& rDocument, SCTAB nActTab, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1) const; }; diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 15bbd16a56cb..b09bce06797d 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -168,7 +168,7 @@ public: false. Used only in ScCompiler::NextNewToken() to preserve non-existing sheet names in otherwise valid references. */ - bool IsValidReference(const ScDocument* pDoc) const; + bool IsValidReference(const ScDocument& rDoc) const; formula::FormulaToken* CreateToken(ScSheetLimits& rLimits) const; // create typified token }; diff --git a/sc/inc/markdata.hxx b/sc/inc/markdata.hxx index a92e00ce3746..283202cfd8eb 100644 --- a/sc/inc/markdata.hxx +++ b/sc/inc/markdata.hxx @@ -142,8 +142,8 @@ public: void InsertTab( SCTAB nTab ); void DeleteTab( SCTAB nTab ); - void ShiftCols(const ScDocument* pDoc, SCCOL nStartCol, long nColOffset); - void ShiftRows(const ScDocument* pDoc, SCROW nStartRow, long nRowOffset); + void ShiftCols(const ScDocument& rDoc, SCCOL nStartCol, long nColOffset); + void ShiftRows(const ScDocument& rDoc, SCROW nStartRow, long nRowOffset); // Generate envelopes if multimarked and fills the passed ScRange object with // the smallest range that includes the marked area plus its envelopes. diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx index 9429ba0d8cff..dce91b5091d9 100644 --- a/sc/inc/refdata.hxx +++ b/sc/inc/refdata.hxx @@ -57,9 +57,9 @@ public: void InitAddress( const ScAddress& rAdr ); void InitAddress( SCCOL nCol, SCROW nRow, SCTAB nTab ); /// InitAddressRel: InitFlags and set address, everything relative to rPos - void InitAddressRel( const ScDocument* pDoc, const ScAddress& rAdr, const ScAddress& rPos ); + void InitAddressRel( const ScDocument& rDoc, const ScAddress& rAdr, const ScAddress& rPos ); /// InitFlags and set address, relative to rPos if rRef says so. - void InitFromRefAddress( const ScDocument* pDoc, const ScRefAddress& rRef, const ScAddress& rPos ); + void InitFromRefAddress( const ScDocument& rDoc, const ScRefAddress& rRef, const ScAddress& rPos ); sal_uInt8 FlagValue() const { return mnFlagValue;} void SetColRel( bool bVal ) { Flags.bColRel = bVal; } @@ -132,10 +132,10 @@ struct ScComplexRefData Ref1.InitAddress( rRange.aStart ); Ref2.InitAddress( rRange.aEnd ); } - void InitRangeRel( const ScDocument* pDoc, const ScRange& rRange, const ScAddress& rPos ) + void InitRangeRel( const ScDocument& rDoc, const ScRange& rRange, const ScAddress& rPos ) { - Ref1.InitAddressRel( pDoc, rRange.aStart, rPos ); - Ref2.InitAddressRel( pDoc, rRange.aEnd, rPos ); + Ref1.InitAddressRel( rDoc, rRange.aStart, rPos ); + Ref2.InitAddressRel( rDoc, rRange.aEnd, rPos ); } void InitRange( SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2 ) @@ -145,7 +145,7 @@ struct ScComplexRefData } /// InitFlags and set range, relative to rPos if rRef1 and rRef2 say so. - void InitFromRefAddresses( const ScDocument* pDoc, const ScRefAddress& rRef1, const ScRefAddress& rRef2, const ScAddress& rPos ); + void InitFromRefAddresses( const ScDocument& rDoc, const ScRefAddress& rRef1, const ScRefAddress& rRef2, const ScAddress& rPos ); bool Valid(const ScDocument* pDoc) const; diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index d3bdb6e4e0f1..f36064373700 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -417,7 +417,7 @@ public: virtual VclPtr<AbstractScSortWarningDlg> CreateScSortWarningDlg(weld::Window* pParent, const OUString& rExtendText, const OUString& rCurrentText ) = 0; - virtual VclPtr<AbstractScCondFormatManagerDlg> CreateScCondFormatMgrDlg(weld::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList ) = 0; + virtual VclPtr<AbstractScCondFormatManagerDlg> CreateScCondFormatMgrDlg(weld::Window* pParent, ScDocument& rDoc, const ScConditionalFormatList* pFormatList ) = 0; virtual VclPtr<AbstractScDataPilotDatabaseDlg> CreateScDataPilotDatabaseDlg(weld::Window* pParent) = 0; diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 3e15695567cd..15a74d3fbaf8 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -1272,7 +1272,7 @@ private: static constexpr SCROW ROW_NOT_FOUND = -1; public: - explicit VisibleDataCellIterator(const ScDocument* pDoc, ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn); + explicit VisibleDataCellIterator(const ScDocument& rDoc, ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn); ~VisibleDataCellIterator(); /** @@ -1300,7 +1300,7 @@ private: SCROW getRow() const { return mnCurRow;} private: - const ScDocument* mpDocument; + const ScDocument& mrDocument; ScFlatBoolRowSegments& mrRowSegs; ScColumn& mrColumn; ScRefCellValue maCell; diff --git a/sc/inc/tabprotection.hxx b/sc/inc/tabprotection.hxx index fe543075fadd..caf408a0f35b 100644 --- a/sc/inc/tabprotection.hxx +++ b/sc/inc/tabprotection.hxx @@ -213,7 +213,7 @@ public: void setEnhancedProtection( const ::std::vector< ScEnhancedProtection > & rProt ); const ::std::vector< ScEnhancedProtection > & getEnhancedProtection() const; - 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; diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index e226103849c8..fd652222bffa 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -971,7 +971,7 @@ void Test::testFormulaRefData() CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong end position of extended range.", ScAddress(6,5,0), aTest.aEnd); ScComplexRefData aDoubleRef2; - aDoubleRef2.InitRangeRel(pDoc.get(), ScRange(1,2,0,8,6,0), ScAddress(5,5,0)); + aDoubleRef2.InitRangeRel(*pDoc, ScRange(1,2,0,8,6,0), ScAddress(5,5,0)); aDoubleRef.Extend(pDoc->GetSheetLimits(), aDoubleRef2, ScAddress(5,5,0)); aTest = aDoubleRef.toAbs(*pDoc, ScAddress(5,5,0)); 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); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits