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