1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: AccessibleTableBase.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #ifndef _SC_ACCESSIBLETABLEBASE_HXX
33 #define _SC_ACCESSIBLETABLEBASE_HXX
35 #include "AccessibleContextBase.hxx"
37 #include "address.hxx"
38 #include <com/sun/star/accessibility/XAccessibleTable.hpp>
39 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
40 #include <cppuhelper/implbase2.hxx>
45 This base class provides an implementation of the
46 <code>AccessibleTable</code> service.
49 typedef cppu::ImplHelper2
< ::com::sun::star::accessibility::XAccessibleTable
,
50 ::com::sun::star::accessibility::XAccessibleSelection
>
51 ScAccessibleTableBaseImpl
;
53 class ScAccessibleTableBase
:
54 public ScAccessibleContextBase
,
55 public ScAccessibleTableBaseImpl
58 //===== internal ========================================================
59 ScAccessibleTableBase(
60 const ::com::sun::star::uno::Reference
<
61 ::com::sun::star::accessibility::XAccessible
>& rxParent
,
63 const ScRange
& rRange
);
65 virtual ~ScAccessibleTableBase();
68 using ScAccessibleContextBase::disposing
;
69 virtual void SAL_CALL
disposing();
71 ///===== XInterface =====================================================
73 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
74 ::com::sun::star::uno::Type
const & rType
)
75 throw (::com::sun::star::uno::RuntimeException
);
77 virtual void SAL_CALL
acquire() throw ();
79 virtual void SAL_CALL
release() throw ();
81 ///===== XAccessibleTable ================================================
83 /// Returns the number of rows in the table.
84 virtual sal_Int32 SAL_CALL
85 getAccessibleRowCount( )
86 throw (::com::sun::star::uno::RuntimeException
);
88 /// Returns the number of columns in the table.
89 virtual sal_Int32 SAL_CALL
90 getAccessibleColumnCount( )
91 throw (::com::sun::star::uno::RuntimeException
);
93 /// Returns the description of the specified row in the table.
94 virtual ::rtl::OUString SAL_CALL
95 getAccessibleRowDescription( sal_Int32 nRow
)
96 throw (::com::sun::star::uno::RuntimeException
,
97 ::com::sun::star::lang::IndexOutOfBoundsException
);
99 /// Returns the description text of the specified column in the table.
100 virtual ::rtl::OUString SAL_CALL
101 getAccessibleColumnDescription( sal_Int32 nColumn
)
102 throw (::com::sun::star::uno::RuntimeException
,
103 ::com::sun::star::lang::IndexOutOfBoundsException
);
105 /** Returns the number of rows 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 rows the cell is merged if the cell is a merged cell.
108 virtual sal_Int32 SAL_CALL
109 getAccessibleRowExtentAt( sal_Int32 nRow
, sal_Int32 nColumn
)
110 throw (::com::sun::star::uno::RuntimeException
,
111 ::com::sun::star::lang::IndexOutOfBoundsException
);
113 /** Returns the number of columns occupied by the Accessible at a specified row and column in the table.
114 Returns 1 if it is only a cell and the number of columns the cell is merged if the cell is a merged cell.
116 virtual sal_Int32 SAL_CALL
117 getAccessibleColumnExtentAt( sal_Int32 nRow
, sal_Int32 nColumn
)
118 throw (::com::sun::star::uno::RuntimeException
,
119 ::com::sun::star::lang::IndexOutOfBoundsException
);
121 /// Returns the row headers as an AccessibleTable.
122 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleTable
> SAL_CALL
123 getAccessibleRowHeaders( )
124 throw (::com::sun::star::uno::RuntimeException
);
126 /// Returns the column headers as an AccessibleTable.
127 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleTable
> SAL_CALL
128 getAccessibleColumnHeaders( )
129 throw (::com::sun::star::uno::RuntimeException
);
131 /// Returns the selected rows in a table.
132 virtual ::com::sun::star::uno::Sequence
< sal_Int32
> SAL_CALL
133 getSelectedAccessibleRows( )
134 throw (::com::sun::star::uno::RuntimeException
);
136 /// Returns the selected columns in a table.
137 virtual ::com::sun::star::uno::Sequence
< sal_Int32
> SAL_CALL
138 getSelectedAccessibleColumns( )
139 throw (::com::sun::star::uno::RuntimeException
);
141 /// Returns a boolean value indicating whether the specified row is selected.
142 virtual sal_Bool SAL_CALL
143 isAccessibleRowSelected( sal_Int32 nRow
)
144 throw (::com::sun::star::uno::RuntimeException
,
145 ::com::sun::star::lang::IndexOutOfBoundsException
);
147 /// Returns a boolean value indicating whether the specified column is selected.
148 virtual sal_Bool SAL_CALL
149 isAccessibleColumnSelected( sal_Int32 nColumn
)
150 throw (::com::sun::star::uno::RuntimeException
,
151 ::com::sun::star::lang::IndexOutOfBoundsException
);
153 /// Returns the Accessible at a specified row and column in the table.
154 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
155 getAccessibleCellAt( sal_Int32 nRow
, sal_Int32 nColumn
)
156 throw (::com::sun::star::uno::RuntimeException
,
157 ::com::sun::star::lang::IndexOutOfBoundsException
);
159 /// Returns the caption for the table.
160 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
161 getAccessibleCaption( )
162 throw (::com::sun::star::uno::RuntimeException
);
164 /// Returns the summary description of the table.
165 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
166 getAccessibleSummary( )
167 throw (::com::sun::star::uno::RuntimeException
);
169 /// Returns a boolean value indicating whether the accessible at a specified row and column is selected.
170 virtual sal_Bool SAL_CALL
171 isAccessibleSelected( sal_Int32 nRow
, sal_Int32 nColumn
)
172 throw (::com::sun::star::uno::RuntimeException
,
173 ::com::sun::star::lang::IndexOutOfBoundsException
);
175 ///===== XAccessibleExtendedTable ========================================
177 /// Returns the index of the cell on the given position.
178 virtual sal_Int32 SAL_CALL
179 getAccessibleIndex( sal_Int32 nRow
, sal_Int32 nColumn
)
180 throw (::com::sun::star::uno::RuntimeException
,
181 ::com::sun::star::lang::IndexOutOfBoundsException
);
183 /// Returns the row number of an index in the table.
184 virtual sal_Int32 SAL_CALL
185 getAccessibleRow( sal_Int32 nChildIndex
)
186 throw (::com::sun::star::uno::RuntimeException
,
187 ::com::sun::star::lang::IndexOutOfBoundsException
);
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
);
195 //===== XAccessibleContext ==============================================
197 /// Return the number of currently visible children.
198 // is overloaded to calculate this on demand
199 virtual sal_Int32 SAL_CALL
200 getAccessibleChildCount(void)
201 throw (::com::sun::star::uno::RuntimeException
);
203 /// Return the specified child or NULL if index is invalid.
204 // is overloaded to calculate this on demand
205 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
206 getAccessibleChild(sal_Int32 nIndex
)
207 throw (::com::sun::star::uno::RuntimeException
,
208 ::com::sun::star::lang::IndexOutOfBoundsException
);
211 /// Return this object's description.
212 virtual ::rtl::OUString SAL_CALL
213 createAccessibleDescription(void)
214 throw (::com::sun::star::uno::RuntimeException
);
216 /// Return the object's current name.
217 virtual ::rtl::OUString SAL_CALL
218 createAccessibleName(void)
219 throw (::com::sun::star::uno::RuntimeException
);
222 /// Return NULL to indicate that an empty relation set.
223 virtual ::com::sun::star::uno::Reference
<
224 ::com::sun::star::accessibility::XAccessibleRelationSet
> SAL_CALL
225 getAccessibleRelationSet(void)
226 throw (::com::sun::star::uno::RuntimeException
);
228 /// Return the set of current states.
229 // perhaps sometimes to be implemented
230 virtual ::com::sun::star::uno::Reference
<
231 ::com::sun::star::accessibility::XAccessibleStateSet
> SAL_CALL
232 getAccessibleStateSet(void)
233 throw (::com::sun::star::uno::RuntimeException
);
235 ///===== XAccessibleSelection ===========================================
237 virtual void SAL_CALL
238 selectAccessibleChild( sal_Int32 nChildIndex
)
239 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
240 ::com::sun::star::uno::RuntimeException
);
242 virtual sal_Bool SAL_CALL
243 isAccessibleChildSelected( sal_Int32 nChildIndex
)
244 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
245 ::com::sun::star::uno::RuntimeException
);
247 virtual void SAL_CALL
248 clearAccessibleSelection( )
249 throw (::com::sun::star::uno::RuntimeException
);
251 virtual void SAL_CALL
252 selectAllAccessibleChildren( )
253 throw (::com::sun::star::uno::RuntimeException
);
255 virtual sal_Int32 SAL_CALL
256 getSelectedAccessibleChildCount( )
257 throw (::com::sun::star::uno::RuntimeException
);
259 virtual ::com::sun::star::uno::Reference
<
260 ::com::sun::star::accessibility::XAccessible
> SAL_CALL
261 getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex
)
262 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
263 ::com::sun::star::uno::RuntimeException
);
265 virtual void SAL_CALL
266 deselectAccessibleChild( sal_Int32 nSelectedChildIndex
)
267 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
268 ::com::sun::star::uno::RuntimeException
);
270 ///===== XServiceInfo ===================================================
272 /** Returns an identifier for the implementation of this object.
274 virtual ::rtl::OUString SAL_CALL
275 getImplementationName(void)
276 throw (::com::sun::star::uno::RuntimeException
);
278 ///===== XTypeProvider ===================================================
280 /// returns the possible types
281 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
283 throw (::com::sun::star::uno::RuntimeException
);
285 /** Returns a implementation id.
287 virtual ::com::sun::star::uno::Sequence
<sal_Int8
> SAL_CALL
288 getImplementationId(void)
289 throw (::com::sun::star::uno::RuntimeException
);
292 /// contains the range of the table, because it could be a subrange of the complete table
297 void CommitTableModelChange(sal_Int32 nStartRow
, sal_Int32 nStartCol
, sal_Int32 nEndRow
, sal_Int32 nEndCol
, sal_uInt16 nId
);