Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _ACCTABLE_HXX
29 : : #define _ACCTABLE_HXX
30 : : #include <com/sun/star/accessibility/XAccessibleTable.hpp>
31 : : #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
32 : :
33 : : #include <acccontext.hxx>
34 : :
35 : : class SwTabFrm;
36 : : class SwAccessibleTableData_Impl;
37 : : class SwTableBox;
38 : : class SwSelBoxes;
39 : :
40 : : namespace sw { namespace access {
41 : : class SwAccessibleChild;
42 : : } }
43 : :
44 : : class SwAccessibleTable :
45 : : public SwAccessibleContext,
46 : : public ::com::sun::star::accessibility::XAccessibleTable,
47 : : public ::com::sun::star::accessibility::XAccessibleSelection,
48 : : public SwClient
49 : : {
50 : : SwAccessibleTableData_Impl *mpTableData; // the table's data, prot by Sol-Mutex
51 : : ::rtl::OUString sDesc;
52 : : const SwSelBoxes *GetSelBoxes() const;
53 : :
54 : : void FireTableChangeEvent( const SwAccessibleTableData_Impl& rTableData );
55 : :
56 : : /** get the SwTableBox* for the given child */
57 : : const SwTableBox* GetTableBox( sal_Int32 ) const;
58 : :
59 : : sal_Bool IsChildSelected( sal_Int32 nChildIndex ) const;
60 : :
61 : : sal_Int32 GetIndexOfSelectedChild( sal_Int32 nSelectedChildIndex ) const;
62 : :
63 : : protected:
64 : :
65 : : // Set states for getAccessibleStateSet.
66 : : // This drived class additinaly sets MULTISELECTABLE(+)
67 : : virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet );
68 : :
69 : : virtual ~SwAccessibleTable();
70 : :
71 : : // #i77106#
72 : 0 : inline void SetDesc( ::rtl::OUString sNewDesc )
73 : : {
74 : 0 : sDesc = sNewDesc;
75 : 0 : }
76 : :
77 : : virtual SwAccessibleTableData_Impl* CreateNewTableData(); // #i77106#
78 : :
79 : : // force update of table data
80 : : void UpdateTableData();
81 : :
82 : : // remove the current table data
83 : : void ClearTableData();
84 : :
85 : : // get table data, update if necessary
86 : : inline SwAccessibleTableData_Impl& GetTableData();
87 : :
88 : : // Is table data evailable?
89 : 4 : sal_Bool HasTableData() const { return (mpTableData != 0); }
90 : :
91 : : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
92 : :
93 : : public:
94 : :
95 : : SwAccessibleTable( SwAccessibleMap* pInitMap, const SwTabFrm* pTableFrm );
96 : :
97 : : //===== XInterface ======================================================
98 : :
99 : : // (XInterface methods need to be implemented to disambigouate
100 : : // between those inherited through SwAcessibleContext and
101 : : // XAccessibleTable).
102 : :
103 : : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
104 : : const ::com::sun::star::uno::Type& aType )
105 : : throw (::com::sun::star::uno::RuntimeException);
106 : :
107 : 580 : virtual void SAL_CALL acquire( ) throw ()
108 : 580 : { SwAccessibleContext::acquire(); };
109 : :
110 : 580 : virtual void SAL_CALL release( ) throw ()
111 : 580 : { SwAccessibleContext::release(); };
112 : :
113 : : //====== XTypeProvider ====================================================
114 : : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
115 : : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
116 : :
117 : : //===== XAccessibleContext ==============================================
118 : :
119 : : /// Return this object's description.
120 : : virtual ::rtl::OUString SAL_CALL
121 : : getAccessibleDescription (void)
122 : : throw (com::sun::star::uno::RuntimeException);
123 : :
124 : : //===== XAccessibleTable ================================================
125 : :
126 : : virtual sal_Int32 SAL_CALL getAccessibleRowCount()
127 : : throw (::com::sun::star::uno::RuntimeException);
128 : : virtual sal_Int32 SAL_CALL getAccessibleColumnCount( )
129 : : throw (::com::sun::star::uno::RuntimeException);
130 : : virtual ::rtl::OUString SAL_CALL getAccessibleRowDescription(
131 : : sal_Int32 nRow )
132 : : throw (::com::sun::star::lang::IndexOutOfBoundsException,
133 : : ::com::sun::star::uno::RuntimeException);
134 : : virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription(
135 : : sal_Int32 nColumn )
136 : : throw (::com::sun::star::lang::IndexOutOfBoundsException,
137 : : ::com::sun::star::uno::RuntimeException);
138 : : virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt(
139 : : sal_Int32 nRow, sal_Int32 nColumn )
140 : : throw (::com::sun::star::lang::IndexOutOfBoundsException,
141 : : ::com::sun::star::uno::RuntimeException);
142 : : virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt(
143 : : sal_Int32 nRow, sal_Int32 nColumn )
144 : : throw (::com::sun::star::lang::IndexOutOfBoundsException,
145 : : ::com::sun::star::uno::RuntimeException);
146 : : virtual ::com::sun::star::uno::Reference<
147 : : ::com::sun::star::accessibility::XAccessibleTable >
148 : : SAL_CALL getAccessibleRowHeaders( )
149 : : throw (::com::sun::star::uno::RuntimeException);
150 : : virtual ::com::sun::star::uno::Reference<
151 : : ::com::sun::star::accessibility::XAccessibleTable >
152 : : SAL_CALL getAccessibleColumnHeaders( )
153 : : throw (::com::sun::star::uno::RuntimeException);
154 : : virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
155 : : getSelectedAccessibleRows( )
156 : : throw (::com::sun::star::uno::RuntimeException);
157 : : virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
158 : : getSelectedAccessibleColumns( )
159 : : throw (::com::sun::star::uno::RuntimeException);
160 : : virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow )
161 : : throw (::com::sun::star::lang::IndexOutOfBoundsException,
162 : : ::com::sun::star::uno::RuntimeException);
163 : : virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn )
164 : : throw (::com::sun::star::lang::IndexOutOfBoundsException,
165 : : ::com::sun::star::uno::RuntimeException);
166 : : virtual ::com::sun::star::uno::Reference<
167 : : ::com::sun::star::accessibility::XAccessible > SAL_CALL
168 : : getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
169 : : throw (::com::sun::star::lang::IndexOutOfBoundsException,
170 : : ::com::sun::star::uno::RuntimeException);
171 : : virtual ::com::sun::star::uno::Reference<
172 : : ::com::sun::star::accessibility::XAccessible > SAL_CALL
173 : : getAccessibleCaption( )
174 : : throw (::com::sun::star::uno::RuntimeException);
175 : : virtual ::com::sun::star::uno::Reference<
176 : : ::com::sun::star::accessibility::XAccessible > SAL_CALL
177 : : getAccessibleSummary( )
178 : : throw (::com::sun::star::uno::RuntimeException);
179 : : virtual sal_Bool SAL_CALL isAccessibleSelected(
180 : : sal_Int32 nRow, sal_Int32 nColumn )
181 : : throw (::com::sun::star::lang::IndexOutOfBoundsException,
182 : : ::com::sun::star::uno::RuntimeException);
183 : : virtual sal_Int32 SAL_CALL getAccessibleIndex(
184 : : sal_Int32 nRow, sal_Int32 nColumn )
185 : : throw (::com::sun::star::lang::IndexOutOfBoundsException,
186 : : ::com::sun::star::uno::RuntimeException);
187 : : virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex )
188 : : throw (::com::sun::star::lang::IndexOutOfBoundsException,
189 : : ::com::sun::star::uno::RuntimeException);
190 : : virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex )
191 : : throw (::com::sun::star::lang::IndexOutOfBoundsException,
192 : : ::com::sun::star::uno::RuntimeException);
193 : :
194 : : //===== XServiceInfo ====================================================
195 : :
196 : : /** Returns an identifier for the implementation of this object.
197 : : */
198 : : virtual ::rtl::OUString SAL_CALL
199 : : getImplementationName (void)
200 : : throw (::com::sun::star::uno::RuntimeException);
201 : :
202 : : /** Return whether the specified service is supported by this class.
203 : : */
204 : : virtual sal_Bool SAL_CALL
205 : : supportsService (const ::rtl::OUString& sServiceName)
206 : : throw (::com::sun::star::uno::RuntimeException);
207 : :
208 : : /** Returns a list of all supported services. In this case that is just
209 : : the AccessibleContext service.
210 : : */
211 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
212 : : getSupportedServiceNames (void)
213 : : throw (::com::sun::star::uno::RuntimeException);
214 : :
215 : : //===== C++ interface ======================================================
216 : :
217 : : // The object has been moved by the layout
218 : : virtual void InvalidatePosOrSize( const SwRect& rOldBox );
219 : :
220 : : // The object is not visible an longer and should be destroyed
221 : : virtual void Dispose( sal_Bool bRecursive = sal_False );
222 : :
223 : : virtual void DisposeChild( const sw::access::SwAccessibleChild& rFrmOrObj,
224 : : sal_Bool bRecursive );
225 : : virtual void InvalidateChildPosOrSize( const sw::access::SwAccessibleChild& rFrmOrObj,
226 : : const SwRect& rFrm );
227 : :
228 : : //===== XAccessibleSelection ============================================
229 : :
230 : : virtual void SAL_CALL selectAccessibleChild(
231 : : sal_Int32 nChildIndex )
232 : : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
233 : : ::com::sun::star::uno::RuntimeException );
234 : :
235 : : virtual sal_Bool SAL_CALL isAccessibleChildSelected(
236 : : sal_Int32 nChildIndex )
237 : : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
238 : : ::com::sun::star::uno::RuntimeException );
239 : :
240 : : virtual void SAL_CALL clearAccessibleSelection( )
241 : : throw ( ::com::sun::star::uno::RuntimeException );
242 : :
243 : : virtual void SAL_CALL selectAllAccessibleChildren( )
244 : : throw ( ::com::sun::star::uno::RuntimeException );
245 : :
246 : : virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( )
247 : : throw ( ::com::sun::star::uno::RuntimeException );
248 : :
249 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
250 : : sal_Int32 nSelectedChildIndex )
251 : : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
252 : : ::com::sun::star::uno::RuntimeException);
253 : :
254 : : // index has to be treated as global child index.
255 : : virtual void SAL_CALL deselectAccessibleChild(
256 : : sal_Int32 nChildIndex )
257 : : throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
258 : : ::com::sun::star::uno::RuntimeException );
259 : :
260 : : };
261 : :
262 : 0 : inline SwAccessibleTableData_Impl& SwAccessibleTable::GetTableData()
263 : : {
264 [ # # ]: 0 : if( !mpTableData )
265 : 0 : UpdateTableData();
266 : 0 : return *mpTableData;
267 : : }
268 : :
269 : : // #i77106# - subclass to represent table column headers
270 : : class SwAccessibleTableColHeaders : public SwAccessibleTable
271 : : {
272 : : protected:
273 : :
274 : 0 : virtual ~SwAccessibleTableColHeaders()
275 [ # # ]: 0 : {}
276 : :
277 : : virtual SwAccessibleTableData_Impl* CreateNewTableData();
278 : : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
279 : :
280 : : public:
281 : :
282 : : SwAccessibleTableColHeaders( SwAccessibleMap *pMap, const SwTabFrm *pTabFrm );
283 : :
284 : : //===== XInterface ======================================================
285 : :
286 : : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
287 : : const ::com::sun::star::uno::Type& aType )
288 : : throw (::com::sun::star::uno::RuntimeException);
289 : :
290 : 0 : virtual void SAL_CALL acquire( ) throw ()
291 : 0 : { SwAccessibleContext::acquire(); };
292 : :
293 : 0 : virtual void SAL_CALL release( ) throw ()
294 : 0 : { SwAccessibleContext::release(); };
295 : :
296 : : //===== XAccessibleContext ==============================================
297 : :
298 : : /// Return the number of currently visible children.
299 : : virtual sal_Int32 SAL_CALL getAccessibleChildCount (void)
300 : : throw (::com::sun::star::uno::RuntimeException);
301 : :
302 : : /// Return the specified child or NULL if index is invalid.
303 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
304 : : getAccessibleChild (sal_Int32 nIndex)
305 : : throw (::com::sun::star::uno::RuntimeException,
306 : : ::com::sun::star::lang::IndexOutOfBoundsException);
307 : :
308 : : //===== XAccessibleTable ================================================
309 : :
310 : : virtual ::com::sun::star::uno::Reference<
311 : : ::com::sun::star::accessibility::XAccessibleTable >
312 : : SAL_CALL getAccessibleRowHeaders( )
313 : : throw (::com::sun::star::uno::RuntimeException);
314 : : virtual ::com::sun::star::uno::Reference<
315 : : ::com::sun::star::accessibility::XAccessibleTable >
316 : : SAL_CALL getAccessibleColumnHeaders( )
317 : : throw (::com::sun::star::uno::RuntimeException);
318 : :
319 : : //===== XServiceInfo ====================================================
320 : :
321 : : /** Returns an identifier for the implementation of this object.
322 : : */
323 : : virtual ::rtl::OUString SAL_CALL
324 : : getImplementationName (void)
325 : : throw (::com::sun::star::uno::RuntimeException);
326 : :
327 : : };
328 : : #endif
329 : :
330 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|