editeng/source/accessibility/AccessibleParaManager.cxx |   31 ++++++-----------
 include/editeng/AccessibleParaManager.hxx              |   11 ++----
 svx/source/accessibility/AccessibleTextHelper.cxx      |    4 +-
 3 files changed, 18 insertions(+), 28 deletions(-)

New commits:
commit 6934cf941800ee9fa222a128f8730692ea1c4ad8
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Apr 2 14:53:14 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Apr 3 22:30:42 2025 +0200

    editeng a11y: Simplify AccessibleParaManager::CreateChild
    
    Both callers are only interested in the XAccessible
    in the returned std::pair, so let the method only
    return that instead of the pair.
    
    Drop the now unused AccessibleParaManager::Child typedef.
    
    Change-Id: I2b271de7b3e668be982b01bd183e0c39d47f444d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183670
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/editeng/source/accessibility/AccessibleParaManager.cxx 
b/editeng/source/accessibility/AccessibleParaManager.cxx
index a587b832771d..379ff46199ae 100644
--- a/editeng/source/accessibility/AccessibleParaManager.cxx
+++ b/editeng/source/accessibility/AccessibleParaManager.cxx
@@ -153,10 +153,9 @@ bool AccessibleParaManager::HasCreatedChild( sal_Int32 
nParagraphIndex ) const
         return false;
 }
 
-AccessibleParaManager::Child AccessibleParaManager::CreateChild( sal_Int32     
                         nChild,
-                                                                 const 
uno::Reference< XAccessible >&   xFrontEnd,
-                                                                 
SvxEditSourceAdapter&                  rEditSource,
-                                                                 sal_Int32     
                         nParagraphIndex )
+css::uno::Reference<css::accessibility::XAccessible>
+AccessibleParaManager::CreateChild(sal_Int32 nChild, const 
uno::Reference<XAccessible>& xFrontEnd,
+                                   SvxEditSourceAdapter& rEditSource, 
sal_Int32 nParagraphIndex)
 {
     DBG_ASSERT( 0 <= nParagraphIndex && maChildren.size() > 
o3tl::make_unsigned(nParagraphIndex),
             "AccessibleParaManager::CreateChild: invalid index" );
@@ -177,11 +176,11 @@ AccessibleParaManager::Child 
AccessibleParaManager::CreateChild( sal_Int32
             maChildren[nParagraphIndex] = WeakChild(xChild, 
xChild->getBounds());
         }
 
-        return Child(xChild.get(), GetChild(nParagraphIndex).second);
+        return xChild;
     }
     else
     {
-        return Child();
+        return nullptr;
     }
 }
 
diff --git a/include/editeng/AccessibleParaManager.hxx 
b/include/editeng/AccessibleParaManager.hxx
index 91b73b8097be..b6df448c9a36 100644
--- a/include/editeng/AccessibleParaManager.hxx
+++ b/include/editeng/AccessibleParaManager.hxx
@@ -92,8 +92,6 @@ class UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) 
AccessibleParaManager
 public:
     typedef WeakCppRef < css::accessibility::XAccessible, 
AccessibleEditableTextPara > WeakPara;
     typedef ::std::pair< WeakPara, css::awt::Rectangle > WeakChild;
-    typedef ::std::pair< css::uno::Reference<
-        css::accessibility::XAccessible > , css::awt::Rectangle > Child;
     typedef ::std::vector< WeakChild > VectorOfChildren;
 
     AccessibleParaManager();
@@ -131,10 +129,10 @@ public:
     static bool IsReferencable(rtl::Reference<AccessibleEditableTextPara> 
const & aChild);
     bool IsReferencable( sal_Int32 nChild ) const;
 
-    Child CreateChild( sal_Int32                                               
                                         nChild,
-                       const css::uno::Reference< 
css::accessibility::XAccessible >& xFrontEnd,
-                       SvxEditSourceAdapter&                                   
                                         rEditSource,
-                       sal_Int32                                               
                                        nParagraphIndex );
+    css::uno::Reference<css::accessibility::XAccessible>
+    CreateChild(sal_Int32 nChild,
+                const css::uno::Reference<css::accessibility::XAccessible>& 
xFrontEnd,
+                SvxEditSourceAdapter& rEditSource, sal_Int32 nParagraphIndex);
 
     WeakChild GetChild( sal_Int32 nParagraphIndex ) const;
     bool HasCreatedChild( sal_Int32 nParagraphIndex ) const;
diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx 
b/svx/source/accessibility/AccessibleTextHelper.cxx
index c37845cff514..43993b383d09 100644
--- a/svx/source/accessibility/AccessibleTextHelper.cxx
+++ b/svx/source/accessibility/AccessibleTextHelper.cxx
@@ -770,7 +770,7 @@ namespace accessibility
                     if (!maParaManager.HasCreatedChild(nCurrPara))
                     {
                         FireEvent(AccessibleEventId::CHILD, 
uno::Any(maParaManager.CreateChild(nCurrPara - mnFirstVisibleChild,
-                                                                               
                mxFrontEnd, GetEditSource(), nCurrPara).first));
+                                                                               
                mxFrontEnd, GetEditSource(), nCurrPara)));
                     }
                 }
             }
