xref: /trunk/main/accessibility/inc/accessibility/extended/AccessibleGridControlTable.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_ACCESSIBLEGRIDCONTROLTABLE_HXX
26 #define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLTABLE_HXX
27 
28 #include "accessibility/extended/AccessibleGridControlTableBase.hxx"
29 #include <cppuhelper/implbase1.hxx>
30 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
31 #include <accessibility/extended/AccessibleGridControlTableCell.hxx>
32 
33 // ============================================================================
34 
35 namespace accessibility {
36 
37 // ============================================================================
38 typedef ::cppu::ImplHelper1<
39             ::com::sun::star::accessibility::XAccessibleSelection >
40         AccessibleGridControlTableImplHelper1;
41 /** This class represents the accessible object of the data table of a
42     Grid control. */
43 class AccessibleGridControlTable : public AccessibleGridControlTableBase,
44                                 public AccessibleGridControlTableImplHelper1
45 {
46 public:
47     AccessibleGridControlTable(
48         const ::com::sun::star::uno::Reference<
49             ::com::sun::star::accessibility::XAccessible >& rxParent,
50             ::svt::table::IAccessibleTable& rTable,
51             ::svt::table::AccessibleTableControlObjType _eType);
52 
53 protected:
54     virtual ~AccessibleGridControlTable();
55 private:
56     std::vector< AccessibleGridControlTableCell* > m_pCellVector;
57     std::vector< com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible> > m_pAccessCellVector;
58 public:
59     // XAccessibleContext -----------------------------------------------------
60 
61     /** @return  The XAccessible interface of the specified child. */
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 getAccessibleRowDescription( sal_Int32 nRow );
86 
87     /** @return  The description text of the specified column. */
88     virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn );
89 
90     /** @return  The XAccessibleTable interface of the row header bar. */
91     virtual ::com::sun::star::uno::Reference<
92         ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
93     getAccessibleRowHeaders();
94 
95     /** @return  The XAccessibleTable interface of the column header bar. */
96     virtual ::com::sun::star::uno::Reference<
97         ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
98     getAccessibleColumnHeaders();
99 
100     /** @return  An index list of completely selected rows. */
101     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
102     getSelectedAccessibleRows();
103 
104     /** @return  An index list of completely selected columns. */
105     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
106     getSelectedAccessibleColumns();
107 
108     /** @return  <TRUE/>, if the specified row is completely selected. */
109     virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow );
110 
111     /** @return  <TRUE/>, if the specified column is completely selected. */
112     virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn );
113 
114     /** @return The XAccessible interface of the cell object at the specified
115                 cell position. */
116     virtual ::com::sun::star::uno::Reference<
117         ::com::sun::star::accessibility::XAccessible > SAL_CALL
118     getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn );
119 
120     /** @return  <TRUE/>, if the specified cell is selected. */
121     virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn );
122 
123     // XAccessibleSelection ---------------------------------------------------
124 
125     /** Selects the specified child (row or column of the table). */
126     virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex );
127 
128     /** @return  <TRUE/>, if the specified child (row/column) is selected. */
129     virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex );
130 
131     /** Clears the complete selection. */
132     virtual void SAL_CALL clearAccessibleSelection();
133 
134     /** Selects all children or first, if multiselection is not supported. */
135     virtual void SAL_CALL selectAllAccessibleChildren();
136 
137     /** @return  The number of selected rows/columns. */
138     virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount();
139 
140     /** @return  The specified selected row/column. */
141     virtual ::com::sun::star::uno::Reference<
142         ::com::sun::star::accessibility::XAccessible > SAL_CALL
143     getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex );
144 
145     /** Removes the specified row/column from the selection. */
146     virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex );
147      // XInterface -------------------------------------------------------------
148 
149     /** Queries for a new interface. */
150     ::com::sun::star::uno::Any SAL_CALL queryInterface(
151             const ::com::sun::star::uno::Type& rType );
152 
153     /** Aquires the object (calls acquire() on base class). */
154     virtual void SAL_CALL acquire() throw ();
155 
156     /** Releases the object (calls release() on base class). */
157     virtual void SAL_CALL release() throw ();
158     // XServiceInfo -----------------------------------------------------------
159 
160     /** @return  The name of this class. */
161     virtual ::rtl::OUString SAL_CALL getImplementationName();
162 
163     /**@return m_pCellVector*/
164     std::vector< AccessibleGridControlTableCell* >& getCellVector();
165     /**@return m_xAccessCellVector*/
166     std::vector< com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible > >& getAccessibleCellVector();
167 
168 protected:
169     // internal virtual methods -----------------------------------------------
170 
171     /** @attention  This method requires locked mutex's and a living object.
172         @return  The bounding box (VCL rect.) relative to the parent window. */
173     virtual Rectangle implGetBoundingBox();
174     ///** @attention  This method requires locked mutex's and a living object.
175     //    @return  The bounding box (VCL rect.) in screen coordinates. */
176     virtual Rectangle implGetBoundingBoxOnScreen();
177 
178 
179     //// internal helper methods ------------------------------------------------
180     ///** @attention  This method requires a locked mutex.
181     //    @return  The XAccessibleTable interface of the specified header bar. */
182     ::com::sun::star::uno::Reference<
183         ::com::sun::star::accessibility::XAccessibleTable >
184     implGetHeaderBar( sal_Int32 nChildIndex );
185 };
186 
187 // ============================================================================
188 
189 } // namespace accessibility
190 
191 // ============================================================================
192 
193 #endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLE_HXX
194