1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_ACCESSIBLETABLEBASE_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_ACCESSIBLETABLEBASE_HXX
23 #include "AccessibleContextBase.hxx"
25 #include "address.hxx"
26 #include <com/sun/star/accessibility/XAccessibleTable.hpp>
27 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
28 #include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
29 #include <cppuhelper/implbase2.hxx>
32 This base class provides an implementation of the
33 <code>AccessibleTable</code> service.
36 typedef cppu::ImplHelper2
< ::com::sun::star::accessibility::XAccessibleTable
,
37 ::com::sun::star::accessibility::XAccessibleSelection
>
38 ScAccessibleTableBaseImpl
;
40 class ScAccessibleTableBase
:
41 public ScAccessibleContextBase
,
42 public ::com::sun::star::accessibility::XAccessibleTableSelection
,
43 public ScAccessibleTableBaseImpl
46 //===== internal ========================================================
47 ScAccessibleTableBase(
48 const ::com::sun::star::uno::Reference
<
49 ::com::sun::star::accessibility::XAccessible
>& rxParent
,
51 const ScRange
& rRange
);
53 virtual ~ScAccessibleTableBase();
56 using ScAccessibleContextBase::disposing
;
57 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
59 ///===== XInterface =====================================================
61 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
62 ::com::sun::star::uno::Type
const & rType
)
63 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
65 virtual void SAL_CALL
acquire() throw () SAL_OVERRIDE
;
67 virtual void SAL_CALL
release() throw () SAL_OVERRIDE
;
69 ///===== XAccessibleTable ================================================
71 /// Returns the number of rows in the table.
72 virtual sal_Int32 SAL_CALL
73 getAccessibleRowCount( )
74 throw (::com::sun::star::uno::RuntimeException
,
75 std::exception
) SAL_OVERRIDE
;
77 /// Returns the number of columns in the table.
78 virtual sal_Int32 SAL_CALL
79 getAccessibleColumnCount( )
80 throw (::com::sun::star::uno::RuntimeException
,
81 std::exception
) SAL_OVERRIDE
;
83 /// Returns the description of the specified row in the table.
84 virtual OUString SAL_CALL
85 getAccessibleRowDescription( sal_Int32 nRow
)
86 throw (::com::sun::star::uno::RuntimeException
,
87 ::com::sun::star::lang::IndexOutOfBoundsException
,
88 std::exception
) SAL_OVERRIDE
;
90 /// Returns the description text of the specified column in the table.
91 virtual OUString SAL_CALL
92 getAccessibleColumnDescription( sal_Int32 nColumn
)
93 throw (::com::sun::star::uno::RuntimeException
,
94 ::com::sun::star::lang::IndexOutOfBoundsException
,
95 std::exception
) SAL_OVERRIDE
;
97 /** Returns the number of rows occupied by the Accessible at a specified row and column in the table.
98 Returns 1 if it is only a cell and the number of rows the cell is merged if the cell is a merged cell.
100 virtual sal_Int32 SAL_CALL
101 getAccessibleRowExtentAt( sal_Int32 nRow
, sal_Int32 nColumn
)
102 throw (::com::sun::star::uno::RuntimeException
,
103 ::com::sun::star::lang::IndexOutOfBoundsException
,
104 std::exception
) SAL_OVERRIDE
;
106 /** Returns the number of columns occupied by the Accessible at a specified row and column in the table.
107 Returns 1 if it is only a cell and the number of columns the cell is merged if the cell is a merged cell.
109 virtual sal_Int32 SAL_CALL
110 getAccessibleColumnExtentAt( sal_Int32 nRow
, sal_Int32 nColumn
)
111 throw (::com::sun::star::uno::RuntimeException
,
112 ::com::sun::star::lang::IndexOutOfBoundsException
,
113 std::exception
) SAL_OVERRIDE
;
115 /// Returns the row headers as an AccessibleTable.
116 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleTable
> SAL_CALL
117 getAccessibleRowHeaders( )
118 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
120 /// Returns the column headers as an AccessibleTable.
121 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleTable
> SAL_CALL
122 getAccessibleColumnHeaders( )
123 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
125 /// Returns the selected rows in a table.
126 virtual ::com::sun::star::uno::Sequence
< sal_Int32
> SAL_CALL
127 getSelectedAccessibleRows( )
128 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
130 /// Returns the selected columns in a table.
131 virtual ::com::sun::star::uno::Sequence
< sal_Int32
> SAL_CALL
132 getSelectedAccessibleColumns( )
133 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
135 /// Returns a boolean value indicating whether the specified row is selected.
136 virtual sal_Bool SAL_CALL
137 isAccessibleRowSelected( sal_Int32 nRow
)
138 throw (::com::sun::star::uno::RuntimeException
,
139 ::com::sun::star::lang::IndexOutOfBoundsException
,
140 std::exception
) SAL_OVERRIDE
;
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 std::exception
) SAL_OVERRIDE
;
149 /// Returns the Accessible at a specified row and column in the table.
150 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
151 getAccessibleCellAt( sal_Int32 nRow
, sal_Int32 nColumn
)
152 throw (::com::sun::star::uno::RuntimeException
,
153 ::com::sun::star::lang::IndexOutOfBoundsException
,
154 std::exception
) SAL_OVERRIDE
;
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
, std::exception
) SAL_OVERRIDE
;
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
, std::exception
) SAL_OVERRIDE
;
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 std::exception
) SAL_OVERRIDE
;
173 ///===== XAccessibleExtendedTable ========================================
175 /// Returns the index of the cell on the given position.
176 virtual sal_Int32 SAL_CALL
177 getAccessibleIndex( sal_Int32 nRow
, sal_Int32 nColumn
)
178 throw (::com::sun::star::uno::RuntimeException
,
179 ::com::sun::star::lang::IndexOutOfBoundsException
,
180 std::exception
) SAL_OVERRIDE
;
182 /// Returns the row number of an index in the table.
183 virtual sal_Int32 SAL_CALL
184 getAccessibleRow( sal_Int32 nChildIndex
)
185 throw (::com::sun::star::uno::RuntimeException
,
186 ::com::sun::star::lang::IndexOutOfBoundsException
,
187 std::exception
) SAL_OVERRIDE
;
189 /// Returns the column number of an index in the table.
190 virtual sal_Int32 SAL_CALL
191 getAccessibleColumn( sal_Int32 nChildIndex
)
192 throw (::com::sun::star::uno::RuntimeException
,
193 ::com::sun::star::lang::IndexOutOfBoundsException
,
194 std::exception
) SAL_OVERRIDE
;
196 //===== XAccessibleContext ==============================================
198 /// Return the number of currently visible children.
199 /// override to calculate this on demand
200 virtual sal_Int32 SAL_CALL
201 getAccessibleChildCount()
202 throw (::com::sun::star::uno::RuntimeException
,
203 std::exception
) SAL_OVERRIDE
;
205 /// Return the specified child or NULL if index is invalid.
206 /// override to calculate this on demand
207 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
208 getAccessibleChild(sal_Int32 nIndex
)
209 throw (::com::sun::star::uno::RuntimeException
,
210 ::com::sun::star::lang::IndexOutOfBoundsException
,
211 std::exception
) SAL_OVERRIDE
;
212 virtual sal_Bool SAL_CALL
selectRow( sal_Int32 row
)
213 throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
,
214 std::exception
) SAL_OVERRIDE
;
215 virtual sal_Bool SAL_CALL
selectColumn( sal_Int32 column
)
216 throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
,
217 std::exception
) SAL_OVERRIDE
;
218 virtual sal_Bool SAL_CALL
unselectRow( sal_Int32 row
)
219 throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
,
220 std::exception
) SAL_OVERRIDE
;
221 virtual sal_Bool SAL_CALL
unselectColumn( sal_Int32 column
)
222 throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
,
223 std::exception
) SAL_OVERRIDE
;
226 /// Return this object's description.
227 virtual OUString SAL_CALL
228 createAccessibleDescription()
229 throw (::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
231 /// Return the object's current name.
232 virtual OUString SAL_CALL
233 createAccessibleName()
234 throw (::com::sun::star::uno::RuntimeException
,
235 std::exception
) SAL_OVERRIDE
;
238 /// Return NULL to indicate that an empty relation set.
239 virtual ::com::sun::star::uno::Reference
<
240 ::com::sun::star::accessibility::XAccessibleRelationSet
> SAL_CALL
241 getAccessibleRelationSet()
242 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
244 /// Return the set of current states.
245 // perhaps sometimes to be implemented
246 virtual ::com::sun::star::uno::Reference
<
247 ::com::sun::star::accessibility::XAccessibleStateSet
> SAL_CALL
248 getAccessibleStateSet()
249 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
251 ///===== XAccessibleSelection ===========================================
253 virtual void SAL_CALL
254 selectAccessibleChild( sal_Int32 nChildIndex
)
255 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
256 ::com::sun::star::uno::RuntimeException
,
257 std::exception
) SAL_OVERRIDE
;
259 virtual sal_Bool SAL_CALL
260 isAccessibleChildSelected( sal_Int32 nChildIndex
)
261 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
262 ::com::sun::star::uno::RuntimeException
,
263 std::exception
) SAL_OVERRIDE
;
265 virtual void SAL_CALL
266 clearAccessibleSelection( )
267 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
269 virtual void SAL_CALL
270 selectAllAccessibleChildren( )
271 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
273 virtual sal_Int32 SAL_CALL
274 getSelectedAccessibleChildCount( )
275 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
277 virtual ::com::sun::star::uno::Reference
<
278 ::com::sun::star::accessibility::XAccessible
> SAL_CALL
279 getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex
)
280 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
281 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
283 virtual void SAL_CALL
284 deselectAccessibleChild( sal_Int32 nSelectedChildIndex
)
285 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
286 ::com::sun::star::uno::RuntimeException
,
287 std::exception
) SAL_OVERRIDE
;
289 ///===== XServiceInfo ===================================================
291 /** Returns an identifier for the implementation of this object.
293 virtual OUString SAL_CALL
294 getImplementationName()
295 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
297 ///===== XTypeProvider ===================================================
299 /// returns the possible types
300 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
302 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
304 /** Returns a implementation id.
306 virtual ::com::sun::star::uno::Sequence
<sal_Int8
> SAL_CALL
307 getImplementationId()
308 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
311 /// contains the range of the table, because it could be a subrange of the complete table
316 void CommitTableModelChange(sal_Int32 nStartRow
, sal_Int32 nStartCol
, sal_Int32 nEndRow
, sal_Int32 nEndCol
, sal_uInt16 nId
);
321 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */