diff options
Diffstat (limited to 'sc')
69 files changed, 258 insertions, 266 deletions
diff --git a/sc/inc/chartarr.hxx b/sc/inc/chartarr.hxx index c06400c34c69..c35fc4a6e66e 100644 --- a/sc/inc/chartarr.hxx +++ b/sc/inc/chartarr.hxx @@ -57,14 +57,14 @@ public: class ScChartArray // only parameter-struct { - ScDocument* pDocument; + ScDocument& rDocument; ScChartPositioner aPositioner; private: std::unique_ptr<ScMemChart> CreateMemChartSingle(); std::unique_ptr<ScMemChart> CreateMemChartMulti(); public: - ScChartArray( ScDocument* pDoc, const ScRangeListRef& rRangeList ); + ScChartArray( ScDocument& rDoc, const ScRangeListRef& rRangeList ); const ScRangeListRef& GetRangeList() const { return aPositioner.GetRangeList(); } const ScChartPositionMap* GetPositionMap() { return aPositioner.GetPositionMap(); } diff --git a/sc/inc/chartpos.hxx b/sc/inc/chartpos.hxx index 0069b1a80c50..ab953ef1461a 100644 --- a/sc/inc/chartpos.hxx +++ b/sc/inc/chartpos.hxx @@ -103,7 +103,7 @@ class ScDocument; class ScChartPositioner final // only parameter struct { ScRangeListRef aRangeListRef; - ScDocument* pDocument; + ScDocument& rDocument; std::unique_ptr<ScChartPositionMap> pPositionMap; ScChartGlue eGlue; SCCOL nStartCol; @@ -118,10 +118,10 @@ class ScChartPositioner final // only parameter struct void CreatePositionMap(); public: - ScChartPositioner( ScDocument* pDoc, SCTAB nTab, + ScChartPositioner( ScDocument& rDoc, SCTAB nTab, SCCOL nStartColP, SCROW nStartRowP, SCCOL nEndColP, SCROW nEndRowP ); - ScChartPositioner( ScDocument* pDoc, const ScRangeListRef& rRangeList ); + ScChartPositioner( ScDocument& rDoc, const ScRangeListRef& rRangeList ); ScChartPositioner( const ScChartPositioner& rPositioner ); ~ScChartPositioner(); diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index 364538749910..6a6339336907 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -668,8 +668,8 @@ public: ScRangeList GetCombinedRange() const; - void RemoveFromDocument(ScDocument* pDoc) const; - void AddToDocument(ScDocument* pDoc) const; + void RemoveFromDocument(ScDocument& rDoc) const; + void AddToDocument(ScDocument& rDoc) const; iterator begin(); const_iterator begin() const; diff --git a/sc/inc/dbdocutl.hxx b/sc/inc/dbdocutl.hxx index 8ceb525b2bc2..759490eeda03 100644 --- a/sc/inc/dbdocutl.hxx +++ b/sc/inc/dbdocutl.hxx @@ -40,7 +40,7 @@ public: StrData(); }; - static void PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, + static void PutData( ScDocument& rDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, const css::uno::Reference< css::sdbc::XRow>& xRow, long nRowPos, long nType, bool bCurrency, StrData* pStrData = nullptr ); diff --git a/sc/inc/docpool.hxx b/sc/inc/docpool.hxx index 75989a1beb77..9c3a6edcc50a 100644 --- a/sc/inc/docpool.hxx +++ b/sc/inc/docpool.hxx @@ -42,7 +42,7 @@ public: virtual MapUnit GetMetric( sal_uInt16 nWhich ) const override; void StyleDeleted( const ScStyleSheet* pStyle ); // delete templates(?) in organizer - void CellStyleCreated( const OUString& rName, const ScDocument* pDoc ); + void CellStyleCreated( const OUString& rName, const ScDocument& rDoc ); virtual bool GetPresentation( const SfxPoolItem& rItem, MapUnit ePresentationMetric, OUString& rText, diff --git a/sc/inc/filter.hxx b/sc/inc/filter.hxx index 25a4c6e2cc56..b92c98c16cf8 100644 --- a/sc/inc/filter.hxx +++ b/sc/inc/filter.hxx @@ -73,7 +73,7 @@ class SAL_DLLPUBLIC_RTTI ScFormatFilterPlugin { // various import helpers virtual std::unique_ptr<ScEEAbsImport> CreateRTFImport( ScDocument* pDoc, const ScRange& rRange ) = 0; virtual std::unique_ptr<ScEEAbsImport> CreateHTMLImport( ScDocument* pDocP, const OUString& rBaseURL, const ScRange& rRange ) = 0; - virtual OUString GetHTMLRangeNameList( ScDocument* pDoc, const OUString& rOrigName ) = 0; + virtual OUString GetHTMLRangeNameList( ScDocument& rDoc, const OUString& rOrigName ) = 0; // various export filters virtual ErrCode ScExportExcel5( SfxMedium&, ScDocument*, ExportFormatExcel eFormat, rtl_TextEncoding eDest ) = 0; diff --git a/sc/inc/fmtuno.hxx b/sc/inc/fmtuno.hxx index f67af17e947e..38c306ac26e5 100644 --- a/sc/inc/fmtuno.hxx +++ b/sc/inc/fmtuno.hxx @@ -190,7 +190,7 @@ private: public: ScTableValidationObj() = delete; - ScTableValidationObj(const ScDocument* pDoc, sal_uLong nKey, + ScTableValidationObj(const ScDocument& rDoc, sal_uLong nKey, const formula::FormulaGrammar::Grammar eGrammar); virtual ~ScTableValidationObj() override; diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index 68176a37cd5b..9be8b84df8a9 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -332,9 +332,9 @@ public: */ svl::SharedString GetRawString() const; const ScMatrix* GetMatrix(); - bool GetMatrixOrigin( const ScDocument* pDoc, ScAddress& rPos ) const; + bool GetMatrixOrigin( const ScDocument& rDoc, ScAddress& rPos ) const; void GetResultDimensions( SCSIZE& rCols, SCSIZE& rRows ); - sc::MatrixEdge GetMatrixEdge( const ScDocument* pDoc, ScAddress& rOrgPos ) const; + sc::MatrixEdge GetMatrixEdge( const ScDocument& rDoc, ScAddress& rOrgPos ) const; FormulaError GetErrCode(); // interpret first if necessary FormulaError GetRawError() const; // don't interpret, just return code or result error bool GetErrorOrValue( FormulaError& rErr, double& rVal ); diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx index 1c21460f0351..d6c21e07ac01 100644 --- a/sc/inc/patattr.hxx +++ b/sc/inc/patattr.hxx @@ -125,7 +125,7 @@ public: void SetStyleSheet(ScStyleSheet* pNewStyle, bool bClearDirectFormat = true); const ScStyleSheet* GetStyleSheet() const { return pStyle; } const OUString* GetStyleName() const; - void UpdateStyleSheet(const ScDocument* pDoc); + void UpdateStyleSheet(const ScDocument& rDoc); void StyleToName(); bool IsVisible() const; diff --git a/sc/inc/reftokenhelper.hxx b/sc/inc/reftokenhelper.hxx index c8ba9acca9b0..28af075a4258 100644 --- a/sc/inc/reftokenhelper.hxx +++ b/sc/inc/reftokenhelper.hxx @@ -61,8 +61,8 @@ namespace ScRefTokenHelper bool getDoubleRefDataFromToken(ScComplexRefData& rData, const ScTokenRef& pToken); - ScTokenRef createRefToken(const ScDocument* pDoc, const ScAddress& rAddr); - ScTokenRef createRefToken(const ScDocument* pDoc, const ScRange& rRange); + ScTokenRef createRefToken(const ScDocument& rDoc, const ScAddress& rAddr); + ScTokenRef createRefToken(const ScDocument& rDoc, const ScRange& rRange); }; #endif diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx index 08100126a7ae..b7113ee1658c 100644 --- a/sc/qa/unit/screenshots/screenshots.cxx +++ b/sc/qa/unit/screenshots/screenshots.cxx @@ -245,7 +245,7 @@ VclPtr<VclAbstractDialog> ScScreenshotTest::createDialogByID(sal_uInt32 nID) mpItemSet->Put(SfxUInt32Item(ATTR_VALUE_FORMAT, pAttr->GetNumberFormat( rDoc.GetFormatTable() ) ) ); - pNumberInfoItem = ScTabViewShell::MakeNumberInfoItem(&rDoc, &rViewData); + pNumberInfoItem = ScTabViewShell::MakeNumberInfoItem(rDoc, &rViewData); mpItemSet->MergeRange(SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO); mpItemSet->Put(*pNumberInfoItem); diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index ba235b6b7e66..e0543656631c 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -2343,7 +2343,7 @@ void checkMatrixRange(ScDocument& rDoc, const ScRange& rRange) const ScFormulaCell* pCell = rDoc.GetFormulaCell(aPos); CPPUNIT_ASSERT_MESSAGE("This must be a formula cell.", pCell); - bIsMatrix = pCell->GetMatrixOrigin(&rDoc, aMatOrigin); + bIsMatrix = pCell->GetMatrixOrigin(rDoc, aMatOrigin); CPPUNIT_ASSERT_MESSAGE("Not a part of matrix formula.", bIsMatrix); CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong matrix origin.", aMatRange.aStart, aMatOrigin); } diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx index dc6cdaa326c4..419123ef7622 100644 --- a/sc/source/core/data/cellvalue.cxx +++ b/sc/source/core/data/cellvalue.cxx @@ -180,7 +180,7 @@ OUString getStringImpl( const CellT& rCell, const ScDocument* pDoc ) } template<typename CellT> -OUString getRawStringImpl( const CellT& rCell, const ScDocument* pDoc ) +OUString getRawStringImpl( const CellT& rCell, const ScDocument& rDoc ) { switch (rCell.meType) { @@ -190,7 +190,7 @@ OUString getRawStringImpl( const CellT& rCell, const ScDocument* pDoc ) return rCell.mpString->getString(); case CELLTYPE_EDIT: if (rCell.mpEditText) - return ScEditUtil::GetString(*rCell.mpEditText, pDoc); + return ScEditUtil::GetString(*rCell.mpEditText, &rDoc); break; case CELLTYPE_FORMULA: return rCell.mpFormula->GetRawString().getString(); @@ -664,7 +664,7 @@ OUString ScRefCellValue::getString( const ScDocument* pDoc ) const OUString ScRefCellValue::getRawString( const ScDocument& rDoc ) const { - return getRawStringImpl(*this, &rDoc); + return getRawStringImpl(*this, rDoc); } bool ScRefCellValue::isEmpty() const diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 3d98018f64ac..fe968e85a23d 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -130,7 +130,7 @@ sc::MatrixEdge ScColumn::GetBlockMatrixEdges( SCROW nRow1, SCROW nRow2, sc::Matr if (pCell->GetMatrixFlag() == ScMatrixMode::NONE) return MatrixEdge::Nothing; - return pCell->GetMatrixEdge(&GetDoc(), aOrigin); + return pCell->GetMatrixEdge(GetDoc(), aOrigin); } bool bOpen = false; @@ -160,7 +160,7 @@ sc::MatrixEdge ScColumn::GetBlockMatrixEdges( SCROW nRow1, SCROW nRow2, sc::Matr if (pCell->GetMatrixFlag() == ScMatrixMode::NONE) continue; - nEdges = pCell->GetMatrixEdge(&GetDoc(), aOrigin); + nEdges = pCell->GetMatrixEdge(GetDoc(), aOrigin); if (nEdges == MatrixEdge::Nothing) continue; @@ -240,7 +240,7 @@ bool ScColumn::HasSelectionMatrixFragment(const ScMarkData& rMark) const // cell is not a part of a matrix. continue; - MatrixEdge nEdges = pCell->GetMatrixEdge(&GetDoc(), aOrigin); + MatrixEdge nEdges = pCell->GetMatrixEdge(GetDoc(), aOrigin); if (nEdges == MatrixEdge::Nothing) continue; diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 698ab22a05d5..3b2c54cfc477 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -2228,16 +2228,16 @@ ScRangeList ScConditionalFormatList::GetCombinedRange() const return aRange; } -void ScConditionalFormatList::RemoveFromDocument(ScDocument* pDoc) const +void ScConditionalFormatList::RemoveFromDocument(ScDocument& rDoc) const { ScRangeList aRange = GetCombinedRange(); - ScMarkData aMark(pDoc->GetSheetLimits()); + ScMarkData aMark(rDoc.GetSheetLimits()); aMark.MarkFromRangeList(aRange, true); sal_uInt16 const pItems[2] = { sal_uInt16(ATTR_CONDITIONAL),0}; - pDoc->ClearSelectionItems(pItems, aMark); + rDoc.ClearSelectionItems(pItems, aMark); } -void ScConditionalFormatList::AddToDocument(ScDocument* pDoc) const +void ScConditionalFormatList::AddToDocument(ScDocument& rDoc) const { for (auto& itr: m_ConditionalFormats) { @@ -2246,7 +2246,7 @@ void ScConditionalFormatList::AddToDocument(ScDocument* pDoc) const continue; SCTAB nTab = rRange.front().aStart.Tab(); - pDoc->AddCondFormatData(rRange, nTab, itr->GetKey()); + rDoc.AddCondFormatData(rRange, nTab, itr->GetKey()); } } diff --git a/sc/source/core/data/dbdocutl.cxx b/sc/source/core/data/dbdocutl.cxx index 32165dc5f653..07eca19c9ca6 100644 --- a/sc/source/core/data/dbdocutl.cxx +++ b/sc/source/core/data/dbdocutl.cxx @@ -34,9 +34,9 @@ ScDatabaseDocUtil::StrData::StrData() : { } -void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, +void ScDatabaseDocUtil::PutData(ScDocument& rDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, const uno::Reference<sdbc::XRow>& xRow, long nRowPos, - long nType, bool bCurrency, StrData* pStrData ) + long nType, bool bCurrency, StrData* pStrData) { OUString aString; double nVal = 0.0; @@ -54,7 +54,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB case sdbc::DataType::BIT: case sdbc::DataType::BOOLEAN: //TODO: use language from doc (here, date/time and currency)? - nFormatIndex = pDoc->GetFormatTable()->GetStandardFormat( + nFormatIndex = rDoc.GetFormatTable()->GetStandardFormat( SvNumFormatType::LOGICAL, ScGlobal::eLnge ); nVal = (xRow->getBoolean(nRowPos) ? 1 : 0); bEmptyFlag = ( nVal == 0.0 ) && xRow->wasNull(); @@ -91,7 +91,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nVal = 0.0; else { - SvNumberFormatter* pFormTable = pDoc->GetFormatTable(); + SvNumberFormatter* pFormTable = rDoc.GetFormatTable(); nFormatIndex = pFormTable->GetStandardFormat( SvNumFormatType::DATE, ScGlobal::eLnge ); nVal = Date( aDate ) - pFormTable->GetNullDate(); @@ -102,7 +102,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB case sdbc::DataType::TIME: { - SvNumberFormatter* pFormTable = pDoc->GetFormatTable(); + SvNumberFormatter* pFormTable = rDoc.GetFormatTable(); nFormatIndex = pFormTable->GetStandardFormat( SvNumFormatType::TIME, ScGlobal::eLnge ); @@ -118,7 +118,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB case sdbc::DataType::TIMESTAMP: { - SvNumberFormatter* pFormTable = pDoc->GetFormatTable(); + SvNumberFormatter* pFormTable = rDoc.GetFormatTable(); nFormatIndex = pFormTable->GetStandardFormat( SvNumFormatType::DATETIME, ScGlobal::eLnge ); @@ -154,21 +154,21 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB } if ( bValue && bCurrency ) - nFormatIndex = pDoc->GetFormatTable()->GetStandardFormat( + nFormatIndex = rDoc.GetFormatTable()->GetStandardFormat( SvNumFormatType::CURRENCY, ScGlobal::eLnge ); ScAddress aPos(nCol, nRow, nTab); if (bEmptyFlag) - pDoc->SetEmptyCell(aPos); + rDoc.SetEmptyCell(aPos); else if (bError) { - pDoc->SetError( nCol, nRow, nTab, FormulaError::NotAvailable ); + rDoc.SetError( nCol, nRow, nTab, FormulaError::NotAvailable ); } else if (bValue) { - pDoc->SetValue(aPos, nVal); + rDoc.SetValue(aPos, nVal); if (nFormatIndex) - pDoc->SetNumberFormat(aPos, nFormatIndex); + rDoc.SetNumberFormat(aPos, nFormatIndex); } else { @@ -176,7 +176,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB { if (ScStringUtil::isMultiline(aString)) { - pDoc->SetEditText(aPos, aString); + rDoc.SetEditText(aPos, aString); if (pStrData) pStrData->mbSimpleText = false; } @@ -184,7 +184,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB { ScSetStringParam aParam; aParam.setTextInput(); - pDoc->SetString(aPos, aString, &aParam); + rDoc.SetString(aPos, aString, &aParam); if (pStrData) pStrData->mbSimpleText = true; } @@ -193,7 +193,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB pStrData->mnStrLength = aString.getLength(); } else - pDoc->SetEmptyCell(aPos); + rDoc.SetEmptyCell(aPos); } } diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index b4a8e47fdc54..ad7e33a3a3ff 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -358,7 +358,7 @@ void ScDocumentPool::StyleDeleted( const ScStyleSheet* pStyle ) } } -void ScDocumentPool::CellStyleCreated( const OUString& rName, const ScDocument* pDoc ) +void ScDocumentPool::CellStyleCreated( const OUString& rName, const ScDocument& rDoc ) { // If a style was created, don't keep any pattern with its name string in the pool, // because it would compare equal to a pattern with a pointer to the new style. @@ -372,7 +372,7 @@ void ScDocumentPool::CellStyleCreated( const OUString& rName, const ScDocument* { const OUString* pStyleName = pPattern->GetStyleName(); if ( pStyleName && *pStyleName == rName ) - pPattern->UpdateStyleSheet(pDoc); // find and store style pointer + pPattern->UpdateStyleSheet(rDoc); // find and store style pointer } } } diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 7274dd77b2d0..e2efd10d7fc0 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -190,7 +190,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : * have all of these available. */ if ( eMode == SCDOCMODE_DOCUMENT || eMode == SCDOCMODE_FUNCTIONACCESS ) { - mxPoolHelper = new ScPoolHelper( this ); + mxPoolHelper = new ScPoolHelper( *this ); pBASM.reset( new ScBroadcastAreaSlotMachine( this ) ); pChartListenerCollection.reset( new ScChartListenerCollection( *this ) ); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 432673951492..c5926391988e 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -5435,7 +5435,7 @@ bool ScDocument::GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMat return false; ScAddress aOrigin = rCellPos; - if (!pFCell->GetMatrixOrigin(this, aOrigin)) + if (!pFCell->GetMatrixOrigin(*this, aOrigin)) // Failed to get the address of the matrix origin. return false; @@ -5457,7 +5457,7 @@ bool ScDocument::GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMat // from old file format). // Needs an "invalid" initialized address. aOrigin.SetInvalid(); - pFCell->GetMatrixEdge(this, aOrigin); + pFCell->GetMatrixEdge(*this, aOrigin); pFCell->GetMatColsRows(nSizeX, nSizeY); } @@ -6114,9 +6114,9 @@ void ScDocument::UpdStlShtPtrsFrmNms() { auto pPattern = const_cast<ScPatternAttr*>(dynamic_cast<const ScPatternAttr*>(pItem)); if (pPattern) - pPattern->UpdateStyleSheet(this); + pPattern->UpdateStyleSheet(*this); } - const_cast<ScPatternAttr&>(pPool->GetDefaultItem(ATTR_PATTERN)).UpdateStyleSheet(this); + const_cast<ScPatternAttr&>(pPool->GetDefaultItem(ATTR_PATTERN)).UpdateStyleSheet(*this); } void ScDocument::StylesToNames() diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index ec99a7124656..370434367cb3 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -87,15 +87,15 @@ struct DebugCalculationEntry { ScAddress maPos; OUString maResult; - const ScDocument* mpDoc; + const ScDocument& mrDoc; sal_uInt32 mnGroup; sal_uInt16 mnRecursion; - DebugCalculationEntry( const ScAddress& rPos, ScDocument* pDoc, sal_uInt32 nGroup ) : + DebugCalculationEntry( const ScAddress& rPos, ScDocument& rDoc, sal_uInt32 nGroup ) : maPos(rPos), - mpDoc(pDoc), + mrDoc(rDoc), mnGroup(nGroup), - mnRecursion(pDoc->GetRecursionHelper().GetRecursionCount()) + mnRecursion(rDoc.GetRecursionHelper().GetRecursionCount()) { } }; @@ -125,7 +125,7 @@ static struct DebugCalculation { for (auto const& it : mvPos) { - OUString aStr( it.maPos.Format( ScRefFlags::VALID | ScRefFlags::TAB_3D, it.mpDoc) + + OUString aStr( it.maPos.Format( ScRefFlags::VALID | ScRefFlags::TAB_3D, &it.mrDoc) + " [" + OUString::number( it.mnRecursion) + "," + OUString::number( it.mnGroup) + "]"); fprintf( stderr, "%s -> ", aStr.toUtf8().getStr()); } @@ -137,7 +137,7 @@ static struct DebugCalculation { for (auto const& it : mvResults) { - OUString aStr( it.maPos.Format( ScRefFlags::VALID | ScRefFlags::TAB_3D, it.mpDoc)); + OUString aStr( it.maPos.Format( ScRefFlags::VALID | ScRefFlags::TAB_3D, &it.mrDoc)); aStr += " (" + it.maResult + ")"; fprintf( stderr, "%s, ", aStr.toUtf8().getStr()); } @@ -176,13 +176,13 @@ static struct DebugCalculation struct DebugCalculationStacker { - DebugCalculationStacker( const ScAddress& rPos, ScDocument* pDoc ) + DebugCalculationStacker( const ScAddress& rPos, ScDocument& rDoc ) { if (!aDC.mbActive && rPos == aDC.maTrigger) aDC.mbActive = aDC.mbSwitchOff = true; if (aDC.mbActive) { - aDC.mvPos.push_back( DebugCalculationEntry( rPos, pDoc, aDC.mnGroup)); + aDC.mvPos.push_back( DebugCalculationEntry( rPos, rDoc, aDC.mnGroup)); aDC.mbPrint = true; } } @@ -1565,7 +1565,7 @@ bool ScFormulaCell::Interpret(SCROW nStartOffset, SCROW nEndOffset) aDC.mbPrintResults = true; bDebugCalculationInit = false; } - DebugCalculationStacker aDebugEntry( aPos, &rDocument); + DebugCalculationStacker aDebugEntry(aPos, rDocument); #endif if (!IsDirtyOrInTableOpDirty() || rRecursionHelper.IsInReturn()) @@ -2833,7 +2833,7 @@ const ScMatrix* ScFormulaCell::GetMatrix() return aResult.GetMatrix().get(); } -bool ScFormulaCell::GetMatrixOrigin( const ScDocument* pDoc, ScAddress& rPos ) const +bool ScFormulaCell::GetMatrixOrigin( const ScDocument& rDoc, ScAddress& rPos ) const { switch ( cMatrixFlag ) { @@ -2847,8 +2847,8 @@ bool ScFormulaCell::GetMatrixOrigin( const ScDocument* pDoc, ScAddress& rPos ) c if( t ) { ScSingleRefData& rRef = *t->GetSingleRef(); - ScAddress aAbs = rRef.toAbs(*pDoc, aPos); - if (pDoc->ValidAddress(aAbs)) + ScAddress aAbs = rRef.toAbs(rDoc, aPos); + if (rDoc.ValidAddress(aAbs)) { rPos = aAbs; return true; @@ -2861,7 +2861,7 @@ bool ScFormulaCell::GetMatrixOrigin( const ScDocument* pDoc, ScAddress& rPos ) c return false; } -sc::MatrixEdge ScFormulaCell::GetMatrixEdge( const ScDocument* pDoc, ScAddress& rOrgPos ) const +sc::MatrixEdge ScFormulaCell::GetMatrixEdge( const ScDocument& rDoc, ScAddress& rOrgPos ) const { switch ( cMatrixFlag ) { @@ -2871,7 +2871,7 @@ sc::MatrixEdge ScFormulaCell::GetMatrixEdge( const ScDocument* pDoc, ScAddress& static thread_local SCCOL nC; static thread_local SCROW nR; ScAddress aOrg; - if ( !GetMatrixOrigin( pDoc, aOrg ) ) + if ( !GetMatrixOrigin( rDoc, aOrg ) ) return sc::MatrixEdge::Nothing; if ( aOrg != rOrgPos ) { // First time or a different matrix than last time. @@ -2899,7 +2899,7 @@ sc::MatrixEdge ScFormulaCell::GetMatrixEdge( const ScDocument* pDoc, ScAddress& { pCell = rDocument.GetFormulaCell(aAdr); if (pCell && pCell->cMatrixFlag == ScMatrixMode::Reference && - pCell->GetMatrixOrigin(&rDocument, aTmpOrg) && aTmpOrg == aOrg) + pCell->GetMatrixOrigin(rDocument, aTmpOrg) && aTmpOrg == aOrg) { nC++; aAdr.IncCol(); @@ -2914,7 +2914,7 @@ sc::MatrixEdge ScFormulaCell::GetMatrixEdge( const ScDocument* pDoc, ScAddress& { pCell = rDocument.GetFormulaCell(aAdr); if (pCell && pCell->cMatrixFlag == ScMatrixMode::Reference && - pCell->GetMatrixOrigin(&rDocument, aTmpOrg) && aTmpOrg == aOrg) + pCell->GetMatrixOrigin(rDocument, aTmpOrg) && aTmpOrg == aOrg) { nR++; aAdr.IncRow(); diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index bbb8471a8551..9ba0d854a4ca 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -1194,18 +1194,18 @@ void ScPatternAttr::SetStyleSheet( ScStyleSheet* pNewStyle, bool bClearDirectFor } } -void ScPatternAttr::UpdateStyleSheet(const ScDocument* pDoc) +void ScPatternAttr::UpdateStyleSheet(const ScDocument& rDoc) { if (pName) { - pStyle = static_cast<ScStyleSheet*>(pDoc->GetStyleSheetPool()->Find(*pName, SfxStyleFamily::Para)); + pStyle = static_cast<ScStyleSheet*>(rDoc.GetStyleSheetPool()->Find(*pName, SfxStyleFamily::Para)); // use Standard if Style is not found, // to avoid empty display in Toolbox-Controller // Assumes that "Standard" is always the 1st entry! if (!pStyle) { - std::unique_ptr<SfxStyleSheetIterator> pIter = pDoc->GetStyleSheetPool()->CreateIterator(SfxStyleFamily::Para); + std::unique_ptr<SfxStyleSheetIterator> pIter = rDoc.GetStyleSheetPool()->CreateIterator(SfxStyleFamily::Para); pStyle = dynamic_cast< ScStyleSheet* >(pIter->First()); } diff --git a/sc/source/core/data/poolhelp.cxx b/sc/source/core/data/poolhelp.cxx index f29268d7bc72..dc7e5e6a7cbf 100644 --- a/sc/source/core/data/poolhelp.cxx +++ b/sc/source/core/data/poolhelp.cxx @@ -27,16 +27,15 @@ #include <docpool.hxx> #include <stlpool.hxx> -ScPoolHelper::ScPoolHelper( ScDocument* pSourceDoc ) -:pEditPool(nullptr) -,pEnginePool(nullptr) -,m_pSourceDoc(pSourceDoc) +ScPoolHelper::ScPoolHelper( ScDocument& rSourceDoc ) + : pEditPool(nullptr) + , pEnginePool(nullptr) + , m_rSourceDoc(rSourceDoc) { - OSL_ENSURE( pSourceDoc, "ScPoolHelper: no document" ); pDocPool = new ScDocumentPool; pDocPool->FreezeIdRanges(); - mxStylePool = new ScStyleSheetPool( *pDocPool, pSourceDoc ); + mxStylePool = new ScStyleSheetPool( *pDocPool, &rSourceDoc ); } ScPoolHelper::~ScPoolHelper() @@ -96,7 +95,7 @@ std::unique_ptr<SvNumberFormatter> ScPoolHelper::CreateNumberFormatter() const osl::MutexGuard aGuard(&maMtxCreateNumFormatter); p.reset(new SvNumberFormatter(comphelper::getProcessComponentContext(), LANGUAGE_SYSTEM)); } - p->SetColorLink( LINK(m_pSourceDoc, ScDocument, GetUserDefinedColor) ); + p->SetColorLink( LINK(&m_rSourceDoc, ScDocument, GetUserDefinedColor) ); p->SetEvalDateFormat(NF_EVALDATEFORMAT_INTL_FORMAT); sal_uInt16 d,m; diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index c64dbf9b0d72..f20dc524c487 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -596,7 +596,7 @@ void ScTable::CopyCellToDocument(SCCOL nSrcCol, SCROW nSrcRow, SCCOL nDestCol, S namespace { -bool CheckAndDeduplicateCondFormat(ScDocument* pDocument, ScConditionalFormat* pOldFormat, const ScConditionalFormat* pNewFormat, SCTAB nTab) +bool CheckAndDeduplicateCondFormat(ScDocument& rDocument, ScConditionalFormat* pOldFormat, const ScConditionalFormat* pNewFormat, SCTAB nTab) { if (!pOldFormat) return false; @@ -609,7 +609,7 @@ bool CheckAndDeduplicateCondFormat(ScDocument* pDocument, ScConditionalFormat* p { rDstRangeList.Join(rNewRangeList[i]); } - pDocument->AddCondFormatData(rNewRangeList, nTab, pOldFormat->GetKey()); + rDocument.AddCondFormatData(rNewRangeList, nTab, pOldFormat->GetKey()); return true; } @@ -643,7 +643,7 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO aRefCxt.mnTabDelta = nTab - pTable->nTab; pNewFormat->UpdateReference(aRefCxt, true); - if (bSameDoc && pTable->nTab == nTab && CheckAndDeduplicateCondFormat(&rDocument, mpCondFormatList->GetFormat(rxCondFormat->GetKey()), pNewFormat.get(), nTab)) + if (bSameDoc && pTable->nTab == nTab && CheckAndDeduplicateCondFormat(rDocument, mpCondFormatList->GetFormat(rxCondFormat->GetKey()), pNewFormat.get(), nTab)) { continue; } @@ -653,7 +653,7 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO { // Check if there is the same format in the destination // If there is, then simply expand its range - if (CheckAndDeduplicateCondFormat(&rDocument, rxCond.get(), pNewFormat.get(), nTab)) + if (CheckAndDeduplicateCondFormat(rDocument, rxCond.get(), pNewFormat.get(), nTab)) { bDuplicate = true; break; diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 09a17546c002..2bd2076689b0 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -482,7 +482,7 @@ void ScTable::FillFormula( if ( bLast && pDestCell->GetMatrixFlag() != ScMatrixMode::NONE ) { ScAddress aOrg; - if ( pDestCell->GetMatrixOrigin( &GetDoc(), aOrg ) ) + if ( pDestCell->GetMatrixOrigin( GetDoc(), aOrg ) ) { if ( nDestCol >= aOrg.Col() && nDestRow >= aOrg.Row() ) { diff --git a/sc/source/core/inc/poolhelp.hxx b/sc/source/core/inc/poolhelp.hxx index c7cf0639fba5..23fa529f7088 100644 --- a/sc/source/core/inc/poolhelp.hxx +++ b/sc/source/core/inc/poolhelp.hxx @@ -41,10 +41,10 @@ private: mutable std::unique_ptr<SvNumberFormatter> pFormTable; mutable SfxItemPool* pEditPool; // EditTextObjectPool mutable SfxItemPool* pEnginePool; // EditEnginePool - ScDocument* m_pSourceDoc; + ScDocument& m_rSourceDoc; public: - ScPoolHelper( ScDocument* pSourceDoc ); + ScPoolHelper( ScDocument& rSourceDoc ); virtual ~ScPoolHelper() override; // called in dtor of main document diff --git a/sc/source/core/tool/chartarr.cxx b/sc/source/core/tool/chartarr.cxx index 5a3d21c69c33..7b4637bc5b6e 100644 --- a/sc/source/core/tool/chartarr.cxx +++ b/sc/source/core/tool/chartarr.cxx @@ -55,9 +55,9 @@ ScMemChart::~ScMemChart() } ScChartArray::ScChartArray( - ScDocument* pDoc, const ScRangeListRef& rRangeList ) : - pDocument( pDoc ), - aPositioner(pDoc, rRangeList) {} + ScDocument& rDoc, const ScRangeListRef& rRangeList ) : + rDocument( rDoc ), + aPositioner(rDoc, rRangeList) {} std::unique_ptr<ScMemChart> ScChartArray::CreateMemChart() { @@ -135,12 +135,12 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartSingle() // Skip hidden columns. // TODO: make use of last column value once implemented. SCCOL nLastCol = -1; - while (pDocument->ColHidden(nCol1, nTab1, nullptr, &nLastCol)) + while (rDocument.ColHidden(nCol1, nTab1, nullptr, &nLastCol)) ++nCol1; // Skip hidden rows. SCROW nLastRow = -1; - if (pDocument->RowHidden(nRow1, nTab1, nullptr, &nLastRow)) + if (rDocument.RowHidden(nRow1, nTab1, nullptr, &nLastRow)) nRow1 = nLastRow + 1; // if everything is hidden then the label remains at the beginning @@ -161,7 +161,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartSingle() for (SCSIZE i=0; i<nTotalCols; i++) { SCCOL nThisCol = sal::static_int_cast<SCCOL>(nCol1+i); - if (!pDocument->ColHidden(nThisCol, nTab1, nullptr, &nLastCol)) + if (!rDocument.ColHidden(nThisCol, nTab1, nullptr, &nLastCol)) aCols.push_back(nThisCol); } SCSIZE nColCount = aCols.size(); @@ -175,7 +175,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartSingle() SCROW nThisRow = nRow1; while (nThisRow <= nRow2) { - if (pDocument->RowHidden(nThisRow, nTab1, nullptr, &nLastRow)) + if (rDocument.RowHidden(nThisRow, nTab1, nullptr, &nLastRow)) nThisRow = nLastRow; else aRows.push_back(nThisRow); @@ -210,14 +210,14 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartSingle() if ( bValidData ) { - bool bCalcAsShown = pDocument->GetDocOptions().IsCalcAsShown(); + bool bCalcAsShown = rDocument.GetDocOptions().IsCalcAsShown(); for (nCol=0; nCol<nColCount; nCol++) { for (nRow=0; nRow<nRowCount; nRow++) { // DBL_MIN is a Hack for Chart to recognize empty cells. ScAddress aPos(aCols[nCol], aRows[nRow], nTab1); - double nVal = getCellValue(*pDocument, aPos, DBL_MIN, bCalcAsShown); + double nVal = getCellValue(rDocument, aPos, DBL_MIN, bCalcAsShown); pMemChart->SetData(nCol, nRow, nVal); } } @@ -236,7 +236,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartSingle() { OUString aString; if (HasColHeaders()) - aString = pDocument->GetString(aCols[nCol], nStrRow, nTab1); + aString = rDocument.GetString(aCols[nCol], nStrRow, nTab1); if (aString.isEmpty()) { OUStringBuffer aBuf; @@ -258,7 +258,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartSingle() OUString aString; if (HasRowHeaders()) { - aString = pDocument->GetString(nStrCol, aRows[nRow], nTab1); + aString = rDocument.GetString(nStrCol, aRows[nRow], nTab1); } if (aString.isEmpty()) { @@ -303,7 +303,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartMulti() SCSIZE nCol = 0; SCSIZE nRow = 0; - bool bCalcAsShown = pDocument->GetDocOptions().IsCalcAsShown(); + bool bCalcAsShown = rDocument.GetDocOptions().IsCalcAsShown(); sal_uLong nIndex = 0; if (bValidData) { @@ -315,7 +315,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartMulti() const ScAddress* pPos = GetPositionMap()->GetPosition( nIndex ); if (pPos) // otherwise: Gap - nVal = getCellValue(*pDocument, *pPos, DBL_MIN, bCalcAsShown); + nVal = getCellValue(rDocument, *pPos, DBL_MIN, bCalcAsShown); pMemChart->SetData(nCol, nRow, nVal); } @@ -329,7 +329,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartMulti() const ScAddress* pPos = GetPositionMap()->GetPosition( nIndex ); if (pPos) // otherwise: Gap - nVal = getCellValue(*pDocument, *pPos, DBL_MIN, bCalcAsShown); + nVal = getCellValue(rDocument, *pPos, DBL_MIN, bCalcAsShown); pMemChart->SetData(nCol, nRow, nVal); } @@ -345,7 +345,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartMulti() OUString aString; const ScAddress* pPos = GetPositionMap()->GetColHeaderPosition( static_cast<SCCOL>(nCol) ); if ( HasColHeaders() && pPos ) - aString = pDocument->GetString(pPos->Col(), pPos->Row(), pPos->Tab()); + aString = rDocument.GetString(pPos->Col(), pPos->Row(), pPos->Tab()); if (aString.isEmpty()) { @@ -370,7 +370,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartMulti() OUString aString; const ScAddress* pPos = GetPositionMap()->GetRowHeaderPosition( nRow ); if ( HasRowHeaders() && pPos ) - aString = pDocument->GetString(pPos->Col(), pPos->Row(), pPos->Tab()); + aString = rDocument.GetString(pPos->Col(), pPos->Row(), pPos->Tab()); if (aString.isEmpty()) { diff --git a/sc/source/core/tool/chartpos.cxx b/sc/source/core/tool/chartpos.cxx index 89326661f319..1d2cdc53f018 100644 --- a/sc/source/core/tool/chartpos.cxx +++ b/sc/source/core/tool/chartpos.cxx @@ -26,14 +26,14 @@ namespace { - bool lcl_hasValueDataButNoDates( const ScDocument* pDocument, SCCOL nCol, SCROW nRow, SCTAB nTab ) + bool lcl_hasValueDataButNoDates( const ScDocument& rDocument, SCCOL nCol, SCROW nRow, SCTAB nTab ) { bool bReturn = false; - if (pDocument->HasValueData( nCol, nRow, nTab )) + if (rDocument.HasValueData( nCol, nRow, nTab )) { //treat dates like text #i25706# - sal_uInt32 nNumberFormat = pDocument->GetNumberFormat( ScAddress( nCol, nRow, nTab ) ); - SvNumFormatType nType = pDocument->GetFormatTable()->GetType(nNumberFormat); + sal_uInt32 nNumberFormat = rDocument.GetNumberFormat( ScAddress( nCol, nRow, nTab ) ); + SvNumFormatType nType = rDocument.GetFormatTable()->GetType(nNumberFormat); bool bIsDate(nType & SvNumFormatType::DATE); bReturn = !bIsDate; } @@ -41,9 +41,9 @@ namespace } } -ScChartPositioner::ScChartPositioner( ScDocument* pDoc, SCTAB nTab, +ScChartPositioner::ScChartPositioner( ScDocument& rDoc, SCTAB nTab, SCCOL nStartColP, SCROW nStartRowP, SCCOL nEndColP, SCROW nEndRowP) : - pDocument( pDoc ), + rDocument( rDoc ), eGlue( ScChartGlue::NA ), nStartCol(0), nStartRow(0), @@ -55,9 +55,9 @@ ScChartPositioner::ScChartPositioner( ScDocument* pDoc, SCTAB nTab, CheckColRowHeaders(); } -ScChartPositioner::ScChartPositioner( ScDocument* pDoc, const ScRangeListRef& rRangeList ) : +ScChartPositioner::ScChartPositioner( ScDocument& rDoc, const ScRangeListRef& rRangeList ) : aRangeListRef( rRangeList ), - pDocument( pDoc ), + rDocument( rDoc ), eGlue( ScChartGlue::NA ), nStartCol(0), nStartRow(0), @@ -71,7 +71,7 @@ ScChartPositioner::ScChartPositioner( ScDocument* pDoc, const ScRangeListRef& rR ScChartPositioner::ScChartPositioner( const ScChartPositioner& rPositioner ) : aRangeListRef( rPositioner.aRangeListRef ), - pDocument(rPositioner.pDocument), + rDocument(rPositioner.rDocument), eGlue(rPositioner.eGlue), nStartCol(rPositioner.nStartCol), nStartRow(rPositioner.nStartRow), @@ -285,12 +285,12 @@ void ScChartPositioner::CheckColRowHeaders() { for (iCol=nCol1; iCol<=nCol2 && bColStrings; iCol++) { - if (lcl_hasValueDataButNoDates( pDocument, iCol, nRow1, nTab1 )) + if (lcl_hasValueDataButNoDates( rDocument, iCol, nRow1, nTab1 )) bColStrings = false; } for (iRow=nRow1; iRow<=nRow2 && bRowStrings; iRow++) { - if (lcl_hasValueDataButNoDates( pDocument, nCol1, iRow, nTab1 )) + if (lcl_hasValueDataButNoDates( rDocument, nCol1, iRow, nTab1 )) bRowStrings = false; } } @@ -312,7 +312,7 @@ void ScChartPositioner::CheckColRowHeaders() if ( nCol1 <= nCol2 ) for (iRow=nRow1; iRow<=nRow2 && bRowStrings; iRow++) { - if (lcl_hasValueDataButNoDates( pDocument, nCol1, iRow, nTab1 )) + if (lcl_hasValueDataButNoDates( rDocument, nCol1, iRow, nTab1 )) bRowStrings = false; } } @@ -321,7 +321,7 @@ void ScChartPositioner::CheckColRowHeaders() if ( nRow1 <= nRow2 ) for (iCol=nCol1; iCol<=nCol2 && bColStrings; iCol++) { - if (lcl_hasValueDataButNoDates( pDocument, iCol, nRow1, nTab1 )) + if (lcl_hasValueDataButNoDates( rDocument, iCol, nRow1, nTab1 )) bColStrings = false; } } diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index 06ad5357a0d9..bd40a24b3eb5 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -2917,7 +2917,7 @@ void ScChangeTrack::Dependencies( ScChangeAction* pAct ) if ( ScChangeActionContent::GetContentCellType(rCell) == SC_CACCT_MATREF ) { ScAddress aOrg; - bool bOrgFound = rCell.mpFormula->GetMatrixOrigin(&rDoc, aOrg); + bool bOrgFound = rCell.mpFormula->GetMatrixOrigin(rDoc, aOrg); ScChangeActionContent* pContent = (bOrgFound ? SearchContentAt( aOrg, pAct ) : nullptr); if ( pContent && pContent->IsMatrixOrigin() ) { diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index 7393144f764c..d4c1ab66ec2e 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -1386,7 +1386,7 @@ void ScDetectiveFunc::GetAllSuccs(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW n { vector<ScTokenRef> aSrcRange; aSrcRange.push_back( - ScRefTokenHelper::createRefToken(&rDoc, ScRange(nCol1, nRow1, nTab, nCol2, nRow2, nTab))); + ScRefTokenHelper::createRefToken(rDoc, ScRange(nCol1, nRow1, nTab, nCol2, nRow2, nTab))); ScCellIterator aIter(rDoc, ScRange(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab)); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) @@ -1403,7 +1403,7 @@ void ScDetectiveFunc::GetAllSuccs(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW n if (ScRefTokenHelper::intersects(&rDoc, aSrcRange, pRef, aPos)) { // This address is absolute. - pRef = ScRefTokenHelper::createRefToken(&rDoc, aPos); + pRef = ScRefTokenHelper::createRefToken(rDoc, aPos); ScRefTokenHelper::join(&rDoc, rRefTokens, pRef, ScAddress()); } } diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx index 74319f5a77d0..58d9353222dc 100644 --- a/sc/source/core/tool/reftokenhelper.cxx +++ b/sc/source/core/tool/reftokenhelper.cxx @@ -447,19 +447,19 @@ bool ScRefTokenHelper::getDoubleRefDataFromToken(ScComplexRefData& rData, const return true; } -ScTokenRef ScRefTokenHelper::createRefToken(const ScDocument* pDoc, const ScAddress& rAddr) +ScTokenRef ScRefTokenHelper::createRefToken(const ScDocument& rDoc, const ScAddress& rAddr) { ScSingleRefData aRefData; aRefData.InitAddress(rAddr); - ScTokenRef pRef(new ScSingleRefToken(pDoc->GetSheetLimits(), aRefData)); + ScTokenRef pRef(new ScSingleRefToken(rDoc.GetSheetLimits(), aRefData)); return pRef; } -ScTokenRef ScRefTokenHelper::createRefToken(const ScDocument* pDoc, const ScRange& rRange) +ScTokenRef ScRefTokenHelper::createRefToken(const ScDocument& rDoc, const ScRange& rRange) { ScComplexRefData aRefData; aRefData.InitRange(rRange); - ScTokenRef pRef(new ScDoubleRefToken(pDoc->GetSheetLimits(), aRefData)); + ScTokenRef pRef(new ScDoubleRefToken(rDoc.GetSheetLimits(), aRefData)); return pRef; } diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx index 7dc6f3de4fe2..6e1076c34942 100644 --- a/sc/source/filter/html/htmlimp.cxx +++ b/sc/source/filter/html/htmlimp.cxx @@ -192,20 +192,18 @@ void ScHTMLImport::WriteToDocument( } } -OUString ScFormatFilterPluginImpl::GetHTMLRangeNameList( ScDocument* pDoc, const OUString& rOrigName ) +OUString ScFormatFilterPluginImpl::GetHTMLRangeNameList( ScDocument& rDoc, const OUString& rOrigName ) { - return ScHTMLImport::GetHTMLRangeNameList( pDoc, rOrigName ); + return ScHTMLImport::GetHTMLRangeNameList( rDoc, rOrigName ); } -OUString ScHTMLImport::GetHTMLRangeNameList( const ScDocument* pDoc, const OUString& rOrigName ) +OUString ScHTMLImport::GetHTMLRangeNameList( const ScDocument& rDoc, const OUString& rOrigName ) { - OSL_ENSURE( pDoc, "ScHTMLImport::GetHTMLRangeNameList - missing document" ); - if (rOrigName.isEmpty()) return OUString(); OUString aNewName; - ScRangeName* pRangeNames = pDoc->GetRangeName(); + ScRangeName* pRangeNames = rDoc.GetRangeName(); ScRangeList aRangeList; sal_Int32 nStringIx = 0; do diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx index ffd510fc025a..be871273486b 100644 --- a/sc/source/filter/inc/ftools.hxx +++ b/sc/source/filter/inc/ftools.hxx @@ -277,7 +277,7 @@ public: virtual std::unique_ptr<ScEEAbsImport> CreateRTFImport( ScDocument* pDoc, const ScRange& rRange ) override; virtual std::unique_ptr<ScEEAbsImport> CreateHTMLImport( ScDocument* pDocP, const OUString& rBaseURL, const ScRange& rRange ) override; - virtual OUString GetHTMLRangeNameList( ScDocument* pDoc, const OUString& rOrigName ) override; + virtual OUString GetHTMLRangeNameList( ScDocument& rDoc, const OUString& rOrigName ) override; // various export filters virtual ErrCode ScExportExcel5( SfxMedium&, ScDocument*, ExportFormatExcel eFormat, rtl_TextEncoding eDest ) override; diff --git a/sc/source/filter/inc/htmlimp.hxx b/sc/source/filter/inc/htmlimp.hxx index eaddd57cf16f..a6fbadb75115 100644 --- a/sc/source/filter/inc/htmlimp.hxx +++ b/sc/source/filter/inc/htmlimp.hxx @@ -33,7 +33,7 @@ public: virtual void WriteToDocument( bool bSizeColsRows = false, double nOutputFactor = 1.0, SvNumberFormatter* pFormatter = nullptr, bool bConvertDate = true ) override; - static OUString GetHTMLRangeNameList( const ScDocument* pDoc, const OUString& rOrigName ); + static OUString GetHTMLRangeNameList( const ScDocument& rDoc, const OUString& rOrigName ); }; #endif diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index a8f88c493685..ecaf9445be8c 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -1074,7 +1074,7 @@ void ScXMLTableRowCellContext::PutTextCell( const ScAddress& rCurrentPos, else { ScAddress aTopLeftMatrixCell; - if (pFCell && pFCell->GetMatrixOrigin(pDoc, aTopLeftMatrixCell)) + if (pFCell && pFCell->GetMatrixOrigin(*pDoc, aTopLeftMatrixCell)) { ScFormulaCell* pMatrixCell = pDoc->GetFormulaCell(aTopLeftMatrixCell); if (pMatrixCell) diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 23e7c0cb2af0..987c4630b1a5 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -105,9 +105,9 @@ namespace { // Collation may treat parentheses differently. const sal_Unicode cParenthesesReplacement = 0x0001; -sal_Unicode lcl_getSheetSeparator(ScDocument* pDoc) +sal_Unicode lcl_getSheetSeparator(ScDocument& rDoc) { - ScCompiler aComp(*pDoc, ScAddress(), pDoc->GetGrammar()); + ScCompiler aComp(rDoc, ScAddress(), rDoc.GetGrammar()); return aComp.GetNativeAddressSymbol(ScCompiler::Convention::SHEET_SEPARATOR); } @@ -310,7 +310,7 @@ void ScInputHandler::InitRangeFinder( const OUString& rFormula ) return; ScDocShell* pDocSh = pActiveViewSh->GetViewData().GetDocShell(); ScDocument& rDoc = pDocSh->GetDocument(); - const sal_Unicode cSheetSep = lcl_getSheetSeparator(&rDoc); + const sal_Unicode cSheetSep = lcl_getSheetSeparator(rDoc); OUString aDelimiters = ScEditUtil::ModifyDelimiters(" !~\""); // delimiters (in addition to ScEditUtil): only characters that are @@ -1063,7 +1063,7 @@ void ScInputHandler::ShowArgumentsTip( OUString& rSelText ) ScDocShell* pDocSh = pActiveViewSh->GetViewData().GetDocShell(); const sal_Unicode cSep = ScCompiler::GetNativeSymbolChar(ocSep); - const sal_Unicode cSheetSep = lcl_getSheetSeparator(&pDocSh->GetDocument()); + const sal_Unicode cSheetSep = lcl_getSheetSeparator(pDocSh->GetDocument()); FormulaHelper aHelper(ScGlobal::GetStarCalcFunctionMgr()); bool bFound = false; while( !bFound ) diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index dae7c230aade..5aedba47d2c9 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -70,7 +70,7 @@ constexpr sal_uInt32 SCTRANS_TYPE_EDIT_BIN = 3; constexpr sal_uInt32 SCTRANS_TYPE_EMBOBJ = 4; constexpr sal_uInt32 SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT = 5; -void ScTransferObj::GetAreaSize( const ScDocument* pDoc, SCTAB nTab1, SCTAB nTab2, SCROW& nRow, SCCOL& nCol ) +void ScTransferObj::GetAreaSize( const ScDocument& rDoc, SCTAB nTab1, SCTAB nTab2, SCROW& nRow, SCCOL& nCol ) { SCCOL nMaxCol = 0; SCROW nMaxRow = 0; @@ -79,7 +79,7 @@ void ScTransferObj::GetAreaSize( const ScDocument* pDoc, SCTAB nTab1, SCTAB nTab SCCOL nLastCol = 0; SCROW nLastRow = 0; // GetPrintArea instead of GetCellArea - include drawing objects - if( pDoc->GetPrintArea( nTab, nLastCol, nLastRow ) ) + if( rDoc.GetPrintArea( nTab, nLastCol, nLastRow ) ) { if( nLastCol > nMaxCol ) nMaxCol = nLastCol; @@ -158,7 +158,7 @@ ScTransferObj::ScTransferObj( ScDocumentUniquePtr pClipDoc, const TransferableOb { SCROW nMaxRow; SCCOL nMaxCol; - GetAreaSize( m_pDoc.get(), nTab1, nTab2, nMaxRow, nMaxCol ); + GetAreaSize( *m_pDoc, nTab1, nTab2, nMaxRow, nMaxCol ); if( nMaxRow < nRow2 ) nRow2 = nMaxRow; if( nMaxCol < nCol2 ) @@ -733,7 +733,7 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize) rDestDoc.CopyFromClip( aDestRange, aDestMark, InsertDeleteFlags::ALL, nullptr, m_pDoc.get(), false ); m_pDoc->SetClipArea( aDestRange, bWasCut ); - StripRefs( m_pDoc.get(), nStartX,nStartY, nEndX,nEndY, &rDestDoc ); + StripRefs(*m_pDoc, nStartX,nStartY, nEndX,nEndY, rDestDoc); ScRange aMergeRange = aDestRange; rDestDoc.ExtendMerge( aMergeRange, true ); @@ -829,25 +829,20 @@ SfxObjectShell* ScTransferObj::SetDrawClipDoc( bool bAnyOle ) } } -void ScTransferObj::StripRefs( ScDocument* pDoc, +void ScTransferObj::StripRefs( ScDocument& rDoc, SCCOL nStartX, SCROW nStartY, SCCOL nEndX, SCROW nEndY, - ScDocument* pDestDoc ) + ScDocument& rDestDoc ) { - if (!pDestDoc) - { - pDestDoc = pDoc; - } - // In a clipboard doc the data don't have to be on the first sheet SCTAB nSrcTab = 0; - while (nSrcTab<pDoc->GetTableCount() && !pDoc->HasTable(nSrcTab)) + while (nSrcTab < rDoc.GetTableCount() && !rDoc.HasTable(nSrcTab)) ++nSrcTab; SCTAB nDestTab = 0; - while (nDestTab<pDestDoc->GetTableCount() && !pDestDoc->HasTable(nDestTab)) + while (nDestTab < rDestDoc.GetTableCount() && !rDestDoc.HasTable(nDestTab)) ++nDestTab; - if (!pDoc->HasTable(nSrcTab) || !pDestDoc->HasTable(nDestTab)) + if (!rDoc.HasTable(nSrcTab) || !rDestDoc.HasTable(nDestTab)) { OSL_FAIL("Sheet not found in ScTransferObj::StripRefs"); return; @@ -855,7 +850,7 @@ void ScTransferObj::StripRefs( ScDocument* pDoc, ScRange aRef; - ScCellIterator aIter( *pDoc, ScRange(nStartX, nStartY, nSrcTab, nEndX, nEndY, nSrcTab) ); + ScCellIterator aIter( rDoc, ScRange(nStartX, nStartY, nSrcTab, nEndX, nEndY, nSrcTab) ); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { if (aIter.getType() != CELLTYPE_FORMULA) @@ -863,7 +858,7 @@ void ScTransferObj::StripRefs( ScDocument* pDoc, ScFormulaCell* pFCell = aIter.getFormulaCell(); bool bOut = false; - ScDetectiveRefIter aRefIter( *pDoc, pFCell ); + ScDetectiveRefIter aRefIter( rDoc, pFCell ); while ( !bOut && aRefIter.GetNextRef( aRef ) ) { if ( aRef.aStart.Tab() != nSrcTab || aRef.aEnd.Tab() != nSrcTab || @@ -880,33 +875,33 @@ void ScTransferObj::StripRefs( ScDocument* pDoc, ScAddress aPos(nCol, nRow, nDestTab); if (nErrCode != FormulaError::NONE) { - if ( pDestDoc->GetAttr( nCol,nRow,nDestTab, ATTR_HOR_JUSTIFY)->GetValue() == + if ( rDestDoc.GetAttr( nCol,nRow,nDestTab, ATTR_HOR_JUSTIFY)->GetValue() == SvxCellHorJustify::Standard ) - pDestDoc->ApplyAttr( nCol,nRow,nDestTab, + rDestDoc.ApplyAttr( nCol,nRow,nDestTab, SvxHorJustifyItem(SvxCellHorJustify::Right, ATTR_HOR_JUSTIFY) ); ScSetStringParam aParam; aParam.setTextInput(); - pDestDoc->SetString(aPos, ScGlobal::GetErrorString(nErrCode), &aParam); + rDestDoc.SetString(aPos, ScGlobal::GetErrorString(nErrCode), &aParam); } else if (pFCell->IsValue()) { - pDestDoc->SetValue(aPos, pFCell->GetValue()); + rDestDoc.SetValue(aPos, pFCell->GetValue()); } else { OUString aStr = pFCell->GetString().getString(); if ( pFCell->IsMultilineResult() ) { - ScFieldEditEngine& rEngine = pDestDoc->GetEditEngine(); + ScFieldEditEngine& rEngine = rDestDoc.GetEditEngine(); rEngine.SetTextCurrentDefaults(aStr); - pDestDoc->SetEditText(ScAddress(nCol,nRow,nDestTab), rEngine.CreateTextObject()); + rDestDoc.SetEditText(ScAddress(nCol,nRow,nDestTab), rEngine.CreateTextObject()); } else { ScSetStringParam aParam; aParam.setTextInput(); - pDestDoc->SetString(aPos, aStr, &aParam); + rDestDoc.SetString(aPos, aStr, &aParam); } } } diff --git a/sc/source/ui/dataprovider/sqldataprovider.cxx b/sc/source/ui/dataprovider/sqldataprovider.cxx index 4e2ee80bea5b..3267822b0b93 100644 --- a/sc/source/ui/dataprovider/sqldataprovider.cxx +++ b/sc/source/ui/dataprovider/sqldataprovider.cxx @@ -102,7 +102,7 @@ void SQLFetchThread::execute() for (SCCOL nCol = 0; nCol < nColCount; nCol++) { - ScDatabaseDocUtil::PutData(&mrDocument, nCol, nRow - 1, 0, xRow, nCol + 1, + ScDatabaseDocUtil::PutData(mrDocument, nCol, nRow - 1, 0, xRow, nCol + 1, xMetaData->getColumnType(nCol + 1), false); } } diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx index a813a427f93e..8c92e8378172 100644 --- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx +++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx @@ -47,10 +47,10 @@ ScItemValue::~ScItemValue() namespace { -ScRange lclGetRangeForNamedRange(OUString const & aName, const ScDocument* pDocument) +ScRange lclGetRangeForNamedRange(OUString const & aName, const ScDocument& rDocument) { ScRange aInvalidRange(ScAddress::INITIALIZE_INVALID); - ScRangeName* pRangeName = pDocument->GetRangeName(); + ScRangeName* pRangeName = rDocument.GetRangeName(); if (pRangeName == nullptr) return aInvalidRange; @@ -398,7 +398,7 @@ void ScPivotLayoutDialog::UpdateSourceRange() if (mxSourceRadioNamedRange->get_active()) { OUString aEntryString = mxSourceListBox->get_active_text(); - ScRange aSourceRange = lclGetRangeForNamedRange(aEntryString, &mrDocument); + ScRange aSourceRange = lclGetRangeForNamedRange(aEntryString, mrDocument); if (!aSourceRange.IsValid() || aSourceSheet.GetSourceRange() == aSourceRange) return; aSourceSheet.SetRangeName(aEntryString); @@ -424,7 +424,7 @@ void ScPivotLayoutDialog::UpdateSourceRange() } else { - aSourceRange = lclGetRangeForNamedRange(aSourceString, &mrDocument); + aSourceRange = lclGetRangeForNamedRange(aSourceString, mrDocument); } if (!aSourceRange.IsValid()) @@ -583,7 +583,7 @@ bool ScPivotLayoutDialog::GetDestination(ScRange& aDestinationRange, bool& bToNe if (mxDestinationRadioNamedRange->get_active()) { OUString aName = mxDestinationListBox->get_active_text(); - aDestinationRange = lclGetRangeForNamedRange(aName, &mrDocument); + aDestinationRange = lclGetRangeForNamedRange(aName, mrDocument); if (!aDestinationRange.IsValid()) return false; } diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index ab8a3585e4d6..2920ca6ad08d 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -261,7 +261,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter, OUString aTempArea; if( rNewFilter == ScDocShell::GetWebQueryFilterName() ) - aTempArea = ScFormatFilter::Get().GetHTMLRangeNameList( &rSrcDoc, rNewArea ); + aTempArea = ScFormatFilter::Get().GetHTMLRangeNameList( rSrcDoc, rNewArea ); else aTempArea = rNewArea; diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index 8a19581362aa..a49b9257f4f4 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -330,7 +330,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, nCol = rParam.nCol1; for (long i=0; i<nColCount; i++) { - ScDatabaseDocUtil::PutData( pImportDoc.get(), nCol, nRow, nTab, + ScDatabaseDocUtil::PutData( *pImportDoc, nCol, nRow, nTab, xRow, i+1, pTypeArr[i], pCurrArr[i] ); ++nCol; } diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 826755bb9fa5..e05daaa02f65 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -1551,13 +1551,13 @@ namespace { * @return true if this insertion can be done safely without shearing any * existing pivot tables, false otherwise. */ -bool canInsertCellsByPivot(const ScRange& rRange, const ScMarkData& rMarkData, InsCellCmd eCmd, const ScDocument* pDoc) +bool canInsertCellsByPivot(const ScRange& rRange, const ScMarkData& rMarkData, InsCellCmd eCmd, const ScDocument& rDoc) { - if (!pDoc->HasPivotTable()) + if (!rDoc.HasPivotTable()) // This document has no pivot tables. return true; - const ScDPCollection* pDPs = pDoc->GetDPCollection(); + const ScDPCollection* pDPs = rDoc.GetDPCollection(); ScRange aRange(rRange); // local copy switch (eCmd) @@ -1565,7 +1565,7 @@ bool canInsertCellsByPivot(const ScRange& rRange, const ScMarkData& rMarkData, I case INS_INSROWS_BEFORE: { aRange.aStart.SetCol(0); - aRange.aEnd.SetCol(pDoc->MaxCol()); + aRange.aEnd.SetCol(rDoc.MaxCol()); [[fallthrough]]; } case INS_CELLSDOWN: @@ -1600,7 +1600,7 @@ bool canInsertCellsByPivot(const ScRange& rRange, const ScMarkData& rMarkData, I case INS_INSCOLS_BEFORE: { aRange.aStart.SetRow(0); - aRange.aEnd.SetRow(pDoc->MaxRow()); + aRange.aEnd.SetRow(rDoc.MaxRow()); [[fallthrough]]; } case INS_CELLSRIGHT: @@ -1645,13 +1645,13 @@ bool canInsertCellsByPivot(const ScRange& rRange, const ScMarkData& rMarkData, I * @return true if this deletion can be done safely without shearing any * existing pivot tables, false otherwise. */ -bool canDeleteCellsByPivot(const ScRange& rRange, const ScMarkData& rMarkData, DelCellCmd eCmd, const ScDocument* pDoc) +bool canDeleteCellsByPivot(const ScRange& rRange, const ScMarkData& rMarkData, DelCellCmd eCmd, const ScDocument& rDoc) { - if (!pDoc->HasPivotTable()) + if (!rDoc.HasPivotTable()) // This document has no pivot tables. return true; - const ScDPCollection* pDPs = pDoc->GetDPCollection(); + const ScDPCollection* pDPs = rDoc.GetDPCollection(); ScRange aRange(rRange); // local copy @@ -1660,7 +1660,7 @@ bool canDeleteCellsByPivot(const ScRange& rRange, const ScMarkData& rMarkData, D case DelCellCmd::Rows: { aRange.aStart.SetCol(0); - aRange.aEnd.SetCol(pDoc->MaxCol()); + aRange.aEnd.SetCol(rDoc.MaxCol()); [[fallthrough]]; } case DelCellCmd::CellsUp: @@ -1684,7 +1684,7 @@ bool canDeleteCellsByPivot(const ScRange& rRange, const ScMarkData& rMarkData, D case DelCellCmd::Cols: { aRange.aStart.SetRow(0); - aRange.aEnd.SetRow(pDoc->MaxRow()); + aRange.aEnd.SetRow(rDoc.MaxRow()); [[fallthrough]]; } case DelCellCmd::CellsLeft: @@ -1887,7 +1887,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, } // Check if this insertion is allowed with respect to pivot table. - if (!canInsertCellsByPivot(aTargetRange, aMark, eCmd, &rDoc)) + if (!canInsertCellsByPivot(aTargetRange, aMark, eCmd, rDoc)) { if (!bApi) rDocShell.ErrorMessage(STR_NO_INSERT_DELETE_OVER_PIVOT_TABLE); @@ -2380,7 +2380,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, return false; } - if (!canDeleteCellsByPivot(rRange, aMark, eCmd, &rDoc)) + if (!canDeleteCellsByPivot(rRange, aMark, eCmd, rDoc)) { if (!bApi) rDocShell.ErrorMessage(STR_NO_INSERT_DELETE_OVER_PIVOT_TABLE); @@ -5691,10 +5691,10 @@ void ScDocFunc::SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB // first remove all old entries ScConditionalFormatList* pOldList = rDoc.GetCondFormList(nTab); - pOldList->RemoveFromDocument(&rDoc); + pOldList->RemoveFromDocument(rDoc); // then set new entries - pList->AddToDocument(&rDoc); + pList->AddToDocument(rDoc); rDoc.SetCondFormList(pList, nTab); rDocShell.PostPaintGridAll(); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index a63a8b49619b..df7022239633 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -390,7 +390,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) bool bOk = true; if ( !bAddRange && ( !bColInit || !bRowInit ) ) { - ScChartPositioner aChartPositioner( &m_aDocument, nTab, nCol1,nRow1, nCol2,nRow2 ); + ScChartPositioner aChartPositioner( m_aDocument, nTab, nCol1,nRow1, nCol2,nRow2 ); if (!bColInit) bColHeaders = aChartPositioner.HasColHeaders(); if (!bRowInit) diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index d6ddd20047e2..902a1852f9eb 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -393,7 +393,7 @@ ErrCode ScDocShell::DBaseImport( const OUString& rFullFileName, rtl_TextEncoding for (i=0; i<nColCount; i++) { ScDatabaseDocUtil::StrData aStrData; - ScDatabaseDocUtil::PutData( &m_aDocument, nCol, nRow, 0, + ScDatabaseDocUtil::PutData( m_aDocument, nCol, nRow, 0, xRow, i+1, pTypeArr[i], false, &aStrData ); diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index ca14676c6ed4..e13fdb78e459 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -2205,7 +2205,7 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm ) case ScMatrixMode::Reference : { // diff expression with 'I' M$-extension ScAddress aPos; - (void)pFCell->GetMatrixOrigin( &rDoc, aPos ); + (void)pFCell->GetMatrixOrigin( rDoc, aPos ); aPrefix = ";I;R" + OUString::number( aPos.Row() - nStartRow + 1 ) + ";C" diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index 11217f783bde..4188e78f1fe0 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -162,7 +162,7 @@ void lcl_ChartInit(const uno::Reference <embed::XEmbeddedObject>& xObj, ScViewDa aRangeListRef->Format( aTmpStr, ScRefFlags::RANGE_ABS_3D, rScDoc, rScDoc.GetAddressConvention() ); aRangeString = aTmpStr; - ScChartPositioner aChartPositioner( &rScDoc, aRangeListRef ); + ScChartPositioner aChartPositioner( rScDoc, aRangeListRef ); const ScChartPositionMap* pPositionMap( aChartPositioner.GetPositionMap() ); if( pPositionMap ) { diff --git a/sc/source/ui/inc/cliputil.hxx b/sc/source/ui/inc/cliputil.hxx index b938dfe444ff..241cd00e49b0 100644 --- a/sc/source/ui/inc/cliputil.hxx +++ b/sc/source/ui/inc/cliputil.hxx @@ -23,7 +23,7 @@ namespace ScClipUtil void PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTabViewShell, bool bShowDialog ); bool CheckDestRanges( - const ScDocument* pDoc, SCCOL nSrcCols, SCROW nSrcRows, const ScMarkData& rMark, + const ScDocument& rDoc, SCCOL nSrcCols, SCROW nSrcRows, const ScMarkData& rMark, const ScRangeList& rDest); } diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 7a9b32c32729..47874cb06320 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -348,7 +348,7 @@ public: void ForceMove() { Move(); } - static std::unique_ptr<SvxNumberInfoItem> MakeNumberInfoItem( ScDocument* pDoc, const ScViewData* pViewData ); + static std::unique_ptr<SvxNumberInfoItem> MakeNumberInfoItem( ScDocument& rDoc, const ScViewData* pViewData ); static void UpdateNumberFormatter( const SvxNumberInfoItem& rInfoItem ); diff --git a/sc/source/ui/inc/transobj.hxx b/sc/source/ui/inc/transobj.hxx index dc046fdfea56..95cdf0265894 100644 --- a/sc/source/ui/inc/transobj.hxx +++ b/sc/source/ui/inc/transobj.hxx @@ -60,12 +60,12 @@ private: // #i123405# added parameter to allow size calculation without limitation // to PageSize, e.g. used for Metafile creation for clipboard. void InitDocShell(bool bLimitToPageSize); - static void StripRefs( ScDocument* pDoc, SCCOL nStartX, SCROW nStartY, + static void StripRefs( ScDocument& rDoc, SCCOL nStartX, SCROW nStartY, SCCOL nEndX, SCROW nEndY, - ScDocument* pDestDoc ); + ScDocument& rDestDoc ); static void PaintToDev( OutputDevice* pDev, ScDocument* pDoc, double nPrintFactor, const ScRange& rBlock ); - static void GetAreaSize( const ScDocument* pDoc, SCTAB nTab1, SCTAB nTab2, SCROW& nRow, SCCOL& nCol ); + static void GetAreaSize( const ScDocument& rDoc, SCTAB nTab1, SCTAB nTab2, SCROW& nRow, SCCOL& nCol ); public: ScTransferObj( ScDocumentUniquePtr pClipDoc, const TransferableObjectDescriptor& rDesc ); diff --git a/sc/source/ui/inc/viewutil.hxx b/sc/source/ui/inc/viewutil.hxx index f8dddbfbc8e1..6dd0a49a2b28 100644 --- a/sc/source/ui/inc/viewutil.hxx +++ b/sc/source/ui/inc/viewutil.hxx @@ -51,15 +51,15 @@ public: static void PutItemScript( SfxItemSet& rShellSet, const SfxItemSet& rCoreSet, sal_uInt16 nWhichId, SvtScriptType nScript ); - static LanguageType GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos ); + static LanguageType GetEffLanguage( ScDocument& rDoc, const ScAddress& rPos ); static TransliterationFlags GetTransliterationType( sal_uInt16 nSlotID ); - static bool HasFiltered( const ScRange& rRange, const ScDocument* pDoc ); + static bool HasFiltered( const ScRange& rRange, const ScDocument& rDoc ); /** Fit a range to cover nRows number of unfiltered rows. @return <TRUE/> if the resulting range covers nRows unfiltered rows. */ - static bool FitToUnfilteredRows( ScRange & rRange, const ScDocument * pDoc, size_t nRows ); - static void UnmarkFiltered( ScMarkData& rMark, const ScDocument* pDoc ); + static bool FitToUnfilteredRows( ScRange & rRange, const ScDocument& rDoc, size_t nRows ); + static void UnmarkFiltered( ScMarkData& rMark, const ScDocument& rDoc ); static void HideDisabledSlot( SfxItemSet& rSet, SfxBindings& rBindings, sal_uInt16 nSlotId ); diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index 8b7d7d7d442b..3c4b952e81c9 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -1093,13 +1093,13 @@ bool ScContentTree::DrawNamesChanged( ScContentId nType ) return !bEqual; } -static bool lcl_GetRange( const ScDocument* pDoc, ScContentId nType, const OUString& rName, ScRange& rRange ) +static bool lcl_GetRange( const ScDocument& rDoc, ScContentId nType, const OUString& rName, ScRange& rRange ) { bool bFound = false; if ( nType == ScContentId::RANGENAME ) { - ScRangeName* pList = pDoc->GetRangeName(); + ScRangeName* pList = rDoc.GetRangeName(); if (pList) { const ScRangeData* p = pList->findByUpperName(ScGlobal::getCharClassPtr()->uppercase(rName)); @@ -1109,7 +1109,7 @@ static bool lcl_GetRange( const ScDocument* pDoc, ScContentId nType, const OUStr } else if ( nType == ScContentId::DBAREA ) { - ScDBCollection* pList = pDoc->GetDBCollection(); + ScDBCollection* pList = rDoc.GetDBCollection(); if (pList) { const ScDBData* p = pList->getNamedDBs().findByUpperName(ScGlobal::getCharClassPtr()->uppercase(rName)); @@ -1338,7 +1338,7 @@ IMPL_LINK(ScContentTree, DragBeginHdl, bool&, rUnsetDragIcon, bool) if ( nType == ScContentId::RANGENAME || nType == ScContentId::DBAREA ) { ScRange aRange; - if ( lcl_GetRange( &rSrcDoc, nType, aText, aRange ) ) + if ( lcl_GetRange( rSrcDoc, nType, aText, aRange ) ) { bDisallow = lcl_DoDragCells( pSrcShell, aRange, ScDragSrc::Navigator, *m_xTreeView ); } diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index 5a2be9602c8b..e7fccbedded5 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -1630,13 +1630,13 @@ void ScUndoConditionalFormatList::DoChange(const ScDocument* pSrcDoc) if (pSrcDoc == mpUndoDoc.get()) { - mpRedoDoc->GetCondFormList(mnTab)->RemoveFromDocument(&rDoc); - mpUndoDoc->GetCondFormList(mnTab)->AddToDocument(&rDoc); + mpRedoDoc->GetCondFormList(mnTab)->RemoveFromDocument(rDoc); + mpUndoDoc->GetCondFormList(mnTab)->AddToDocument(rDoc); } else { - mpUndoDoc->GetCondFormList(mnTab)->RemoveFromDocument(&rDoc); - mpRedoDoc->GetCondFormList(mnTab)->AddToDocument(&rDoc); + mpUndoDoc->GetCondFormList(mnTab)->RemoveFromDocument(rDoc); + mpRedoDoc->GetCondFormList(mnTab)->AddToDocument(rDoc); } rDoc.SetCondFormList(new ScConditionalFormatList(&rDoc, *pSrcDoc->GetCondFormList(mnTab)), mnTab); diff --git a/sc/source/ui/undo/undostyl.cxx b/sc/source/ui/undo/undostyl.cxx index 89aad6155455..9596edb07a01 100644 --- a/sc/source/ui/undo/undostyl.cxx +++ b/sc/source/ui/undo/undostyl.cxx @@ -133,7 +133,7 @@ void ScUndoModifyStyle::DoChange( ScDocShell* pDocSh, const OUString& rName, pStyle = &pStlPool->Make( aNewName, eStyleFamily, SfxStyleSearchBits::UserDefined ); if ( eStyleFamily == SfxStyleFamily::Para ) - rDoc.GetPool()->CellStyleCreated( aNewName, &rDoc ); + rDoc.GetPool()->CellStyleCreated( aNewName, rDoc ); } if ( pStyle ) diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index c9ddf00d91ff..28de74f67ccc 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -2021,7 +2021,7 @@ uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const OUString& aPropert formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML)); aAny <<= uno::Reference<beans::XPropertySet>( - new ScTableValidationObj( &rDoc, 0, eGrammar )); + new ScTableValidationObj( rDoc, 0, eGrammar )); } break; case SC_WID_UNO_NUMRULES: @@ -2507,7 +2507,7 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE sal_uLong nIndex = pPattern->GetItem(ATTR_VALIDDATA).GetValue(); rAny <<= uno::Reference<beans::XPropertySet>( - new ScTableValidationObj( &rDoc, nIndex, eGrammar )); + new ScTableValidationObj( rDoc, nIndex, eGrammar )); } } break; @@ -2952,7 +2952,7 @@ std::unique_ptr<ScMemChart> ScCellRangesBase::CreateMemChart_Impl() const } if (!xChartRanges.is()) // otherwise take Ranges directly xChartRanges = new ScRangeList(aRanges); - ScChartArray aArr( &pDocShell->GetDocument(), xChartRanges ); + ScChartArray aArr( pDocShell->GetDocument(), xChartRanges ); // RowAsHdr = ColHeaders and vice versa aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); @@ -3032,7 +3032,7 @@ void SAL_CALL ScCellRangesBase::setData( const uno::Sequence< uno::Sequence<doub if ( pDocShell && xChartRanges.is() ) { ScDocument& rDoc = pDocShell->GetDocument(); - ScChartArray aArr( &rDoc, xChartRanges ); + ScChartArray aArr( rDoc, xChartRanges ); aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders const ScChartPositionMap* pPosMap = aArr.GetPositionMap(); if (pPosMap) @@ -3103,7 +3103,7 @@ void SAL_CALL ScCellRangesBase::setRowDescriptions( if ( pDocShell && xChartRanges.is() ) { ScDocument& rDoc = pDocShell->GetDocument(); - ScChartArray aArr( &rDoc, xChartRanges ); + ScChartArray aArr( rDoc, xChartRanges ); aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders const ScChartPositionMap* pPosMap = aArr.GetPositionMap(); if (pPosMap) @@ -3172,7 +3172,7 @@ void SAL_CALL ScCellRangesBase::setColumnDescriptions( if ( pDocShell && xChartRanges.is() ) { ScDocument& rDoc = pDocShell->GetDocument(); - ScChartArray aArr( &rDoc, xChartRanges ); + ScChartArray aArr( rDoc, xChartRanges ); aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders const ScChartPositionMap* pPosMap = aArr.GetPositionMap(); if (pPosMap) @@ -4858,7 +4858,7 @@ OUString SAL_CALL ScCellRangeObj::getArrayFormula() const ScFormulaCell* pFCell2 = aCell2.mpFormula; ScAddress aStart1; ScAddress aStart2; - if (pFCell1->GetMatrixOrigin(&rDoc, aStart1) && pFCell2->GetMatrixOrigin(&rDoc, aStart2)) + if (pFCell1->GetMatrixOrigin(rDoc, aStart1) && pFCell2->GetMatrixOrigin(rDoc, aStart2)) { if (aStart1 == aStart2) // both the same matrix pFCell1->GetFormula(aFormula); // it doesn't matter from which cell @@ -4922,7 +4922,7 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellRangeObj::getArrayTokens() const ScFormulaCell* pFCell2 = aCell2.mpFormula; ScAddress aStart1; ScAddress aStart2; - if (pFCell1->GetMatrixOrigin(&rDoc, aStart1) && pFCell2->GetMatrixOrigin(&rDoc, aStart2)) + if (pFCell1->GetMatrixOrigin(rDoc, aStart1) && pFCell2->GetMatrixOrigin(rDoc, aStart2)) { if (aStart1 == aStart2) { diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx index 0a1ef95a31f7..48caa4bbacc1 100644 --- a/sc/source/ui/unoobj/fmtuno.cxx +++ b/sc/source/ui/unoobj/fmtuno.cxx @@ -544,16 +544,16 @@ void SAL_CALL ScTableConditionalEntry::setStyleName( const OUString& aStyleName aData.maStyle = ScStyleNameConversion::ProgrammaticToDisplayName( aStyleName, SfxStyleFamily::Para ); } -ScTableValidationObj::ScTableValidationObj(const ScDocument* pDoc, sal_uLong nKey, - const formula::FormulaGrammar::Grammar eGrammar) : +ScTableValidationObj::ScTableValidationObj(const ScDocument& rDoc, sal_uLong nKey, + const formula::FormulaGrammar::Grammar eGrammar) : aPropSet( lcl_GetValidatePropertyMap() ) { // read the entry from the document... bool bFound = false; - if ( pDoc && nKey ) + if (nKey) { - const ScValidationData* pData = pDoc->GetValidationEntry( nKey ); + const ScValidationData* pData = rDoc.GetValidationEntry( nKey ); if (pData) { nMode = pData->GetOperation(); @@ -573,7 +573,7 @@ ScTableValidationObj::ScTableValidationObj(const ScDocument* pDoc, sal_uLong nKe // saved, even if in the list, see // ScMyValidationsContainer::GetCondition(), so shall not mark // anything in use. - if (nValMode != SC_VALID_ANY && pDoc->IsInExternalReferenceMarking()) + if (nValMode != SC_VALID_ANY && rDoc.IsInExternalReferenceMarking()) pData->MarkUsedExternalReferences(); bFound = true; diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index 407dd7a2789a..5d5aa8b93fbf 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -696,7 +696,7 @@ void SAL_CALL ScStyleFamilyObj::insertByName( const OUString& aName, const uno:: (void)pStylePool->Make( aNameStr, eFamily, SfxStyleSearchBits::UserDefined ); if ( eFamily == SfxStyleFamily::Para && !rDoc.IsImportingXML() ) - rDoc.GetPool()->CellStyleCreated( aNameStr, &rDoc ); + rDoc.GetPool()->CellStyleCreated( aNameStr, rDoc ); pStyleObj->InitDoc( pDocShell, aNameStr ); // object can be used @@ -1102,7 +1102,7 @@ void SAL_CALL ScStyleObj::setName( const OUString& aNewName ) ScDocument& rDoc = pDocShell->GetDocument(); if ( eFamily == SfxStyleFamily::Para && !rDoc.IsImportingXML() ) - rDoc.GetPool()->CellStyleCreated( aNewName, &rDoc ); + rDoc.GetPool()->CellStyleCreated( aNewName, rDoc ); // cell styles = 2, page styles = 4 sal_uInt16 nId = ( eFamily == SfxStyleFamily::Para ) ? diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index 052618d69786..2d63065555ea 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -883,7 +883,7 @@ uno::Any SAL_CALL ScTabViewObj::getSelection() else if ( nTabs == 1 && (eMarkType == SC_MARK_SIMPLE_FILTERED) ) { ScMarkData aFilteredMark( rMark ); - ScViewUtil::UnmarkFiltered( aFilteredMark, &pDocSh->GetDocument()); + ScViewUtil::UnmarkFiltered( aFilteredMark, pDocSh->GetDocument()); ScRangeList aRangeList; aFilteredMark.FillRangeListWithMarks( &aRangeList, false); // Theoretically a selection may start and end on a filtered row. diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index 01d9feb25107..2fe440d84e12 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -349,7 +349,7 @@ void ScCellShell::GetCellState( SfxItemSet& rSet ) if (!bDisable) { // test for available languages - LanguageType nLang = ScViewUtil::GetEffLanguage( &rDoc, aCursor ); + LanguageType nLang = ScViewUtil::GetEffLanguage( rDoc, aCursor ); bDisable = !ScModule::HasThesaurusLanguage( nLang ); } } @@ -571,7 +571,7 @@ bool checkDestRanges(ScViewData& rViewData) aMark.MarkToSimple(); aMark.FillRangeListWithMarks(&aRanges, false); - return ScClipUtil::CheckDestRanges(&rDoc, nColSize, nRowSize, aMark, aRanges); + return ScClipUtil::CheckDestRanges(rDoc, nColSize, nRowSize, aMark, aRanges); } } diff --git a/sc/source/ui/view/cliputil.cxx b/sc/source/ui/view/cliputil.cxx index 595e5b2e9d7a..aa07e6d216c7 100644 --- a/sc/source/ui/view/cliputil.cxx +++ b/sc/source/ui/view/cliputil.cxx @@ -94,7 +94,7 @@ void ScClipUtil::PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTab } bool ScClipUtil::CheckDestRanges( - const ScDocument* pDoc, SCCOL nSrcCols, SCROW nSrcRows, const ScMarkData& rMark, const ScRangeList& rDest) + const ScDocument& rDoc, SCCOL nSrcCols, SCROW nSrcRows, const ScMarkData& rMark, const ScRangeList& rDest) { for (size_t i = 0, n = rDest.size(); i < n; ++i) { @@ -104,7 +104,7 @@ bool ScClipUtil::CheckDestRanges( { aTest.aStart.SetTab(rTab); aTest.aEnd.SetTab(rTab); - if (ScViewUtil::HasFiltered(aTest, pDoc)) + if (ScViewUtil::HasFiltered(aTest, rDoc)) { // I don't know how to handle pasting into filtered rows yet. return false; diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 6567f5f3ab97..7075fbd5d02a 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -284,7 +284,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) if ( eFamily == SfxStyleFamily::Para ) // CellStyles { ScMarkData aFuncMark( pViewData->GetMarkData() ); - ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc ); + ScViewUtil::UnmarkFiltered( aFuncMark, rDoc ); aFuncMark.MarkToMulti(); if ( !aFuncMark.IsMarked() && !aFuncMark.IsMultiMarked() ) @@ -609,7 +609,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) // Name to style pointer rDoc.UpdStlShtPtrsFrmNms(); else - rDoc.GetPool()->CellStyleCreated( aStyleName, &rDoc ); + rDoc.GetPool()->CellStyleCreated( aStyleName, rDoc ); // Adopt attribute and use style pStyleSheet->GetItemSet().Put( aAttrSet ); @@ -818,7 +818,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) } std::unique_ptr<SvxNumberInfoItem> pNumberInfoItem( - ScTabViewShell::MakeNumberInfoItem(&rDoc, GetViewData())); + ScTabViewShell::MakeNumberInfoItem(rDoc, GetViewData())); pDocSh->PutItem( *pNumberInfoItem ); bPage = false; @@ -886,7 +886,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) pNew->GetLanguage(), ATTR_LANGUAGE_FORMAT ) ); } - rDoc.GetPool()->CellStyleCreated( pStyleSheet->GetName(), &rDoc ); + rDoc.GetPool()->CellStyleCreated( pStyleSheet->GetName(), rDoc ); } else { @@ -1769,7 +1769,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) aSetItem.PutItemForScriptType( nScript, rFont ); ScMarkData aFuncMark( pViewData->GetMarkData() ); - ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc ); + ScViewUtil::UnmarkFiltered( aFuncMark, rDoc ); rDoc.SetPreviewFont( aSetItem.GetItemSet().Clone() ); aFuncMark.MarkToMulti(); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 4a9759f01e13..bb8cef1279f1 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -360,7 +360,7 @@ static bool lcl_IsEditableMatrix( ScDocument& rDoc, const ScRange& rRange ) ScRefCellValue aCell(rDoc, rRange.aEnd); ScAddress aPos; - return (aCell.meType == CELLTYPE_FORMULA && aCell.mpFormula->GetMatrixOrigin(&rDoc, aPos) && aPos == rRange.aStart); + return (aCell.meType == CELLTYPE_FORMULA && aCell.mpFormula->GetMatrixOrigin(rDoc, aPos) && aPos == rRange.aStart); } static void lcl_UnLockComment( ScDrawView* pView, const Point& rPos, const ScViewData* pViewData ) @@ -3584,7 +3584,7 @@ sal_Int8 ScGridWindow::AcceptPrivateDrop( const AcceptDropEvent& rEvt ) ScRange aDropRange = lcl_MakeDropRange( rThisDoc, nNewDragX, nNewDragY, nTab, aSourceRange ); if ( lcl_TestScenarioRedliningDrop( &rThisDoc, aDropRange ) || lcl_TestScenarioRedliningDrop( pSourceDoc, aSourceRange ) || - ScViewUtil::HasFiltered( aDropRange, &rThisDoc) ) + ScViewUtil::HasFiltered( aDropRange, rThisDoc) ) { if (bDragRect) { @@ -4077,7 +4077,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos } else // Don't copy or move to filtered destination. - bFiltered = ScViewUtil::HasFiltered( aDest, &rThisDoc); + bFiltered = ScViewUtil::HasFiltered(aDest, rThisDoc); } bool bDone = false; diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index 3196e2cf4820..a27339a914ef 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -506,7 +506,7 @@ void ScTabControl::DoDrag() pTransferObj->StartDrag( pWindow, DND_ACTION_COPYMOVE | DND_ACTION_LINK ); } -static sal_uInt16 lcl_DocShellNr( const ScDocument* pDoc ) +static sal_uInt16 lcl_DocShellNr( const ScDocument& rDoc ) { sal_uInt16 nShellCnt = 0; SfxObjectShell* pShell = SfxObjectShell::GetFirst(); @@ -514,7 +514,7 @@ static sal_uInt16 lcl_DocShellNr( const ScDocument* pDoc ) { if ( dynamic_cast<const ScDocShell *>(pShell) != nullptr ) { - if ( &static_cast<ScDocShell*>(pShell)->GetDocument() == pDoc ) + if ( &static_cast<ScDocShell*>(pShell)->GetDocument() == &rDoc ) return nShellCnt; ++nShellCnt; @@ -549,7 +549,7 @@ sal_Int8 ScTabControl::ExecuteDrop( const ExecuteDropEvent& rEvt ) if ( !rDoc.GetChangeTrack() && rDoc.IsDocEditable() ) { //! use table selection from the tab control where dragging was started? - pViewData->GetView()->MoveTable( lcl_DocShellNr(&rDoc), nPos, rEvt.mnAction != DND_ACTION_MOVE ); + pViewData->GetView()->MoveTable( lcl_DocShellNr(rDoc), nPos, rEvt.mnAction != DND_ACTION_MOVE ); rData.pCellTransfer->SetDragWasInternal(); // don't delete return DND_ACTION_COPY; diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx index b3101b49487e..c8e5f31a58f1 100644 --- a/sc/source/ui/view/tabvwsh5.cxx +++ b/sc/source/ui/view/tabvwsh5.cxx @@ -311,7 +311,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SfxViewShell::Notify( rBC, rHint ); } -std::unique_ptr<SvxNumberInfoItem> ScTabViewShell::MakeNumberInfoItem( ScDocument* pDoc, const ScViewData* pViewData ) +std::unique_ptr<SvxNumberInfoItem> ScTabViewShell::MakeNumberInfoItem( ScDocument& rDoc, const ScViewData* pViewData ) { // construct NumberInfo item @@ -320,7 +320,7 @@ std::unique_ptr<SvxNumberInfoItem> ScTabViewShell::MakeNumberInfoItem( ScDocumen double nCellValue = 0; OUString aCellString; - ScRefCellValue aCell(*pDoc, pViewData->GetCurPos()); + ScRefCellValue aCell(rDoc, pViewData->GetCurPos()); switch (aCell.meType) { @@ -362,13 +362,13 @@ std::unique_ptr<SvxNumberInfoItem> ScTabViewShell::MakeNumberInfoItem( ScDocumen { case SvxNumberValueType::String: return std::make_unique<SvxNumberInfoItem>( - pDoc->GetFormatTable(), + rDoc.GetFormatTable(), aCellString, SID_ATTR_NUMBERFORMAT_INFO ); case SvxNumberValueType::Number: return std::make_unique<SvxNumberInfoItem>( - pDoc->GetFormatTable(), + rDoc.GetFormatTable(), nCellValue, SID_ATTR_NUMBERFORMAT_INFO ); @@ -378,7 +378,7 @@ std::unique_ptr<SvxNumberInfoItem> ScTabViewShell::MakeNumberInfoItem( ScDocumen } return std::make_unique<SvxNumberInfoItem>( - pDoc->GetFormatTable(), static_cast<sal_uInt16>(SID_ATTR_NUMBERFORMAT_INFO)); + rDoc.GetFormatTable(), static_cast<sal_uInt16>(SID_ATTR_NUMBERFORMAT_INFO)); } void ScTabViewShell::UpdateNumberFormatter( diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 211a047c9bb1..fb8156f5e391 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -547,7 +547,7 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName pOldSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, pOldAttrs->GetNumberFormat( rDoc.GetFormatTable() ) ) ); - pNumberInfoItem = MakeNumberInfoItem(&rDoc, &GetViewData()); + pNumberInfoItem = MakeNumberInfoItem(rDoc, &GetViewData()); pOldSet->MergeRange( SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO ); pOldSet->Put(*pNumberInfoItem ); diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index d95a5cf12d9d..10aedf7eb3fc 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1131,7 +1131,7 @@ ScMarkType ScViewData::GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark ) if ( rNewMark.IsMarked() && !rNewMark.IsMultiMarked() ) { rNewMark.GetMarkArea( rRange ); - if (ScViewUtil::HasFiltered( rRange, &GetDocument())) + if (ScViewUtil::HasFiltered(rRange, GetDocument())) eMarkType = SC_MARK_SIMPLE_FILTERED; else eMarkType = SC_MARK_SIMPLE; diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 134420f5d2f6..41b1a8f8ddf9 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -3274,7 +3274,7 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine, ScDocument& rDoc = GetViewData().GetDocument(); ScMarkData aFuncMark( GetViewData().GetMarkData() ); // local copy for UnmarkFiltered - ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc ); + ScViewUtil::UnmarkFiltered( aFuncMark, rDoc ); ScDocShell* pDocSh = GetViewData().GetDocShell(); const ScPatternAttr* pSelAttrs = GetSelectionPattern(); const SfxItemSet& rSelItemSet = pSelAttrs->GetItemSet(); diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index eb88e97891e9..b80037080d63 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -997,13 +997,13 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, nEndRow = nStartRow + nDestSizeY; nEndTab = nStartTab; aMarkRange = ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab); - if (ScViewUtil::HasFiltered( aMarkRange, &rDoc)) + if (ScViewUtil::HasFiltered(aMarkRange, rDoc)) { bMarkIsFiltered = true; // Fit to clipboard's row count unfiltered rows. If there is no // fit assume that pasting is not possible. Note that nDestSizeY is // size-1 (difference). - if (!ScViewUtil::FitToUnfilteredRows( aMarkRange, &rDoc, nDestSizeY+1)) + if (!ScViewUtil::FitToUnfilteredRows(aMarkRange, rDoc, nDestSizeY+1)) bNoPaste = true; } aFilteredMark.SetMarkArea( aMarkRange); @@ -1032,7 +1032,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, ScRangeList aRangeList; if (bMarkIsFiltered) { - ScViewUtil::UnmarkFiltered( aFilteredMark, &rDoc); + ScViewUtil::UnmarkFiltered(aFilteredMark, rDoc); aFilteredMark.FillRangeListWithMarks( &aRangeList, false); nUnfilteredRows = 0; size_t ListSize = aRangeList.size(); @@ -1096,11 +1096,11 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, // introduce filtered rows where there weren't any before, so // we also need to test for that. aMarkRange = ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab); - if (bMarkIsFiltered || ScViewUtil::HasFiltered( aMarkRange, &rDoc)) + if (bMarkIsFiltered || ScViewUtil::HasFiltered(aMarkRange, rDoc)) { bMarkIsFiltered = true; // Worst case: all rows up to the end of the sheet are filtered. - if (!ScViewUtil::FitToUnfilteredRows( aMarkRange, &rDoc, nDestSizeY+1)) + if (!ScViewUtil::FitToUnfilteredRows(aMarkRange, rDoc, nDestSizeY+1)) { ErrorMessage(STR_PASTE_FULL); return false; @@ -1110,7 +1110,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, aFilteredMark.SetMarkArea( aMarkRange); if (bMarkIsFiltered) { - ScViewUtil::UnmarkFiltered( aFilteredMark, &rDoc); + ScViewUtil::UnmarkFiltered(aFilteredMark, rDoc); aFilteredMark.FillRangeListWithMarks( &aRangeList, true); } } @@ -1517,9 +1517,9 @@ bool ScViewFunc::PasteMultiRangesFromClip( // Extend the marked range to account for filtered rows in the destination // area. - if (ScViewUtil::HasFiltered(aMarkedRange, &rDoc)) + if (ScViewUtil::HasFiltered(aMarkedRange, rDoc)) { - if (!ScViewUtil::FitToUnfilteredRows(aMarkedRange, &rDoc, nRowSize)) + if (!ScViewUtil::FitToUnfilteredRows(aMarkedRange, rDoc, nRowSize)) return false; } @@ -1676,7 +1676,7 @@ bool ScViewFunc::PasteFromClipToMultiRanges( ScRangeList aRanges; aMark.MarkToSimple(); aMark.FillRangeListWithMarks(&aRanges, false); - if (!ScClipUtil::CheckDestRanges(&rDoc, nColSize, nRowSize, aMark, aRanges)) + if (!ScClipUtil::CheckDestRanges(rDoc, nColSize, nRowSize, aMark, aRanges)) { ErrorMessage(STR_MSSG_PASTEFROMCLIP_0); return false; diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index da574db27b53..272bd25fad9f 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -390,7 +390,7 @@ void ScViewFunc::DoThesaurus() if (eState == EESpellState::ErrorFound) // should happen later through Wrapper! { - LanguageType eLnge = ScViewUtil::GetEffLanguage( &rDoc, ScAddress( nCol, nRow, nTab ) ); + LanguageType eLnge = ScViewUtil::GetEffLanguage( rDoc, ScAddress( nCol, nRow, nTab ) ); OUString aErr = SvtLanguageTable::GetLanguageString(eLnge) + ScResId( STR_SPELLING_NO_LANG ); std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetViewData().GetDialogParent(), diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 874020116144..0c39728dd6d2 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1028,7 +1028,7 @@ void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem { ScDocument& rDoc = GetViewData().GetDocument(); ScMarkData aFuncMark( GetViewData().GetMarkData() ); // local copy for UnmarkFiltered - ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc ); + ScViewUtil::UnmarkFiltered( aFuncMark, rDoc ); bool bRecord = true; if (!rDoc.IsUndoEnabled()) bRecord = false; @@ -1111,7 +1111,7 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursor ScDocShell* pDocSh = rViewData.GetDocShell(); ScDocument& rDoc = pDocSh->GetDocument(); ScMarkData aFuncMark( rViewData.GetMarkData() ); // local copy for UnmarkFiltered - ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc ); + ScViewUtil::UnmarkFiltered( aFuncMark, rDoc ); bool bRecord = true; if (!rDoc.IsUndoEnabled()) @@ -1329,7 +1329,7 @@ void ScViewFunc::SetStyleSheetToMarked( const SfxStyleSheet* pStyleSheet ) ScDocShell* pDocSh = rViewData.GetDocShell(); ScDocument& rDoc = pDocSh->GetDocument(); ScMarkData aFuncMark( rViewData.GetMarkData() ); // local copy for UnmarkFiltered - ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc ); + ScViewUtil::UnmarkFiltered( aFuncMark, rDoc ); SCTAB nTabCount = rDoc.GetTableCount(); bool bRecord = true; if (!rDoc.IsUndoEnabled()) @@ -1746,7 +1746,7 @@ void ScViewFunc::DeleteMulti( bool bRows ) SCTAB nTab = GetViewData().GetTabNo(); ScDocument& rDoc = pDocSh->GetDocument(); ScMarkData aFuncMark( GetViewData().GetMarkData() ); // local copy for UnmarkFiltered - ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc ); + ScViewUtil::UnmarkFiltered( aFuncMark, rDoc ); bool bRecord = true; if (!rDoc.IsUndoEnabled()) @@ -1959,7 +1959,7 @@ void ScViewFunc::DeleteContents( InsertDeleteFlags nFlags ) ScDocument& rDoc = GetViewData().GetDocument(); ScDocShell* pDocSh = GetViewData().GetDocShell(); ScMarkData aFuncMark( GetViewData().GetMarkData() ); // local copy for UnmarkFiltered - ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc ); + ScViewUtil::UnmarkFiltered( aFuncMark, rDoc ); bool bRecord =true; if (!rDoc.IsUndoEnabled()) @@ -2828,7 +2828,7 @@ void ScViewFunc::ChangeIndent( bool bIncrement ) ScMarkData& rMark = rViewData.GetMarkData(); ScMarkData aWorkMark = rMark; - ScViewUtil::UnmarkFiltered( aWorkMark, &pDocSh->GetDocument() ); + ScViewUtil::UnmarkFiltered( aWorkMark, pDocSh->GetDocument() ); aWorkMark.MarkToMulti(); if (!aWorkMark.IsMultiMarked()) { diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx index 67b48be34a38..7d87902175b2 100644 --- a/sc/source/ui/view/viewutil.cxx +++ b/sc/source/ui/view/viewutil.cxx @@ -66,14 +66,14 @@ void ScViewUtil::PutItemScript( SfxItemSet& rShellSet, const SfxItemSet& rCoreSe rShellSet.InvalidateItem( nWhichId ); } -LanguageType ScViewUtil::GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos ) +LanguageType ScViewUtil::GetEffLanguage( ScDocument& rDoc, const ScAddress& rPos ) { // used for thesaurus - SvtScriptType nScript = pDoc->GetScriptType(rPos.Col(), rPos.Row(), rPos.Tab()); + SvtScriptType nScript = rDoc.GetScriptType(rPos.Col(), rPos.Row(), rPos.Tab()); sal_uInt16 nWhich = ( nScript == SvtScriptType::ASIAN ) ? ATTR_CJK_FONT_LANGUAGE : ( ( nScript == SvtScriptType::COMPLEX ) ? ATTR_CTL_FONT_LANGUAGE : ATTR_FONT_LANGUAGE ); - const SfxPoolItem* pItem = pDoc->GetAttr( rPos.Col(), rPos.Row(), rPos.Tab(), nWhich); + const SfxPoolItem* pItem = rDoc.GetAttr( rPos.Col(), rPos.Row(), rPos.Tab(), nWhich); const SvxLanguageItem* pLangIt = dynamic_cast<const SvxLanguageItem*>( pItem ); LanguageType eLnge; if (pLangIt) @@ -82,7 +82,7 @@ LanguageType ScViewUtil::GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos if (eLnge == LANGUAGE_DONTKNOW) //! can this happen? { LanguageType eLatin, eCjk, eCtl; - pDoc->GetLanguage( eLatin, eCjk, eCtl ); + rDoc.GetLanguage( eLatin, eCjk, eCtl ); eLnge = ( nScript == SvtScriptType::ASIAN ) ? eCjk : ( ( nScript == SvtScriptType::COMPLEX ) ? eCtl : eLatin ); } @@ -220,7 +220,7 @@ bool ScViewUtil::IsActionShown( const ScChangeAction& rAction, return true; } -void ScViewUtil::UnmarkFiltered( ScMarkData& rMark, const ScDocument* pDoc ) +void ScViewUtil::UnmarkFiltered( ScMarkData& rMark, const ScDocument& rDoc ) { rMark.MarkToMulti(); @@ -237,7 +237,7 @@ void ScViewUtil::UnmarkFiltered( ScMarkData& rMark, const ScDocument* pDoc ) for (SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow) { SCROW nLastRow = nRow; - if (pDoc->RowFiltered(nRow, nTab, nullptr, &nLastRow)) + if (rDoc.RowFiltered(nRow, nTab, nullptr, &nLastRow)) { // use nStartCol/nEndCol, so the multi mark area isn't extended to all columns // (visible in repaint for indentation) @@ -255,27 +255,27 @@ void ScViewUtil::UnmarkFiltered( ScMarkData& rMark, const ScDocument* pDoc ) rMark.MarkToSimple(); } -bool ScViewUtil::FitToUnfilteredRows( ScRange & rRange, const ScDocument * pDoc, size_t nRows ) +bool ScViewUtil::FitToUnfilteredRows( ScRange & rRange, const ScDocument& rDoc, size_t nRows ) { SCTAB nTab = rRange.aStart.Tab(); bool bOneTabOnly = (nTab == rRange.aEnd.Tab()); // Always fit the range on its first sheet. OSL_ENSURE( bOneTabOnly, "ScViewUtil::ExtendToUnfilteredRows: works only on one sheet"); SCROW nStartRow = rRange.aStart.Row(); - SCROW nLastRow = pDoc->LastNonFilteredRow(nStartRow, pDoc->MaxRow(), nTab); - if (pDoc->ValidRow(nLastRow)) + SCROW nLastRow = rDoc.LastNonFilteredRow(nStartRow, rDoc.MaxRow(), nTab); + if (rDoc.ValidRow(nLastRow)) rRange.aEnd.SetRow(nLastRow); - SCROW nCount = pDoc->CountNonFilteredRows(nStartRow, pDoc->MaxRow(), nTab); + SCROW nCount = rDoc.CountNonFilteredRows(nStartRow, rDoc.MaxRow(), nTab); return static_cast<size_t>(nCount) == nRows && bOneTabOnly; } -bool ScViewUtil::HasFiltered( const ScRange& rRange, const ScDocument* pDoc ) +bool ScViewUtil::HasFiltered( const ScRange& rRange, const ScDocument& rDoc ) { SCROW nStartRow = rRange.aStart.Row(); SCROW nEndRow = rRange.aEnd.Row(); for (SCTAB nTab=rRange.aStart.Tab(); nTab<=rRange.aEnd.Tab(); nTab++) { - if (pDoc->HasFilteredRows(nStartRow, nEndRow, nTab)) + if (rDoc.HasFilteredRows(nStartRow, nEndRow, nTab)) return true; } |