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 :
20 : #include <osl/mutex.hxx>
21 : #include <rtl/ustrbuf.hxx>
22 :
23 : #include <algorithm>
24 : #include <list>
25 : #include <set>
26 : #include <com/sun/star/accessibility/AccessibleRole.hpp>
27 : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
28 : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
29 : #include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
30 : #include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp>
31 : #include <unotools/accessiblestatesethelper.hxx>
32 : #include <vcl/svapp.hxx>
33 : #include <frmfmt.hxx>
34 : #include <tabfrm.hxx>
35 : #include <rowfrm.hxx>
36 : #include <cellfrm.hxx>
37 : #include <swtable.hxx>
38 : #include <crsrsh.hxx>
39 : #include <viscrs.hxx>
40 : #include <hints.hxx>
41 : #include <fesh.hxx>
42 : #include <accfrmobjslist.hxx>
43 : #include <accmap.hxx>
44 : #include <access.hrc>
45 : #include <acctable.hxx>
46 :
47 : #include <com/sun/star/accessibility/XAccessibleText.hpp>
48 : #include <comphelper/servicehelper.hxx>
49 :
50 : using namespace ::com::sun::star;
51 : using namespace ::com::sun::star::accessibility;
52 : using namespace ::sw::access;
53 :
54 : const sal_Char sServiceName[] = "com.sun.star.table.AccessibleTableView";
55 : const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleTableView";
56 :
57 : typedef ::std::less < sal_Int32 > Int32Less_Impl;
58 : typedef ::std::set < sal_Int32, Int32Less_Impl > Int32Set_Impl;
59 :
60 : typedef ::std::pair < sal_Int32, sal_Int32 > Int32Pair_Impl;
61 : typedef ::std::list < Int32Pair_Impl > Int32PairList_Impl;
62 :
63 0 : class SwAccTableSelHander_Impl
64 : {
65 : public:
66 : virtual void Unselect( sal_Int32 nRowOrCol, sal_Int32 nExt ) = 0;
67 :
68 : protected:
69 0 : ~SwAccTableSelHander_Impl() {}
70 : };
71 :
72 :
73 0 : class SwAccessibleTableData_Impl
74 : {
75 : SwAccessibleMap& mrAccMap;
76 : Int32Set_Impl maRows;
77 : Int32Set_Impl maColumns;
78 : Int32PairList_Impl maExtents; // cell extends for event processing only
79 : Point maTabFrmPos;
80 : const SwTabFrm *mpTabFrm;
81 : sal_Bool mbIsInPagePreview;
82 : bool mbOnlyTableColumnHeader;
83 :
84 : void CollectData( const SwFrm *pFrm );
85 : void CollectExtents( const SwFrm *pFrm );
86 :
87 : sal_Bool FindCell( const Point& rPos, const SwFrm *pFrm ,
88 : sal_Bool bExact, const SwFrm *& rFrm ) const;
89 :
90 : void GetSelection( const Point& rTabPos, const SwRect& rArea,
91 : const SwSelBoxes& rSelBoxes, const SwFrm *pFrm,
92 : SwAccTableSelHander_Impl& rSelHdl,
93 : sal_Bool bColumns ) const;
94 :
95 : // #i77106#
96 0 : inline bool IncludeRow( const SwFrm& rFrm ) const
97 : {
98 0 : return !mbOnlyTableColumnHeader ||
99 0 : mpTabFrm->IsInHeadline( rFrm );
100 : }
101 : public:
102 : // #i77106# - add third optional parameter <bOnlyTableColumnHeader>, default value <false>
103 : SwAccessibleTableData_Impl( SwAccessibleMap& rAccMap,
104 : const SwTabFrm *pTabFrm,
105 : sal_Bool bIsInPagePreview,
106 : bool bOnlyTableColumnHeader = false );
107 :
108 0 : const Int32Set_Impl& GetRows() const { return maRows; }
109 0 : const Int32Set_Impl& GetColumns() const { return maColumns; }
110 :
111 : inline Int32Set_Impl::const_iterator GetRowIter( sal_Int32 nRow ) const;
112 : inline Int32Set_Impl::const_iterator GetColumnIter( sal_Int32 nCol ) const;
113 :
114 : const SwFrm *GetCell( sal_Int32 nRow, sal_Int32 nColumn, sal_Bool bExact,
115 : SwAccessibleTable *pThis ) const
116 : throw(lang::IndexOutOfBoundsException );
117 : const SwFrm *GetCellAtPos( sal_Int32 nLeft, sal_Int32 nTop,
118 : sal_Bool bExact ) const;
119 : inline sal_Int32 GetRowCount() const;
120 : inline sal_Int32 GetColumnCount() const;
121 : sal_Bool CompareExtents( const SwAccessibleTableData_Impl& r ) const;
122 :
123 : void GetSelection( sal_Int32 nStart, sal_Int32 nEnd,
124 : const SwSelBoxes& rSelBoxes,
125 : SwAccTableSelHander_Impl& rSelHdl,
126 : sal_Bool bColumns ) const;
127 :
128 : void CheckRowAndCol( sal_Int32 nRow, sal_Int32 nCol,
129 : SwAccessibleTable *pThis ) const
130 : throw(lang::IndexOutOfBoundsException );
131 :
132 : void GetRowColumnAndExtent( const SwRect& rBox,
133 : sal_Int32& rRow, sal_Int32& rColumn,
134 : sal_Int32& rRowExtent,
135 : sal_Int32& rColumnExtent ) const;
136 :
137 : const Point& GetTablePos() const { return maTabFrmPos; }
138 0 : void SetTablePos( const Point& rPos ) { maTabFrmPos = rPos; }
139 : };
140 :
141 0 : void SwAccessibleTableData_Impl::CollectData( const SwFrm *pFrm )
142 : {
143 0 : const SwAccessibleChildSList aList( *pFrm, mrAccMap );
144 0 : SwAccessibleChildSList::const_iterator aIter( aList.begin() );
145 0 : SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
146 0 : while( aIter != aEndIter )
147 : {
148 0 : const SwAccessibleChild& rLower = *aIter;
149 0 : const SwFrm *pLower = rLower.GetSwFrm();
150 0 : if( pLower )
151 : {
152 0 : if( pLower->IsRowFrm() )
153 : {
154 : // #i77106#
155 0 : if ( IncludeRow( *pLower ) )
156 : {
157 0 : maRows.insert( pLower->Frm().Top() - maTabFrmPos.getY() );
158 0 : CollectData( pLower );
159 : }
160 : }
161 0 : else if( pLower->IsCellFrm() &&
162 0 : rLower.IsAccessible( mbIsInPagePreview ) )
163 : {
164 0 : maColumns.insert( pLower->Frm().Left() - maTabFrmPos.getX() );
165 : }
166 : else
167 : {
168 0 : CollectData( pLower );
169 : }
170 : }
171 0 : ++aIter;
172 : }
173 0 : }
174 :
175 0 : void SwAccessibleTableData_Impl::CollectExtents( const SwFrm *pFrm )
176 : {
177 0 : const SwAccessibleChildSList aList( *pFrm, mrAccMap );
178 0 : SwAccessibleChildSList::const_iterator aIter( aList.begin() );
179 0 : SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
180 0 : while( aIter != aEndIter )
181 : {
182 0 : const SwAccessibleChild& rLower = *aIter;
183 0 : const SwFrm *pLower = rLower.GetSwFrm();
184 0 : if( pLower )
185 : {
186 0 : if( pLower->IsCellFrm() &&
187 0 : rLower.IsAccessible( mbIsInPagePreview ) )
188 : {
189 : sal_Int32 nRow, nCol;
190 0 : Int32Pair_Impl aCellExtents;
191 0 : GetRowColumnAndExtent( pLower->Frm(), nRow, nCol,
192 : aCellExtents.first,
193 0 : aCellExtents.second );
194 :
195 0 : maExtents.push_back( aCellExtents );
196 : }
197 : else
198 : {
199 : // #i77106#
200 0 : if ( !pLower->IsRowFrm() ||
201 0 : IncludeRow( *pLower ) )
202 : {
203 0 : CollectExtents( pLower );
204 : }
205 : }
206 : }
207 0 : ++aIter;
208 : }
209 0 : }
210 :
211 0 : sal_Bool SwAccessibleTableData_Impl::FindCell(
212 : const Point& rPos, const SwFrm *pFrm, sal_Bool bExact,
213 : const SwFrm *& rRet ) const
214 : {
215 0 : sal_Bool bFound = sal_False;
216 :
217 0 : const SwAccessibleChildSList aList( *pFrm, mrAccMap );
218 0 : SwAccessibleChildSList::const_iterator aIter( aList.begin() );
219 0 : SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
220 0 : while( !bFound && aIter != aEndIter )
221 : {
222 0 : const SwAccessibleChild& rLower = *aIter;
223 0 : const SwFrm *pLower = rLower.GetSwFrm();
224 : OSL_ENSURE( pLower, "child should be a frame" );
225 0 : if( pLower )
226 : {
227 0 : if( rLower.IsAccessible( mbIsInPagePreview ) )
228 : {
229 : OSL_ENSURE( pLower->IsCellFrm(), "lower is not a cell frame" );
230 0 : const SwRect& rFrm = pLower->Frm();
231 0 : if( rFrm.Right() >= rPos.X() && rFrm.Bottom() >= rPos.Y() )
232 : {
233 : // We have found the cell
234 : OSL_ENSURE( rFrm.Left() <= rPos.X() && rFrm.Top() <= rPos.Y(),
235 : "find frame moved to far!" );
236 0 : bFound = sal_True;
237 0 : if( !bExact ||
238 0 : (rFrm.Top() == rPos.Y() && rFrm.Left() == rPos.Y() ) )
239 : {
240 0 : rRet = pLower;
241 : }
242 : }
243 : }
244 : else
245 : {
246 : // #i77106#
247 0 : if ( !pLower->IsRowFrm() ||
248 0 : IncludeRow( *pLower ) )
249 : {
250 0 : bFound = FindCell( rPos, pLower, bExact, rRet );
251 : }
252 : }
253 : }
254 0 : ++aIter;
255 : }
256 :
257 0 : return bFound;
258 : }
259 :
260 0 : void SwAccessibleTableData_Impl::GetSelection(
261 : const Point& rTabPos,
262 : const SwRect& rArea,
263 : const SwSelBoxes& rSelBoxes,
264 : const SwFrm *pFrm,
265 : SwAccTableSelHander_Impl& rSelHdl,
266 : sal_Bool bColumns ) const
267 : {
268 0 : const SwAccessibleChildSList aList( *pFrm, mrAccMap );
269 0 : SwAccessibleChildSList::const_iterator aIter( aList.begin() );
270 0 : SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
271 0 : while( aIter != aEndIter )
272 : {
273 0 : const SwAccessibleChild& rLower = *aIter;
274 0 : const SwFrm *pLower = rLower.GetSwFrm();
275 : OSL_ENSURE( pLower, "child should be a frame" );
276 0 : const SwRect& rBox = rLower.GetBox( mrAccMap );
277 0 : if( pLower && rBox.IsOver( rArea ) )
278 : {
279 0 : if( rLower.IsAccessible( mbIsInPagePreview ) )
280 : {
281 : OSL_ENSURE( pLower->IsCellFrm(), "lower is not a cell frame" );
282 : const SwCellFrm *pCFrm =
283 0 : static_cast < const SwCellFrm * >( pLower );
284 : SwTableBox *pBox =
285 0 : const_cast< SwTableBox *>( pCFrm->GetTabBox() );
286 0 : if( rSelBoxes.find( pBox ) == rSelBoxes.end() )
287 : {
288 : const Int32Set_Impl rRowsOrCols =
289 0 : bColumns ? maColumns : maRows;
290 :
291 0 : sal_Int32 nPos = bColumns ? (rBox.Left() - rTabPos.X())
292 0 : : (rBox.Top() - rTabPos.Y());
293 : Int32Set_Impl::const_iterator aSttRowOrCol(
294 0 : rRowsOrCols.lower_bound( nPos ) );
295 : sal_Int32 nRowOrCol =
296 : static_cast< sal_Int32 >( ::std::distance(
297 0 : rRowsOrCols.begin(), aSttRowOrCol ) );
298 :
299 0 : nPos = bColumns ? (rBox.Right() - rTabPos.X())
300 0 : : (rBox.Bottom() - rTabPos.Y());
301 : Int32Set_Impl::const_iterator aEndRowOrCol(
302 0 : rRowsOrCols.upper_bound( nPos ) );
303 : sal_Int32 nExt =
304 : static_cast< sal_Int32 >( ::std::distance(
305 0 : aSttRowOrCol, aEndRowOrCol ) );
306 :
307 0 : rSelHdl.Unselect( nRowOrCol, nExt );
308 : }
309 : }
310 : else
311 : {
312 : // #i77106#
313 0 : if ( !pLower->IsRowFrm() ||
314 0 : IncludeRow( *pLower ) )
315 : {
316 : GetSelection( rTabPos, rArea, rSelBoxes, pLower, rSelHdl,
317 0 : bColumns );
318 : }
319 : }
320 : }
321 0 : ++aIter;
322 : }
323 0 : }
324 :
325 0 : const SwFrm *SwAccessibleTableData_Impl::GetCell(
326 : sal_Int32 nRow, sal_Int32 nColumn, sal_Bool,
327 : SwAccessibleTable *pThis ) const
328 : throw(lang::IndexOutOfBoundsException )
329 : {
330 0 : CheckRowAndCol( nRow, nColumn, pThis );
331 :
332 0 : Int32Set_Impl::const_iterator aSttCol( GetColumnIter( nColumn ) );
333 0 : Int32Set_Impl::const_iterator aSttRow( GetRowIter( nRow ) );
334 0 : const SwFrm *pCellFrm = GetCellAtPos( *aSttCol, *aSttRow, sal_False );
335 :
336 0 : return pCellFrm;
337 : }
338 :
339 0 : void SwAccessibleTableData_Impl::GetSelection(
340 : sal_Int32 nStart, sal_Int32 nEnd,
341 : const SwSelBoxes& rSelBoxes,
342 : SwAccTableSelHander_Impl& rSelHdl,
343 : sal_Bool bColumns ) const
344 : {
345 0 : SwRect aArea( mpTabFrm->Frm() );
346 0 : Point aPos( aArea.Pos() );
347 :
348 0 : const Int32Set_Impl& rRowsOrColumns = bColumns ? maColumns : maRows;
349 0 : if( nStart > 0 )
350 : {
351 0 : Int32Set_Impl::const_iterator aStt( rRowsOrColumns.begin() );
352 : ::std::advance( aStt,
353 0 : static_cast< Int32Set_Impl::difference_type >( nStart ) );
354 0 : if( bColumns )
355 0 : aArea.Left( *aStt + aPos.getX() );
356 : else
357 0 : aArea.Top( *aStt + aPos.getY() );
358 : }
359 0 : if( nEnd < static_cast< sal_Int32 >( rRowsOrColumns.size() ) )
360 : {
361 0 : Int32Set_Impl::const_iterator aEnd( rRowsOrColumns.begin() );
362 : ::std::advance( aEnd,
363 0 : static_cast< Int32Set_Impl::difference_type >( nEnd ) );
364 0 : if( bColumns )
365 0 : aArea.Right( *aEnd + aPos.getX() - 1 );
366 : else
367 0 : aArea.Bottom( *aEnd + aPos.getY() - 1 );
368 : }
369 :
370 0 : GetSelection( aPos, aArea, rSelBoxes, mpTabFrm, rSelHdl, bColumns );
371 0 : }
372 :
373 0 : const SwFrm *SwAccessibleTableData_Impl::GetCellAtPos(
374 : sal_Int32 nLeft, sal_Int32 nTop, sal_Bool bExact ) const
375 : {
376 0 : Point aPos( mpTabFrm->Frm().Pos() );
377 0 : aPos.Move( nLeft, nTop );
378 0 : const SwFrm *pRet = 0;
379 0 : FindCell( aPos, mpTabFrm, bExact, pRet );
380 :
381 0 : return pRet;
382 : }
383 :
384 0 : inline sal_Int32 SwAccessibleTableData_Impl::GetRowCount() const
385 : {
386 0 : return static_cast< sal_Int32 >( maRows.size() );
387 : }
388 :
389 0 : inline sal_Int32 SwAccessibleTableData_Impl::GetColumnCount() const
390 : {
391 0 : return static_cast< sal_Int32 >( maColumns.size() );
392 : }
393 :
394 0 : sal_Bool SwAccessibleTableData_Impl::CompareExtents(
395 : const SwAccessibleTableData_Impl& rCmp ) const
396 : {
397 0 : if( maExtents.size() != rCmp.maExtents.size() )
398 0 : return sal_False;
399 :
400 0 : return ::std::equal(maExtents.begin(), maExtents.end(), rCmp.maExtents.begin()) ? sal_True : sal_False;
401 : }
402 :
403 0 : SwAccessibleTableData_Impl::SwAccessibleTableData_Impl( SwAccessibleMap& rAccMap,
404 : const SwTabFrm *pTabFrm,
405 : sal_Bool bIsInPagePreview,
406 : bool bOnlyTableColumnHeader )
407 : : mrAccMap( rAccMap )
408 0 : , maTabFrmPos( pTabFrm->Frm().Pos() )
409 : , mpTabFrm( pTabFrm )
410 : , mbIsInPagePreview( bIsInPagePreview )
411 0 : , mbOnlyTableColumnHeader( bOnlyTableColumnHeader )
412 : {
413 0 : CollectData( mpTabFrm );
414 0 : CollectExtents( mpTabFrm );
415 0 : }
416 :
417 0 : inline Int32Set_Impl::const_iterator SwAccessibleTableData_Impl::GetRowIter(
418 : sal_Int32 nRow ) const
419 : {
420 0 : Int32Set_Impl::const_iterator aCol( GetRows().begin() );
421 0 : if( nRow > 0 )
422 : {
423 : ::std::advance( aCol,
424 0 : static_cast< Int32Set_Impl::difference_type >( nRow ) );
425 : }
426 0 : return aCol;
427 : }
428 :
429 0 : inline Int32Set_Impl::const_iterator SwAccessibleTableData_Impl::GetColumnIter(
430 : sal_Int32 nColumn ) const
431 : {
432 0 : Int32Set_Impl::const_iterator aCol = GetColumns().begin();
433 0 : if( nColumn > 0 )
434 : {
435 : ::std::advance( aCol,
436 0 : static_cast< Int32Set_Impl::difference_type >( nColumn ) );
437 : }
438 0 : return aCol;
439 : }
440 :
441 0 : void SwAccessibleTableData_Impl::CheckRowAndCol(
442 : sal_Int32 nRow, sal_Int32 nCol, SwAccessibleTable *pThis ) const
443 : throw(lang::IndexOutOfBoundsException )
444 : {
445 0 : if( ( nRow < 0 || nRow >= static_cast< sal_Int32 >( maRows.size() ) ) ||
446 0 : ( nCol < 0 || nCol >= static_cast< sal_Int32 >( maColumns.size() ) ) )
447 : {
448 0 : uno::Reference < XAccessibleTable > xThis( pThis );
449 : lang::IndexOutOfBoundsException aExcept(
450 : OUString( "row or column index out of range" ),
451 0 : xThis );
452 0 : throw aExcept;
453 : }
454 0 : }
455 :
456 0 : void SwAccessibleTableData_Impl::GetRowColumnAndExtent(
457 : const SwRect& rBox,
458 : sal_Int32& rRow, sal_Int32& rColumn,
459 : sal_Int32& rRowExtent, sal_Int32& rColumnExtent ) const
460 : {
461 : Int32Set_Impl::const_iterator aStt(
462 0 : maRows.lower_bound( rBox.Top() - maTabFrmPos.Y() ) );
463 : Int32Set_Impl::const_iterator aEnd(
464 0 : maRows.upper_bound( rBox.Bottom() - maTabFrmPos.Y() ) );
465 : rRow =
466 0 : static_cast< sal_Int32 >( ::std::distance( maRows.begin(), aStt ) );
467 : rRowExtent =
468 0 : static_cast< sal_Int32 >( ::std::distance( aStt, aEnd ) );
469 :
470 0 : aStt = maColumns.lower_bound( rBox.Left() - maTabFrmPos.X() );
471 0 : aEnd = maColumns.upper_bound( rBox.Right() - maTabFrmPos.X() );
472 : rColumn =
473 0 : static_cast< sal_Int32 >( ::std::distance( maColumns.begin(), aStt ) );
474 : rColumnExtent =
475 0 : static_cast< sal_Int32 >( ::std::distance( aStt, aEnd ) );
476 0 : }
477 :
478 : class SwAccSingleTableSelHander_Impl : public SwAccTableSelHander_Impl
479 : {
480 : sal_Bool bSelected;
481 :
482 : public:
483 :
484 : inline SwAccSingleTableSelHander_Impl();
485 :
486 0 : virtual ~SwAccSingleTableSelHander_Impl() {}
487 :
488 0 : inline sal_Bool IsSelected() const { return bSelected; }
489 :
490 : virtual void Unselect( sal_Int32, sal_Int32 );
491 : };
492 :
493 0 : inline SwAccSingleTableSelHander_Impl::SwAccSingleTableSelHander_Impl() :
494 0 : bSelected( sal_True )
495 : {
496 0 : }
497 :
498 0 : void SwAccSingleTableSelHander_Impl::Unselect( sal_Int32, sal_Int32 )
499 : {
500 0 : bSelected = sal_False;
501 0 : }
502 :
503 : class SwAccAllTableSelHander_Impl : public SwAccTableSelHander_Impl
504 :
505 : {
506 : ::std::vector< sal_Bool > aSelected;
507 : sal_Int32 nCount;
508 :
509 : public:
510 :
511 : inline SwAccAllTableSelHander_Impl( sal_Int32 nSize );
512 :
513 : uno::Sequence < sal_Int32 > GetSelSequence();
514 :
515 : virtual void Unselect( sal_Int32 nRowOrCol, sal_Int32 nExt );
516 : virtual ~SwAccAllTableSelHander_Impl();
517 : };
518 :
519 0 : SwAccAllTableSelHander_Impl::~SwAccAllTableSelHander_Impl()
520 : {
521 0 : }
522 :
523 0 : inline SwAccAllTableSelHander_Impl::SwAccAllTableSelHander_Impl( sal_Int32 nSize ) :
524 : aSelected( nSize, sal_True ),
525 0 : nCount( nSize )
526 : {
527 0 : }
528 :
529 0 : uno::Sequence < sal_Int32 > SwAccAllTableSelHander_Impl::GetSelSequence()
530 : {
531 : OSL_ENSURE( nCount >= 0, "underflow" );
532 0 : uno::Sequence < sal_Int32 > aRet( nCount );
533 0 : sal_Int32 *pRet = aRet.getArray();
534 0 : sal_Int32 nPos = 0;
535 0 : size_t nSize = aSelected.size();
536 0 : for( size_t i=0; i < nSize && nPos < nCount; i++ )
537 : {
538 0 : if( aSelected[i] )
539 : {
540 0 : *pRet++ = i;
541 0 : nPos++;
542 : }
543 : }
544 :
545 : OSL_ENSURE( nPos == nCount, "count is wrong" );
546 :
547 0 : return aRet;
548 : }
549 :
550 0 : void SwAccAllTableSelHander_Impl::Unselect( sal_Int32 nRowOrCol,
551 : sal_Int32 nExt )
552 : {
553 : OSL_ENSURE( static_cast< size_t >( nRowOrCol ) < aSelected.size(),
554 : "index to large" );
555 : OSL_ENSURE( static_cast< size_t >( nRowOrCol+nExt ) <= aSelected.size(),
556 : "extent to large" );
557 0 : while( nExt )
558 : {
559 0 : if( aSelected[static_cast< size_t >( nRowOrCol )] )
560 : {
561 0 : aSelected[static_cast< size_t >( nRowOrCol )] = sal_False;
562 0 : nCount--;
563 : }
564 0 : nExt--;
565 0 : nRowOrCol++;
566 : }
567 0 : }
568 :
569 4 : const SwSelBoxes *SwAccessibleTable::GetSelBoxes() const
570 : {
571 4 : const SwSelBoxes *pSelBoxes = 0;
572 4 : const SwCrsrShell *pCSh = GetCrsrShell();
573 4 : if( (pCSh != NULL) && pCSh->IsTableMode() )
574 : {
575 2 : pSelBoxes = &pCSh->GetTableCrsr()->GetSelectedBoxes();
576 : }
577 :
578 4 : return pSelBoxes;
579 : }
580 :
581 0 : void SwAccessibleTable::FireTableChangeEvent(
582 : const SwAccessibleTableData_Impl& rTableData )
583 : {
584 0 : AccessibleTableModelChange aModelChange;
585 0 : aModelChange.Type = AccessibleTableModelChangeType::UPDATE;
586 0 : aModelChange.FirstRow = 0;
587 0 : aModelChange.LastRow = rTableData.GetRowCount() - 1;
588 0 : aModelChange.FirstColumn = 0;
589 0 : aModelChange.LastColumn = rTableData.GetColumnCount() - 1;
590 :
591 0 : AccessibleEventObject aEvent;
592 0 : aEvent.EventId = AccessibleEventId::TABLE_MODEL_CHANGED;
593 0 : aEvent.NewValue <<= aModelChange;
594 :
595 0 : FireAccessibleEvent( aEvent );
596 0 : }
597 :
598 :
599 6 : const SwTableBox* SwAccessibleTable::GetTableBox( sal_Int32 nChildIndex ) const
600 : {
601 : OSL_ENSURE( nChildIndex >= 0, "Illegal child index." );
602 : OSL_ENSURE( nChildIndex < const_cast<SwAccessibleTable*>(this)->getAccessibleChildCount(), "Illegal child index." ); // #i77106#
603 :
604 6 : const SwTableBox* pBox = NULL;
605 :
606 : // get table box for 'our' table cell
607 6 : SwAccessibleChild aCell( GetChild( *(const_cast<SwAccessibleMap*>(GetMap())), nChildIndex ) );
608 6 : if( aCell.GetSwFrm() )
609 : {
610 6 : const SwFrm* pChildFrm = aCell.GetSwFrm();
611 6 : if( (pChildFrm != NULL) && pChildFrm->IsCellFrm() )
612 : {
613 : const SwCellFrm* pCellFrm =
614 6 : static_cast<const SwCellFrm*>( pChildFrm );
615 6 : pBox = pCellFrm->GetTabBox();
616 : }
617 : }
618 :
619 : OSL_ENSURE( pBox != NULL, "We need the table box." );
620 6 : return pBox;
621 : }
622 :
623 4 : sal_Bool SwAccessibleTable::IsChildSelected( sal_Int32 nChildIndex ) const
624 : {
625 4 : sal_Bool bRet = sal_False;
626 4 : const SwSelBoxes* pSelBoxes = GetSelBoxes();
627 4 : if( pSelBoxes )
628 : {
629 2 : const SwTableBox* pBox = GetTableBox( nChildIndex );
630 : OSL_ENSURE( pBox != NULL, "We need the table box." );
631 2 : bRet = pSelBoxes->find( const_cast<SwTableBox*>( pBox ) ) != pSelBoxes->end();
632 : }
633 :
634 4 : return bRet;
635 : }
636 :
637 0 : sal_Int32 SwAccessibleTable::GetIndexOfSelectedChild(
638 : sal_Int32 nSelectedChildIndex ) const
639 : {
640 : // iterate over all children to n-th isAccessibleChildSelected()
641 0 : sal_Int32 nChildren = const_cast<SwAccessibleTable*>(this)->getAccessibleChildCount(); // #i77106#
642 0 : if( nSelectedChildIndex >= nChildren )
643 0 : return -1L;
644 :
645 0 : sal_Int32 n = 0;
646 0 : while( n < nChildren )
647 : {
648 0 : if( IsChildSelected( n ) )
649 : {
650 0 : if( 0 == nSelectedChildIndex )
651 0 : break;
652 : else
653 0 : --nSelectedChildIndex;
654 : }
655 0 : ++n;
656 : }
657 :
658 0 : return n < nChildren ? n : -1L;
659 : }
660 :
661 2 : void SwAccessibleTable::GetStates(
662 : ::utl::AccessibleStateSetHelper& rStateSet )
663 : {
664 2 : SwAccessibleContext::GetStates( rStateSet );
665 :
666 : // MULTISELECTABLE
667 2 : SwCrsrShell* pCrsrShell = GetCrsrShell();
668 2 : if( pCrsrShell )
669 2 : rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
670 2 : }
671 :
672 2 : SwAccessibleTable::SwAccessibleTable(
673 : SwAccessibleMap* pInitMap,
674 : const SwTabFrm* pTabFrm ) :
675 : SwAccessibleContext( pInitMap, AccessibleRole::TABLE, pTabFrm ),
676 2 : mpTableData( 0 )
677 : {
678 2 : SolarMutexGuard aGuard;
679 :
680 2 : const SwFrmFmt *pFrmFmt = pTabFrm->GetFmt();
681 2 : const_cast< SwFrmFmt * >( pFrmFmt )->Add( this );
682 2 : const String& rName = pFrmFmt->GetName();
683 :
684 2 : SetName( OUString( rName ) + "-" + OUString::number( pTabFrm->GetPhyPageNum() ) );
685 :
686 2 : OUString sArg1( static_cast< const SwTabFrm * >( GetFrm() )
687 4 : ->GetFmt()->GetName() );
688 4 : OUString sArg2( GetFormattedPageNumber() );
689 :
690 4 : sDesc = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );
691 2 : }
692 :
693 6 : SwAccessibleTable::~SwAccessibleTable()
694 : {
695 2 : SolarMutexGuard aGuard;
696 :
697 2 : delete mpTableData;
698 4 : }
699 :
700 0 : void SwAccessibleTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
701 : {
702 0 : sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
703 0 : const SwTabFrm *pTabFrm = static_cast< const SwTabFrm * >( GetFrm() );
704 0 : switch( nWhich )
705 : {
706 : case RES_NAME_CHANGED:
707 0 : if( pTabFrm )
708 : {
709 0 : const SwFrmFmt *pFrmFmt = pTabFrm->GetFmt();
710 : OSL_ENSURE( pFrmFmt == GetRegisteredIn(), "invalid frame" );
711 :
712 0 : OUString sOldName( GetName() );
713 :
714 0 : const String& rNewTabName = pFrmFmt->GetName();
715 :
716 0 : SetName( OUString(rNewTabName) + "-" + OUString::number( pTabFrm->GetPhyPageNum() ) );
717 :
718 0 : if( sOldName != GetName() )
719 : {
720 0 : AccessibleEventObject aEvent;
721 0 : aEvent.EventId = AccessibleEventId::NAME_CHANGED;
722 0 : aEvent.OldValue <<= sOldName;
723 0 : aEvent.NewValue <<= GetName();
724 0 : FireAccessibleEvent( aEvent );
725 : }
726 :
727 0 : OUString sOldDesc( sDesc );
728 0 : OUString sArg1( rNewTabName );
729 0 : OUString sArg2( GetFormattedPageNumber() );
730 :
731 0 : sDesc = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );
732 0 : if( sDesc != sOldDesc )
733 : {
734 0 : AccessibleEventObject aEvent;
735 0 : aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
736 0 : aEvent.OldValue <<= sOldDesc;
737 0 : aEvent.NewValue <<= sDesc;
738 0 : FireAccessibleEvent( aEvent );
739 0 : }
740 : }
741 0 : break;
742 :
743 : case RES_OBJECTDYING:
744 : // mba: it seems that this class intentionally does not call code in base class SwClient
745 0 : if( GetRegisteredIn() ==
746 : static_cast< SwModify *>( static_cast< const SwPtrMsgPoolItem * >( pOld )->pObject ) )
747 0 : GetRegisteredInNonConst()->Remove( this );
748 0 : break;
749 :
750 : default:
751 : // mba: former call to base class method removed as it is meant to handle only RES_OBJECTDYING
752 0 : break;
753 : }
754 0 : }
755 :
756 56 : uno::Any SwAccessibleTable::queryInterface( const uno::Type& rType )
757 : throw (uno::RuntimeException)
758 : {
759 56 : uno::Any aRet;
760 56 : if ( rType == ::getCppuType( static_cast< uno::Reference< XAccessibleTable > * >( 0 ) ) )
761 : {
762 0 : uno::Reference<XAccessibleTable> xThis( this );
763 0 : aRet <<= xThis;
764 : }
765 56 : else if ( rType == ::getCppuType( static_cast< uno::Reference< XAccessibleSelection > * >( 0 ) ) )
766 : {
767 2 : uno::Reference<XAccessibleSelection> xSelection( this );
768 2 : aRet <<= xSelection;
769 : }
770 : else
771 : {
772 54 : aRet = SwAccessibleContext::queryInterface(rType);
773 : }
774 :
775 56 : return aRet;
776 : }
777 :
778 : // XTypeProvider
779 0 : uno::Sequence< uno::Type > SAL_CALL SwAccessibleTable::getTypes()
780 : throw(uno::RuntimeException)
781 : {
782 0 : uno::Sequence< uno::Type > aTypes( SwAccessibleContext::getTypes() );
783 :
784 0 : sal_Int32 nIndex = aTypes.getLength();
785 0 : aTypes.realloc( nIndex + 2 );
786 :
787 0 : uno::Type* pTypes = aTypes.getArray();
788 0 : pTypes[nIndex++] = ::getCppuType( static_cast< uno::Reference< XAccessibleSelection > * >( 0 ) );
789 0 : pTypes[nIndex++] = ::getCppuType( static_cast< uno::Reference< XAccessibleTable > * >( 0 ) );
790 :
791 0 : return aTypes;
792 : }
793 :
794 : namespace
795 : {
796 : class theSwAccessibleTableImplementationId : public rtl::Static< UnoTunnelIdInit, theSwAccessibleTableImplementationId > {};
797 : }
798 :
799 0 : uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleTable::getImplementationId()
800 : throw(uno::RuntimeException)
801 : {
802 0 : return theSwAccessibleTableImplementationId::get().getSeq();
803 : }
804 :
805 : // #i77106#
806 0 : SwAccessibleTableData_Impl* SwAccessibleTable::CreateNewTableData()
807 : {
808 0 : const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() );
809 0 : return new SwAccessibleTableData_Impl( *GetMap(), pTabFrm, IsInPagePreview() );
810 : }
811 :
812 0 : void SwAccessibleTable::UpdateTableData()
813 : {
814 : // #i77106# - usage of new method <CreateNewTableData()>
815 0 : delete mpTableData;
816 0 : mpTableData = CreateNewTableData();
817 0 : }
818 :
819 0 : void SwAccessibleTable::ClearTableData()
820 : {
821 0 : delete mpTableData;
822 0 : mpTableData = 0;
823 0 : }
824 :
825 6 : OUString SAL_CALL SwAccessibleTable::getAccessibleDescription (void)
826 : throw (uno::RuntimeException)
827 : {
828 6 : SolarMutexGuard aGuard;
829 :
830 6 : CHECK_FOR_DEFUNC( XAccessibleContext )
831 :
832 6 : return sDesc;
833 : }
834 :
835 0 : sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRowCount()
836 : throw (uno::RuntimeException)
837 : {
838 0 : SolarMutexGuard aGuard;
839 :
840 0 : CHECK_FOR_DEFUNC( XAccessibleTable )
841 :
842 0 : return GetTableData().GetRowCount();
843 : }
844 :
845 0 : sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleColumnCount( )
846 : throw (uno::RuntimeException)
847 : {
848 0 : SolarMutexGuard aGuard;
849 :
850 0 : CHECK_FOR_DEFUNC( XAccessibleTable )
851 :
852 0 : return GetTableData().GetColumnCount();
853 : }
854 :
855 0 : OUString SAL_CALL SwAccessibleTable::getAccessibleRowDescription(
856 : sal_Int32 nRow )
857 : throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
858 : {
859 : // #i87532# - determine table cell in <nRow>th row and
860 : // in first column of row header table and return its text content.
861 0 : OUString sRowDesc;
862 :
863 0 : GetTableData().CheckRowAndCol(nRow, 0, this);
864 :
865 0 : uno::Reference< XAccessibleTable > xTableRowHeader = getAccessibleRowHeaders();
866 0 : if ( xTableRowHeader.is() )
867 : {
868 : uno::Reference< XAccessible > xRowHeaderCell =
869 0 : xTableRowHeader->getAccessibleCellAt( nRow, 0 );
870 : OSL_ENSURE( xRowHeaderCell.is(),
871 : "<SwAccessibleTable::getAccessibleRowDescription(..)> - missing row header cell -> serious issue." );
872 : uno::Reference< XAccessibleContext > xRowHeaderCellContext =
873 0 : xRowHeaderCell->getAccessibleContext();
874 0 : const sal_Int32 nCellChildCount( xRowHeaderCellContext->getAccessibleChildCount() );
875 0 : for ( sal_Int32 nChildIndex = 0; nChildIndex < nCellChildCount; ++nChildIndex )
876 : {
877 0 : uno::Reference< XAccessible > xChild = xRowHeaderCellContext->getAccessibleChild( nChildIndex );
878 0 : uno::Reference< XAccessibleText > xChildText( xChild, uno::UNO_QUERY );
879 0 : if ( xChildText.is() )
880 : {
881 0 : sRowDesc = sRowDesc + xChildText->getText();
882 : }
883 0 : }
884 : }
885 :
886 0 : return sRowDesc;
887 : }
888 :
889 0 : OUString SAL_CALL SwAccessibleTable::getAccessibleColumnDescription(
890 : sal_Int32 nColumn )
891 : throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
892 : {
893 : // #i87532# - determine table cell in first row and
894 : // in <nColumn>th column of column header table and return its text content.
895 0 : OUString sColumnDesc;
896 :
897 0 : GetTableData().CheckRowAndCol(0, nColumn, this);
898 :
899 0 : uno::Reference< XAccessibleTable > xTableColumnHeader = getAccessibleColumnHeaders();
900 0 : if ( xTableColumnHeader.is() )
901 : {
902 : uno::Reference< XAccessible > xColumnHeaderCell =
903 0 : xTableColumnHeader->getAccessibleCellAt( 0, nColumn );
904 : OSL_ENSURE( xColumnHeaderCell.is(),
905 : "<SwAccessibleTable::getAccessibleColumnDescription(..)> - missing column header cell -> serious issue." );
906 : uno::Reference< XAccessibleContext > xColumnHeaderCellContext =
907 0 : xColumnHeaderCell->getAccessibleContext();
908 0 : const sal_Int32 nCellChildCount( xColumnHeaderCellContext->getAccessibleChildCount() );
909 0 : for ( sal_Int32 nChildIndex = 0; nChildIndex < nCellChildCount; ++nChildIndex )
910 : {
911 0 : uno::Reference< XAccessible > xChild = xColumnHeaderCellContext->getAccessibleChild( nChildIndex );
912 0 : uno::Reference< XAccessibleText > xChildText( xChild, uno::UNO_QUERY );
913 0 : if ( xChildText.is() )
914 : {
915 0 : sColumnDesc = sColumnDesc + xChildText->getText();
916 : }
917 0 : }
918 : }
919 :
920 0 : return sColumnDesc;
921 : }
922 :
923 0 : sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRowExtentAt(
924 : sal_Int32 nRow, sal_Int32 nColumn )
925 : throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
926 : {
927 0 : sal_Int32 nExtend = -1;
928 :
929 0 : SolarMutexGuard aGuard;
930 :
931 0 : CHECK_FOR_DEFUNC( XAccessibleTable )
932 :
933 0 : GetTableData().CheckRowAndCol( nRow, nColumn, this );
934 :
935 : Int32Set_Impl::const_iterator aSttCol(
936 0 : GetTableData().GetColumnIter( nColumn ) );
937 : Int32Set_Impl::const_iterator aSttRow(
938 0 : GetTableData().GetRowIter( nRow ) );
939 0 : const SwFrm *pCellFrm = GetTableData().GetCellAtPos( *aSttCol, *aSttRow,
940 0 : sal_False );
941 0 : if( pCellFrm )
942 : {
943 0 : sal_Int32 nBottom = pCellFrm->Frm().Bottom();
944 0 : nBottom -= GetFrm()->Frm().Top();
945 : Int32Set_Impl::const_iterator aEndRow(
946 0 : GetTableData().GetRows().upper_bound( nBottom ) );
947 : nExtend =
948 0 : static_cast< sal_Int32 >( ::std::distance( aSttRow, aEndRow ) );
949 : }
950 :
951 0 : return nExtend;
952 : }
953 :
954 0 : sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleColumnExtentAt(
955 : sal_Int32 nRow, sal_Int32 nColumn )
956 : throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
957 : {
958 0 : sal_Int32 nExtend = -1;
959 :
960 0 : SolarMutexGuard aGuard;
961 :
962 0 : CHECK_FOR_DEFUNC( XAccessibleTable )
963 :
964 0 : GetTableData().CheckRowAndCol( nRow, nColumn, this );
965 :
966 : Int32Set_Impl::const_iterator aSttCol(
967 0 : GetTableData().GetColumnIter( nColumn ) );
968 : Int32Set_Impl::const_iterator aSttRow(
969 0 : GetTableData().GetRowIter( nRow ) );
970 0 : const SwFrm *pCellFrm = GetTableData().GetCellAtPos( *aSttCol, *aSttRow,
971 0 : sal_False );
972 0 : if( pCellFrm )
973 : {
974 0 : sal_Int32 nRight = pCellFrm->Frm().Right();
975 0 : nRight -= GetFrm()->Frm().Left();
976 : Int32Set_Impl::const_iterator aEndCol(
977 0 : GetTableData().GetColumns().upper_bound( nRight ) );
978 : nExtend =
979 0 : static_cast< sal_Int32 >( ::std::distance( aSttCol, aEndCol ) );
980 : }
981 :
982 0 : return nExtend;
983 : }
984 :
985 : uno::Reference< XAccessibleTable > SAL_CALL
986 0 : SwAccessibleTable::getAccessibleRowHeaders( )
987 : throw (uno::RuntimeException)
988 : {
989 : // Row headers aren't supported
990 0 : return uno::Reference< XAccessibleTable >();
991 : }
992 :
993 : uno::Reference< XAccessibleTable > SAL_CALL
994 0 : SwAccessibleTable::getAccessibleColumnHeaders( )
995 : throw (uno::RuntimeException)
996 : {
997 : // #i87532# - assure that return accessible object is empty,
998 : // if no column header exists.
999 : SwAccessibleTableColHeaders* pTableColHeaders =
1000 0 : new SwAccessibleTableColHeaders( GetMap(), static_cast< const SwTabFrm *>( GetFrm() ) );
1001 0 : uno::Reference< XAccessibleTable > xTableColumnHeaders( pTableColHeaders );
1002 0 : if ( pTableColHeaders->getAccessibleChildCount() <= 0 )
1003 : {
1004 0 : return uno::Reference< XAccessibleTable >();
1005 : }
1006 :
1007 0 : return xTableColumnHeaders;
1008 : }
1009 :
1010 0 : uno::Sequence< sal_Int32 > SAL_CALL SwAccessibleTable::getSelectedAccessibleRows()
1011 : throw (uno::RuntimeException)
1012 : {
1013 0 : SolarMutexGuard aGuard;
1014 :
1015 0 : CHECK_FOR_DEFUNC( XAccessibleTable )
1016 :
1017 0 : const SwSelBoxes *pSelBoxes = GetSelBoxes();
1018 0 : if( pSelBoxes )
1019 : {
1020 0 : sal_Int32 nRows = GetTableData().GetRowCount();
1021 0 : SwAccAllTableSelHander_Impl aSelRows( nRows );
1022 :
1023 0 : GetTableData().GetSelection( 0, nRows, *pSelBoxes, aSelRows,
1024 0 : sal_False );
1025 :
1026 0 : return aSelRows.GetSelSequence();
1027 : }
1028 : else
1029 : {
1030 0 : return uno::Sequence< sal_Int32 >( 0 );
1031 0 : }
1032 : }
1033 :
1034 0 : uno::Sequence< sal_Int32 > SAL_CALL SwAccessibleTable::getSelectedAccessibleColumns()
1035 : throw (uno::RuntimeException)
1036 : {
1037 0 : SolarMutexGuard aGuard;
1038 :
1039 0 : CHECK_FOR_DEFUNC( XAccessibleTable )
1040 :
1041 0 : const SwSelBoxes *pSelBoxes = GetSelBoxes();
1042 0 : if( pSelBoxes )
1043 : {
1044 0 : sal_Int32 nCols = GetTableData().GetColumnCount();
1045 0 : SwAccAllTableSelHander_Impl aSelCols( nCols );
1046 :
1047 0 : GetTableData().GetSelection( 0, nCols, *pSelBoxes, aSelCols, sal_True );
1048 :
1049 0 : return aSelCols.GetSelSequence();
1050 : }
1051 : else
1052 : {
1053 0 : return uno::Sequence< sal_Int32 >( 0 );
1054 0 : }
1055 : }
1056 :
1057 0 : sal_Bool SAL_CALL SwAccessibleTable::isAccessibleRowSelected( sal_Int32 nRow )
1058 : throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
1059 : {
1060 0 : SolarMutexGuard aGuard;
1061 :
1062 0 : CHECK_FOR_DEFUNC( XAccessibleTable )
1063 :
1064 0 : GetTableData().CheckRowAndCol( nRow, 0, this );
1065 :
1066 : sal_Bool bRet;
1067 0 : const SwSelBoxes *pSelBoxes = GetSelBoxes();
1068 0 : if( pSelBoxes )
1069 : {
1070 0 : SwAccSingleTableSelHander_Impl aSelRow;
1071 0 : GetTableData().GetSelection( nRow, nRow+1, *pSelBoxes, aSelRow,
1072 0 : sal_False );
1073 0 : bRet = aSelRow.IsSelected();
1074 : }
1075 : else
1076 : {
1077 0 : bRet = sal_False;
1078 : }
1079 :
1080 0 : return bRet;
1081 : }
1082 :
1083 0 : sal_Bool SAL_CALL SwAccessibleTable::isAccessibleColumnSelected(
1084 : sal_Int32 nColumn )
1085 : throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
1086 : {
1087 0 : SolarMutexGuard aGuard;
1088 :
1089 0 : CHECK_FOR_DEFUNC( XAccessibleTable )
1090 :
1091 0 : GetTableData().CheckRowAndCol( 0, nColumn, this );
1092 :
1093 : sal_Bool bRet;
1094 0 : const SwSelBoxes *pSelBoxes = GetSelBoxes();
1095 0 : if( pSelBoxes )
1096 : {
1097 0 : SwAccSingleTableSelHander_Impl aSelCol;
1098 :
1099 0 : GetTableData().GetSelection( nColumn, nColumn+1, *pSelBoxes, aSelCol,
1100 0 : sal_True );
1101 0 : bRet = aSelCol.IsSelected();
1102 : }
1103 : else
1104 : {
1105 0 : bRet = sal_False;
1106 : }
1107 :
1108 0 : return bRet;
1109 : }
1110 :
1111 0 : uno::Reference< XAccessible > SAL_CALL SwAccessibleTable::getAccessibleCellAt(
1112 : sal_Int32 nRow, sal_Int32 nColumn )
1113 : throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
1114 : {
1115 0 : uno::Reference< XAccessible > xRet;
1116 :
1117 0 : SolarMutexGuard aGuard;
1118 :
1119 0 : CHECK_FOR_DEFUNC( XAccessibleTable )
1120 :
1121 : const SwFrm *pCellFrm =
1122 0 : GetTableData().GetCell( nRow, nColumn, sal_False, this );
1123 0 : if( pCellFrm )
1124 0 : xRet = GetMap()->GetContext( pCellFrm, sal_True );
1125 :
1126 0 : return xRet;
1127 : }
1128 :
1129 0 : uno::Reference< XAccessible > SAL_CALL SwAccessibleTable::getAccessibleCaption()
1130 : throw (uno::RuntimeException)
1131 : {
1132 : // captions aren't supported
1133 0 : return uno::Reference< XAccessible >();
1134 : }
1135 :
1136 0 : uno::Reference< XAccessible > SAL_CALL SwAccessibleTable::getAccessibleSummary()
1137 : throw (uno::RuntimeException)
1138 : {
1139 : // summaries aren't supported
1140 0 : return uno::Reference< XAccessible >();
1141 : }
1142 :
1143 0 : sal_Bool SAL_CALL SwAccessibleTable::isAccessibleSelected(
1144 : sal_Int32 nRow, sal_Int32 nColumn )
1145 : throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
1146 : {
1147 0 : sal_Bool bRet = sal_False;
1148 :
1149 0 : SolarMutexGuard aGuard;
1150 :
1151 0 : CHECK_FOR_DEFUNC( XAccessibleTable )
1152 :
1153 : const SwFrm *pFrm =
1154 0 : GetTableData().GetCell( nRow, nColumn, sal_False, this );
1155 0 : if( pFrm && pFrm->IsCellFrm() )
1156 : {
1157 0 : const SwSelBoxes *pSelBoxes = GetSelBoxes();
1158 0 : if( pSelBoxes )
1159 : {
1160 0 : const SwCellFrm *pCFrm = static_cast < const SwCellFrm * >( pFrm );
1161 : SwTableBox *pBox =
1162 0 : const_cast< SwTableBox *>( pCFrm->GetTabBox() );
1163 0 : bRet = pSelBoxes->find( pBox ) != pSelBoxes->end();
1164 : }
1165 : }
1166 :
1167 0 : return bRet;
1168 : }
1169 :
1170 0 : sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleIndex(
1171 : sal_Int32 nRow, sal_Int32 nColumn )
1172 : throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
1173 : {
1174 0 : sal_Int32 nRet = -1;
1175 :
1176 0 : SolarMutexGuard aGuard;
1177 :
1178 0 : CHECK_FOR_DEFUNC( XAccessibleTable )
1179 :
1180 0 : SwAccessibleChild aCell( GetTableData().GetCell( nRow, nColumn, sal_False, this ));
1181 0 : if ( aCell.IsValid() )
1182 : {
1183 0 : nRet = GetChildIndex( *(GetMap()), aCell );
1184 : }
1185 :
1186 0 : return nRet;
1187 : }
1188 :
1189 0 : sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRow( sal_Int32 nChildIndex )
1190 : throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
1191 : {
1192 0 : sal_Int32 nRet = -1;
1193 :
1194 0 : SolarMutexGuard aGuard;
1195 :
1196 0 : CHECK_FOR_DEFUNC( XAccessibleTable )
1197 :
1198 : // #i77106#
1199 0 : if ( ( nChildIndex < 0 ) ||
1200 0 : ( nChildIndex >= getAccessibleChildCount() ) )
1201 : {
1202 0 : throw lang::IndexOutOfBoundsException();
1203 : }
1204 :
1205 0 : SwAccessibleChild aCell( GetChild( *(GetMap()), nChildIndex ) );
1206 0 : if ( aCell.GetSwFrm() )
1207 : {
1208 0 : sal_Int32 nTop = aCell.GetSwFrm()->Frm().Top();
1209 0 : nTop -= GetFrm()->Frm().Top();
1210 : Int32Set_Impl::const_iterator aRow(
1211 0 : GetTableData().GetRows().lower_bound( nTop ) );
1212 : nRet = static_cast< sal_Int32 >( ::std::distance(
1213 0 : GetTableData().GetRows().begin(), aRow ) );
1214 : }
1215 : else
1216 : {
1217 : OSL_ENSURE( !aCell.IsValid(), "SwAccessibleTable::getAccessibleColumn:"
1218 : "aCell not expected to be valid.");
1219 :
1220 0 : throw lang::IndexOutOfBoundsException();
1221 : }
1222 :
1223 0 : return nRet;
1224 : }
1225 :
1226 0 : sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleColumn(
1227 : sal_Int32 nChildIndex )
1228 : throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
1229 : {
1230 0 : sal_Int32 nRet = -1;
1231 :
1232 0 : SolarMutexGuard aGuard;
1233 :
1234 0 : CHECK_FOR_DEFUNC( XAccessibleTable )
1235 :
1236 : // #i77106#
1237 0 : if ( ( nChildIndex < 0 ) ||
1238 0 : ( nChildIndex >= getAccessibleChildCount() ) )
1239 : {
1240 0 : throw lang::IndexOutOfBoundsException();
1241 : }
1242 :
1243 0 : SwAccessibleChild aCell( GetChild( *(GetMap()), nChildIndex ) );
1244 0 : if ( aCell.GetSwFrm() )
1245 : {
1246 0 : sal_Int32 nLeft = aCell.GetSwFrm()->Frm().Left();
1247 0 : nLeft -= GetFrm()->Frm().Left();
1248 : Int32Set_Impl::const_iterator aCol(
1249 0 : GetTableData().GetColumns().lower_bound( nLeft ) );
1250 : nRet = static_cast< sal_Int32 >( ::std::distance(
1251 0 : GetTableData().GetColumns().begin(), aCol ) );
1252 : }
1253 : else
1254 : {
1255 : OSL_ENSURE( !aCell.IsValid(), "SwAccessibleTable::getAccessibleColumn:"
1256 : "aCell not expected to be valid.");
1257 :
1258 0 : throw lang::IndexOutOfBoundsException();
1259 : }
1260 :
1261 0 : return nRet;
1262 : }
1263 :
1264 :
1265 0 : OUString SAL_CALL SwAccessibleTable::getImplementationName()
1266 : throw( uno::RuntimeException )
1267 : {
1268 0 : return OUString(sImplementationName);
1269 : }
1270 :
1271 0 : sal_Bool SAL_CALL SwAccessibleTable::supportsService(
1272 : const OUString& sTestServiceName)
1273 : throw (uno::RuntimeException)
1274 : {
1275 : return sTestServiceName.equalsAsciiL( sServiceName,
1276 0 : sizeof(sServiceName)-1 ) ||
1277 : sTestServiceName.equalsAsciiL( sAccessibleServiceName,
1278 0 : sizeof(sAccessibleServiceName)-1 );
1279 : }
1280 :
1281 0 : uno::Sequence< OUString > SAL_CALL SwAccessibleTable::getSupportedServiceNames()
1282 : throw( uno::RuntimeException )
1283 : {
1284 0 : uno::Sequence< OUString > aRet(2);
1285 0 : OUString* pArray = aRet.getArray();
1286 0 : pArray[0] = OUString( sServiceName );
1287 0 : pArray[1] = OUString( sAccessibleServiceName );
1288 0 : return aRet;
1289 : }
1290 :
1291 0 : void SwAccessibleTable::InvalidatePosOrSize( const SwRect& rOldBox )
1292 : {
1293 0 : SolarMutexGuard aGuard;
1294 :
1295 0 : if( HasTableData() )
1296 0 : GetTableData().SetTablePos( GetFrm()->Frm().Pos() );
1297 :
1298 0 : SwAccessibleContext::InvalidatePosOrSize( rOldBox );
1299 0 : }
1300 :
1301 2 : void SwAccessibleTable::Dispose( sal_Bool bRecursive )
1302 : {
1303 2 : SolarMutexGuard aGuard;
1304 :
1305 2 : if( GetRegisteredIn() )
1306 2 : GetRegisteredInNonConst()->Remove( this );
1307 :
1308 2 : SwAccessibleContext::Dispose( bRecursive );
1309 2 : }
1310 :
1311 2 : void SwAccessibleTable::DisposeChild( const SwAccessibleChild& rChildFrmOrObj,
1312 : sal_Bool bRecursive )
1313 : {
1314 2 : SolarMutexGuard aGuard;
1315 :
1316 2 : const SwFrm *pFrm = rChildFrmOrObj.GetSwFrm();
1317 : OSL_ENSURE( pFrm, "frame expected" );
1318 2 : if( HasTableData() )
1319 : {
1320 0 : FireTableChangeEvent( GetTableData() );
1321 0 : ClearTableData();
1322 : }
1323 :
1324 : // There are two reason why this method has been called. The first one
1325 : // is there is no context for pFrm. The method is then called by
1326 : // the map, and we have to call our superclass.
1327 : // The other situation is that we have been call by a call to get notified
1328 : // about its change. We then must not call the superclass
1329 4 : uno::Reference< XAccessible > xAcc( GetMap()->GetContext( pFrm, sal_False ) );
1330 2 : if( !xAcc.is() )
1331 2 : SwAccessibleContext::DisposeChild( rChildFrmOrObj, bRecursive );
1332 2 : }
1333 :
1334 0 : void SwAccessibleTable::InvalidateChildPosOrSize( const SwAccessibleChild& rChildFrmOrObj,
1335 : const SwRect& rOldBox )
1336 : {
1337 0 : SolarMutexGuard aGuard;
1338 :
1339 0 : if( HasTableData() )
1340 : {
1341 : OSL_ENSURE( !HasTableData() ||
1342 : GetFrm()->Frm().Pos() == GetTableData().GetTablePos(),
1343 : "table has invalid position" );
1344 0 : if( HasTableData() )
1345 : {
1346 0 : SwAccessibleTableData_Impl *pNewTableData = CreateNewTableData(); // #i77106#
1347 0 : if( !pNewTableData->CompareExtents( GetTableData() ) )
1348 : {
1349 0 : FireTableChangeEvent( GetTableData() );
1350 0 : ClearTableData();
1351 0 : mpTableData = pNewTableData;
1352 : }
1353 : else
1354 : {
1355 0 : delete pNewTableData;
1356 : }
1357 : }
1358 : }
1359 :
1360 : // #i013961# - always call super class method
1361 0 : SwAccessibleContext::InvalidateChildPosOrSize( rChildFrmOrObj, rOldBox );
1362 0 : }
1363 :
1364 :
1365 : // XAccessibleSelection
1366 :
1367 4 : void SAL_CALL SwAccessibleTable::selectAccessibleChild(
1368 : sal_Int32 nChildIndex )
1369 : throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
1370 : {
1371 4 : SolarMutexGuard aGuard;
1372 4 : CHECK_FOR_DEFUNC( XAccessibleTable );
1373 :
1374 4 : if( (nChildIndex < 0) || (nChildIndex >= getAccessibleChildCount()) ) // #i77106#
1375 0 : throw lang::IndexOutOfBoundsException();
1376 :
1377 : // preliminaries: get 'our' table box, and get the cursor shell
1378 4 : const SwTableBox* pBox = GetTableBox( nChildIndex );
1379 : OSL_ENSURE( pBox != NULL, "We need the table box." );
1380 :
1381 4 : SwCrsrShell* pCrsrShell = GetCrsrShell();
1382 4 : if( pCrsrShell == NULL )
1383 0 : return;
1384 :
1385 : // assure, that child, indentified by the given index, isn't already selected.
1386 4 : if ( IsChildSelected( nChildIndex ) )
1387 : {
1388 0 : return;
1389 : }
1390 :
1391 : // now we can start to do the work: check whether we already have
1392 : // a table selection (in 'our' table). If so, extend the
1393 : // selection, else select the current cell.
1394 :
1395 : // if we have a selection in a table, check if it's in the
1396 : // same table that we're trying to select in
1397 4 : const SwTableNode* pSelectedTable = pCrsrShell->IsCrsrInTbl();
1398 4 : if( pSelectedTable != NULL )
1399 : {
1400 : // get top-most table line
1401 3 : const SwTableLine* pUpper = pBox->GetUpper();
1402 6 : while( pUpper->GetUpper() != NULL )
1403 0 : pUpper = pUpper->GetUpper()->GetUpper();
1404 : sal_uInt16 nPos =
1405 3 : pSelectedTable->GetTable().GetTabLines().GetPos( pUpper );
1406 3 : if( nPos == USHRT_MAX )
1407 0 : pSelectedTable = NULL;
1408 : }
1409 :
1410 : // create the new selection
1411 4 : const SwStartNode* pStartNode = pBox->GetSttNd();
1412 4 : if( pSelectedTable == NULL || !pCrsrShell->GetTblCrs() )
1413 : {
1414 2 : pCrsrShell->StartAction();
1415 : // Set cursor into current cell. This deletes any table cursor.
1416 2 : SwPaM aPaM( *pStartNode );
1417 2 : aPaM.Move( fnMoveForward, fnGoNode );
1418 2 : Select( aPaM );
1419 : // Move cursor to the end of the table creating a selection and a table
1420 : // cursor.
1421 2 : pCrsrShell->SetMark();
1422 2 : pCrsrShell->MoveTable( fnTableCurr, fnTableEnd );
1423 : // now set the cursor into the cell again.
1424 2 : SwPaM *pPaM = pCrsrShell->GetTblCrs() ? pCrsrShell->GetTblCrs()
1425 2 : : pCrsrShell->GetCrsr();
1426 2 : *pPaM->GetPoint() = *pPaM->GetMark();
1427 2 : pCrsrShell->EndAction();
1428 : // we now have one cell selected!
1429 : }
1430 : else
1431 : {
1432 : // if the cursor is already in this table,
1433 : // expand the current selection (i.e., set
1434 : // point to new position; keep mark)
1435 2 : SwPaM aPaM( *pStartNode );
1436 2 : aPaM.Move( fnMoveForward, fnGoNode );
1437 2 : aPaM.SetMark();
1438 2 : const SwPaM *pPaM = pCrsrShell->GetTblCrs() ? pCrsrShell->GetTblCrs()
1439 2 : : pCrsrShell->GetCrsr();
1440 2 : *(aPaM.GetMark()) = *pPaM->GetMark();
1441 2 : Select( aPaM );
1442 :
1443 4 : }
1444 : }
1445 :
1446 :
1447 0 : sal_Bool SAL_CALL SwAccessibleTable::isAccessibleChildSelected(
1448 : sal_Int32 nChildIndex )
1449 : throw ( lang::IndexOutOfBoundsException,
1450 : uno::RuntimeException )
1451 : {
1452 0 : SolarMutexGuard aGuard;
1453 0 : CHECK_FOR_DEFUNC( XAccessibleTable );
1454 :
1455 0 : if( (nChildIndex < 0) || (nChildIndex >= getAccessibleChildCount()) ) // #i77106#
1456 0 : throw lang::IndexOutOfBoundsException();
1457 :
1458 0 : return IsChildSelected( nChildIndex );
1459 : }
1460 :
1461 2 : void SAL_CALL SwAccessibleTable::clearAccessibleSelection( )
1462 : throw ( uno::RuntimeException )
1463 : {
1464 2 : SolarMutexGuard aGuard;
1465 :
1466 2 : CHECK_FOR_DEFUNC( XAccessibleTable );
1467 :
1468 2 : SwCrsrShell* pCrsrShell = GetCrsrShell();
1469 2 : if( pCrsrShell != NULL )
1470 : {
1471 2 : pCrsrShell->StartAction();
1472 2 : pCrsrShell->ClearMark();
1473 2 : pCrsrShell->EndAction();
1474 2 : }
1475 2 : }
1476 :
1477 2 : void SAL_CALL SwAccessibleTable::selectAllAccessibleChildren( )
1478 : throw ( uno::RuntimeException )
1479 : {
1480 : // first clear selection, then select first and last child
1481 2 : clearAccessibleSelection();
1482 2 : selectAccessibleChild( 0 );
1483 2 : selectAccessibleChild( getAccessibleChildCount()-1 ); // #i77106#
1484 2 : }
1485 :
1486 0 : sal_Int32 SAL_CALL SwAccessibleTable::getSelectedAccessibleChildCount( )
1487 : throw ( uno::RuntimeException )
1488 : {
1489 0 : SolarMutexGuard aGuard;
1490 0 : CHECK_FOR_DEFUNC( XAccessibleTable );
1491 :
1492 : // iterate over all children and count isAccessibleChildSelected()
1493 0 : sal_Int32 nCount = 0;
1494 :
1495 0 : sal_Int32 nChildren = getAccessibleChildCount(); // #i71106#
1496 0 : for( sal_Int32 n = 0; n < nChildren; n++ )
1497 0 : if( IsChildSelected( n ) )
1498 0 : nCount++;
1499 :
1500 0 : return nCount;
1501 : }
1502 :
1503 0 : uno::Reference<XAccessible> SAL_CALL SwAccessibleTable::getSelectedAccessibleChild(
1504 : sal_Int32 nSelectedChildIndex )
1505 : throw ( lang::IndexOutOfBoundsException,
1506 : uno::RuntimeException)
1507 : {
1508 0 : SolarMutexGuard aGuard;
1509 0 : CHECK_FOR_DEFUNC( XAccessibleTable );
1510 :
1511 : // parameter checking (part 1): index lower 0
1512 0 : if( nSelectedChildIndex < 0 )
1513 0 : throw lang::IndexOutOfBoundsException();
1514 :
1515 0 : sal_Int32 nChildIndex = GetIndexOfSelectedChild( nSelectedChildIndex );
1516 :
1517 : // parameter checking (part 2): index higher than selected children?
1518 0 : if( nChildIndex < 0 )
1519 0 : throw lang::IndexOutOfBoundsException();
1520 :
1521 : // #i77106#
1522 0 : if ( nChildIndex >= getAccessibleChildCount() )
1523 : {
1524 0 : throw lang::IndexOutOfBoundsException();
1525 : }
1526 :
1527 0 : return getAccessibleChild( nChildIndex );
1528 : }
1529 :
1530 : // index has to be treated as global child index.
1531 0 : void SAL_CALL SwAccessibleTable::deselectAccessibleChild(
1532 : sal_Int32 nChildIndex )
1533 : throw ( lang::IndexOutOfBoundsException,
1534 : uno::RuntimeException )
1535 : {
1536 0 : SolarMutexGuard aGuard;
1537 0 : CHECK_FOR_DEFUNC( XAccessibleTable );
1538 :
1539 0 : SwCrsrShell* pCrsrShell = GetCrsrShell();
1540 :
1541 : // index has to be treated as global child index
1542 0 : if ( !pCrsrShell )
1543 0 : throw lang::IndexOutOfBoundsException();
1544 :
1545 : // assure, that given child index is in bounds.
1546 0 : if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) // #i77106#
1547 0 : throw lang::IndexOutOfBoundsException();
1548 :
1549 : // assure, that child, identified by the given index, is selected.
1550 0 : if ( !IsChildSelected( nChildIndex ) )
1551 0 : return;
1552 :
1553 0 : const SwTableBox* pBox = GetTableBox( nChildIndex );
1554 : OSL_ENSURE( pBox != NULL, "We need the table box." );
1555 :
1556 : // If we unselect point, then set cursor to mark. If we clear another
1557 : // selected box, then set cursor to point.
1558 : // reduce selection to mark.
1559 0 : SwPaM *pPaM = pCrsrShell->GetTblCrs() ? pCrsrShell->GetTblCrs()
1560 0 : : pCrsrShell->GetCrsr();
1561 : sal_Bool bDeselectPoint =
1562 0 : pBox->GetSttNd() ==
1563 0 : pPaM->GetPoint()->nNode.GetNode().FindTableBoxStartNode();
1564 :
1565 0 : SwPaM aPaM( bDeselectPoint ? *pPaM->GetMark() : *pPaM->GetPoint() );
1566 :
1567 0 : pCrsrShell->StartAction();
1568 :
1569 : // Set cursor into either point or mark
1570 0 : Select( aPaM );
1571 : // Move cursor to the end of the table creating a selection and a table
1572 : // cursor.
1573 0 : pCrsrShell->SetMark();
1574 0 : pCrsrShell->MoveTable( fnTableCurr, fnTableEnd );
1575 : // now set the cursor into the cell again.
1576 0 : pPaM = pCrsrShell->GetTblCrs() ? pCrsrShell->GetTblCrs()
1577 0 : : pCrsrShell->GetCrsr();
1578 0 : *pPaM->GetPoint() = *pPaM->GetMark();
1579 0 : pCrsrShell->EndAction();
1580 : }
1581 :
1582 : // #i77106# - implementation of class <SwAccessibleTableColHeaders>
1583 0 : SwAccessibleTableColHeaders::SwAccessibleTableColHeaders( SwAccessibleMap *pMap2,
1584 : const SwTabFrm *pTabFrm )
1585 0 : : SwAccessibleTable( pMap2, pTabFrm )
1586 : {
1587 0 : SolarMutexGuard aGuard;
1588 :
1589 0 : const SwFrmFmt *pFrmFmt = pTabFrm->GetFmt();
1590 0 : const_cast< SwFrmFmt * >( pFrmFmt )->Add( this );
1591 0 : const String& rName = pFrmFmt->GetName();
1592 :
1593 0 : SetName( OUString(rName) + "-ColumnHeaders-" + OUString::number( pTabFrm->GetPhyPageNum() ) );
1594 :
1595 0 : OUString sArg1( OUString(rName) + "-ColumnHeaders" );
1596 0 : OUString sArg2( GetFormattedPageNumber() );
1597 :
1598 0 : OUString sDesc2 = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );
1599 0 : SetDesc( sDesc2 );
1600 :
1601 0 : NotRegisteredAtAccessibleMap(); // #i85634#
1602 0 : }
1603 :
1604 0 : SwAccessibleTableData_Impl* SwAccessibleTableColHeaders::CreateNewTableData()
1605 : {
1606 0 : const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() );
1607 0 : return new SwAccessibleTableData_Impl( *(GetMap()), pTabFrm, IsInPagePreview(), true );
1608 : }
1609 :
1610 :
1611 0 : void SwAccessibleTableColHeaders::Modify( const SfxPoolItem * /*pOld*/, const SfxPoolItem * /*pNew*/ )
1612 : {
1613 0 : }
1614 :
1615 : // XInterface
1616 0 : uno::Any SAL_CALL SwAccessibleTableColHeaders::queryInterface( const uno::Type& aType )
1617 : throw (uno::RuntimeException)
1618 : {
1619 0 : return SwAccessibleTable::queryInterface( aType );
1620 : }
1621 :
1622 : // XAccessibleContext
1623 0 : sal_Int32 SAL_CALL SwAccessibleTableColHeaders::getAccessibleChildCount(void)
1624 : throw (uno::RuntimeException)
1625 : {
1626 0 : SolarMutexGuard aGuard;
1627 :
1628 0 : CHECK_FOR_DEFUNC( XAccessibleContext )
1629 :
1630 0 : sal_Int32 nCount = 0;
1631 :
1632 0 : const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( GetFrm() );
1633 0 : const SwAccessibleChildSList aVisList( GetVisArea(), *pTabFrm, *(GetMap()) );
1634 0 : SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
1635 0 : while( aIter != aVisList.end() )
1636 : {
1637 0 : const SwAccessibleChild& rLower = *aIter;
1638 0 : if( rLower.IsAccessible( IsInPagePreview() ) )
1639 : {
1640 0 : nCount++;
1641 : }
1642 0 : else if( rLower.GetSwFrm() )
1643 : {
1644 : // There are no unaccessible SdrObjects that count
1645 0 : if ( !rLower.GetSwFrm()->IsRowFrm() ||
1646 0 : pTabFrm->IsInHeadline( *(rLower.GetSwFrm()) ) )
1647 : {
1648 0 : nCount += SwAccessibleFrame::GetChildCount( *(GetMap()),
1649 0 : GetVisArea(),
1650 : rLower.GetSwFrm(),
1651 0 : IsInPagePreview() );
1652 : }
1653 : }
1654 0 : ++aIter;
1655 : }
1656 :
1657 0 : return nCount;
1658 : }
1659 :
1660 : uno::Reference< XAccessible> SAL_CALL
1661 0 : SwAccessibleTableColHeaders::getAccessibleChild (sal_Int32 nIndex)
1662 : throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
1663 : {
1664 0 : if ( nIndex < 0 || nIndex >= getAccessibleChildCount() )
1665 : {
1666 0 : throw lang::IndexOutOfBoundsException();
1667 : }
1668 :
1669 0 : return SwAccessibleTable::getAccessibleChild( nIndex );
1670 : }
1671 :
1672 : // XAccessibleTable
1673 : uno::Reference< XAccessibleTable >
1674 0 : SAL_CALL SwAccessibleTableColHeaders::getAccessibleRowHeaders()
1675 : throw (uno::RuntimeException)
1676 : {
1677 0 : return uno::Reference< XAccessibleTable >();
1678 : }
1679 :
1680 : uno::Reference< XAccessibleTable >
1681 0 : SAL_CALL SwAccessibleTableColHeaders::getAccessibleColumnHeaders()
1682 : throw (uno::RuntimeException)
1683 : {
1684 0 : return uno::Reference< XAccessibleTable >();
1685 : }
1686 :
1687 : // XServiceInfo
1688 :
1689 0 : OUString SAL_CALL SwAccessibleTableColHeaders::getImplementationName (void)
1690 : throw (uno::RuntimeException)
1691 : {
1692 : static const sal_Char sImplName[] = "com.sun.star.comp.Writer.SwAccessibleTableColumnHeadersView";
1693 0 : return OUString(sImplName);
1694 99 : }
1695 :
1696 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|