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 .
22 #include "AccessibleContextBase.hxx"
23 #include <address.hxx>
24 #include <com/sun/star/accessibility/XAccessibleTable.hpp>
25 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
26 #include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
27 #include <cppuhelper/implbase2.hxx>
30 This base class provides an implementation of the
31 <code>AccessibleTable</code> service.
34 typedef cppu::ImplHelper2
< css::accessibility::XAccessibleTable
,
35 css::accessibility::XAccessibleSelection
>
36 ScAccessibleTableBaseImpl
;
38 class ScAccessibleTableBase
:
39 public ScAccessibleContextBase
,
40 public css::accessibility::XAccessibleTableSelection
,
41 public ScAccessibleTableBaseImpl
44 //===== internal ========================================================
45 ScAccessibleTableBase(
46 const css::uno::Reference
<css::accessibility::XAccessible
>& rxParent
,
48 const ScRange
& rRange
);
50 virtual ~ScAccessibleTableBase() override
;
53 using ScAccessibleContextBase::disposing
;
54 virtual void SAL_CALL
disposing() override
;
56 ///===== XInterface =====================================================
58 virtual css::uno::Any SAL_CALL
queryInterface(
59 css::uno::Type
const & rType
) override
;
61 virtual void SAL_CALL
acquire() noexcept override
;
63 virtual void SAL_CALL
release() noexcept override
;
65 ///===== XAccessibleTable ================================================
67 /// Returns the number of rows in the table.
68 virtual sal_Int32 SAL_CALL
69 getAccessibleRowCount( ) override
;
71 /// Returns the number of columns in the table.
72 virtual sal_Int32 SAL_CALL
73 getAccessibleColumnCount( ) override
;
75 /// Returns the description of the specified row in the table.
76 virtual OUString SAL_CALL
77 getAccessibleRowDescription( sal_Int32 nRow
) override
;
79 /// Returns the description text of the specified column in the table.
80 virtual OUString SAL_CALL
81 getAccessibleColumnDescription( sal_Int32 nColumn
) override
;
83 /** Returns the number of rows occupied by the Accessible at a specified row and column in the table.
84 Returns 1 if it is only a cell and the number of rows the cell is merged if the cell is a merged cell.
86 virtual sal_Int32 SAL_CALL
87 getAccessibleRowExtentAt( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
89 /** Returns the number of columns occupied by the Accessible at a specified row and column in the table.
90 Returns 1 if it is only a cell and the number of columns the cell is merged if the cell is a merged cell.
92 virtual sal_Int32 SAL_CALL
93 getAccessibleColumnExtentAt( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
95 /// Returns the row headers as an AccessibleTable.
96 virtual css::uno::Reference
< css::accessibility::XAccessibleTable
> SAL_CALL
97 getAccessibleRowHeaders( ) override
;
99 /// Returns the column headers as an AccessibleTable.
100 virtual css::uno::Reference
< css::accessibility::XAccessibleTable
> SAL_CALL
101 getAccessibleColumnHeaders( ) override
;
103 /// Returns the selected rows in a table.
104 virtual css::uno::Sequence
< sal_Int32
> SAL_CALL
105 getSelectedAccessibleRows( ) override
;
107 /// Returns the selected columns in a table.
108 virtual css::uno::Sequence
< sal_Int32
> SAL_CALL
109 getSelectedAccessibleColumns( ) override
;
111 /// Returns a boolean value indicating whether the specified row is selected.
112 virtual sal_Bool SAL_CALL
113 isAccessibleRowSelected( sal_Int32 nRow
) override
;
115 /// Returns a boolean value indicating whether the specified column is selected.
116 virtual sal_Bool SAL_CALL
117 isAccessibleColumnSelected( sal_Int32 nColumn
) override
;
119 /// Returns the Accessible at a specified row and column in the table.
120 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
121 getAccessibleCellAt( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
123 /// Returns the caption for the table.
124 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
125 getAccessibleCaption( ) override
;
127 /// Returns the summary description of the table.
128 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
129 getAccessibleSummary( ) override
;
131 /// Returns a boolean value indicating whether the accessible at a specified row and column is selected.
132 virtual sal_Bool SAL_CALL
133 isAccessibleSelected( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
135 ///===== XAccessibleExtendedTable ========================================
137 /// Returns the index of the cell on the given position.
138 virtual sal_Int64 SAL_CALL
139 getAccessibleIndex( sal_Int32 nRow
, sal_Int32 nColumn
) override
;
141 /// Returns the row number of an index in the table.
142 virtual sal_Int32 SAL_CALL
143 getAccessibleRow( sal_Int64 nChildIndex
) override
;
145 /// Returns the column number of an index in the table.
146 virtual sal_Int32 SAL_CALL
147 getAccessibleColumn( sal_Int64 nChildIndex
) override
;
149 //===== XAccessibleContext ==============================================
151 /// Return the number of currently visible children.
152 /// override to calculate this on demand
153 virtual sal_Int64 SAL_CALL
154 getAccessibleChildCount() override
;
156 /// Return the specified child or NULL if index is invalid.
157 /// override to calculate this on demand
158 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
159 getAccessibleChild(sal_Int64 nIndex
) override
;
160 virtual sal_Bool SAL_CALL
selectRow( sal_Int32 row
) override
;
161 virtual sal_Bool SAL_CALL
selectColumn( sal_Int32 column
) override
;
162 virtual sal_Bool SAL_CALL
unselectRow( sal_Int32 row
) override
;
163 virtual sal_Bool SAL_CALL
unselectColumn( sal_Int32 column
) override
;
166 /// Return this object's description.
168 createAccessibleDescription() override
;
170 /// Return the object's current name.
172 createAccessibleName() override
;
175 /// Return NULL to indicate that an empty relation set.
176 virtual css::uno::Reference
<css::accessibility::XAccessibleRelationSet
> SAL_CALL
177 getAccessibleRelationSet() override
;
179 /// Return the set of current states.
180 // perhaps sometimes to be implemented
181 virtual sal_Int64 SAL_CALL
182 getAccessibleStateSet() override
;
184 ///===== XAccessibleSelection ===========================================
186 virtual void SAL_CALL
187 selectAccessibleChild( sal_Int64 nChildIndex
) override
;
189 virtual sal_Bool SAL_CALL
190 isAccessibleChildSelected( sal_Int64 nChildIndex
) override
;
192 virtual void SAL_CALL
193 clearAccessibleSelection( ) override
;
195 virtual void SAL_CALL
196 selectAllAccessibleChildren( ) override
;
198 virtual sal_Int64 SAL_CALL
199 getSelectedAccessibleChildCount( ) override
;
201 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
202 getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex
) override
;
204 virtual void SAL_CALL
205 deselectAccessibleChild( sal_Int64 nSelectedChildIndex
) override
;
207 ///===== XServiceInfo ===================================================
209 /** Returns an identifier for the implementation of this object.
211 virtual OUString SAL_CALL
212 getImplementationName() override
;
214 ///===== XTypeProvider ===================================================
216 /// returns the possible types
217 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
220 /** Returns an implementation id.
222 virtual css::uno::Sequence
<sal_Int8
> SAL_CALL
223 getImplementationId() override
;
226 /// contains the range of the table, because it could be a subrange of the complete table
231 void CommitTableModelChange(sal_Int32 nStartRow
, sal_Int32 nStartCol
, sal_Int32 nEndRow
, sal_Int32 nEndCol
, sal_uInt16 nId
);
234 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */