xref: /trunk/main/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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 
66     /** @return  The index of this object among the parent's children. */
67     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent();
68 
69     // XAccessibleComponent ---------------------------------------------------
70 
71     /** @return  The accessible child rendered under the given point. */
72     virtual ::com::sun::star::uno::Reference<
73         ::com::sun::star::accessibility::XAccessible > SAL_CALL
74     getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint );
75 
76     /** Grabs the focus to (the current cell of) the data table. */
77     virtual void SAL_CALL grabFocus();
78 
79     /** @return  The key bindings associated with this object. */
80     virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding();
81 
82     // XAccessibleTable -------------------------------------------------------
83 
84     /** @return  The description text of the specified row. */
85     virtual ::rtl::OUString SAL_CALL
86     getAccessibleRowDescription( sal_Int32 nRow );
87 
88     /** @return  The description text of the specified column. */
89     virtual ::rtl::OUString SAL_CALL
90     getAccessibleColumnDescription( sal_Int32 nColumn );
91 
92     /** @return  The XAccessibleTable interface of the row header bar. */
93     virtual ::com::sun::star::uno::Reference<
94         ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
95     getAccessibleRowHeaders();
96 
97     /** @return  The XAccessibleTable interface of the column header bar. */
98     virtual ::com::sun::star::uno::Reference<
99         ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
100     getAccessibleColumnHeaders();
101 
102     /** @return  An index list of completely selected rows. */
103     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
104     getSelectedAccessibleRows();
105 
106     /** @return  An index list of completely selected columns. */
107     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
108     getSelectedAccessibleColumns();
109 
110     /** @return  <TRUE/>, if the specified row is completely selected. */
111     virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow );
112 
113     /** @return  <TRUE/>, if the specified column is completely selected. */
114     virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn );
115 
116     /** @return The XAccessible interface of the cell object at the specified
117                 cell position. */
118     virtual ::com::sun::star::uno::Reference<
119         ::com::sun::star::accessibility::XAccessible > SAL_CALL
120     getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn );
121 
122     /** @return  <TRUE/>, if the specified cell is selected. */
123     virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn );
124 
125     // XServiceInfo -----------------------------------------------------------
126 
127     /** @return  The name of this class. */
128     virtual ::rtl::OUString SAL_CALL getImplementationName();
129 
130     /** @return  An unique implementation ID. */
131     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId();
132 
133 protected:
134     // internal virtual methods -----------------------------------------------
135     /** @attention  This method requires locked mutex's and a living object.
136         @return  The absolute child index from the index of selected children.
137         @throws <type>IndexOutOfBoundsException</type>
138         If the specified index is invalid. */
139     //sal_Int32 implGetChildIndexFromSelectedIndex( sal_Int32 nSelectedChildIndex )
140     //    throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
141 
142     /** Returns the specified row or column. Uses one of the parameters,
143         depending on object type.
144         @attention  This method requires locked mutex's and a living object.
145         @return  The XAccessible interface of the specified column/row. */
146     ::com::sun::star::uno::Reference<
147         ::com::sun::star::accessibility::XAccessible >
148     implGetChild( sal_Int32 nRow, sal_uInt32 nColumnPos );
149     /** @attention  This method requires locked mutex's and a living object.
150         @return  The bounding box (VCL rect.) relative to the parent window. */
151     virtual Rectangle implGetBoundingBox();
152    /** @attention  This method requires locked mutex's and a living object.
153         @return  The bounding box (VCL rect.) in screen coordinates. */
154     virtual Rectangle implGetBoundingBoxOnScreen();
155 
156     /** @attention  This method requires locked mutex's and a living object.
157         @return  The count of used rows. */
158     virtual sal_Int32 implGetRowCount() const;
159     /** @attention  This method requires locked mutex's and a living object.
160         @return  The count of used columns. */
161     virtual sal_Int32 implGetColumnCount() const;
162 
163     // internal helper methods ------------------------------------------------
164 
165     /** @return  <TRUE/>, if the objects is a header bar for rows. */
166     inline sal_Bool isRowBar() const;
167     /** @return  <TRUE/>, if the objects is a header bar for columns. */
168     inline sal_Bool isColumnBar() const;
169 };
170 
171 // inlines --------------------------------------------------------------------
172 
isRowBar() const173 inline sal_Bool AccessibleGridControlHeader::isRowBar() const
174 {
175     return getType() == ::svt::table::TCTYPE_ROWHEADERBAR;
176 }
177 
isColumnBar() const178 inline sal_Bool AccessibleGridControlHeader::isColumnBar() const
179 {
180     return getType() == ::svt::table::TCTYPE_COLUMNHEADERBAR;
181 }
182 
183 // ============================================================================
184 
185 } // namespace accessibility
186 
187 // ============================================================================
188 
189 #endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLHEADER_HXX
190