sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx |   26 ++++-------
 1 file changed, 10 insertions(+), 16 deletions(-)

New commits:
commit aa5064a8973028edf8104c426d06a6f77332f63e
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Apr 29 18:11:03 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Apr 29 23:11:33 2025 +0200

    sc a11y: Use ref instead of pointer in ScChild{Gone,New}
    
    Change-Id: I28a314c2d07e402decb5a7e9cae1ac59b6e8dc3a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184792
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx 
b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index cbfc9403b9cd..5b3248ba079b 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -431,29 +431,23 @@ namespace {
 
 struct ScChildGone
 {
-    ScAccessibleDocumentPagePreview* mpAccDoc;
-    explicit ScChildGone(ScAccessibleDocumentPagePreview* pAccDoc) : 
mpAccDoc(pAccDoc) {}
+    ScAccessibleDocumentPagePreview& mrAccDoc;
+    explicit ScChildGone(ScAccessibleDocumentPagePreview& rAccDoc) : 
mrAccDoc(rAccDoc) {}
     void operator() (const uno::Reference<XAccessible>& xAccessible) const
     {
-        if (mpAccDoc)
-        {
-            // gone child - event
-            mpAccDoc->CommitChange(AccessibleEventId::CHILD, 
uno::Any(xAccessible), uno::Any());
-        }
+        // gone child - event
+        mrAccDoc.CommitChange(AccessibleEventId::CHILD, uno::Any(xAccessible), 
uno::Any());
     }
 };
 
 struct ScChildNew
 {
-    ScAccessibleDocumentPagePreview* mpAccDoc;
-    explicit ScChildNew(ScAccessibleDocumentPagePreview* pAccDoc) : 
mpAccDoc(pAccDoc) {}
+    ScAccessibleDocumentPagePreview& mrAccDoc;
+    explicit ScChildNew(ScAccessibleDocumentPagePreview& rAccDoc) : 
mrAccDoc(rAccDoc) {}
     void operator() (const uno::Reference<XAccessible>& xAccessible) const
     {
-        if (mpAccDoc)
-        {
-            // new child - event
-            mpAccDoc->CommitChange(AccessibleEventId::CHILD, uno::Any(), 
uno::Any(xAccessible));
-        }
+        // new child - event
+        mrAccDoc.CommitChange(AccessibleEventId::CHILD, uno::Any(), 
uno::Any(xAccessible));
     }
 };
 
@@ -477,8 +471,8 @@ void ScNotesChildren::DataChanged(const tools::Rectangle& 
rVisRect)
         maNotes = std::move(aNewNotes);
     }
 
-    std::for_each(aOldParas.begin(), aOldParas.end(), ScChildGone(&mrAccDoc));
-    std::for_each(aNewParas.begin(), aNewParas.end(), ScChildNew(&mrAccDoc));
+    std::for_each(aOldParas.begin(), aOldParas.end(), ScChildGone(mrAccDoc));
+    std::for_each(aNewParas.begin(), aNewParas.end(), ScChildNew(mrAccDoc));
 }
 
 inline ScDocument* ScNotesChildren::GetDocument() const

Reply via email to