sc/source/core/data/column2.cxx   |   12 ++++++------
 sc/source/core/data/column4.cxx   |    2 +-
 sc/source/ui/docshell/docfunc.cxx |    2 +-
 sc/source/ui/docshell/docsh4.cxx  |    6 +++---
 sc/source/ui/inc/docsh.hxx        |    2 +-
 sc/source/ui/undo/undocell.cxx    |    4 ++--
 6 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit f1d2442662a1c593c0ed47391156719ffdf9385f
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue Oct 31 10:55:13 2023 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Oct 31 15:10:05 2023 +0100

    we always have a ScDocument so pass by reference
    
    Change-Id: Ic82c71ea6d0490d17fcca07afe4f7da9441a5794
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158715
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index a2f8ca5ea25a..e7ca588a0b34 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1945,7 +1945,7 @@ public:
         ScPostIt* pNew = p->Clone(aSrcPos, mrDestCol.GetDoc(), aDestPos, 
mbCloneCaption).release();
         miPos = mrDestNotes.set(miPos, nDestRow, pNew);
         // Notify our LOK clients also
-        ScDocShell::LOKCommentNotify(LOKCommentNotificationType::Add, 
&mrDestCol.GetDoc(), aDestPos, pNew);
+        ScDocShell::LOKCommentNotify(LOKCommentNotificationType::Add, 
mrDestCol.GetDoc(), aDestPos, pNew);
     }
 };
 
@@ -2230,13 +2230,13 @@ void ScColumn::SetCellNote(SCROW nRow, 
std::unique_ptr<ScPostIt> pNote)
 namespace {
     class CellNoteHandler
     {
-        const ScDocument* m_pDocument;
+        const ScDocument& m_rDocument;
         const ScAddress m_aAddress; // 'incomplete' address consisting of tab, 
column
         const bool m_bForgetCaptionOwnership;
 
     public:
-        CellNoteHandler(const ScDocument* pDocument, const ScAddress& rPos, 
bool bForgetCaptionOwnership) :
-            m_pDocument(pDocument),
+        CellNoteHandler(const ScDocument& rDocument, const ScAddress& rPos, 
bool bForgetCaptionOwnership) :
+            m_rDocument(rDocument),
             m_aAddress(rPos),
             m_bForgetCaptionOwnership(bForgetCaptionOwnership) {}
 
@@ -2249,7 +2249,7 @@ namespace {
             ScAddress aAddr(m_aAddress);
             aAddr.SetRow(nRow);
             // Notify our LOK clients
-            ScDocShell::LOKCommentNotify(LOKCommentNotificationType::Remove, 
m_pDocument, aAddr, p);
+            ScDocShell::LOKCommentNotify(LOKCommentNotificationType::Remove, 
m_rDocument, aAddr, p);
         }
     };
 } // anonymous namespace
@@ -2257,7 +2257,7 @@ namespace {
 void ScColumn::CellNotesDeleting(SCROW nRow1, SCROW nRow2, bool 
bForgetCaptionOwnership)
 {
     ScAddress aAddr(nCol, 0, nTab);
-    CellNoteHandler aFunc(&GetDoc(), aAddr, bForgetCaptionOwnership);
+    CellNoteHandler aFunc(GetDoc(), aAddr, bForgetCaptionOwnership);
     sc::ParseNote(maCellNotes.begin(), maCellNotes, nRow1, nRow2, aFunc);
 }
 
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index be0fc4f201c3..8e22b13a8e1e 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -362,7 +362,7 @@ void ScColumn::CopyOneCellFromClip( 
sc::CopyFromClipContext& rCxt, SCROW nRow1,
     aDestPosition.SetRow(nRow1);
     for (size_t i = 0; i < nDestSize; ++i)
     {
-        ScDocShell::LOKCommentNotify(LOKCommentNotificationType::Add, 
&rDocument, aDestPosition, aNotes[i]);
+        ScDocShell::LOKCommentNotify(LOKCommentNotificationType::Add, 
rDocument, aDestPosition, aNotes[i]);
         aDestPosition.IncRow();
     }
 }
diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index 5691a67b9780..7ad32d4963b9 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1396,7 +1396,7 @@ void ScDocFunc::ReplaceNote( const ScAddress& rPos, const 
OUString& rNoteText, c
         if (pNewNote)
         {
             ScDocShell::LOKCommentNotify(hadOldNote ? 
LOKCommentNotificationType::Modify : LOKCommentNotificationType::Add,
-                                         &rDoc, rPos, pNewNote);
+                                         rDoc, rPos, pNewNote);
         }
     }
     else if (!bApi)
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 0ef5be3c50e8..f8a33f91d1e8 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -2535,9 +2535,9 @@ bool ScDocShell::DdeSetData( const OUString& rItem,
     return pObj;
 }
 
