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