xref: /trunk/main/sc/source/ui/inc/AccessibleTableBase.hxx (revision 0deba7fbda3d9908785c25a443701a293b6f4e71)
138d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
338d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
438d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
538d50f7bSAndrew Rist  * distributed with this work for additional information
638d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
738d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
838d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
938d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
1138d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
1338d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
1438d50f7bSAndrew Rist  * software distributed under the License is distributed on an
1538d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1638d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
1738d50f7bSAndrew Rist  * specific language governing permissions and limitations
1838d50f7bSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
2038d50f7bSAndrew Rist  *************************************************************/
2138d50f7bSAndrew Rist 
2238d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #ifndef _SC_ACCESSIBLETABLEBASE_HXX
26cdf0e10cSrcweir #define _SC_ACCESSIBLETABLEBASE_HXX
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include "AccessibleContextBase.hxx"
29cdf0e10cSrcweir #include "global.hxx"
30cdf0e10cSrcweir #include "address.hxx"
31cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleTable.hpp>
32cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
33*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009-----
34*0deba7fbSSteve Yin #include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
35*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009
36cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir class ScTabViewShell;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir /** @descr
41cdf0e10cSrcweir         This base class provides an implementation of the
42cdf0e10cSrcweir         <code>AccessibleTable</code> service.
43cdf0e10cSrcweir */
44cdf0e10cSrcweir 
45cdf0e10cSrcweir typedef cppu::ImplHelper2< ::com::sun::star::accessibility::XAccessibleTable,
46cdf0e10cSrcweir                     ::com::sun::star::accessibility::XAccessibleSelection>
47cdf0e10cSrcweir                     ScAccessibleTableBaseImpl;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir class ScAccessibleTableBase :
50cdf0e10cSrcweir             public ScAccessibleContextBase,
51*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009-----
52*0deba7fbSSteve Yin             public   ::com::sun::star::accessibility::XAccessibleTableSelection,
53*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009
54cdf0e10cSrcweir             public ScAccessibleTableBaseImpl
55cdf0e10cSrcweir {
56cdf0e10cSrcweir public:
57cdf0e10cSrcweir     //=====  internal  ========================================================
58cdf0e10cSrcweir     ScAccessibleTableBase(
59cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
60cdf0e10cSrcweir         ::com::sun::star::accessibility::XAccessible>& rxParent,
61cdf0e10cSrcweir         ScDocument* pDoc,
62cdf0e10cSrcweir         const ScRange& rRange);
63cdf0e10cSrcweir protected:
64cdf0e10cSrcweir     virtual ~ScAccessibleTableBase();
65cdf0e10cSrcweir public:
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     using ScAccessibleContextBase::disposing;
68cdf0e10cSrcweir     virtual void SAL_CALL disposing();
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     ///=====  XInterface  =====================================================
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
73cdf0e10cSrcweir         ::com::sun::star::uno::Type const & rType )
74cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     virtual void SAL_CALL acquire() throw ();
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     virtual void SAL_CALL release() throw ();
79cdf0e10cSrcweir 
80cdf0e10cSrcweir     ///=====  XAccessibleTable  ================================================
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     /// Returns the number of rows in the table.
83cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
84cdf0e10cSrcweir                 getAccessibleRowCount(  )
85cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException);
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     /// Returns the number of columns in the table.
88cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
89cdf0e10cSrcweir                 getAccessibleColumnCount(  )
90cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException);
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     /// Returns the description of the specified row in the table.
93cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL
94cdf0e10cSrcweir                 getAccessibleRowDescription( sal_Int32 nRow )
95cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException,
96cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     /// Returns the description text of the specified column in the table.
99cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL
100cdf0e10cSrcweir                 getAccessibleColumnDescription( sal_Int32 nColumn )
101cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException,
102cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     /** Returns the number of rows occupied by the Accessible at a specified row and column in the table.
105cdf0e10cSrcweir     Returns 1 if it is only a cell and the number of rows the cell is merged if the cell is a merged cell.
106cdf0e10cSrcweir     */
107cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
108cdf0e10cSrcweir                 getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
109cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException,
110cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     /** Returns the number of columns occupied by the Accessible at a specified row and column in the table.
113cdf0e10cSrcweir     Returns 1 if it is only a cell and the number of columns the cell is merged if the cell is a merged cell.
114cdf0e10cSrcweir     */
115cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
116cdf0e10cSrcweir                 getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
117cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException,
118cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     /// Returns the row headers as an AccessibleTable.
121cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
122cdf0e10cSrcweir                 getAccessibleRowHeaders(  )
123cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException);
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     /// Returns the column headers as an AccessibleTable.
126cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
127cdf0e10cSrcweir                 getAccessibleColumnHeaders(  )
128cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException);
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     /// Returns the selected rows in a table.
131cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
132cdf0e10cSrcweir                 getSelectedAccessibleRows(  )
133cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException);
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     /// Returns the selected columns in a table.
136cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
137cdf0e10cSrcweir                 getSelectedAccessibleColumns(  )
138cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException);
139cdf0e10cSrcweir 
140cdf0e10cSrcweir     /// Returns a boolean value indicating whether the specified row is selected.
141cdf0e10cSrcweir     virtual sal_Bool SAL_CALL
142cdf0e10cSrcweir                 isAccessibleRowSelected( sal_Int32 nRow )
143cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException,
144cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
145cdf0e10cSrcweir 
146cdf0e10cSrcweir     /// Returns a boolean value indicating whether the specified column is selected.
147cdf0e10cSrcweir     virtual sal_Bool SAL_CALL
148cdf0e10cSrcweir                 isAccessibleColumnSelected( sal_Int32 nColumn )
149cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException,
150cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
151cdf0e10cSrcweir 
152cdf0e10cSrcweir     /// Returns the Accessible at a specified row and column in the table.
153cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
154cdf0e10cSrcweir                 getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
155cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException,
156cdf0e10cSrcweir                             ::com::sun::star::lang::IndexOutOfBoundsException);
157cdf0e10cSrcweir 
158cdf0e10cSrcweir     /// Returns the caption for the table.
159cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
160cdf0e10cSrcweir                 getAccessibleCaption(  )
161cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException);
162cdf0e10cSrcweir 
163cdf0e10cSrcweir     /// Returns the summary description of the table.
164cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
165cdf0e10cSrcweir                 getAccessibleSummary(  )
166cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException);
167cdf0e10cSrcweir 
168cdf0e10cSrcweir     /// Returns a boolean value indicating whether the accessible at a specified row and column is selected.
169cdf0e10cSrcweir     virtual sal_Bool SAL_CALL
170cdf0e10cSrcweir                 isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
171cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException,
172cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
173cdf0e10cSrcweir 
174cdf0e10cSrcweir     ///=====  XAccessibleExtendedTable  ========================================
175cdf0e10cSrcweir 
176cdf0e10cSrcweir     /// Returns the index of the cell on the given position.
177cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
178cdf0e10cSrcweir                 getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn )
179cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException,
180cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     /// Returns the row number of an index in the table.
183cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
184cdf0e10cSrcweir                 getAccessibleRow( sal_Int32 nChildIndex )
185cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException,
186cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
187cdf0e10cSrcweir 
188cdf0e10cSrcweir     /// Returns the column number of an index in the table.
189cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
190cdf0e10cSrcweir                 getAccessibleColumn( sal_Int32 nChildIndex )
191cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException,
192cdf0e10cSrcweir                     ::com::sun::star::lang::IndexOutOfBoundsException);
193cdf0e10cSrcweir 
194cdf0e10cSrcweir     //=====  XAccessibleContext  ==============================================
195cdf0e10cSrcweir 
196cdf0e10cSrcweir     /// Return the number of currently visible children.
197cdf0e10cSrcweir     // is overloaded to calculate this on demand
198cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
199cdf0e10cSrcweir         getAccessibleChildCount(void)
200cdf0e10cSrcweir                     throw (::com::sun::star::uno::RuntimeException);
201cdf0e10cSrcweir 
202cdf0e10cSrcweir     /// Return the specified child or NULL if index is invalid.
203cdf0e10cSrcweir     // is overloaded to calculate this on demand
204cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
205cdf0e10cSrcweir         getAccessibleChild(sal_Int32 nIndex)
206cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException,
207cdf0e10cSrcweir                 ::com::sun::star::lang::IndexOutOfBoundsException);
208*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009-----
209*0deba7fbSSteve Yin     virtual sal_Bool SAL_CALL selectRow( sal_Int32 row )
210*0deba7fbSSteve Yin         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
211*0deba7fbSSteve Yin     virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column )
212*0deba7fbSSteve Yin         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
213*0deba7fbSSteve Yin     virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row )
214*0deba7fbSSteve Yin         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
215*0deba7fbSSteve Yin     virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column )
216*0deba7fbSSteve Yin         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
217*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009
218cdf0e10cSrcweir 
219cdf0e10cSrcweir protected:
220cdf0e10cSrcweir     /// Return this object's description.
221cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL
222cdf0e10cSrcweir         createAccessibleDescription(void)
223cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
224cdf0e10cSrcweir 
225cdf0e10cSrcweir     /// Return the object's current name.
226cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL
227cdf0e10cSrcweir         createAccessibleName(void)
228cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
229cdf0e10cSrcweir 
230cdf0e10cSrcweir public:
231cdf0e10cSrcweir     /// Return NULL to indicate that an empty relation set.
232cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
233cdf0e10cSrcweir             ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
234cdf0e10cSrcweir         getAccessibleRelationSet(void)
235cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
236cdf0e10cSrcweir 
237cdf0e10cSrcweir     /// Return the set of current states.
238cdf0e10cSrcweir     // perhaps sometimes to be implemented
239cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
240cdf0e10cSrcweir             ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
241cdf0e10cSrcweir         getAccessibleStateSet(void)
242cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
243cdf0e10cSrcweir 
244cdf0e10cSrcweir     ///=====  XAccessibleSelection  ===========================================
245cdf0e10cSrcweir 
246cdf0e10cSrcweir     virtual void SAL_CALL
247cdf0e10cSrcweir         selectAccessibleChild( sal_Int32 nChildIndex )
248cdf0e10cSrcweir         throw (::com::sun::star::lang::IndexOutOfBoundsException,
249cdf0e10cSrcweir         ::com::sun::star::uno::RuntimeException);
250cdf0e10cSrcweir 
251cdf0e10cSrcweir     virtual sal_Bool SAL_CALL
252cdf0e10cSrcweir         isAccessibleChildSelected( sal_Int32 nChildIndex )
253cdf0e10cSrcweir         throw (::com::sun::star::lang::IndexOutOfBoundsException,
254cdf0e10cSrcweir         ::com::sun::star::uno::RuntimeException);
255cdf0e10cSrcweir 
256cdf0e10cSrcweir     virtual void SAL_CALL
257cdf0e10cSrcweir         clearAccessibleSelection(  )
258cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
259cdf0e10cSrcweir 
260cdf0e10cSrcweir     virtual void SAL_CALL
261cdf0e10cSrcweir         selectAllAccessibleChildren(  )
262cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
263cdf0e10cSrcweir 
264cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
265cdf0e10cSrcweir         getSelectedAccessibleChildCount(  )
266cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
267cdf0e10cSrcweir 
268cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
269cdf0e10cSrcweir         ::com::sun::star::accessibility::XAccessible > SAL_CALL
270cdf0e10cSrcweir         getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
271cdf0e10cSrcweir         throw (::com::sun::star::lang::IndexOutOfBoundsException,
272cdf0e10cSrcweir         ::com::sun::star::uno::RuntimeException);
273cdf0e10cSrcweir 
274cdf0e10cSrcweir     virtual void SAL_CALL
275cdf0e10cSrcweir         deselectAccessibleChild( sal_Int32 nSelectedChildIndex )
276cdf0e10cSrcweir         throw (::com::sun::star::lang::IndexOutOfBoundsException,
277cdf0e10cSrcweir         ::com::sun::star::uno::RuntimeException);
278cdf0e10cSrcweir 
279cdf0e10cSrcweir     ///=====  XServiceInfo  ===================================================
280cdf0e10cSrcweir 
281cdf0e10cSrcweir     /** Returns an identifier for the implementation of this object.
282cdf0e10cSrcweir     */
283cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL
284cdf0e10cSrcweir         getImplementationName(void)
285cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
286cdf0e10cSrcweir 
287cdf0e10cSrcweir     ///=====  XTypeProvider  ===================================================
288cdf0e10cSrcweir 
289cdf0e10cSrcweir     /// returns the possible types
290cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL
291cdf0e10cSrcweir         getTypes()
292cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
293cdf0e10cSrcweir 
294cdf0e10cSrcweir     /** Returns a implementation id.
295cdf0e10cSrcweir     */
296cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
297cdf0e10cSrcweir         getImplementationId(void)
298cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
299cdf0e10cSrcweir 
300cdf0e10cSrcweir protected:
301cdf0e10cSrcweir     /// contains the range of the table, because it could be a subrange of the complete table
302cdf0e10cSrcweir     ScRange maRange;
303cdf0e10cSrcweir 
304cdf0e10cSrcweir     ScDocument* mpDoc;
305cdf0e10cSrcweir 
306cdf0e10cSrcweir     void CommitTableModelChange(sal_Int32 nStartRow, sal_Int32 nStartCol, sal_Int32 nEndRow, sal_Int32 nEndCol, sal_uInt16 nId);
307cdf0e10cSrcweir };
308cdf0e10cSrcweir 
309cdf0e10cSrcweir 
310cdf0e10cSrcweir #endif
311