diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2017-04-27 03:19:48 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2017-04-27 08:59:37 +0300 |
commit | 7c4c9947b8e52ce67af1ab131ed583a41f0ddbfa (patch) | |
tree | 4b83446a6b33384c4a4e5b3a88ce8ce9868ad363 /accessibility | |
parent | 17026b70731d9285d4d0d053057b0779877d8feb (diff) |
tdf#107458 No active item for the overflow subtoolbar
Item id 0 has two meanings inside ToolBox. Methods like
GetCurItemId and GetDownItemId use it as "no item".
But that's also the id of a separator item, so calling
GetItemPos(0) will find a separator, if the ToolBox has
one.
Change-Id: I4f2c1fac1759fe0a3ae09d317909707084e16180
Diffstat (limited to 'accessibility')
-rw-r--r-- | accessibility/source/standard/vclxaccessibletoolbox.cxx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx index aa4cad63acb8..b8dd8e2436f4 100644 --- a/accessibility/source/standard/vclxaccessibletoolbox.cxx +++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx @@ -421,8 +421,8 @@ void VCLXAccessibleToolBox::UpdateCustomPopupItemp_Impl( vcl::Window* pWindow, b { const sal_uInt16 nDownItem = pToolBox->GetDownItemId(); if ( !nDownItem ) - // Items with ItemId == 0 are not allowed in ToolBox, which means that currently no item is in down state. - // Moreover, running GetItemPos with 0 could find a separator item if there is any. + // No item is currently in down state. + // Moreover, calling GetItemPos with 0 will find a separator if there is any. return; Reference< XAccessible > xChild( pWindow->GetAccessible() ); @@ -461,7 +461,13 @@ void VCLXAccessibleToolBox::HandleSubToolBarEvent( const VclWindowEvent& rVclWin && pToolBox == pChildWindow->GetParent() && pChildWindow->GetType() == WindowType::TOOLBOX ) { - ToolBox::ImplToolItems::size_type nIndex = pToolBox->GetItemPos( pToolBox->GetCurItemId() ); + const sal_uInt16 nCurItemId( pToolBox->GetCurItemId() ); + if ( !nCurItemId ) + // No item is currently active (might happen when opening the overflow popup). + // Moreover, calling GetItemPos with 0 will find a separator if there is any. + return; + + ToolBox::ImplToolItems::size_type nIndex = pToolBox->GetItemPos( nCurItemId ); Reference< XAccessible > xItem = getAccessibleChild( nIndex ); //TODO: ToolBox::ImplToolItems::size_type -> sal_Int32! if ( xItem.is() ) |