summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-02-15 16:52:53 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-02-15 16:55:05 +0000
commitb3098d239f46c8d5965754f275bc62216dcb4f4f (patch)
tree9e66d4a52f305362ca30a6425867cb0dd385f043
parentdeff2acd61de53e29a8cf1eed7f8db458244dab0 (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 Change-Id: Icf1a0afc4a6f6090e3f14f30b4380db477955561
-rw-r--r--svx/source/accessibility/charmapacc.cxx29
-rw-r--r--svx/source/inc/charmapacc.hxx1
2 files changed, 18 insertions, 12 deletions
diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx
index 816c68b8e505..7d79b0a60349 100644
--- a/svx/source/accessibility/charmapacc.cxx
+++ b/svx/source/accessibility/charmapacc.cxx
@@ -71,11 +71,16 @@ void SAL_CALL SvxShowCharSetVirtualAcc::fireEvent(
m_xTable->fireEvent(_nEventId,_rOldValue,_rNewValue);
}
-sal_Int32 SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleChildCount( )
+sal_Int32 SvxShowCharSetVirtualAcc::getImplAccessibleChildCount() const
+{
+ return mpParent->getScrollBar().IsVisible() ? 2 : 1;
+}
+
+sal_Int32 SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleChildCount()
{
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 )
@@ -115,17 +120,17 @@ Reference< XAccessible > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleChild(
{
OExternalLockGuard aGuard( this );
ensureAlive();
- if ( mpParent->getScrollBar().IsVisible() && i == 0 )
- return mpParent->getScrollBar().GetAccessible();
- else if ( i == 1 )
- {
- if ( !m_xTable.is() )
- {
- m_xTable = new SvxShowCharSetAcc(this);
- }
- }
- else
+
+ sal_Int32 nCount = getImplAccessibleChildCount();
+ if (i >= nCount)
throw IndexOutOfBoundsException();
+
+ if (i == 0 && mpParent->getScrollBar().IsVisible())
+ return mpParent->getScrollBar().GetAccessible();
+
+ if (!m_xTable.is())
+ m_xTable = new SvxShowCharSetAcc(this);
+
return m_xTable.get();
}
diff --git a/svx/source/inc/charmapacc.hxx b/svx/source/inc/charmapacc.hxx
index 41d8f26eb292..d93540437a5b 100644
--- a/svx/source/inc/charmapacc.hxx
+++ b/svx/source/inc/charmapacc.hxx
@@ -43,6 +43,7 @@ namespace svx
{
VclPtr<SvxShowCharSet> mpParent; // the vcl control
rtl::Reference<SvxShowCharSetAcc> m_xTable; // the table, which holds the characters shown by the vcl control
+ sal_Int32 getImplAccessibleChildCount() const;
protected:
virtual ~SvxShowCharSetVirtualAcc() override;