Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 :
21 : #ifndef INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_EXTENDED_ACCESSIBLEBROWSEBOXHEADERBAR_HXX
22 : #define INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_EXTENDED_ACCESSIBLEBROWSEBOXHEADERBAR_HXX
23 :
24 : #include "accessibility/extended/AccessibleBrowseBoxTableBase.hxx"
25 : #include <cppuhelper/implbase1.hxx>
26 : #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
27 :
28 :
29 :
30 : namespace accessibility {
31 :
32 :
33 :
34 : typedef ::cppu::ImplHelper1<
35 : ::com::sun::star::accessibility::XAccessibleSelection >
36 : AccessibleBrowseBoxHeaderBarImplHelper;
37 :
38 : /** This class represents the accessible object of a header bar of a BrowseBox
39 : control (row or column header bar). This object supports the
40 : XAccessibleSelection interface. Selecting a child of this object selects
41 : complete rows or columns of the data table. */
42 : class AccessibleBrowseBoxHeaderBar :
43 : public AccessibleBrowseBoxTableBase,
44 : public AccessibleBrowseBoxHeaderBarImplHelper
45 : {
46 : public:
47 : /** @param eObjType One of the two allowed types BBTYPE_ROWHEADERBAR or
48 : BBTYPE_COLUMNHEADERBAR. */
49 : AccessibleBrowseBoxHeaderBar(
50 : const ::com::sun::star::uno::Reference<
51 : ::com::sun::star::accessibility::XAccessible >& rxParent,
52 : ::svt::IAccessibleTableProvider& rBrowseBox,
53 : ::svt::AccessibleBrowseBoxObjType eObjType );
54 :
55 : protected:
56 : virtual ~AccessibleBrowseBoxHeaderBar();
57 :
58 : public:
59 : // XAccessibleContext -----------------------------------------------------
60 :
61 : /** @return
62 : The XAccessible interface of the specified child.
63 : */
64 : virtual ::com::sun::star::uno::Reference<
65 : ::com::sun::star::accessibility::XAccessible > SAL_CALL
66 : getAccessibleChild( sal_Int32 nChildIndex )
67 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
68 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
69 :
70 : /** @return The index of this object among the parent's children. */
71 : virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
72 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
73 :
74 : // XAccessibleComponent ---------------------------------------------------
75 :
76 : /** @return The accessible child rendered under the given point. */
77 : virtual ::com::sun::star::uno::Reference<
78 : ::com::sun::star::accessibility::XAccessible > SAL_CALL
79 : getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint )
80 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
81 :
82 : /** Grabs the focus to (the current cell of) the data table. */
83 : virtual void SAL_CALL grabFocus()
84 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
85 :
86 : // XAccessibleTable -------------------------------------------------------
87 :
88 : /** @return The description text of the specified row. */
89 : virtual OUString SAL_CALL
90 : getAccessibleRowDescription( sal_Int32 nRow )
91 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
92 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
93 :
94 : /** @return The description text of the specified column. */
95 : virtual OUString SAL_CALL
96 : getAccessibleColumnDescription( sal_Int32 nColumn )
97 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
98 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
99 :
100 : /** @return The XAccessibleTable interface of the row header bar. */
101 : virtual ::com::sun::star::uno::Reference<
102 : ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
103 : getAccessibleRowHeaders()
104 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
105 :
106 : /** @return The XAccessibleTable interface of the column header bar. */
107 : virtual ::com::sun::star::uno::Reference<
108 : ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
109 : getAccessibleColumnHeaders()
110 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
111 :
112 : /** @return An index list of completely selected rows. */
113 : virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
114 : getSelectedAccessibleRows()
115 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
116 :
117 : /** @return An index list of completely selected columns. */
118 : virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
119 : getSelectedAccessibleColumns()
120 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
121 :
122 : /** @return <TRUE/>, if the specified row is completely selected. */
123 : virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow )
124 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
125 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
126 :
127 : /** @return <TRUE/>, if the specified column is completely selected. */
128 : virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn )
129 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
130 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
131 :
132 : /** @return The XAccessible interface of the cell object at the specified
133 : cell position. */
134 : virtual ::com::sun::star::uno::Reference<
135 : ::com::sun::star::accessibility::XAccessible > SAL_CALL
136 : getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
137 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
138 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
139 :
140 : /** @return <TRUE/>, if the specified cell is selected. */
141 : virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
142 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
143 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
144 :
145 : // XAccessibleSelection ---------------------------------------------------
146 :
147 : /** Selects the specified child (row or column of the table). */
148 : virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex )
149 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
150 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
151 :
152 : /** @return <TRUE/>, if the specified child (row/column) is selected. */
153 : virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex )
154 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
155 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
156 :
157 : /** Clears the complete selection. */
158 : virtual void SAL_CALL clearAccessibleSelection()
159 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
160 :
161 : /** Selects all children or first, if multiselection is not supported. */
162 : virtual void SAL_CALL selectAllAccessibleChildren()
163 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
164 :
165 : /** @return The number of selected rows/columns. */
166 : virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount()
167 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
168 :
169 : /** @return The specified selected row/column. */
170 : virtual ::com::sun::star::uno::Reference<
171 : ::com::sun::star::accessibility::XAccessible > SAL_CALL
172 : getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
173 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
174 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
175 :
176 : /** Removes the specified row/column from the selection. */
177 : virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex )
178 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
179 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
180 :
181 : // XInterface -------------------------------------------------------------
182 :
183 : /** Queries for a new interface. */
184 : ::com::sun::star::uno::Any SAL_CALL queryInterface(
185 : const ::com::sun::star::uno::Type& rType )
186 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
187 :
188 : /** Aquires the object (calls acquire() on base class). */
189 : virtual void SAL_CALL acquire() throw () SAL_OVERRIDE;
190 :
191 : /** Releases the object (calls release() on base class). */
192 : virtual void SAL_CALL release() throw () SAL_OVERRIDE;
193 :
194 : // XServiceInfo -----------------------------------------------------------
195 :
196 : /** @return The name of this class. */
197 : virtual OUString SAL_CALL getImplementationName()
198 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
199 :
200 : /** @return An unique implementation ID. */
201 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
202 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
203 :
204 : protected:
205 : // internal virtual methods -----------------------------------------------
206 :
207 : /** @attention This method requires locked mutex's and a living object.
208 : @return The bounding box (VCL rect.) relative to the parent window. */
209 : virtual Rectangle implGetBoundingBox() SAL_OVERRIDE;
210 : /** @attention This method requires locked mutex's and a living object.
211 : @return The bounding box (VCL rect.) in screen coordinates. */
212 : virtual Rectangle implGetBoundingBoxOnScreen() SAL_OVERRIDE;
213 :
214 : /** @attention This method requires locked mutex's and a living object.
215 : @return The count of used rows. */
216 : virtual sal_Int32 implGetRowCount() const SAL_OVERRIDE;
217 : /** @attention This method requires locked mutex's and a living object.
218 : @return The count of used columns. */
219 : virtual sal_Int32 implGetColumnCount() const SAL_OVERRIDE;
220 :
221 : // internal helper methods ------------------------------------------------
222 :
223 : /** @return <TRUE/>, if the objects is a header bar for rows. */
224 : inline bool isRowBar() const;
225 : /** @return <TRUE/>, if the objects is a header bar for columns. */
226 : inline bool isColumnBar() const;
227 :
228 : /** Returns the specified row or column. Uses one of the parameters,
229 : depending on object type.
230 : @attention This method requires locked mutex's and a living object.
231 : @return The XAccessible interface of the specified column/row. */
232 : ::com::sun::star::uno::Reference<
233 : ::com::sun::star::accessibility::XAccessible >
234 : implGetChild( sal_Int32 nRow, sal_uInt16 nColumnPos );
235 :
236 : /** @attention This method requires locked mutex's and a living object.
237 : @return The absolute child index from the index of selected children.
238 : @throws <type>IndexOutOfBoundsException</type>
239 : If the specified index is invalid. */
240 : sal_Int32 implGetChildIndexFromSelectedIndex( sal_Int32 nSelectedChildIndex )
241 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
242 :
243 : /** @attention This method requires locked mutex's and a living object.
244 : @throws <type>IndexOutOfBoundsException</type>
245 : If the specified row/column index (depending on type) is invalid. */
246 : void ensureIsValidHeaderIndex( sal_Int32 nIndex )
247 : throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
248 : };
249 :
250 : // inlines --------------------------------------------------------------------
251 :
252 0 : inline bool AccessibleBrowseBoxHeaderBar::isRowBar() const
253 : {
254 0 : return getType() == ::svt::BBTYPE_ROWHEADERBAR;
255 : }
256 :
257 0 : inline bool AccessibleBrowseBoxHeaderBar::isColumnBar() const
258 : {
259 0 : return getType() == ::svt::BBTYPE_COLUMNHEADERBAR;
260 : }
261 :
262 :
263 :
264 : } // namespace accessibility
265 :
266 :
267 :
268 : #endif
269 :
270 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|