/src/libreoffice/toolkit/inc/controls/table/AccessibleGridControlHeader.hxx
Line | Count | Source |
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 | | #pragma once |
22 | | |
23 | | #include <controls/table/AccessibleGridControlTableBase.hxx> |
24 | | #include <controls/table/tablecontrol.hxx> |
25 | | |
26 | | namespace accessibility { |
27 | | |
28 | | /** This class represents the accessible object of a header bar of a Grid Control |
29 | | (row or column header bar). This object supports the |
30 | | XAccessibleSelection interface. Selecting a child of this object selects |
31 | | complete rows or columns of the data table. */ |
32 | | class AccessibleGridControlHeader final : public AccessibleGridControlTableBase |
33 | | { |
34 | | public: |
35 | | /** @param rxParent accessible parent control |
36 | | @param rTable accessible table |
37 | | @param eObjType One of the two allowed types AccessibleTableControlObjType::ROWHEADERBAR or |
38 | | AccessibleTableControlObjType::COLUMNHEADERBAR. */ |
39 | | AccessibleGridControlHeader( |
40 | | const css::uno::Reference< |
41 | | css::accessibility::XAccessible >& rxParent, |
42 | | svt::table::TableControl& rTable, |
43 | | AccessibleTableControlObjType eObjType); |
44 | | |
45 | | private: |
46 | | virtual ~AccessibleGridControlHeader() override = default; |
47 | | |
48 | | public: |
49 | | // XAccessibleContext |
50 | | |
51 | | /** @return |
52 | | The XAccessible interface of the specified child. |
53 | | */ |
54 | | virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL |
55 | | getAccessibleChild( sal_Int64 nChildIndex ) override; |
56 | | |
57 | | /** @return The index of this object among the parent's children. */ |
58 | | virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override; |
59 | | |
60 | | // XAccessibleComponent |
61 | | |
62 | | /** @return The accessible child rendered under the given point. */ |
63 | | virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL |
64 | | getAccessibleAtPoint( const css::awt::Point& rPoint ) override; |
65 | | |
66 | | /** Grabs the focus to (the current cell of) the data table. */ |
67 | | virtual void SAL_CALL grabFocus() override; |
68 | | |
69 | | // XAccessibleTable |
70 | | |
71 | | /** @return The description text of the specified row. */ |
72 | | virtual OUString SAL_CALL |
73 | | getAccessibleRowDescription( sal_Int32 nRow ) override; |
74 | | |
75 | | /** @return The description text of the specified column. */ |
76 | | virtual OUString SAL_CALL |
77 | | getAccessibleColumnDescription( sal_Int32 nColumn ) override; |
78 | | |
79 | | /** @return The XAccessibleTable interface of the row header bar. */ |
80 | | virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL |
81 | | getAccessibleRowHeaders() override; |
82 | | |
83 | | /** @return The XAccessibleTable interface of the column header bar. */ |
84 | | virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL |
85 | | getAccessibleColumnHeaders() override; |
86 | | |
87 | | /** @return An index list of completely selected rows. */ |
88 | | virtual css::uno::Sequence< sal_Int32 > SAL_CALL |
89 | | getSelectedAccessibleRows() override; |
90 | | |
91 | | /** @return An index list of completely selected columns. */ |
92 | | virtual css::uno::Sequence< sal_Int32 > SAL_CALL |
93 | | getSelectedAccessibleColumns() override; |
94 | | |
95 | | /** @return TRUE, if the specified row is completely selected. */ |
96 | | virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) override; |
97 | | |
98 | | /** @return TRUE, if the specified column is completely selected. */ |
99 | | virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) override; |
100 | | |
101 | | /** @return The XAccessible interface of the cell object at the specified |
102 | | cell position. */ |
103 | | virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL |
104 | | getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) override; |
105 | | |
106 | | /** @return TRUE, if the specified cell is selected. */ |
107 | | virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) override; |
108 | | |
109 | | // XServiceInfo |
110 | | |
111 | | /** @return The name of this class. */ |
112 | | virtual OUString SAL_CALL getImplementationName() override; |
113 | | |
114 | | private: |
115 | | /** Returns the specified row or column. Uses one of the parameters, |
116 | | depending on object type. |
117 | | @attention This method requires locked mutex's and a living object. |
118 | | @return The XAccessible interface of the specified column/row. */ |
119 | | css::uno::Reference< css::accessibility::XAccessible > |
120 | | implGetChild( sal_Int32 nRow, sal_uInt32 nColumnPos ); |
121 | | /** @attention This method requires locked mutex's and a living object. |
122 | | @return The bounding box (VCL rect.) in screen coordinates. */ |
123 | | virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; |
124 | | |
125 | | // internal helper methods |
126 | | |
127 | | /** @return TRUE, if the objects is a header bar for rows. */ |
128 | | inline bool isRowBar() const; |
129 | | /** @return TRUE, if the objects is a header bar for columns. */ |
130 | | inline bool isColumnBar() const; |
131 | | }; |
132 | | |
133 | | // inlines |
134 | | |
135 | | inline bool AccessibleGridControlHeader::isRowBar() const |
136 | 0 | { |
137 | 0 | return getType() == AccessibleTableControlObjType::ROWHEADERBAR; |
138 | 0 | } |
139 | | |
140 | | inline bool AccessibleGridControlHeader::isColumnBar() const |
141 | 0 | { |
142 | 0 | return getType() == AccessibleTableControlObjType::COLUMNHEADERBAR; |
143 | 0 | } |
144 | | |
145 | | |
146 | | } // namespace accessibility |
147 | | |
148 | | |
149 | | |
150 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |