diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-03-08 21:37:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-03-11 14:10:30 +0100 |
commit | 1692998399eecb79e7b59456cff805bcb77aece4 (patch) | |
tree | 8cc22c633e88f19c39f5736e87a0934f041729de /accessibility | |
parent | 665a2b477dd4f412b42ffb58a183f7a702cd7645 (diff) |
use strong_int for item ids in vcl::ToolBox
(*) fix bug in SfxToolBoxControl::StateChanged where it was using the slot id
instead of the toolbox item id
(*) I left the logic in SbaTableQueryBrowser alone, but it looks suspicious,
casting slot ids to toolbox ids
Change-Id: Ied229164c27fb4456b0515c6fdcbd1682766a1a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112186
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'accessibility')
3 files changed, 16 insertions, 16 deletions
diff --git a/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx b/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx index 544be177044b..cbfb8162f677 100644 --- a/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx +++ b/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx @@ -45,7 +45,7 @@ private: VclPtr<ToolBox> m_pToolBox; sal_Int32 m_nIndexInParent; sal_Int16 m_nRole; - sal_uInt16 m_nItemId; + ToolBoxItemId m_nItemId; bool m_bHasFocus; bool m_bIsChecked; bool m_bIndeterminate; diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx index a04685730c85..cf3bf77169e7 100644 --- a/accessibility/source/standard/vclxaccessibletoolbox.cxx +++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx @@ -200,11 +200,11 @@ void VCLXAccessibleToolBox::UpdateFocus_Impl() if ( !bHasFocus ) return; - sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId(); + ToolBoxItemId nHighlightItemId = pToolBox->GetHighlightItemId(); sal_uInt16 nFocusCount = 0; for ( const auto& [rPos, rxChild] : m_aAccessibleChildren ) { - sal_uInt16 nItemId = pToolBox->GetItemId( rPos ); + ToolBoxItemId nItemId = pToolBox->GetItemId( rPos ); if ( rxChild.is() ) { @@ -252,12 +252,12 @@ void VCLXAccessibleToolBox::UpdateChecked_Impl( ToolBox::ImplToolItems::size_typ if ( !pToolBox ) return; - sal_uInt16 nFocusId = pToolBox->GetItemId( _nPos ); + ToolBoxItemId nFocusId = pToolBox->GetItemId( _nPos ); VCLXAccessibleToolBoxItem* pFocusItem = nullptr; for ( const auto& [rPos, rxChild] : m_aAccessibleChildren ) { - sal_uInt16 nItemId = pToolBox->GetItemId( rPos ); + ToolBoxItemId nItemId = pToolBox->GetItemId( rPos ); VCLXAccessibleToolBoxItem* pItem = static_cast< VCLXAccessibleToolBoxItem* >( rxChild.get() ); @@ -276,7 +276,7 @@ void VCLXAccessibleToolBox::UpdateIndeterminate_Impl( ToolBox::ImplToolItems::si if ( !pToolBox ) return; - sal_uInt16 nItemId = pToolBox->GetItemId( _nPos ); + ToolBoxItemId nItemId = pToolBox->GetItemId( _nPos ); ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos ); //TODO: ToolBox::ImplToolItems::size_type -> sal_Int32! @@ -392,7 +392,7 @@ void VCLXAccessibleToolBox::UpdateCustomPopupItemp_Impl( vcl::Window* pWindow, b if( !(pWindow && pToolBox) ) return; - const sal_uInt16 nDownItem = pToolBox->GetDownItemId(); + const ToolBoxItemId nDownItem = pToolBox->GetDownItemId(); if ( !nDownItem ) // No item is currently in down state. // Moreover, calling GetItemPos with 0 will find a separator if there is any. @@ -434,7 +434,7 @@ void VCLXAccessibleToolBox::HandleSubToolBarEvent( const VclWindowEvent& rVclWin && pChildWindow->GetType() == WindowType::TOOLBOX) ) return; - const sal_uInt16 nCurItemId( pToolBox->GetCurItemId() ); + const ToolBoxItemId 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. @@ -698,8 +698,8 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleChild( sal ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find(i); if ( m_aAccessibleChildren.end() == aIter ) { - sal_uInt16 nItemId = pToolBox->GetItemId( i ); - sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId(); + ToolBoxItemId nItemId = pToolBox->GetItemId( i ); + ToolBoxItemId nHighlightItemId = pToolBox->GetHighlightItemId(); vcl::Window* pItemWindow = pToolBox->GetItemWindow( nItemId ); // not found -> create a new child rtl::Reference<VCLXAccessibleToolBoxItem> pChild = new VCLXAccessibleToolBoxItem( pToolBox, i ); @@ -711,7 +711,7 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleChild( sal pChild->SetChild( xChild ); } xChild = pChild; - if ( nHighlightItemId > 0 && nItemId == nHighlightItemId ) + if ( nHighlightItemId > ToolBoxItemId(0) && nItemId == nHighlightItemId ) pChild->SetFocus( true ); if ( pToolBox->IsItemChecked( nItemId ) ) pChild->SetChecked( true ); @@ -754,7 +754,7 @@ Reference< XAccessible > VCLXAccessibleToolBox::GetItemWindowAccessible( const V ToolBox::ImplToolItems::size_type nCount = pToolBox->GetItemCount(); for (ToolBox::ImplToolItems::size_type i = 0 ; i < nCount && !xReturn.is() ; ++i) { - sal_uInt16 nItemId = pToolBox->GetItemId( i ); + ToolBoxItemId nItemId = pToolBox->GetItemId( i ); vcl::Window* pItemWindow = pToolBox->GetItemWindow( nItemId ); if ( pItemWindow == pChildWindow ) xReturn = getAccessibleChild(i); @@ -819,7 +819,7 @@ sal_Int32 VCLXAccessibleToolBox::getSelectedAccessibleChildCount( ) VclPtr< ToolBox > pToolBox = GetAs< ToolBox >(); if (pToolBox) { - sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId(); + ToolBoxItemId nHighlightItemId = pToolBox->GetHighlightItemId(); for ( size_t i = 0, nCount = pToolBox->GetItemCount(); i < nCount; i++ ) { if ( nHighlightItemId == pToolBox->GetItemId( i ) ) @@ -843,7 +843,7 @@ Reference< XAccessible > VCLXAccessibleToolBox::getSelectedAccessibleChild( sal_ VclPtr< ToolBox > pToolBox = GetAs< ToolBox >(); if (pToolBox) { - sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId(); + ToolBoxItemId nHighlightItemId = pToolBox->GetHighlightItemId(); for ( sal_Int32 i = 0, nCount = pToolBox->GetItemCount(); i < nCount; i++ ) { if ( nHighlightItemId == pToolBox->GetItemId( i ) ) diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx index cc613bbe4ec3..211547a7e206 100644 --- a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx +++ b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx @@ -118,7 +118,7 @@ OUString VCLXAccessibleToolBoxItem::GetText() { OUString sRet; // no text for separators and spaces - if ( m_pToolBox && m_nItemId > 0 ) + if ( m_pToolBox && m_nItemId > ToolBoxItemId(0) ) { sRet = m_pToolBox->GetItemText( m_nItemId ); if (sRet.isEmpty()) @@ -498,7 +498,7 @@ sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getIndexAtPoint( const awt::Point& sal_Int32 nIndex = -1; if ( m_pToolBox && m_pToolBox->GetButtonType() != ButtonType::SYMBOLONLY ) // symbol buttons have no character bounds { - sal_uInt16 nItemId = 0; + ToolBoxItemId nItemId; tools::Rectangle aItemRect = m_pToolBox->GetItemRect( m_nItemId ); Point aPnt( VCLPoint( aPoint ) ); aPnt += aItemRect.TopLeft(); |