diff options
Diffstat (limited to 'basctl/source/accessibility/accessibledialogwindow.cxx')
-rw-r--r-- | basctl/source/accessibility/accessibledialogwindow.cxx | 132 |
1 files changed, 51 insertions, 81 deletions
diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx index 0b641c8aca5e..e9b4513294fb 100644 --- a/basctl/source/accessibility/accessibledialogwindow.cxx +++ b/basctl/source/accessibility/accessibledialogwindow.cxx @@ -26,13 +26,14 @@ #include <dlgedpage.hxx> #include <dlgedview.hxx> #include <dlgedobj.hxx> +#include <com/sun/star/awt/XVclWindowPeer.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <tools/debug.hxx> -#include <unotools/accessiblestatesethelper.hxx> #include <unotools/accessiblerelationsethelper.hxx> #include <toolkit/awt/vclxfont.hxx> #include <toolkit/helper/convert.hxx> @@ -84,11 +85,10 @@ AccessibleDialogWindow::AccessibleDialogWindow (basctl::DialogWindow* pDialogWin return; SdrPage& rPage = m_pDialogWindow->GetPage(); - const size_t nCount = rPage.GetObjCount(); - for ( size_t i = 0; i < nCount; ++i ) + for (const rtl::Reference<SdrObject>& pObj : rPage) { - if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(rPage.GetObj(i))) + if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pObj.get())) { ChildDescriptor aDesc( pDlgEdObj ); if ( IsChildVisible( aDesc ) ) @@ -119,13 +119,8 @@ void AccessibleDialogWindow::UpdateFocused() { for (const ChildDescriptor & i : m_aAccessibleChildren) { - Reference< XAccessible > xChild( i.rxAccessible ); - if ( xChild.is() ) - { - AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() ); - if ( pShape ) - pShape->SetFocused( pShape->IsFocused() ); - } + if ( i.mxAccessible ) + i.mxAccessible->SetFocused( i.mxAccessible->IsFocused() ); } } @@ -136,13 +131,8 @@ void AccessibleDialogWindow::UpdateSelected() for (const ChildDescriptor & i : m_aAccessibleChildren) { - Reference< XAccessible > xChild( i.rxAccessible ); - if ( xChild.is() ) - { - AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() ); - if ( pShape ) - pShape->SetSelected( pShape->IsSelected() ); - } + if ( i.mxAccessible ) + i.mxAccessible->SetSelected( i.mxAccessible->IsSelected() ); } } @@ -151,13 +141,8 @@ void AccessibleDialogWindow::UpdateBounds() { for (const ChildDescriptor & i : m_aAccessibleChildren) { - Reference< XAccessible > xChild( i.rxAccessible ); - if ( xChild.is() ) - { - AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() ); - if ( pShape ) - pShape->SetBounds( pShape->GetBounds() ); - } + if ( i.mxAccessible ) + i.mxAccessible->SetBounds( i.mxAccessible->GetBounds() ); } } @@ -194,7 +179,7 @@ bool AccessibleDialogWindow::IsChildVisible( const ChildDescriptor& rDesc ) // check, if the shape's bounding box intersects with the bounding box of its parent tools::Rectangle aParentRect( Point( 0, 0 ), m_pDialogWindow->GetSizePixel() ); - if ( aParentRect.IsOver( aRect ) ) + if ( aParentRect.Overlaps( aRect ) ) bVisible = true; } } @@ -243,7 +228,7 @@ void AccessibleDialogWindow::RemoveChild( const ChildDescriptor& rDesc ) return; // get the accessible of the removed child - Reference< XAccessible > xChild( aIter->rxAccessible ); + rtl::Reference< AccessibleDialogControlShape > xChild( aIter->mxAccessible ); // remove entry from child list m_aAccessibleChildren.erase( aIter ); @@ -252,12 +237,11 @@ void AccessibleDialogWindow::RemoveChild( const ChildDescriptor& rDesc ) if ( xChild.is() ) { Any aOldValue, aNewValue; - aOldValue <<= xChild; + aOldValue <<= uno::Reference<XAccessible>(xChild); NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); - Reference< XComponent > xComponent( xChild, UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); + if ( xChild ) + xChild->dispose(); } } @@ -282,8 +266,8 @@ void AccessibleDialogWindow::UpdateChildren() if ( m_pDialogWindow ) { SdrPage& rPage = m_pDialogWindow->GetPage(); - for ( size_t i = 0, nCount = rPage.GetObjCount(); i < nCount; ++i ) - if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(rPage.GetObj(i))) + for (const rtl::Reference<SdrObject>& pObj : rPage) + if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pObj.get())) UpdateChild( ChildDescriptor( pDlgEdObj ) ); } } @@ -379,9 +363,8 @@ void AccessibleDialogWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindo // dispose all children for (const ChildDescriptor & i : m_aAccessibleChildren) { - Reference< XComponent > xComponent( i.rxAccessible, UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); + if ( i.mxAccessible ) + i.mxAccessible->dispose(); } m_aAccessibleChildren.clear(); } @@ -395,27 +378,27 @@ void AccessibleDialogWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindo } -void AccessibleDialogWindow::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) +void AccessibleDialogWindow::FillAccessibleStateSet( sal_Int64& rStateSet ) { if ( !m_pDialogWindow ) return; if ( m_pDialogWindow->IsEnabled() ) - rStateSet.AddState( AccessibleStateType::ENABLED ); + rStateSet |= AccessibleStateType::ENABLED; - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); + rStateSet |= AccessibleStateType::FOCUSABLE; if ( m_pDialogWindow->HasFocus() ) - rStateSet.AddState( AccessibleStateType::FOCUSED ); + rStateSet |= AccessibleStateType::FOCUSED; - rStateSet.AddState( AccessibleStateType::VISIBLE ); + rStateSet |= AccessibleStateType::VISIBLE; if ( m_pDialogWindow->IsVisible() ) - rStateSet.AddState( AccessibleStateType::SHOWING ); + rStateSet |= AccessibleStateType::SHOWING; - rStateSet.AddState( AccessibleStateType::OPAQUE ); + rStateSet |= AccessibleStateType::OPAQUE; - rStateSet.AddState( AccessibleStateType::RESIZABLE ); + rStateSet |= AccessibleStateType::RESIZABLE; } @@ -493,18 +476,6 @@ void AccessibleDialogWindow::Notify( SfxBroadcaster&, const SfxHint& rHint ) } -// XInterface - - -IMPLEMENT_FORWARD_XINTERFACE2( AccessibleDialogWindow, OAccessibleExtendedComponentHelper, AccessibleDialogWindow_BASE ) - - -// XTypeProvider - - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleDialogWindow, OAccessibleExtendedComponentHelper, AccessibleDialogWindow_BASE ) - - // XComponent @@ -525,9 +496,8 @@ void AccessibleDialogWindow::disposing() // dispose all children for (const ChildDescriptor & i : m_aAccessibleChildren) { - Reference< XComponent > xComponent( i.rxAccessible, UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); + if ( i.mxAccessible ) + i.mxAccessible->dispose(); } m_aAccessibleChildren.clear(); } @@ -535,7 +505,7 @@ void AccessibleDialogWindow::disposing() // XServiceInfo OUString AccessibleDialogWindow::getImplementationName() { - return "com.sun.star.comp.basctl.AccessibleWindow"; + return u"com.sun.star.comp.basctl.AccessibleWindow"_ustr; } sal_Bool AccessibleDialogWindow::supportsService( const OUString& rServiceName ) @@ -545,7 +515,7 @@ sal_Bool AccessibleDialogWindow::supportsService( const OUString& rServiceName ) Sequence< OUString > AccessibleDialogWindow::getSupportedServiceNames() { - return { "com.sun.star.awt.AccessibleWindow" }; + return { u"com.sun.star.awt.AccessibleWindow"_ustr }; } // XAccessible @@ -555,7 +525,7 @@ Reference< XAccessibleContext > AccessibleDialogWindow::getAccessibleContext( ) } // XAccessibleContext -sal_Int32 AccessibleDialogWindow::getAccessibleChildCount() +sal_Int64 AccessibleDialogWindow::getAccessibleChildCount() { OExternalLockGuard aGuard( this ); @@ -563,14 +533,14 @@ sal_Int32 AccessibleDialogWindow::getAccessibleChildCount() } -Reference< XAccessible > AccessibleDialogWindow::getAccessibleChild( sal_Int32 i ) +Reference< XAccessible > AccessibleDialogWindow::getAccessibleChild( sal_Int64 i ) { OExternalLockGuard aGuard( this ); if ( i < 0 || i >= getAccessibleChildCount() ) throw IndexOutOfBoundsException(); - Reference< XAccessible > xChild = m_aAccessibleChildren[i].rxAccessible; + rtl::Reference< AccessibleDialogControlShape > xChild = m_aAccessibleChildren[i].mxAccessible; if ( !xChild.is() ) { if ( m_pDialogWindow ) @@ -581,7 +551,7 @@ Reference< XAccessible > AccessibleDialogWindow::getAccessibleChild( sal_Int32 i xChild = new AccessibleDialogControlShape( m_pDialogWindow, pDlgEdObj ); // insert into child list - m_aAccessibleChildren[i].rxAccessible = xChild; + m_aAccessibleChildren[i].mxAccessible = xChild; } } } @@ -606,11 +576,11 @@ Reference< XAccessible > AccessibleDialogWindow::getAccessibleParent( ) } -sal_Int32 AccessibleDialogWindow::getAccessibleIndexInParent( ) +sal_Int64 AccessibleDialogWindow::getAccessibleIndexInParent( ) { OExternalLockGuard aGuard( this ); - sal_Int32 nIndexInParent = -1; + sal_Int64 nIndexInParent = -1; if ( m_pDialogWindow ) { vcl::Window* pParent = m_pDialogWindow->GetAccessibleParentWindow(); @@ -672,22 +642,22 @@ Reference< XAccessibleRelationSet > AccessibleDialogWindow::getAccessibleRelatio } -Reference< XAccessibleStateSet > AccessibleDialogWindow::getAccessibleStateSet( ) +sal_Int64 AccessibleDialogWindow::getAccessibleStateSet( ) { OExternalLockGuard aGuard( this ); - rtl::Reference<utl::AccessibleStateSetHelper> pStateSetHelper = new utl::AccessibleStateSetHelper; + sal_Int64 nStateSet = 0; if ( !rBHelper.bDisposed && !rBHelper.bInDispose ) { - FillAccessibleStateSet( *pStateSetHelper ); + FillAccessibleStateSet( nStateSet ); } else { - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); + nStateSet |= AccessibleStateType::DEFUNC; } - return pStateSetHelper; + return nStateSet; } @@ -717,7 +687,7 @@ Reference< XAccessible > AccessibleDialogWindow::getAccessibleAtPoint( const awt { tools::Rectangle aRect = VCLRectangle( xComp->getBounds() ); Point aPos = VCLPoint( rPoint ); - if ( aRect.IsInside( aPos ) ) + if ( aRect.Contains( aPos ) ) { xChild = xAcc; break; @@ -831,7 +801,7 @@ OUString AccessibleDialogWindow::getToolTipText( ) // XAccessibleSelection -void AccessibleDialogWindow::selectAccessibleChild( sal_Int32 nChildIndex ) +void AccessibleDialogWindow::selectAccessibleChild( sal_Int64 nChildIndex ) { OExternalLockGuard aGuard( this ); @@ -850,7 +820,7 @@ void AccessibleDialogWindow::selectAccessibleChild( sal_Int32 nChildIndex ) } -sal_Bool AccessibleDialogWindow::isAccessibleChildSelected( sal_Int32 nChildIndex ) +sal_Bool AccessibleDialogWindow::isAccessibleChildSelected( sal_Int64 nChildIndex ) { OExternalLockGuard aGuard( this ); @@ -882,13 +852,13 @@ void AccessibleDialogWindow::selectAllAccessibleChildren( ) } -sal_Int32 AccessibleDialogWindow::getSelectedAccessibleChildCount( ) +sal_Int64 AccessibleDialogWindow::getSelectedAccessibleChildCount( ) { OExternalLockGuard aGuard( this ); - sal_Int32 nRet = 0; + sal_Int64 nRet = 0; - for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) + for ( sal_Int64 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) { if ( isAccessibleChildSelected( i ) ) ++nRet; @@ -898,7 +868,7 @@ sal_Int32 AccessibleDialogWindow::getSelectedAccessibleChildCount( ) } -Reference< XAccessible > AccessibleDialogWindow::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) +Reference< XAccessible > AccessibleDialogWindow::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) { OExternalLockGuard aGuard( this ); @@ -907,7 +877,7 @@ Reference< XAccessible > AccessibleDialogWindow::getSelectedAccessibleChild( sal Reference< XAccessible > xChild; - for ( sal_Int32 i = 0, j = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) + for ( sal_Int64 i = 0, j = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) { if ( isAccessibleChildSelected( i ) && ( j++ == nSelectedChildIndex ) ) { @@ -920,7 +890,7 @@ Reference< XAccessible > AccessibleDialogWindow::getSelectedAccessibleChild( sal } -void AccessibleDialogWindow::deselectAccessibleChild( sal_Int32 nChildIndex ) +void AccessibleDialogWindow::deselectAccessibleChild( sal_Int64 nChildIndex ) { OExternalLockGuard aGuard( this ); |