Branch libreoffice-5-0-4
[LibreOffice.git] / accessibility / source / extended / accessibletablistbox.cxx
blobf2ec2d8c9126e8132816c514fd6b40bb65b7275d
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 .
21 #include "accessibility/extended/accessibletablistbox.hxx"
22 #include "accessibility/extended/accessibletablistboxtable.hxx"
23 #include <svtools/svtabbx.hxx>
24 #include <comphelper/sequence.hxx>
27 namespace accessibility
31 // class AccessibleTabListBox -----------------------------------------------------
33 using namespace ::com::sun::star::accessibility;
34 using namespace ::com::sun::star::uno;
35 using namespace ::com::sun::star::lang;
36 using namespace ::com::sun::star;
39 // Ctor() and Dtor()
41 AccessibleTabListBox::AccessibleTabListBox( const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox )
42 :AccessibleBrowseBox( rxParent, NULL, rBox )
43 ,m_pTabListBox( &rBox )
46 osl_atomic_increment( &m_refCount );
48 setCreator( this );
50 osl_atomic_decrement( &m_refCount );
54 AccessibleTabListBox::~AccessibleTabListBox()
56 if ( isAlive() )
58 // increment ref count to prevent double call of Dtor
59 osl_atomic_increment( &m_refCount );
60 dispose();
64 AccessibleBrowseBoxTable* AccessibleTabListBox::createAccessibleTable()
66 return new AccessibleTabListBoxTable( this, *m_pTabListBox );
69 // XInterface -----------------------------------------------------------------
70 IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base )
72 // XTypeProvider --------------------------------------------------------------
73 IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base )
75 // XAccessibleContext ---------------------------------------------------------
77 sal_Int32 SAL_CALL AccessibleTabListBox::getAccessibleChildCount()
78 throw ( uno::RuntimeException, std::exception )
80 return 2; // header and table
84 Reference< XAccessibleContext > SAL_CALL AccessibleTabListBox::getAccessibleContext() throw ( RuntimeException, std::exception )
86 return this;
90 Reference< XAccessible > SAL_CALL
91 AccessibleTabListBox::getAccessibleChild( sal_Int32 nChildIndex )
92 throw ( IndexOutOfBoundsException, RuntimeException, std::exception )
94 SolarMutexGuard aSolarGuard;
95 ::osl::MutexGuard aGuard( getOslMutex() );
96 ensureIsAlive();
98 if ( nChildIndex < 0 || nChildIndex > 1 )
99 throw IndexOutOfBoundsException();
101 Reference< XAccessible > xRet;
102 if (nChildIndex == 0)
104 //! so far the actual implementation object only supports column headers
105 xRet = implGetFixedChild( ::svt::BBINDEX_COLUMNHEADERBAR );
107 else if (nChildIndex == 1)
108 xRet = implGetFixedChild( ::svt::BBINDEX_TABLE );
110 if ( !xRet.is() )
111 throw RuntimeException();
113 return xRet;
117 }// namespace accessibility
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */