svx/source/accessibility/GraphCtlAccessibleContext.cxx |  192 +----------------
 svx/source/dialog/graphctl.cxx                         |    4 
 svx/source/inc/GraphCtlAccessibleContext.hxx           |   42 ---
 3 files changed, 34 insertions(+), 204 deletions(-)

New commits:
commit 62b8ebe343ec49756fdbfddd0f22cb0b15296747
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Feb 12 13:15:52 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Feb 12 20:05:08 2025 +0100

    GraphCtrl a11y: Use comphelper::OAccessibleComponentHelper
    
    Turn SvxGraphCtrlAccessibleContext into a 
comphelper::OAccessibleComponentHelper
    subclass.
    
    comphelper::OAccessibleComponentHelper already implements
    the logic for event handling and most of the location/bounds handling,
    so avoid reimplementing it in SvxGraphCtrlAccessibleContext.
    
    No longer manually call `dispose()` from the SvxGraphCtrlAccessibleContext
    dtor, as the OCommonAccessibleComponent base class dtor already calls
    `ensureDisposed()`. Drop SvxGraphCtrlAccessibleContext::mbDisposed
    and use methods from the base class instead to check whether
    the object has been disposed already.
    
    No change in behavior seen when testing with Accerciser with
    the steps described in previous commit
    
        Change-Id: I876af36f3a583f054da2804151bbe3208e1bbdbf
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Wed Feb 12 12:58:01 2025 +0100
    
            GraphCtrl a11y: Create the accessible object again
    
    Change-Id: Idfa69c97e57598fc8fcc1bf390cf607510d6f53a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181487
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx 
b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
index e51c8f6f6826..1bd4285c808b 100644
--- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx
+++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
@@ -54,15 +54,10 @@ using namespace ::com::sun::star::accessibility;
 
 // internal
 /** initialize this component and set default values */
-SvxGraphCtrlAccessibleContext::SvxGraphCtrlAccessibleContext(
-    GraphCtrl&                   rRepr ) :
-
-    SvxGraphCtrlAccessibleContext_Base( m_aMutex ),
-    mpControl( &rRepr ),
-    mpPage (nullptr),
-    mpView (nullptr),
-    mnClientId( 0 ),
-    mbDisposed( false )
+SvxGraphCtrlAccessibleContext::SvxGraphCtrlAccessibleContext(GraphCtrl& rRepr)
+    : mpControl(&rRepr)
+    , mpPage(nullptr)
+    , mpView(nullptr)
 {
     if (mpControl != nullptr)
     {
@@ -73,9 +68,7 @@ SvxGraphCtrlAccessibleContext::SvxGraphCtrlAccessibleContext(
 
         if (pModel == nullptr || mpPage == nullptr || mpView == nullptr)
         {
-            mbDisposed = true;
-            // Set all the pointers to NULL just in case they are used as
-            // a disposed flag.
+            // Set all the pointers to NULL
             mpPage = nullptr;
             mpView = nullptr;
         }
@@ -88,15 +81,6 @@ SvxGraphCtrlAccessibleContext::SvxGraphCtrlAccessibleContext(
     }
 }
 
-
-/** on destruction, this component is disposed and all dispose listeners
-    are called, except if this component was already disposed */
-SvxGraphCtrlAccessibleContext::~SvxGraphCtrlAccessibleContext()
-{
-    disposing();
-}
-
-
 /** returns the XAccessible interface for a given SdrObject.
     Multiple calls for the same SdrObject return the same XAccessible.
 */
@@ -149,18 +133,6 @@ Reference< XAccessibleContext > SAL_CALL 
SvxGraphCtrlAccessibleContext::getAcces
     return this;
 }
 
-// XAccessibleComponent
-sal_Bool SAL_CALL SvxGraphCtrlAccessibleContext::containsPoint( const 
awt::Point& rPoint )
-{
-    // no guard -> done in getSize()
-    awt::Size aSize (getSize());
-    return (rPoint.X >= 0)
-        && (rPoint.X < aSize.Width)
-        && (rPoint.Y >= 0)
-        && (rPoint.Y < aSize.Height);
-}
-
-
 Reference< XAccessible > SAL_CALL 
SvxGraphCtrlAccessibleContext::getAccessibleAtPoint( const awt::Point& rPoint )
 {
     ::osl::MutexGuard   aGuard( m_aMutex );
@@ -188,13 +160,8 @@ Reference< XAccessible > SAL_CALL 
SvxGraphCtrlAccessibleContext::getAccessibleAt
     return xAccessible;
 }
 
-awt::Rectangle SAL_CALL SvxGraphCtrlAccessibleContext::getBounds()
+awt::Rectangle SvxGraphCtrlAccessibleContext::implGetBounds()
 {
-    const SolarMutexGuard aSolarGuard;
-
-    if (nullptr == mpControl)
-        throw DisposedException();
-
     const Point         aOutPos;
     const Size          aOutSize( mpControl->GetOutputSizePixel() );
     awt::Rectangle      aRet;
@@ -207,65 +174,6 @@ awt::Rectangle SAL_CALL 
SvxGraphCtrlAccessibleContext::getBounds()
     return aRet;
 }
 
-awt::Point SAL_CALL SvxGraphCtrlAccessibleContext::getLocation()
-{
-    const SolarMutexGuard aSolarGuard;
-
-    if (nullptr == mpControl)
-        throw DisposedException();
-
-    const awt::Rectangle    aRect( getBounds() );
-    awt::Point              aRet;
-
-    aRet.X = aRect.X;
-    aRet.Y = aRect.Y;
-
-    return aRet;
-}
-
-awt::Point SAL_CALL SvxGraphCtrlAccessibleContext::getLocationOnScreen()
-{
-    const SolarMutexGuard aSolarGuard;
-
-    if (nullptr == mpControl)
-        throw DisposedException();
-
-    awt::Point aScreenLoc(0, 0);
-
-    auto xParent(getAccessibleParent());
-    if (xParent)
-    {
-        css::uno::Reference<css::accessibility::XAccessibleContext> 
xParentContext(xParent->getAccessibleContext());
-        css::uno::Reference<css::accessibility::XAccessibleComponent> 
xParentComponent(xParentContext, css::uno::UNO_QUERY);
-        OSL_ENSURE( xParentComponent.is(), "ValueSetAcc::getLocationOnScreen: 
no parent component!" );
-        if ( xParentComponent.is() )
-        {
-            awt::Point aParentScreenLoc( 
xParentComponent->getLocationOnScreen() );
-            awt::Point aOwnRelativeLoc( getLocation() );
-            aScreenLoc.X = aParentScreenLoc.X + aOwnRelativeLoc.X;
-            aScreenLoc.Y = aParentScreenLoc.Y + aOwnRelativeLoc.Y;
-        }
-    }
-
-    return aScreenLoc;
-}
-
-awt::Size SAL_CALL SvxGraphCtrlAccessibleContext::getSize()
-{
-    const SolarMutexGuard aSolarGuard;
-
-    if (nullptr == mpControl)
-        throw DisposedException();
-
-    const awt::Rectangle    aRect( getBounds() );
-    awt::Size               aRet;
-
-    aRet.Width = aRect.Width;
-    aRet.Height = aRect.Height;
-
-    return aRet;
-}
-
 // XAccessibleContext
 sal_Int64 SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleChildCount()
 {
@@ -299,14 +207,7 @@ void SvxGraphCtrlAccessibleContext::CommitChange (
     const uno::Any& rNewValue,
     const uno::Any& rOldValue)
 {
-    AccessibleEventObject aEvent (
-        getXWeak(),
-        nEventId,
-        rNewValue,
-        rOldValue, -1);
-
-    if (mnClientId)
-        comphelper::AccessibleEventNotifier::addEvent( mnClientId, aEvent );
+    NotifyAccessibleEvent(nEventId, rOldValue, rNewValue);
 }
 
 Reference< XAccessible > SAL_CALL 
SvxGraphCtrlAccessibleContext::getAccessibleChild( sal_Int64 nIndex )
@@ -393,7 +294,7 @@ sal_Int64 SAL_CALL 
SvxGraphCtrlAccessibleContext::getAccessibleStateSet()
 
     sal_Int64 nStateSet = 0;
 
-    if ( rBHelper.bDisposed || mbDisposed )
+    if (!isAlive())
     {
         nStateSet |= AccessibleStateType::DEFUNC;
     }
@@ -427,38 +328,6 @@ lang::Locale SAL_CALL 
SvxGraphCtrlAccessibleContext::getLocale()
     throw IllegalAccessibleComponentStateException();
 }
 
-// XAccessibleEventListener
-void SAL_CALL SvxGraphCtrlAccessibleContext::addAccessibleEventListener( const 
Reference< XAccessibleEventListener >& xListener )
-{
-    if (xListener.is())
-    {
-        ::SolarMutexGuard aGuard;
-        if (!mnClientId)
-            mnClientId = comphelper::AccessibleEventNotifier::registerClient( 
);
-        comphelper::AccessibleEventNotifier::addEventListener( mnClientId, 
xListener );
-    }
-}
-
-
-void SAL_CALL SvxGraphCtrlAccessibleContext::removeAccessibleEventListener( 
const Reference< XAccessibleEventListener >& xListener )
-{
-    if (!xListener.is())
-        return;
-
-    ::SolarMutexGuard aGuard;
-
-    sal_Int32 nListenerCount = 
comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener 
);
-    if ( !nListenerCount )
-    {
-        // no listeners anymore
-        // -> revoke ourself. This may lead to the notifier thread dying (if 
we were the last client),
-        // and at least to us not firing any events anymore, in case somebody 
calls
-        // NotifyAccessibleEvent, again
-        comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
-        mnClientId = 0;
-    }
-}
-
 void SAL_CALL SvxGraphCtrlAccessibleContext::grabFocus()
 {
     ::SolarMutexGuard aGuard;
@@ -645,10 +514,7 @@ void SvxGraphCtrlAccessibleContext::setModelAndView (
 
     if (mpPage == nullptr || mpView == nullptr)
     {
-        mbDisposed = true;
-
-        // Set all the pointers to NULL just in case they are used as
-        // a disposed flag.
+        // Set all the pointers to NULL
         mpPage = nullptr;
         mpView = nullptr;
     }
@@ -659,11 +525,9 @@ void SAL_CALL SvxGraphCtrlAccessibleContext::disposing()
 {
     ::SolarMutexGuard aGuard;
 
-    if( mbDisposed )
+    if (!isAlive())
         return;
 
-    mbDisposed = true;
-
     mpControl = nullptr;       // object dies with representation
     mpView = nullptr;
     mpPage = nullptr;
@@ -680,12 +544,7 @@ void SAL_CALL SvxGraphCtrlAccessibleContext::disposing()
         mxShapes.clear();
     }
 
-    // Send a disposing to all listeners.
-    if ( mnClientId )
-    {
-        comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( 
mnClientId, *this );
-        mnClientId =  0;
-    }
+    comphelper::OAccessibleComponentHelper::disposing();
 }
 
 void SvxGraphCtrlAccessibleContext::Notify( SfxBroadcaster& /*rBC*/, const 
SfxHint& rHint )
diff --git a/svx/source/inc/GraphCtlAccessibleContext.hxx 
b/svx/source/inc/GraphCtlAccessibleContext.hxx
index 9a99656ed475..5884b0961485 100644
--- a/svx/source/inc/GraphCtlAccessibleContext.hxx
+++ b/svx/source/inc/GraphCtlAccessibleContext.hxx
@@ -30,6 +30,7 @@
 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XServiceName.hpp>
+#include <comphelper/accessiblecomponenthelper.hxx>
 #include <cppuhelper/basemutex.hxx>
 #include <svl/lstner.hxx>
 
@@ -57,19 +58,13 @@ class SdrView;
         <code>AccessibleContext</code> service.
 */
 
-typedef ::cppu::WeakComponentImplHelper<
-                css::accessibility::XAccessible,
-                css::accessibility::XAccessibleComponent,
-                css::accessibility::XAccessibleContext,
-                css::accessibility::XAccessibleEventBroadcaster,
-                css::accessibility::XAccessibleSelection,
-                css::lang::XServiceInfo,
-                css::lang::XServiceName >
-                SvxGraphCtrlAccessibleContext_Base;
-
-class SvxGraphCtrlAccessibleContext final :
-    private cppu::BaseMutex, public SvxGraphCtrlAccessibleContext_Base,
-    public SfxListener, public ::accessibility::IAccessibleViewForwarder
+class SvxGraphCtrlAccessibleContext final
+    : public 
cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper,
+                                         css::accessibility::XAccessible,
+                                         
css::accessibility::XAccessibleSelection,
+                                         css::lang::XServiceInfo, 
css::lang::XServiceName>,
+      public SfxListener,
+      public ::accessibility::IAccessibleViewForwarder
 {
 public:
     friend class GraphCtrl;
@@ -85,12 +80,7 @@ public:
         getAccessibleContext() override;
 
     // XAccessibleComponent
-    virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& rPoint ) 
override;
     virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL 
getAccessibleAtPoint( const css::awt::Point& rPoint ) override;
-    virtual css::awt::Rectangle SAL_CALL getBounds() override;
-    virtual css::awt::Point SAL_CALL getLocation() override;
-    virtual css::awt::Point SAL_CALL getLocationOnScreen() override;
-    virtual css::awt::Size SAL_CALL getSize() override;
     virtual void SAL_CALL grabFocus() override;
 
     virtual sal_Int32 SAL_CALL getForeground() override;
@@ -109,10 +99,6 @@ public:
     virtual sal_Int64 SAL_CALL getAccessibleStateSet() override;
     virtual css::lang::Locale SAL_CALL getLocale() override;
 
-    // XAccessibleEventBroadcaster
-    virtual void SAL_CALL addAccessibleEventListener( const 
css::uno::Reference< css::accessibility::XAccessibleEventListener>& xListener) 
override;
-    virtual void SAL_CALL removeAccessibleEventListener(  const 
css::uno::Reference< css::accessibility::XAccessibleEventListener>& xListener) 
override;
-
     // XServiceInfo
     virtual OUString SAL_CALL getImplementationName() override;
     virtual sal_Bool SAL_CALL supportsService (const OUString& sServiceName) 
override;
@@ -143,8 +129,10 @@ public:
     */
     void setModelAndView (SdrModel* pModel, SdrView* pView);
 
+protected:
+    virtual css::awt::Rectangle implGetBounds() override;
+
 private:
-    virtual ~SvxGraphCtrlAccessibleContext() override;
     /// @throws css::lang::IndexOutOfBoundsException
     void checkChildIndexOnSelection(sal_Int64 nIndexOfChild );
 
@@ -175,11 +163,6 @@ private:
 
     SdrPage* mpPage;
     SdrView* mpView;
-
-    /// client id in the AccessibleEventNotifier queue
-    sal_uInt32 mnClientId;
-
-    bool mbDisposed;
 };
 
 #endif
