basctl/source/accessibility/accessibledialogcontrolshape.cxx | 2 basctl/source/accessibility/accessibledialogwindow.cxx | 2 chart2/source/controller/accessibility/AccessibleBase.cxx | 40 +++------- chart2/source/controller/accessibility/AccessibleChartElement.cxx | 4 - chart2/source/controller/accessibility/AccessibleChartShape.cxx | 2 chart2/source/controller/inc/AccessibleBase.hxx | 9 -- include/editeng/AccessibleContextBase.hxx | 2 7 files changed, 18 insertions(+), 43 deletions(-)
New commits: commit 45d5a34ba4d9f44811aa42274de3904f915196da Author: Michael Weghorn <[email protected]> AuthorDate: Mon Mar 31 10:17:27 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Apr 1 11:19:26 2025 +0200 editeng a11y: Fix interface names in doc Change-Id: I02f000b574165d9a8e068dd29e3dbd7e902f0b65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183539 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/include/editeng/AccessibleContextBase.hxx b/include/editeng/AccessibleContextBase.hxx index 21ec7335102c..cc5b023065bb 100644 --- a/include/editeng/AccessibleContextBase.hxx +++ b/include/editeng/AccessibleContextBase.hxx @@ -38,7 +38,7 @@ namespace accessibility { /** @descr This base class provides an implementation of the AccessibleContext service. Apart from the - <type>XXAccessible<type> and XAccessibleContextContext + <type>XAccessible<type> and XAccessibleContext interfaces it supports the XServiceInfo interface. */ class EDITENG_DLLPUBLIC AccessibleContextBase commit a3af74ab9f2ff5cba9a35c20eff96a037072f966 Author: Michael Weghorn <[email protected]> AuthorDate: Mon Mar 31 09:37:46 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Apr 1 11:19:20 2025 +0200 basctl a11y: Use OCommonAccessibleComponent::isAlive helper Change-Id: I2cc920d7fcb772000f6c31367602cbdecd56f324 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183538 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx index ce65b97f819d..7f2b16403032 100644 --- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx +++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx @@ -398,7 +398,7 @@ sal_Int64 AccessibleDialogControlShape::getAccessibleStateSet( ) sal_Int64 nStateSet = 0; - if ( !rBHelper.bDisposed && !rBHelper.bInDispose ) + if (isAlive()) { FillAccessibleStateSet( nStateSet ); } diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx index be36c4e4485b..fe6d87972ac9 100644 --- a/basctl/source/accessibility/accessibledialogwindow.cxx +++ b/basctl/source/accessibility/accessibledialogwindow.cxx @@ -645,7 +645,7 @@ sal_Int64 AccessibleDialogWindow::getAccessibleStateSet( ) sal_Int64 nStateSet = 0; - if ( !rBHelper.bDisposed && !rBHelper.bInDispose ) + if (isAlive()) { FillAccessibleStateSet( nStateSet ); } commit 24f207d4fe604e0b95590da5b2dff85739599cfa Author: Michael Weghorn <[email protected]> AuthorDate: Mon Mar 31 09:25:27 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Apr 1 11:19:14 2025 +0200 chart a11y: Reuse base class logic to check disposed state Change-Id: I79c95519ee5ba76f68bff6984e3659abdea9ce60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183537 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx index bd04a69afb67..e28b1ea62fed 100644 --- a/chart2/source/controller/accessibility/AccessibleBase.cxx +++ b/chart2/source/controller/accessibility/AccessibleBase.cxx @@ -66,7 +66,6 @@ AccessibleBase::AccessibleBase( AccessibleElementInfo aAccInfo, bool bMayHaveChildren, bool bAlwaysTransparent /* default: false */ ) : - m_bIsDisposed( false ), m_bMayHaveChildren( bMayHaveChildren ), m_bChildrenInitialized( false ), m_nStateSet( 0 ), @@ -84,18 +83,7 @@ AccessibleBase::AccessibleBase( AccessibleBase::~AccessibleBase() { - OSL_ASSERT( m_bIsDisposed ); -} - -bool AccessibleBase::CheckDisposeState( bool bThrowException /* default: true */ ) const -{ - if( bThrowException && - m_bIsDisposed ) - { - throw lang::DisposedException(u"component has state DEFUNC"_ustr, - static_cast< uno::XWeak * >( const_cast< AccessibleBase * >( this ))); - } - return m_bIsDisposed; + OSL_ASSERT(!isAlive()); } bool AccessibleBase::NotifyEvent( EventType eEventType, const AccessibleUniqueId & rId ) @@ -159,13 +147,13 @@ bool AccessibleBase::NotifyEvent( EventType eEventType, const AccessibleUniqueId void AccessibleBase::AddState( sal_Int64 aState ) { - CheckDisposeState(); + ensureAlive(); m_nStateSet |= aState; } void AccessibleBase::RemoveState( sal_Int64 aState ) { - CheckDisposeState(); + ensureAlive(); m_nStateSet &= ~aState; } @@ -174,8 +162,7 @@ bool AccessibleBase::UpdateChildren() bool bMustUpdateChildren = false; { MutexGuard aGuard( m_aMutex ); - if( ! m_bMayHaveChildren || - m_bIsDisposed ) + if (!m_bMayHaveChildren || !isAlive()) return false; bMustUpdateChildren = ( m_bMayHaveChildren && @@ -363,7 +350,7 @@ void SAL_CALL AccessibleBase::disposing() { { MutexGuard aGuard(m_aMutex); - OSL_ENSURE(!m_bIsDisposed, "dispose() called twice"); + OSL_ENSURE(isAlive(), "dispose() called twice"); OAccessibleExtendedComponentHelper::disposing(); @@ -373,8 +360,6 @@ void SAL_CALL AccessibleBase::disposing() m_nStateSet = AccessibleStateType::DEFUNC; - m_bIsDisposed = true; - } // call listeners unguarded @@ -396,8 +381,7 @@ Reference< XAccessibleContext > SAL_CALL AccessibleBase::getAccessibleContext() sal_Int64 SAL_CALL AccessibleBase::getAccessibleChildCount() { ClearableMutexGuard aGuard( m_aMutex ); - if( ! m_bMayHaveChildren || - m_bIsDisposed ) + if (!m_bMayHaveChildren || !isAlive()) return 0; bool bMustUpdateChildren = ( m_bMayHaveChildren && @@ -419,7 +403,7 @@ sal_Int64 AccessibleBase::ImplGetAccessibleChildCount() const Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleChild( sal_Int64 i ) { - CheckDisposeState(); + ensureAlive(); Reference< XAccessible > xResult; ClearableMutexGuard aGuard( m_aMutex ); @@ -461,7 +445,7 @@ Reference< XAccessible > AccessibleBase::ImplGetAccessibleChildById( sal_Int64 i Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleParent() { - CheckDisposeState(); + ensureAlive(); Reference< XAccessible > aResult; if( m_aAccInfo.m_pParent ) aResult.set( m_aAccInfo.m_pParent ); @@ -471,7 +455,7 @@ Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleParent() sal_Int64 SAL_CALL AccessibleBase::getAccessibleIndexInParent() { - CheckDisposeState(); + ensureAlive(); if( m_aAccInfo.m_spObjectHierarchy ) return m_aAccInfo.m_spObjectHierarchy->getIndexInParent( GetId() ); @@ -511,7 +495,7 @@ sal_Int64 SAL_CALL AccessibleBase::getAccessibleStateSet() lang::Locale SAL_CALL AccessibleBase::getLocale() { - CheckDisposeState(); + ensureAlive(); return Application::GetSettings().GetLanguageTag().getLocale(); } @@ -520,7 +504,7 @@ lang::Locale SAL_CALL AccessibleBase::getLocale() Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleAtPoint( const awt::Point& aPoint ) { - CheckDisposeState(); + ensureAlive(); rtl::Reference< AccessibleBase > aResult; awt::Rectangle aRect( implGetBounds()); @@ -590,7 +574,7 @@ css::awt::Rectangle AccessibleBase::implGetBounds() void SAL_CALL AccessibleBase::grabFocus() { - CheckDisposeState(); + ensureAlive(); rtl::Reference< ::chart::ChartController > xSelSupp( GetInfo().m_xChartController ); if ( xSelSupp.is() ) diff --git a/chart2/source/controller/accessibility/AccessibleChartElement.cxx b/chart2/source/controller/accessibility/AccessibleChartElement.cxx index cb8ec98eff72..00d59a712632 100644 --- a/chart2/source/controller/accessibility/AccessibleChartElement.cxx +++ b/chart2/source/controller/accessibility/AccessibleChartElement.cxx @@ -50,7 +50,7 @@ AccessibleChartElement::AccessibleChartElement( AccessibleChartElement::~AccessibleChartElement() { - OSL_ASSERT( CheckDisposeState( false /* don't throw exceptions */ ) ); + OSL_ASSERT(!isAlive()); } // ________ protected ________ @@ -141,7 +141,7 @@ OUString SAL_CALL AccessibleChartElement::getAccessibleDescription() OUString SAL_CALL AccessibleChartElement::getToolTipText() { - CheckDisposeState(); + ensureAlive(); return ObjectNameProvider::getHelpText( GetInfo().m_aOID.getObjectCID(), GetInfo().m_xChartDocument ); diff --git a/chart2/source/controller/accessibility/AccessibleChartShape.cxx b/chart2/source/controller/accessibility/AccessibleChartShape.cxx index f415748323ea..194f3f47bc7f 100644 --- a/chart2/source/controller/accessibility/AccessibleChartShape.cxx +++ b/chart2/source/controller/accessibility/AccessibleChartShape.cxx @@ -63,7 +63,7 @@ AccessibleChartShape::AccessibleChartShape( AccessibleChartShape::~AccessibleChartShape() { - OSL_ASSERT( CheckDisposeState( false /* don't throw exceptions */ ) ); + OSL_ASSERT(!isAlive()); if ( m_pAccShape.is() ) { diff --git a/chart2/source/controller/inc/AccessibleBase.hxx b/chart2/source/controller/inc/AccessibleBase.hxx index a491f98771f5..f2b8f5d99717 100644 --- a/chart2/source/controller/inc/AccessibleBase.hxx +++ b/chart2/source/controller/inc/AccessibleBase.hxx @@ -93,14 +93,6 @@ protected: // for all calls to protected methods it is assumed that the mutex is locked // unless calls outside via UNO, e.g. event notification, are done - /** @param bThrowException if true, a DisposedException is thrown if the - object is already disposed - @return true, if the component is already disposed and bThrowException is false, - false otherwise - @throws css::lang::DisposedException - */ - bool CheckDisposeState( bool bThrowException = true ) const; - /** Events coming from the core have to be processed in this methods. The default implementation returns false, which indicates that the object is not interested in the event. To react on events you have to implement @@ -256,7 +248,6 @@ private: */ typedef std::map<ObjectIdentifier, rtl::Reference<AccessibleBase>> ChildOIDMap; - bool m_bIsDisposed; const bool m_bMayHaveChildren; bool m_bChildrenInitialized; std::vector<rtl::Reference<AccessibleBase>> m_aChildList;
