Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / sc / source / ui / inc / AccessibleTableBase.hxx
blob33ffbf50dac018f99805ab2b859e874f0a7316d4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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"
24 #include "global.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>
31 /** @descr
32 This base class provides an implementation of the
33 <code>AccessibleTable</code> service.
36 typedef cppu::ImplHelper2< css::accessibility::XAccessibleTable,
37 css::accessibility::XAccessibleSelection>
38 ScAccessibleTableBaseImpl;
40 class ScAccessibleTableBase :
41 public ScAccessibleContextBase,
42 public css::accessibility::XAccessibleTableSelection,
43 public ScAccessibleTableBaseImpl
45 public:
46 //===== internal ========================================================
47 ScAccessibleTableBase(
48 const css::uno::Reference<css::accessibility::XAccessible>& rxParent,
49 ScDocument* pDoc,
50 const ScRange& rRange);
51 protected:
52 virtual ~ScAccessibleTableBase();
53 public:
55 using ScAccessibleContextBase::disposing;
56 virtual void SAL_CALL disposing() override;
58 ///===== XInterface =====================================================
60 virtual css::uno::Any SAL_CALL queryInterface(
61 css::uno::Type const & rType )
62 throw (css::uno::RuntimeException, std::exception) override;
64 virtual void SAL_CALL acquire() throw () override;
66 virtual void SAL_CALL release() throw () override;
68 ///===== XAccessibleTable ================================================
70 /// Returns the number of rows in the table.
71 virtual sal_Int32 SAL_CALL
72 getAccessibleRowCount( )
73 throw (css::uno::RuntimeException,
74 std::exception) override;
76 /// Returns the number of columns in the table.
77 virtual sal_Int32 SAL_CALL
78 getAccessibleColumnCount( )
79 throw (css::uno::RuntimeException,
80 std::exception) override;
82 /// Returns the description of the specified row in the table.
83 virtual OUString SAL_CALL
84 getAccessibleRowDescription( sal_Int32 nRow )
85 throw (css::uno::RuntimeException,
86 css::lang::IndexOutOfBoundsException,
87 std::exception) override;
89 /// Returns the description text of the specified column in the table.
90 virtual OUString SAL_CALL
91 getAccessibleColumnDescription( sal_Int32 nColumn )
92 throw (css::uno::RuntimeException,
93 css::lang::IndexOutOfBoundsException,
94 std::exception) override;
96 /** Returns the number of rows occupied by the Accessible at a specified row and column in the table.
97 Returns 1 if it is only a cell and the number of rows the cell is merged if the cell is a merged cell.
99 virtual sal_Int32 SAL_CALL
100 getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
101 throw (css::uno::RuntimeException,
102 css::lang::IndexOutOfBoundsException,
103 std::exception) override;
105 /** Returns the number of columns occupied by the Accessible at a specified row and column in the table.
106 Returns 1 if it is only a cell and the number of columns the cell is merged if the cell is a merged cell.
108 virtual sal_Int32 SAL_CALL
109 getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
110 throw (css::uno::RuntimeException,
111 css::lang::IndexOutOfBoundsException,
112 std::exception) override;
114 /// Returns the row headers as an AccessibleTable.
115 virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL
116 getAccessibleRowHeaders( )
117 throw (css::uno::RuntimeException, std::exception) override;
119 /// Returns the column headers as an AccessibleTable.
120 virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL
121 getAccessibleColumnHeaders( )
122 throw (css::uno::RuntimeException, std::exception) override;
124 /// Returns the selected rows in a table.
125 virtual css::uno::Sequence< sal_Int32 > SAL_CALL
126 getSelectedAccessibleRows( )
127 throw (css::uno::RuntimeException, std::exception) override;
129 /// Returns the selected columns in a table.
130 virtual css::uno::Sequence< sal_Int32 > SAL_CALL
131 getSelectedAccessibleColumns( )
132 throw (css::uno::RuntimeException, std::exception) override;
134 /// Returns a boolean value indicating whether the specified row is selected.
135 virtual sal_Bool SAL_CALL
136 isAccessibleRowSelected( sal_Int32 nRow )
137 throw (css::uno::RuntimeException,
138 css::lang::IndexOutOfBoundsException,
139 std::exception) override;
141 /// Returns a boolean value indicating whether the specified column is selected.
142 virtual sal_Bool SAL_CALL
143 isAccessibleColumnSelected( sal_Int32 nColumn )
144 throw (css::uno::RuntimeException,
145 css::lang::IndexOutOfBoundsException,
146 std::exception) override;
148 /// Returns the Accessible at a specified row and column in the table.
149 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
150 getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
151 throw (css::uno::RuntimeException,
152 css::lang::IndexOutOfBoundsException,
153 std::exception) override;
155 /// Returns the caption for the table.
156 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
157 getAccessibleCaption( )
158 throw (css::uno::RuntimeException, std::exception) override;
160 /// Returns the summary description of the table.
161 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
162 getAccessibleSummary( )
163 throw (css::uno::RuntimeException, std::exception) override;
165 /// Returns a boolean value indicating whether the accessible at a specified row and column is selected.
166 virtual sal_Bool SAL_CALL
167 isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
168 throw (css::uno::RuntimeException,
169 css::lang::IndexOutOfBoundsException,
170 std::exception) override;
172 ///===== XAccessibleExtendedTable ========================================
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 (css::uno::RuntimeException,
178 css::lang::IndexOutOfBoundsException,
179 std::exception) override;
181 /// Returns the row number of an index in the table.
182 virtual sal_Int32 SAL_CALL
183 getAccessibleRow( sal_Int32 nChildIndex )
184 throw (css::uno::RuntimeException,
185 css::lang::IndexOutOfBoundsException,
186 std::exception) override;
188 /// Returns the column number of an index in the table.
189 virtual sal_Int32 SAL_CALL
190 getAccessibleColumn( sal_Int32 nChildIndex )
191 throw (css::uno::RuntimeException,
192 css::lang::IndexOutOfBoundsException,
193 std::exception) override;
195 //===== XAccessibleContext ==============================================
197 /// Return the number of currently visible children.
198 /// override to calculate this on demand
199 virtual sal_Int32 SAL_CALL
200 getAccessibleChildCount()
201 throw (css::uno::RuntimeException,
202 std::exception) override;
204 /// Return the specified child or NULL if index is invalid.
205 /// override to calculate this on demand
206 virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
207 getAccessibleChild(sal_Int32 nIndex)
208 throw (css::uno::RuntimeException,
209 css::lang::IndexOutOfBoundsException,
210 std::exception) override;
211 virtual sal_Bool SAL_CALL selectRow( sal_Int32 row )
212 throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException,
213 std::exception) override;
214 virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column )
215 throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException,
216 std::exception) override;
217 virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row )
218 throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException,
219 std::exception) override;
220 virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column )
221 throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException,
222 std::exception) override;
224 protected:
225 /// Return this object's description.
226 virtual OUString SAL_CALL
227 createAccessibleDescription()
228 throw (css::uno::RuntimeException, std::exception) override;
230 /// Return the object's current name.
231 virtual OUString SAL_CALL
232 createAccessibleName()
233 throw (css::uno::RuntimeException,
234 std::exception) override;
236 public:
237 /// Return NULL to indicate that an empty relation set.
238 virtual css::uno::Reference<css::accessibility::XAccessibleRelationSet> SAL_CALL
239 getAccessibleRelationSet()
240 throw (css::uno::RuntimeException, std::exception) override;
242 /// Return the set of current states.
243 // perhaps sometimes to be implemented
244 virtual css::uno::Reference<css::accessibility::XAccessibleStateSet> SAL_CALL
245 getAccessibleStateSet()
246 throw (css::uno::RuntimeException, std::exception) override;
248 ///===== XAccessibleSelection ===========================================
250 virtual void SAL_CALL
251 selectAccessibleChild( sal_Int32 nChildIndex )
252 throw (css::lang::IndexOutOfBoundsException,
253 css::uno::RuntimeException,
254 std::exception) override;
256 virtual sal_Bool SAL_CALL
257 isAccessibleChildSelected( sal_Int32 nChildIndex )
258 throw (css::lang::IndexOutOfBoundsException,
259 css::uno::RuntimeException,
260 std::exception) override;
262 virtual void SAL_CALL
263 clearAccessibleSelection( )
264 throw (css::uno::RuntimeException, std::exception) override;
266 virtual void SAL_CALL
267 selectAllAccessibleChildren( )
268 throw (css::uno::RuntimeException, std::exception) override;
270 virtual sal_Int32 SAL_CALL
271 getSelectedAccessibleChildCount( )
272 throw (css::uno::RuntimeException, std::exception) override;
274 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
275 getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
276 throw (css::lang::IndexOutOfBoundsException,
277 css::uno::RuntimeException, std::exception) override;
279 virtual void SAL_CALL
280 deselectAccessibleChild( sal_Int32 nSelectedChildIndex )
281 throw (css::lang::IndexOutOfBoundsException,
282 css::uno::RuntimeException,
283 std::exception) override;
285 ///===== XServiceInfo ===================================================
287 /** Returns an identifier for the implementation of this object.
289 virtual OUString SAL_CALL
290 getImplementationName()
291 throw (css::uno::RuntimeException, std::exception) override;
293 ///===== XTypeProvider ===================================================
295 /// returns the possible types
296 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
297 getTypes()
298 throw (css::uno::RuntimeException, std::exception) override;
300 /** Returns a implementation id.
302 virtual css::uno::Sequence<sal_Int8> SAL_CALL
303 getImplementationId()
304 throw (css::uno::RuntimeException, std::exception) override;
306 protected:
307 /// contains the range of the table, because it could be a subrange of the complete table
308 ScRange maRange;
310 ScDocument* mpDoc;
312 void CommitTableModelChange(sal_Int32 nStartRow, sal_Int32 nStartCol, sal_Int32 nEndRow, sal_Int32 nEndCol, sal_uInt16 nId);
315 #endif
317 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */