LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / accessibility / source / extended / accessibletablistbox.cxx
blobe34f1896f307958081d55912cf8fc55085ff9b7b
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 <extended/accessibletablistbox.hxx>
21 #include <extended/accessibletablistboxtable.hxx>
22 #include <vcl/toolkit/svtabbx.hxx>
23 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
25 namespace accessibility
29 // class AccessibleTabListBox -----------------------------------------------------
31 using namespace ::com::sun::star::accessibility;
32 using namespace ::com::sun::star::uno;
33 using namespace ::com::sun::star::lang;
34 using namespace ::com::sun::star;
37 // Ctor() and Dtor()
39 AccessibleTabListBox::AccessibleTabListBox( const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox )
40 :AccessibleBrowseBox( rxParent, nullptr, rBox )
41 ,m_pTabListBox( &rBox )
43 osl_atomic_increment( &m_refCount );
45 setCreator( this );
47 osl_atomic_decrement( &m_refCount );
51 AccessibleTabListBox::~AccessibleTabListBox()
53 if ( isAlive() )
55 // increment ref count to prevent double call of Dtor
56 osl_atomic_increment( &m_refCount );
57 dispose();
61 rtl::Reference<AccessibleBrowseBoxTable> AccessibleTabListBox::createAccessibleTable()
63 return new AccessibleTabListBoxTable( this, *m_pTabListBox );
66 // XInterface -----------------------------------------------------------------
67 IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base )
69 // XTypeProvider --------------------------------------------------------------
70 IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base )
72 // XAccessibleContext ---------------------------------------------------------
74 sal_Int32 SAL_CALL AccessibleTabListBox::getAccessibleChildCount()
76 return 2; // header and table
79 Reference< XAccessibleContext > SAL_CALL AccessibleTabListBox::getAccessibleContext()
81 return this;
84 Reference< XAccessible > SAL_CALL
85 AccessibleTabListBox::getAccessibleChild( sal_Int32 nChildIndex )
87 SolarMethodGuard aGuard(getMutex());
88 ensureIsAlive();
90 if ( nChildIndex < 0 || nChildIndex > 1 )
91 throw IndexOutOfBoundsException();
93 Reference< XAccessible > xRet;
94 if (nChildIndex == 0)
96 //! so far the actual implementation object only supports column headers
97 xRet = implGetHeaderBar( AccessibleBrowseBoxObjType::ColumnHeaderBar );
99 else if (nChildIndex == 1)
100 xRet = implGetTable();
102 if ( !xRet.is() )
103 throw RuntimeException();
105 return xRet;
109 }// namespace accessibility
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */