diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-09-24 09:13:16 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-09-24 16:24:51 +0200 |
commit | fe1ea3f546a539787d7f5e9c25fcf47dc0cbe2c0 (patch) | |
tree | 3b52b05a162921d0ea21b0e09e64cd82d07ec03d /sc/source/ui | |
parent | 85af9e1d7a5820b989b004594e5462093b300021 (diff) |
some places where ScDocument* is never passed a nullptr
Change-Id: Ie06fef80990b539d5b6cc87c80d9bbd3e851766c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103299
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui')
35 files changed, 133 insertions, 138 deletions
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; } |