diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-02-15 16:52:53 +0000 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-02-27 11:16:42 +0100 |
commit | 7e6d7a4474feeeff5fb406e1e3caf6113f31205b (patch) | |
tree | b12fd74eaba018617bbeec4d106efb6729aa01c3 /svx | |
parent | a4e318ba7b4245e2047f5702c8c2d646375e27d1 (diff) |
Related: tdf#105712 inconsistency with num of a11y children in special char
with no visible scrollbar it claims 1 child, but trying to get child at
index 0 throws
(cherry picked from commit b3098d239f46c8d5965754f275bc62216dcb4f4f)
Change-Id: Icf1a0afc4a6f6090e3f14f30b4380db477955561
Reviewed-on: https://gerrit.libreoffice.org/34314
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
(cherry picked from commit 2247313b0aec80306e7f67926810cf004d5b4d1d)
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/accessibility/charmapacc.cxx | 29 | ||||
-rw-r--r-- | svx/source/inc/charmapacc.hxx | 1 |
2 files changed, 19 insertions, 11 deletions
diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx index 3e5ec9e0f34d..e38a4acaee1d 100644 --- a/svx/source/accessibility/charmapacc.cxx +++ b/svx/source/accessibility/charmapacc.cxx @@ -73,11 +73,16 @@ void SAL_CALL SvxShowCharSetVirtualAcc::fireEvent( m_pTable->fireEvent(_nEventId,_rOldValue,_rNewValue); } -sal_Int32 SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleChildCount( ) throw (RuntimeException, std::exception) +sal_Int32 SvxShowCharSetVirtualAcc::getImplAccessibleChildCount() const +{ + return mpParent->getScrollBar().IsVisible() ? 2 : 1; +} + +sal_Int32 SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleChildCount() throw (RuntimeException, std::exception) { OExternalLockGuard aGuard( this ); ensureAlive(); - return ( mpParent->getScrollBar().IsVisible() ) ? 2 : 1; + return getImplAccessibleChildCount(); } uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleAtPoint( const awt::Point& aPoint ) @@ -119,18 +124,20 @@ Reference< XAccessible > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleChild( { OExternalLockGuard aGuard( this ); ensureAlive(); - if ( mpParent->getScrollBar().IsVisible() && i == 0 ) + + sal_Int32 nCount = getImplAccessibleChildCount(); + if (i >= nCount) + throw IndexOutOfBoundsException(); + + if (i == 0 && mpParent->getScrollBar().IsVisible()) return mpParent->getScrollBar().GetAccessible(); - else if ( i == 1 ) + + if ( !m_xAcc.is() ) { - if ( !m_xAcc.is() ) - { - m_pTable = new SvxShowCharSetAcc(this); - m_xAcc = m_pTable; - } + m_pTable = new SvxShowCharSetAcc(this); + m_xAcc = m_pTable; } - else - throw IndexOutOfBoundsException(); + return m_xAcc; } diff --git a/svx/source/inc/charmapacc.hxx b/svx/source/inc/charmapacc.hxx index 2169e9688452..bfb4fb73cf2c 100644 --- a/svx/source/inc/charmapacc.hxx +++ b/svx/source/inc/charmapacc.hxx @@ -44,6 +44,7 @@ namespace svx VclPtr<SvxShowCharSet> mpParent; // the vcl control SvxShowCharSetAcc* m_pTable; // the table, which holds the characters shown by the vcl control css::uno::Reference< css::accessibility::XAccessible > m_xAcc; // the ref to the table + sal_Int32 getImplAccessibleChildCount() const; protected: virtual ~SvxShowCharSetVirtualAcc(); |