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_sc.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #include "AccessibleTableBase.hxx"
33*cdf0e10cSrcweir #include "miscuno.hxx"
34*cdf0e10cSrcweir #include "document.hxx"
35*cdf0e10cSrcweir #include "unoguard.hxx"
36*cdf0e10cSrcweir #include "scresid.hxx"
37*cdf0e10cSrcweir #ifndef SC_SC_HRC
38*cdf0e10cSrcweir #include "sc.hrc"
39*cdf0e10cSrcweir #endif
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEROLE_HPP_
42*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
43*cdf0e10cSrcweir #endif
44*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
45*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
46*cdf0e10cSrcweir #include <rtl/uuid.h>
47*cdf0e10cSrcweir #include <tools/debug.hxx>
48*cdf0e10cSrcweir #include <comphelper/sequence.hxx>
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir using namespace	::com::sun::star;
52*cdf0e10cSrcweir using namespace	::com::sun::star::accessibility;
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir //=====  internal  ============================================================
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir ScAccessibleTableBase::ScAccessibleTableBase(
57*cdf0e10cSrcweir         const uno::Reference<XAccessible>& rxParent,
58*cdf0e10cSrcweir 		ScDocument* pDoc,
59*cdf0e10cSrcweir 		const ScRange& rRange)
60*cdf0e10cSrcweir 	:
61*cdf0e10cSrcweir 	ScAccessibleContextBase (rxParent, AccessibleRole::TABLE),
62*cdf0e10cSrcweir 	maRange(rRange),
63*cdf0e10cSrcweir 	mpDoc(pDoc)
64*cdf0e10cSrcweir {
65*cdf0e10cSrcweir }
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir ScAccessibleTableBase::~ScAccessibleTableBase()
68*cdf0e10cSrcweir {
69*cdf0e10cSrcweir }
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir void SAL_CALL ScAccessibleTableBase::disposing()
72*cdf0e10cSrcweir {
73*cdf0e10cSrcweir     ScUnoGuard aGuard;
74*cdf0e10cSrcweir 	mpDoc = NULL;
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir 	ScAccessibleContextBase::disposing();
77*cdf0e10cSrcweir }
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir 	//=====  XInterface  =====================================================
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir uno::Any SAL_CALL ScAccessibleTableBase::queryInterface( uno::Type const & rType )
82*cdf0e10cSrcweir 	throw (uno::RuntimeException)
83*cdf0e10cSrcweir {
84*cdf0e10cSrcweir 	uno::Any aAny (ScAccessibleTableBaseImpl::queryInterface(rType));
85*cdf0e10cSrcweir 	return aAny.hasValue() ? aAny : ScAccessibleContextBase::queryInterface(rType);
86*cdf0e10cSrcweir }
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir void SAL_CALL ScAccessibleTableBase::acquire()
89*cdf0e10cSrcweir 	throw ()
90*cdf0e10cSrcweir {
91*cdf0e10cSrcweir 	ScAccessibleContextBase::acquire();
92*cdf0e10cSrcweir }
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir void SAL_CALL ScAccessibleTableBase::release()
95*cdf0e10cSrcweir 	throw ()
96*cdf0e10cSrcweir {
97*cdf0e10cSrcweir 	ScAccessibleContextBase::release();
98*cdf0e10cSrcweir }
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir 	//=====  XAccessibleTable  ================================================
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir sal_Int32 SAL_CALL ScAccessibleTableBase::getAccessibleRowCount(  )
103*cdf0e10cSrcweir     				throw (uno::RuntimeException)
104*cdf0e10cSrcweir {
105*cdf0e10cSrcweir 	ScUnoGuard aGuard;
106*cdf0e10cSrcweir     IsObjectValid();
107*cdf0e10cSrcweir 	return maRange.aEnd.Row() - maRange.aStart.Row() + 1;
108*cdf0e10cSrcweir }
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir sal_Int32 SAL_CALL ScAccessibleTableBase::getAccessibleColumnCount(  )
111*cdf0e10cSrcweir     				throw (uno::RuntimeException)
112*cdf0e10cSrcweir {
113*cdf0e10cSrcweir 	ScUnoGuard aGuard;
114*cdf0e10cSrcweir     IsObjectValid();
115*cdf0e10cSrcweir 	return maRange.aEnd.Col() - maRange.aStart.Col() + 1;
116*cdf0e10cSrcweir }
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ScAccessibleTableBase::getAccessibleRowDescription( sal_Int32 nRow )
119*cdf0e10cSrcweir     throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
120*cdf0e10cSrcweir {
121*cdf0e10cSrcweir 	DBG_ERROR("Here should be a implementation to fill the description");
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir     if ((nRow > (maRange.aEnd.Row() - maRange.aStart.Row())) || (nRow < 0))
124*cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir     //setAccessibleRowDescription(nRow, xAccessible); // to remember the created Description
127*cdf0e10cSrcweir 	return rtl::OUString();
128*cdf0e10cSrcweir }
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ScAccessibleTableBase::getAccessibleColumnDescription( sal_Int32 nColumn )
131*cdf0e10cSrcweir     throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
132*cdf0e10cSrcweir {
133*cdf0e10cSrcweir 	DBG_ERROR("Here should be a implementation to fill the description");
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir     if ((nColumn > (maRange.aEnd.Col() - maRange.aStart.Col())) || (nColumn < 0))
136*cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir     //setAccessibleColumnDescription(nColumn, xAccessible); // to remember the created Description
139*cdf0e10cSrcweir 	return rtl::OUString();
140*cdf0e10cSrcweir }
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir sal_Int32 SAL_CALL ScAccessibleTableBase::getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
143*cdf0e10cSrcweir     throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
144*cdf0e10cSrcweir {
145*cdf0e10cSrcweir 	ScUnoGuard aGuard;
146*cdf0e10cSrcweir     IsObjectValid();
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir     if ((nColumn > (maRange.aEnd.Col() - maRange.aStart.Col())) || (nColumn < 0) ||
149*cdf0e10cSrcweir         (nRow > (maRange.aEnd.Row() - maRange.aStart.Row())) || (nRow < 0))
150*cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir     sal_Int32 nCount(1); // the same cell
153*cdf0e10cSrcweir 	nRow += maRange.aStart.Row();
154*cdf0e10cSrcweir 	nColumn += maRange.aStart.Col();
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir 	if (mpDoc)
157*cdf0e10cSrcweir 	{
158*cdf0e10cSrcweir 		SCROW nEndRow(0);
159*cdf0e10cSrcweir         SCCOL nEndCol(0);
160*cdf0e10cSrcweir 		if (mpDoc->ExtendMerge(static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow),
161*cdf0e10cSrcweir 			nEndCol, nEndRow, maRange.aStart.Tab()))
162*cdf0e10cSrcweir         {
163*cdf0e10cSrcweir 		    if (nEndRow > nRow)
164*cdf0e10cSrcweir 			    nCount = nEndRow - nRow + 1;
165*cdf0e10cSrcweir         }
166*cdf0e10cSrcweir 	}
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir 	return nCount;
169*cdf0e10cSrcweir }
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir sal_Int32 SAL_CALL ScAccessibleTableBase::getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
172*cdf0e10cSrcweir     throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
173*cdf0e10cSrcweir {
174*cdf0e10cSrcweir 	ScUnoGuard aGuard;
175*cdf0e10cSrcweir     IsObjectValid();
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir     if ((nColumn > (maRange.aEnd.Col() - maRange.aStart.Col())) || (nColumn < 0) ||
178*cdf0e10cSrcweir         (nRow > (maRange.aEnd.Row() - maRange.aStart.Row())) || (nRow < 0))
179*cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir     sal_Int32 nCount(1); // the same cell
182*cdf0e10cSrcweir 	nRow += maRange.aStart.Row();
183*cdf0e10cSrcweir 	nColumn += maRange.aStart.Col();
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir 	if (mpDoc)
186*cdf0e10cSrcweir 	{
187*cdf0e10cSrcweir 		SCROW nEndRow(0);
188*cdf0e10cSrcweir         SCCOL nEndCol(0);
189*cdf0e10cSrcweir 		if (mpDoc->ExtendMerge(static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow),
190*cdf0e10cSrcweir 			nEndCol, nEndRow, maRange.aStart.Tab()))
191*cdf0e10cSrcweir         {
192*cdf0e10cSrcweir 		    if (nEndCol > nColumn)
193*cdf0e10cSrcweir 			    nCount = nEndCol - nColumn + 1;
194*cdf0e10cSrcweir         }
195*cdf0e10cSrcweir 	}
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir 	return nCount;
198*cdf0e10cSrcweir }
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir uno::Reference< XAccessibleTable > SAL_CALL ScAccessibleTableBase::getAccessibleRowHeaders(  )
201*cdf0e10cSrcweir     				throw (uno::RuntimeException)
202*cdf0e10cSrcweir {
203*cdf0e10cSrcweir 	uno::Reference< XAccessibleTable > xAccessibleTable;
204*cdf0e10cSrcweir 	DBG_ERROR("Here should be a implementation to fill the row headers");
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir     //CommitChange
207*cdf0e10cSrcweir 	return xAccessibleTable;
208*cdf0e10cSrcweir }
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir uno::Reference< XAccessibleTable > SAL_CALL ScAccessibleTableBase::getAccessibleColumnHeaders(  )
211*cdf0e10cSrcweir     				throw (uno::RuntimeException)
212*cdf0e10cSrcweir {
213*cdf0e10cSrcweir 	uno::Reference< XAccessibleTable > xAccessibleTable;
214*cdf0e10cSrcweir 	DBG_ERROR("Here should be a implementation to fill the column headers");
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir     //CommitChange
217*cdf0e10cSrcweir 	return xAccessibleTable;
218*cdf0e10cSrcweir }
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir uno::Sequence< sal_Int32 > SAL_CALL ScAccessibleTableBase::getSelectedAccessibleRows(  )
221*cdf0e10cSrcweir     				throw (uno::RuntimeException)
222*cdf0e10cSrcweir {
223*cdf0e10cSrcweir 	DBG_ERROR("not implemented yet");
224*cdf0e10cSrcweir 	uno::Sequence< sal_Int32 > aSequence;
225*cdf0e10cSrcweir 	return aSequence;
226*cdf0e10cSrcweir }
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir uno::Sequence< sal_Int32 > SAL_CALL ScAccessibleTableBase::getSelectedAccessibleColumns(  )
229*cdf0e10cSrcweir     				throw (uno::RuntimeException)
230*cdf0e10cSrcweir {
231*cdf0e10cSrcweir 	DBG_ERROR("not implemented yet");
232*cdf0e10cSrcweir 	uno::Sequence< sal_Int32 > aSequence;
233*cdf0e10cSrcweir 	return aSequence;
234*cdf0e10cSrcweir }
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir sal_Bool SAL_CALL ScAccessibleTableBase::isAccessibleRowSelected( sal_Int32 /* nRow */ )
237*cdf0e10cSrcweir     throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
238*cdf0e10cSrcweir {
239*cdf0e10cSrcweir 	DBG_ERROR("not implemented yet");
240*cdf0e10cSrcweir 	return sal_False;
241*cdf0e10cSrcweir }
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir sal_Bool SAL_CALL ScAccessibleTableBase::isAccessibleColumnSelected( sal_Int32 /* nColumn */ )
244*cdf0e10cSrcweir     throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
245*cdf0e10cSrcweir {
246*cdf0e10cSrcweir 	DBG_ERROR("not implemented yet");
247*cdf0e10cSrcweir 	return sal_False;
248*cdf0e10cSrcweir }
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir uno::Reference< XAccessible > SAL_CALL ScAccessibleTableBase::getAccessibleCellAt( sal_Int32 /* nRow */, sal_Int32 /* nColumn */ )
251*cdf0e10cSrcweir     				throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
252*cdf0e10cSrcweir {
253*cdf0e10cSrcweir 	DBG_ERROR("not implemented yet");
254*cdf0e10cSrcweir 	uno::Reference< XAccessible > xAccessible;
255*cdf0e10cSrcweir 	return xAccessible;
256*cdf0e10cSrcweir }
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir uno::Reference< XAccessible > SAL_CALL ScAccessibleTableBase::getAccessibleCaption(  )
259*cdf0e10cSrcweir     				throw (uno::RuntimeException)
260*cdf0e10cSrcweir {
261*cdf0e10cSrcweir 	DBG_ERROR("not implemented yet");
262*cdf0e10cSrcweir 	uno::Reference< XAccessible > xAccessible;
263*cdf0e10cSrcweir 	return xAccessible;
264*cdf0e10cSrcweir }
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir uno::Reference< XAccessible > SAL_CALL ScAccessibleTableBase::getAccessibleSummary(  )
267*cdf0e10cSrcweir     				throw (uno::RuntimeException)
268*cdf0e10cSrcweir {
269*cdf0e10cSrcweir 	DBG_ERROR("not implemented yet");
270*cdf0e10cSrcweir 	uno::Reference< XAccessible > xAccessible;
271*cdf0e10cSrcweir 	return xAccessible;
272*cdf0e10cSrcweir }
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir sal_Bool SAL_CALL ScAccessibleTableBase::isAccessibleSelected( sal_Int32 /* nRow */, sal_Int32 /* nColumn */ )
275*cdf0e10cSrcweir     throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
276*cdf0e10cSrcweir {
277*cdf0e10cSrcweir 	DBG_ERROR("not implemented yet");
278*cdf0e10cSrcweir 	return sal_False;
279*cdf0e10cSrcweir }
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir 	//=====  XAccessibleExtendedTable  ========================================
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir sal_Int32 SAL_CALL ScAccessibleTableBase::getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn )
284*cdf0e10cSrcweir     throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
285*cdf0e10cSrcweir {
286*cdf0e10cSrcweir 	ScUnoGuard aGuard;
287*cdf0e10cSrcweir     IsObjectValid();
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir     if (nRow > (maRange.aEnd.Row() - maRange.aStart.Row()) ||
290*cdf0e10cSrcweir         nRow < 0 ||
291*cdf0e10cSrcweir         nColumn > (maRange.aEnd.Col() - maRange.aStart.Col()) ||
292*cdf0e10cSrcweir         nColumn < 0)
293*cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir     nRow -= maRange.aStart.Row();
296*cdf0e10cSrcweir 	nColumn -= maRange.aStart.Col();
297*cdf0e10cSrcweir 	return (nRow * (maRange.aEnd.Col() + 1)) + nColumn;
298*cdf0e10cSrcweir }
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir sal_Int32 SAL_CALL ScAccessibleTableBase::getAccessibleRow( sal_Int32 nChildIndex )
301*cdf0e10cSrcweir     throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
302*cdf0e10cSrcweir {
303*cdf0e10cSrcweir 	ScUnoGuard aGuard;
304*cdf0e10cSrcweir     IsObjectValid();
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir     if (nChildIndex >= getAccessibleChildCount() || nChildIndex < 0)
307*cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir     return nChildIndex / (maRange.aEnd.Col() - maRange.aStart.Col() + 1);
310*cdf0e10cSrcweir }
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir sal_Int32 SAL_CALL ScAccessibleTableBase::getAccessibleColumn( sal_Int32 nChildIndex )
313*cdf0e10cSrcweir     throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
314*cdf0e10cSrcweir {
315*cdf0e10cSrcweir 	ScUnoGuard aGuard;
316*cdf0e10cSrcweir     IsObjectValid();
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir     if (nChildIndex >= getAccessibleChildCount() || nChildIndex < 0)
319*cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir     return nChildIndex % static_cast<sal_Int32>(maRange.aEnd.Col() - maRange.aStart.Col() + 1);
322*cdf0e10cSrcweir }
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir 	//=====  XAccessibleContext  ==============================================
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir sal_Int32 SAL_CALL
327*cdf0e10cSrcweir 	ScAccessibleTableBase::getAccessibleChildCount(void)
328*cdf0e10cSrcweir     				throw (uno::RuntimeException)
329*cdf0e10cSrcweir {
330*cdf0e10cSrcweir 	ScUnoGuard aGuard;
331*cdf0e10cSrcweir     IsObjectValid();
332*cdf0e10cSrcweir 	return static_cast<sal_Int32>(maRange.aEnd.Row() - maRange.aStart.Row() + 1) *
333*cdf0e10cSrcweir 			(maRange.aEnd.Col() - maRange.aStart.Col() + 1);
334*cdf0e10cSrcweir //	return 1;
335*cdf0e10cSrcweir }
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir uno::Reference< XAccessible > SAL_CALL
338*cdf0e10cSrcweir 	ScAccessibleTableBase::getAccessibleChild(sal_Int32 nIndex)
339*cdf0e10cSrcweir         throw (uno::RuntimeException,
340*cdf0e10cSrcweir 		lang::IndexOutOfBoundsException)
341*cdf0e10cSrcweir {
342*cdf0e10cSrcweir 	ScUnoGuard aGuard;
343*cdf0e10cSrcweir     IsObjectValid();
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir     if (nIndex >= getAccessibleChildCount() || nIndex < 0)
346*cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir 	sal_Int32 nRow(0);
349*cdf0e10cSrcweir 	sal_Int32 nColumn(0);
350*cdf0e10cSrcweir 	sal_Int32 nTemp(maRange.aEnd.Col() - maRange.aStart.Col() + 1);
351*cdf0e10cSrcweir 	nRow = nIndex / nTemp;
352*cdf0e10cSrcweir 	nColumn = nIndex % nTemp;
353*cdf0e10cSrcweir 	return getAccessibleCellAt(nRow, nColumn);
354*cdf0e10cSrcweir }
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir ::rtl::OUString SAL_CALL
357*cdf0e10cSrcweir     ScAccessibleTableBase::createAccessibleDescription(void)
358*cdf0e10cSrcweir     throw (uno::RuntimeException)
359*cdf0e10cSrcweir {
360*cdf0e10cSrcweir     String sDesc(ScResId(STR_ACC_TABLE_DESCR));
361*cdf0e10cSrcweir /*	String sCoreName;
362*cdf0e10cSrcweir 	if (mpDoc && mpDoc->GetName( maRange.aStart.Tab(), sCoreName ))
363*cdf0e10cSrcweir 		sDesc.SearchAndReplaceAscii("%1", sCoreName);
364*cdf0e10cSrcweir     sDesc.SearchAndReplaceAscii("%2", String(ScResId(SCSTR_UNKNOWN)));*/
365*cdf0e10cSrcweir     return rtl::OUString(sDesc);
366*cdf0e10cSrcweir }
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir ::rtl::OUString SAL_CALL
369*cdf0e10cSrcweir     ScAccessibleTableBase::createAccessibleName(void)
370*cdf0e10cSrcweir     throw (uno::RuntimeException)
371*cdf0e10cSrcweir {
372*cdf0e10cSrcweir     String sName(ScResId(STR_ACC_TABLE_NAME));
373*cdf0e10cSrcweir 	String sCoreName;
374*cdf0e10cSrcweir 	if (mpDoc && mpDoc->GetName( maRange.aStart.Tab(), sCoreName ))
375*cdf0e10cSrcweir 		sName.SearchAndReplaceAscii("%1", sCoreName);
376*cdf0e10cSrcweir     return rtl::OUString(sName);
377*cdf0e10cSrcweir }
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir uno::Reference<XAccessibleRelationSet> SAL_CALL
380*cdf0e10cSrcweir     ScAccessibleTableBase::getAccessibleRelationSet(void)
381*cdf0e10cSrcweir     throw (uno::RuntimeException)
382*cdf0e10cSrcweir {
383*cdf0e10cSrcweir 	DBG_ERROR("should be implemented in the abrevated class");
384*cdf0e10cSrcweir 	return uno::Reference<XAccessibleRelationSet>();
385*cdf0e10cSrcweir }
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir uno::Reference<XAccessibleStateSet> SAL_CALL
388*cdf0e10cSrcweir 	ScAccessibleTableBase::getAccessibleStateSet(void)
389*cdf0e10cSrcweir     throw (uno::RuntimeException)
390*cdf0e10cSrcweir {
391*cdf0e10cSrcweir 	DBG_ERROR("should be implemented in the abrevated class");
392*cdf0e10cSrcweir 	uno::Reference< XAccessibleStateSet > xAccessibleStateSet;
393*cdf0e10cSrcweir 	return xAccessibleStateSet;
394*cdf0e10cSrcweir }
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir 	///=====  XAccessibleSelection  ===========================================
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir void SAL_CALL
399*cdf0e10cSrcweir         ScAccessibleTableBase::selectAccessibleChild( sal_Int32 /* nChildIndex */ )
400*cdf0e10cSrcweir 		throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
401*cdf0e10cSrcweir {
402*cdf0e10cSrcweir }
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir sal_Bool SAL_CALL
405*cdf0e10cSrcweir 		ScAccessibleTableBase::isAccessibleChildSelected( sal_Int32 nChildIndex )
406*cdf0e10cSrcweir 		throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
407*cdf0e10cSrcweir {
408*cdf0e10cSrcweir     // I don't need to guard, because the called funtions have a guard
409*cdf0e10cSrcweir //    ScUnoGuard aGuard;
410*cdf0e10cSrcweir     if (nChildIndex < 0 || nChildIndex >= getAccessibleChildCount())
411*cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
412*cdf0e10cSrcweir 	return isAccessibleSelected(getAccessibleRow(nChildIndex), getAccessibleColumn(nChildIndex));
413*cdf0e10cSrcweir }
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir void SAL_CALL
416*cdf0e10cSrcweir 		ScAccessibleTableBase::clearAccessibleSelection(  )
417*cdf0e10cSrcweir 		throw (uno::RuntimeException)
418*cdf0e10cSrcweir {
419*cdf0e10cSrcweir }
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir void SAL_CALL
422*cdf0e10cSrcweir 		ScAccessibleTableBase::selectAllAccessibleChildren(  )
423*cdf0e10cSrcweir 		throw (uno::RuntimeException)
424*cdf0e10cSrcweir {
425*cdf0e10cSrcweir }
426*cdf0e10cSrcweir 
427*cdf0e10cSrcweir sal_Int32 SAL_CALL
428*cdf0e10cSrcweir 		ScAccessibleTableBase::getSelectedAccessibleChildCount(  )
429*cdf0e10cSrcweir 		throw (uno::RuntimeException)
430*cdf0e10cSrcweir {
431*cdf0e10cSrcweir 	sal_Int32 nResult(0);
432*cdf0e10cSrcweir 	return nResult;
433*cdf0e10cSrcweir }
434*cdf0e10cSrcweir 
435*cdf0e10cSrcweir uno::Reference<XAccessible > SAL_CALL
436*cdf0e10cSrcweir         ScAccessibleTableBase::getSelectedAccessibleChild( sal_Int32 /* nSelectedChildIndex */ )
437*cdf0e10cSrcweir 		throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
438*cdf0e10cSrcweir {
439*cdf0e10cSrcweir 	uno::Reference < XAccessible > xAccessible;
440*cdf0e10cSrcweir 	return xAccessible;
441*cdf0e10cSrcweir }
442*cdf0e10cSrcweir 
443*cdf0e10cSrcweir void SAL_CALL
444*cdf0e10cSrcweir         ScAccessibleTableBase::deselectAccessibleChild( sal_Int32 /* nSelectedChildIndex */ )
445*cdf0e10cSrcweir 		throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
446*cdf0e10cSrcweir {
447*cdf0e10cSrcweir }
448*cdf0e10cSrcweir 
449*cdf0e10cSrcweir 	//=====  XServiceInfo  ====================================================
450*cdf0e10cSrcweir 
451*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ScAccessibleTableBase::getImplementationName(void)
452*cdf0e10cSrcweir         throw (uno::RuntimeException)
453*cdf0e10cSrcweir {
454*cdf0e10cSrcweir 	return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("ScAccessibleTableBase"));
455*cdf0e10cSrcweir }
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir 	//=====  XTypeProvider  ===================================================
458*cdf0e10cSrcweir 
459*cdf0e10cSrcweir uno::Sequence< uno::Type > SAL_CALL ScAccessibleTableBase::getTypes()
460*cdf0e10cSrcweir 		throw (uno::RuntimeException)
461*cdf0e10cSrcweir {
462*cdf0e10cSrcweir 	return comphelper::concatSequences(ScAccessibleTableBaseImpl::getTypes(), ScAccessibleContextBase::getTypes());
463*cdf0e10cSrcweir }
464*cdf0e10cSrcweir 
465*cdf0e10cSrcweir uno::Sequence<sal_Int8> SAL_CALL
466*cdf0e10cSrcweir 	ScAccessibleTableBase::getImplementationId(void)
467*cdf0e10cSrcweir     throw (uno::RuntimeException)
468*cdf0e10cSrcweir {
469*cdf0e10cSrcweir     ScUnoGuard aGuard;
470*cdf0e10cSrcweir     IsObjectValid();
471*cdf0e10cSrcweir 	static uno::Sequence<sal_Int8> aId;
472*cdf0e10cSrcweir 	if (aId.getLength() == 0)
473*cdf0e10cSrcweir 	{
474*cdf0e10cSrcweir 		aId.realloc (16);
475*cdf0e10cSrcweir 		rtl_createUuid (reinterpret_cast<sal_uInt8 *>(aId.getArray()), 0, sal_True);
476*cdf0e10cSrcweir 	}
477*cdf0e10cSrcweir 	return aId;
478*cdf0e10cSrcweir }
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir void ScAccessibleTableBase::CommitTableModelChange(sal_Int32 nStartRow, sal_Int32 nStartCol, sal_Int32 nEndRow, sal_Int32 nEndCol, sal_uInt16 nId)
481*cdf0e10cSrcweir {
482*cdf0e10cSrcweir 	AccessibleTableModelChange aModelChange;
483*cdf0e10cSrcweir 	aModelChange.FirstRow = nStartRow;
484*cdf0e10cSrcweir 	aModelChange.FirstColumn = nStartCol;
485*cdf0e10cSrcweir 	aModelChange.LastRow = nEndRow;
486*cdf0e10cSrcweir 	aModelChange.LastColumn = nEndCol;
487*cdf0e10cSrcweir 	aModelChange.Type = nId;
488*cdf0e10cSrcweir 
489*cdf0e10cSrcweir 	AccessibleEventObject aEvent;
490*cdf0e10cSrcweir 	aEvent.EventId = AccessibleEventId::TABLE_MODEL_CHANGED;
491*cdf0e10cSrcweir 	aEvent.Source = uno::Reference< XAccessibleContext >(this);
492*cdf0e10cSrcweir 	aEvent.NewValue <<= aModelChange;
493*cdf0e10cSrcweir 
494*cdf0e10cSrcweir 	CommitChange(aEvent);
495*cdf0e10cSrcweir }
496