diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-02-26 15:55:42 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-02-26 22:38:31 +0100 |
commit | 86dff3ca4e994f69bf9ba6656ac3e1164a29ca11 (patch) | |
tree | 488057edfbdeb04d825e1fef1544599b7a694930 /accessibility | |
parent | 625d22600d41a70f5c4a65bc75ef02b17c6cfae2 (diff) |
tdf#159910 a11y: Merge VCLXAccessibleToolBoxItem::{,impl}GetText
`VCLXAccessibleToolBoxItem::implGetText` was just calling
`VCLXAccessibleToolBoxItem::GetText`, and both of them
were used from different places.
Just move the implementation to `VCLXAccessibleToolBoxItem::implGetText`
right away, drop `VCLXAccessibleToolBoxItem::implGetText` and adjust
callers to unify this.
Change-Id: I0f4a4652f9e1259826a566d42b4b6998fc8ac7db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163958
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'accessibility')
-rw-r--r-- | accessibility/inc/standard/vclxaccessibletoolboxitem.hxx | 1 | ||||
-rw-r--r-- | accessibility/source/standard/vclxaccessibletoolboxitem.cxx | 57 |
2 files changed, 26 insertions, 32 deletions
diff --git a/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx b/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx index 5bff8ef95374..9676762d54bb 100644 --- a/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx +++ b/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx @@ -50,7 +50,6 @@ private: bool m_bIndeterminate; css::uno::Reference< css::accessibility::XAccessible > m_xChild; - OUString GetText() const; public: sal_Int32 getIndexInParent() const { return m_nIndexInParent; } diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx index 63ec17cdff7c..f8545eacc422 100644 --- a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx +++ b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx @@ -69,7 +69,7 @@ VCLXAccessibleToolBoxItem::VCLXAccessibleToolBoxItem( ToolBox* _pToolBox, sal_In { assert( m_pToolBox ); m_nItemId = m_pToolBox->GetItemId( m_nIndexInParent ); - m_sOldName = GetText(); + m_sOldName = implGetText(); m_bIsChecked = m_pToolBox->IsItemChecked( m_nItemId ); m_bIndeterminate = ( m_pToolBox->GetItemState( m_nItemId ) == TRISTATE_INDET ); ToolBoxItemType eType = m_pToolBox->GetItemType( m_nIndexInParent ); @@ -114,29 +114,6 @@ VCLXAccessibleToolBoxItem::~VCLXAccessibleToolBoxItem() { } -OUString VCLXAccessibleToolBoxItem::GetText() const -{ - // no text for separators and spaces - if (!m_pToolBox || m_nItemId <= ToolBoxItemId(0)) - return OUString(); - - OUString sRet = m_pToolBox->GetItemText( m_nItemId ); - if (!sRet.isEmpty()) - return sRet; - - sRet = m_pToolBox->GetQuickHelpText( m_nItemId ); - if (!sRet.isEmpty()) - return sRet; - - vcl::Window* pItemWindow = m_pToolBox->GetItemWindow( m_nItemId ); - if ( m_nRole == AccessibleRole::PANEL && pItemWindow && pItemWindow->GetAccessible().is() && - pItemWindow->GetAccessible()->getAccessibleContext().is() ) - { - sRet = pItemWindow->GetAccessible()->getAccessibleContext()->getAccessibleName(); - } - return sRet; -} - void VCLXAccessibleToolBoxItem::SetFocus( bool _bFocus ) { if ( m_bHasFocus != _bFocus ) @@ -238,7 +215,25 @@ awt::Rectangle VCLXAccessibleToolBoxItem::implGetBounds( ) OUString VCLXAccessibleToolBoxItem::implGetText() { - return GetText(); + // no text for separators and spaces + if (!m_pToolBox || m_nItemId <= ToolBoxItemId(0)) + return OUString(); + + OUString sRet = m_pToolBox->GetItemText( m_nItemId ); + if (!sRet.isEmpty()) + return sRet; + + sRet = m_pToolBox->GetQuickHelpText( m_nItemId ); + if (!sRet.isEmpty()) + return sRet; + + vcl::Window* pItemWindow = m_pToolBox->GetItemWindow( m_nItemId ); + if ( m_nRole == AccessibleRole::PANEL && pItemWindow && pItemWindow->GetAccessible().is() && + pItemWindow->GetAccessible()->getAccessibleContext().is() ) + { + sRet = pItemWindow->GetAccessible()->getAccessibleContext()->getAccessibleName(); + } + return sRet; } Locale VCLXAccessibleToolBoxItem::implGetLocale() @@ -362,7 +357,7 @@ OUString SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleName( ) OExternalLockGuard aGuard( this ); // entry text == accessible name - return GetText(); + return implGetText(); } Reference< XAccessibleRelationSet > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleRelationSet( ) @@ -411,26 +406,26 @@ OUString VCLXAccessibleToolBoxItem::getText() { OExternalLockGuard aGuard( this ); - return GetText(); + return implGetText(); } sal_Int32 VCLXAccessibleToolBoxItem::getCharacterCount() { - return GetText().getLength(); + return implGetText().getLength(); } sal_Unicode VCLXAccessibleToolBoxItem::getCharacter( sal_Int32 nIndex ) { OExternalLockGuard aGuard( this ); - return OCommonAccessibleText::implGetCharacter( GetText(), nIndex ); + return OCommonAccessibleText::implGetCharacter(implGetText(), nIndex); } OUString VCLXAccessibleToolBoxItem::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) { OExternalLockGuard aGuard( this ); - return OCommonAccessibleText::implGetTextRange( GetText(), nStartIndex, nEndIndex ); + return OCommonAccessibleText::implGetTextRange(implGetText(), nStartIndex, nEndIndex); } sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getCaretPosition() @@ -442,7 +437,7 @@ sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::setCaretPosition( sal_Int32 nIndex { OExternalLockGuard aGuard( this ); - if ( !implIsValidRange( nIndex, nIndex, GetText().getLength() ) ) + if (!implIsValidRange(nIndex, nIndex, implGetText().getLength())) throw IndexOutOfBoundsException(); return false; |