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"
24 #include <address.hxx>
25 #include <com/sun/star/accessibility/XAccessibleTable.hpp>
26 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
27 #include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
28 #include <cppuhelper/implbase2.hxx>
31 This base class provides an implementation of the
32 <code>AccessibleTable</code> service.
35 typedef cppu::ImplHelper2
< css::accessibility::XAccessibleTable
,
36 css::accessibility::XAccessibleSelection
>
37 ScAccessibleTableBaseImpl
;
39 class ScAccessibleTableBase
:
40 public ScAccessibleContextBase
,
41 public css::accessibility::XAccessibleTableSelection
,
42 public ScAccessibleTableBaseImpl
45 //===== internal ========================================================
46 ScAccessibleTableBase(
47 const css::uno::Reference
<css::accessibility::XAccessible
>& rxParent
,
49 const ScRange
& rRange
);
51 virtual ~ScAccessibleTableBase() override
;
54 using ScAccessibleContextBase::disposing
;
55 virtual void SAL_CALL
disposing() override
;
57 ///===== XInterface =====================================================
59 virtual css::uno::Any SAL_CALL
queryInterface(
60 css::uno::Type
const & rType
) override
;
62 virtual void SAL_CALL
acquire() throw () override
;
64 virtual void SAL_CALL
release() throw () override
;
66 ///===== XAccessibleTable ================================================
68 /// Returns the number of rows in the table.
69 virtual sal_Int32 SAL_CALL
70 getAccessibleRowCount( ) override
;
72 /// Returns the number of columns in the table.
73 virtual sal_Int32 SAL_CALL
74 getAccessibleColumnCount( ) override
;
76 /// Returns the description of the specified row in the table.
77 virtual OUString SAL_CALL
78 getAccessibleRowDescription( sal_Int32 nRow
) override
;
80 /// Returns the description text of the specified column in the table.
81 virtual OUString SAL_CALL
82 getAccessibleColumnDescription( sal_Int32 nColumn
) override
;
84 /** Returns the number of rows occupied by the Accessible at a specified row and column in the table.
85 Returns 1 if it is only a cell and the number of rows the cell is merged if the cell is a merged cell.
87 virtual sal_Int32 SAL_CALL
88 getAccessibleRowExtentAt( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
90 /** Returns the number of columns occupied by the Accessible at a specified row and column in the table.
91 Returns 1 if it is only a cell and the number of columns the cell is merged if the cell is a merged cell.
93 virtual sal_Int32 SAL_CALL
94 getAccessibleColumnExtentAt( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
96 /// Returns the row headers as an AccessibleTable.
97 virtual css::uno::Reference
< css::accessibility::XAccessibleTable
> SAL_CALL
98 getAccessibleRowHeaders( ) override
;
100 /// Returns the column headers as an AccessibleTable.
101 virtual css::uno::Reference
< css::accessibility::XAccessibleTable
> SAL_CALL
102 getAccessibleColumnHeaders( ) override
;
104 /// Returns the selected rows in a table.
105 virtual css::uno::Sequence
< sal_Int32
> SAL_CALL
106 getSelectedAccessibleRows( ) override
;
108 /// Returns the selected columns in a table.
109 virtual css::uno::Sequence
< sal_Int32
> SAL_CALL
110 getSelectedAccessibleColumns( ) override
;
112 /// Returns a boolean value indicating whether the specified row is selected.
113 virtual sal_Bool SAL_CALL
114 isAccessibleRowSelected( sal_Int32 nRow
) override
;
116 /// Returns a boolean value indicating whether the specified column is selected.
117 virtual sal_Bool SAL_CALL
118 isAccessibleColumnSelected( sal_Int32 nColumn
) override
;
120 /// Returns the Accessible at a specified row and column in the table.
121 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
122 getAccessibleCellAt( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
124 /// Returns the caption for the table.
125 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
126 getAccessibleCaption( ) override
;
128 /// Returns the summary description of the table.
129 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
130 getAccessibleSummary( ) override
;
132 /// Returns a boolean value indicating whether the accessible at a specified row and column is selected.
133 virtual sal_Bool SAL_CALL
134 isAccessibleSelected( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
136 ///===== XAccessibleExtendedTable ========================================
138 /// Returns the index of the cell on the given position.
139 virtual sal_Int32 SAL_CALL
140 getAccessibleIndex( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
142 /// Returns the row number of an index in the table.
143 virtual sal_Int32 SAL_CALL
144 getAccessibleRow( sal_Int32 nChildIndex
) override
;
146 /// Returns the column number of an index in the table.
147 virtual sal_Int32 SAL_CALL
148 getAccessibleColumn( sal_Int32 nChildIndex
) override
;
150 //===== XAccessibleContext ==============================================
152 /// Return the number of currently visible children.
153 /// override to calculate this on demand
154 virtual sal_Int32 SAL_CALL
155 getAccessibleChildCount() override
;
157 /// Return the specified child or NULL if index is invalid.
158 /// override to calculate this on demand
159 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
160 getAccessibleChild(sal_Int32 nIndex
) override
;
161 virtual sal_Bool SAL_CALL
selectRow( sal_Int32 row
) override
;
162 virtual sal_Bool SAL_CALL
selectColumn( sal_Int32 column
) override
;
163 virtual sal_Bool SAL_CALL
unselectRow( sal_Int32 row
) override
;
164 virtual sal_Bool SAL_CALL
unselectColumn( sal_Int32 column
) override
;
167 /// Return this object's description.
169 createAccessibleDescription() override
;
171 /// Return the object's current name.
173 createAccessibleName() override
;
176 /// Return NULL to indicate that an empty relation set.
177 virtual css::uno::Reference
<css::accessibility::XAccessibleRelationSet
> SAL_CALL
178 getAccessibleRelationSet() override
;
180 /// Return the set of current states.
181 // perhaps sometimes to be implemented
182 virtual css::uno::Reference
<css::accessibility::XAccessibleStateSet
> SAL_CALL
183 getAccessibleStateSet() override
;
185 ///===== XAccessibleSelection ===========================================
187 virtual void SAL_CALL
188 selectAccessibleChild( sal_Int32 nChildIndex
) override
;
190 virtual sal_Bool SAL_CALL
191 isAccessibleChildSelected( sal_Int32 nChildIndex
) override
;
193 virtual void SAL_CALL
194 clearAccessibleSelection( ) override
;
196 virtual void SAL_CALL
197 selectAllAccessibleChildren( ) override
;
199 virtual sal_Int32 SAL_CALL
200 getSelectedAccessibleChildCount( ) override
;
202 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
203 getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex
) override
;
205 virtual void SAL_CALL
206 deselectAccessibleChild( sal_Int32 nSelectedChildIndex
) override
;
208 ///===== XServiceInfo ===================================================
210 /** Returns an identifier for the implementation of this object.
212 virtual OUString SAL_CALL
213 getImplementationName() override
;
215 ///===== XTypeProvider ===================================================
217 /// returns the possible types
218 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
221 /** Returns an implementation id.
223 virtual css::uno::Sequence
<sal_Int8
> SAL_CALL
224 getImplementationId() override
;
227 /// contains the range of the table, because it could be a subrange of the complete table
232 void CommitTableModelChange(sal_Int32 nStartRow
, sal_Int32 nStartCol
, sal_Int32 nEndRow
, sal_Int32 nEndCol
, sal_uInt16 nId
);
237 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */