1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24
25 #ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADER_HXX
26 #define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADER_HXX
27
28
29 #include "accessibility/extended/AccessibleGridControlHeaderCell.hxx"
30 #include "accessibility/extended/AccessibleGridControlTableBase.hxx"
31
32 // ============================================================================
33
34 namespace accessibility {
35
36 // ============================================================================
37
38 /** This class represents the accessible object of a header bar of a Grid Control
39 (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 AccessibleGridControlHeader : public AccessibleGridControlTableBase
43 {
44 public:
45 /** @param eObjType One of the two allowed types TCTYPE_ROWHEADERBAR or
46 TCTYPE_COLUMNHEADERBAR. */
47 AccessibleGridControlHeader(
48 const ::com::sun::star::uno::Reference<
49 ::com::sun::star::accessibility::XAccessible >& rxParent,
50 ::svt::table::IAccessibleTable& rTable,
51 ::svt::table::AccessibleTableControlObjType eObjType );
52
53 protected:
54 virtual ~AccessibleGridControlHeader();
55
56 public:
57 // XAccessibleContext -----------------------------------------------------
58
59 /** @return
60 The XAccessible interface of the specified child.
61 */
62 virtual ::com::sun::star::uno::Reference<
63 ::com::sun::star::accessibility::XAccessible > SAL_CALL
64 getAccessibleChild( sal_Int32 nChildIndex )
65 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
66 ::com::sun::star::uno::RuntimeException );
67
68 /** @return The index of this object among the parent's children. */
69 virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
70 throw ( ::com::sun::star::uno::RuntimeException );
71
72 // XAccessibleComponent ---------------------------------------------------
73
74 /** @return The accessible child rendered under the given point. */
75 virtual ::com::sun::star::uno::Reference<
76 ::com::sun::star::accessibility::XAccessible > SAL_CALL
77 getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint )
78 throw ( ::com::sun::star::uno::RuntimeException );
79
80 /** Grabs the focus to (the current cell of) the data table. */
81 virtual void SAL_CALL grabFocus()
82 throw ( ::com::sun::star::uno::RuntimeException );
83
84 /** @return The key bindings associated with this object. */
85 virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding()
86 throw ( ::com::sun::star::uno::RuntimeException );
87
88 // XAccessibleTable -------------------------------------------------------
89
90 /** @return The description text of the specified row. */
91 virtual ::rtl::OUString SAL_CALL
92 getAccessibleRowDescription( sal_Int32 nRow )
93 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
94 ::com::sun::star::uno::RuntimeException );
95
96 /** @return The description text of the specified column. */
97 virtual ::rtl::OUString SAL_CALL
98 getAccessibleColumnDescription( sal_Int32 nColumn )
99 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
100 ::com::sun::star::uno::RuntimeException );
101
102 /** @return The XAccessibleTable interface of the row header bar. */
103 virtual ::com::sun::star::uno::Reference<
104 ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
105 getAccessibleRowHeaders()
106 throw ( ::com::sun::star::uno::RuntimeException );
107
108 /** @return The XAccessibleTable interface of the column header bar. */
109 virtual ::com::sun::star::uno::Reference<
110 ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
111 getAccessibleColumnHeaders()
112 throw ( ::com::sun::star::uno::RuntimeException );
113
114 /** @return An index list of completely selected rows. */
115 virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
116 getSelectedAccessibleRows()
117 throw ( ::com::sun::star::uno::RuntimeException );
118
119 /** @return An index list of completely selected columns. */
120 virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
121 getSelectedAccessibleColumns()
122 throw ( ::com::sun::star::uno::RuntimeException );
123
124 /** @return <TRUE/>, if the specified row is completely selected. */
125 virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow )
126 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
127 ::com::sun::star::uno::RuntimeException );
128
129 /** @return <TRUE/>, if the specified column is completely selected. */
130 virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn )
131 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
132 ::com::sun::star::uno::RuntimeException );
133
134 /** @return The XAccessible interface of the cell object at the specified
135 cell position. */
136 virtual ::com::sun::star::uno::Reference<
137 ::com::sun::star::accessibility::XAccessible > SAL_CALL
138 getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
139 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
140 ::com::sun::star::uno::RuntimeException );
141
142 /** @return <TRUE/>, if the specified cell is selected. */
143 virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
144 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
145 ::com::sun::star::uno::RuntimeException );
146
147 // XServiceInfo -----------------------------------------------------------
148
149 /** @return The name of this class. */
150 virtual ::rtl::OUString SAL_CALL getImplementationName()
151 throw ( ::com::sun::star::uno::RuntimeException );
152
153 /** @return An unique implementation ID. */
154 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
155 throw ( ::com::sun::star::uno::RuntimeException );
156
157 protected:
158 // internal virtual methods -----------------------------------------------
159 /** @attention This method requires locked mutex's and a living object.
160 @return The absolute child index from the index of selected children.
161 @throws <type>IndexOutOfBoundsException</type>
162 If the specified index is invalid. */
163 //sal_Int32 implGetChildIndexFromSelectedIndex( sal_Int32 nSelectedChildIndex )
164 // throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
165
166 /** Returns the specified row or column. Uses one of the parameters,
167 depending on object type.
168 @attention This method requires locked mutex's and a living object.
169 @return The XAccessible interface of the specified column/row. */
170 ::com::sun::star::uno::Reference<
171 ::com::sun::star::accessibility::XAccessible >
172 implGetChild( sal_Int32 nRow, sal_uInt32 nColumnPos );
173 /** @attention This method requires locked mutex's and a living object.
174 @return The bounding box (VCL rect.) relative to the parent window. */
175 virtual Rectangle implGetBoundingBox();
176 /** @attention This method requires locked mutex's and a living object.
177 @return The bounding box (VCL rect.) in screen coordinates. */
178 virtual Rectangle implGetBoundingBoxOnScreen();
179
180 /** @attention This method requires locked mutex's and a living object.
181 @return The count of used rows. */
182 virtual sal_Int32 implGetRowCount() const;
183 /** @attention This method requires locked mutex's and a living object.
184 @return The count of used columns. */
185 virtual sal_Int32 implGetColumnCount() const;
186
187 // internal helper methods ------------------------------------------------
188
189 /** @return <TRUE/>, if the objects is a header bar for rows. */
190 inline sal_Bool isRowBar() const;
191 /** @return <TRUE/>, if the objects is a header bar for columns. */
192 inline sal_Bool isColumnBar() const;
193 };
194
195 // inlines --------------------------------------------------------------------
196
isRowBar() const197 inline sal_Bool AccessibleGridControlHeader::isRowBar() const
198 {
199 return getType() == ::svt::table::TCTYPE_ROWHEADERBAR;
200 }
201
isColumnBar() const202 inline sal_Bool AccessibleGridControlHeader::isColumnBar() const
203 {
204 return getType() == ::svt::table::TCTYPE_COLUMNHEADERBAR;
205 }
206
207 // ============================================================================
208
209 } // namespace accessibility
210
211 // ============================================================================
212
213 #endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLHEADER_HXX
214
215