xref: /AOO41X/main/sc/source/ui/inc/AccessibleTableBase.hxx (revision 38d50f7b14e1cf975d8c6468d9633894cd59b523)
1*38d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*38d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*38d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*38d50f7bSAndrew Rist  * distributed with this work for additional information
6*38d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*38d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*38d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
9*38d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*38d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*38d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*38d50f7bSAndrew Rist  * software distributed under the License is distributed on an
15*38d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*38d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
17*38d50f7bSAndrew Rist  * specific language governing permissions and limitations
18*38d50f7bSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*38d50f7bSAndrew Rist  *************************************************************/
21*38d50f7bSAndrew Rist 
22*38d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #ifndef _SC_ACCESSIBLETABLEBASE_HXX
26cdf0e10cSrcweir #define _SC_ACCESSIBLETABLEBASE_HXX
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include "AccessibleContextBase.hxx"
29cdf0e10cSrcweir #include "global.hxx"
30cdf0e10cSrcweir #include "address.hxx"
31cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleTable.hpp>
32cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
33cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir class ScTabViewShell;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir /**	@descr
38cdf0e10cSrcweir         This base class provides an implementation of the
39cdf0e10cSrcweir         <code>AccessibleTable</code> service.
40cdf0e10cSrcweir */
41cdf0e10cSrcweir 
42cdf0e10cSrcweir typedef cppu::ImplHelper2< ::com::sun::star::accessibility::XAccessibleTable,
43cdf0e10cSrcweir 					::com::sun::star::accessibility::XAccessibleSelection>
44cdf0e10cSrcweir 					ScAccessibleTableBaseImpl;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir class ScAccessibleTableBase :
47cdf0e10cSrcweir 			public ScAccessibleContextBase,
48cdf0e10cSrcweir 			public ScAccessibleTableBaseImpl
49cdf0e10cSrcweir {
50cdf0e10cSrcweir public:
51cdf0e10cSrcweir 	//=====  internal  ========================================================
52cdf0e10cSrcweir 	ScAccessibleTableBase(
53cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
54cdf0e10cSrcweir         ::com::sun::star::accessibility::XAccessible>& rxParent,
55cdf0e10cSrcweir 		ScDocument* pDoc,
56cdf0e10cSrcweir 		const ScRange& rRange);
57cdf0e10cSrcweir protected:
58cdf0e10cSrcweir 	virtual ~ScAccessibleTableBase();
59cdf0e10cSrcweir public:
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     using ScAccessibleContextBase::disposing;
62cdf0e10cSrcweir  	virtual void SAL_CALL disposing();
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 	///=====  XInterface  =====================================================
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
67cdf0e10cSrcweir 		::com::sun::star::uno::Type const & rType )
68cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	virtual void SAL_CALL acquire() throw ();
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 	virtual void SAL_CALL release() throw ();
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	///=====  XAccessibleTable  ================================================
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     /// Returns the number of rows in the table.
77cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
78cdf0e10cSrcweir     			getAccessibleRowCount(  )
79cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException);
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     /// Returns the number of columns in the table.
82cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
83cdf0e10cSrcweir     			getAccessibleColumnCount(  )
84cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException);
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     /// Returns the description of the specified row in the table.
87cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL
88cdf0e10cSrcweir     			getAccessibleRowDescription( sal_Int32 nRow )
89cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException,
90cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     /// Returns the description text of the specified column in the table.
93cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL
94cdf0e10cSrcweir     			getAccessibleColumnDescription( sal_Int32 nColumn )
95cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException,
96cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     /** Returns the number of rows occupied by the Accessible at a specified row and column in the table.
99cdf0e10cSrcweir     Returns 1 if it is only a cell and the number of rows the cell is merged if the cell is a merged cell.
100cdf0e10cSrcweir     */
101cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
102cdf0e10cSrcweir     			getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
103cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException,
104cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     /** Returns the number of columns occupied by the Accessible at a specified row and column in the table.
107cdf0e10cSrcweir     Returns 1 if it is only a cell and the number of columns the cell is merged if the cell is a merged cell.
108cdf0e10cSrcweir     */
109cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
110cdf0e10cSrcweir     			getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
111cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException,
112cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     /// Returns the row headers as an AccessibleTable.
115cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
116cdf0e10cSrcweir     			getAccessibleRowHeaders(  )
117cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException);
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     /// Returns the column headers as an AccessibleTable.
120cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
121cdf0e10cSrcweir     			getAccessibleColumnHeaders(  )
122cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException);
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     /// Returns the selected rows in a table.
125cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
126cdf0e10cSrcweir     			getSelectedAccessibleRows(  )
127cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException);
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     /// Returns the selected columns in a table.
130cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
131cdf0e10cSrcweir     			getSelectedAccessibleColumns(  )
132cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException);
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     /// Returns a boolean value indicating whether the specified row is selected.
135cdf0e10cSrcweir     virtual sal_Bool SAL_CALL
136cdf0e10cSrcweir     			isAccessibleRowSelected( sal_Int32 nRow )
137cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException,
138cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
139cdf0e10cSrcweir 
140cdf0e10cSrcweir     /// Returns a boolean value indicating whether the specified column is selected.
141cdf0e10cSrcweir     virtual sal_Bool SAL_CALL
142cdf0e10cSrcweir     			isAccessibleColumnSelected( sal_Int32 nColumn )
143cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException,
144cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 	/// Returns the Accessible at a specified row and column in the table.
147cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
148cdf0e10cSrcweir     			getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
149cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException,
150cdf0e10cSrcweir     				        ::com::sun::star::lang::IndexOutOfBoundsException);
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 	/// Returns the caption for the table.
153cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
154cdf0e10cSrcweir     			getAccessibleCaption(  )
155cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException);
156cdf0e10cSrcweir 
157cdf0e10cSrcweir     /// Returns the summary description of the table.
158cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
159cdf0e10cSrcweir     			getAccessibleSummary(  )
160cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException);
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     /// Returns a boolean value indicating whether the accessible at a specified row and column is selected.
163cdf0e10cSrcweir     virtual sal_Bool SAL_CALL
164cdf0e10cSrcweir     			isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
165cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException,
166cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
167cdf0e10cSrcweir 
168cdf0e10cSrcweir 	///=====  XAccessibleExtendedTable  ========================================
169cdf0e10cSrcweir 
170cdf0e10cSrcweir     /// Returns the index of the cell on the given position.
171cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
172cdf0e10cSrcweir     			getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn )
173cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException,
174cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
175cdf0e10cSrcweir 
176cdf0e10cSrcweir     /// Returns the row number of an index in the table.
177cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
178cdf0e10cSrcweir     			getAccessibleRow( sal_Int32 nChildIndex )
179cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException,
180cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     /// Returns the column number of an index in the table.
183cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
184cdf0e10cSrcweir     			getAccessibleColumn( sal_Int32 nChildIndex )
185cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException,
186cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
187cdf0e10cSrcweir 
188cdf0e10cSrcweir 	//=====  XAccessibleContext  ==============================================
189cdf0e10cSrcweir 
190cdf0e10cSrcweir     ///	Return the number of currently visible children.
191cdf0e10cSrcweir     // is overloaded to calculate this on demand
192cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
193cdf0e10cSrcweir     	getAccessibleChildCount(void)
194cdf0e10cSrcweir     				throw (::com::sun::star::uno::RuntimeException);
195cdf0e10cSrcweir 
196cdf0e10cSrcweir     ///	Return the specified child or NULL if index is invalid.
197cdf0e10cSrcweir     // is overloaded to calculate this on demand
198cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
199cdf0e10cSrcweir     	getAccessibleChild(sal_Int32 nIndex)
200cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException,
201cdf0e10cSrcweir 				::com::sun::star::lang::IndexOutOfBoundsException);
202cdf0e10cSrcweir 
203cdf0e10cSrcweir protected:
204cdf0e10cSrcweir     ///	Return this object's description.
205cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL
206cdf0e10cSrcweir     	createAccessibleDescription(void)
207cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
208cdf0e10cSrcweir 
209cdf0e10cSrcweir     ///	Return the object's current name.
210cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL
211cdf0e10cSrcweir     	createAccessibleName(void)
212cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
213cdf0e10cSrcweir 
214cdf0e10cSrcweir public:
215cdf0e10cSrcweir 	///	Return NULL to indicate that an empty relation set.
216cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference<
217cdf0e10cSrcweir             ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
218cdf0e10cSrcweir     	getAccessibleRelationSet(void)
219cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
220cdf0e10cSrcweir 
221cdf0e10cSrcweir     ///	Return the set of current states.
222cdf0e10cSrcweir     // perhaps sometimes to be implemented
223cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference<
224cdf0e10cSrcweir             ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
225cdf0e10cSrcweir     	getAccessibleStateSet(void)
226cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
227cdf0e10cSrcweir 
228cdf0e10cSrcweir 	///=====  XAccessibleSelection  ===========================================
229cdf0e10cSrcweir 
230cdf0e10cSrcweir     virtual void SAL_CALL
231cdf0e10cSrcweir 		selectAccessibleChild( sal_Int32 nChildIndex )
232cdf0e10cSrcweir 		throw (::com::sun::star::lang::IndexOutOfBoundsException,
233cdf0e10cSrcweir 		::com::sun::star::uno::RuntimeException);
234cdf0e10cSrcweir 
235cdf0e10cSrcweir     virtual sal_Bool SAL_CALL
236cdf0e10cSrcweir 		isAccessibleChildSelected( sal_Int32 nChildIndex )
237cdf0e10cSrcweir 		throw (::com::sun::star::lang::IndexOutOfBoundsException,
238cdf0e10cSrcweir 		::com::sun::star::uno::RuntimeException);
239cdf0e10cSrcweir 
240cdf0e10cSrcweir     virtual void SAL_CALL
241cdf0e10cSrcweir 		clearAccessibleSelection(  )
242cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
243cdf0e10cSrcweir 
244cdf0e10cSrcweir     virtual void SAL_CALL
245cdf0e10cSrcweir 		selectAllAccessibleChildren(  )
246cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
247cdf0e10cSrcweir 
248cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
249cdf0e10cSrcweir 		getSelectedAccessibleChildCount(  )
250cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
251cdf0e10cSrcweir 
252cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
253cdf0e10cSrcweir 		::com::sun::star::accessibility::XAccessible > SAL_CALL
254cdf0e10cSrcweir 		getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
255cdf0e10cSrcweir 		throw (::com::sun::star::lang::IndexOutOfBoundsException,
256cdf0e10cSrcweir 		::com::sun::star::uno::RuntimeException);
257cdf0e10cSrcweir 
258cdf0e10cSrcweir     virtual void SAL_CALL
259cdf0e10cSrcweir 		deselectAccessibleChild( sal_Int32 nSelectedChildIndex )
260cdf0e10cSrcweir 		throw (::com::sun::star::lang::IndexOutOfBoundsException,
261cdf0e10cSrcweir 		::com::sun::star::uno::RuntimeException);
262cdf0e10cSrcweir 
263cdf0e10cSrcweir 	///=====  XServiceInfo  ===================================================
264cdf0e10cSrcweir 
265cdf0e10cSrcweir     /**	Returns an identifier for the implementation of this object.
266cdf0e10cSrcweir     */
267cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL
268cdf0e10cSrcweir     	getImplementationName(void)
269cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
270cdf0e10cSrcweir 
271cdf0e10cSrcweir 	///=====  XTypeProvider  ===================================================
272cdf0e10cSrcweir 
273cdf0e10cSrcweir 	/// returns the possible types
274cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL
275cdf0e10cSrcweir 		getTypes()
276cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
277cdf0e10cSrcweir 
278cdf0e10cSrcweir 	/**	Returns a implementation id.
279cdf0e10cSrcweir     */
280cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
281cdf0e10cSrcweir         getImplementationId(void)
282cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
283cdf0e10cSrcweir 
284cdf0e10cSrcweir protected:
285cdf0e10cSrcweir 	/// contains the range of the table, because it could be a subrange of the complete table
286cdf0e10cSrcweir 	ScRange maRange;
287cdf0e10cSrcweir 
288cdf0e10cSrcweir 	ScDocument*	mpDoc;
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 	void CommitTableModelChange(sal_Int32 nStartRow, sal_Int32 nStartCol, sal_Int32 nEndRow, sal_Int32 nEndCol, sal_uInt16 nId);
291cdf0e10cSrcweir };
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 
294cdf0e10cSrcweir #endif
295