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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 15 18:07:59 UTC 2020


 sc/source/ui/app/transobj.cxx  |    2 +-
 sc/source/ui/inc/viewdata.hxx  |    6 +++---
 sc/source/ui/unoobj/docuno.cxx |    2 +-
 sc/source/ui/view/viewdata.cxx |   18 +++++++++---------
 4 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit 7f242cef830edac793753f9ac3ce162869cd67c6
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Sep 14 16:27:37 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Sep 15 20:07:14 2020 +0200

    setDocument and InitData never called with a null ScDocument*
    
    Change-Id: Ia0c6613daabcdcd61bd3efe1fe8a79ccbc7fa19c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102751
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index f329576d2bbc..3b2d355fb0b7 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -100,7 +100,7 @@ void ScTransferObj::PaintToDev( OutputDevice* pDev, ScDocument* pDoc, double nPr
     tools::Rectangle aBound( Point(), pDev->GetOutputSize() );      //! use size from clip area?
 
     ScViewData aViewData(nullptr,nullptr);
-    aViewData.InitData( pDoc );
+    aViewData.InitData( *pDoc );
 
     aViewData.SetTabNo( rBlock.aEnd.Tab() );
     aViewData.SetScreen( rBlock.aStart.Col(), rBlock.aStart.Row(),
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 2c362b58c4ec..d79d2e0b84ae 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -138,7 +138,7 @@ private:
 
 public:
     ScPositionHelper(ScDocument *pDoc, bool bColumn);
-    void setDocument(ScDocument *pDoc, bool bColumn);
+    void setDocument(ScDocument& rDoc, bool bColumn);
 
     void insert(index_type nIndex, long nPos);
     void removeByIndex(index_type nIndex);
@@ -247,7 +247,7 @@ private:
     bool            mbOldCursorValid;           // "virtual" Cursor position when combined
                     ScViewDataTable(ScDocument *pDoc = nullptr);
 
-    void            InitData(ScDocument *pDoc);
+    void            InitData(ScDocument& rDoc);
     void            WriteUserDataSequence(
                         css::uno::Sequence <css::beans::PropertyValue>& rSettings,
                         const ScViewData& rViewData, SCTAB nTab ) const;
@@ -349,7 +349,7 @@ public:
                     ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh );
                     ~ScViewData() COVERITY_NOEXCEPT_FALSE;
 
-    void            InitData( ScDocument* pDocument );
+    void            InitData(ScDocument& rDocument);
 
     ScDocShell*     GetDocShell() const     { return pDocShell; }
     ScDocFunc&      GetDocFunc() const;
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 2531c4776284..3ff67bb64af6 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -2081,7 +2081,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
         tools::Rectangle aBound( Point(), pDev->GetOutputSize());
 
         ScViewData aViewData(nullptr,nullptr);
-        aViewData.InitData( &rDoc );
+        aViewData.InitData( rDoc );
 
         aViewData.SetTabNo( aRange.aStart.Tab() );
         aViewData.SetScreen( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row() );
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 69fadf2f61f7..6af89998cd99 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -124,9 +124,9 @@ ScPositionHelper::ScPositionHelper(ScDocument *pDoc, bool bColumn)
     mData.insert(std::make_pair(-1, 0));
 }
 
-void ScPositionHelper::setDocument(ScDocument *pDoc, bool bColumn)
+void ScPositionHelper::setDocument(ScDocument& rDoc, bool bColumn)
 {
-    MAX_INDEX = bColumn ? pDoc->MaxCol() : MAXTILEDROW;
+    MAX_INDEX = bColumn ? rDoc.MaxCol() : MAXTILEDROW;
 }
 
 void ScPositionHelper::insert(index_type nIndex, long nPos)
@@ -514,10 +514,10 @@ ScViewDataTable::ScViewDataTable(ScDocument *pDoc) :
     nPixPosY[0]=nPixPosY[1]=0;
 }
 
-void ScViewDataTable::InitData(ScDocument *pDoc)
+void ScViewDataTable::InitData(ScDocument& rDoc)
 {
-    aWidthHelper.setDocument(pDoc, true);
-    aHeightHelper.setDocument(pDoc, false);
+    aWidthHelper.setDocument(rDoc, true);
+    aHeightHelper.setDocument(rDoc, false);
 }
 
 void ScViewDataTable::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>& rSettings, const ScViewData& rViewData, SCTAB nTab) const
@@ -838,21 +838,21 @@ ScViewData::ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ) :
         for ( auto & xTabData : maTabData )
         {
             if (xTabData)
-                xTabData->InitData( pDoc );
+                xTabData->InitData( *pDoc );
         }
     }
 
     CalcPPT();
 }
 
-void ScViewData::InitData( ScDocument* pDocument )
+void ScViewData::InitData(ScDocument& rDocument)
 {
-    pDoc = pDocument;
+    pDoc = &rDocument;
     *pOptions = pDoc->GetViewOptions();
     for ( auto & xTabData : maTabData )
     {
         if (xTabData)
-            xTabData->InitData( pDocument );
+            xTabData->InitData( rDocument );
     }
 }
 


More information about the Libreoffice-commits mailing list