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