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 #ifndef _ACCTABLE_HXX
24 #define _ACCTABLE_HXX
25 #include <com/sun/star/accessibility/XAccessibleTable.hpp>
26 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleTableSelection_HPP_
27 #include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
28 #endif
29 #include <vector>
30 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
31
32 #include <acccontext.hxx>
33
34 class SwTabFrm;
35 class SwAccessibleTableData_Impl;
36 class SwTableBox;
37 class SwSelBoxes;
38
39 namespace sw { namespace access {
40 class SwAccessibleChild;
41 } }
42
43 class SwAccessibleTable :
44 public SwAccessibleContext,
45 public ::com::sun::star::accessibility::XAccessibleTable,
46 public ::com::sun::star::accessibility::XAccessibleSelection,
47 public ::com::sun::star::accessibility::XAccessibleTableSelection,
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 // --> OD 2007-06-27 #i77106#
SetDesc(::rtl::OUString sNewDesc)72 inline void SetDesc( ::rtl::OUString sNewDesc )
73 {
74 sDesc = sNewDesc;
75 }
76
77 // --> OD 2007-06-28 #i77106#
78 virtual SwAccessibleTableData_Impl* CreateNewTableData();
79 // <--
80
81 // force update of table data
82 void UpdateTableData();
83
84 // remove the current table data
85 void ClearTableData();
86
87 // get table data, update if necessary
88 inline SwAccessibleTableData_Impl& GetTableData();
89
90 // Is table data available?
HasTableData() const91 sal_Bool HasTableData() const { return (mpTableData != 0); }
92
93 void SetTableData(SwAccessibleTableData_Impl* mpNewTableData) ;
94 virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
95
96 public:
97
98 SwAccessibleTable( SwAccessibleMap* pInitMap, const SwTabFrm* pTableFrm );
99
100 //===== XInterface ======================================================
101
102 // (XInterface methods need to be implemented to disambigouate
103 // between those inherited through SwAcessibleContext and
104 // XAccessibleTable).
105
106 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
107 const ::com::sun::star::uno::Type& aType )
108 throw (::com::sun::star::uno::RuntimeException);
109
acquire()110 virtual void SAL_CALL acquire( ) throw ()
111 { SwAccessibleContext::acquire(); };
112
release()113 virtual void SAL_CALL release( ) throw ()
114 { SwAccessibleContext::release(); };
115
116 //====== XTypeProvider ====================================================
117 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
118 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
119
120 //===== XAccessibleContext ==============================================
121
122 /// Return this object's description.
123 virtual ::rtl::OUString SAL_CALL
124 getAccessibleDescription (void)
125 throw (com::sun::star::uno::RuntimeException);
126
127 //===== XAccessibleTable ================================================
128
129 virtual sal_Int32 SAL_CALL getAccessibleRowCount()
130 throw (::com::sun::star::uno::RuntimeException);
131 virtual sal_Int32 SAL_CALL getAccessibleColumnCount( )
132 throw (::com::sun::star::uno::RuntimeException);
133 virtual ::rtl::OUString SAL_CALL getAccessibleRowDescription(
134 sal_Int32 nRow )
135 throw (::com::sun::star::lang::IndexOutOfBoundsException,
136 ::com::sun::star::uno::RuntimeException);
137 virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription(
138 sal_Int32 nColumn )
139 throw (::com::sun::star::lang::IndexOutOfBoundsException,
140 ::com::sun::star::uno::RuntimeException);
141 virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt(
142 sal_Int32 nRow, sal_Int32 nColumn )
143 throw (::com::sun::star::lang::IndexOutOfBoundsException,
144 ::com::sun::star::uno::RuntimeException);
145 virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt(
146 sal_Int32 nRow, sal_Int32 nColumn )
147 throw (::com::sun::star::lang::IndexOutOfBoundsException,
148 ::com::sun::star::uno::RuntimeException);
149 virtual ::com::sun::star::uno::Reference<
150 ::com::sun::star::accessibility::XAccessibleTable >
151 SAL_CALL getAccessibleRowHeaders( )
152 throw (::com::sun::star::uno::RuntimeException);
153 virtual ::com::sun::star::uno::Reference<
154 ::com::sun::star::accessibility::XAccessibleTable >
155 SAL_CALL getAccessibleColumnHeaders( )
156 throw (::com::sun::star::uno::RuntimeException);
157 virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
158 getSelectedAccessibleRows( )
159 throw (::com::sun::star::uno::RuntimeException);
160 virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
161 getSelectedAccessibleColumns( )
162 throw (::com::sun::star::uno::RuntimeException);
163 virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow )
164 throw (::com::sun::star::lang::IndexOutOfBoundsException,
165 ::com::sun::star::uno::RuntimeException);
166 virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn )
167 throw (::com::sun::star::lang::IndexOutOfBoundsException,
168 ::com::sun::star::uno::RuntimeException);
169 virtual ::com::sun::star::uno::Reference<
170 ::com::sun::star::accessibility::XAccessible > SAL_CALL
171 getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
172 throw (::com::sun::star::lang::IndexOutOfBoundsException,
173 ::com::sun::star::uno::RuntimeException);
174 virtual ::com::sun::star::uno::Reference<
175 ::com::sun::star::accessibility::XAccessible > SAL_CALL
176 getAccessibleCaption( )
177 throw (::com::sun::star::uno::RuntimeException);
178 virtual ::com::sun::star::uno::Reference<
179 ::com::sun::star::accessibility::XAccessible > SAL_CALL
180 getAccessibleSummary( )
181 throw (::com::sun::star::uno::RuntimeException);
182 virtual sal_Bool SAL_CALL isAccessibleSelected(
183 sal_Int32 nRow, sal_Int32 nColumn )
184 throw (::com::sun::star::lang::IndexOutOfBoundsException,
185 ::com::sun::star::uno::RuntimeException);
186 virtual sal_Int32 SAL_CALL getAccessibleIndex(
187 sal_Int32 nRow, sal_Int32 nColumn )
188 throw (::com::sun::star::lang::IndexOutOfBoundsException,
189 ::com::sun::star::uno::RuntimeException);
190 virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex )
191 throw (::com::sun::star::lang::IndexOutOfBoundsException,
192 ::com::sun::star::uno::RuntimeException);
193 virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex )
194 throw (::com::sun::star::lang::IndexOutOfBoundsException,
195 ::com::sun::star::uno::RuntimeException);
196 //===== XAccessibleTableSelection ============================================
197 virtual sal_Bool SAL_CALL selectRow( sal_Int32 row )
198 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
199 virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column )
200 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
201 virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row )
202 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
203 virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column )
204 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
205 //===== XServiceInfo ====================================================
206
207 /** Returns an identifier for the implementation of this object.
208 */
209 virtual ::rtl::OUString SAL_CALL
210 getImplementationName (void)
211 throw (::com::sun::star::uno::RuntimeException);
212
213 /** Return whether the specified service is supported by this class.
214 */
215 virtual sal_Bool SAL_CALL
216 supportsService (const ::rtl::OUString& sServiceName)
217 throw (::com::sun::star::uno::RuntimeException);
218
219 /** Returns a list of all supported services. In this case that is just
220 the AccessibleContext service.
221 */
222 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
223 getSupportedServiceNames (void)
224 throw (::com::sun::star::uno::RuntimeException);
225
226 //===== C++ interface ======================================================
227
228 // The object has been moved by the layout
229 virtual void InvalidatePosOrSize( const SwRect& rOldBox );
230
231 // The object is not visible an longer and should be destroyed
232 virtual void Dispose( sal_Bool bRecursive = sal_False );
233
234 virtual void DisposeChild( const sw::access::SwAccessibleChild& rFrmOrObj,
235 sal_Bool bRecursive );
236 virtual void InvalidateChildPosOrSize( const sw::access::SwAccessibleChild& rFrmOrObj,
237 const SwRect& rFrm );
238
239 //===== XAccessibleSelection ============================================
240
241 virtual void SAL_CALL selectAccessibleChild(
242 sal_Int32 nChildIndex )
243 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
244 ::com::sun::star::uno::RuntimeException );
245
246 virtual sal_Bool SAL_CALL isAccessibleChildSelected(
247 sal_Int32 nChildIndex )
248 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
249 ::com::sun::star::uno::RuntimeException );
250
251 virtual void SAL_CALL clearAccessibleSelection( )
252 throw ( ::com::sun::star::uno::RuntimeException );
253
254 virtual void SAL_CALL selectAllAccessibleChildren( )
255 throw ( ::com::sun::star::uno::RuntimeException );
256
257 virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( )
258 throw ( ::com::sun::star::uno::RuntimeException );
259
260 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
261 sal_Int32 nSelectedChildIndex )
262 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
263 ::com::sun::star::uno::RuntimeException);
264
265 // --> OD 2004-11-16 #111714# - index has to be treated as global child index.
266 virtual void SAL_CALL deselectAccessibleChild(
267 sal_Int32 nChildIndex )
268 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
269 ::com::sun::star::uno::RuntimeException );
270
271 //===== XAccessibleComponent ============================================
272 sal_Int32 SAL_CALL getBackground()
273 throw (::com::sun::star::uno::RuntimeException);
274 typedef std::vector<const SwAccessibleContext*> VEC_CELL;
275 VEC_CELL m_vecCellAdd;
276 VEC_CELL m_vecCellRemove;
277 void FireSelectionEvent( );
278 void ClearSelectionCellCache();
279 void AddSelectionCell(const SwAccessibleContext* ,sal_Bool bAddOrRemove);
280 };
281
GetTableData()282 inline SwAccessibleTableData_Impl& SwAccessibleTable::GetTableData()
283 {
284 if( !mpTableData )
285 UpdateTableData();
286 return *mpTableData;
287 }
288
289 // --> OD 2007-06-28 #i77106#
290 // subclass to represent table column headers
291 class SwAccessibleTableColHeaders : public SwAccessibleTable
292 {
293 protected:
294
~SwAccessibleTableColHeaders()295 virtual ~SwAccessibleTableColHeaders()
296 {}
297
298 virtual SwAccessibleTableData_Impl* CreateNewTableData();
299 virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
300
301 public:
302
303 SwAccessibleTableColHeaders( SwAccessibleMap *pMap, const SwTabFrm *pTabFrm );
304
305 //===== XInterface ======================================================
306
307 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
308 const ::com::sun::star::uno::Type& aType )
309 throw (::com::sun::star::uno::RuntimeException);
310
acquire()311 virtual void SAL_CALL acquire( ) throw ()
312 { SwAccessibleContext::acquire(); };
313
release()314 virtual void SAL_CALL release( ) throw ()
315 { SwAccessibleContext::release(); };
316
317 //===== XAccessibleContext ==============================================
318
319 /// Return the number of currently visible children.
320 virtual sal_Int32 SAL_CALL getAccessibleChildCount (void)
321 throw (::com::sun::star::uno::RuntimeException);
322
323 /// Return the specified child or NULL if index is invalid.
324 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
325 getAccessibleChild (sal_Int32 nIndex)
326 throw (::com::sun::star::uno::RuntimeException,
327 ::com::sun::star::lang::IndexOutOfBoundsException);
328
329 //===== XAccessibleTable ================================================
330
331 virtual ::com::sun::star::uno::Reference<
332 ::com::sun::star::accessibility::XAccessibleTable >
333 SAL_CALL getAccessibleRowHeaders( )
334 throw (::com::sun::star::uno::RuntimeException);
335 virtual ::com::sun::star::uno::Reference<
336 ::com::sun::star::accessibility::XAccessibleTable >
337 SAL_CALL getAccessibleColumnHeaders( )
338 throw (::com::sun::star::uno::RuntimeException);
339
340 //===== XServiceInfo ====================================================
341
342 /** Returns an identifier for the implementation of this object.
343 */
344 virtual ::rtl::OUString SAL_CALL
345 getImplementationName (void)
346 throw (::com::sun::star::uno::RuntimeException);
347
348 };
349 // <--
350 #endif
351