summaryrefslogtreecommitdiff
path: root/accessibility
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-08-30 14:02:11 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-08-30 22:16:23 +0200
commitaf08e6c2f46a6d99b2e18fe176c15ec2b6edb2fd (patch)
treeb7093fb592cedce15d8c0e22a98c793c0f6e28c5 /accessibility
parent0974b4e97320a43040201557ff9c648a5f582b29 (diff)
use concrete type for ToolBoxItemsMap
avoid some unnecessary casting Change-Id: I582144f0654837ac8864679b38c3d2676d1089b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156290 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'accessibility')
-rw-r--r--accessibility/inc/standard/vclxaccessibletoolbox.hxx6
-rw-r--r--accessibility/source/standard/vclxaccessibletoolbox.cxx33
2 files changed, 16 insertions, 23 deletions
diff --git a/accessibility/inc/standard/vclxaccessibletoolbox.hxx b/accessibility/inc/standard/vclxaccessibletoolbox.hxx
index 2fba09d80e79..4918e511ba2a 100644
--- a/accessibility/inc/standard/vclxaccessibletoolbox.hxx
+++ b/accessibility/inc/standard/vclxaccessibletoolbox.hxx
@@ -25,13 +25,11 @@
#include <cppuhelper/implbase.hxx>
-
-
-typedef std::map< sal_Int32, css::uno::Reference< css::accessibility::XAccessible > > ToolBoxItemsMap;
-
class VCLXAccessibleToolBoxItem;
class ToolBox;
+typedef std::map< sal_Int32, rtl::Reference< VCLXAccessibleToolBoxItem > > ToolBoxItemsMap;
+
class VCLXAccessibleToolBox final : public cppu::ImplInheritanceHelper<VCLXAccessibleComponent, css::accessibility::XAccessibleSelection>
{
private:
diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx
index aaea955d10f6..a3ea0ec99d72 100644
--- a/accessibility/source/standard/vclxaccessibletoolbox.cxx
+++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx
@@ -137,7 +137,7 @@ VCLXAccessibleToolBoxItem* VCLXAccessibleToolBox::GetItem_Impl( ToolBox::ImplToo
//TODO: ToolBox::ImplToolItems::size_type -> sal_Int32!
// returns only toolbox buttons, not windows
if ( aIter != m_aAccessibleChildren.end() && aIter->second.is())
- pItem = static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
+ pItem = aIter->second.get();
}
return pItem;
@@ -173,8 +173,7 @@ void VCLXAccessibleToolBox::UpdateFocus_Impl()
if ( rxChild.is() )
{
- VCLXAccessibleToolBoxItem* pItem =
- static_cast< VCLXAccessibleToolBoxItem* >( rxChild.get() );
+ VCLXAccessibleToolBoxItem* pItem = rxChild.get();
if ( pItem->HasFocus() && nItemId != nHighlightItemId )
{
// reset the old focused item
@@ -203,8 +202,7 @@ void VCLXAccessibleToolBox::ReleaseFocus_Impl( ToolBox::ImplToolItems::size_type
//TODO: ToolBox::ImplToolItems::size_type -> sal_Int32!
if ( aIter != m_aAccessibleChildren.end() && aIter->second.is() )
{
- VCLXAccessibleToolBoxItem* pItem =
- static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
+ VCLXAccessibleToolBoxItem* pItem = aIter->second.get();
if ( pItem->HasFocus() )
pItem->SetFocus( false );
}
@@ -224,8 +222,7 @@ void VCLXAccessibleToolBox::UpdateChecked_Impl( ToolBox::ImplToolItems::size_typ
{
ToolBoxItemId nItemId = pToolBox->GetItemId( rPos );
- VCLXAccessibleToolBoxItem* pItem =
- static_cast< VCLXAccessibleToolBoxItem* >( rxChild.get() );
+ VCLXAccessibleToolBoxItem* pItem = rxChild.get();
pItem->SetChecked( pToolBox->IsItemChecked( nItemId ) );
if ( nItemId == nFocusId )
pFocusItem = pItem;
@@ -247,8 +244,7 @@ void VCLXAccessibleToolBox::UpdateIndeterminate_Impl( ToolBox::ImplToolItems::si
//TODO: ToolBox::ImplToolItems::size_type -> sal_Int32!
if ( aIter != m_aAccessibleChildren.end() && aIter->second.is() )
{
- VCLXAccessibleToolBoxItem* pItem =
- static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
+ VCLXAccessibleToolBoxItem* pItem = aIter->second.get();
if ( pItem )
pItem->SetIndeterminate( pToolBox->GetItemState( nItemId ) == TRISTATE_INDET );
}
@@ -646,7 +642,7 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleChild( sal
if ( (!pToolBox) || i < 0 || o3tl::make_unsigned(i) >= pToolBox->GetItemCount() )
throw IndexOutOfBoundsException();
- Reference< XAccessible > xChild;
+ rtl::Reference< VCLXAccessibleToolBoxItem > xChild;
// search for the child
ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find(i);
if ( m_aAccessibleChildren.end() == aIter )
@@ -655,21 +651,20 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleChild( sal
ToolBoxItemId nHighlightItemId = pToolBox->GetHighlightItemId();
vcl::Window* pItemWindow = pToolBox->GetItemWindow( nItemId );
// not found -> create a new child
- rtl::Reference<VCLXAccessibleToolBoxItem> pChild = new VCLXAccessibleToolBoxItem( pToolBox, i );
- Reference< XAccessible> xParent = pChild;
+ xChild = new VCLXAccessibleToolBoxItem( pToolBox, i );
if ( pItemWindow )
{
- xChild = new OToolBoxWindowItem(0,::comphelper::getProcessComponentContext(),pItemWindow->GetAccessible(),xParent);
- pItemWindow->SetAccessible(xChild);
- pChild->SetChild( xChild );
+ Reference< XAccessible> xParent = xChild;
+ rtl::Reference<OToolBoxWindowItem> xChild2( new OToolBoxWindowItem(0,::comphelper::getProcessComponentContext(),pItemWindow->GetAccessible(),xParent) );
+ pItemWindow->SetAccessible(xChild2);
+ xChild->SetChild( xChild2 );
}
- xChild = pChild;
if ( nHighlightItemId > ToolBoxItemId(0) && nItemId == nHighlightItemId )
- pChild->SetFocus( true );
+ xChild->SetFocus( true );
if ( pToolBox->IsItemChecked( nItemId ) )
- pChild->SetChecked( true );
+ xChild->SetChecked( true );
if ( pToolBox->GetItemState( nItemId ) == TRISTATE_INDET )
- pChild->SetIndeterminate( true );
+ xChild->SetIndeterminate( true );
m_aAccessibleChildren.emplace( i, xChild );
}
else