commit 2b773f238be02f1c4f92977349928908454ecd7e
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Feb 12 12:58:01 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Feb 12 20:05:01 2025 +0100

    GraphCtrl a11y: Create the accessible object again
    
    Since
    
        commit 8a35ae3e6c5c45aa1426cfd81472b309d02a1b48
        Date:   Thu May 16 15:17:38 2019 +0100
    
            weld SvxIMapDlg
    
    , the null check in GraphCtrl::CreateAccessible
    prevented the accessible from getting created at all
    because the method now gets called from the
    SvxIMapDlg::SvxIMapDlg ctor, before the model
    and view are set. Backtrace:
    
        1   GraphCtrl::CreateAccessible                                         
                                                                                
                         graphctl.cxx          844  0x7ffff27e88bd
        2   weld::CustomWeld::CustomWeld                                        
                                                                                
                         customweld.cxx        24   0x7fffeeba2276
        3   SvxIMapDlg::SvxIMapDlg                                              
                                                                                
                         imapdlg.cxx           118  0x7ffff27fd237
        4   std::_Construct<SvxIMapDlg, SfxBindings *&, SvxIMapDlgChildWindow 
*, weld::Window *>                                                              
                           stl_construct.h       119  0x7ffff28078c6
        5   std::allocator_traits<std::allocator<void>>::construct<SvxIMapDlg, 
