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.
904  SwAccessibleTableColHeaders* pTableColHeaders =
905  new SwAccessibleTableColHeaders(GetMap()->shared_from_this(),
906  static_cast<const SwTabFrame *>(GetFrame()));
907  uno::Reference< XAccessibleTable > xTableColumnHeaders( pTableColHeaders );
908  if ( pTableColHeaders->getAccessibleChildCount() <= 0 )
909  {
910  return uno::Reference< XAccessibleTable >();
911  }
912 
913  return xTableColumnHeaders;
914 }
915 
916 uno::Sequence< sal_Int32 > SAL_CALL SwAccessibleTable::getSelectedAccessibleRows()
917 {
918  SolarMutexGuard aGuard;
919 
920  ThrowIfDisposed();
921 
922  const SwSelBoxes *pSelBoxes = GetSelBoxes();
923  if( pSelBoxes )
924  {
925  sal_Int32 nRows = GetTableData().GetRowCount();
926  SwAccAllTableSelHandler_Impl aSelRows( nRows );
927 
928  GetTableData().GetSelection( 0, nRows, *pSelBoxes, aSelRows,
929  false );
930 
931  return aSelRows.GetSelSequence();
932  }
933  else
934  {
935  return uno::Sequence< sal_Int32 >( 0 );
936  }
937 }
938 
939 uno::Sequence< sal_Int32 > SAL_CALL SwAccessibleTable::getSelectedAccessibleColumns()
940 {
941  SolarMutexGuard aGuard;
942 
943  ThrowIfDisposed();
944 
945  const SwSelBoxes *pSelBoxes = GetSelBoxes();
946  if( pSelBoxes )
947  {
948  sal_Int32 nCols = GetTableData().GetColumnCount();
949  SwAccAllTableSelHandler_Impl aSelCols( nCols );
950 
951  GetTableData().GetSelection( 0, nCols, *pSelBoxes, aSelCols, true );
952 
953  return aSelCols.GetSelSequence();
954  }
955  else
956  {
957  return uno::Sequence< sal_Int32 >( 0 );
958  }
959 }
960 
962 {
963  SolarMutexGuard aGuard;
964 
965  ThrowIfDisposed();
966 
967  GetTableData().CheckRowAndCol( nRow, 0, this );
968 
969  bool bRet;
970  const SwSelBoxes *pSelBoxes = GetSelBoxes();
971  if( pSelBoxes )
972  {
973  SwAccSingleTableSelHandler_Impl aSelRow;
974  GetTableData().GetSelection( nRow, nRow+1, *pSelBoxes, aSelRow,
975  false );
976  bRet = aSelRow.IsSelected();
977  }
978  else
979  {
980  bRet = false;
981  }
982 
983  return bRet;
984 }
985 
987  sal_Int32 nColumn )
988 {
989  SolarMutexGuard aGuard;
990 
991  ThrowIfDisposed();
992 
993  GetTableData().CheckRowAndCol( 0, nColumn, this );
994 
995  bool bRet;
996  const SwSelBoxes *pSelBoxes = GetSelBoxes();
997  if( pSelBoxes )
998  {
999  SwAccSingleTableSelHandler_Impl aSelCol;
1000 
1001  GetTableData().GetSelection( nColumn, nColumn+1, *pSelBoxes, aSelCol,
1002  true );
1003  bRet = aSelCol.IsSelected();
1004  }
1005  else
1006  {
1007  bRet = false;
1008  }
1009 
1010  return bRet;
1011 }
1012 
1013 uno::Reference< XAccessible > SAL_CALL SwAccessibleTable::getAccessibleCellAt(
1014  sal_Int32 nRow, sal_Int32 nColumn )
1015 {
1016  uno::Reference< XAccessible > xRet;
1017 
1018  SolarMutexGuard aGuard;
1019 
1020  ThrowIfDisposed();
1021 
1022  const SwFrame *pCellFrame =
1023  GetTableData().GetCell( nRow, nColumn, this );
1024  if( pCellFrame )
1025  xRet = GetMap()->GetContext( pCellFrame );
1026 
1027  return xRet;
1028 }
1029 
1030 uno::Reference< XAccessible > SAL_CALL SwAccessibleTable::getAccessibleCaption()
1031 {
1032  // captions aren't supported
1033  return uno::Reference< XAccessible >();
1034 }
1035 
1036 uno::Reference< XAccessible > SAL_CALL SwAccessibleTable::getAccessibleSummary()
1037 {
1038  // summaries aren't supported
1039  return uno::Reference< XAccessible >();
1040 }
1041 
1043  sal_Int32 nRow, sal_Int32 nColumn )
1044 {
1045  bool bRet = false;
1046 
1047  SolarMutexGuard aGuard;
1048 
1049  ThrowIfDisposed();
1050 
1051  const SwFrame *pFrame =
1052  GetTableData().GetCell( nRow, nColumn, this );
1053  if( pFrame && pFrame->IsCellFrame() )
1054  {
1055  const SwSelBoxes *pSelBoxes = GetSelBoxes();
1056  if( pSelBoxes )
1057  {
1058  const SwCellFrame *pCFrame = static_cast < const SwCellFrame * >( pFrame );
1059  SwTableBox *pBox =
1060  const_cast< SwTableBox *>( pCFrame->GetTabBox() );
1061  bRet = pSelBoxes->find( pBox ) != pSelBoxes->end();
1062  }
1063  }
1064 
1065  return bRet;
1066 }
1067 
1069  sal_Int32 nRow, sal_Int32 nColumn )
1070 {
1071  sal_Int32 nRet = -1;
1072 
1073  SolarMutexGuard aGuard;
1074 
1075  ThrowIfDisposed();
1076 
1077  SwAccessibleChild aCell( GetTableData().GetCell( nRow, nColumn, this ));
1078  if ( aCell.IsValid() )
1079  {
1080  nRet = GetChildIndex( *(GetMap()), aCell );
1081  }
1082 
1083  return nRet;
1084 }
1085 
1086 sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRow( sal_Int32 nChildIndex )
1087 {
1088  sal_Int32 nRet = -1;
1089 
1090  SolarMutexGuard aGuard;
1091 
1092  ThrowIfDisposed();
1093 
1094  // #i77106#
1095  if ( ( nChildIndex < 0 ) ||
1096  ( nChildIndex >= getAccessibleChildCount() ) )
1097  {
1098  throw lang::IndexOutOfBoundsException();
1099  }
1100 
1101  SwAccessibleChild aCell( GetChild( *(GetMap()), nChildIndex ) );
1102  if ( aCell.GetSwFrame() )
1103  {
1104  sal_Int32 nTop = aCell.GetSwFrame()->getFrameArea().Top();
1105  nTop -= GetFrame()->getFrameArea().Top();
1107  GetTableData().GetRows().lower_bound( nTop ) );
1108  nRet = static_cast< sal_Int32 >( std::distance(
1109  GetTableData().GetRows().begin(), aRow ) );
1110  }
1111  else
1112  {
1113  OSL_ENSURE( !aCell.IsValid(), "SwAccessibleTable::getAccessibleColumn:"
1114  "aCell not expected to be valid.");
1115 
1116  throw lang::IndexOutOfBoundsException();
1117  }
1118 
1119  return nRet;
1120 }
1121 
1123  sal_Int32 nChildIndex )
1124 {
1125  sal_Int32 nRet = -1;
1126 
1127  SolarMutexGuard aGuard;
1128 
1129  ThrowIfDisposed();
1130 
1131  // #i77106#
1132  if ( ( nChildIndex < 0 ) ||
1133  ( nChildIndex >= getAccessibleChildCount() ) )
1134  {
1135  throw lang::IndexOutOfBoundsException();
1136  }
1137 
1138  SwAccessibleChild aCell( GetChild( *(GetMap()), nChildIndex ) );
1139  if ( aCell.GetSwFrame() )
1140  {
1141  sal_Int32 nLeft = aCell.GetSwFrame()->getFrameArea().Left();
1142  nLeft -= GetFrame()->getFrameArea().Left();
1144  GetTableData().GetColumns().lower_bound( nLeft ) );
1145  nRet = static_cast< sal_Int32 >( std::distance(
1146  GetTableData().GetColumns().begin(), aCol ) );
1147  }
1148  else
1149  {
1150  OSL_ENSURE( !aCell.IsValid(), "SwAccessibleTable::getAccessibleColumn:"
1151  "aCell not expected to be valid.");
1152 
1153  throw lang::IndexOutOfBoundsException();
1154  }
1155 
1156  return nRet;
1157 }
1158 
1160 {
1161  return "com.sun.star.comp.Writer.SwAccessibleTableView";
1162 }
1163 
1165  const OUString& sTestServiceName)
1166 {
1167  return cppu::supportsService(this, sTestServiceName);
1168 }
1169 
1170 uno::Sequence< OUString > SAL_CALL SwAccessibleTable::getSupportedServiceNames()
1171 {
1172  return { "com.sun.star.table.AccessibleTableView", sAccessibleServiceName };
1173 }
1174 
1176 {
1177  SolarMutexGuard aGuard;
1178 
1179  //need to update children
1180  std::unique_ptr<SwAccessibleTableData_Impl> pNewTableData = CreateNewTableData();
1181  if( !pNewTableData->CompareExtents( GetTableData() ) )
1182  {
1183  mpTableData = std::move(pNewTableData);
1185  }
1186  if( HasTableData() )
1187  GetTableData().SetTablePos( GetFrame()->getFrameArea().Pos() );
1188 
1190 }
1191 
1192 void SwAccessibleTable::Dispose(bool bRecursive, bool bCanSkipInvisible)
1193 {
1194  SolarMutexGuard aGuard;
1195  EndListeningAll();
1196  SwAccessibleContext::Dispose(bRecursive, bCanSkipInvisible);
1197 }
1198 
1199 void SwAccessibleTable::DisposeChild( const SwAccessibleChild& rChildFrameOrObj,
1200  bool bRecursive, bool bCanSkipInvisible )
1201 {
1202  SolarMutexGuard aGuard;
1203 
1204  const SwFrame *pFrame = rChildFrameOrObj.GetSwFrame();
1205  OSL_ENSURE( pFrame, "frame expected" );
1206  if( HasTableData() )
1207  {
1209  ClearTableData();
1210  }
1211 
1212  // There are two reason why this method has been called. The first one
1213  // is there is no context for pFrame. The method is then called by
1214  // the map, and we have to call our superclass.
1215  // The other situation is that we have been call by a call to get notified
1216  // about its change. We then must not call the superclass
1217  uno::Reference< XAccessible > xAcc( GetMap()->GetContext( pFrame, false ) );
1218  if( !xAcc.is() )
1219  SwAccessibleContext::DisposeChild( rChildFrameOrObj, bRecursive, bCanSkipInvisible );
1220 }
1221 
1222 void SwAccessibleTable::InvalidateChildPosOrSize( const SwAccessibleChild& rChildFrameOrObj,
1223  const SwRect& rOldBox )
1224 {
1225  SolarMutexGuard aGuard;
1226 
1227  if( HasTableData() )
1228  {
1230  GetFrame()->getFrameArea().Pos() != GetTableData().GetTablePos(),
1231  "sw.a11y", "table has invalid position" );
1232  if( HasTableData() )
1233  {
1234  std::unique_ptr<SwAccessibleTableData_Impl> pNewTableData = CreateNewTableData(); // #i77106#
1235  if( !pNewTableData->CompareExtents( GetTableData() ) )
1236  {
1237  if (pNewTableData->GetRowCount() != mpTableData->GetRowCount()
1238  && 1 < GetTableData().GetRowCount())
1239  {
1240  Int32Set_Impl::const_iterator aSttCol( GetTableData().GetColumnIter( 0 ) );
1241  Int32Set_Impl::const_iterator aSttRow( GetTableData().GetRowIter( 1 ) );
1242  const SwFrame *pCellFrame = GetTableData().GetCellAtPos( *aSttCol, *aSttRow );
1243  Int32Set_Impl::const_iterator aSttCol2( pNewTableData->GetColumnIter( 0 ) );
1244  Int32Set_Impl::const_iterator aSttRow2( pNewTableData->GetRowIter( 0 ) );
1245  const SwFrame *pCellFrame2 = pNewTableData->GetCellAtPos( *aSttCol2, *aSttRow2 );
1246 
1247  if(pCellFrame == pCellFrame2)
1248  {
1249  AccessibleTableModelChange aModelChange;
1250  aModelChange.Type = AccessibleTableModelChangeType::UPDATE;
1251  aModelChange.FirstRow = 0;
1252  aModelChange.LastRow = mpTableData->GetRowCount() - 1;
1253  aModelChange.FirstColumn = 0;
1254  aModelChange.LastColumn = mpTableData->GetColumnCount() - 1;
1255 
1256  AccessibleEventObject aEvent;
1257  aEvent.EventId = AccessibleEventId::TABLE_COLUMN_HEADER_CHANGED;
1258  aEvent.NewValue <<= aModelChange;
1259 
1260  FireAccessibleEvent( aEvent );
1261  }
1262  }
1263  else
1265  ClearTableData();
1266  mpTableData = std::move(pNewTableData);
1267  }
1268  }
1269  }
1270 
1271  // #i013961# - always call super class method
1272  SwAccessibleContext::InvalidateChildPosOrSize( rChildFrameOrObj, rOldBox );
1273 }
1274 
1275 // XAccessibleSelection
1276 
1278  sal_Int32 nChildIndex )
1279 {
1280  SolarMutexGuard aGuard;
1281 
1282  ThrowIfDisposed();
1283 
1284  if( (nChildIndex < 0) || (nChildIndex >= getAccessibleChildCount()) ) // #i77106#
1285  throw lang::IndexOutOfBoundsException();
1286 
1287  // preliminaries: get 'our' table box, and get the cursor shell
1288  const SwTableBox* pBox = GetTableBox( nChildIndex );
1289  OSL_ENSURE( pBox != nullptr, "We need the table box." );
1290 
1291  SwCursorShell* pCursorShell = GetCursorShell();
1292  if( pCursorShell == nullptr )
1293  return;
1294 
1295  // assure, that child, identified by the given index, isn't already selected.
1296  if ( IsChildSelected( nChildIndex ) )
1297  {
1298  return;
1299  }
1300 
1301  // now we can start to do the work: check whether we already have
1302  // a table selection (in 'our' table). If so, extend the
1303  // selection, else select the current cell.
1304 
1305  // if we have a selection in a table, check if it's in the
1306  // same table that we're trying to select in
1307  const SwTableNode* pSelectedTable = pCursorShell->IsCursorInTable();
1308  if( pSelectedTable != nullptr )
1309  {
1310  // get top-most table line
1311  const SwTableLine* pUpper = pBox->GetUpper();
1312  while( pUpper->GetUpper() != nullptr )
1313  pUpper = pUpper->GetUpper()->GetUpper();
1314  sal_uInt16 nPos =
1315  pSelectedTable->GetTable().GetTabLines().GetPos( pUpper );
1316  if( nPos == USHRT_MAX )
1317  pSelectedTable = nullptr;
1318  }
1319 
1320  // create the new selection
1321  const SwStartNode* pStartNode = pBox->GetSttNd();
1322  if( pSelectedTable == nullptr || !pCursorShell->GetTableCrs() )
1323  {
1324  pCursorShell->StartAction();
1325  // Set cursor into current cell. This deletes any table cursor.
1326  SwPaM aPaM( *pStartNode );
1327  aPaM.Move( fnMoveForward, GoInNode );
1328  Select( aPaM );
1329  // Move cursor to the end of the table creating a selection and a table
1330  // cursor.
1331  pCursorShell->SetMark();
1332  pCursorShell->MoveTable( GotoCurrTable, fnTableEnd );
1333  // now set the cursor into the cell again.
1334  SwPaM *pPaM = pCursorShell->GetTableCrs() ? pCursorShell->GetTableCrs()
1335  : pCursorShell->GetCursor();
1336  *pPaM->GetPoint() = *pPaM->GetMark();
1337  pCursorShell->EndAction();
1338  // we now have one cell selected!
1339  }
1340  else
1341  {
1342  // if the cursor is already in this table,
1343  // expand the current selection (i.e., set
1344  // point to new position; keep mark)
1345  SwPaM aPaM( *pStartNode );
1346  aPaM.Move( fnMoveForward, GoInNode );
1347  aPaM.SetMark();
1348  const SwPaM *pPaM = pCursorShell->GetTableCrs() ? pCursorShell->GetTableCrs()
1349  : pCursorShell->GetCursor();
1350  *(aPaM.GetMark()) = *pPaM->GetMark();
1351  Select( aPaM );
1352 
1353  }
1354 }
1355 
1357  sal_Int32 nChildIndex )
1358 {
1359  SolarMutexGuard aGuard;
1360 
1361  ThrowIfDisposed();
1362 
1363  if( (nChildIndex < 0) || (nChildIndex >= getAccessibleChildCount()) ) // #i77106#
1364  throw lang::IndexOutOfBoundsException();
1365 
1366  return IsChildSelected( nChildIndex );
1367 }
1368 
1370 {
1371  SolarMutexGuard aGuard;
1372 
1373  ThrowIfDisposed();
1374 
1375  SwCursorShell* pCursorShell = GetCursorShell();
1376  if( pCursorShell != nullptr )
1377  {
1378  pCursorShell->StartAction();
1379  pCursorShell->ClearMark();
1380  pCursorShell->EndAction();
1381  }
1382 }
1383 
1385 {
1386  // first clear selection, then select first and last child
1388  selectAccessibleChild( 0 );
1390 }
1391 
1393 {
1394  SolarMutexGuard aGuard;
1395 
1396  ThrowIfDisposed();
1397 
1398  // iterate over all children and count isAccessibleChildSelected()
1399  sal_Int32 nCount = 0;
1400 
1401  sal_Int32 nChildren = getAccessibleChildCount(); // #i71106#
1402  for( sal_Int32 n = 0; n < nChildren; n++ )
1403  if( IsChildSelected( n ) )
1404  nCount++;
1405 
1406  return nCount;
1407 }
1408 
1409 uno::Reference<XAccessible> SAL_CALL SwAccessibleTable::getSelectedAccessibleChild(
1410  sal_Int32 nSelectedChildIndex )
1411 {
1412  SolarMutexGuard aGuard;
1413 
1414  ThrowIfDisposed();
1415 
1416  // parameter checking (part 1): index lower 0
1417  if( nSelectedChildIndex < 0 )
1418  throw lang::IndexOutOfBoundsException();
1419 
1420  sal_Int32 nChildIndex = GetIndexOfSelectedChild( nSelectedChildIndex );
1421 
1422  // parameter checking (part 2): index higher than selected children?
1423  if( nChildIndex < 0 )
1424  throw lang::IndexOutOfBoundsException();
1425 
1426  // #i77106#
1427  if ( nChildIndex >= getAccessibleChildCount() )
1428  {
1429  throw lang::IndexOutOfBoundsException();
1430  }
1431 
1432  return getAccessibleChild( nChildIndex );
1433 }
1434 
1435 // index has to be treated as global child index.
1437  sal_Int32 nChildIndex )
1438 {
1439  SolarMutexGuard aGuard;
1440 
1441  ThrowIfDisposed();
1442 
1443  SwCursorShell* pCursorShell = GetCursorShell();
1444 
1445  // index has to be treated as global child index
1446  if ( !pCursorShell )
1447  throw lang::IndexOutOfBoundsException();
1448 
1449  // assure, that given child index is in bounds.
1450  if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) // #i77106#
1451  throw lang::IndexOutOfBoundsException();
1452 
1453  // assure, that child, identified by the given index, is selected.
1454  if ( !IsChildSelected( nChildIndex ) )
1455  return;
1456 
1457  const SwTableBox* pBox = GetTableBox( nChildIndex );
1458  OSL_ENSURE( pBox != nullptr, "We need the table box." );
1459 
1460  // If we unselect point, then set cursor to mark. If we clear another
1461  // selected box, then set cursor to point.
1462  // reduce selection to mark.
1463  SwPaM *pPaM = pCursorShell->GetTableCrs() ? pCursorShell->GetTableCrs()
1464  : pCursorShell->GetCursor();
1465  bool bDeselectPoint =
1466  pBox->GetSttNd() ==
1468 
1469  SwPaM aPaM( bDeselectPoint ? *pPaM->GetMark() : *pPaM->GetPoint() );
1470 
1471  pCursorShell->StartAction();
1472 
1473  // Set cursor into either point or mark
1474  Select( aPaM );
1475  // Move cursor to the end of the table creating a selection and a table
1476  // cursor.
1477  pCursorShell->SetMark();
1478  pCursorShell->MoveTable( GotoCurrTable, fnTableEnd );
1479  // now set the cursor into the cell again.
1480  pPaM = pCursorShell->GetTableCrs() ? pCursorShell->GetTableCrs()
1481  : pCursorShell->GetCursor();
1482  *pPaM->GetPoint() = *pPaM->GetMark();
1483  pCursorShell->EndAction();
1484 }
1485 
1487 {
1488  const SvxBrushItem &rBack = GetFrame()->GetAttrSet()->GetBackground();
1489  Color crBack = rBack.GetColor();
1490 
1491  if (COL_AUTO == crBack)
1492  {
1493  uno::Reference<XAccessible> xAccDoc = getAccessibleParent();
1494  if (xAccDoc.is())
1495  {
1496  uno::Reference<XAccessibleComponent> xComponentDoc(xAccDoc,uno::UNO_QUERY);
1497  if (xComponentDoc.is())
1498  {
1499  crBack = Color(xComponentDoc->getBackground());
1500  }
1501  }
1502  }
1503  return sal_Int32(crBack);
1504 }
1505 
1507 {
1508  AccessibleEventObject aEvent;
1509 
1510  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
1511 
1512  for (const auto& rCell : m_vecCellRemove)
1513  {
1514  // fdo#57197: check if the object is still alive
1515  uno::Reference<XAccessible> const xAcc(rCell.second);
1516  if (xAcc.is())
1517  {
1518  SwAccessibleContext *const pAccCell(rCell.first);
1519  assert(pAccCell);
1520  pAccCell->FireAccessibleEvent(aEvent);
1521  }
1522  }
1523 
1524  if (m_vecCellAdd.size() <= SELECTION_WITH_NUM)
1525  {
1526  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD;
1527  for (const auto& rCell : m_vecCellAdd)
1528  {
1529  // fdo#57197: check if the object is still alive
1530  uno::Reference<XAccessible> const xAcc(rCell.second);
1531  if (xAcc.is())
1532  {
1533  SwAccessibleContext *const pAccCell(rCell.first);
1534  assert(pAccCell);
1535  pAccCell->FireAccessibleEvent(aEvent);
1536  }
1537  }
1538  return ;
1539  }
1540  else
1541  {
1542  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
1543  FireAccessibleEvent(aEvent);
1544  }
1545 }
1546 
1548  SwAccessibleContext *const pAccCell, bool const bAddOrRemove)
1549 {
1550  uno::Reference<XAccessible> const xTmp(pAccCell);
1551  if (bAddOrRemove)
1552  {
1553  m_vecCellAdd.emplace_back(pAccCell, xTmp);
1554  }
1555  else
1556  {
1557  m_vecCellRemove.emplace_back(pAccCell, xTmp);
1558  }
1559 }
1560 
1561 // XAccessibleTableSelection
1562 sal_Bool SAL_CALL SwAccessibleTable::selectRow( sal_Int32 row )
1563 {
1564  SolarMutexGuard g;
1565 
1566  if( isAccessibleColumnSelected( row ) )
1567  return true;
1568 
1569  tools::Long lColumnCount = getAccessibleColumnCount();
1570  for(tools::Long lCol = 0; lCol < lColumnCount; lCol ++)
1571  {
1572  tools::Long lChildIndex = getAccessibleIndex(row, lCol);
1573  selectAccessibleChild(lChildIndex);
1574  }
1575 
1576  return true;
1577 }
1578 sal_Bool SAL_CALL SwAccessibleTable::selectColumn( sal_Int32 column )
1579 {
1580  SolarMutexGuard g;
1581 
1582  if( isAccessibleColumnSelected( column ) )
1583  return true;
1584 
1585  sal_Int32 lRowCount = getAccessibleRowCount();
1586 
1587  for(sal_Int32 lRow = 0; lRow < lRowCount; lRow ++)
1588  {
1589  sal_Int32 lChildIndex = getAccessibleIndex(lRow, column);
1590  selectAccessibleChild(lChildIndex);
1591  }
1592  return true;
1593 }
1594 
1595 sal_Bool SAL_CALL SwAccessibleTable::unselectRow( sal_Int32 row )
1596 {
1597  SolarMutexGuard g;
1598 
1599  if( isAccessibleSelected( row , 0 ) && isAccessibleSelected( row , getAccessibleColumnCount()-1 ) )
1600  {
1601  SwCursorShell* pCursorShell = GetCursorShell();
1602  if( pCursorShell != nullptr )
1603  {
1604  pCursorShell->StartAction();
1605  pCursorShell->ClearMark();
1606  pCursorShell->EndAction();
1607  return true;
1608  }
1609  }
1610  return true;
1611 }
1612 
1613 sal_Bool SAL_CALL SwAccessibleTable::unselectColumn( sal_Int32 column )
1614 {
1615  SolarMutexGuard g;
1616 
1617  if( isAccessibleSelected( 0 , column ) && isAccessibleSelected( getAccessibleRowCount()-1,column))
1618  {
1619  SwCursorShell* pCursorShell = GetCursorShell();
1620  if( pCursorShell != nullptr )
1621  {
1622  pCursorShell->StartAction();
1623  pCursorShell->ClearMark();
1624  pCursorShell->EndAction();
1625  return true;
1626  }
1627  }
1628  return true;
1629 }
1630 
1631 // #i77106# - implementation of class <SwAccessibleTableColHeaders>
1633  std::shared_ptr<SwAccessibleMap> const& pMap,
1634  const SwTabFrame *const pTabFrame)
1635  : SwAccessibleTable(pMap, pTabFrame)
1636 {
1637  SolarMutexGuard aGuard;
1638 
1639  const SwFrameFormat* pFrameFormat = pTabFrame->GetFormat();
1640  if(pFrameFormat)
1641  StartListening(const_cast<SwFrameFormat*>(pFrameFormat)->GetNotifier());
1642  const OUString aName = pFrameFormat->GetName() + "-ColumnHeaders";
1643 
1644  SetName( aName + "-" + OUString::number( pTabFrame->GetPhyPageNum() ) );
1645 
1646  const OUString sArg2( GetFormattedPageNumber() );
1647 
1648  SetDesc( GetResource( STR_ACCESS_TABLE_DESC, &aName, &sArg2 ) );
1649 
1650  NotRegisteredAtAccessibleMap(); // #i85634#
1651 }
1652 
1653 std::unique_ptr<SwAccessibleTableData_Impl> SwAccessibleTableColHeaders::CreateNewTableData()
1654 {
1655  const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>( GetFrame() );
1656  return std::unique_ptr<SwAccessibleTableData_Impl>(new SwAccessibleTableData_Impl( *(GetMap()), pTabFrame, IsInPagePreview(), true ));
1657 }
1658 
1660 {
1661 }
1662 
1663 // XInterface
1665 {
1666  return SwAccessibleTable::queryInterface( aType );
1667 }
1668 
1669 // XAccessibleContext
1671 {
1672  SolarMutexGuard aGuard;
1673 
1674  ThrowIfDisposed();
1675 
1676  sal_Int32 nCount = 0;
1677 
1678  const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>( GetFrame() );
1679  const SwAccessibleChildSList aVisList( GetVisArea(), *pTabFrame, *(GetMap()) );
1680  SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
1681  while( aIter != aVisList.end() )
1682  {
1683  const SwAccessibleChild& rLower = *aIter;
1684  if( rLower.IsAccessible( IsInPagePreview() ) )
1685  {
1686  nCount++;
1687  }
1688  else if( rLower.GetSwFrame() )
1689  {
1690  // There are no unaccessible SdrObjects that count
1691  if ( !rLower.GetSwFrame()->IsRowFrame() ||
1692  pTabFrame->IsInHeadline( *(rLower.GetSwFrame()) ) )
1693  {
1694  nCount += SwAccessibleFrame::GetChildCount( *(GetMap()),
1695  GetVisArea(),
1696  rLower.GetSwFrame(),
1697  IsInPagePreview() );
1698  }
1699  }
1700  ++aIter;
1701  }
1702 
1703  return nCount;
1704 }
1705 
1706 uno::Reference< XAccessible> SAL_CALL
1708 {
1709  if ( nIndex < 0 || nIndex >= getAccessibleChildCount() )
1710  {
1711  throw lang::IndexOutOfBoundsException();
1712  }
1713 
1714  return SwAccessibleTable::getAccessibleChild( nIndex );
1715 }
1716 
1717 // XAccessibleTable
1718 uno::Reference< XAccessibleTable >
1720 {
1721  return uno::Reference< XAccessibleTable >();
1722 }
1723 
1724 uno::Reference< XAccessibleTable >
1726 {
1727  return uno::Reference< XAccessibleTable >();
1728 }
1729 
1730 // XServiceInfo
1731 
1733 {
1734  static constexpr OUStringLiteral sImplName
1735  = u"com.sun.star.comp.Writer.SwAccessibleTableColumnHeadersView";
1736  return sImplName;
1737 }
1738 
1739 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Dispose(bool bRecursive, bool bCanSkipInvisible=true) override
Definition: acctable.cxx:1192
Starts a section of nodes in the document model.
Definition: node.hxx:311
Base class of the Writer layout elements.
Definition: frame.hxx:298
virtual sal_Bool SAL_CALL selectColumn(sal_Int32 column) override
Definition: acctable.cxx:1578
virtual OUString SAL_CALL getImplementationName() override
Returns an identifier for the implementation of this object.
Definition: acctable.cxx:1732
virtual sal_Bool SAL_CALL unselectRow(sal_Int32 row) override
Definition: acctable.cxx:1595
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:1384
sal_Int32 SAL_CALL getBackground() override
Definition: acctable.cxx:1486
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCaption() override
Definition: acctable.cxx:1030
bool IncludeRow(const SwFrame &rFrame) const
Definition: acctable.cxx:95
constexpr TypedWhichId< SwStringMsgPoolItem > RES_NAME_CHANGED(185)
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:190
virtual void SAL_CALL selectAccessibleChild(sal_Int32 nChildIndex) override
Definition: acctable.cxx:1277
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:1175
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:986
long Long
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: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:1164
Cells_t m_vecCellAdd
Definition: acctable.hxx:218
virtual std::unique_ptr< SwAccessibleTableData_Impl > CreateNewTableData() override
Definition: acctable.cxx:1653
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:1409
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:1159
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
constexpr::Color COL_AUTO(0xFF, 0xFF, 0xFF, 0xFF)
virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() override
Definition: acctable.cxx:1392
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:1068
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:132
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:961
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:1013
const SwTable & GetTable() const
Definition: node.hxx:500
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:1042
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:1664
virtual void SAL_CALL deselectAccessibleChild(sal_Int32 nChildIndex) override
Definition: acctable.cxx:1436
const Point & GetTablePos() const
Definition: acctable.cxx:130
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:502
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:1613
Style of a layout element.
Definition: frmfmt.hxx:58
int i
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:955
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:1707
const SwPosition * GetPoint() const
Definition: pam.hxx:207
void EndAction(const bool bIdleEnd=false, const bool DoSetPosX=false)
Definition: crsrsh.cxx:239
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:1547
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:1670
virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders() override
Definition: acctable.cxx:1725
virtual void DisposeChild(const sw::access::SwAccessibleChild &rFrameOrObj, bool bRecursive, bool bCanSkipInvisible) override
Definition: acctable.cxx:1199
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:222
virtual void InvalidateChildPosOrSize(const sw::access::SwAccessibleChild &rFrameOrObj, const SwRect &rFrame) override
Definition: acctable.cxx:1222
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:1719
virtual void SAL_CALL clearAccessibleSelection() override
Definition: acctable.cxx:1369
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:1694
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:1170
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:1086
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:1506
css::uno::Reference< css::accessibility::XAccessible > GetContext(const SwFrame *pFrame, bool bCreate=true)
Definition: accmap.cxx:1862
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:196
SwTableBox * GetUpper()
Definition: swtable.hxx:369
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:1036
virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int32 nChildIndex) override
Definition: acctable.cxx:1356
SwAccessibleTableColHeaders(std::shared_ptr< SwAccessibleMap > const &pMap, const SwTabFrame *pTabFrame)
Definition: acctable.cxx:1632
virtual sal_Int32 SAL_CALL getAccessibleColumn(sal_Int32 nChildIndex) override
Definition: acctable.cxx:1122
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:476
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:939
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:1659
sal_uInt16 nPos
std::vector< Value >::const_iterator const_iterator
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows() override
Definition: acctable.cxx:916
Int32Set_Impl maColumns
Definition: acctable.cxx:78
bool IsInHeadline(const SwFrame &rFrame) const
Definition: tabfrm.cxx:5529
virtual const SwFrameFormat * GetFormat() const
Definition: ssfrm.cxx:394
virtual sal_Bool SAL_CALL selectRow(sal_Int32 row) override
Definition: acctable.cxx:1562