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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 16 07:45:02 UTC 2020


 sc/source/ui/view/drawvie4.cxx |   26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

New commits:
commit 15a4bde9d6d3b6df097d0066f33e6eb79bb18b56
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Sep 15 10:00:28 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Sep 16 09:44:16 2020 +0200

    copyChartRefDataToClipDoc never passed a null ScDocument*
    
    Change-Id: I3a647358263b0e328dc2238bbfdc6e4e2ecf4090
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102791
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index 7717979a39b4..f07c44c6904e 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -272,26 +272,26 @@ public:
 
 class CopyRangeData
 {
-    ScDocument* mpSrc;
-    ScDocument* mpDest;
+    ScDocument& mrSrc;
+    ScDocument& mrDest;
 public:
-    CopyRangeData(ScDocument* pSrc, ScDocument* pDest) : mpSrc(pSrc), mpDest(pDest) {}
+    CopyRangeData(ScDocument& rSrc, ScDocument& rDest) : mrSrc(rSrc), mrDest(rDest) {}
 
     void operator() (const ScRange& rRange)
     {
         OUString aTabName;
-        mpSrc->GetName(rRange.aStart.Tab(), aTabName);
+        mrSrc.GetName(rRange.aStart.Tab(), aTabName);
 
         SCTAB nTab;
-        if (!mpDest->GetTable(aTabName, nTab))
+        if (!mrDest.GetTable(aTabName, nTab))
             // Sheet by this name doesn't exist.
             return;
 
-        mpSrc->CopyStaticToDocument(rRange, nTab, mpDest);
+        mrSrc.CopyStaticToDocument(rRange, nTab, &mrDest);
     }
 };
 
-void copyChartRefDataToClipDoc(ScDocument* pSrcDoc, ScDocument* pClipDoc, const std::vector<ScRange>& rRanges)
+void copyChartRefDataToClipDoc(ScDocument& rSrcDoc, ScDocument& rClipDoc, const std::vector<ScRange>& rRanges)
 {
     // Get a list of referenced table indices.
     std::vector<SCTAB> aTabs;
@@ -306,20 +306,20 @@ void copyChartRefDataToClipDoc(ScDocument* pSrcDoc, ScDocument* pClipDoc, const
     // Create sheets only for referenced source sheets.
     OUString aName;
     std::vector<SCTAB>::const_iterator it = aTabs.begin(), itEnd = aTabs.end();
-    if (!pSrcDoc->GetName(*it, aName))
+    if (!rSrcDoc.GetName(*it, aName))
         return;
 
-    pClipDoc->SetTabNameOnLoad(0, aName); // document initially has one sheet.
+    rClipDoc.SetTabNameOnLoad(0, aName); // document initially has one sheet.
 
     for (++it; it != itEnd; ++it)
     {
-        if (!pSrcDoc->GetName(*it, aName))
+        if (!rSrcDoc.GetName(*it, aName))
             return;
 
-        pClipDoc->AppendTabOnLoad(aName);
+        rClipDoc.AppendTabOnLoad(aName);
     }
 
-    std::for_each(rRanges.begin(), rRanges.end(), CopyRangeData(pSrcDoc, pClipDoc));
+    std::for_each(rRanges.begin(), rRanges.end(), CopyRangeData(rSrcDoc, rClipDoc));
 }
 
 }
@@ -344,7 +344,7 @@ void ScDrawView::DoCopy()
         // document. We need to do this before CreateMarkedObjModel() below.
         ScDocShellRef xDocSh = ScGlobal::xDrawClipDocShellRef;
         ScDocument& rClipDoc = xDocSh->GetDocument();
-        copyChartRefDataToClipDoc(&rDoc, &rClipDoc, aRanges);
+        copyChartRefDataToClipDoc(rDoc, rClipDoc, aRanges);
     }
     std::unique_ptr<SdrModel> pModel(CreateMarkedObjModel());
     ScDrawLayer::SetGlobalDrawPersist(nullptr);


More information about the Libreoffice-commits mailing list