accessibility/source/helper/acc_factory.cxx |   18 +-----------------
 include/svtools/ruler.hxx                   |    2 --
 svtools/source/control/ruler.cxx            |    9 ++-------
 3 files changed, 3 insertions(+), 26 deletions(-)

New commits:
commit 0143fd51480169696efb565f5c1da12364b185ff
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Dec 16 13:44:49 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Mon Dec 16 19:07:35 2024 +0100

    svtools a11y: Switch OSL_ENSURE to assert
    
    Change-Id: I5391cd0a23c28d1df30f2f4f87701156e25f34b3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178586
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 15685e7edc83..d178ca1f4897 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -2744,7 +2744,7 @@ void Ruler::DrawTicks()
 uno::Reference< XAccessible > Ruler::CreateAccessible()
 {
     vcl::Window* pParent = GetAccessibleParentWindow();
-    OSL_ENSURE( pParent, "-SvxRuler::CreateAccessible(): No Parent!" );
+    assert(pParent && "Ruler::CreateAccessible(): No Parent!");
     uno::Reference< XAccessible >   xAccParent  = pParent->GetAccessible();
     if( xAccParent.is() )
     {
commit 4b55d5ab1566ac64fc432d8c9e62c346441730cb
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Dec 16 13:42:51 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Mon Dec 16 19:07:28 2024 +0100

    svtools a11y: Simplify Ruler::CreateAccessible
    
    Ruler::mxAccContext is only used in this method
    and nowhere else, so there's no need to have
    this as a class member. (The vcl::Window
    base class already holds a Reference to the
    XAccessible, s. below.)
    
    There's no need to explicitly call
    vcl::Window::SetAccessible, because
    Ruler::CreateAccessible gets called
    by Window::GetAccessible, and that already
    sets `mpWindowImpl->mxAccessible`, which
    is what vcl::Window::SetAccessible also does.
    
    Drop the
    
        // MT: Fixed compiler issue because the address from a temporary object 
was used.
        // BUT: Should it really be a Pointer, instead of const&???
    
    comment for which it's unclear what it refers to now,
    neither is it clear to me when looking at the
    commit that originally introduced it,
    
        commit b755fb8c0f6b1282f62c12f378c0a5ecac64d490
        Author: Steve Yin <stev...@apache.org>
        Date:   Mon Nov 25 16:15:58 2013 +0000
    
            Integrate branch of IAccessible2
    
    Change-Id: Ic423d0fcc97894303c29097023742f2dabf00b79
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178585
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx
index f32f37688225..2cabded3b1be 100644
--- a/include/svtools/ruler.hxx
+++ b/include/svtools/ruler.hxx
@@ -654,8 +654,6 @@ private:
     std::unique_ptr<RulerSelection> mxCurrentHitTest;
     std::unique_ptr<RulerSelection> mxPreviousHitTest;
 
-    rtl::Reference<SvtRulerAccessible> mxAccContext;
-
     std::map<OUString, SalLayoutGlyphs> maTextGlyphs;
 
     SVT_DLLPRIVATE void ImplVDrawLine(vcl::RenderContext& rRenderContext,  
tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2 );
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index d4f75c69bfce..15685e7edc83 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -285,7 +285,6 @@ void Ruler::dispose()
 {
     mpSaveData.reset();
     mpDragData.reset();
-    mxAccContext.clear();
     Window::dispose();
 }
 
@@ -2749,8 +2748,6 @@ uno::Reference< XAccessible > Ruler::CreateAccessible()
     uno::Reference< XAccessible >   xAccParent  = pParent->GetAccessible();
     if( xAccParent.is() )
     {
-        // MT: Fixed compiler issue because the address from a temporary 
object was used.
-        // BUT: Should it really be a Pointer, instead of const&???
         OUString aStr;
         if ( mnWinStyle & WB_HORZ )
         {
@@ -2760,9 +2757,7 @@ uno::Reference< XAccessible > Ruler::CreateAccessible()
         {
             aStr = SvtResId(STR_SVT_ACC_RULER_VERT_NAME);
         }
-        mxAccContext = new SvtRulerAccessible( xAccParent, *this, aStr );
-        SetAccessible(mxAccContext);
-        return mxAccContext;
+        return new SvtRulerAccessible(xAccParent, *this, aStr);
     }
     else
         return uno::Reference< XAccessible >();
commit 8af53caecef4d7b0add1823a4a1f8be5907679b2
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Dec 16 12:18:09 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Mon Dec 16 19:07:22 2024 +0100

    a11y: Drop special menu/toolbar handling in AccessibleFactory
    
    IIUC, this code path should never be reached:
    
    The accessible for menu and menu floating windows
    gets created in Menu::CreateAccessible. The
    menu floating window reuses the Menu's accessible
    and if the code path dropped in this commit was ever
    reached for menu floating windows, it would be problematic,
    see the commit messsage of
    
        commit b608604d0bbecdc24a17175374581b4e2d720658
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Thu Dec 5 14:07:52 2024 +0000
    
            tdf#164093 tdf#157001 wina11y: Use vcl::Window's actual XAccessible
    
    for more details.
    
    Implementation for floating toolbar windows to have a null
    XAccessible is implemented in ImplPopupFloatWin::CreateAccessible,
    so that case also shouldn't get here (where a null XAccessibleContext
    would have been returned).
    
    Change-Id: Ie9a55b4120a6857e9cac534fa2bdfd3a0cf7d9c9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178584
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/accessibility/source/helper/acc_factory.cxx 
b/accessibility/source/helper/acc_factory.cxx
index e3ce283d0ed8..75d4bd13e6db 100644
--- a/accessibility/source/helper/acc_factory.cxx
+++ b/accessibility/source/helper/acc_factory.cxx
@@ -282,21 +282,7 @@ Reference< XAccessibleContext > 
AccessibleFactory::createAccessibleContext(vcl::
 
     WindowType nType = pWindow->GetType();
 
-    if ( nType == WindowType::MENUBARWINDOW || pWindow->IsMenuFloatingWindow() 
|| pWindow->IsToolbarFloatingWindow() )
-    {
-        Reference< XAccessible > xAcc( pWindow->GetAccessible() );
-        if ( xAcc.is() )
-        {
-            Reference<XAccessibleContext > 
xContext(xAcc->getAccessibleContext());
-            if ( pWindow->GetType() == WindowType::MENUBARWINDOW ||
-                ( xContext.is() && xContext->getAccessibleRole() == 
AccessibleRole::POPUP_MENU ) )
-            {
-                return xContext;
-            }
-        }
-    }
-
-    else if ( nType == WindowType::STATUSBAR )
+    if ( nType == WindowType::STATUSBAR )
     {
         return new VCLXAccessibleStatusBar(pWindow);
     }
@@ -329,8 +315,6 @@ Reference< XAccessibleContext > 
AccessibleFactory::createAccessibleContext(vcl::
     {
         return new VCLXAccessibleComponent(pWindow);
     }
-
-    return nullptr;
 }
 
 Reference< XAccessibleContext > 
AccessibleFactory::createAccessibleContext(ToolBox* pToolBox)

Reply via email to