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