[Libreoffice-commits] core.git: sc/inc sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 15 19:38:11 UTC 2020


 sc/inc/charthelper.hxx              |    2 +-
 sc/source/core/tool/charthelper.cxx |   10 +++++-----
 sc/source/ui/drawfunc/fusel.cxx     |    2 +-
 sc/source/ui/view/viewfun3.cxx      |    2 +-
 sc/source/ui/view/viewfun7.cxx      |    4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 8f78e5b82a87437877bdb883f003e571cc042094
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Sep 15 09:38:20 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Sep 15 21:37:14 2020 +0200

    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 at redhat.com>

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 );
         }
     }


More information about the Libreoffice-commits mailing list