SfxBindings *&, SvxIMapDlgChildWindow *, weld::Window *>                        
                          alloc_traits.h        706  0x7ffff28074f5
        6   std::_Sp_counted_ptr_inplace<SvxIMapDlg, std::allocator<void>, 
(__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<SfxBindings *&, 
SvxIMapDlgChildWindow *, weld::Window *> shared_ptr_base.h     607  
0x7ffff28074f5
        7   
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<SvxIMapDlg, 
std::allocator<void>, SfxBindings *&, SvxIMapDlgChildWindow *, weld::Window *>  
                 shared_ptr_base.h     970  0x7ffff280727f
        8   std::__shared_ptr<SvxIMapDlg, 
(__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<void>, SfxBindings *&, 
SvxIMapDlgChildWindow *, weld::Window *>                       
shared_ptr_base.h     1713 0x7ffff28071ac
        9   std::shared_ptr<SvxIMapDlg>::shared_ptr<std::allocator<void>, 
SfxBindings *&, SvxIMapDlgChildWindow *, weld::Window *>                        
                               shared_ptr.h          463  0x7ffff280712a
        10  std::make_shared<SvxIMapDlg, SfxBindings *&, SvxIMapDlgChildWindow 
*, weld::Window *>                                                              
                          shared_ptr.h          1007 0x7ffff28037c9
        11  SvxIMapDlgChildWindow::SvxIMapDlgChildWindow                        
                                                                                
                         imapdlg.cxx           89   0x7ffff27fc8fc
        12  std::make_unique<SvxIMapDlgChildWindow, vcl::Window *&, unsigned 
short&, SfxBindings *&, SfxChildWinInfo *&>                                     
                            unique_ptr.h          1077 0x7ffff280368c
        13  SvxIMapDlgChildWindow::CreateImpl                                   
                                                                                
                         imapdlg.cxx           59   0x7ffff27fc484
        14  SfxChildWindow::CreateChildWindow                                   
                                                                                
                         childwin.cxx          242  0x7ffff3ac434f
        15  SfxWorkWindow::CreateChildWin_Impl                                  
                                                                                
                         workwin.cxx           1350 0x7ffff3b5fdcd
        16  SfxWorkWindow::UpdateChildWindows_Impl                              
                                                                                
                         workwin.cxx           1299 0x7ffff3b5fb36
        17  SfxWorkWindow::UpdateObjectBars_Impl2                               
                                                                                
                         workwin.cxx           1247 0x7ffff3b5f175
        18  SfxWorkWindow::UpdateObjectBars_Impl                                
                                                                                
                         workwin.cxx           1095 0x7ffff3b5e7a1
        19  SfxDispatcher::Update_Impl                                          
                                                                                
                         dispatch.cxx          1123 0x7ffff3bcad13
        20  SfxBaseController::ConnectSfxFrame_Impl                             
                                                                                
                         sfxbasecontroller.cxx 1207 0x7ffff42048a1
        ... <More>
    
    Drop the null check (model and view can later be set
    via SvxGraphCtrlAccessibleContext::setModelAndView
    which gets called from GraphCtrl::InitSdrModel).
    
    No longer try to initialize SvxGraphCtrlAccessibleContext::maTreeInfo
    in the ctor, but use a local variable in
    SvxGraphCtrlAccessibleContext::getAccessible (the only place
    where it gets read) instead, because the relevant
    SvxIMapDlg methods cannot be called before its ctor
    (see frame 3 in above backtrace) is done (resulting in a crash).
    
    With this in place, SvxGraphCtrlAccessibleContext now
    gets used again, which can be seen as follows when using
    the qt6 VCL plugin:
    
    1) start Writer
    2) insert an image
    3) select the image
    4) "Tools" -> "ImageMap"
    5) select the accessible object for the pane that shows the
       image in Accerciser's treeview
    
    It now has an accessible name of "Contour control"
    (RID_SVXSTR_GRAPHCTRL_ACC_NAME) again.
    
    Change-Id: I876af36f3a583f054da2804151bbe3208e1bbdbf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181486
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx 
b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
index 22fcbfbb9235..e51c8f6f6826 100644
--- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx
+++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
@@ -86,10 +86,6 @@ SvxGraphCtrlAccessibleContext::SvxGraphCtrlAccessibleContext(
         msName = SvxResId( RID_SVXSTR_GRAPHCTRL_ACC_NAME );
         msDescription = SvxResId( RID_SVXSTR_GRAPHCTRL_ACC_DESCRIPTION );
     }
