lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / accessibility / source / extended / accessibletablistbox.cxx
blob4ed0b54b90bdd6392d461db2fe9ee40cf1b2299f
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 <extended/accessibletablistbox.hxx>
22 #include <extended/accessibletablistboxtable.hxx>
23 #include <vcl/svtabbx.hxx>
26 namespace accessibility
30 // class AccessibleTabListBox -----------------------------------------------------
32 using namespace ::com::sun::star::accessibility;
33 using namespace ::com::sun::star::uno;
34 using namespace ::com::sun::star::lang;
35 using namespace ::com::sun::star;
38 // Ctor() and Dtor()
40 AccessibleTabListBox::AccessibleTabListBox( const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox )
41 :AccessibleBrowseBox( rxParent, nullptr, rBox )
42 ,m_pTabListBox( &rBox )
44 osl_atomic_increment( &m_refCount );
46 setCreator( this );
48 osl_atomic_decrement( &m_refCount );
52 AccessibleTabListBox::~AccessibleTabListBox()
54 if ( isAlive() )
56 // increment ref count to prevent double call of Dtor
57 osl_atomic_increment( &m_refCount );
58 dispose();
62 AccessibleBrowseBoxTable* AccessibleTabListBox::createAccessibleTable()
64 return new AccessibleTabListBoxTable( this, *m_pTabListBox );
67 // XInterface -----------------------------------------------------------------
68 IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base )
70 // XTypeProvider --------------------------------------------------------------
71 IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base )
73 // XAccessibleContext ---------------------------------------------------------
75 sal_Int32 SAL_CALL AccessibleTabListBox::getAccessibleChildCount()
77 return 2; // header and table
80 Reference< XAccessibleContext > SAL_CALL AccessibleTabListBox::getAccessibleContext()
82 return this;
85 Reference< XAccessible > SAL_CALL
86 AccessibleTabListBox::getAccessibleChild( sal_Int32 nChildIndex )
88 SolarMethodGuard aGuard(getMutex());
89 ensureIsAlive();
91 if ( nChildIndex < 0 || nChildIndex > 1 )
92 throw IndexOutOfBoundsException();
94 Reference< XAccessible > xRet;
95 if (nChildIndex == 0)
97 //! so far the actual implementation object only supports column headers
98 xRet = implGetHeaderBar( ::vcl::BBTYPE_COLUMNHEADERBAR );
100 else if (nChildIndex == 1)
101 xRet = implGetTable();
103 if ( !xRet.is() )
104 throw RuntimeException();
106 return xRet;
110 }// namespace accessibility
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */