diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-09-15 09:38:20 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-09-15 21:37:14 +0200 |
commit | 8f78e5b82a87437877bdb883f003e571cc042094 (patch) | |
tree | b8a429e91be60db20988ec05c380bf93b3ffa99e | |
parent | 24ceb100883e5413b1e911bf1bc29df008972a5a (diff) |
CreateProtectedChartListenersAndNotify never passed a null ScDocument*
Change-Id: I76efe00924938830f26e1901c22da04376c30ce9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102784
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sc/inc/charthelper.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/charthelper.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/fusel.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun3.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun7.cxx | 4 |
5 files changed, 10 insertions, 10 deletions
diff --git a/sc/inc/charthelper.hxx b/sc/inc/charthelper.hxx index 61da8d797a4a..1dc55ffd312a 100644 --- a/sc/inc/charthelper.hxx +++ b/sc/inc/charthelper.hxx @@ -48,7 +48,7 @@ public: static void AddRangesIfProtectedChart( ScRangeListVector& rRangesVector, const ScDocument* pDocument, SdrObject* pObject ); static void FillProtectedChartRangesVector( ScRangeListVector& rRangesVector, const ScDocument* pDocument, const SdrPage* pPage ); static void GetChartNames( ::std::vector< OUString >& rChartNames, const SdrPage* pPage ); - static void CreateProtectedChartListenersAndNotify( ScDocument* pDoc, const SdrPage* pPage, ScModelObj* pModelObj, SCTAB nTab, + static void CreateProtectedChartListenersAndNotify( ScDocument& rDoc, const SdrPage* pPage, ScModelObj* pModelObj, SCTAB nTab, const ScRangeListVector& rRangesVector, const ::std::vector< OUString >& rExcludedChartNames, bool bSameDoc = true ); }; diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx index cb31f2c7468f..13bb73b86f8a 100644 --- a/sc/source/core/tool/charthelper.cxx +++ b/sc/source/core/tool/charthelper.cxx @@ -358,10 +358,10 @@ void ScChartHelper::GetChartNames( ::std::vector< OUString >& rChartNames, const } } -void ScChartHelper::CreateProtectedChartListenersAndNotify( ScDocument* pDoc, const SdrPage* pPage, ScModelObj* pModelObj, SCTAB nTab, +void ScChartHelper::CreateProtectedChartListenersAndNotify( ScDocument& rDoc, const SdrPage* pPage, ScModelObj* pModelObj, SCTAB nTab, const ScRangeListVector& rRangesVector, const ::std::vector< OUString >& rExcludedChartNames, bool bSameDoc ) { - if ( !(pDoc && pPage && pModelObj) ) + if ( !(pPage && pModelObj) ) return; size_t nRangeListCount = rRangesVector.size(); @@ -392,12 +392,12 @@ void ScChartHelper::CreateProtectedChartListenersAndNotify( ScDocument* pDoc, co { if ( bSameDoc ) { - ScChartListenerCollection* pCollection = pDoc->GetChartListenerCollection(); + ScChartListenerCollection* pCollection = rDoc.GetChartListenerCollection(); if (pCollection && !pCollection->findByName(aChartName)) { ScRangeList aRangeList( rRangesVector[ nRangeList++ ] ); ScRangeListRef rRangeList( new ScRangeList( aRangeList ) ); - ScChartListener* pChartListener = new ScChartListener( aChartName, pDoc, rRangeList ); + ScChartListener* pChartListener = new ScChartListener( aChartName, &rDoc, rRangeList ); pCollection->insert( pChartListener ); pChartListener->StartListeningTo(); } @@ -415,7 +415,7 @@ void ScChartHelper::CreateProtectedChartListenersAndNotify( ScDocument* pDoc, co if (pModelObj->HasChangesListeners()) { tools::Rectangle aRectangle = pSdrOle2Obj->GetSnapRect(); - ScRange aRange( pDoc->GetRange( nTab, aRectangle ) ); + ScRange aRange( rDoc.GetRange( nTab, aRectangle ) ); ScRangeList aChangeRanges( aRange ); uno::Sequence< beans::PropertyValue > aProperties( 1 ); diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx index e592085d14de..72be7847faef 100644 --- a/sc/source/ui/drawfunc/fusel.cxx +++ b/sc/source/ui/drawfunc/fusel.cxx @@ -521,7 +521,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) if ( pModelObj ) { SCTAB nTab = rViewData.GetTabNo(); - ScChartHelper::CreateProtectedChartListenersAndNotify( &rDocument, pPage, pModelObj, nTab, + ScChartHelper::CreateProtectedChartListenersAndNotify( rDocument, pPage, pModelObj, nTab, aProtectedChartRangesVector, aExcludedChartNames ); } } diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index aba8c6666765..989037bc6369 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -1457,7 +1457,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, { bool bSameDoc = ( rClipParam.getSourceDocID() == rDoc.GetDocumentID() ); const ScRangeListVector& rProtectedChartRangesVector( rClipParam.maProtectedChartRangesVector ); - ScChartHelper::CreateProtectedChartListenersAndNotify( &rDoc, pPage, pModelObj, nStartTab, + ScChartHelper::CreateProtectedChartListenersAndNotify( rDoc, pPage, pModelObj, nStartTab, rProtectedChartRangesVector, aExcludedChartNames, bSameDoc ); } } diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx index 38b9b1e013d1..d7b4cf056562 100644 --- a/sc/source/ui/view/viewfun7.cxx +++ b/sc/source/ui/view/viewfun7.cxx @@ -181,7 +181,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, if ( pDestPage && pModelObj && pDrawTrans ) { const ScRangeListVector& rProtectedChartRangesVector( pDrawTrans->GetProtectedChartRangesVector() ); - ScChartHelper::CreateProtectedChartListenersAndNotify( &rDocument, pDestPage, pModelObj, nTab, + ScChartHelper::CreateProtectedChartListenersAndNotify( rDocument, pDestPage, pModelObj, nTab, rProtectedChartRangesVector, aExcludedChartNames, bSameDoc ); } } @@ -252,7 +252,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, { const ScRangeListVector& rProtectedChartRangesVector( pTransferObj ? pTransferObj->GetProtectedChartRangesVector() : pDrawTrans->GetProtectedChartRangesVector() ); - ScChartHelper::CreateProtectedChartListenersAndNotify( &rDocument, pPage, pModelObj, nTab, + ScChartHelper::CreateProtectedChartListenersAndNotify( rDocument, pPage, pModelObj, nTab, rProtectedChartRangesVector, aExcludedChartNames, bSameDocClipboard ); } } |