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