-
-    maTreeInfo.SetSdrView( mpView );
-    
maTreeInfo.SetWindow(mpControl->GetDrawingArea()->get_ref_device().GetOwnerWindow());
-    maTreeInfo.SetViewForwarder( this );
 }
 
 
@@ -125,9 +121,13 @@ Reference< XAccessible > 
SvxGraphCtrlAccessibleContext::getAccessible( const Sdr
 
             css::uno::Reference<css::accessibility::XAccessible> 
xParent(getAccessibleParent());
             AccessibleShapeInfo aShapeInfo (xShape,xParent);
+            ::accessibility::AccessibleShapeTreeInfo aTreeInfo;
+            aTreeInfo.SetSdrView(mpView);
+            
aTreeInfo.SetWindow(mpControl->GetDrawingArea()->get_ref_device().GetOwnerWindow());
+            aTreeInfo.SetViewForwarder(this);
             // Create accessible object that corresponds to the descriptor's 
shape.
             rtl::Reference<AccessibleShape> 
pAcc(ShapeTypeHandler::Instance().CreateAccessibleObject(
-                aShapeInfo, maTreeInfo));
+                aShapeInfo, aTreeInfo));
             xAccessibleShape = pAcc.get();
             if (pAcc.is())
             {
@@ -652,8 +652,6 @@ void SvxGraphCtrlAccessibleContext::setModelAndView (
         mpPage = nullptr;
         mpView = nullptr;
     }
-
-    maTreeInfo.SetSdrView (mpView);
 }
 
 
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx
index 3d8d71f4d2e1..34145c88255a 100644
--- a/svx/source/dialog/graphctl.cxx
+++ b/svx/source/dialog/graphctl.cxx
@@ -840,9 +840,7 @@ css::uno::Reference< css::accessibility::XAccessible > 
GraphCtrl::CreateAccessib
 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
     if(mpAccContext == nullptr )
     {
-        // Disable accessibility if no model/view data available
-        if (pView && pModel)
-            mpAccContext = new SvxGraphCtrlAccessibleContext(*this);
+        mpAccContext = new SvxGraphCtrlAccessibleContext(*this);
     }
 #endif
     return mpAccContext;
