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