LCOV - code coverage report
Current view: top level - accessibility/source/extended - accessibletabbarpagelist.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 331 0.0 %
Date: 2014-04-11 Functions: 0 47 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <accessibility/extended/accessibletabbarpagelist.hxx>
      21             : #include <svtools/tabbar.hxx>
      22             : #include <accessibility/extended/accessibletabbarpage.hxx>
      23             : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      24             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      25             : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      26             : #include <cppuhelper/supportsservice.hxx>
      27             : #include <unotools/accessiblestatesethelper.hxx>
      28             : #include <unotools/accessiblerelationsethelper.hxx>
      29             : #include <vcl/svapp.hxx>
      30             : #include <vcl/settings.hxx>
      31             : #include <toolkit/helper/convert.hxx>
      32             : 
      33             : 
      34             : 
      35             : namespace accessibility
      36             : {
      37             : 
      38             : 
      39             :     using namespace ::com::sun::star::accessibility;
      40             :     using namespace ::com::sun::star::uno;
      41             :     using namespace ::com::sun::star::lang;
      42             :     using namespace ::com::sun::star;
      43             :     using namespace ::comphelper;
      44             : 
      45             : 
      46             :     // class AccessibleTabBarPageList
      47             : 
      48             : 
      49           0 :     AccessibleTabBarPageList::AccessibleTabBarPageList( TabBar* pTabBar, sal_Int32 nIndexInParent )
      50             :         :AccessibleTabBarBase( pTabBar )
      51           0 :         ,m_nIndexInParent( nIndexInParent )
      52             :     {
      53           0 :         if ( m_pTabBar )
      54           0 :             m_aAccessibleChildren.assign( m_pTabBar->GetPageCount(), Reference< XAccessible >() );
      55           0 :     }
      56             : 
      57             : 
      58             : 
      59           0 :     AccessibleTabBarPageList::~AccessibleTabBarPageList()
      60             :     {
      61           0 :     }
      62             : 
      63             : 
      64             : 
      65           0 :     void AccessibleTabBarPageList::UpdateEnabled( sal_Int32 i, sal_Bool bEnabled )
      66             :     {
      67           0 :         if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
      68             :         {
      69           0 :             Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
      70           0 :             if ( xChild.is() )
      71             :             {
      72           0 :                 AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() );
      73           0 :                 if ( pAccessibleTabBarPage )
      74           0 :                     pAccessibleTabBarPage->SetEnabled( bEnabled );
      75           0 :             }
      76             :         }
      77           0 :     }
      78             : 
      79             : 
      80             : 
      81           0 :     void AccessibleTabBarPageList::UpdateShowing( sal_Bool bShowing )
      82             :     {
      83           0 :         for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
      84             :         {
      85           0 :             Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
      86           0 :             if ( xChild.is() )
      87             :             {
      88           0 :                 AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() );
      89           0 :                 if ( pAccessibleTabBarPage )
      90           0 :                     pAccessibleTabBarPage->SetShowing( bShowing );
      91             :             }
      92           0 :         }
      93           0 :     }
      94             : 
      95             : 
      96             : 
      97           0 :     void AccessibleTabBarPageList::UpdateSelected( sal_Int32 i, sal_Bool bSelected )
      98             :     {
      99           0 :         NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
     100             : 
     101           0 :         if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
     102             :         {
     103           0 :             Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
     104           0 :             if ( xChild.is() )
     105             :             {
     106           0 :                 AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() );
     107           0 :                 if ( pAccessibleTabBarPage )
     108           0 :                     pAccessibleTabBarPage->SetSelected( bSelected );
     109           0 :             }
     110             :         }
     111           0 :     }
     112             : 
     113             : 
     114             : 
     115           0 :     void AccessibleTabBarPageList::UpdatePageText( sal_Int32 i )
     116             :     {
     117           0 :         if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
     118             :         {
     119           0 :             Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
     120           0 :             if ( xChild.is() )
     121             :             {
     122           0 :                 AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() );
     123           0 :                 if ( pAccessibleTabBarPage )
     124             :                 {
     125           0 :                     if ( m_pTabBar )
     126             :                     {
     127           0 :                         OUString sPageText = m_pTabBar->GetPageText( m_pTabBar->GetPageId( (sal_uInt16)i ) );
     128           0 :                         pAccessibleTabBarPage->SetPageText( sPageText );
     129             :                     }
     130             :                 }
     131           0 :             }
     132             :         }
     133           0 :     }
     134             : 
     135             : 
     136             : 
     137           0 :     void AccessibleTabBarPageList::InsertChild( sal_Int32 i )
     138             :     {
     139           0 :         if ( i >= 0 && i <= (sal_Int32)m_aAccessibleChildren.size() )
     140             :         {
     141             :             // insert entry in child list
     142           0 :             m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + i, Reference< XAccessible >() );
     143             : 
     144             :             // send accessible child event
     145           0 :             Reference< XAccessible > xChild( getAccessibleChild( i ) );
     146           0 :             if ( xChild.is() )
     147             :             {
     148           0 :                 Any aOldValue, aNewValue;
     149           0 :                 aNewValue <<= xChild;
     150           0 :                 NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
     151           0 :             }
     152             :         }
     153           0 :     }
     154             : 
     155             : 
     156             : 
     157           0 :     void AccessibleTabBarPageList::RemoveChild( sal_Int32 i )
     158             :     {
     159           0 :         if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
     160             :         {
     161             :             // get the accessible of the removed page
     162           0 :             Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
     163             : 
     164             :             // remove entry in child list
     165           0 :             m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i );
     166             : 
     167             :             // send accessible child event
     168           0 :             if ( xChild.is() )
     169             :             {
     170           0 :                 Any aOldValue, aNewValue;
     171           0 :                 aOldValue <<= xChild;
     172           0 :                 NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
     173             : 
     174           0 :                 Reference< XComponent > xComponent( xChild, UNO_QUERY );
     175           0 :                 if ( xComponent.is() )
     176           0 :                     xComponent->dispose();
     177           0 :             }
     178             :         }
     179           0 :     }
     180             : 
     181             : 
     182             : 
     183           0 :     void AccessibleTabBarPageList::MoveChild( sal_Int32 i, sal_Int32 j )
     184             :     {
     185           0 :         if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() &&
     186           0 :              j >= 0 && j <= (sal_Int32)m_aAccessibleChildren.size() )
     187             :         {
     188           0 :             if ( i < j )
     189           0 :                 --j;
     190             : 
     191             :             // get the accessible of the moved page
     192           0 :             Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
     193             : 
     194             :             // remove entry in child list at old position
     195           0 :             m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i );
     196             : 
     197             :             // insert entry in child list at new position
     198           0 :             m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + j, xChild );
     199             :         }
     200           0 :     }
     201             : 
     202             : 
     203             : 
     204           0 :     void AccessibleTabBarPageList::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
     205             :     {
     206           0 :          switch ( rVclWindowEvent.GetId() )
     207             :          {
     208             :             case VCLEVENT_WINDOW_ENABLED:
     209             :             {
     210           0 :                Any aNewValue;
     211           0 :                 aNewValue <<= AccessibleStateType::SENSITIVE;
     212           0 :                 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), aNewValue );
     213           0 :                 aNewValue <<= AccessibleStateType::ENABLED;
     214           0 :                 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), aNewValue );
     215             :             }
     216           0 :             break;
     217             :             case VCLEVENT_WINDOW_DISABLED:
     218             :             {
     219           0 :                Any aOldValue;
     220           0 :                 aOldValue <<= AccessibleStateType::ENABLED;
     221           0 :                 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, Any() );
     222           0 :                 aOldValue <<= AccessibleStateType::SENSITIVE;
     223           0 :                 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, Any() );
     224             :             }
     225           0 :             break;
     226             :             case VCLEVENT_WINDOW_SHOW:
     227             :             {
     228           0 :                 Any aOldValue, aNewValue;
     229           0 :                 aNewValue <<= AccessibleStateType::SHOWING;
     230           0 :                 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
     231           0 :                 UpdateShowing( sal_True );
     232             :             }
     233           0 :             break;
     234             :             case VCLEVENT_WINDOW_HIDE:
     235             :             {
     236           0 :                 Any aOldValue, aNewValue;
     237           0 :                 aOldValue <<= AccessibleStateType::SHOWING;
     238           0 :                 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
     239           0 :                 UpdateShowing( sal_False );
     240             :             }
     241           0 :             break;
     242             :             case VCLEVENT_TABBAR_PAGEENABLED:
     243             :             {
     244           0 :                 if ( m_pTabBar )
     245             :                 {
     246           0 :                     sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
     247           0 :                     sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
     248           0 :                     UpdateEnabled( nPagePos, sal_True );
     249             :                 }
     250             :             }
     251           0 :             break;
     252             :             case VCLEVENT_TABBAR_PAGEDISABLED:
     253             :             {
     254           0 :                 if ( m_pTabBar )
     255             :                 {
     256           0 :                     sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
     257           0 :                     sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
     258           0 :                     UpdateEnabled( nPagePos, sal_False );
     259             :                 }
     260             :             }
     261           0 :             break;
     262             :             case VCLEVENT_TABBAR_PAGESELECTED:
     263             :             {
     264             :                 // do nothing
     265             :             }
     266           0 :             break;
     267             :             case VCLEVENT_TABBAR_PAGEACTIVATED:
     268             :             {
     269           0 :                 if ( m_pTabBar )
     270             :                 {
     271           0 :                     sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
     272           0 :                     sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
     273           0 :                     UpdateSelected( nPagePos, sal_True );
     274             :                 }
     275             :             }
     276           0 :             break;
     277             :             case VCLEVENT_TABBAR_PAGEDEACTIVATED:
     278             :             {
     279           0 :                 if ( m_pTabBar )
     280             :                 {
     281           0 :                     sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
     282           0 :                     sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
     283           0 :                     UpdateSelected( nPagePos, sal_False );
     284             :                 }
     285             :             }
     286           0 :             break;
     287             :             case VCLEVENT_TABBAR_PAGEINSERTED:
     288             :             {
     289           0 :                 if ( m_pTabBar )
     290             :                 {
     291           0 :                     sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
     292           0 :                     sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
     293           0 :                     InsertChild( nPagePos );
     294             :                 }
     295             :             }
     296           0 :             break;
     297             :             case VCLEVENT_TABBAR_PAGEREMOVED:
     298             :             {
     299           0 :                 if ( m_pTabBar )
     300             :                 {
     301           0 :                     sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
     302             : 
     303           0 :                     if ( nPageId == TabBar::PAGE_NOT_FOUND )
     304             :                     {
     305           0 :                         for ( sal_Int32 i = m_aAccessibleChildren.size() - 1; i >= 0; --i )
     306           0 :                             RemoveChild( i );
     307             :                     }
     308             :                     else
     309             :                     {
     310           0 :                         for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
     311             :                         {
     312           0 :                             Reference< XAccessible > xChild( getAccessibleChild( i ) );
     313           0 :                             if ( xChild.is() )
     314             :                             {
     315           0 :                                 AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() );
     316           0 :                                 if ( pAccessibleTabBarPage && pAccessibleTabBarPage->GetPageId() == nPageId )
     317             :                                 {
     318           0 :                                     RemoveChild( i );
     319           0 :                                     break;
     320             :                                 }
     321             :                             }
     322           0 :                         }
     323             :                     }
     324             :                 }
     325             :             }
     326           0 :             break;
     327             :             case VCLEVENT_TABBAR_PAGEMOVED:
     328             :             {
     329           0 :                 Pair* pPair = (Pair*) rVclWindowEvent.GetData();
     330           0 :                 if ( pPair )
     331           0 :                     MoveChild( pPair->A(), pPair->B() );
     332             :             }
     333           0 :             break;
     334             :             case VCLEVENT_TABBAR_PAGETEXTCHANGED:
     335             :             {
     336           0 :                 sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
     337           0 :                 sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
     338           0 :                 UpdatePageText( nPagePos );
     339             :             }
     340           0 :             break;
     341             :             default:
     342             :             {
     343           0 :                 AccessibleTabBarBase::ProcessWindowEvent( rVclWindowEvent );
     344             :             }
     345           0 :             break;
     346             :         }
     347           0 :     }
     348             : 
     349             : 
     350             : 
     351           0 :     void AccessibleTabBarPageList::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
     352             :     {
     353           0 :         if ( m_pTabBar )
     354             :         {
     355           0 :             if ( m_pTabBar->IsEnabled() )
     356             :             {
     357           0 :                 rStateSet.AddState( AccessibleStateType::ENABLED );
     358           0 :                 rStateSet.AddState( AccessibleStateType::SENSITIVE );
     359             :             }
     360             : 
     361           0 :             rStateSet.AddState( AccessibleStateType::VISIBLE );
     362             : 
     363           0 :             if ( m_pTabBar->IsVisible() )
     364           0 :                 rStateSet.AddState( AccessibleStateType::SHOWING );
     365             :         }
     366           0 :     }
     367             : 
     368             : 
     369             :     // OCommonAccessibleComponent
     370             : 
     371             : 
     372           0 :     awt::Rectangle AccessibleTabBarPageList::implGetBounds() throw (RuntimeException)
     373             :     {
     374           0 :         awt::Rectangle aBounds;
     375           0 :         if ( m_pTabBar )
     376           0 :             aBounds = AWTRectangle( m_pTabBar->GetPageArea() );
     377             : 
     378           0 :         return aBounds;
     379             :     }
     380             : 
     381             : 
     382             :     // XInterface
     383             : 
     384             : 
     385           0 :     IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabBarPageList, AccessibleExtendedComponentHelper_BASE, AccessibleTabBarPageList_BASE )
     386             : 
     387             : 
     388             :     // XTypeProvider
     389             : 
     390             : 
     391           0 :     IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabBarPageList, AccessibleExtendedComponentHelper_BASE, AccessibleTabBarPageList_BASE )
     392             : 
     393             : 
     394             :     // XComponent
     395             : 
     396             : 
     397           0 :     void AccessibleTabBarPageList::disposing()
     398             :     {
     399           0 :         AccessibleTabBarBase::disposing();
     400             : 
     401             :         // dispose all children
     402           0 :         for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
     403             :         {
     404           0 :             Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY );
     405           0 :             if ( xComponent.is() )
     406           0 :                 xComponent->dispose();
     407           0 :         }
     408           0 :         m_aAccessibleChildren.clear();
     409           0 :     }
     410             : 
     411             : 
     412             :     // XServiceInfo
     413             : 
     414             : 
     415           0 :     OUString AccessibleTabBarPageList::getImplementationName() throw (RuntimeException, std::exception)
     416             :     {
     417           0 :         return OUString( "com.sun.star.comp.svtools.AccessibleTabBarPageList" );
     418             :     }
     419             : 
     420             : 
     421             : 
     422           0 :     sal_Bool AccessibleTabBarPageList::supportsService( const OUString& rServiceName ) throw (RuntimeException, std::exception)
     423             :     {
     424           0 :         return cppu::supportsService(this, rServiceName);
     425             :     }
     426             : 
     427             : 
     428             : 
     429           0 :     Sequence< OUString > AccessibleTabBarPageList::getSupportedServiceNames() throw (RuntimeException, std::exception)
     430             :     {
     431           0 :         Sequence< OUString > aNames(1);
     432           0 :         aNames[0] = "com.sun.star.awt.AccessibleTabBarPageList";
     433           0 :         return aNames;
     434             :     }
     435             : 
     436             : 
     437             :     // XAccessible
     438             : 
     439             : 
     440           0 :     Reference< XAccessibleContext > AccessibleTabBarPageList::getAccessibleContext(  ) throw (RuntimeException, std::exception)
     441             :     {
     442           0 :         OExternalLockGuard aGuard( this );
     443             : 
     444           0 :         return this;
     445             :     }
     446             : 
     447             : 
     448             :     // XAccessibleContext
     449             : 
     450             : 
     451           0 :     sal_Int32 AccessibleTabBarPageList::getAccessibleChildCount() throw (RuntimeException, std::exception)
     452             :     {
     453           0 :         OExternalLockGuard aGuard( this );
     454             : 
     455           0 :         return m_aAccessibleChildren.size();
     456             :     }
     457             : 
     458             : 
     459             : 
     460           0 :     Reference< XAccessible > AccessibleTabBarPageList::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     461             :     {
     462           0 :         OExternalLockGuard aGuard( this );
     463             : 
     464           0 :         if ( i < 0 || i >= getAccessibleChildCount() )
     465           0 :             throw IndexOutOfBoundsException();
     466             : 
     467           0 :         Reference< XAccessible > xChild = m_aAccessibleChildren[i];
     468           0 :         if ( !xChild.is() )
     469             :         {
     470           0 :             if ( m_pTabBar )
     471             :             {
     472           0 :                 sal_uInt16 nPageId = m_pTabBar->GetPageId( (sal_uInt16)i );
     473             : 
     474           0 :                 xChild = new AccessibleTabBarPage( m_pTabBar, nPageId, this );
     475             : 
     476             :                 // insert into child list
     477           0 :                 m_aAccessibleChildren[i] = xChild;
     478             :             }
     479             :         }
     480             : 
     481           0 :         return xChild;
     482             :     }
     483             : 
     484             : 
     485             : 
     486           0 :     Reference< XAccessible > AccessibleTabBarPageList::getAccessibleParent(  ) throw (RuntimeException, std::exception)
     487             :     {
     488           0 :         OExternalLockGuard aGuard( this );
     489             : 
     490           0 :         Reference< XAccessible > xParent;
     491           0 :         if ( m_pTabBar )
     492           0 :             xParent = m_pTabBar->GetAccessible();
     493             : 
     494           0 :         return xParent;
     495             :     }
     496             : 
     497             : 
     498             : 
     499           0 :     sal_Int32 AccessibleTabBarPageList::getAccessibleIndexInParent(  ) throw (RuntimeException, std::exception)
     500             :     {
     501           0 :         OExternalLockGuard aGuard( this );
     502             : 
     503           0 :         return m_nIndexInParent;
     504             :     }
     505             : 
     506             : 
     507             : 
     508           0 :     sal_Int16 AccessibleTabBarPageList::getAccessibleRole(  ) throw (RuntimeException, std::exception)
     509             :     {
     510           0 :         OExternalLockGuard aGuard( this );
     511             : 
     512           0 :         return AccessibleRole::PAGE_TAB_LIST;
     513             :     }
     514             : 
     515             : 
     516             : 
     517           0 :     OUString AccessibleTabBarPageList::getAccessibleDescription( ) throw (RuntimeException, std::exception)
     518             :     {
     519           0 :         OExternalLockGuard aGuard( this );
     520             : 
     521           0 :         return OUString();
     522             :     }
     523             : 
     524             : 
     525             : 
     526           0 :     OUString AccessibleTabBarPageList::getAccessibleName(  ) throw (RuntimeException, std::exception)
     527             :     {
     528           0 :         OExternalLockGuard aGuard( this );
     529             : 
     530           0 :         return OUString();
     531             :     }
     532             : 
     533             : 
     534             : 
     535           0 :     Reference< XAccessibleRelationSet > AccessibleTabBarPageList::getAccessibleRelationSet(  ) throw (RuntimeException, std::exception)
     536             :     {
     537           0 :         OExternalLockGuard aGuard( this );
     538             : 
     539           0 :         utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
     540           0 :         Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
     541           0 :         return xSet;
     542             :     }
     543             : 
     544             : 
     545             : 
     546           0 :     Reference< XAccessibleStateSet > AccessibleTabBarPageList::getAccessibleStateSet(  ) throw (RuntimeException, std::exception)
     547             :     {
     548           0 :         OExternalLockGuard aGuard( this );
     549             : 
     550           0 :         utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
     551           0 :         Reference< XAccessibleStateSet > xSet = pStateSetHelper;
     552             : 
     553           0 :         if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
     554             :         {
     555           0 :             FillAccessibleStateSet( *pStateSetHelper );
     556             :         }
     557             :         else
     558             :         {
     559           0 :             pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
     560             :         }
     561             : 
     562           0 :         return xSet;
     563             :     }
     564             : 
     565             : 
     566             : 
     567           0 :     Locale AccessibleTabBarPageList::getLocale(  ) throw (IllegalAccessibleComponentStateException, RuntimeException, std::exception)
     568             :     {
     569           0 :         OExternalLockGuard aGuard( this );
     570             : 
     571           0 :         return Application::GetSettings().GetLanguageTag().getLocale();
     572             :     }
     573             : 
     574             : 
     575             :     // XAccessibleComponent
     576             : 
     577             : 
     578           0 :     Reference< XAccessible > AccessibleTabBarPageList::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException, std::exception)
     579             :     {
     580           0 :         OExternalLockGuard aGuard( this );
     581             : 
     582           0 :         Reference< XAccessible > xChild;
     583           0 :         for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
     584             :         {
     585           0 :             Reference< XAccessible > xAcc = getAccessibleChild( i );
     586           0 :             if ( xAcc.is() )
     587             :             {
     588           0 :                 Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY );
     589           0 :                 if ( xComp.is() )
     590             :                 {
     591           0 :                     Rectangle aRect = VCLRectangle( xComp->getBounds() );
     592           0 :                     Point aPos = VCLPoint( rPoint );
     593           0 :                     if ( aRect.IsInside( aPos ) )
     594             :                     {
     595           0 :                         xChild = xAcc;
     596           0 :                         break;
     597             :                     }
     598           0 :                 }
     599             :             }
     600           0 :         }
     601             : 
     602           0 :         return xChild;
     603             :     }
     604             : 
     605             : 
     606             : 
     607           0 :     void AccessibleTabBarPageList::grabFocus(  ) throw (RuntimeException, std::exception)
     608             :     {
     609             :         // no focus
     610           0 :     }
     611             : 
     612             : 
     613             : 
     614           0 :     sal_Int32 AccessibleTabBarPageList::getForeground(  ) throw (RuntimeException, std::exception)
     615             :     {
     616           0 :         OExternalLockGuard aGuard( this );
     617             : 
     618           0 :         sal_Int32 nColor = 0;
     619           0 :         Reference< XAccessible > xParent = getAccessibleParent();
     620           0 :         if ( xParent.is() )
     621             :         {
     622           0 :             Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
     623           0 :             if ( xParentComp.is() )
     624           0 :                 nColor = xParentComp->getForeground();
     625             :         }
     626             : 
     627           0 :         return nColor;
     628             :     }
     629             : 
     630             : 
     631             : 
     632           0 :     sal_Int32 AccessibleTabBarPageList::getBackground(  ) throw (RuntimeException, std::exception)
     633             :     {
     634           0 :         OExternalLockGuard aGuard( this );
     635             : 
     636           0 :         sal_Int32 nColor = 0;
     637           0 :         Reference< XAccessible > xParent = getAccessibleParent();
     638           0 :         if ( xParent.is() )
     639             :         {
     640           0 :             Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
     641           0 :             if ( xParentComp.is() )
     642           0 :                 nColor = xParentComp->getBackground();
     643             :         }
     644             : 
     645           0 :         return nColor;
     646             :     }
     647             : 
     648             : 
     649             :     // XAccessibleExtendedComponent
     650             : 
     651             : 
     652           0 :     Reference< awt::XFont > AccessibleTabBarPageList::getFont(  ) throw (RuntimeException, std::exception)
     653             :     {
     654           0 :         OExternalLockGuard aGuard( this );
     655             : 
     656           0 :         Reference< awt::XFont > xFont;
     657           0 :         Reference< XAccessible > xParent = getAccessibleParent();
     658           0 :         if ( xParent.is() )
     659             :         {
     660           0 :             Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
     661           0 :             if ( xParentComp.is() )
     662           0 :                 xFont = xParentComp->getFont();
     663             :         }
     664             : 
     665           0 :         return xFont;
     666             :     }
     667             : 
     668             : 
     669             : 
     670           0 :     OUString AccessibleTabBarPageList::getTitledBorderText(  ) throw (RuntimeException, std::exception)
     671             :     {
     672           0 :         OExternalLockGuard aGuard( this );
     673             : 
     674           0 :         return OUString();
     675             :     }
     676             : 
     677             : 
     678             : 
     679           0 :     OUString AccessibleTabBarPageList::getToolTipText(  ) throw (RuntimeException, std::exception)
     680             :     {
     681           0 :         OExternalLockGuard aGuard( this );
     682             : 
     683           0 :         return OUString();
     684             :     }
     685             : 
     686             : 
     687             :     // XAccessibleSelection
     688             : 
     689             : 
     690           0 :     void AccessibleTabBarPageList::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     691             :     {
     692           0 :         OExternalLockGuard aGuard( this );
     693             : 
     694           0 :         if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
     695           0 :             throw IndexOutOfBoundsException();
     696             : 
     697           0 :         if ( m_pTabBar )
     698             :         {
     699           0 :             m_pTabBar->SetCurPageId( m_pTabBar->GetPageId( (sal_uInt16)nChildIndex ) );
     700           0 :             m_pTabBar->Update();
     701           0 :             m_pTabBar->ActivatePage();
     702           0 :             m_pTabBar->Select();
     703           0 :         }
     704           0 :     }
     705             : 
     706             : 
     707             : 
     708           0 :     sal_Bool AccessibleTabBarPageList::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     709             :     {
     710           0 :         OExternalLockGuard aGuard( this );
     711             : 
     712           0 :         if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
     713           0 :             throw IndexOutOfBoundsException();
     714             : 
     715           0 :         sal_Bool bSelected = sal_False;
     716           0 :         if ( m_pTabBar && m_pTabBar->GetCurPageId() == m_pTabBar->GetPageId( (sal_uInt16)nChildIndex ) )
     717           0 :             bSelected = sal_True;
     718             : 
     719           0 :         return bSelected;
     720             :     }
     721             : 
     722             : 
     723             : 
     724           0 :     void AccessibleTabBarPageList::clearAccessibleSelection(  ) throw (RuntimeException, std::exception)
     725             :     {
     726             :         // This method makes no sense in a TabBar, and so does nothing.
     727           0 :     }
     728             : 
     729             : 
     730             : 
     731           0 :     void AccessibleTabBarPageList::selectAllAccessibleChildren(  ) throw (RuntimeException, std::exception)
     732             :     {
     733           0 :         OExternalLockGuard aGuard( this );
     734             : 
     735           0 :         selectAccessibleChild( 0 );
     736           0 :     }
     737             : 
     738             : 
     739             : 
     740           0 :     sal_Int32 AccessibleTabBarPageList::getSelectedAccessibleChildCount(  ) throw (RuntimeException, std::exception)
     741             :     {
     742           0 :         OExternalLockGuard aGuard( this );
     743             : 
     744           0 :         return 1;
     745             :     }
     746             : 
     747             : 
     748             : 
     749           0 :     Reference< XAccessible > AccessibleTabBarPageList::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     750             :     {
     751           0 :         OExternalLockGuard aGuard( this );
     752             : 
     753           0 :         if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() )
     754           0 :             throw IndexOutOfBoundsException();
     755             : 
     756           0 :         Reference< XAccessible > xChild;
     757             : 
     758           0 :         for ( sal_Int32 i = 0, j = 0, nCount = getAccessibleChildCount(); i < nCount; i++ )
     759             :         {
     760           0 :             if ( isAccessibleChildSelected( i ) && ( j++ == nSelectedChildIndex ) )
     761             :             {
     762           0 :                 xChild = getAccessibleChild( i );
     763           0 :                 break;
     764             :             }
     765             :         }
     766             : 
     767           0 :         return xChild;
     768             :     }
     769             : 
     770             : 
     771             : 
     772           0 :     void AccessibleTabBarPageList::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
     773             :     {
     774           0 :         OExternalLockGuard aGuard( this );
     775             : 
     776           0 :         if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
     777           0 :             throw IndexOutOfBoundsException();
     778             : 
     779             :         // This method makes no sense in a TabBar, and so does nothing.
     780           0 :     }
     781             : 
     782             : 
     783             : 
     784             : 
     785             : }   // namespace accessibility
     786             : 
     787             : 
     788             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10