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