xref: /trunk/main/accessibility/source/extended/AccessibleGridControlTable.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_accessibility.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #include "accessibility/extended/AccessibleGridControlTable.hxx"
33*cdf0e10cSrcweir #include "accessibility/extended/AccessibleGridControlTableCell.hxx"
34*cdf0e10cSrcweir #include <svtools/accessibletable.hxx>
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir // ============================================================================
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir using ::rtl::OUString;
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
41*cdf0e10cSrcweir using ::com::sun::star::uno::Sequence;
42*cdf0e10cSrcweir using ::com::sun::star::uno::Any;
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir using namespace ::com::sun::star;
45*cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
46*cdf0e10cSrcweir using namespace ::svt;
47*cdf0e10cSrcweir using namespace ::svt::table;
48*cdf0e10cSrcweir // ============================================================================
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir namespace accessibility {
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir // ============================================================================
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir DBG_NAME( AccessibleGridControlTable )
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir AccessibleGridControlTable::AccessibleGridControlTable(
57*cdf0e10cSrcweir         const Reference< XAccessible >& rxParent,
58*cdf0e10cSrcweir         IAccessibleTable& rTable,
59*cdf0e10cSrcweir         AccessibleTableControlObjType _eType) :
60*cdf0e10cSrcweir     AccessibleGridControlTableBase( rxParent, rTable, _eType )
61*cdf0e10cSrcweir         ,m_pCellVector( )
62*cdf0e10cSrcweir         ,m_pAccessCellVector( )
63*cdf0e10cSrcweir {
64*cdf0e10cSrcweir }
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir AccessibleGridControlTable::~AccessibleGridControlTable()
67*cdf0e10cSrcweir {
68*cdf0e10cSrcweir }
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir // XAccessibleContext ---------------------------------------------------------
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir Reference< XAccessible > SAL_CALL
73*cdf0e10cSrcweir AccessibleGridControlTable::getAccessibleChild( sal_Int32 nChildIndex )
74*cdf0e10cSrcweir     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
75*cdf0e10cSrcweir {
76*cdf0e10cSrcweir     TCSolarGuard aSolarGuard;
77*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
78*cdf0e10cSrcweir     ensureIsAlive();
79*cdf0e10cSrcweir     ensureIsValidIndex( nChildIndex );
80*cdf0e10cSrcweir     sal_Int32 nCount = getAccessibleChildCount();
81*cdf0e10cSrcweir     if(m_pAccessCellVector.size() == 0 || m_pAccessCellVector.size() != (unsigned)nCount)
82*cdf0e10cSrcweir     {
83*cdf0e10cSrcweir         m_pAccessCellVector.resize(nCount);
84*cdf0e10cSrcweir         m_pCellVector.resize(nCount);
85*cdf0e10cSrcweir     }
86*cdf0e10cSrcweir     if(!m_pAccessCellVector[nChildIndex].is())
87*cdf0e10cSrcweir     {
88*cdf0e10cSrcweir         AccessibleGridControlTableCell* pCell = new AccessibleGridControlTableCell(this, m_aTable, nChildIndex/m_aTable.GetColumnCount(), nChildIndex%m_aTable.GetColumnCount(), TCTYPE_TABLECELL);
89*cdf0e10cSrcweir         m_pCellVector[nChildIndex] = pCell;
90*cdf0e10cSrcweir         m_pAccessCellVector[nChildIndex] = pCell;
91*cdf0e10cSrcweir     }
92*cdf0e10cSrcweir     return m_pAccessCellVector[nChildIndex];
93*cdf0e10cSrcweir }
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleGridControlTable::getAccessibleIndexInParent()
96*cdf0e10cSrcweir     throw ( uno::RuntimeException )
97*cdf0e10cSrcweir {
98*cdf0e10cSrcweir     ensureIsAlive();
99*cdf0e10cSrcweir     if(m_aTable.HasRowHeader() && m_aTable.HasColHeader())
100*cdf0e10cSrcweir         return 0;
101*cdf0e10cSrcweir     else if((!m_aTable.HasRowHeader() && m_aTable.HasColHeader()) || (m_aTable.HasRowHeader() && !m_aTable.HasColHeader()) )
102*cdf0e10cSrcweir         return 1;
103*cdf0e10cSrcweir     else
104*cdf0e10cSrcweir         return 2;
105*cdf0e10cSrcweir }
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir // XAccessibleComponent -------------------------------------------------------
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir Reference< XAccessible > SAL_CALL
110*cdf0e10cSrcweir AccessibleGridControlTable::getAccessibleAtPoint( const awt::Point& rPoint )
111*cdf0e10cSrcweir     throw ( uno::RuntimeException )
112*cdf0e10cSrcweir {
113*cdf0e10cSrcweir     TCSolarGuard aSolarGuard;
114*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
115*cdf0e10cSrcweir     ensureIsAlive();
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir     Reference< XAccessible > xChild;
118*cdf0e10cSrcweir     sal_Int32 nRow = 0;
119*cdf0e10cSrcweir     sal_Int32 nColumnPos = 0;
120*cdf0e10cSrcweir     if( m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) )
121*cdf0e10cSrcweir         xChild = new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumnPos, TCTYPE_TABLECELL);
122*cdf0e10cSrcweir     return xChild;
123*cdf0e10cSrcweir }
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir void SAL_CALL AccessibleGridControlTable::grabFocus()
126*cdf0e10cSrcweir     throw ( uno::RuntimeException )
127*cdf0e10cSrcweir {
128*cdf0e10cSrcweir     TCSolarGuard aSolarGuard;
129*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
130*cdf0e10cSrcweir     ensureIsAlive();
131*cdf0e10cSrcweir     m_aTable.GrabFocus();
132*cdf0e10cSrcweir }
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir Any SAL_CALL AccessibleGridControlTable::getAccessibleKeyBinding()
135*cdf0e10cSrcweir     throw ( uno::RuntimeException )
136*cdf0e10cSrcweir {
137*cdf0e10cSrcweir     ensureIsAlive();
138*cdf0e10cSrcweir     return Any();   // no special key bindings for data table
139*cdf0e10cSrcweir }
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir // XAccessibleTable -----------------------------------------------------------
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir OUString SAL_CALL AccessibleGridControlTable::getAccessibleRowDescription( sal_Int32 nRow )
144*cdf0e10cSrcweir     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
145*cdf0e10cSrcweir {
146*cdf0e10cSrcweir     TCSolarGuard aSolarGuard;
147*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
148*cdf0e10cSrcweir     ensureIsAlive();
149*cdf0e10cSrcweir     ensureIsValidRow( nRow );
150*cdf0e10cSrcweir     return m_aTable.GetRowDescription( nRow );
151*cdf0e10cSrcweir }
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir OUString SAL_CALL AccessibleGridControlTable::getAccessibleColumnDescription( sal_Int32 nColumn )
154*cdf0e10cSrcweir     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
155*cdf0e10cSrcweir {
156*cdf0e10cSrcweir     TCSolarGuard aSolarGuard;
157*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
158*cdf0e10cSrcweir     ensureIsAlive();
159*cdf0e10cSrcweir     ensureIsValidColumn( nColumn );
160*cdf0e10cSrcweir     return m_aTable.GetColumnDescription( (sal_uInt16)nColumn );
161*cdf0e10cSrcweir }
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir Reference< XAccessibleTable > SAL_CALL AccessibleGridControlTable::getAccessibleRowHeaders()
164*cdf0e10cSrcweir     throw ( uno::RuntimeException )
165*cdf0e10cSrcweir {
166*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
167*cdf0e10cSrcweir     ensureIsAlive();
168*cdf0e10cSrcweir     if(m_aTable.HasColHeader())
169*cdf0e10cSrcweir         return implGetHeaderBar( 1 );
170*cdf0e10cSrcweir     else
171*cdf0e10cSrcweir         return implGetHeaderBar( 0 );
172*cdf0e10cSrcweir }
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir Reference< XAccessibleTable > SAL_CALL AccessibleGridControlTable::getAccessibleColumnHeaders()
175*cdf0e10cSrcweir     throw ( uno::RuntimeException )
176*cdf0e10cSrcweir {
177*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
178*cdf0e10cSrcweir     ensureIsAlive();
179*cdf0e10cSrcweir     return implGetHeaderBar( 0 );
180*cdf0e10cSrcweir }
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessibleRows()
183*cdf0e10cSrcweir     throw ( uno::RuntimeException )
184*cdf0e10cSrcweir {
185*cdf0e10cSrcweir     TCSolarGuard aSolarGuard;
186*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
187*cdf0e10cSrcweir     ensureIsAlive();
188*cdf0e10cSrcweir     Sequence< sal_Int32 > aSelSeq;
189*cdf0e10cSrcweir     implGetSelectedRows( aSelSeq );
190*cdf0e10cSrcweir     return aSelSeq;
191*cdf0e10cSrcweir }
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir //columns aren't selectable
194*cdf0e10cSrcweir Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessibleColumns()
195*cdf0e10cSrcweir     throw ( uno::RuntimeException )
196*cdf0e10cSrcweir {
197*cdf0e10cSrcweir     Sequence< sal_Int32 > aSelSeq(0);
198*cdf0e10cSrcweir     return aSelSeq;
199*cdf0e10cSrcweir }
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleRowSelected( sal_Int32 nRow )
202*cdf0e10cSrcweir     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
203*cdf0e10cSrcweir {
204*cdf0e10cSrcweir     TCSolarGuard aSolarGuard;
205*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
206*cdf0e10cSrcweir     ensureIsAlive();
207*cdf0e10cSrcweir     ensureIsValidRow( nRow );
208*cdf0e10cSrcweir     sal_Bool bSelected = sal_False;
209*cdf0e10cSrcweir     Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows();
210*cdf0e10cSrcweir     for(int i=0; i<selectedRows.getLength(); i++)
211*cdf0e10cSrcweir     {
212*cdf0e10cSrcweir         if(nRow == selectedRows[i])
213*cdf0e10cSrcweir         {
214*cdf0e10cSrcweir             bSelected = sal_True;
215*cdf0e10cSrcweir             continue;
216*cdf0e10cSrcweir         }
217*cdf0e10cSrcweir     }
218*cdf0e10cSrcweir     return bSelected;
219*cdf0e10cSrcweir }
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir //columns aren't selectable
222*cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleColumnSelected( sal_Int32 nColumn )
223*cdf0e10cSrcweir     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
224*cdf0e10cSrcweir {
225*cdf0e10cSrcweir     (void) nColumn;
226*cdf0e10cSrcweir     return sal_False;
227*cdf0e10cSrcweir }
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir Reference< XAccessible > SAL_CALL AccessibleGridControlTable::getAccessibleCellAt(
230*cdf0e10cSrcweir         sal_Int32 nRow, sal_Int32 nColumn )
231*cdf0e10cSrcweir     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
232*cdf0e10cSrcweir {
233*cdf0e10cSrcweir     TCSolarGuard aSolarGuard;
234*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
235*cdf0e10cSrcweir     ensureIsAlive();
236*cdf0e10cSrcweir     ensureIsValidAddress( nRow, nColumn );
237*cdf0e10cSrcweir     sal_Int32 nCount = getAccessibleChildCount();
238*cdf0e10cSrcweir     sal_Int32 nChildIndex = nRow*m_aTable.GetColumnCount() + nColumn;
239*cdf0e10cSrcweir     if(m_pAccessCellVector.size() == 0 || m_pAccessCellVector.size() != (unsigned)nCount)
240*cdf0e10cSrcweir     {
241*cdf0e10cSrcweir         m_pAccessCellVector.resize(nCount);
242*cdf0e10cSrcweir         m_pCellVector.resize(nCount);
243*cdf0e10cSrcweir     }
244*cdf0e10cSrcweir     if(!m_pAccessCellVector[nChildIndex].is())
245*cdf0e10cSrcweir     {
246*cdf0e10cSrcweir         AccessibleGridControlTableCell* pCell = new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumn, TCTYPE_TABLECELL);
247*cdf0e10cSrcweir         m_pCellVector[nChildIndex] = pCell;
248*cdf0e10cSrcweir         m_pAccessCellVector[nChildIndex] = pCell;
249*cdf0e10cSrcweir     }
250*cdf0e10cSrcweir     return m_pAccessCellVector[nChildIndex];
251*cdf0e10cSrcweir }
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleSelected(
254*cdf0e10cSrcweir         sal_Int32 nRow, sal_Int32 nColumn )
255*cdf0e10cSrcweir     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
256*cdf0e10cSrcweir {
257*cdf0e10cSrcweir     TCSolarGuard aSolarGuard;
258*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
259*cdf0e10cSrcweir     ensureIsAlive();
260*cdf0e10cSrcweir     ensureIsValidAddress( nRow, nColumn );
261*cdf0e10cSrcweir     (void) nColumn;
262*cdf0e10cSrcweir     //selection of single cells not possible, so if row is selected, the cell will be selected too
263*cdf0e10cSrcweir     return isAccessibleRowSelected(nRow);
264*cdf0e10cSrcweir }
265*cdf0e10cSrcweir void SAL_CALL AccessibleGridControlTable::selectAccessibleChild( sal_Int32 nChildIndex )
266*cdf0e10cSrcweir     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
267*cdf0e10cSrcweir {
268*cdf0e10cSrcweir     TCSolarGuard aSolarGuard;
269*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
270*cdf0e10cSrcweir     ensureIsAlive();
271*cdf0e10cSrcweir     ensureIsValidIndex( nChildIndex );
272*cdf0e10cSrcweir     sal_Int32 nColumns = m_aTable.GetColumnCount();
273*cdf0e10cSrcweir     sal_Int32 nRow = (nChildIndex / nColumns);
274*cdf0e10cSrcweir     m_aTable.SelectRow( nRow, sal_True );
275*cdf0e10cSrcweir }
276*cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleChildSelected( sal_Int32 nChildIndex )
277*cdf0e10cSrcweir     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
278*cdf0e10cSrcweir {
279*cdf0e10cSrcweir     TCSolarGuard aSolarGuard;
280*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
281*cdf0e10cSrcweir     ensureIsAlive();
282*cdf0e10cSrcweir     ensureIsValidIndex( nChildIndex );
283*cdf0e10cSrcweir     sal_Int32 nColumns = m_aTable.GetColumnCount();
284*cdf0e10cSrcweir     sal_Int32 nRow = (nChildIndex / nColumns);
285*cdf0e10cSrcweir     return isAccessibleRowSelected(nRow);
286*cdf0e10cSrcweir }
287*cdf0e10cSrcweir void SAL_CALL AccessibleGridControlTable::clearAccessibleSelection()
288*cdf0e10cSrcweir     throw ( uno::RuntimeException )
289*cdf0e10cSrcweir {
290*cdf0e10cSrcweir     TCSolarGuard aSolarGuard;
291*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
292*cdf0e10cSrcweir     ensureIsAlive();
293*cdf0e10cSrcweir     m_aTable.SelectAllRows( false );
294*cdf0e10cSrcweir }
295*cdf0e10cSrcweir void SAL_CALL AccessibleGridControlTable::selectAllAccessibleChildren()
296*cdf0e10cSrcweir     throw ( uno::RuntimeException )
297*cdf0e10cSrcweir {
298*cdf0e10cSrcweir     TCSolarGuard aSolarGuard;
299*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
300*cdf0e10cSrcweir     ensureIsAlive();
301*cdf0e10cSrcweir     Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows();
302*cdf0e10cSrcweir     for(int i=0;i<m_aTable.GetRowCount();i++)
303*cdf0e10cSrcweir         selectedRows[i]=i;
304*cdf0e10cSrcweir }
305*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleGridControlTable::getSelectedAccessibleChildCount()
306*cdf0e10cSrcweir     throw ( uno::RuntimeException )
307*cdf0e10cSrcweir {
308*cdf0e10cSrcweir     TCSolarGuard aSolarGuard;
309*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
310*cdf0e10cSrcweir     ensureIsAlive();
311*cdf0e10cSrcweir     Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows();
312*cdf0e10cSrcweir     sal_Int32 nColumns = m_aTable.GetColumnCount();
313*cdf0e10cSrcweir     return selectedRows.getLength()*nColumns;
314*cdf0e10cSrcweir }
315*cdf0e10cSrcweir Reference< XAccessible > SAL_CALL
316*cdf0e10cSrcweir AccessibleGridControlTable::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
317*cdf0e10cSrcweir     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
318*cdf0e10cSrcweir {
319*cdf0e10cSrcweir     TCSolarGuard aSolarGuard;
320*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
321*cdf0e10cSrcweir     ensureIsAlive();
322*cdf0e10cSrcweir     if(isAccessibleChildSelected(nSelectedChildIndex))
323*cdf0e10cSrcweir         return getAccessibleChild(nSelectedChildIndex);
324*cdf0e10cSrcweir     else
325*cdf0e10cSrcweir         return NULL;
326*cdf0e10cSrcweir }
327*cdf0e10cSrcweir //not implemented yet, because only row selection possible
328*cdf0e10cSrcweir void SAL_CALL AccessibleGridControlTable::deselectAccessibleChild(
329*cdf0e10cSrcweir         sal_Int32 nSelectedChildIndex )
330*cdf0e10cSrcweir     throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
331*cdf0e10cSrcweir {
332*cdf0e10cSrcweir     TCSolarGuard aSolarGuard;
333*cdf0e10cSrcweir     ::osl::MutexGuard aGuard( getOslMutex() );
334*cdf0e10cSrcweir     ensureIsAlive();
335*cdf0e10cSrcweir     (void)nSelectedChildIndex;
336*cdf0e10cSrcweir }
337*cdf0e10cSrcweir // XInterface -----------------------------------------------------------------
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir Any SAL_CALL AccessibleGridControlTable::queryInterface( const uno::Type& rType )
340*cdf0e10cSrcweir     throw ( uno::RuntimeException )
341*cdf0e10cSrcweir {
342*cdf0e10cSrcweir     Any aAny( AccessibleGridControlTableBase::queryInterface( rType ) );
343*cdf0e10cSrcweir     return aAny.hasValue() ?
344*cdf0e10cSrcweir         aAny : AccessibleGridControlTableImplHelper1::queryInterface( rType );
345*cdf0e10cSrcweir }
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir void SAL_CALL AccessibleGridControlTable::acquire() throw ()
348*cdf0e10cSrcweir {
349*cdf0e10cSrcweir     AccessibleGridControlTableBase::acquire();
350*cdf0e10cSrcweir }
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir void SAL_CALL AccessibleGridControlTable::release() throw ()
353*cdf0e10cSrcweir {
354*cdf0e10cSrcweir     AccessibleGridControlTableBase::release();
355*cdf0e10cSrcweir }
356*cdf0e10cSrcweir // XServiceInfo ---------------------------------------------------------------
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir OUString SAL_CALL AccessibleGridControlTable::getImplementationName()
359*cdf0e10cSrcweir     throw ( uno::RuntimeException )
360*cdf0e10cSrcweir {
361*cdf0e10cSrcweir     return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlTable" ) );
362*cdf0e10cSrcweir }
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir // internal virtual methods ---------------------------------------------------
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir Rectangle AccessibleGridControlTable::implGetBoundingBox()
367*cdf0e10cSrcweir {
368*cdf0e10cSrcweir     Window* pParent = m_aTable.GetAccessibleParentWindow();
369*cdf0e10cSrcweir     DBG_ASSERT( pParent, "implGetBoundingBox - missing parent window" );
370*cdf0e10cSrcweir     Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( pParent ));
371*cdf0e10cSrcweir     Rectangle aTableRect( m_aTable.calcTableRect() );
372*cdf0e10cSrcweir     long nX = aGridRect.Left() + aTableRect.Left();
373*cdf0e10cSrcweir     long nY = aGridRect.Top() + aTableRect.Top();
374*cdf0e10cSrcweir     long nWidth = aGridRect.GetSize().Width()-aTableRect.Left();
375*cdf0e10cSrcweir     long nHeight = aGridRect.GetSize().Height()-aTableRect.Top();
376*cdf0e10cSrcweir     Rectangle aTable( Point( nX, nY ), Size( nWidth, nHeight ));
377*cdf0e10cSrcweir     return aTable;
378*cdf0e10cSrcweir }
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir Rectangle AccessibleGridControlTable::implGetBoundingBoxOnScreen()
381*cdf0e10cSrcweir {
382*cdf0e10cSrcweir     Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( NULL ));
383*cdf0e10cSrcweir     Rectangle aTableRect( m_aTable.calcTableRect() );
384*cdf0e10cSrcweir     long nX = aGridRect.Left() + aTableRect.Left();
385*cdf0e10cSrcweir     long nY = aGridRect.Top() + aTableRect.Top();
386*cdf0e10cSrcweir     long nWidth = aGridRect.GetSize().Width()-aTableRect.Left();
387*cdf0e10cSrcweir     long nHeight = aGridRect.GetSize().Height()-aTableRect.Top();
388*cdf0e10cSrcweir     Rectangle aTable( Point( nX, nY ), Size( nWidth, nHeight ));
389*cdf0e10cSrcweir     return aTable;
390*cdf0e10cSrcweir }
391*cdf0e10cSrcweir // internal helper methods ----------------------------------------------------
392*cdf0e10cSrcweir Reference< XAccessibleTable > AccessibleGridControlTable::implGetHeaderBar(
393*cdf0e10cSrcweir         sal_Int32 nChildIndex )
394*cdf0e10cSrcweir     throw ( uno::RuntimeException )
395*cdf0e10cSrcweir {
396*cdf0e10cSrcweir     Reference< XAccessible > xRet;
397*cdf0e10cSrcweir     Reference< XAccessibleContext > xContext( m_xParent, uno::UNO_QUERY );
398*cdf0e10cSrcweir     if( xContext.is() )
399*cdf0e10cSrcweir     {
400*cdf0e10cSrcweir         try
401*cdf0e10cSrcweir         {
402*cdf0e10cSrcweir             xRet = xContext->getAccessibleChild( nChildIndex );
403*cdf0e10cSrcweir         }
404*cdf0e10cSrcweir         catch( lang::IndexOutOfBoundsException& )
405*cdf0e10cSrcweir         {
406*cdf0e10cSrcweir             DBG_ERROR( "implGetHeaderBar - wrong child index" );
407*cdf0e10cSrcweir         }
408*cdf0e10cSrcweir         // RuntimeException goes to caller
409*cdf0e10cSrcweir     }
410*cdf0e10cSrcweir     return Reference< XAccessibleTable >( xRet, uno::UNO_QUERY );
411*cdf0e10cSrcweir }
412*cdf0e10cSrcweir 
413*cdf0e10cSrcweir std::vector< AccessibleGridControlTableCell* >& AccessibleGridControlTable::getCellVector()
414*cdf0e10cSrcweir {
415*cdf0e10cSrcweir     return m_pCellVector;
416*cdf0e10cSrcweir }
417*cdf0e10cSrcweir 
418*cdf0e10cSrcweir std::vector< Reference< XAccessible > >& AccessibleGridControlTable::getAccessibleCellVector()
419*cdf0e10cSrcweir {
420*cdf0e10cSrcweir     return m_pAccessCellVector;
421*cdf0e10cSrcweir }
422*cdf0e10cSrcweir // ============================================================================
423*cdf0e10cSrcweir 
424*cdf0e10cSrcweir } // namespace accessibility
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir // ============================================================================
427*cdf0e10cSrcweir 
428