Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / accessibility / source / extended / accessibletabbarpagelist.cxx
blob889908635d0a425aad5812a15428c40b8607f43e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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 <toolkit/helper/convert.hxx>
33 //.........................................................................
34 namespace accessibility
36 //.........................................................................
38 using namespace ::com::sun::star::accessibility;
39 using namespace ::com::sun::star::uno;
40 using namespace ::com::sun::star::lang;
41 using namespace ::com::sun::star;
42 using namespace ::comphelper;
44 // -----------------------------------------------------------------------------
45 // class AccessibleTabBarPageList
46 // -----------------------------------------------------------------------------
48 AccessibleTabBarPageList::AccessibleTabBarPageList( TabBar* pTabBar, sal_Int32 nIndexInParent )
49 :AccessibleTabBarBase( pTabBar )
50 ,m_nIndexInParent( nIndexInParent )
52 if ( m_pTabBar )
53 m_aAccessibleChildren.assign( m_pTabBar->GetPageCount(), Reference< XAccessible >() );
56 // -----------------------------------------------------------------------------
58 AccessibleTabBarPageList::~AccessibleTabBarPageList()
62 // -----------------------------------------------------------------------------
64 void AccessibleTabBarPageList::UpdateEnabled( sal_Int32 i, sal_Bool bEnabled )
66 if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
68 Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
69 if ( xChild.is() )
71 AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() );
72 if ( pAccessibleTabBarPage )
73 pAccessibleTabBarPage->SetEnabled( bEnabled );
78 // -----------------------------------------------------------------------------
80 void AccessibleTabBarPageList::UpdateShowing( sal_Bool bShowing )
82 for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
84 Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
85 if ( xChild.is() )
87 AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() );
88 if ( pAccessibleTabBarPage )
89 pAccessibleTabBarPage->SetShowing( bShowing );
94 // -----------------------------------------------------------------------------
96 void AccessibleTabBarPageList::UpdateSelected( sal_Int32 i, sal_Bool bSelected )
98 NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
100 if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
102 Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
103 if ( xChild.is() )
105 AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() );
106 if ( pAccessibleTabBarPage )
107 pAccessibleTabBarPage->SetSelected( bSelected );
112 // -----------------------------------------------------------------------------
114 void AccessibleTabBarPageList::UpdatePageText( sal_Int32 i )
116 if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
118 Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
119 if ( xChild.is() )
121 AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() );
122 if ( pAccessibleTabBarPage )
124 if ( m_pTabBar )
126 OUString sPageText = m_pTabBar->GetPageText( m_pTabBar->GetPageId( (sal_uInt16)i ) );
127 pAccessibleTabBarPage->SetPageText( sPageText );
134 // -----------------------------------------------------------------------------
136 void AccessibleTabBarPageList::InsertChild( sal_Int32 i )
138 if ( i >= 0 && i <= (sal_Int32)m_aAccessibleChildren.size() )
140 // insert entry in child list
141 m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + i, Reference< XAccessible >() );
143 // send accessible child event
144 Reference< XAccessible > xChild( getAccessibleChild( i ) );
145 if ( xChild.is() )
147 Any aOldValue, aNewValue;
148 aNewValue <<= xChild;
149 NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
154 // -----------------------------------------------------------------------------
156 void AccessibleTabBarPageList::RemoveChild( sal_Int32 i )
158 if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
160 // get the accessible of the removed page
161 Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
163 // remove entry in child list
164 m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i );
166 // send accessible child event
167 if ( xChild.is() )
169 Any aOldValue, aNewValue;
170 aOldValue <<= xChild;
171 NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
173 Reference< XComponent > xComponent( xChild, UNO_QUERY );
174 if ( xComponent.is() )
175 xComponent->dispose();
180 // -----------------------------------------------------------------------------
182 void AccessibleTabBarPageList::MoveChild( sal_Int32 i, sal_Int32 j )
184 if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() &&
185 j >= 0 && j <= (sal_Int32)m_aAccessibleChildren.size() )
187 if ( i < j )
188 --j;
190 // get the accessible of the moved page
191 Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
193 // remove entry in child list at old position
194 m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i );
196 // insert entry in child list at new position
197 m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + j, xChild );
201 // -----------------------------------------------------------------------------
203 void AccessibleTabBarPageList::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
205 switch ( rVclWindowEvent.GetId() )
207 case VCLEVENT_WINDOW_ENABLED:
209 Any aNewValue;
210 aNewValue <<= AccessibleStateType::SENSITIVE;
211 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), aNewValue );
212 aNewValue <<= AccessibleStateType::ENABLED;
213 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), aNewValue );
215 break;
216 case VCLEVENT_WINDOW_DISABLED:
218 Any aOldValue;
219 aOldValue <<= AccessibleStateType::ENABLED;
220 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, Any() );
221 aOldValue <<= AccessibleStateType::SENSITIVE;
222 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, Any() );
224 break;
225 case VCLEVENT_WINDOW_SHOW:
227 Any aOldValue, aNewValue;
228 aNewValue <<= AccessibleStateType::SHOWING;
229 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
230 UpdateShowing( sal_True );
232 break;
233 case VCLEVENT_WINDOW_HIDE:
235 Any aOldValue, aNewValue;
236 aOldValue <<= AccessibleStateType::SHOWING;
237 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
238 UpdateShowing( sal_False );
240 break;
241 case VCLEVENT_TABBAR_PAGEENABLED:
243 if ( m_pTabBar )
245 sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
246 sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
247 UpdateEnabled( nPagePos, sal_True );
250 break;
251 case VCLEVENT_TABBAR_PAGEDISABLED:
253 if ( m_pTabBar )
255 sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
256 sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
257 UpdateEnabled( nPagePos, sal_False );
260 break;
261 case VCLEVENT_TABBAR_PAGESELECTED:
263 // do nothing
265 break;
266 case VCLEVENT_TABBAR_PAGEACTIVATED:
268 if ( m_pTabBar )
270 sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
271 sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
272 UpdateSelected( nPagePos, sal_True );
275 break;
276 case VCLEVENT_TABBAR_PAGEDEACTIVATED:
278 if ( m_pTabBar )
280 sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
281 sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
282 UpdateSelected( nPagePos, sal_False );
285 break;
286 case VCLEVENT_TABBAR_PAGEINSERTED:
288 if ( m_pTabBar )
290 sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
291 sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
292 InsertChild( nPagePos );
295 break;
296 case VCLEVENT_TABBAR_PAGEREMOVED:
298 if ( m_pTabBar )
300 sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
302 if ( nPageId == TabBar::PAGE_NOT_FOUND )
304 for ( sal_Int32 i = m_aAccessibleChildren.size() - 1; i >= 0; --i )
305 RemoveChild( i );
307 else
309 for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
311 Reference< XAccessible > xChild( getAccessibleChild( i ) );
312 if ( xChild.is() )
314 AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() );
315 if ( pAccessibleTabBarPage && pAccessibleTabBarPage->GetPageId() == nPageId )
317 RemoveChild( i );
318 break;
325 break;
326 case VCLEVENT_TABBAR_PAGEMOVED:
328 Pair* pPair = (Pair*) rVclWindowEvent.GetData();
329 if ( pPair )
330 MoveChild( pPair->A(), pPair->B() );
332 break;
333 case VCLEVENT_TABBAR_PAGETEXTCHANGED:
335 sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
336 sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
337 UpdatePageText( nPagePos );
339 break;
340 default:
342 AccessibleTabBarBase::ProcessWindowEvent( rVclWindowEvent );
344 break;
348 // -----------------------------------------------------------------------------
350 void AccessibleTabBarPageList::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
352 if ( m_pTabBar )
354 if ( m_pTabBar->IsEnabled() )
356 rStateSet.AddState( AccessibleStateType::ENABLED );
357 rStateSet.AddState( AccessibleStateType::SENSITIVE );
360 rStateSet.AddState( AccessibleStateType::VISIBLE );
362 if ( m_pTabBar->IsVisible() )
363 rStateSet.AddState( AccessibleStateType::SHOWING );
367 // -----------------------------------------------------------------------------
368 // OCommonAccessibleComponent
369 // -----------------------------------------------------------------------------
371 awt::Rectangle AccessibleTabBarPageList::implGetBounds() throw (RuntimeException)
373 awt::Rectangle aBounds;
374 if ( m_pTabBar )
375 aBounds = AWTRectangle( m_pTabBar->GetPageArea() );
377 return aBounds;
380 // -----------------------------------------------------------------------------
381 // XInterface
382 // -----------------------------------------------------------------------------
384 IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabBarPageList, AccessibleExtendedComponentHelper_BASE, AccessibleTabBarPageList_BASE )
386 // -----------------------------------------------------------------------------
387 // XTypeProvider
388 // -----------------------------------------------------------------------------
390 IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabBarPageList, AccessibleExtendedComponentHelper_BASE, AccessibleTabBarPageList_BASE )
392 // -----------------------------------------------------------------------------
393 // XComponent
394 // -----------------------------------------------------------------------------
396 void AccessibleTabBarPageList::disposing()
398 AccessibleTabBarBase::disposing();
400 // dispose all children
401 for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
403 Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY );
404 if ( xComponent.is() )
405 xComponent->dispose();
407 m_aAccessibleChildren.clear();
410 // -----------------------------------------------------------------------------
411 // XServiceInfo
412 // -----------------------------------------------------------------------------
414 OUString AccessibleTabBarPageList::getImplementationName() throw (RuntimeException)
416 return OUString( "com.sun.star.comp.svtools.AccessibleTabBarPageList" );
419 // -----------------------------------------------------------------------------
421 sal_Bool AccessibleTabBarPageList::supportsService( const OUString& rServiceName ) throw (RuntimeException)
423 return cppu::supportsService(this, rServiceName);
426 // -----------------------------------------------------------------------------
428 Sequence< OUString > AccessibleTabBarPageList::getSupportedServiceNames() throw (RuntimeException)
430 Sequence< OUString > aNames(1);
431 aNames[0] = "com.sun.star.awt.AccessibleTabBarPageList";
432 return aNames;
435 // -----------------------------------------------------------------------------
436 // XAccessible
437 // -----------------------------------------------------------------------------
439 Reference< XAccessibleContext > AccessibleTabBarPageList::getAccessibleContext( ) throw (RuntimeException)
441 OExternalLockGuard aGuard( this );
443 return this;
446 // -----------------------------------------------------------------------------
447 // XAccessibleContext
448 // -----------------------------------------------------------------------------
450 sal_Int32 AccessibleTabBarPageList::getAccessibleChildCount() throw (RuntimeException)
452 OExternalLockGuard aGuard( this );
454 return m_aAccessibleChildren.size();
457 // -----------------------------------------------------------------------------
459 Reference< XAccessible > AccessibleTabBarPageList::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
461 OExternalLockGuard aGuard( this );
463 if ( i < 0 || i >= getAccessibleChildCount() )
464 throw IndexOutOfBoundsException();
466 Reference< XAccessible > xChild = m_aAccessibleChildren[i];
467 if ( !xChild.is() )
469 if ( m_pTabBar )
471 sal_uInt16 nPageId = m_pTabBar->GetPageId( (sal_uInt16)i );
473 xChild = new AccessibleTabBarPage( m_pTabBar, nPageId, this );
475 // insert into child list
476 m_aAccessibleChildren[i] = xChild;
480 return xChild;
483 // -----------------------------------------------------------------------------
485 Reference< XAccessible > AccessibleTabBarPageList::getAccessibleParent( ) throw (RuntimeException)
487 OExternalLockGuard aGuard( this );
489 Reference< XAccessible > xParent;
490 if ( m_pTabBar )
491 xParent = m_pTabBar->GetAccessible();
493 return xParent;
496 // -----------------------------------------------------------------------------
498 sal_Int32 AccessibleTabBarPageList::getAccessibleIndexInParent( ) throw (RuntimeException)
500 OExternalLockGuard aGuard( this );
502 return m_nIndexInParent;
505 // -----------------------------------------------------------------------------
507 sal_Int16 AccessibleTabBarPageList::getAccessibleRole( ) throw (RuntimeException)
509 OExternalLockGuard aGuard( this );
511 return AccessibleRole::PAGE_TAB_LIST;
514 // -----------------------------------------------------------------------------
516 OUString AccessibleTabBarPageList::getAccessibleDescription( ) throw (RuntimeException)
518 OExternalLockGuard aGuard( this );
520 return OUString();
523 // -----------------------------------------------------------------------------
525 OUString AccessibleTabBarPageList::getAccessibleName( ) throw (RuntimeException)
527 OExternalLockGuard aGuard( this );
529 return OUString();
532 // -----------------------------------------------------------------------------
534 Reference< XAccessibleRelationSet > AccessibleTabBarPageList::getAccessibleRelationSet( ) throw (RuntimeException)
536 OExternalLockGuard aGuard( this );
538 utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
539 Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
540 return xSet;
543 // -----------------------------------------------------------------------------
545 Reference< XAccessibleStateSet > AccessibleTabBarPageList::getAccessibleStateSet( ) throw (RuntimeException)
547 OExternalLockGuard aGuard( this );
549 utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
550 Reference< XAccessibleStateSet > xSet = pStateSetHelper;
552 if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
554 FillAccessibleStateSet( *pStateSetHelper );
556 else
558 pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
561 return xSet;
564 // -----------------------------------------------------------------------------
566 Locale AccessibleTabBarPageList::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException)
568 OExternalLockGuard aGuard( this );
570 return Application::GetSettings().GetLanguageTag().getLocale();
573 // -----------------------------------------------------------------------------
574 // XAccessibleComponent
575 // -----------------------------------------------------------------------------
577 Reference< XAccessible > AccessibleTabBarPageList::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException)
579 OExternalLockGuard aGuard( this );
581 Reference< XAccessible > xChild;
582 for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
584 Reference< XAccessible > xAcc = getAccessibleChild( i );
585 if ( xAcc.is() )
587 Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY );
588 if ( xComp.is() )
590 Rectangle aRect = VCLRectangle( xComp->getBounds() );
591 Point aPos = VCLPoint( rPoint );
592 if ( aRect.IsInside( aPos ) )
594 xChild = xAcc;
595 break;
601 return xChild;
604 // -----------------------------------------------------------------------------
606 void AccessibleTabBarPageList::grabFocus( ) throw (RuntimeException)
608 // no focus
611 // -----------------------------------------------------------------------------
613 sal_Int32 AccessibleTabBarPageList::getForeground( ) throw (RuntimeException)
615 OExternalLockGuard aGuard( this );
617 sal_Int32 nColor = 0;
618 Reference< XAccessible > xParent = getAccessibleParent();
619 if ( xParent.is() )
621 Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
622 if ( xParentComp.is() )
623 nColor = xParentComp->getForeground();
626 return nColor;
629 // -----------------------------------------------------------------------------
631 sal_Int32 AccessibleTabBarPageList::getBackground( ) throw (RuntimeException)
633 OExternalLockGuard aGuard( this );
635 sal_Int32 nColor = 0;
636 Reference< XAccessible > xParent = getAccessibleParent();
637 if ( xParent.is() )
639 Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
640 if ( xParentComp.is() )
641 nColor = xParentComp->getBackground();
644 return nColor;
647 // -----------------------------------------------------------------------------
648 // XAccessibleExtendedComponent
649 // -----------------------------------------------------------------------------
651 Reference< awt::XFont > AccessibleTabBarPageList::getFont( ) throw (RuntimeException)
653 OExternalLockGuard aGuard( this );
655 Reference< awt::XFont > xFont;
656 Reference< XAccessible > xParent = getAccessibleParent();
657 if ( xParent.is() )
659 Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
660 if ( xParentComp.is() )
661 xFont = xParentComp->getFont();
664 return xFont;
667 // -----------------------------------------------------------------------------
669 OUString AccessibleTabBarPageList::getTitledBorderText( ) throw (RuntimeException)
671 OExternalLockGuard aGuard( this );
673 return OUString();
676 // -----------------------------------------------------------------------------
678 OUString AccessibleTabBarPageList::getToolTipText( ) throw (RuntimeException)
680 OExternalLockGuard aGuard( this );
682 return OUString();
685 // -----------------------------------------------------------------------------
686 // XAccessibleSelection
687 // -----------------------------------------------------------------------------
689 void AccessibleTabBarPageList::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
691 OExternalLockGuard aGuard( this );
693 if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
694 throw IndexOutOfBoundsException();
696 if ( m_pTabBar )
698 m_pTabBar->SetCurPageId( m_pTabBar->GetPageId( (sal_uInt16)nChildIndex ) );
699 m_pTabBar->Update();
700 m_pTabBar->ActivatePage();
701 m_pTabBar->Select();
705 // -----------------------------------------------------------------------------
707 sal_Bool AccessibleTabBarPageList::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
709 OExternalLockGuard aGuard( this );
711 if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
712 throw IndexOutOfBoundsException();
714 sal_Bool bSelected = sal_False;
715 if ( m_pTabBar && m_pTabBar->GetCurPageId() == m_pTabBar->GetPageId( (sal_uInt16)nChildIndex ) )
716 bSelected = sal_True;
718 return bSelected;
721 // -----------------------------------------------------------------------------
723 void AccessibleTabBarPageList::clearAccessibleSelection( ) throw (RuntimeException)
725 // This method makes no sense in a TabBar, and so does nothing.
728 // -----------------------------------------------------------------------------
730 void AccessibleTabBarPageList::selectAllAccessibleChildren( ) throw (RuntimeException)
732 OExternalLockGuard aGuard( this );
734 selectAccessibleChild( 0 );
737 // -----------------------------------------------------------------------------
739 sal_Int32 AccessibleTabBarPageList::getSelectedAccessibleChildCount( ) throw (RuntimeException)
741 OExternalLockGuard aGuard( this );
743 return 1;
746 // -----------------------------------------------------------------------------
748 Reference< XAccessible > AccessibleTabBarPageList::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
750 OExternalLockGuard aGuard( this );
752 if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() )
753 throw IndexOutOfBoundsException();
755 Reference< XAccessible > xChild;
757 for ( sal_Int32 i = 0, j = 0, nCount = getAccessibleChildCount(); i < nCount; i++ )
759 if ( isAccessibleChildSelected( i ) && ( j++ == nSelectedChildIndex ) )
761 xChild = getAccessibleChild( i );
762 break;
766 return xChild;
769 // -----------------------------------------------------------------------------
771 void AccessibleTabBarPageList::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
773 OExternalLockGuard aGuard( this );
775 if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
776 throw IndexOutOfBoundsException();
778 // This method makes no sense in a TabBar, and so does nothing.
781 // -----------------------------------------------------------------------------
783 //.........................................................................
784 } // namespace accessibility
785 //.........................................................................
787 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */