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