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         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 getAccessibleRowDescription( sal_Int32 nRow )
92         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
93                 ::com::sun::star::uno::RuntimeException );
94 
95     /** @return  The description text of the specified column. */
96     virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn )
97         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
98                 ::com::sun::star::uno::RuntimeException );
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 );
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 );
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 );
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 );
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 );
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 );
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 );
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 );
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 );
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 );
156 
157     /** Clears the complete selection. */
158     virtual void SAL_CALL clearAccessibleSelection()
159         throw ( ::com::sun::star::uno::RuntimeException );
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 );
164 
165     /** @return  The number of selected rows/columns. */
166     virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount()
167         throw ( ::com::sun::star::uno::RuntimeException );
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 );
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 );
180 	 // XInterface -------------------------------------------------------------
181 
182     /** Queries for a new interface. */
183     ::com::sun::star::uno::Any SAL_CALL queryInterface(
184             const ::com::sun::star::uno::Type& rType )
185         throw ( ::com::sun::star::uno::RuntimeException );
186 
187     /** Aquires the object (calls acquire() on base class). */
188     virtual void SAL_CALL acquire() throw ();
189 
190     /** Releases the object (calls release() on base class). */
191     virtual void SAL_CALL release() throw ();
192     // XServiceInfo -----------------------------------------------------------
193 
194     /** @return  The name of this class. */
195     virtual ::rtl::OUString SAL_CALL getImplementationName()
196         throw ( ::com::sun::star::uno::RuntimeException );
197 
198     /**@return m_pCellVector*/
199     std::vector< AccessibleGridControlTableCell* >& getCellVector();
200     /**@return m_xAccessCellVector*/
201     std::vector< com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible > >& getAccessibleCellVector();
202 
203 protected:
204     // internal virtual methods -----------------------------------------------
205 
206     /** @attention  This method requires locked mutex's and a living object.
207         @return  The bounding box (VCL rect.) relative to the parent window. */
208     virtual Rectangle implGetBoundingBox();
209     ///** @attention  This method requires locked mutex's and a living object.
210     //    @return  The bounding box (VCL rect.) in screen coordinates. */
211     virtual Rectangle implGetBoundingBoxOnScreen();
212 
213 
214     //// internal helper methods ------------------------------------------------
215     ///** @attention  This method requires a locked mutex.
216     //    @return  The XAccessibleTable interface of the specified header bar. */
217     ::com::sun::star::uno::Reference<
218         ::com::sun::star::accessibility::XAccessibleTable >
219     implGetHeaderBar( sal_Int32 nChildIndex )
220         throw ( ::com::sun::star::uno::RuntimeException );
221 };
222 
223 // ============================================================================
224 
225 } // namespace accessibility
226 
227 // ============================================================================
228 
229 #endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLE_HXX
230 
231