@@ -1444,7 +1444,7 @@ namespace accessibility
         DBG_ASSERT(mxFrontEnd.is(), 
"AccessibleTextHelper_Impl::UpdateVisibleChildren: no frontend set");
 
         if( mxFrontEnd.is() )
-            return maParaManager.CreateChild( i, mxFrontEnd, GetEditSource(), 
mnFirstVisibleChild + i ).first;
+            return maParaManager.CreateChild(i, mxFrontEnd, GetEditSource(), 
mnFirstVisibleChild + i);
         else
             return nullptr;
     }
commit 4397edc75dab602f0963731d9a9fa6b902c8622b
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Apr 2 14:47:12 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Apr 3 22:30:34 2025 +0200

    editeng a11y: Replace auto and adhere to naming scheme
    
    This makes more obvious that the child is a
    rtl::Reference<AccessibleEditableTextPara> here, which
    is otherwise a bit harder to see with all the typedefs etc.
    involved.
    
    Change-Id: Id9d0c2457813b7e0fed34b0ce8fe52553ef6a39d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183669
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/editeng/source/accessibility/AccessibleParaManager.cxx 
b/editeng/source/accessibility/AccessibleParaManager.cxx
index 94fbb44dca2d..a587b832771d 100644
--- a/editeng/source/accessibility/AccessibleParaManager.cxx
+++ b/editeng/source/accessibility/AccessibleParaManager.cxx
@@ -164,20 +164,20 @@ AccessibleParaManager::Child 
AccessibleParaManager::CreateChild( sal_Int32
     if( 0 <= nParagraphIndex && maChildren.size() > 
o3tl::make_unsigned(nParagraphIndex) )
     {
         // retrieve hard reference from weak one
-        auto aChild( GetChild( nParagraphIndex ).first.get() );
+        rtl::Reference<AccessibleEditableTextPara> 
xChild(GetChild(nParagraphIndex).first.get());
 
         if( !IsReferencable( nParagraphIndex ) )
         {
             // there is no hard reference available, create object then
             // #i27138#
-            aChild = new AccessibleEditableTextPara(xFrontEnd, this);
+            xChild = new AccessibleEditableTextPara(xFrontEnd, this);
 
-            InitChild( *aChild, rEditSource, nChild, nParagraphIndex );
+            InitChild(*xChild, rEditSource, nChild, nParagraphIndex);
 
-            maChildren[ nParagraphIndex ] = WeakChild( aChild, 
aChild->getBounds() );
+            maChildren[nParagraphIndex] = WeakChild(xChild, 
xChild->getBounds());
         }
 
-        return Child( aChild.get(), GetChild( nParagraphIndex ).second );
+        return Child(xChild.get(), GetChild(nParagraphIndex).second);
     }
     else
     {
commit 1f91b8e0cbdc6befce53465e59393bb8259fd56b
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Apr 2 14:29:03 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Apr 3 22:30:27 2025 +0200

    editeng a11y: Inline AccessibleParaManager::ShutdownPara in only caller
    
    Change-Id: I27f86a476b6c4c7c90f4c26baff30cc1a525d9b8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183663
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/editeng/source/accessibility/AccessibleParaManager.cxx 
b/editeng/source/accessibility/AccessibleParaManager.cxx
index 27ef0d356fab..94fbb44dca2d 100644
--- a/editeng/source/accessibility/AccessibleParaManager.cxx
+++ b/editeng/source/accessibility/AccessibleParaManager.cxx
@@ -374,7 +374,9 @@ void AccessibleParaManager::Release( sal_Int32 nStartPara, 
sal_Int32 nEndPara )
         std::transform(front, back, front,
                        [](const AccessibleParaManager::WeakChild& rPara)
                        {
-                           AccessibleParaManager::ShutdownPara(rPara);
+                           auto aChild(rPara.first.get());
+                           if (IsReferencable(aChild))
+                               aChild->SetEditSource(nullptr);
 
                            // clear reference
                            return AccessibleParaManager::WeakChild();
@@ -382,14 +384,6 @@ void AccessibleParaManager::Release( sal_Int32 nStartPara, 
sal_Int32 nEndPara )
     }
 }
 
-void AccessibleParaManager::ShutdownPara( const WeakChild& rChild )
-{
-    auto aChild( rChild.first.get() );
-
-    if( IsReferencable( aChild ) )
-        aChild->SetEditSource( nullptr );
-}
-
 }
 
 
diff --git a/include/editeng/AccessibleParaManager.hxx 
b/include/editeng/AccessibleParaManager.hxx
index ad77ded5857a..91b73b8097be 100644
--- a/include/editeng/AccessibleParaManager.hxx
+++ b/include/editeng/AccessibleParaManager.hxx
@@ -130,7 +130,6 @@ public:
 
     static bool IsReferencable(rtl::Reference<AccessibleEditableTextPara> 
const & aChild);
     bool IsReferencable( sal_Int32 nChild ) const;
-    static void ShutdownPara( const WeakChild& rChild );
 
     Child CreateChild( sal_Int32                                               
                                         nChild,
                        const css::uno::Reference< 
css::accessibility::XAccessible >& xFrontEnd,

Reply via email to