diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-27 12:15:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-28 06:43:03 +0100 |
commit | 6658a384245f04b433fb540c757b9bd9be43e1c3 (patch) | |
tree | 5a37bf9d349caedfcc3a5cee74b58ec47fe61a74 /accessibility/source | |
parent | 7510cca63690ea97eb02a43f698fc183c3d0434a (diff) |
convert VCLXAccessibleListItem to comphelper::WeakComponentImplHelper
Change-Id: I82b7dd9b0cdf379c710870a295c8f33ed9fff681
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165437
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'accessibility/source')
-rw-r--r-- | accessibility/source/standard/vclxaccessiblelistitem.cxx | 90 |
1 files changed, 38 insertions, 52 deletions
diff --git a/accessibility/source/standard/vclxaccessiblelistitem.cxx b/accessibility/source/standard/vclxaccessiblelistitem.cxx index 5339f93824a9..31b889ebc3b5 100644 --- a/accessibility/source/standard/vclxaccessiblelistitem.cxx +++ b/accessibility/source/standard/vclxaccessiblelistitem.cxx @@ -60,8 +60,7 @@ using namespace ::com::sun::star; // Ctor() and Dtor() VCLXAccessibleListItem::VCLXAccessibleListItem(sal_Int32 _nIndexInParent, rtl::Reference< VCLXAccessibleList > _xParent) - : VCLXAccessibleListItem_BASE(m_aMutex) - , m_nIndexInParent(_nIndexInParent) + : m_nIndexInParent(_nIndexInParent) , m_bSelected(false) , m_bVisible(false) , m_nClientId(0) @@ -142,26 +141,25 @@ Sequence< sal_Int8 > VCLXAccessibleListItem::getImplementationId() // XComponent -void SAL_CALL VCLXAccessibleListItem::disposing() +void VCLXAccessibleListItem::disposing(std::unique_lock<std::mutex>& rGuard) { - comphelper::AccessibleEventNotifier::TClientId nId( 0 ); - Reference< XInterface > xEventSource; - { - ::osl::MutexGuard aGuard( m_aMutex ); - - VCLXAccessibleListItem_BASE::disposing(); - m_sEntryText.clear(); - m_xParent = nullptr; + VCLXAccessibleListItem_BASE::disposing(rGuard); - nId = m_nClientId; - m_nClientId = 0; - if ( nId ) - xEventSource = *this; - } + m_sEntryText.clear(); + m_xParent = nullptr; + comphelper::AccessibleEventNotifier::TClientId nId = m_nClientId; + m_nClientId = 0; + Reference< XInterface > xEventSource; + if ( nId ) + xEventSource = *this; // Send a disposing to all listeners. if ( nId ) - comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this ); + { + rGuard.unlock(); + comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this ); + rGuard.lock(); + } } // XServiceInfo @@ -204,7 +202,7 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleListItem::getAccessibleChild( sa Reference< XAccessible > SAL_CALL VCLXAccessibleListItem::getAccessibleParent( ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return m_xParent; } @@ -228,7 +226,7 @@ OUString SAL_CALL VCLXAccessibleListItem::getAccessibleDescription( ) OUString SAL_CALL VCLXAccessibleListItem::getAccessibleName( ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); // entry text == accessible name return m_sEntryText; @@ -241,11 +239,11 @@ Reference< XAccessibleRelationSet > SAL_CALL VCLXAccessibleListItem::getAccessib sal_Int64 SAL_CALL VCLXAccessibleListItem::getAccessibleStateSet( ) { - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); sal_Int64 nStateSet = 0; - if ( !rBHelper.bDisposed && !rBHelper.bInDispose ) + if ( !m_bDisposed ) { nStateSet |= AccessibleStateType::TRANSIENT; @@ -274,7 +272,7 @@ sal_Int64 SAL_CALL VCLXAccessibleListItem::getAccessibleStateSet( ) Locale SAL_CALL VCLXAccessibleListItem::getLocale( ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return implGetLocale(); } @@ -284,7 +282,7 @@ Locale SAL_CALL VCLXAccessibleListItem::getLocale( ) sal_Bool SAL_CALL VCLXAccessibleListItem::containsPoint( const awt::Point& _aPoint ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); bool bInside = false; ::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; @@ -305,7 +303,7 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleListItem::getAccessibleAtPoint( awt::Rectangle SAL_CALL VCLXAccessibleListItem::getBounds( ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); awt::Rectangle aRect; ::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; @@ -318,7 +316,7 @@ awt::Rectangle SAL_CALL VCLXAccessibleListItem::getBounds( ) awt::Point SAL_CALL VCLXAccessibleListItem::getLocation( ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); Point aPoint(0,0); ::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; @@ -333,7 +331,7 @@ awt::Point SAL_CALL VCLXAccessibleListItem::getLocation( ) awt::Point SAL_CALL VCLXAccessibleListItem::getLocationOnScreen( ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); Point aPoint(0,0); ::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; @@ -349,7 +347,7 @@ awt::Point SAL_CALL VCLXAccessibleListItem::getLocationOnScreen( ) awt::Size SAL_CALL VCLXAccessibleListItem::getSize( ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); Size aSize; ::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; @@ -374,7 +372,7 @@ sal_Int32 SAL_CALL VCLXAccessibleListItem::getCaretPosition() sal_Bool SAL_CALL VCLXAccessibleListItem::setCaretPosition( sal_Int32 nIndex ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); if ( !implIsValidRange( nIndex, nIndex, m_sEntryText.getLength() ) ) throw IndexOutOfBoundsException(); @@ -385,7 +383,7 @@ sal_Bool SAL_CALL VCLXAccessibleListItem::setCaretPosition( sal_Int32 nIndex ) sal_Unicode SAL_CALL VCLXAccessibleListItem::getCharacter( sal_Int32 nIndex ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return OCommonAccessibleText::implGetCharacter( m_sEntryText, nIndex ); } @@ -393,7 +391,7 @@ sal_Unicode SAL_CALL VCLXAccessibleListItem::getCharacter( sal_Int32 nIndex ) Sequence< PropertyValue > SAL_CALL VCLXAccessibleListItem::getCharacterAttributes( sal_Int32 nIndex, const Sequence< OUString >& ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); if ( !implIsValidIndex( nIndex, m_sEntryText.getLength() ) ) throw IndexOutOfBoundsException(); @@ -404,7 +402,7 @@ Sequence< PropertyValue > SAL_CALL VCLXAccessibleListItem::getCharacterAttribute awt::Rectangle SAL_CALL VCLXAccessibleListItem::getCharacterBounds( sal_Int32 nIndex ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); if ( !implIsValidIndex( nIndex, m_sEntryText.getLength() ) ) throw IndexOutOfBoundsException(); @@ -424,8 +422,7 @@ awt::Rectangle SAL_CALL VCLXAccessibleListItem::getCharacterBounds( sal_Int32 nI sal_Int32 SAL_CALL VCLXAccessibleListItem::getCharacterCount() { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return m_sEntryText.getLength(); } @@ -433,7 +430,7 @@ sal_Int32 SAL_CALL VCLXAccessibleListItem::getCharacterCount() sal_Int32 SAL_CALL VCLXAccessibleListItem::getIndexAtPoint( const awt::Point& aPoint ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); sal_Int32 nIndex = -1; ::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; @@ -452,32 +449,22 @@ sal_Int32 SAL_CALL VCLXAccessibleListItem::getIndexAtPoint( const awt::Point& aP OUString SAL_CALL VCLXAccessibleListItem::getSelectedText() { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - return OUString(); } sal_Int32 SAL_CALL VCLXAccessibleListItem::getSelectionStart() { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } sal_Int32 SAL_CALL VCLXAccessibleListItem::getSelectionEnd() { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - return 0; } sal_Bool SAL_CALL VCLXAccessibleListItem::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); if ( !implIsValidRange( nStartIndex, nEndIndex, m_sEntryText.getLength() ) ) throw IndexOutOfBoundsException(); @@ -487,8 +474,7 @@ sal_Bool SAL_CALL VCLXAccessibleListItem::setSelection( sal_Int32 nStartIndex, s OUString SAL_CALL VCLXAccessibleListItem::getText() { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return m_sEntryText; } @@ -496,7 +482,7 @@ OUString SAL_CALL VCLXAccessibleListItem::getText() OUString SAL_CALL VCLXAccessibleListItem::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return OCommonAccessibleText::implGetTextRange( m_sEntryText, nStartIndex, nEndIndex ); } @@ -504,7 +490,7 @@ OUString SAL_CALL VCLXAccessibleListItem::getTextRange( sal_Int32 nStartIndex, s css::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return OCommonAccessibleText::getTextAtIndex( nIndex, aTextType ); } @@ -512,7 +498,7 @@ css::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextAtIndex( css::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType ); } @@ -520,7 +506,7 @@ css::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextBeforeIn css::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); return OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType ); } @@ -528,7 +514,7 @@ css::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextBehindIn sal_Bool SAL_CALL VCLXAccessibleListItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) { SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + std::unique_lock aGuard( m_aMutex ); checkIndex_Impl( nStartIndex, m_sEntryText ); checkIndex_Impl( nEndIndex, m_sEntryText ); |