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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 18 17:57:48 UTC 2020


 sc/inc/chgtrack.hxx              |    2 +-
 sc/source/core/tool/chgtrack.cxx |   10 +++++-----
 sc/source/ui/undo/undoblk3.cxx   |    7 ++++---
 3 files changed, 10 insertions(+), 9 deletions(-)

New commits:
commit 0abf2ac27859f1e91a3d183b81948b1fe8f5aca3
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Sep 16 11:25:25 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Sep 18 19:57:03 2020 +0200

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

diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index c5af0df88064..b061aa7f2ddf 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -1025,7 +1025,7 @@ public:
                         // after new values were set in the document,
                         // old values from RefDoc/UndoDoc.
                         // All contents with a cell in RefDoc
-    void                AppendContentsIfInRefDoc( ScDocument* pRefDoc,
+    void                AppendContentsIfInRefDoc( ScDocument& rRefDoc,
                             sal_uLong& nStartAction, sal_uLong& nEndAction );
 
                         // Meant for import filter, creates and inserts
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index a1779618333f..84848a57e540 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -2768,21 +2768,21 @@ void ScChangeTrack::AppendContentRange( const ScRange& rRange,
     }
 }
 
-void ScChangeTrack::AppendContentsIfInRefDoc( ScDocument* pRefDoc,
+void ScChangeTrack::AppendContentsIfInRefDoc( ScDocument& rRefDoc,
             sal_uLong& nStartAction, sal_uLong& nEndAction )
 {
-    ScCellIterator aIter(pRefDoc, ScRange(0,0,0,rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB));
+    ScCellIterator aIter(&rRefDoc, ScRange(0,0,0,rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB));
     if (aIter.first())
     {
         nStartAction = GetActionMax() + 1;
         StartBlockModify( ScChangeTrackMsgType::Append, nStartAction );
-        SvNumberFormatter* pFormatter = pRefDoc->GetFormatTable();
+        SvNumberFormatter* pFormatter = rRefDoc.GetFormatTable();
         do
         {
             const ScAddress& rPos = aIter.GetPos();
-            const ScPatternAttr* pPat = pRefDoc->GetPattern(rPos);
+            const ScPatternAttr* pPat = rRefDoc.GetPattern(rPos);
             AppendContent(
-                rPos, aIter.getCellValue(), pPat->GetNumberFormat(pFormatter), pRefDoc);
+                rPos, aIter.getCellValue(), pPat->GetNumberFormat(pFormatter), &rRefDoc);
         }
         while (aIter.next());
 
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index f08e420a4ad8..d7358831d75f 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -940,7 +940,7 @@ void ScUndoReplace::SetChangeTrack()
         if ( pUndoDoc )
         {   //! UndoDoc includes only the changed cells,
             // that is why an Iterator can be used
-            pChangeTrack->AppendContentsIfInRefDoc( pUndoDoc.get(),
+            pChangeTrack->AppendContentsIfInRefDoc( *pUndoDoc,
                 nStartChangeAction, nEndChangeAction );
         }
         else
@@ -1193,7 +1193,7 @@ void ScUndoConversion::SetChangeTrack()
     if ( pChangeTrack )
     {
         if ( pUndoDoc )
-            pChangeTrack->AppendContentsIfInRefDoc( pUndoDoc.get(),
+            pChangeTrack->AppendContentsIfInRefDoc( *pUndoDoc,
                 nStartChangeAction, nEndChangeAction );
         else
         {
@@ -1285,6 +1285,7 @@ pRedoDoc    ( std::move(pNewRedoDoc) ),
 aRange      ( aMarkRange ),
 bMulti      ( bNewMulti )
 {
+    assert(pUndoDoc && pUndoDoc);
     SetChangeTrack();
 }
 
@@ -1303,7 +1304,7 @@ void ScUndoRefConversion::SetChangeTrack()
 {
     ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack();
     if ( pChangeTrack )
-        pChangeTrack->AppendContentsIfInRefDoc( pUndoDoc.get(),
+        pChangeTrack->AppendContentsIfInRefDoc( *pUndoDoc,
             nStartChangeAction, nEndChangeAction );
     else
         nStartChangeAction = nEndChangeAction = 0;


More information about the Libreoffice-commits mailing list