From a5d2e06d444b486bb2695c9268681f044f27d599 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 22 May 2022 12:16:41 +0100 Subject: pass ScDocShell by reference in ctor to indicate never initially null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6b07f734aba06a643b6240562bb3e427e5c1e9ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134729 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sc/inc/dapiuno.hxx | 8 ++++---- sc/source/ui/unoobj/cellsuno.cxx | 2 +- sc/source/ui/unoobj/dapiuno.cxx | 26 +++++++++++++------------- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'sc') diff --git a/sc/inc/dapiuno.hxx b/sc/inc/dapiuno.hxx index 86d2d56893b5..07d2740efa98 100644 --- a/sc/inc/dapiuno.hxx +++ b/sc/inc/dapiuno.hxx @@ -90,7 +90,7 @@ private: rtl::Reference GetObjectByName_Impl(const OUString& aName); public: - ScDataPilotTablesObj(ScDocShell* pDocSh, SCTAB nT); + ScDataPilotTablesObj(ScDocShell& rDocSh, SCTAB nT); virtual ~ScDataPilotTablesObj() override; virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; @@ -141,7 +141,7 @@ private: ScDocShell* pDocShell; public: - ScDataPilotDescriptorBase(ScDocShell* pDocSh); + ScDataPilotDescriptorBase(ScDocShell& rDocSh); virtual ~ScDataPilotDescriptorBase() override; virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; @@ -207,7 +207,7 @@ private: std::unique_ptr mpDPObject; public: - ScDataPilotDescriptor(ScDocShell* pDocSh); + ScDataPilotDescriptor(ScDocShell& rDocSh); virtual ~ScDataPilotDescriptor() override; virtual ScDPObject* GetDPObject() const override; @@ -237,7 +237,7 @@ private: void Refreshed_Impl(); public: - ScDataPilotTableObj(ScDocShell* pDocSh, SCTAB nT, const OUString& rN); + ScDataPilotTableObj(ScDocShell& rDocSh, SCTAB nT, const OUString& rN); virtual ~ScDataPilotTableObj() override; virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 763ee12f7b24..c2ef70015d1f 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -6652,7 +6652,7 @@ uno::Reference SAL_CALL ScTableSheetObj::getDataPilotTa SolarMutexGuard aGuard; ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) - return new ScDataPilotTablesObj( pDocSh, GetTab_Impl() ); + return new ScDataPilotTablesObj(*pDocSh, GetTab_Impl()); OSL_FAIL("no document"); return nullptr; diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index dfd11971e88f..4bf5018e2cd4 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -295,8 +295,8 @@ static sal_Int32 lcl_GetObjectIndex( ScDPObject* pDPObj, const ScFieldIdentifier return -1; // none } -ScDataPilotTablesObj::ScDataPilotTablesObj(ScDocShell* pDocSh, SCTAB nT) : - pDocShell( pDocSh ), +ScDataPilotTablesObj::ScDataPilotTablesObj(ScDocShell& rDocSh, SCTAB nT) : + pDocShell( &rDocSh ), nTab( nT ) { pDocShell->GetDocument().AddUnoObject(*this); @@ -340,7 +340,7 @@ rtl::Reference ScDataPilotTablesObj::GetObjectByIndex_Impl( { if ( nFound == nIndex ) { - return new ScDataPilotTableObj( pDocShell, nTab, rDPObj.GetName() ); + return new ScDataPilotTableObj(*pDocShell, nTab, rDPObj.GetName()); } ++nFound; } @@ -353,7 +353,7 @@ rtl::Reference ScDataPilotTablesObj::GetObjectByIndex_Impl( rtl::Reference ScDataPilotTablesObj::GetObjectByName_Impl(const OUString& rName) { if (hasByName(rName)) - return new ScDataPilotTableObj( pDocShell, nTab, rName ); + return new ScDataPilotTableObj(*pDocShell, nTab, rName); return nullptr; } @@ -361,7 +361,7 @@ Reference SAL_CALL ScDataPilotTablesObj::createDataPilotDe { SolarMutexGuard aGuard; if (pDocShell) - return new ScDataPilotDescriptor(pDocShell); + return new ScDataPilotDescriptor(*pDocShell); return nullptr; } @@ -578,9 +578,9 @@ sal_Bool SAL_CALL ScDataPilotTablesObj::hasByName( const OUString& aName ) return false; } -ScDataPilotDescriptorBase::ScDataPilotDescriptorBase(ScDocShell* pDocSh) : +ScDataPilotDescriptorBase::ScDataPilotDescriptorBase(ScDocShell& rDocSh) : maPropSet( lcl_GetDataPilotDescriptorBaseMap() ), - pDocShell( pDocSh ) + pDocShell( &rDocSh ) { pDocShell->GetDocument().AddUnoObject(*this); } @@ -988,8 +988,8 @@ const Sequence& ScDataPilotDescriptorBase::getUnoTunnelId() return theScDataPilotDescriptorBaseUnoTunnelId.getSeq(); } -ScDataPilotTableObj::ScDataPilotTableObj(ScDocShell* pDocSh, SCTAB nT, const OUString& rN) : - ScDataPilotDescriptorBase( pDocSh ), +ScDataPilotTableObj::ScDataPilotTableObj(ScDocShell& rDocSh, SCTAB nT, const OUString& rN) : + ScDataPilotDescriptorBase( rDocSh ), nTab( nT ), aName( rN ), aModifyListeners( 0 ) @@ -1258,9 +1258,9 @@ void ScDataPilotTableObj::Refreshed_Impl() rDoc.AddUnoListenerCall( xModifyListener, aEvent ); } -ScDataPilotDescriptor::ScDataPilotDescriptor(ScDocShell* pDocSh) : - ScDataPilotDescriptorBase( pDocSh ), - mpDPObject(new ScDPObject(&pDocSh->GetDocument())) +ScDataPilotDescriptor::ScDataPilotDescriptor(ScDocShell& rDocSh) : + ScDataPilotDescriptorBase( rDocSh ), + mpDPObject(new ScDPObject(&rDocSh.GetDocument())) { ScDPSaveData aSaveData; // set defaults like in ScPivotParam constructor @@ -1269,7 +1269,7 @@ ScDataPilotDescriptor::ScDataPilotDescriptor(ScDocShell* pDocSh) : aSaveData.SetIgnoreEmptyRows( false ); aSaveData.SetRepeatIfEmpty( false ); mpDPObject->SetSaveData(aSaveData); - ScSheetSourceDesc aSheetDesc(&pDocSh->GetDocument()); + ScSheetSourceDesc aSheetDesc(&rDocSh.GetDocument()); mpDPObject->SetSheetDesc(aSheetDesc); } -- cgit