Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "accessibility/extended/accessibletablistbox.hxx"
31 : : #include "accessibility/extended/accessibletablistboxtable.hxx"
32 : : #include <svtools/svtabbx.hxx>
33 : : #include <comphelper/sequence.hxx>
34 : :
35 : : //........................................................................
36 : : namespace accessibility
37 : : {
38 : : //........................................................................
39 : :
40 : : // class AccessibleTabListBox -----------------------------------------------------
41 : :
42 : : using namespace ::com::sun::star::accessibility;
43 : : using namespace ::com::sun::star::uno;
44 : : using namespace ::com::sun::star::lang;
45 : : using namespace ::com::sun::star;
46 : :
47 : : // -----------------------------------------------------------------------------
48 : : // Ctor() and Dtor()
49 : : // -----------------------------------------------------------------------------
50 : 0 : AccessibleTabListBox::AccessibleTabListBox( const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox )
51 : : :AccessibleBrowseBox( rxParent, NULL, rBox )
52 [ # # ]: 0 : ,m_pTabListBox( &rBox )
53 : :
54 : : {
55 [ # # ]: 0 : osl_incrementInterlockedCount( &m_refCount );
56 : : {
57 [ # # ][ # # ]: 0 : setCreator( this );
58 : : }
59 [ # # ]: 0 : osl_decrementInterlockedCount( &m_refCount );
60 : 0 : }
61 : :
62 : : // -----------------------------------------------------------------------------
63 : 0 : AccessibleTabListBox::~AccessibleTabListBox()
64 : : {
65 [ # # ][ # # ]: 0 : if ( isAlive() )
66 : : {
67 : : // increment ref count to prevent double call of Dtor
68 [ # # ]: 0 : osl_incrementInterlockedCount( &m_refCount );
69 [ # # ]: 0 : dispose();
70 : : }
71 [ # # ]: 0 : }
72 : : // -----------------------------------------------------------------------------
73 : 0 : AccessibleBrowseBoxTable* AccessibleTabListBox::createAccessibleTable()
74 : : {
75 [ # # ]: 0 : return new AccessibleTabListBoxTable( this, *m_pTabListBox );
76 : : }
77 : :
78 : : // XInterface -----------------------------------------------------------------
79 [ # # ][ # # ]: 0 : IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base )
80 : :
81 : : // XTypeProvider --------------------------------------------------------------
82 [ # # ][ # # ]: 0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base )
[ # # ]
83 : :
84 : : // XAccessibleContext ---------------------------------------------------------
85 : :
86 : 0 : sal_Int32 SAL_CALL AccessibleTabListBox::getAccessibleChildCount()
87 : : throw ( uno::RuntimeException )
88 : : {
89 : 0 : return 2; // header and table
90 : : }
91 : :
92 : : // -----------------------------------------------------------------------------
93 : 0 : Reference< XAccessibleContext > SAL_CALL AccessibleTabListBox::getAccessibleContext() throw ( RuntimeException )
94 : : {
95 : 0 : return this;
96 : : }
97 : :
98 : : // -----------------------------------------------------------------------------
99 : : Reference< XAccessible > SAL_CALL
100 : 0 : AccessibleTabListBox::getAccessibleChild( sal_Int32 nChildIndex )
101 : : throw ( IndexOutOfBoundsException, RuntimeException )
102 : : {
103 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
104 [ # # ]: 0 : ::osl::MutexGuard aGuard( getOslMutex() );
105 [ # # ]: 0 : ensureIsAlive();
106 : :
107 [ # # ][ # # ]: 0 : if ( nChildIndex < 0 || nChildIndex > 1 )
108 [ # # ]: 0 : throw IndexOutOfBoundsException();
109 : :
110 : 0 : Reference< XAccessible > xRet;
111 [ # # ]: 0 : if (nChildIndex == 0)
112 : : {
113 : : //! so far the actual implementation object only supports column headers
114 [ # # ][ # # ]: 0 : xRet = implGetFixedChild( ::svt::BBINDEX_COLUMNHEADERBAR );
115 : : }
116 [ # # ]: 0 : else if (nChildIndex == 1)
117 [ # # ][ # # ]: 0 : xRet = implGetFixedChild( ::svt::BBINDEX_TABLE );
118 : :
119 [ # # ]: 0 : if ( !xRet.is() )
120 [ # # ]: 0 : throw RuntimeException();
121 : :
122 [ # # ][ # # ]: 0 : return xRet;
123 : : }
124 : :
125 : : //........................................................................
126 : : }// namespace accessibility
127 : : //........................................................................
128 : :
129 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|