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