diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-09-14 16:42:52 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-09-15 21:36:27 +0200 |
commit | bf3d1b8e8f89bfdb409c70cfea126f36474d4772 (patch) | |
tree | 9d496d04fc1bbd76c15ab215f947ac28587f0e1e /sc/source/ui/view/tabvwshc.cxx | |
parent | 957adc83e67276805c6dcd7be1ea23c142c49306 (diff) |
establish that ScViewData::GetDocument can always return ScDocument&
we can only be ctored with a ScDocShell& or ScDocument&, and ScDocShell
provides a ScDocument& from its GetDocument() so we can always have a
ScDocument& when a public ctor has completed
some null checks can then be seen to be redundant and are removed
Change-Id: Ifaf39cb06e8dbce363999c05ee0aeb3ec4f00428
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102775
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui/view/tabvwshc.cxx')
-rw-r--r-- | sc/source/ui/view/tabvwshc.cxx | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 0a1f0feb41af..b96c30d9d057 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -133,7 +133,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont if(pCW) pCW->SetHideNotDelete(true); - ScDocument* pDoc = GetViewData().GetDocument(); + ScDocument& rDoc = GetViewData().GetDocument(); switch( nSlotId ) { @@ -210,7 +210,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont if (!mbInSwitch) { std::map<OUString, ScRangeName*> aRangeMap; - pDoc->GetRangeNameMap(aRangeMap); + rDoc.GetRangeNameMap(aRangeMap); xResult = std::make_shared<ScNameDefDlg>(pB, pCW, pParent, &GetViewData(), aRangeMap, ScAddress(GetViewData().GetCurX(), GetViewData().GetCurY(), @@ -256,7 +256,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont ScAddress aCurPos( rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo()); - xResult = std::make_shared<ScSolverDlg>(pB, pCW, pParent, rViewData.GetDocument(), aCurPos); + xResult = std::make_shared<ScSolverDlg>(pB, pCW, pParent, &rViewData.GetDocument(), aCurPos); break; } case SID_OPENDLG_TABOP: @@ -266,7 +266,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont rViewData.GetCurY(), rViewData.GetTabNo()); - xResult = std::make_shared<ScTabOpDlg>(pB, pCW, pParent, rViewData.GetDocument(), aCurPos); + xResult = std::make_shared<ScTabOpDlg>(pB, pCW, pParent, &rViewData.GetDocument(), aCurPos); break; } case SID_OPENDLG_CONSOLIDATE: @@ -276,7 +276,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont SCITEM_CONSOLIDATEDATA>{} ); const ScConsolidateParam* pDlgData = - pDoc->GetConsolidateDlgData(); + rDoc.GetConsolidateDlgData(); if ( !pDlgData ) { @@ -315,7 +315,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont SCITEM_QUERYDATA>{} ); ScDBData* pDBData = GetDBData(false, SC_DB_MAKE, ScGetDBSelection::RowDown); - pDBData->ExtendDataArea(pDoc); + pDBData->ExtendDataArea(&rDoc); pDBData->GetQueryParam( aQueryParam ); ScRange aArea; @@ -340,7 +340,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont SCITEM_QUERYDATA>{} ); ScDBData* pDBData = GetDBData(false, SC_DB_MAKE, ScGetDBSelection::RowDown); - pDBData->ExtendDataArea(pDoc); + pDBData->ExtendDataArea(&rDoc); pDBData->GetQueryParam( aQueryParam ); ScRange aArea; @@ -375,7 +375,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont } case SID_MANAGE_XML_SOURCE: { - xResult = std::make_shared<ScXMLSourceDlg>(pB, pCW, pParent, pDoc); + xResult = std::make_shared<ScXMLSourceDlg>(pB, pCW, pParent, &rDoc); break; } case SID_OPENDLG_PIVOTTABLE: @@ -387,7 +387,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont // Check for an existing datapilot output. ScViewData& rViewData = GetViewData(); rViewData.SetRefTabNo( rViewData.GetTabNo() ); - ScDPObject* pObj = pDoc->GetDPAtCursor(rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo()); + ScDPObject* pObj = rDoc.GetDPAtCursor(rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo()); xResult = std::make_shared<ScPivotLayoutDialog>(pB, pCW, pParent, &rViewData, pDialogDPObject.get(), pObj == nullptr); } @@ -600,7 +600,7 @@ void ScTabViewShell::notifyAllViewsSheetGeomInvalidation(SfxViewShell* pForViewS bool ScTabViewShell::UseSubTotal(ScRangeList* pRangeList) { bool bSubTotal = false; - ScDocument* pDoc = GetViewData().GetDocument(); + ScDocument& rDoc = GetViewData().GetDocument(); size_t nRangeCount (pRangeList->size()); size_t nRangeIndex (0); while (!bSubTotal && nRangeIndex < nRangeCount) @@ -614,7 +614,7 @@ bool ScTabViewShell::UseSubTotal(ScRangeList* pRangeList) SCROW nRow(rRange.aStart.Row()); while (!bSubTotal && nRow <= nRowEnd) { - if (pDoc->RowFiltered(nRow, nTab)) + if (rDoc.RowFiltered(nRow, nTab)) bSubTotal = true; else ++nRow; @@ -626,7 +626,7 @@ bool ScTabViewShell::UseSubTotal(ScRangeList* pRangeList) if (!bSubTotal) { - const ScDBCollection::NamedDBs& rDBs = pDoc->GetDBCollection()->getNamedDBs(); + const ScDBCollection::NamedDBs& rDBs = rDoc.GetDBCollection()->getNamedDBs(); for (const auto& rxDB : rDBs) { const ScDBData& rDB = *rxDB; @@ -660,7 +660,7 @@ OUString ScTabViewShell::DoAutoSum(bool& rRangeFinder, bool& rSubTotal, const Op ScRangeList aMarkRangeList; rRangeFinder = rSubTotal = false; rMark.FillRangeListWithMarks( &aMarkRangeList, false ); - ScDocument* pDoc = GetViewData().GetDocument(); + ScDocument& rDoc = GetViewData().GetDocument(); // check if one of the marked ranges is empty bool bEmpty = false; @@ -668,7 +668,7 @@ OUString ScTabViewShell::DoAutoSum(bool& rRangeFinder, bool& rSubTotal, const Op for ( size_t i = 0; i < nCount; ++i ) { const ScRange & rRange( aMarkRangeList[i] ); - if ( pDoc->IsBlockEmpty( rRange.aStart.Tab(), + if ( rDoc.IsBlockEmpty( rRange.aStart.Tab(), rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row() ) ) { |