xref: /trunk/main/sc/source/ui/inc/AccessibleTableBase.hxx (revision 45c5a00162811bd03b87fcb4fe9996782f2b59ec)
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 _SC_ACCESSIBLETABLEBASE_HXX
26 #define _SC_ACCESSIBLETABLEBASE_HXX
27 
28 #include "AccessibleContextBase.hxx"
29 #include "global.hxx"
30 #include "address.hxx"
31 #include <com/sun/star/accessibility/XAccessibleTable.hpp>
32 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
33 #include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
34 #include <cppuhelper/implbase2.hxx>
35 
36 class ScTabViewShell;
37 
38 /** @descr
39         This base class provides an implementation of the
40         <code>AccessibleTable</code> service.
41 */
42 
43 typedef cppu::ImplHelper2< ::com::sun::star::accessibility::XAccessibleTable,
44                     ::com::sun::star::accessibility::XAccessibleSelection>
45                     ScAccessibleTableBaseImpl;
46 
47 class ScAccessibleTableBase :
48             public ScAccessibleContextBase,
49             public   ::com::sun::star::accessibility::XAccessibleTableSelection,
50             public ScAccessibleTableBaseImpl
51 {
52 public:
53     //=====  internal  ========================================================
54     ScAccessibleTableBase(
55         const ::com::sun::star::uno::Reference<
56         ::com::sun::star::accessibility::XAccessible>& rxParent,
57         ScDocument* pDoc,
58         const ScRange& rRange);
59 protected:
60     virtual ~ScAccessibleTableBase();
61 public:
62 
63     using ScAccessibleContextBase::disposing;
64     virtual void SAL_CALL disposing();
65 
66     ///=====  XInterface  =====================================================
67 
68     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
69         ::com::sun::star::uno::Type const & rType );
70 
71     virtual void SAL_CALL acquire() throw ();
72 
73     virtual void SAL_CALL release() throw ();
74 
75     ///=====  XAccessibleTable  ================================================
76 
77     /// Returns the number of rows in the table.
78     virtual sal_Int32 SAL_CALL
79                 getAccessibleRowCount(  );
80 
81     /// Returns the number of columns in the table.
82     virtual sal_Int32 SAL_CALL
83                 getAccessibleColumnCount(  );
84 
85     /// Returns the description of the specified row in the table.
86     virtual ::rtl::OUString SAL_CALL
87                 getAccessibleRowDescription( sal_Int32 nRow );
88 
89     /// Returns the description text of the specified column in the table.
90     virtual ::rtl::OUString SAL_CALL
91                 getAccessibleColumnDescription( sal_Int32 nColumn );
92 
93     /** Returns the number of rows occupied by the Accessible at a specified row and column in the table.
94     Returns 1 if it is only a cell and the number of rows the cell is merged if the cell is a merged cell.
95     */
96     virtual sal_Int32 SAL_CALL
97                 getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn );
98 
99     /** Returns the number of columns occupied by the Accessible at a specified row and column in the table.
100     Returns 1 if it is only a cell and the number of columns the cell is merged if the cell is a merged cell.
101     */
102     virtual sal_Int32 SAL_CALL
103                 getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn );
104 
105     /// Returns the row headers as an AccessibleTable.
106     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
107                 getAccessibleRowHeaders(  );
108 
109     /// Returns the column headers as an AccessibleTable.
110     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
111                 getAccessibleColumnHeaders(  );
112 
113     /// Returns the selected rows in a table.
114     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
115                 getSelectedAccessibleRows(  );
116 
117     /// Returns the selected columns in a table.
118     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
119                 getSelectedAccessibleColumns(  );
120 
121     /// Returns a boolean value indicating whether the specified row is selected.
122     virtual sal_Bool SAL_CALL
123                 isAccessibleRowSelected( sal_Int32 nRow );
124 
125     /// Returns a boolean value indicating whether the specified column is selected.
126     virtual sal_Bool SAL_CALL
127                 isAccessibleColumnSelected( sal_Int32 nColumn );
128 
129     /// Returns the Accessible at a specified row and column in the table.
130     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
131                 getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn );
132 
133     /// Returns the caption for the table.
134     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
135                 getAccessibleCaption(  );
136 
137     /// Returns the summary description of the table.
138     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
139                 getAccessibleSummary(  );
140 
141     /// Returns a boolean value indicating whether the accessible at a specified row and column is selected.
142     virtual sal_Bool SAL_CALL
143                 isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn );
144 
145     ///=====  XAccessibleExtendedTable  ========================================
146 
147     /// Returns the index of the cell on the given position.
148     virtual sal_Int32 SAL_CALL
149                 getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn );
150 
151     /// Returns the row number of an index in the table.
152     virtual sal_Int32 SAL_CALL
153                 getAccessibleRow( sal_Int32 nChildIndex );
154 
155     /// Returns the column number of an index in the table.
156     virtual sal_Int32 SAL_CALL
157                 getAccessibleColumn( sal_Int32 nChildIndex );
158 
159     //=====  XAccessibleContext  ==============================================
160 
161     /// Return the number of currently visible children.
162     // is overloaded to calculate this on demand
163     virtual sal_Int32 SAL_CALL
164         getAccessibleChildCount(void);
165 
166     /// Return the specified child or NULL if index is invalid.
167     // is overloaded to calculate this on demand
168     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
169         getAccessibleChild(sal_Int32 nIndex);
170     virtual sal_Bool SAL_CALL selectRow( sal_Int32 row ) ;
171     virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column ) ;
172     virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row ) ;
173     virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column ) ;
174 
175 protected:
176     /// Return this object's description.
177     virtual ::rtl::OUString SAL_CALL
178         createAccessibleDescription(void);
179 
180     /// Return the object's current name.
181     virtual ::rtl::OUString SAL_CALL
182         createAccessibleName(void);
183 
184 public:
185     /// Return NULL to indicate that an empty relation set.
186     virtual ::com::sun::star::uno::Reference<
187             ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
188         getAccessibleRelationSet(void);
189 
190     /// Return the set of current states.
191     // perhaps sometimes to be implemented
192     virtual ::com::sun::star::uno::Reference<
193             ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
194         getAccessibleStateSet(void);
195 
196     ///=====  XAccessibleSelection  ===========================================
197 
198     virtual void SAL_CALL
199         selectAccessibleChild( sal_Int32 nChildIndex );
200 
201     virtual sal_Bool SAL_CALL
202         isAccessibleChildSelected( sal_Int32 nChildIndex );
203 
204     virtual void SAL_CALL
205         clearAccessibleSelection(  );
206 
207     virtual void SAL_CALL
208         selectAllAccessibleChildren(  );
209 
210     virtual sal_Int32 SAL_CALL
211         getSelectedAccessibleChildCount(  );
212 
213     virtual ::com::sun::star::uno::Reference<
214         ::com::sun::star::accessibility::XAccessible > SAL_CALL
215         getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex );
216 
217     virtual void SAL_CALL
218         deselectAccessibleChild( sal_Int32 nSelectedChildIndex );
219 
220     ///=====  XServiceInfo  ===================================================
221 
222     /** Returns an identifier for the implementation of this object.
223     */
224     virtual ::rtl::OUString SAL_CALL
225         getImplementationName(void);
226 
227     ///=====  XTypeProvider  ===================================================
228 
229     /// returns the possible types
230     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL
231         getTypes();
232 
233     /** Returns a implementation id.
234     */
235     virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
236         getImplementationId(void);
237 
238 protected:
239     /// contains the range of the table, because it could be a subrange of the complete table
240     ScRange maRange;
241 
242     ScDocument* mpDoc;
243 
244     void CommitTableModelChange(sal_Int32 nStartRow, sal_Int32 nStartCol, sal_Int32 nEndRow, sal_Int32 nEndCol, sal_uInt16 nId);
245 };
246 
247 
248 #endif
249