1*a462bbb7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*a462bbb7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*a462bbb7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*a462bbb7SAndrew Rist  * distributed with this work for additional information
6*a462bbb7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*a462bbb7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*a462bbb7SAndrew Rist  * "License"); you may not use this file except in compliance
9*a462bbb7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*a462bbb7SAndrew Rist  *
11*a462bbb7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*a462bbb7SAndrew Rist  *
13*a462bbb7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*a462bbb7SAndrew Rist  * software distributed under the License is distributed on an
15*a462bbb7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*a462bbb7SAndrew Rist  * KIND, either express or implied.  See the License for the
17*a462bbb7SAndrew Rist  * specific language governing permissions and limitations
18*a462bbb7SAndrew Rist  * under the License.
19*a462bbb7SAndrew Rist  *
20*a462bbb7SAndrew Rist  *************************************************************/
21*a462bbb7SAndrew Rist 
22*a462bbb7SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXTABLEBASE_HXX
26cdf0e10cSrcweir #define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXTABLEBASE_HXX
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include "accessibility/extended/AccessibleBrowseBoxBase.hxx"
29cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
30cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleTable.hpp>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir // ============================================================================
33cdf0e10cSrcweir 
34cdf0e10cSrcweir namespace accessibility {
35cdf0e10cSrcweir 
36cdf0e10cSrcweir typedef ::cppu::ImplHelper1<
37cdf0e10cSrcweir             ::com::sun::star::accessibility::XAccessibleTable >
38cdf0e10cSrcweir         AccessibleBrowseBoxTableImplHelper;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir /** The BrowseBox accessible table objects inherit from this base class. It
41cdf0e10cSrcweir     implements basic functionality for the XAccessibleTable interface.
42cdf0e10cSrcweir     BrowseBox table objects are: the data table, the column header bar and the
43cdf0e10cSrcweir     row header bar. */
44cdf0e10cSrcweir class AccessibleBrowseBoxTableBase :
45cdf0e10cSrcweir     public BrowseBoxAccessibleElement,
46cdf0e10cSrcweir     public AccessibleBrowseBoxTableImplHelper
47cdf0e10cSrcweir {
48cdf0e10cSrcweir public:
49cdf0e10cSrcweir     /** Constructor sets specified name and description. If the constant of a
50cdf0e10cSrcweir         text is BBTEXT_NONE, the derived class has to set the text via
51cdf0e10cSrcweir         implSetName() and implSetDescription() (in Ctor) or later via
52cdf0e10cSrcweir         setAccessibleName() and setAccessibleDescription() (these methods
53cdf0e10cSrcweir         notify the listeners about the change).
54cdf0e10cSrcweir         @param rxParent  XAccessible interface of the parent object.
55cdf0e10cSrcweir         @param rBrowseBox  The BrowseBox control.
56cdf0e10cSrcweir         @param eNameText  The constant for the name text.
57cdf0e10cSrcweir         @param eDescrText  The constant for the description text. */
58cdf0e10cSrcweir     AccessibleBrowseBoxTableBase(
59cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
60cdf0e10cSrcweir             ::com::sun::star::accessibility::XAccessible >& rxParent,
61cdf0e10cSrcweir         ::svt::IAccessibleTableProvider&                  rBrowseBox,
62cdf0e10cSrcweir         ::svt::AccessibleBrowseBoxObjType  eObjType );
63cdf0e10cSrcweir 
64cdf0e10cSrcweir protected:
65cdf0e10cSrcweir     virtual ~AccessibleBrowseBoxTableBase();
66cdf0e10cSrcweir 
67cdf0e10cSrcweir public:
68cdf0e10cSrcweir     // XAccessibleContext -----------------------------------------------------
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     /** @return  The count of visible children. */
71cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleChildCount()
72cdf0e10cSrcweir         throw ( ::com::sun::star::uno::RuntimeException );
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     /** @return  The role of this object (a table). */
75cdf0e10cSrcweir     virtual sal_Int16 SAL_CALL getAccessibleRole()
76cdf0e10cSrcweir         throw ( ::com::sun::star::uno::RuntimeException );
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     /*  Derived classes have to implement:
79cdf0e10cSrcweir         -   getAccessibleChild,
80cdf0e10cSrcweir         -   getAccessibleIndexInParent. */
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     // XAccessibleComponent ---------------------------------------------------
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     /*  Derived classes have to implement:
85cdf0e10cSrcweir         -   getAccessibleAt,
86cdf0e10cSrcweir         -   grabFocus,
87cdf0e10cSrcweir         -   getAccessibleKeyBinding. */
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     // XAccessibleTable -------------------------------------------------------
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     /** @return  The number of used rows in the table (0 = empty table). */
92cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleRowCount()
93cdf0e10cSrcweir         throw ( ::com::sun::star::uno::RuntimeException );
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     /** @return  The number of used columns in the table (0 = empty table). */
96cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleColumnCount()
97cdf0e10cSrcweir         throw ( ::com::sun::star::uno::RuntimeException );
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     /** @return  The row extent of the specified cell (always 1). */
100cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
101cdf0e10cSrcweir     getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
102cdf0e10cSrcweir         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
103cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException );
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     /** @return  The column extent of the specified cell (always 1). */
106cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
107cdf0e10cSrcweir     getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
108cdf0e10cSrcweir         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
109cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException );
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     /** @return  The caption cell of the table (not supported). */
112cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
113cdf0e10cSrcweir         ::com::sun::star::accessibility::XAccessible > SAL_CALL
114cdf0e10cSrcweir     getAccessibleCaption()
115cdf0e10cSrcweir         throw ( ::com::sun::star::uno::RuntimeException );
116cdf0e10cSrcweir 
117cdf0e10cSrcweir     /** @return  The summary object of the table (not supported). */
118cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
119cdf0e10cSrcweir         ::com::sun::star::accessibility::XAccessible > SAL_CALL
120cdf0e10cSrcweir     getAccessibleSummary()
121cdf0e10cSrcweir         throw ( ::com::sun::star::uno::RuntimeException );
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     /** @return  The child index of the specified cell. */
124cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn )
125cdf0e10cSrcweir         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
126cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException );
127cdf0e10cSrcweir 
128cdf0e10cSrcweir     /** @return  The row index of the specified child cell. */
129cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex )
130cdf0e10cSrcweir         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
131cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException );
132cdf0e10cSrcweir 
133cdf0e10cSrcweir     /** @return  The column index of the specified child cell. */
134cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex )
135cdf0e10cSrcweir         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
136cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException );
137cdf0e10cSrcweir 
138cdf0e10cSrcweir     /*  Derived classes have to implement:
139cdf0e10cSrcweir         -   getAccessibleRowDescription,
140cdf0e10cSrcweir         -   getAccessibleColumnDescription,
141cdf0e10cSrcweir         -   getAccessibleRowHeaders,
142cdf0e10cSrcweir         -   getAccessibleColumnHeaders,
143cdf0e10cSrcweir         -   getSelectedAccessibleRows,
144cdf0e10cSrcweir         -   getSelectedAccessibleColumns,
145cdf0e10cSrcweir         -   isAccessibleRowSelected,
146cdf0e10cSrcweir         -   isAccessibleColumnSelected,
147cdf0e10cSrcweir         -   getAccessibleCellAt,
148cdf0e10cSrcweir         -   isAccessibleSelected. */
149cdf0e10cSrcweir 
150cdf0e10cSrcweir     // XInterface -------------------------------------------------------------
151cdf0e10cSrcweir 
152cdf0e10cSrcweir     /** Queries for a new interface. */
153cdf0e10cSrcweir     ::com::sun::star::uno::Any SAL_CALL queryInterface(
154cdf0e10cSrcweir             const ::com::sun::star::uno::Type& rType )
155cdf0e10cSrcweir         throw ( ::com::sun::star::uno::RuntimeException );
156cdf0e10cSrcweir 
157cdf0e10cSrcweir     /** Aquires the object (calls acquire() on base class). */
158cdf0e10cSrcweir     virtual void SAL_CALL acquire() throw ();
159cdf0e10cSrcweir 
160cdf0e10cSrcweir     /** Releases the object (calls release() on base class). */
161cdf0e10cSrcweir     virtual void SAL_CALL release() throw ();
162cdf0e10cSrcweir 
163cdf0e10cSrcweir     // XTypeProvider ----------------------------------------------------------
164cdf0e10cSrcweir 
165cdf0e10cSrcweir     /** @return  A sequence of possible types (received from base classes). */
166cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
167cdf0e10cSrcweir         throw ( ::com::sun::star::uno::RuntimeException );
168cdf0e10cSrcweir 
169cdf0e10cSrcweir     /** @return  An unique implementation ID. */
170cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
171cdf0e10cSrcweir         throw ( ::com::sun::star::uno::RuntimeException );
172cdf0e10cSrcweir 
173cdf0e10cSrcweir     // XServiceInfo -----------------------------------------------------------
174cdf0e10cSrcweir 
175cdf0e10cSrcweir     /*  Derived classes have to implement:
176cdf0e10cSrcweir         -   getImplementationName */
177cdf0e10cSrcweir 
178cdf0e10cSrcweir protected:
179cdf0e10cSrcweir     // internal virtual methods -----------------------------------------------
180cdf0e10cSrcweir 
181cdf0e10cSrcweir     /** @attention  This method requires locked mutex's and a living object.
182cdf0e10cSrcweir         @return  The count of data rows without header bar. */
183cdf0e10cSrcweir     virtual sal_Int32 implGetRowCount() const;
184cdf0e10cSrcweir     /** @attention  This method requires locked mutex's and a living object.
185cdf0e10cSrcweir         @return  The count of data columns without "handle column". */
186cdf0e10cSrcweir     virtual sal_Int32 implGetColumnCount() const;
187cdf0e10cSrcweir 
188cdf0e10cSrcweir     // internal helper methods ------------------------------------------------
189cdf0e10cSrcweir 
190cdf0e10cSrcweir     /** @return  <TRUE/>, if first BrowseBox column is the "handle column". */
191cdf0e10cSrcweir     sal_Bool implHasHandleColumn() const;
192cdf0e10cSrcweir 
193cdf0e10cSrcweir     /** @attention  This method requires locked mutex's and a living object.
194cdf0e10cSrcweir         @param nColumn
195cdf0e10cSrcweir             the position of the column in the Accessible world
196cdf0e10cSrcweir         @return
197cdf0e10cSrcweir             the position of the column in VCL the Accessible world
198cdf0e10cSrcweir     */
199cdf0e10cSrcweir     sal_uInt16 implToVCLColumnPos( sal_Int32 nColumn ) const;
200cdf0e10cSrcweir 
201cdf0e10cSrcweir     /** @attention  This method requires locked mutex's and a living object.
202cdf0e10cSrcweir         @return  The number of cells of the table. */
203cdf0e10cSrcweir     sal_Int32 implGetChildCount() const;
204cdf0e10cSrcweir 
205cdf0e10cSrcweir     /** @attention  This method requires locked mutex's and a living object.
206cdf0e10cSrcweir         @return  The row index of the specified cell index. */
207cdf0e10cSrcweir     sal_Int32 implGetRow( sal_Int32 nChildIndex ) const;
208cdf0e10cSrcweir     /** @attention  This method requires locked mutex's and a living object.
209cdf0e10cSrcweir         @return  The column index of the specified cell index. */
210cdf0e10cSrcweir     sal_Int32 implGetColumn( sal_Int32 nChildIndex ) const;
211cdf0e10cSrcweir     /** @attention  This method requires locked mutex's and a living object.
212cdf0e10cSrcweir         @return  The child index of the specified cell address. */
213cdf0e10cSrcweir     sal_Int32 implGetChildIndex( sal_Int32 nRow, sal_Int32 nColumn ) const;
214cdf0e10cSrcweir 
215cdf0e10cSrcweir     /** @attention  This method requires locked mutex's and a living object.
216cdf0e10cSrcweir         @return  <TRUE/>, if the specified row is selected. */
217cdf0e10cSrcweir     sal_Bool implIsRowSelected( sal_Int32 nRow ) const;
218cdf0e10cSrcweir     /** @attention  This method requires locked mutex's and a living object.
219cdf0e10cSrcweir         @return  <TRUE/>, if the specified column is selected. */
220cdf0e10cSrcweir     sal_Bool implIsColumnSelected( sal_Int32 nColumn ) const;
221cdf0e10cSrcweir 
222cdf0e10cSrcweir     /** Selects/deselects a row (tries to expand selection).
223cdf0e10cSrcweir         @attention  This method requires locked mutex's and a living object.
224cdf0e10cSrcweir         @param bSelect  <TRUE/> = select, <FALSE/> = deselect */
225cdf0e10cSrcweir     void implSelectRow( sal_Int32 nRow, sal_Bool bSelect );
226cdf0e10cSrcweir     /** Selects/deselects a column (tries to expand selection).
227cdf0e10cSrcweir         @attention  This method requires locked mutex's and a living object.
228cdf0e10cSrcweir         @param bSelect  <TRUE/> = select, <FALSE/> = deselect */
229cdf0e10cSrcweir     void implSelectColumn( sal_Int32 nColumnPos, sal_Bool bSelect );
230cdf0e10cSrcweir 
231cdf0e10cSrcweir     /** @attention  This method requires locked mutex's and a living object.
232cdf0e10cSrcweir         @return  The count of selected rows. */
233cdf0e10cSrcweir     sal_Int32 implGetSelectedRowCount() const;
234cdf0e10cSrcweir     /** @attention  This method requires locked mutex's and a living object.
235cdf0e10cSrcweir         @return  The count of selected columns. */
236cdf0e10cSrcweir     sal_Int32 implGetSelectedColumnCount() const;
237cdf0e10cSrcweir 
238cdf0e10cSrcweir     /** Fills a sequence with sorted indexes of completely selected rows.
239cdf0e10cSrcweir         @attention  This method requires locked mutex's and a living object.
240cdf0e10cSrcweir         @param rSeq  Out-parameter that takes the sorted row index list. */
241cdf0e10cSrcweir     void implGetSelectedRows( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq );
242cdf0e10cSrcweir     /** Fills a sequence with sorted indexes of completely selected columns.
243cdf0e10cSrcweir         @attention  This method requires locked mutex's and a living object.
244cdf0e10cSrcweir         @param rSeq  Out-parameter that takes the sorted column index list. */
245cdf0e10cSrcweir     void implGetSelectedColumns( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq );
246cdf0e10cSrcweir 
247cdf0e10cSrcweir     /** @attention  This method requires locked mutex's and a living object.
248cdf0e10cSrcweir         @throws <type>IndexOutOfBoundsException</type>
249cdf0e10cSrcweir         If the specified row index is invalid. */
250cdf0e10cSrcweir     void ensureIsValidRow( sal_Int32 nRow )
251cdf0e10cSrcweir         throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
252cdf0e10cSrcweir     /** @attention  This method requires locked mutex's and a living object.
253cdf0e10cSrcweir         @throws <type>IndexOutOfBoundsException</type>
254cdf0e10cSrcweir         If the specified column index is invalid. */
255cdf0e10cSrcweir     void ensureIsValidColumn( sal_Int32 nColumn )
256cdf0e10cSrcweir         throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
257cdf0e10cSrcweir     /** @attention  This method requires locked mutex's and a living object.
258cdf0e10cSrcweir         @throws <type>IndexOutOfBoundsException</type>
259cdf0e10cSrcweir         If the specified cell address is invalid. */
260cdf0e10cSrcweir     void ensureIsValidAddress( sal_Int32 nRow, sal_Int32 nColumn )
261cdf0e10cSrcweir         throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
262cdf0e10cSrcweir     /** @attention  This method requires locked mutex's and a living object.
263cdf0e10cSrcweir         @throws <type>IndexOutOfBoundsException</type>
264cdf0e10cSrcweir         If the specified child index is invalid. */
265cdf0e10cSrcweir     void ensureIsValidIndex( sal_Int32 nChildIndex )
266cdf0e10cSrcweir         throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
267cdf0e10cSrcweir };
268cdf0e10cSrcweir 
269cdf0e10cSrcweir // ============================================================================
270cdf0e10cSrcweir 
271cdf0e10cSrcweir } // namespace accessibility
272cdf0e10cSrcweir 
273cdf0e10cSrcweir // ============================================================================
274cdf0e10cSrcweir 
275cdf0e10cSrcweir #endif
276cdf0e10cSrcweir 
277