Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 :
21 : #include "accessibility/extended/accessibletablistbox.hxx"
22 : #include "accessibility/extended/accessibletablistboxtable.hxx"
23 : #include <svtools/svtabbx.hxx>
24 : #include <comphelper/sequence.hxx>
25 :
26 : //........................................................................
27 : namespace accessibility
28 : {
29 : //........................................................................
30 :
31 : // class AccessibleTabListBox -----------------------------------------------------
32 :
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;
37 :
38 : // -----------------------------------------------------------------------------
39 : // Ctor() and Dtor()
40 : // -----------------------------------------------------------------------------
41 0 : AccessibleTabListBox::AccessibleTabListBox( const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox )
42 : :AccessibleBrowseBox( rxParent, NULL, rBox )
43 0 : ,m_pTabListBox( &rBox )
44 :
45 : {
46 0 : osl_atomic_increment( &m_refCount );
47 : {
48 0 : setCreator( this );
49 : }
50 0 : osl_atomic_decrement( &m_refCount );
51 0 : }
52 :
53 : // -----------------------------------------------------------------------------
54 0 : AccessibleTabListBox::~AccessibleTabListBox()
55 : {
56 0 : if ( isAlive() )
57 : {
58 : // increment ref count to prevent double call of Dtor
59 0 : osl_atomic_increment( &m_refCount );
60 0 : dispose();
61 : }
62 0 : }
63 : // -----------------------------------------------------------------------------
64 0 : AccessibleBrowseBoxTable* AccessibleTabListBox::createAccessibleTable()
65 : {
66 0 : return new AccessibleTabListBoxTable( this, *m_pTabListBox );
67 : }
68 :
69 : // XInterface -----------------------------------------------------------------
70 0 : IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base )
71 :
72 : // XTypeProvider --------------------------------------------------------------
73 0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base )
74 :
75 : // XAccessibleContext ---------------------------------------------------------
76 :
77 0 : sal_Int32 SAL_CALL AccessibleTabListBox::getAccessibleChildCount()
78 : throw ( uno::RuntimeException )
79 : {
80 0 : return 2; // header and table
81 : }
82 :
83 : // -----------------------------------------------------------------------------
84 0 : Reference< XAccessibleContext > SAL_CALL AccessibleTabListBox::getAccessibleContext() throw ( RuntimeException )
85 : {
86 0 : return this;
87 : }
88 :
89 : // -----------------------------------------------------------------------------
90 : Reference< XAccessible > SAL_CALL
91 0 : AccessibleTabListBox::getAccessibleChild( sal_Int32 nChildIndex )
92 : throw ( IndexOutOfBoundsException, RuntimeException )
93 : {
94 0 : SolarMutexGuard aSolarGuard;
95 0 : ::osl::MutexGuard aGuard( getOslMutex() );
96 0 : ensureIsAlive();
97 :
98 0 : if ( nChildIndex < 0 || nChildIndex > 1 )
99 0 : throw IndexOutOfBoundsException();
100 :
101 0 : Reference< XAccessible > xRet;
102 0 : if (nChildIndex == 0)
103 : {
104 : //! so far the actual implementation object only supports column headers
105 0 : xRet = implGetFixedChild( ::svt::BBINDEX_COLUMNHEADERBAR );
106 : }
107 0 : else if (nChildIndex == 1)
108 0 : xRet = implGetFixedChild( ::svt::BBINDEX_TABLE );
109 :
110 0 : if ( !xRet.is() )
111 0 : throw RuntimeException();
112 :
113 0 : return xRet;
114 : }
115 :
116 : //........................................................................
117 : }// namespace accessibility
118 : //........................................................................
119 :
120 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|