sw/source/uibase/docvw/SidebarWinAcc.cxx |   10 ++++------
 sw/source/uibase/docvw/SidebarWinAcc.hxx |    5 ++++-
 2 files changed, 8 insertions(+), 7 deletions(-)

New commits:
commit e2cd6cd7cb4457b07471c52533b73b155aa98198
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Dec 12 16:55:01 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Dec 12 23:02:04 2024 +0100

    sw a11y: Pass the VCLXWindow to SidebarWinAccessibleContext ctor
    
    SwAnnotationWin::CreateAccessible returns the very
    object that is calling the SidebarWinAccessibleContext
    ctor.
    
    Make that more obvious by passing it as a param instead
    of calling SwAnnotationWin::CreateAccessible and then
    dynamic_casting that to a VCLXWindow.
    
    Change-Id: Id2ef80c7e5540276548c635cf550a552302b2fcc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178383
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sw/source/uibase/docvw/SidebarWinAcc.cxx 
b/sw/source/uibase/docvw/SidebarWinAcc.cxx
index d51d6848b429..0e3ad3a69e6f 100644
--- a/sw/source/uibase/docvw/SidebarWinAcc.cxx
+++ b/sw/source/uibase/docvw/SidebarWinAcc.cxx
@@ -31,8 +31,8 @@ namespace sw::sidebarwindows {
 // implementation of accessible context for <SidebarWinAccessible> instance
 SidebarWinAccessibleContext::SidebarWinAccessibleContext(
     sw::annotation::SwAnnotationWin& rSidebarWin, SwViewShell& rViewShell,
-    const SwFrame* pAnchorFrame)
-    : 
VCLXAccessibleComponent(dynamic_cast<VCLXWindow*>(rSidebarWin.CreateAccessible().get()))
+    const SwFrame* pAnchorFrame, SidebarWinAccessible* pSidebarWinAccessible)
+    : VCLXAccessibleComponent(pSidebarWinAccessible)
     , mrViewShell(rViewShell)
     , mpAnchorFrame(pAnchorFrame)
 {
@@ -111,10 +111,8 @@ void SidebarWinAccessible::ChangeSidebarItem( const 
SwSidebarItem& rSidebarItem
 
 css::uno::Reference< css::accessibility::XAccessibleContext > 
SidebarWinAccessible::CreateAccessibleContext()
 {
-    rtl::Reference<SidebarWinAccessibleContext> pAccContext =
-                                new SidebarWinAccessibleContext( mrSidebarWin,
-                                                                 mrViewShell,
-                                                                 mpAnchorFrame 
);
+    rtl::Reference<SidebarWinAccessibleContext> pAccContext
+        = new SidebarWinAccessibleContext(mrSidebarWin, mrViewShell, 
mpAnchorFrame, this);
     m_bAccContextCreated = true;
     return pAccContext;
 }
diff --git a/sw/source/uibase/docvw/SidebarWinAcc.hxx 
b/sw/source/uibase/docvw/SidebarWinAcc.hxx
index b3c7dfa79700..189905f7d5fa 100644
--- a/sw/source/uibase/docvw/SidebarWinAcc.hxx
+++ b/sw/source/uibase/docvw/SidebarWinAcc.hxx
@@ -29,11 +29,14 @@ namespace sw::annotation { class SwAnnotationWin; }
 
 namespace sw::sidebarwindows {
 
+class SidebarWinAccessible;
+
 class SidebarWinAccessibleContext : public VCLXAccessibleComponent
 {
 public:
     explicit SidebarWinAccessibleContext(sw::annotation::SwAnnotationWin& 
rSidebarWin,
-                                         SwViewShell& rViewShell, const 
SwFrame* pAnchorFrame);
+                                         SwViewShell& rViewShell, const 
SwFrame* pAnchorFrame,
+                                         SidebarWinAccessible* 
pSidebarWinAccessible);
 
     void ChangeAnchor(const SwFrame* pAnchorFrame);
 

Reply via email to