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