diff --git a/svx/source/inc/GraphCtlAccessibleContext.hxx 
b/svx/source/inc/GraphCtlAccessibleContext.hxx
index b75986668c2e..9a99656ed475 100644
--- a/svx/source/inc/GraphCtlAccessibleContext.hxx
+++ b/svx/source/inc/GraphCtlAccessibleContext.hxx
@@ -158,8 +158,6 @@ private:
 
     css::uno::Reference< css::accessibility::XAccessible > getAccessible( 
const SdrObject* pObj );
 
-    ::accessibility::AccessibleShapeTreeInfo maTreeInfo;
-
     /** Description of this object.  This is not a constant because it can
         be set from the outside.
     */
commit 94d95182336b97c36c481f43bb4b780bcee0da89
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Feb 12 12:28:48 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Feb 12 20:04:55 2025 +0100

    GraphCtrl a11y: Drop SvxGraphCtrlAccessibleContext::mpModel
    
    No need to have a class member, as it is always first assigned
    before being read. Use local variables instead.
    
    Change-Id: I4c3262083f61c5484831ff20860dbf567624b94f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181485
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx 
b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
index be0594ed7327..22fcbfbb9235 100644
--- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx
+++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
@@ -59,7 +59,6 @@ SvxGraphCtrlAccessibleContext::SvxGraphCtrlAccessibleContext(
 
     SvxGraphCtrlAccessibleContext_Base( m_aMutex ),
     mpControl( &rRepr ),
-    mpModel (nullptr),
     mpPage (nullptr),
     mpView (nullptr),
     mnClientId( 0 ),
@@ -67,17 +66,16 @@ 
SvxGraphCtrlAccessibleContext::SvxGraphCtrlAccessibleContext(
 {
     if (mpControl != nullptr)
     {
-        mpModel = mpControl->GetSdrModel();
-        if (mpModel != nullptr)
-            mpPage = mpModel->GetPage( 0 );
+        SdrModel* pModel = mpControl->GetSdrModel();
+        if (pModel)
+            mpPage = pModel->GetPage(0);
         mpView = mpControl->GetSdrView();
 
-        if( mpModel == nullptr || mpPage == nullptr || mpView == nullptr )
+        if (pModel == nullptr || mpPage == nullptr || mpView == nullptr)
         {
             mbDisposed = true;
             // Set all the pointers to NULL just in case they are used as
             // a disposed flag.
-            mpModel = nullptr;
             mpPage = nullptr;
             mpView = nullptr;
         }
@@ -642,18 +640,15 @@ void SvxGraphCtrlAccessibleContext::setModelAndView (
 {
     ::SolarMutexGuard aGuard;
 
-    mpModel = pModel;
-    if (mpModel != nullptr)
-        mpPage = mpModel->GetPage( 0 );
+    mpPage = pModel ? pModel->GetPage(0) : nullptr;
     mpView = pView;
 
-    if (mpModel == nullptr || mpPage == nullptr || mpView == nullptr)
+    if (mpPage == nullptr || mpView == nullptr)
     {
         mbDisposed = true;
 
         // Set all the pointers to NULL just in case they are used as
         // a disposed flag.
-        mpModel = nullptr;
         mpPage = nullptr;
         mpView = nullptr;
     }
diff --git a/svx/source/inc/GraphCtlAccessibleContext.hxx 
b/svx/source/inc/GraphCtlAccessibleContext.hxx
index 3e328e9f89a3..b75986668c2e 100644
--- a/svx/source/inc/GraphCtlAccessibleContext.hxx
+++ b/svx/source/inc/GraphCtlAccessibleContext.hxx
@@ -175,7 +175,6 @@ private:
 
     GraphCtrl*  mpControl;
 
-    SdrModel* mpModel;
     SdrPage* mpPage;
     SdrView* mpView;
 

Reply via email to