update dev300-m58
[ooovba.git] / accessibility / source / extended / accessibletablistbox.cxx
blobb02d4db0a4a21996b19ffb128887fde6d4d932b8
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: accessibletablistbox.cxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_accessibility.hxx"
34 #ifndef ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX_
35 #include "accessibility/extended/accessibletablistbox.hxx"
36 #endif
37 #include "accessibility/extended/accessibletablistboxtable.hxx"
38 #include <svtools/svtabbx.hxx>
39 #include <comphelper/sequence.hxx>
41 //........................................................................
42 namespace accessibility
44 //........................................................................
46 // class TLBSolarGuard ---------------------------------------------------------
48 /** Aquire the solar mutex. */
49 class TLBSolarGuard : public ::vos::OGuard
51 public:
52 inline TLBSolarGuard() : ::vos::OGuard( Application::GetSolarMutex() ) {}
55 // class AccessibleTabListBox -----------------------------------------------------
57 using namespace ::com::sun::star::accessibility;
58 using namespace ::com::sun::star::uno;
59 using namespace ::com::sun::star::lang;
60 using namespace ::com::sun::star;
62 DBG_NAME(AccessibleTabListBox)
64 // -----------------------------------------------------------------------------
65 // Ctor() and Dtor()
66 // -----------------------------------------------------------------------------
67 AccessibleTabListBox::AccessibleTabListBox( const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox )
68 :AccessibleBrowseBox( rxParent, NULL, rBox )
69 ,m_pTabListBox( &rBox )
72 DBG_CTOR( AccessibleTabListBox, NULL );
74 osl_incrementInterlockedCount( &m_refCount );
76 setCreator( this );
78 osl_decrementInterlockedCount( &m_refCount );
81 // -----------------------------------------------------------------------------
82 AccessibleTabListBox::~AccessibleTabListBox()
84 DBG_DTOR( AccessibleTabListBox, NULL );
86 if ( isAlive() )
88 // increment ref count to prevent double call of Dtor
89 osl_incrementInterlockedCount( &m_refCount );
90 dispose();
93 // -----------------------------------------------------------------------------
94 AccessibleBrowseBoxTable* AccessibleTabListBox::createAccessibleTable()
96 return new AccessibleTabListBoxTable( this, *m_pTabListBox );
99 // XInterface -----------------------------------------------------------------
100 IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base )
102 // XTypeProvider --------------------------------------------------------------
103 IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base )
105 // XAccessibleContext ---------------------------------------------------------
107 sal_Int32 SAL_CALL AccessibleTabListBox::getAccessibleChildCount()
108 throw ( uno::RuntimeException )
110 return 1; // no header, only table
113 // -----------------------------------------------------------------------------
114 Reference< XAccessibleContext > SAL_CALL AccessibleTabListBox::getAccessibleContext() throw ( RuntimeException )
116 return this;
119 // -----------------------------------------------------------------------------
120 Reference< XAccessible > SAL_CALL
121 AccessibleTabListBox::getAccessibleChild( sal_Int32 nChildIndex )
122 throw ( IndexOutOfBoundsException, RuntimeException )
124 TLBSolarGuard aSolarGuard;
125 ::osl::MutexGuard aGuard( getOslMutex() );
126 ensureIsAlive();
128 if ( nChildIndex != 0 )
129 // only one child
130 throw IndexOutOfBoundsException();
132 Reference< XAccessible > xRet = implGetFixedChild( ::svt::BBINDEX_TABLE );
134 if ( !xRet.is() )
135 throw RuntimeException();
137 return xRet;
140 //........................................................................
141 }// namespace accessibility
142 //........................................................................