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  const_cast< SwFrameFormat * >( pFrameFormat )->Add( this );
676 
677  SetName( pFrameFormat->GetName() + "-" + OUString::number( pTabFrame->GetPhyPageNum() ) );
678 
679  const OUString sArg1( static_cast< const SwTabFrame * >( GetFrame() )->GetFormat()->GetName() );
680  const OUString sArg2( GetFormattedPageNumber() );
681 
682  m_sDesc = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );
683  UpdateTableData();
684 }
685 
687 {
688  SolarMutexGuard aGuard;
689 
690  mpTableData.reset();
691 }
692 
693 void SwAccessibleTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
694 {
695  sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
696  const SwTabFrame *pTabFrame = static_cast< const SwTabFrame * >( GetFrame() );
697  switch( nWhich )
698  {
699  case RES_NAME_CHANGED:
700  if( pTabFrame )
701  {
702  const SwFrameFormat *pFrameFormat = pTabFrame->GetFormat();
703  OSL_ENSURE( pFrameFormat == GetRegisteredIn(), "invalid frame" );
704 
705  const OUString sOldName( GetName() );
706  const OUString sNewTabName = pFrameFormat->GetName();
707 
708  SetName( sNewTabName + "-" + OUString::number( pTabFrame->GetPhyPageNum() ) );
709 
710  if( sOldName != GetName() )
711  {
712  AccessibleEventObject aEvent;
713  aEvent.EventId = AccessibleEventId::NAME_CHANGED;
714  aEvent.OldValue <<= sOldName;
715  aEvent.NewValue <<= GetName();
716  FireAccessibleEvent( aEvent );
717  }
718 
719  const OUString sOldDesc( m_sDesc );
720  const OUString sArg2( GetFormattedPageNumber() );
721 
722  m_sDesc = GetResource( STR_ACCESS_TABLE_DESC, &sNewTabName, &sArg2 );
723  if( m_sDesc != sOldDesc )
724  {
725  AccessibleEventObject aEvent;
726  aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
727  aEvent.OldValue <<= sOldDesc;
728  aEvent.NewValue <<= m_sDesc;
729  FireAccessibleEvent( aEvent );
730  }
731  }
732  break;
733 
734  case RES_OBJECTDYING:
735  // mba: it seems that this class intentionally does not call code in base class SwClient
736  if( pOld && ( GetRegisteredIn() == static_cast< SwModify *>( static_cast< const SwPtrMsgPoolItem * >( pOld )->pObject ) ) )
737  EndListeningAll();
738  break;
739 
740  default:
741  // mba: former call to base class method removed as it is meant to handle only RES_OBJECTDYING
742  break;
743  }
744 }
745 
747 {
748  uno::Any aRet;
749  if ( rType == cppu::UnoType<XAccessibleTable>::get() )
750  {
751  uno::Reference<XAccessibleTable> xThis( this );
752  aRet <<= xThis;
753  }
754  else if ( rType == cppu::UnoType<XAccessibleSelection>::get() )
755  {
756  uno::Reference<XAccessibleSelection> xSelection( this );
757  aRet <<= xSelection;
758  }
759  else if ( rType == cppu::UnoType<XAccessibleTableSelection>::get() )
760  {
761  uno::Reference<XAccessibleTableSelection> xTableExtent( this );
762  aRet <<= xTableExtent;
763  }
764  else
765  {
766  aRet = SwAccessibleContext::queryInterface(rType);
767  }
768 
769  return aRet;
770 }
771 
772 // XTypeProvider
773 uno::Sequence< uno::Type > SAL_CALL SwAccessibleTable::getTypes()
774 {
775  return cppu::OTypeCollection(
778  SwAccessibleContext::getTypes() ).getTypes();
779 }
780 
781 uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleTable::getImplementationId()
782 {
783  return css::uno::Sequence<sal_Int8>();
784 }
785 
786 // #i77106#
787 std::unique_ptr<SwAccessibleTableData_Impl> SwAccessibleTable::CreateNewTableData()
788 {
789  const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>( GetFrame() );
790  return std::unique_ptr<SwAccessibleTableData_Impl>(new SwAccessibleTableData_Impl( *GetMap(), pTabFrame, IsInPagePreview() ));
791 }
792 
794 {
795  // #i77106# - usage of new method <CreateNewTableData()>
797 }
798 
800 {
801  mpTableData.reset();
802 }
803 
805 {
806  SolarMutexGuard aGuard;
807 
808  ThrowIfDisposed();
809 
810  return m_sDesc;
811 }
812 
814 {
815  SolarMutexGuard aGuard;
816 
817  ThrowIfDisposed();
818 
819  return GetTableData().GetRowCount();
820 }
821 
823 {
824  SolarMutexGuard aGuard;
825 
826  ThrowIfDisposed();
827 
828  return GetTableData().GetColumnCount();
829 }
830 
832  sal_Int32 nRow )
833 {
834  // #i87532# - determine table cell in <nRow>th row and
835  // in first column of row header table and return its text content.
836  OUString sRowDesc;
837 
838  GetTableData().CheckRowAndCol(nRow, 0, this);
839 
840  uno::Reference< XAccessibleTable > xTableRowHeader = getAccessibleRowHeaders();
841  if ( xTableRowHeader.is() )
842  {
843  uno::Reference< XAccessible > xRowHeaderCell =
844  xTableRowHeader->getAccessibleCellAt( nRow, 0 );
845  OSL_ENSURE( xRowHeaderCell.is(),
846  "<SwAccessibleTable::getAccessibleRowDescription(..)> - missing row header cell -> serious issue." );
847  uno::Reference< XAccessibleContext > xRowHeaderCellContext =
848  xRowHeaderCell->getAccessibleContext();
849  const sal_Int32 nCellChildCount( xRowHeaderCellContext->getAccessibleChildCount() );
850  for ( sal_Int32 nChildIndex = 0; nChildIndex < nCellChildCount; ++nChildIndex )
851  {
852  uno::Reference< XAccessible > xChild = xRowHeaderCellContext->getAccessibleChild( nChildIndex );
853  uno::Reference< XAccessibleText > xChildText( xChild, uno::UNO_QUERY );
854  if ( xChildText.is() )
855  {
856  sRowDesc = sRowDesc + xChildText->getText();
857  }
858  }
859  }
860 
861  return sRowDesc;
862 }
863 
865  sal_Int32 nColumn )
866 {
867  // #i87532# - determine table cell in first row and
868  // in <nColumn>th column of column header table and return its text content.
869  OUString sColumnDesc;
870 
871  GetTableData().CheckRowAndCol(0, nColumn, this);
872 
873  uno::Reference< XAccessibleTable > xTableColumnHeader = getAccessibleColumnHeaders();
874  if ( xTableColumnHeader.is() )
875  {
876  uno::Reference< XAccessible > xColumnHeaderCell =
877  xTableColumnHeader->getAccessibleCellAt( 0, nColumn );
878  OSL_ENSURE( xColumnHeaderCell.is(),
879  "<SwAccessibleTable::getAccessibleColumnDescription(..)> - missing column header cell -> serious issue." );
880  uno::Reference< XAccessibleContext > xColumnHeaderCellContext =
881  xColumnHeaderCell->getAccessibleContext();
882  const sal_Int32 nCellChildCount( xColumnHeaderCellContext->getAccessibleChildCount() );
883  for ( sal_Int32 nChildIndex = 0; nChildIndex < nCellChildCount; ++nChildIndex )
884  {
885  uno::Reference< XAccessible > xChild = xColumnHeaderCellContext->getAccessibleChild( nChildIndex );
886  uno::Reference< XAccessibleText > xChildText( xChild, uno::UNO_QUERY );
887  if ( xChildText.is() )
888  {
889  sColumnDesc = sColumnDesc + xChildText->getText();
890  }
891  }
892  }
893 
894  return sColumnDesc;
895 }
896 
898  sal_Int32 nRow, sal_Int32 nColumn )
899 {
900  sal_Int32 nExtend = -1;
901 
902  SolarMutexGuard aGuard;
903 
904  ThrowIfDisposed();
905 
906  UpdateTableData();
907  GetTableData().CheckRowAndCol( nRow, nColumn, this );
908 
910  GetTableData().GetColumnIter( nColumn ) );
912  GetTableData().GetRowIter( nRow ) );
913  const SwFrame *pCellFrame = GetTableData().GetCellAtPos( *aSttCol, *aSttRow );
914  if( pCellFrame )
915  {
916  sal_Int32 nBottom = pCellFrame->getFrameArea().Bottom();
917  nBottom -= GetFrame()->getFrameArea().Top();
919  GetTableData().GetRows().upper_bound( nBottom ) );
920  nExtend =
921  static_cast< sal_Int32 >( std::distance( aSttRow, aEndRow ) );
922  }
923 
924  return nExtend;
925 }
926 
928  sal_Int32 nRow, sal_Int32 nColumn )
929 {
930  sal_Int32 nExtend = -1;
931 
932  SolarMutexGuard aGuard;
933 
934  ThrowIfDisposed();
935  UpdateTableData();
936 
937  GetTableData().CheckRowAndCol( nRow, nColumn, this );
938 
940  GetTableData().GetColumnIter( nColumn ) );
942  GetTableData().GetRowIter( nRow ) );
943  const SwFrame *pCellFrame = GetTableData().GetCellAtPos( *aSttCol, *aSttRow );
944  if( pCellFrame )
945  {
946  sal_Int32 nRight = pCellFrame->getFrameArea().Right();
947  nRight -= GetFrame()->getFrameArea().Left();
949  GetTableData().GetColumns().upper_bound( nRight ) );
950  nExtend =
951  static_cast< sal_Int32 >( std::distance( aSttCol, aEndCol ) );
952  }
953 
954  return nExtend;
955 }
956 
957 uno::Reference< XAccessibleTable > SAL_CALL
959 {
960  // Row headers aren't supported
961  return uno::Reference< XAccessibleTable >();
962 }
963 
964 uno::Reference< XAccessibleTable > SAL_CALL
966 {
967  SolarMutexGuard aGuard;
968 
969  // #i87532# - assure that return accessible object is empty,
970  // if no column header exists.
971  SwAccessibleTableColHeaders* pTableColHeaders =
972  new SwAccessibleTableColHeaders(GetMap()->shared_from_this(),
973  static_cast<const SwTabFrame *>(GetFrame()));
974  uno::Reference< XAccessibleTable > xTableColumnHeaders( pTableColHeaders );
975  if ( pTableColHeaders->getAccessibleChildCount() <= 0 )
976  {
977  return uno::Reference< XAccessibleTable >();
978  }
979 
980  return xTableColumnHeaders;
981 }
982 
983 uno::Sequence< sal_Int32 > SAL_CALL SwAccessibleTable::getSelectedAccessibleRows()
984 {
985  SolarMutexGuard aGuard;
986 
987  ThrowIfDisposed();
988 
989  const SwSelBoxes *pSelBoxes = GetSelBoxes();
990  if( pSelBoxes )
991  {
992  sal_Int32 nRows = GetTableData().GetRowCount();
993  SwAccAllTableSelHander_Impl aSelRows( nRows );
994 
995  GetTableData().GetSelection( 0, nRows, *pSelBoxes, aSelRows,
996  false );
997 
998  return aSelRows.GetSelSequence();
999  }
1000  else
1001  {
1002  return uno::Sequence< sal_Int32 >( 0 );
1003  }
1004 }
1005 
1006 uno::Sequence< sal_Int32 > SAL_CALL SwAccessibleTable::getSelectedAccessibleColumns()
1007 {
1008  SolarMutexGuard aGuard;
1009 
1010  ThrowIfDisposed();
1011 
1012  const SwSelBoxes *pSelBoxes = GetSelBoxes();
1013  if( pSelBoxes )
1014  {
1015  sal_Int32 nCols = GetTableData().GetColumnCount();
1016  SwAccAllTableSelHander_Impl aSelCols( nCols );
1017 
1018  GetTableData().GetSelection( 0, nCols, *pSelBoxes, aSelCols, true );
1019 
1020  return aSelCols.GetSelSequence();
1021  }
1022  else
1023  {
1024  return uno::Sequence< sal_Int32 >( 0 );
1025  }
1026 }
1027 
1029 {
1030  SolarMutexGuard aGuard;
1031 
1032  ThrowIfDisposed();
1033 
1034  GetTableData().CheckRowAndCol( nRow, 0, this );
1035 
1036  bool bRet;
1037  const SwSelBoxes *pSelBoxes = GetSelBoxes();
1038  if( pSelBoxes )
1039  {
1041  GetTableData().GetSelection( nRow, nRow+1, *pSelBoxes, aSelRow,
1042  false );
1043  bRet = aSelRow.IsSelected();
1044  }
1045  else
1046  {
1047  bRet = false;
1048  }
1049 
1050  return bRet;
1051 }
1052 
1054  sal_Int32 nColumn )
1055 {
1056  SolarMutexGuard aGuard;
1057 
1058  ThrowIfDisposed();
1059 
1060  GetTableData().CheckRowAndCol( 0, nColumn, this );
1061 
1062  bool bRet;
1063  const SwSelBoxes *pSelBoxes = GetSelBoxes();
1064  if( pSelBoxes )
1065  {
1067 
1068  GetTableData().GetSelection( nColumn, nColumn+1, *pSelBoxes, aSelCol,
1069  true );
1070  bRet = aSelCol.IsSelected();
1071  }
1072  else
1073  {
1074  bRet = false;
1075  }
1076 
1077  return bRet;
1078 }
1079 
1080 uno::Reference< XAccessible > SAL_CALL SwAccessibleTable::getAccessibleCellAt(
1081  sal_Int32 nRow, sal_Int32 nColumn )
1082 {
1083  uno::Reference< XAccessible > xRet;
1084 
1085  SolarMutexGuard aGuard;
1086 
1087  ThrowIfDisposed();
1088 
1089  const SwFrame *pCellFrame =
1090  GetTableData().GetCell( nRow, nColumn, this );
1091  if( pCellFrame )
1092  xRet = GetMap()->GetContext( pCellFrame );
1093 
1094  return xRet;
1095 }
1096 
1097 uno::Reference< XAccessible > SAL_CALL SwAccessibleTable::getAccessibleCaption()
1098 {
1099  // captions aren't supported
1100  return uno::Reference< XAccessible >();
1101 }
1102 
1103 uno::Reference< XAccessible > SAL_CALL SwAccessibleTable::getAccessibleSummary()
1104 {
1105  // summaries aren't supported
1106  return uno::Reference< XAccessible >();
1107 }
1108 
1110  sal_Int32 nRow, sal_Int32 nColumn )
1111 {
1112  bool bRet = false;
1113 
1114  SolarMutexGuard aGuard;
1115 
1116  ThrowIfDisposed();
1117 
1118  const SwFrame *pFrame =
1119  GetTableData().GetCell( nRow, nColumn, this );
1120  if( pFrame && pFrame->IsCellFrame() )
1121  {
1122  const SwSelBoxes *pSelBoxes = GetSelBoxes();
1123  if( pSelBoxes )
1124  {
1125  const SwCellFrame *pCFrame = static_cast < const SwCellFrame * >( pFrame );
1126  SwTableBox *pBox =
1127  const_cast< SwTableBox *>( pCFrame->GetTabBox() );
1128  bRet = pSelBoxes->find( pBox ) != pSelBoxes->end();
1129  }
1130  }
1131 
1132  return bRet;
1133 }
1134 
1136  sal_Int32 nRow, sal_Int32 nColumn )
1137 {
1138  sal_Int32 nRet = -1;
1139 
1140  SolarMutexGuard aGuard;
1141 
1142  ThrowIfDisposed();
1143 
1144  SwAccessibleChild aCell( GetTableData().GetCell( nRow, nColumn, this ));
1145  if ( aCell.IsValid() )
1146  {
1147  nRet = GetChildIndex( *(GetMap()), aCell );
1148  }
1149 
1150  return nRet;
1151 }
1152 
1153 sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRow( sal_Int32 nChildIndex )
1154 {
1155  sal_Int32 nRet = -1;
1156 
1157  SolarMutexGuard aGuard;
1158 
1159  ThrowIfDisposed();
1160 
1161  // #i77106#
1162  if ( ( nChildIndex < 0 ) ||
1163  ( nChildIndex >= getAccessibleChildCount() ) )
1164  {
1165  throw lang::IndexOutOfBoundsException();
1166  }
1167 
1168  SwAccessibleChild aCell( GetChild( *(GetMap()), nChildIndex ) );
1169  if ( aCell.GetSwFrame() )
1170  {
1171  sal_Int32 nTop = aCell.GetSwFrame()->getFrameArea().Top();
1172  nTop -= GetFrame()->getFrameArea().Top();
1174  GetTableData().GetRows().lower_bound( nTop ) );
1175  nRet = static_cast< sal_Int32 >( std::distance(
1176  GetTableData().GetRows().begin(), aRow ) );
1177  }
1178  else
1179  {
1180  OSL_ENSURE( !aCell.IsValid(), "SwAccessibleTable::getAccessibleColumn:"
1181  "aCell not expected to be valid.");
1182 
1183  throw lang::IndexOutOfBoundsException();
1184  }
1185 
1186  return nRet;
1187 }
1188 
1190  sal_Int32 nChildIndex )
1191 {
1192  sal_Int32 nRet = -1;
1193 
1194  SolarMutexGuard aGuard;
1195 
1196  ThrowIfDisposed();
1197 
1198  // #i77106#
1199  if ( ( nChildIndex < 0 ) ||
1200  ( nChildIndex >= getAccessibleChildCount() ) )
1201  {
1202  throw lang::IndexOutOfBoundsException();
1203  }
1204 
1205  SwAccessibleChild aCell( GetChild( *(GetMap()), nChildIndex ) );
1206  if ( aCell.GetSwFrame() )
1207  {
1208  sal_Int32 nLeft = aCell.GetSwFrame()->getFrameArea().Left();
1209  nLeft -= GetFrame()->getFrameArea().Left();
1211  GetTableData().GetColumns().lower_bound( nLeft ) );
1212  nRet = static_cast< sal_Int32 >( std::distance(
1213  GetTableData().GetColumns().begin(), aCol ) );
1214  }
1215  else
1216  {
1217  OSL_ENSURE( !aCell.IsValid(), "SwAccessibleTable::getAccessibleColumn:"
1218  "aCell not expected to be valid.");
1219 
1220  throw lang::IndexOutOfBoundsException();
1221  }
1222 
1223  return nRet;
1224 }
1225 
1227 {
1228  return "com.sun.star.comp.Writer.SwAccessibleTableView";
1229 }
1230 
1232  const OUString& sTestServiceName)
1233 {
1234  return cppu::supportsService(this, sTestServiceName);
1235 }
1236 
1237 uno::Sequence< OUString > SAL_CALL SwAccessibleTable::getSupportedServiceNames()
1238 {
1239  return { "com.sun.star.table.AccessibleTableView", sAccessibleServiceName };
1240 }
1241 
1243 {
1244  SolarMutexGuard aGuard;
1245 
1246  //need to update children
1247  std::unique_ptr<SwAccessibleTableData_Impl> pNewTableData = CreateNewTableData();
1248  if( !pNewTableData->CompareExtents( GetTableData() ) )
1249  {
1250  mpTableData = std::move(pNewTableData);
1252  }
1253  if( HasTableData() )
1254  GetTableData().SetTablePos( GetFrame()->getFrameArea().Pos() );
1255 
1257 }
1258 
1259 void SwAccessibleTable::Dispose(bool bRecursive, bool bCanSkipInvisible)
1260 {
1261  SolarMutexGuard aGuard;
1262  EndListeningAll();
1263  SwAccessibleContext::Dispose(bRecursive, bCanSkipInvisible);
1264 }
1265 
1266 void SwAccessibleTable::DisposeChild( const SwAccessibleChild& rChildFrameOrObj,
1267  bool bRecursive, bool bCanSkipInvisible )
1268 {
1269  SolarMutexGuard aGuard;
1270 
1271  const SwFrame *pFrame = rChildFrameOrObj.GetSwFrame();
1272  OSL_ENSURE( pFrame, "frame expected" );
1273  if( HasTableData() )
1274  {
1276  ClearTableData();
1277  }
1278 
1279  // There are two reason why this method has been called. The first one
1280  // is there is no context for pFrame. The method is then called by
1281  // the map, and we have to call our superclass.
1282  // The other situation is that we have been call by a call to get notified
1283  // about its change. We then must not call the superclass
1284  uno::Reference< XAccessible > xAcc( GetMap()->GetContext( pFrame, false ) );
1285  if( !xAcc.is() )
1286  SwAccessibleContext::DisposeChild( rChildFrameOrObj, bRecursive, bCanSkipInvisible );
1287 }
1288 
1289 void SwAccessibleTable::InvalidateChildPosOrSize( const SwAccessibleChild& rChildFrameOrObj,
1290  const SwRect& rOldBox )
1291 {
1292  SolarMutexGuard aGuard;
1293 
1294  if( HasTableData() )
1295  {
1297  GetFrame()->getFrameArea().Pos() != GetTableData().GetTablePos(),
1298  "sw.a11y", "table has invalid position" );
1299  if( HasTableData() )
1300  {
1301  std::unique_ptr<SwAccessibleTableData_Impl> pNewTableData = CreateNewTableData(); // #i77106#
1302  if( !pNewTableData->CompareExtents( GetTableData() ) )
1303  {
1304  if (pNewTableData->GetRowCount() != mpTableData->GetRowCount()
1305  && 1 < GetTableData().GetRowCount())
1306  {
1307  Int32Set_Impl::const_iterator aSttCol( GetTableData().GetColumnIter( 0 ) );
1308  Int32Set_Impl::const_iterator aSttRow( GetTableData().GetRowIter( 1 ) );
1309  const SwFrame *pCellFrame = GetTableData().GetCellAtPos( *aSttCol, *aSttRow );
1310  Int32Set_Impl::const_iterator aSttCol2( pNewTableData->GetColumnIter( 0 ) );
1311  Int32Set_Impl::const_iterator aSttRow2( pNewTableData->GetRowIter( 0 ) );
1312  const SwFrame *pCellFrame2 = pNewTableData->GetCellAtPos( *aSttCol2, *aSttRow2 );
1313 
1314  if(pCellFrame == pCellFrame2)
1315  {
1316  AccessibleTableModelChange aModelChange;
1317  aModelChange.Type = AccessibleTableModelChangeType::UPDATE;
1318  aModelChange.FirstRow = 0;
1319  aModelChange.LastRow = mpTableData->GetRowCount() - 1;
1320  aModelChange.FirstColumn = 0;
1321  aModelChange.LastColumn = mpTableData->GetColumnCount() - 1;
1322 
1323  AccessibleEventObject aEvent;
1324  aEvent.EventId = AccessibleEventId::TABLE_COLUMN_HEADER_CHANGED;
1325  aEvent.NewValue <<= aModelChange;
1326 
1327  FireAccessibleEvent( aEvent );
1328  }
1329  }
1330  else
1332  ClearTableData();
1333  mpTableData = std::move(pNewTableData);
1334  }
1335  }
1336  }
1337 
1338  // #i013961# - always call super class method
1339  SwAccessibleContext::InvalidateChildPosOrSize( rChildFrameOrObj, rOldBox );
1340 }
1341 
1342 // XAccessibleSelection
1343 
1345  sal_Int32 nChildIndex )
1346 {
1347  SolarMutexGuard aGuard;
1348 
1349  ThrowIfDisposed();
1350 
1351  if( (nChildIndex < 0) || (nChildIndex >= getAccessibleChildCount()) ) // #i77106#
1352  throw lang::IndexOutOfBoundsException();
1353 
1354  // preliminaries: get 'our' table box, and get the cursor shell
1355  const SwTableBox* pBox = GetTableBox( nChildIndex );
1356  OSL_ENSURE( pBox != nullptr, "We need the table box." );
1357 
1358  SwCursorShell* pCursorShell = GetCursorShell();
1359  if( pCursorShell == nullptr )
1360  return;
1361 
1362  // assure, that child, identified by the given index, isn't already selected.
1363  if ( IsChildSelected( nChildIndex ) )
1364  {
1365  return;
1366  }
1367 
1368  // now we can start to do the work: check whether we already have
1369  // a table selection (in 'our' table). If so, extend the
1370  // selection, else select the current cell.
1371 
1372  // if we have a selection in a table, check if it's in the
1373  // same table that we're trying to select in
1374  const SwTableNode* pSelectedTable = pCursorShell->IsCursorInTable();
1375  if( pSelectedTable != nullptr )
1376  {
1377  // get top-most table line
1378  const SwTableLine* pUpper = pBox->GetUpper();
1379  while( pUpper->GetUpper() != nullptr )
1380  pUpper = pUpper->GetUpper()->GetUpper();
1381  sal_uInt16 nPos =
1382  pSelectedTable->GetTable().GetTabLines().GetPos( pUpper );
1383  if( nPos == USHRT_MAX )
1384  pSelectedTable = nullptr;
1385  }
1386 
1387  // create the new selection
1388  const SwStartNode* pStartNode = pBox->GetSttNd();
1389  if( pSelectedTable == nullptr || !pCursorShell->GetTableCrs() )
1390  {
1391  pCursorShell->StartAction();
1392  // Set cursor into current cell. This deletes any table cursor.
1393  SwPaM aPaM( *pStartNode );
1394  aPaM.Move( fnMoveForward, GoInNode );
1395  Select( aPaM );
1396  // Move cursor to the end of the table creating a selection and a table
1397  // cursor.
1398  pCursorShell->SetMark();
1399  pCursorShell->MoveTable( GotoCurrTable, fnTableEnd );
1400  // now set the cursor into the cell again.
1401  SwPaM *pPaM = pCursorShell->GetTableCrs() ? pCursorShell->GetTableCrs()
1402  : pCursorShell->GetCursor();
1403  *pPaM->GetPoint() = *pPaM->GetMark();
1404  pCursorShell->EndAction();
1405  // we now have one cell selected!
1406  }
1407  else
1408  {
1409  // if the cursor is already in this table,
1410  // expand the current selection (i.e., set
1411  // point to new position; keep mark)
1412  SwPaM aPaM( *pStartNode );
1413  aPaM.Move( fnMoveForward, GoInNode );
1414  aPaM.SetMark();
1415  const SwPaM *pPaM = pCursorShell->GetTableCrs() ? pCursorShell->GetTableCrs()
1416  : pCursorShell->GetCursor();
1417  *(aPaM.GetMark()) = *pPaM->GetMark();
1418  Select( aPaM );
1419 
1420  }
1421 }
1422 
1424  sal_Int32 nChildIndex )
1425 {
1426  SolarMutexGuard aGuard;
1427 
1428  ThrowIfDisposed();
1429 
1430  if( (nChildIndex < 0) || (nChildIndex >= getAccessibleChildCount()) ) // #i77106#
1431  throw lang::IndexOutOfBoundsException();
1432 
1433  return IsChildSelected( nChildIndex );
1434 }
1435 
1437 {
1438  SolarMutexGuard aGuard;
1439 
1440  ThrowIfDisposed();
1441 
1442  SwCursorShell* pCursorShell = GetCursorShell();
1443  if( pCursorShell != nullptr )
1444  {
1445  pCursorShell->StartAction();
1446  pCursorShell->ClearMark();
1447  pCursorShell->EndAction();
1448  }
1449 }
1450 
1452 {
1453  // first clear selection, then select first and last child
1455  selectAccessibleChild( 0 );
1457 }
1458 
1460 {
1461  SolarMutexGuard aGuard;
1462 
1463  ThrowIfDisposed();
1464 
1465  // iterate over all children and count isAccessibleChildSelected()
1466  sal_Int32 nCount = 0;
1467 
1468  sal_Int32 nChildren = getAccessibleChildCount(); // #i71106#
1469  for( sal_Int32 n = 0; n < nChildren; n++ )
1470  if( IsChildSelected( n ) )
1471  nCount++;
1472 
1473  return nCount;
1474 }
1475 
1476 uno::Reference<XAccessible> SAL_CALL SwAccessibleTable::getSelectedAccessibleChild(
1477  sal_Int32 nSelectedChildIndex )
1478 {
1479  SolarMutexGuard aGuard;
1480 
1481  ThrowIfDisposed();
1482 
1483  // parameter checking (part 1): index lower 0
1484  if( nSelectedChildIndex < 0 )
1485  throw lang::IndexOutOfBoundsException();
1486 
1487  sal_Int32 nChildIndex = GetIndexOfSelectedChild( nSelectedChildIndex );
1488 
1489  // parameter checking (part 2): index higher than selected children?
1490  if( nChildIndex < 0 )
1491  throw lang::IndexOutOfBoundsException();
1492 
1493  // #i77106#
1494  if ( nChildIndex >= getAccessibleChildCount() )
1495  {
1496  throw lang::IndexOutOfBoundsException();
1497  }
1498 
1499  return getAccessibleChild( nChildIndex );
1500 }
1501 
1502 // index has to be treated as global child index.
1504  sal_Int32 nChildIndex )
1505 {
1506  SolarMutexGuard aGuard;
1507 
1508  ThrowIfDisposed();
1509 
1510  SwCursorShell* pCursorShell = GetCursorShell();
1511 
1512  // index has to be treated as global child index
1513  if ( !pCursorShell )
1514  throw lang::IndexOutOfBoundsException();
1515 
1516  // assure, that given child index is in bounds.
1517  if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) // #i77106#
1518  throw lang::IndexOutOfBoundsException();
1519 
1520  // assure, that child, identified by the given index, is selected.
1521  if ( !IsChildSelected( nChildIndex ) )
1522  return;
1523 
1524  const SwTableBox* pBox = GetTableBox( nChildIndex );
1525  OSL_ENSURE( pBox != nullptr, "We need the table box." );
1526 
1527  // If we unselect point, then set cursor to mark. If we clear another
1528  // selected box, then set cursor to point.
1529  // reduce selection to mark.
1530  SwPaM *pPaM = pCursorShell->GetTableCrs() ? pCursorShell->GetTableCrs()
1531  : pCursorShell->GetCursor();
1532  bool bDeselectPoint =
1533  pBox->GetSttNd() ==
1535 
1536  SwPaM aPaM( bDeselectPoint ? *pPaM->GetMark() : *pPaM->GetPoint() );
1537 
1538  pCursorShell->StartAction();
1539 
1540  // Set cursor into either point or mark
1541  Select( aPaM );
1542  // Move cursor to the end of the table creating a selection and a table
1543  // cursor.
1544  pCursorShell->SetMark();
1545  pCursorShell->MoveTable( GotoCurrTable, fnTableEnd );
1546  // now set the cursor into the cell again.
1547  pPaM = pCursorShell->GetTableCrs() ? pCursorShell->GetTableCrs()
1548  : pCursorShell->GetCursor();
1549  *pPaM->GetPoint() = *pPaM->GetMark();
1550  pCursorShell->EndAction();
1551 }
1552 
1554 {
1555  const SvxBrushItem &rBack = GetFrame()->GetAttrSet()->GetBackground();
1556  Color crBack = rBack.GetColor();
1557 
1558  if (COL_AUTO == crBack)
1559  {
1560  uno::Reference<XAccessible> xAccDoc = getAccessibleParent();
1561  if (xAccDoc.is())
1562  {
1563  uno::Reference<XAccessibleComponent> xComponentDoc(xAccDoc,uno::UNO_QUERY);
1564  if (xComponentDoc.is())
1565  {
1566  crBack = Color(xComponentDoc->getBackground());
1567  }
1568  }
1569  }
1570  return sal_Int32(crBack);
1571 }
1572 
1574 {
1575  AccessibleEventObject aEvent;
1576 
1577  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
1578 
1579  for (const auto& rCell : m_vecCellRemove)
1580  {
1581  // fdo#57197: check if the object is still alive
1582  uno::Reference<XAccessible> const xAcc(rCell.second);
1583  if (xAcc.is())
1584  {
1585  SwAccessibleContext *const pAccCell(rCell.first);
1586  assert(pAccCell);
1587  pAccCell->FireAccessibleEvent(aEvent);
1588  }
1589  }
1590 
1591  if (m_vecCellAdd.size() <= SELECTION_WITH_NUM)
1592  {
1593  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD;
1594  for (const auto& rCell : m_vecCellAdd)
1595  {
1596  // fdo#57197: check if the object is still alive
1597  uno::Reference<XAccessible> const xAcc(rCell.second);
1598  if (xAcc.is())
1599  {
1600  SwAccessibleContext *const pAccCell(rCell.first);
1601  assert(pAccCell);
1602  pAccCell->FireAccessibleEvent(aEvent);
1603  }
1604  }
1605  return ;
1606  }
1607  else
1608  {
1609  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
1610  FireAccessibleEvent(aEvent);
1611  }
1612 }
1613 
1615  SwAccessibleContext *const pAccCell, bool const bAddOrRemove)
1616 {
1617  uno::Reference<XAccessible> const xTmp(pAccCell);
1618  if (bAddOrRemove)
1619  {
1620  m_vecCellAdd.emplace_back(pAccCell, xTmp);
1621  }
1622  else
1623  {
1624  m_vecCellRemove.emplace_back(pAccCell, xTmp);
1625  }
1626 }
1627 
1628 // XAccessibleTableSelection
1629 sal_Bool SAL_CALL SwAccessibleTable::selectRow( sal_Int32 row )
1630 {
1631  SolarMutexGuard g;
1632 
1633  if( isAccessibleColumnSelected( row ) )
1634  return true;
1635 
1636  long lColumnCount = getAccessibleColumnCount();
1637  for(long lCol = 0; lCol < lColumnCount; lCol ++)
1638  {
1639  long lChildIndex = getAccessibleIndex(row, lCol);
1640  selectAccessibleChild(lChildIndex);
1641  }
1642 
1643  return true;
1644 }
1645 sal_Bool SAL_CALL SwAccessibleTable::selectColumn( sal_Int32 column )
1646 {
1647  SolarMutexGuard g;
1648 
1649  if( isAccessibleColumnSelected( column ) )
1650  return true;
1651 
1652  long lRowCount = getAccessibleRowCount();
1653 
1654  for(long lRow = 0; lRow < lRowCount; lRow ++)
1655  {
1656  long lChildIndex = getAccessibleIndex(lRow, column);
1657  selectAccessibleChild(lChildIndex);
1658  }
1659  return true;
1660 }
1661 
1662 sal_Bool SAL_CALL SwAccessibleTable::unselectRow( sal_Int32 row )
1663 {
1664  SolarMutexGuard g;
1665 
1666  if( isAccessibleSelected( row , 0 ) && isAccessibleSelected( row , getAccessibleColumnCount()-1 ) )
1667  {
1668  SwCursorShell* pCursorShell = GetCursorShell();
1669  if( pCursorShell != nullptr )
1670  {
1671  pCursorShell->StartAction();
1672  pCursorShell->ClearMark();
1673  pCursorShell->EndAction();
1674  return true;
1675  }
1676  }
1677  return true;
1678 }
1679 
1680 sal_Bool SAL_CALL SwAccessibleTable::unselectColumn( sal_Int32 column )
1681 {
1682  SolarMutexGuard g;
1683 
1684  if( isAccessibleSelected( 0 , column ) && isAccessibleSelected( getAccessibleRowCount()-1,column))
1685  {
1686  SwCursorShell* pCursorShell = GetCursorShell();
1687  if( pCursorShell != nullptr )
1688  {
1689  pCursorShell->StartAction();
1690  pCursorShell->ClearMark();
1691  pCursorShell->EndAction();
1692  return true;
1693  }
1694  }
1695  return true;
1696 }
1697 
1698 // #i77106# - implementation of class <SwAccessibleTableColHeaders>
1700  std::shared_ptr<SwAccessibleMap> const& pMap,
1701  const SwTabFrame *const pTabFrame)
1702  : SwAccessibleTable(pMap, pTabFrame)
1703 {
1704  SolarMutexGuard aGuard;
1705 
1706  const SwFrameFormat *pFrameFormat = pTabFrame->GetFormat();
1707  const_cast< SwFrameFormat * >( pFrameFormat )->Add( this );
1708  const OUString aName = pFrameFormat->GetName() + "-ColumnHeaders";
1709 
1710  SetName( aName + "-" + OUString::number( pTabFrame->GetPhyPageNum() ) );
1711 
1712  const OUString sArg2( GetFormattedPageNumber() );
1713 
1714  SetDesc( GetResource( STR_ACCESS_TABLE_DESC, &aName, &sArg2 ) );
1715 
1716  NotRegisteredAtAccessibleMap(); // #i85634#
1717 }
1718 
1719 std::unique_ptr<SwAccessibleTableData_Impl> SwAccessibleTableColHeaders::CreateNewTableData()
1720 {
1721  const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>( GetFrame() );
1722  return std::unique_ptr<SwAccessibleTableData_Impl>(new SwAccessibleTableData_Impl( *(GetMap()), pTabFrame, IsInPagePreview(), true ));
1723 }
1724 
1725 void SwAccessibleTableColHeaders::Modify( const SfxPoolItem * /*pOld*/, const SfxPoolItem * /*pNew*/ )
1726 {
1727 }
1728 
1729 // XInterface
1731 {
1732  return SwAccessibleTable::queryInterface( aType );
1733 }
1734 
1735 // XAccessibleContext
1737 {
1738  SolarMutexGuard aGuard;
1739 
1740  ThrowIfDisposed();
1741 
1742  sal_Int32 nCount = 0;
1743 
1744  const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>( GetFrame() );
1745  const SwAccessibleChildSList aVisList( GetVisArea(), *pTabFrame, *(GetMap()) );
1746  SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
1747  while( aIter != aVisList.end() )
1748  {
1749  const SwAccessibleChild& rLower = *aIter;
1750  if( rLower.IsAccessible( IsInPagePreview() ) )
1751  {
1752  nCount++;
1753  }
1754  else if( rLower.GetSwFrame() )
1755  {
1756  // There are no unaccessible SdrObjects that count
1757  if ( !rLower.GetSwFrame()->IsRowFrame() ||
1758  pTabFrame->IsInHeadline( *(rLower.GetSwFrame()) ) )
1759  {
1760  nCount += SwAccessibleFrame::GetChildCount( *(GetMap()),
1761  GetVisArea(),
1762  rLower.GetSwFrame(),
1763  IsInPagePreview() );
1764  }
1765  }
1766  ++aIter;
1767  }
1768 
1769  return nCount;
1770 }
1771 
1772 uno::Reference< XAccessible> SAL_CALL
1774 {
1775  if ( nIndex < 0 || nIndex >= getAccessibleChildCount() )
1776  {
1777  throw lang::IndexOutOfBoundsException();
1778  }
1779 
1780  return SwAccessibleTable::getAccessibleChild( nIndex );
1781 }
1782 
1783 // XAccessibleTable
1784 uno::Reference< XAccessibleTable >
1786 {
1787  return uno::Reference< XAccessibleTable >();
1788 }
1789 
1790 uno::Reference< XAccessibleTable >
1792 {
1793  return uno::Reference< XAccessibleTable >();
1794 }
1795 
1796 // XServiceInfo
1797 
1799 {
1800  static const sal_Char sImplName[] = "com.sun.star.comp.Writer.SwAccessibleTableColumnHeadersView";
1801  return sImplName;
1802 }
1803 
1804 /* 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:1259
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:1645
virtual OUString SAL_CALL getImplementationName() override
Returns an identifier for the implementation of this object.
Definition: acctable.cxx:1798
virtual sal_Bool SAL_CALL unselectRow(sal_Int32 row) override
Definition: acctable.cxx:1662
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:440
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:1451
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:1553
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCaption() override
Definition: acctable.cxx:1097
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:1344
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:1242
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
Definition: acccontext.cxx:566
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:646
virtual OUString SAL_CALL getAccessibleRowDescription(sal_Int32 nRow) override
Definition: acctable.cxx:831
virtual sal_Bool SAL_CALL isAccessibleColumnSelected(sal_Int32 nColumn) override
Definition: acctable.cxx:1053
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 void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew) override
Definition: acctable.cxx:693
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: acctable.cxx:773
Int32Set_Impl::const_iterator GetRowIter(sal_Int32 nRow) const
Definition: acctable.cxx:415
const SwShellTableCursor * GetTableCursor() const
Definition: crsrsh.hxx:648
Cells_t m_vecCellRemove
Definition: acctable.hxx:222
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:118
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
Return whether the specified service is supported by this class.
Definition: acctable.cxx:1231
Cells_t m_vecCellAdd
Definition: acctable.hxx:221
virtual std::unique_ptr< SwAccessibleTableData_Impl > CreateNewTableData() override
Definition: acctable.cxx:1719
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:1476
SwAccAllTableSelHander_Impl(sal_Int32 nSize)
Definition: acctable.cxx:509
void UpdateTableData()
Definition: acctable.cxx:793
virtual OUString SAL_CALL getImplementationName() override
Returns an identifier for the implementation of this object.
Definition: acctable.cxx:1226
virtual sal_Int32 SAL_CALL getAccessibleRowCount() override
Definition: acctable.cxx:813
const unsigned int SELECTION_WITH_NUM
Definition: acctable.cxx:60
bool GotoCurrTable(SwPaM &rCurrentCursor, SwMoveFnCollection const &fnPosTable, bool bInReadOnly)
Definition: trvltbl.cxx:630
constexpr::Color COL_AUTO(0xFF, 0xFF, 0xFF, 0xFF)
virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() override
Definition: acctable.cxx:1459
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:51
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:1135
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:804
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:1028
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:1080
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:1109
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
void EndListeningAll()
Definition: calbck.cxx:124
virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew) override
Definition: acctable.cxx:1725
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
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:1730
virtual void SAL_CALL deselectAccessibleChild(sal_Int32 nChildIndex) override
Definition: acctable.cxx:1503
const Point & GetTablePos() const
Definition: acctable.cxx:134
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:481
SwAccessibleMap & mrAccMap
Definition: acctable.cxx:73
virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt(sal_Int32 nRow, sal_Int32 nColumn) override
Definition: acctable.cxx:897
const SwTableNode * IsCursorInTable() const
Definition: crsrsh.hxx:889
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:1680
Style of a layout element.
Definition: frmfmt.hxx:57
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:892
const SwPaM * GetTableCrs() const
Definition: crsrsh.hxx:904
Int32Set_Impl::const_iterator GetColumnIter(sal_Int32 nCol) const
Definition: acctable.cxx:427
std::unique_ptr< SwAccessibleTableData_Impl > mpTableData
Definition: acctable.hxx:50
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:1773
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:965
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:1614
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:641
void SetMark()
Definition: crsrsh.hxx:875
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
Return the number of currently visible children.
Definition: acctable.cxx:1736
virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders() override
Definition: acctable.cxx:1791
virtual void DisposeChild(const sw::access::SwAccessibleChild &rFrameOrObj, bool bRecursive, bool bCanSkipInvisible) override
Definition: acctable.cxx:1266
const_iterator end() const
virtual void InvalidatePosOrSize(const SwRect &rFrame)
const_iterator end() const
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32 nIndex) override
Definition: acccontext.cxx:576
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:927
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:1289
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:1785
virtual void SAL_CALL clearAccessibleSelection() override
Definition: acctable.cxx:1436
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:1689
OUString GetFormattedPageNumber() const
Definition: accframe.cxx:427
bool HasTableData() const
Definition: acctable.hxx:88
bool MoveTable(SwWhichTable, SwMoveFnCollection const &)
Definition: trvltbl.cxx:679
SwAccessibleTableData_Impl & GetTableData()
Definition: acctable.hxx:227
std::pair< sal_Int32, sal_Int32 > Int32Pair_Impl
Definition: acctable.cxx:58
void ClearTableData()
Definition: acctable.cxx:799
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Returns a list of all supported services.
Definition: acctable.cxx:1237
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:1153
virtual void GetStates(::utl::AccessibleStateSetHelper &rStateSet)
Definition: acccontext.cxx:478
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:746
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:157
bool const mbIsInPagePreview
Definition: acctable.cxx:79
virtual ~SwAccessibleTable() override
Definition: acctable.cxx:686
#define RES_NAME_CHANGED
Definition: hintids.hxx:310
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:1573
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:787
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
#define RES_OBJECTDYING
Definition: hintids.hxx:284
bool CompareExtents(const SwAccessibleTableData_Impl &r) const
Definition: acctable.cxx:392
virtual OUString SAL_CALL getAccessibleColumnDescription(sal_Int32 nColumn) override
Definition: acctable.cxx:864
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:1103
virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int32 nChildIndex) override
Definition: acctable.cxx:1423
SwAccessibleTableColHeaders(std::shared_ptr< SwAccessibleMap > const &pMap, const SwTabFrame *pTabFrame)
Definition: acctable.cxx:1699
std::vector< Int32Pair_Impl > maExtents
Definition: acctable.cxx:76
virtual sal_Int32 SAL_CALL getAccessibleColumn(sal_Int32 nChildIndex) override
Definition: acctable.cxx:1189
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:455
virtual sal_Int32 SAL_CALL getAccessibleColumnCount() override
Definition: acctable.cxx:822
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:958
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns() override
Definition: acctable.cxx:1006
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:781
const SwTabFrame * mpTabFrame
Definition: acctable.cxx:78
void SetName(const OUString &rName)
Definition: acccontext.hxx:99
sal_uInt16 Which() const
SwCellFrame is one table cell in the document layout.
Definition: cellfrm.hxx:30
long Y() const
void SetDesc(const OUString &sNewDesc)
Definition: acctable.hxx:71
std::vector< Value >::const_iterator const_iterator
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows() override
Definition: acctable.cxx:983
Int32Set_Impl maColumns
Definition: acctable.cxx:75
bool IsInHeadline(const SwFrame &rFrame) const
Definition: tabfrm.cxx:5333
virtual const SwFrameFormat * GetFormat() const
Definition: ssfrm.cxx:393
virtual sal_Bool SAL_CALL selectRow(sal_Int32 row) override
Definition: acctable.cxx:1629