-void ScDocShell::LOKCommentNotify(LOKCommentNotificationType nType, const 
ScDocument* pDocument, const ScAddress& rPos, const ScPostIt* pNote)
+void ScDocShell::LOKCommentNotify(LOKCommentNotificationType nType, const 
ScDocument& rDocument, const ScAddress& rPos, const ScPostIt* pNote)
 {
-    if ( !pDocument->IsDocVisible() || // don't want callbacks until document 
load
+    if ( !rDocument.IsDocVisible() || // don't want callbacks until document 
load
          !comphelper::LibreOfficeKit::isActive() ||
          comphelper::LibreOfficeKit::isTiledAnnotations() )
         return;
@@ -2562,7 +2562,7 @@ void 
ScDocShell::LOKCommentNotify(LOKCommentNotificationType nType, const ScDocu
             // Calculating the cell cursor position
             ScViewData* pViewData = GetViewData();
             if (pViewData && pViewData->GetActiveWin())
-                aAnnotation.put("cellRange", 
ScPostIt::NoteRangeToJsonString(*pDocument, rPos));
+                aAnnotation.put("cellRange", 
ScPostIt::NoteRangeToJsonString(rDocument, rPos));
         }
     }
 
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index a2bbb5454573..eb9a3450ad22 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -403,7 +403,7 @@ public:
     static OUString   GetDBaseFilterName();
     static OUString   GetDifFilterName();
     static bool       HasAutomaticTableName( std::u16string_view rFilter );
-    static void       LOKCommentNotify(LOKCommentNotificationType nType, const 
ScDocument* pDocument, const ScAddress& rPos, const ScPostIt* pNote);
+    static void       LOKCommentNotify(LOKCommentNotificationType nType, const 
ScDocument& rDocument, const ScAddress& rPos, const ScPostIt* pNote);
 
     DECL_DLLPRIVATE_LINK( RefreshDBDataHdl, Timer*, void );
 
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index 16c79ea457f5..4cb9d03fed6d 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -812,7 +812,7 @@ void ScUndoReplaceNote::DoInsertNote( const ScNoteData& 
rNoteData )
         OSL_ENSURE( !rDoc.GetNote(maPos), "ScUndoReplaceNote::DoInsertNote - 
unexpected cell note" );
         ScPostIt* pNote = new ScPostIt( rDoc, maPos, rNoteData, false );
         rDoc.SetNote( maPos, std::unique_ptr<ScPostIt>(pNote) );
-        ScDocShell::LOKCommentNotify(LOKCommentNotificationType::Add, &rDoc, 
maPos, pNote);
+        ScDocShell::LOKCommentNotify(LOKCommentNotificationType::Add, rDoc, 
maPos, pNote);
     }
 }
 
@@ -829,7 +829,7 @@ void ScUndoReplaceNote::DoRemoveNote( const ScNoteData& 
rNoteData )
             caption object from the drawing layer while deleting pNote
             (removing the caption is done by a drawing undo action). */
         pNote->ForgetCaption();
-        ScDocShell::LOKCommentNotify(LOKCommentNotificationType::Remove, 
&rDoc, maPos, pNote.get());
+        ScDocShell::LOKCommentNotify(LOKCommentNotificationType::Remove, rDoc, 
maPos, pNote.get());
     }
 }
 

Reply via email to