LibreOffice Module sc (master)  1
AccessibleSpreadsheet.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 
21 #include <AccessibleCell.hxx>
22 #include <AccessibleDocument.hxx>
23 #include <tabvwsh.hxx>
24 #include <document.hxx>
25 #include <hints.hxx>
26 #include <scmod.hxx>
27 #include <markdata.hxx>
28 #include <gridwin.hxx>
29 
30 #include <o3tl/safeint.hxx>
33 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
34 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
35 #include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp>
36 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
37 #include <sal/log.hxx>
38 #include <tools/gen.hxx>
39 #include <svtools/colorcfg.hxx>
40 #include <vcl/svapp.hxx>
41 #include <scresid.hxx>
42 #include <strings.hrc>
43 
44 #include <algorithm>
45 #include <cstdlib>
46 
47 using namespace ::com::sun::star;
48 using namespace ::com::sun::star::accessibility;
49 
50 static bool CompMinCol(const std::pair<sal_uInt16,sal_uInt16> & pc1,const std::pair<sal_uInt16,sal_uInt16> &pc2)
51 {
52  return pc1.first < pc2.first;
53 }
54 
56 {
57  if (pMarkedRanges->size() <= 1)
58  {
59  ScRange const & rRange = pMarkedRanges->front();
60  // MT IA2: Not used.
61  // const int nRowNum = rRange.aEnd.Row() - rRange.aStart.Row() + 1;
62  const int nColNum = rRange.aEnd.Col() - rRange.aStart.Col() + 1;
63  const int nCurCol = nSelectedChildIndex % nColNum;
64  const int nCurRow = (nSelectedChildIndex - nCurCol)/nColNum;
65  return ScMyAddress(static_cast<SCCOL>(rRange.aStart.Col() + nCurCol), rRange.aStart.Row() + nCurRow, maActiveCell.Tab());
66  }
67  else
68  {
70  sal_Int32 nMinRow = pDoc->MaxRow();
71  sal_Int32 nMaxRow = 0;
72  std::vector<ScRange> aRanges;
73  size_t nSize = pMarkedRanges->size();
74  for (size_t i = 0; i < nSize; ++i)
75  {
76  ScRange const & rRange = (*pMarkedRanges)[i];
77  if (rRange.aStart.Tab() != rRange.aEnd.Tab())
78  {
79  if ((maActiveCell.Tab() >= rRange.aStart.Tab()) ||
80  maActiveCell.Tab() <= rRange.aEnd.Tab())
81  {
82  aRanges.push_back(rRange);
83  nMinRow = std::min(rRange.aStart.Row(),nMinRow);
84  nMaxRow = std::max(rRange.aEnd.Row(),nMaxRow);
85  }
86  else
87  SAL_WARN("sc", "Range of wrong table");
88  }
89  else if(rRange.aStart.Tab() == maActiveCell.Tab())
90  {
91  aRanges.push_back(rRange);
92  nMinRow = std::min(rRange.aStart.Row(),nMinRow);
93  nMaxRow = std::max(rRange.aEnd.Row(),nMaxRow);
94  }
95  else
96  SAL_WARN("sc", "Range of wrong table");
97  }
98  int nCurrentIndex = 0 ;
99  for(sal_Int32 row = nMinRow ; row <= nMaxRow ; ++row)
100  {
101  std::vector<std::pair<SCCOL, SCCOL>> aVecCol;
102  for (ScRange const & r : aRanges)
103  {
104  if ( row >= r.aStart.Row() && row <= r.aEnd.Row())
105  {
106  aVecCol.emplace_back(r.aStart.Col(), r.aEnd.Col());
107  }
108  }
109  std::sort(aVecCol.begin(), aVecCol.end(), CompMinCol);
110  for (const std::pair<SCCOL, SCCOL> &pairCol : aVecCol)
111  {
112  SCCOL nCol = pairCol.second - pairCol.first + 1;
113  if (nCol + nCurrentIndex > nSelectedChildIndex)
114  {
115  return ScMyAddress(static_cast<SCCOL>(pairCol.first + nSelectedChildIndex - nCurrentIndex), row, maActiveCell.Tab());
116  }
117  nCurrentIndex += nCol;
118  }
119  }
120  }
121  return ScMyAddress(0,0,maActiveCell.Tab());
122 }
123 
124 bool ScAccessibleSpreadsheet::CalcScRangeDifferenceMax(const ScRange & rSrc, const ScRange & rDest, int nMax,
125  std::vector<ScMyAddress> &vecRet, int &nSize)
126 {
127  //Src Must be :Src > Dest
128  if (rDest.Contains(rSrc))
129  {//Here is Src In Dest,Src <= Dest
130  return false;
131  }
132  if (!rDest.Intersects(rSrc))
133  {
134  int nCellCount = sal_uInt32(rDest.aEnd.Col() - rDest.aStart.Col() + 1)
135  * sal_uInt32(rDest.aEnd.Row() - rDest.aStart.Row() + 1)
136  * sal_uInt32(rDest.aEnd.Tab() - rDest.aStart.Tab() + 1);
137  if (nCellCount + nSize > nMax)
138  {
139  return true;
140  }
141  else if(nCellCount > 0)
142  {
143  for (sal_Int32 row = rDest.aStart.Row(); row <= rDest.aEnd.Row();++row)
144  {
145  for (sal_uInt16 col = rDest.aStart.Col(); col <= rDest.aEnd.Col();++col)
146  {
147  vecRet.emplace_back(col,row,rDest.aStart.Tab());
148  }
149  }
150  }
151  return false;
152  }
153  sal_Int32 nMinRow = rSrc.aStart.Row();
154  sal_Int32 nMaxRow = rSrc.aEnd.Row();
155  for (; nMinRow <= nMaxRow ; ++nMinRow,--nMaxRow)
156  {
157  for (sal_uInt16 col = rSrc.aStart.Col(); col <= rSrc.aEnd.Col();++col)
158  {
159  if (nSize > nMax)
160  {
161  return true;
162  }
163  ScMyAddress cell(col,nMinRow,rSrc.aStart.Tab());
164  if(!rDest.Contains(cell))
165  {//In Src ,Not In Dest
166  vecRet.push_back(cell);
167  ++nSize;
168  }
169  }
170  if (nMinRow != nMaxRow)
171  {
172  for (sal_uInt16 col = rSrc.aStart.Col(); col <= rSrc.aEnd.Col();++col)
173  {
174  if (nSize > nMax)
175  {
176  return true;
177  }
178  ScMyAddress cell(col,nMaxRow,rSrc.aStart.Tab());
179  if(!rDest.Contains(cell))
180  {//In Src ,Not In Dest
181  vecRet.push_back(cell);
182  ++nSize;
183  }
184  }
185  }
186  }
187  return false;
188 }
189 
190 //In Src , Not in Dest
192  int nMax, std::vector<ScMyAddress> &vecRet)
193 {
194  if (pSrc == nullptr || pDest == nullptr)
195  {
196  return false;
197  }
198  int nSize =0;
199  if (pDest->GetCellCount() == 0)//if the Dest Rang List is empty
200  {
201  if (pSrc->GetCellCount() > o3tl::make_unsigned(nMax))//if the Src Cell count is greater than nMax
202  {
203  return true;
204  }
205  //now the cell count is less than nMax
206  vecRet.reserve(10);
207  size_t nSrcSize = pSrc->size();
208  for (size_t i = 0; i < nSrcSize; ++i)
209  {
210  ScRange const & rRange = (*pSrc)[i];
211  for (sal_Int32 row = rRange.aStart.Row(); row <= rRange.aEnd.Row();++row)
212  {
213  for (sal_uInt16 col = rRange.aStart.Col(); col <= rRange.aEnd.Col();++col)
214  {
215  vecRet.emplace_back(col,row, rRange.aStart.Tab());
216  }
217  }
218  }
219  return false;
220  }
221  //the Dest Rang List is not empty
222  vecRet.reserve(10);
223  size_t nSizeSrc = pSrc->size();
224  for (size_t i = 0; i < nSizeSrc; ++i)
225  {
226  ScRange const & rRange = (*pSrc)[i];
227  size_t nSizeDest = pDest->size();
228  for (size_t j = 0; j < nSizeDest; ++j)
229  {
230  ScRange const & rRangeDest = (*pDest)[j];
231  if (CalcScRangeDifferenceMax(rRange,rRangeDest,nMax,vecRet,nSize))
232  {
233  return true;
234  }
235  }
236  }
237  return false;
238 }
239 
240 //===== internal ============================================================
241 
242 // FIXME: really unclear why we have an ScAccessibleTableBase with
243 // only this single sub-class
245  ScAccessibleDocument* pAccDoc,
246  ScTabViewShell* pViewShell,
247  SCTAB nTab,
248  ScSplitPos eSplitPos)
249  :
250  ScAccessibleTableBase( pAccDoc, GetDocument(pViewShell), ScRange( 0, 0, nTab, GetDocument(pViewShell)->MaxCol(), GetDocument(pViewShell)->MaxRow(), nTab)),
251  mbIsSpreadsheet( true ),
252  m_bFormulaMode( false ),
253  m_bFormulaLastMode( false ),
254  m_nMinX(0),m_nMaxX(0),m_nMinY(0),m_nMaxY(0)
255 {
256  ConstructScAccessibleSpreadsheet( pAccDoc, pViewShell, nTab, eSplitPos );
257 }
258 
260  ScAccessibleSpreadsheet& rParent, const ScRange& rRange ) :
261  ScAccessibleTableBase( rParent.mpAccDoc, rParent.mpDoc, rRange),
262  mbIsSpreadsheet( false ),
263  m_bFormulaMode( false ),
264  m_bFormulaLastMode( false ),
265  m_nMinX(0),m_nMaxX(0),m_nMinY(0),m_nMaxY(0)
266 {
267  ConstructScAccessibleSpreadsheet( rParent.mpAccDoc, rParent.mpViewShell, rParent.mnTab, rParent.meSplitPos );
268 }
269 
271 {
272  mpMarkedRanges.reset();
273  if (mpViewShell)
275 }
276 
278  ScAccessibleDocument* pAccDoc,
279  ScTabViewShell* pViewShell,
280  SCTAB nTab,
281  ScSplitPos eSplitPos)
282 {
283  mpViewShell = pViewShell;
284  mpMarkedRanges = nullptr;
285  mpAccDoc = pAccDoc;
286  mpAccCell.clear();
287  meSplitPos = eSplitPos;
288  mnTab = nTab;
289  mbDelIns = false;
290  mbIsFocusSend = false;
291  if (!mpViewShell)
292  return;
293 
295 
296  const ScViewData& rViewData = mpViewShell->GetViewData();
297  maActiveCell = rViewData.GetCurPos();
300  if (pScDoc)
301  {
302  pScDoc->GetName( maActiveCell.Tab(), m_strOldTabName );
303  }
304 }
305 
307 {
308  SolarMutexGuard aGuard;
309  if (mpViewShell)
310  {
312  mpViewShell = nullptr;
313  }
314  mpAccCell.clear();
315 
317 }
318 
320 {
321  if (IsFormulaMode())
322  {
323  return ;
324  }
325  mpMarkedRanges.reset();
326 
327  AccessibleEventObject aEvent;
328  aEvent.EventId = AccessibleEventId::STATE_CHANGED;
329  if (bNewState)
330  aEvent.NewValue <<= AccessibleStateType::SELECTED;
331  else
332  aEvent.OldValue <<= AccessibleStateType::SELECTED;
333  aEvent.Source = uno::Reference< XAccessibleContext >(this);
334 
335  CommitChange(aEvent);
336 }
337 
339 {
340  AccessibleEventObject aEvent;
341  aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
342  aEvent.Source = uno::Reference< XAccessibleContext >(this);
343  aEvent.OldValue <<= uno::Reference<XAccessible>(mpAccCell);
344 
345  CommitChange(aEvent);
346 
347  CommitFocusLost();
348 }
349 
351 {
353  AccessibleEventObject aEvent;
354  aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
355  aEvent.Source = uno::Reference< XAccessibleContext >(this);
356  uno::Reference< XAccessible > xNew;
357  if (IsFormulaMode())
358  {
360  {
361  ScAddress aFormulaAddr;
362  if(!GetFormulaCurrentFocusCell(aFormulaAddr))
363  {
364  return;
365  }
366  m_pAccFormulaCell = GetAccessibleCellAt(aFormulaAddr.Row(),aFormulaAddr.Col());
367  }
368  xNew = m_pAccFormulaCell.get();
369  }
370  else
371  {
372  if(mpAccCell->GetCellAddress() == maActiveCell)
373  {
374  xNew = mpAccCell.get();
375  }
376  else
377  {
379  return ;
380  }
381  }
382  aEvent.NewValue <<= xNew;
383 
384  CommitChange(aEvent);
385 }
386 
388 {
389  AccessibleEventObject aEvent;
390  aEvent.EventId = AccessibleEventId::BOUNDRECT_CHANGED;
391  aEvent.Source = uno::Reference< XAccessibleContext >(this);
392 
393  CommitChange(aEvent);
394 }
395 
397 {
398  AccessibleEventObject aEvent;
399  aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED;
400  aEvent.Source = uno::Reference< XAccessibleContext >(this);
401 
402  CommitChange(aEvent);
403 }
404 
405  //===== SfxListener =====================================================
406 
408 {
409  if ( auto pRefHint = dynamic_cast<const ScUpdateRefHint*>(&rHint) )
410  {
411  if (pRefHint->GetMode() == URM_INSDEL && pRefHint->GetDz() == 0) //test whether table is inserted or deleted
412  {
413  if (((pRefHint->GetRange().aStart.Col() == maRange.aStart.Col()) &&
414  (pRefHint->GetRange().aEnd.Col() == maRange.aEnd.Col())) ||
415  ((pRefHint->GetRange().aStart.Row() == maRange.aStart.Row()) &&
416  (pRefHint->GetRange().aEnd.Row() == maRange.aEnd.Row())))
417  {
418  // ignore next SfxHintId::ScDataChanged notification
419  mbDelIns = true;
420 
421  SCROW nFirstRow = -1;
422  SCROW nLastRow = -1;
423  SCCOL nFirstCol = -1;
424  SCCOL nLastCol = -1;
425 
426  sal_Int16 nId(0);
427  SCCOL nX(pRefHint->GetDx());
428  SCROW nY(pRefHint->GetDy());
429  ScRange aRange(pRefHint->GetRange());
430  if ((nX < 0) || (nY < 0))
431  {
432  assert(!((nX < 0) && (nY < 0)) && "should not be possible to remove row and column at the same time");
433 
434  // Range in the update hint is the range after the removed rows/columns;
435  // calculate indices for the removed ones from that
436  if (nX < 0)
437  {
438  nId = AccessibleTableModelChangeType::COLUMNS_REMOVED;
439  nFirstCol = aRange.aStart.Col() + nX;
440  nLastCol = aRange.aStart.Col() - 1;
441  }
442  else
443  {
444  nId = AccessibleTableModelChangeType::ROWS_REMOVED;
445  nFirstRow = aRange.aStart.Row() + nY;
446  nLastRow = aRange.aStart.Row() - 1;
447  }
448  }
449  else if ((nX > 0) || (nY > 0))
450  {
451  assert(!((nX > 0) && (nY > 0)) && "should not be possible to add row and column at the same time");
452 
453  // Range in the update hint is from first inserted row/column to last one in spreadsheet;
454  // calculate indices for the inserted ones from that
455  if (nX > 0)
456  {
457  nId = AccessibleTableModelChangeType::COLUMNS_INSERTED;
458  nFirstCol = aRange.aStart.Col();
459  nLastCol = aRange.aStart.Col() + nX - 1;
460  }
461  else
462  {
463  nId = AccessibleTableModelChangeType::ROWS_INSERTED;
464  nFirstRow = aRange.aStart.Row();
465  nLastRow = aRange.aStart.Row() + nY -1;
466  }
467  }
468  else
469  {
470  assert(false && "is it a deletion or an insertion?");
471  }
472 
473  CommitTableModelChange(nFirstRow, nFirstCol, nLastRow, nLastCol, nId);
474 
475  AccessibleEventObject aEvent;
476  aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
477  aEvent.Source = uno::Reference< XAccessibleContext >(this);
478  aEvent.NewValue <<= uno::Reference<XAccessible>(mpAccCell);
479 
480  CommitChange(aEvent);
481  }
482  }
483  }
484  else
485  {
486  if (rHint.GetId() == SfxHintId::ScAccCursorChanged)
487  {
488  if (mpViewShell)
489  {
490  ScViewData& rViewData = mpViewShell->GetViewData();
491 
492  m_bFormulaMode = rViewData.IsRefMode() || SC_MOD()->IsFormulaMode();
493  if ( m_bFormulaMode )
494  {
495  NotifyRefMode();
496  m_bFormulaLastMode = true;
497  return;
498  }
499  if (m_bFormulaLastMode)
500  {//Last Notify Mode Is Formula Mode.
501  m_vecFormulaLastMyAddr.clear();
503  m_pAccFormulaCell.clear();
504  //Remove All Selection
505  }
507 
508  AccessibleEventObject aEvent;
509  aEvent.Source = uno::Reference< XAccessible >(this);
510  ScAddress aNewCell = rViewData.GetCurPos();
511  if(aNewCell.Tab() != maActiveCell.Tab())
512  {
513  aEvent.EventId = AccessibleEventId::PAGE_CHANGED;
514  auto pAccParent = getAccessibleParent();
515  ScAccessibleDocument *pAccDoc =
516  static_cast<ScAccessibleDocument*>(pAccParent.get());
517  if(pAccDoc)
518  {
519  pAccDoc->CommitChange(aEvent);
520  }
521  }
522  bool bNewPosCell = (aNewCell != maActiveCell) || mpViewShell->GetForceFocusOnCurCell(); // #i123629#
523  bool bNewPosCellFocus=false;
524  if ( bNewPosCell && IsFocused() && aNewCell.Tab() == maActiveCell.Tab() )
525  {//single Focus
526  bNewPosCellFocus=true;
527  }
528  ScMarkData &refScMarkData = rViewData.GetMarkData();
529  // MT IA2: Not used
530  // int nSelCount = refScMarkData.GetSelectCount();
531  bool bIsMark =refScMarkData.IsMarked();
532  bool bIsMultMark = refScMarkData.IsMultiMarked();
533  bool bNewMarked = refScMarkData.GetTableSelect(aNewCell.Tab()) && ( bIsMark || bIsMultMark );
534 // sal_Bool bNewCellSelected = isAccessibleSelected(aNewCell.Row(), aNewCell.Col());
535  sal_uInt16 nTab = rViewData.GetTabNo();
536  const ScRange& aMarkRange = refScMarkData.GetMarkArea();
537  aEvent.OldValue.clear();
539  //Mark All
540  if ( !bNewPosCellFocus &&
541  (bNewMarked || bIsMark || bIsMultMark ) &&
542  aMarkRange == ScRange( 0,0,nTab, pDoc->MaxCol(),pDoc->MaxRow(),nTab ) )
543  {
544  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
545  aEvent.NewValue.clear();
546  CommitChange(aEvent);
547  return ;
548  }
549  if (!mpMarkedRanges)
550  {
551  mpMarkedRanges.reset(new ScRangeList());
552  }
553  refScMarkData.FillRangeListWithMarks(mpMarkedRanges.get(), true);
554 
555  //For Whole Col Row
556  bool bWholeRow = std::abs(aMarkRange.aStart.Row() - aMarkRange.aEnd.Row()) == pDoc->MaxRow() ;
557  bool bWholeCol = ::abs(aMarkRange.aStart.Col() - aMarkRange.aEnd.Col()) == pDoc->MaxCol() ;
558  if ((bNewMarked || bIsMark || bIsMultMark ) && (bWholeCol || bWholeRow))
559  {
560  if ( aMarkRange != m_aLastWithInMarkRange )
561  {
562  RemoveSelection(refScMarkData);
563  if(bNewPosCell)
564  {
565  CommitFocusCell(aNewCell);
566  }
567  bool bLastIsWholeColRow =
568  (std::abs(m_aLastWithInMarkRange.aStart.Row() - m_aLastWithInMarkRange.aEnd.Row()) == pDoc->MaxRow() && bWholeRow) ||
569  (::abs(m_aLastWithInMarkRange.aStart.Col() - m_aLastWithInMarkRange.aEnd.Col()) == pDoc->MaxCol() && bWholeCol);
570  bool bSelSmaller=
571  bLastIsWholeColRow &&
572  !aMarkRange.Contains(m_aLastWithInMarkRange) &&
574  if( !bSelSmaller )
575  {
576  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
577  aEvent.NewValue.clear();
578  CommitChange(aEvent);
579  }
580  m_aLastWithInMarkRange = aMarkRange;
581  }
582  return ;
583  }
584  m_aLastWithInMarkRange = aMarkRange;
585  int nNewMarkCount = mpMarkedRanges->GetCellCount();
586  bool bSendSingle= (0 == nNewMarkCount) && bNewPosCell;
587  if (bSendSingle)
588  {
589  RemoveSelection(refScMarkData);
590  if(bNewPosCellFocus)
591  {
592  CommitFocusCell(aNewCell);
593  }
594  uno::Reference< XAccessible > xChild ;
595  if (bNewPosCellFocus)
596  {
597  xChild = mpAccCell.get();
598  }
599  else
600  {
601  mpAccCell = GetAccessibleCellAt(aNewCell.Row(),aNewCell.Col());
602  xChild = mpAccCell.get();
603 
604  maActiveCell = aNewCell;
605  aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS;
606  aEvent.NewValue <<= xChild;
607  aEvent.OldValue <<= uno::Reference< XAccessible >();
608  CommitChange(aEvent);
609  }
610  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
611  aEvent.NewValue <<= xChild;
612  CommitChange(aEvent);
613  OSL_ASSERT(m_mapSelectionSend.count(aNewCell) == 0 );
614  m_mapSelectionSend.emplace(aNewCell,xChild);
615 
616  }
617  else
618  {
619  ScRange aDelRange;
620  bool bIsDel = rViewData.GetDelMark( aDelRange );
621  if ( (!bIsDel || aMarkRange != aDelRange) &&
622  bNewMarked &&
623  nNewMarkCount > 0 &&
625  {
626  RemoveSelection(refScMarkData);
627  if(bNewPosCellFocus)
628  {
629  CommitFocusCell(aNewCell);
630  }
631  std::vector<ScMyAddress> vecNew;
633  {
634  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
635  aEvent.NewValue.clear();
636  CommitChange(aEvent);
637  }
638  else
639  {
640  for(const auto& rAddr : vecNew)
641  {
642  uno::Reference< XAccessible > xChild = getAccessibleCellAt(rAddr.Row(),rAddr.Col());
643  if (!(bNewPosCellFocus && rAddr == aNewCell) )
644  {
645  aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS;
646  aEvent.NewValue <<= xChild;
647  CommitChange(aEvent);
648  }
649  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD;
650  aEvent.NewValue <<= xChild;
651  CommitChange(aEvent);
652  m_mapSelectionSend.emplace(rAddr,xChild);
653  }
654  }
655  }
656  }
657  if (bNewPosCellFocus && maActiveCell != aNewCell)
658  {
659  CommitFocusCell(aNewCell);
660  }
662  }
663  }
664  else if (rHint.GetId() == SfxHintId::ScDataChanged)
665  {
666  if (!mbDelIns)
667  CommitTableModelChange(maRange.aStart.Row(), maRange.aStart.Col(), maRange.aEnd.Row(), maRange.aEnd.Col(), AccessibleTableModelChangeType::UPDATE);
668  else
669  mbDelIns = false;
670  if (mpViewShell)
671  {
672  ScViewData& rViewData = mpViewShell->GetViewData();
673  ScAddress aNewCell = rViewData.GetCurPos();
674  if( maActiveCell == aNewCell)
675  {
677  if (pScDoc)
678  {
679  OUString valStr(pScDoc->GetString(aNewCell.Col(),aNewCell.Row(),aNewCell.Tab()));
680  if(m_strCurCellValue != valStr)
681  {
682  AccessibleEventObject aEvent;
683  aEvent.EventId = AccessibleEventId::VALUE_CHANGED;
684  mpAccCell->CommitChange(aEvent);
685  m_strCurCellValue=valStr;
686  }
687  OUString tabName;
688  pScDoc->GetName( maActiveCell.Tab(), tabName );
689  if( m_strOldTabName != tabName )
690  {
691  AccessibleEventObject aEvent;
692  aEvent.EventId = AccessibleEventId::NAME_CHANGED;
693  OUString sOldName(ScResId(STR_ACC_TABLE_NAME));
694  sOldName = sOldName.replaceFirst("%1", m_strOldTabName);
695  aEvent.OldValue <<= sOldName;
696  OUString sNewName(ScResId(STR_ACC_TABLE_NAME));
697  sNewName = sNewName.replaceFirst("%1", tabName);
698  aEvent.NewValue <<= sNewName;
699  CommitChange( aEvent );
700  m_strOldTabName = tabName;
701  }
702  }
703  }
704  }
705  }
706  // commented out, because to use a ModelChangeEvent is not the right way
707  // at the moment there is no way, but the Java/Gnome Api should be extended sometime
708 /* if (mpViewShell)
709  {
710  Rectangle aNewVisCells(GetVisCells(GetVisArea(mpViewShell, meSplitPos)));
711 
712  Rectangle aNewPos(aNewVisCells);
713 
714  if (aNewVisCells.Overlaps(maVisCells))
715  aNewPos.Union(maVisCells);
716  else
717  CommitTableModelChange(maVisCells.Top(), maVisCells.Left(), maVisCells.Bottom(), maVisCells.Right(), AccessibleTableModelChangeType::UPDATE);
718 
719  maVisCells = aNewVisCells;
720 
721  CommitTableModelChange(aNewPos.Top(), aNewPos.Left(), aNewPos.Bottom(), aNewPos.Right(), AccessibleTableModelChangeType::UPDATE);
722  }
723  }*/
724  }
725 
726  ScAccessibleTableBase::Notify(rBC, rHint);
727 }
728 
730 {
731  AccessibleEventObject aEvent;
732  aEvent.Source = uno::Reference< XAccessible >(this);
733  MAP_ADDR_XACC::iterator miRemove = m_mapSelectionSend.begin();
734  while (miRemove != m_mapSelectionSend.end())
735  {
736  if (refScMarkData.IsCellMarked(miRemove->first.Col(),miRemove->first.Row(),true) ||
737  refScMarkData.IsCellMarked(miRemove->first.Col(),miRemove->first.Row()) )
738  {
739  ++miRemove;
740  continue;
741  }
742  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
743  aEvent.NewValue <<= miRemove->second;
744  CommitChange(aEvent);
745  miRemove = m_mapSelectionSend.erase(miRemove);
746  }
747 }
749 {
750  OSL_ASSERT(!IsFormulaMode());
751  if(IsFormulaMode())
752  {
753  return ;
754  }
755  AccessibleEventObject aEvent;
756  aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
757  aEvent.Source = uno::Reference< XAccessible >(this);
758  aEvent.OldValue <<= uno::Reference<XAccessible>(mpAccCell);
759  mpAccCell.clear();
760  mpAccCell = GetAccessibleCellAt(aNewCell.Row(), aNewCell.Col());
761  aEvent.NewValue <<= uno::Reference<XAccessible>(mpAccCell);
762  maActiveCell = aNewCell;
764  if (pScDoc)
765  {
766  m_strCurCellValue = pScDoc->GetString(maActiveCell.Col(),maActiveCell.Row(),maActiveCell.Tab());
767  }
768  CommitChange(aEvent);
769 }
770 
771 //===== XAccessibleTable ================================================
772 
773 uno::Reference< XAccessibleTable > SAL_CALL ScAccessibleSpreadsheet::getAccessibleRowHeaders( )
774 {
775  SolarMutexGuard aGuard;
776  IsObjectValid();
777  uno::Reference< XAccessibleTable > xAccessibleTable;
778  if( mpDoc && mbIsSpreadsheet )
779  {
780  if( const ScRange* pRowRange = mpDoc->GetRepeatRowRange( mnTab ) )
781  {
782  SCROW nStart = pRowRange->aStart.Row();
783  SCROW nEnd = pRowRange->aEnd.Row();
785  if( (0 <= nStart) && (nStart <= nEnd) && (nEnd <= pDoc->MaxRow()) )
786  xAccessibleTable.set( new ScAccessibleSpreadsheet( *this, ScRange( 0, nStart, mnTab, pDoc->MaxCol(), nEnd, mnTab ) ) );
787  }
788  }
789  return xAccessibleTable;
790 }
791 
792 uno::Reference< XAccessibleTable > SAL_CALL ScAccessibleSpreadsheet::getAccessibleColumnHeaders( )
793 {
794  SolarMutexGuard aGuard;
795  IsObjectValid();
796  uno::Reference< XAccessibleTable > xAccessibleTable;
797  if( mpDoc && mbIsSpreadsheet )
798  {
799  if( const ScRange* pColRange = mpDoc->GetRepeatColRange( mnTab ) )
800  {
801  SCCOL nStart = pColRange->aStart.Col();
802  SCCOL nEnd = pColRange->aEnd.Col();
804  if( (0 <= nStart) && (nStart <= nEnd) && (nEnd <= pDoc->MaxCol()) )
805  xAccessibleTable.set( new ScAccessibleSpreadsheet( *this, ScRange( nStart, 0, mnTab, nEnd, pDoc->MaxRow(), mnTab ) ) );
806  }
807  }
808  return xAccessibleTable;
809 }
810 
811 uno::Sequence< sal_Int32 > SAL_CALL ScAccessibleSpreadsheet::getSelectedAccessibleRows( )
812 {
813  SolarMutexGuard aGuard;
814  IsObjectValid();
815  uno::Sequence<sal_Int32> aSequence;
816  if (IsFormulaMode())
817  {
818  return aSequence;
819  }
820  if (mpViewShell)
821  {
822  aSequence.realloc(maRange.aEnd.Row() - maRange.aStart.Row() + 1);
823  const ScMarkData& rMarkdata = mpViewShell->GetViewData().GetMarkData();
824  sal_Int32* pSequence = aSequence.getArray();
825  sal_Int32 nCount(0);
826  for (SCROW i = maRange.aStart.Row(); i <= maRange.aEnd.Row(); ++i)
827  {
828  if (rMarkdata.IsRowMarked(i))
829  {
830  pSequence[nCount] = i;
831  ++nCount;
832  }
833  }
834  aSequence.realloc(nCount);
835  }
836  else
837  aSequence.realloc(0);
838  return aSequence;
839 }
840 
841 uno::Sequence< sal_Int32 > SAL_CALL ScAccessibleSpreadsheet::getSelectedAccessibleColumns( )
842 {
843  SolarMutexGuard aGuard;
844  IsObjectValid();
845  uno::Sequence<sal_Int32> aSequence;
846  if (IsFormulaMode() || !mpViewShell)
847  return aSequence;
848 
849  aSequence.realloc(maRange.aEnd.Col() - maRange.aStart.Col() + 1);
850  sal_Int32* pSequence = aSequence.getArray();
851  sal_Int32 nCount(0);
852  const ScMarkData& rMarkdata = mpViewShell->GetViewData().GetMarkData();
853  for (SCCOL i = maRange.aStart.Col(); i <= maRange.aEnd.Col(); ++i)
854  {
855  if (rMarkdata.IsColumnMarked(i))
856  {
857  pSequence[nCount] = i;
858  ++nCount;
859  }
860  }
861  aSequence.realloc(nCount);
862  return aSequence;
863 }
864 
866 {
867  SolarMutexGuard aGuard;
868  IsObjectValid();
869  if (IsFormulaMode())
870  {
871  return false;
872  }
873 
874  if ((nRow > (maRange.aEnd.Row() - maRange.aStart.Row())) || (nRow < 0))
875  throw lang::IndexOutOfBoundsException();
876 
877  bool bResult(false);
878  if (mpViewShell)
879  {
880  const ScMarkData& rMarkdata = mpViewShell->GetViewData().GetMarkData();
881  bResult = rMarkdata.IsRowMarked(static_cast<SCROW>(nRow));
882  }
883  return bResult;
884 }
885 
887 {
888  SolarMutexGuard aGuard;
889  IsObjectValid();
890 
891  if (IsFormulaMode())
892  {
893  return false;
894  }
895  if ((nColumn > (maRange.aEnd.Col() - maRange.aStart.Col())) || (nColumn < 0))
896  throw lang::IndexOutOfBoundsException();
897 
898  bool bResult(false);
899  if (mpViewShell)
900  {
901  const ScMarkData& rMarkdata = mpViewShell->GetViewData().GetMarkData();
902  bResult = rMarkdata.IsColumnMarked(static_cast<SCCOL>(nColumn));
903  }
904  return bResult;
905 }
906 
908 {
909  if (IsFormulaMode())
910  {
911  ScAddress aCellAddress(static_cast<SCCOL>(nColumn), nRow, mpViewShell->GetViewData().GetTabNo());
912  if ((aCellAddress == m_aFormulaActiveCell) && m_pAccFormulaCell.is())
913  {
914  return m_pAccFormulaCell;
915  }
916  else
917  return ScAccessibleCell::create(this, mpViewShell, aCellAddress, GetAccessibleIndexFormula(nRow, nColumn), meSplitPos, mpAccDoc);
918  }
919  else
920  {
921  ScAddress aCellAddress(static_cast<SCCOL>(maRange.aStart.Col() + nColumn),
922  static_cast<SCROW>(maRange.aStart.Row() + nRow), maRange.aStart.Tab());
923  if ((aCellAddress == maActiveCell) && mpAccCell.is())
924  {
925  return mpAccCell;
926  }
927  else
928  return ScAccessibleCell::create(this, mpViewShell, aCellAddress, getAccessibleIndex(nRow, nColumn), meSplitPos, mpAccDoc);
929  }
930 }
931 
932 uno::Reference< XAccessible > SAL_CALL ScAccessibleSpreadsheet::getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
933 {
934  SolarMutexGuard aGuard;
935  IsObjectValid();
936  if (!IsFormulaMode())
937  {
938  if (nRow > (maRange.aEnd.Row() - maRange.aStart.Row()) ||
939  nRow < 0 ||
940  nColumn > (maRange.aEnd.Col() - maRange.aStart.Col()) ||
941  nColumn < 0)
942  throw lang::IndexOutOfBoundsException();
943  }
944  rtl::Reference<ScAccessibleCell> pAccessibleCell = GetAccessibleCellAt(nRow, nColumn);
945  return pAccessibleCell;
946 }
947 
948 sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
949 {
950  SolarMutexGuard aGuard;
951  IsObjectValid();
952 
953  if (IsFormulaMode())
954  {
955  ScAddress addr(static_cast<SCCOL>(nColumn), nRow, 0);
956  return IsScAddrFormulaSel(addr);
957  }
958  if ((nColumn > (maRange.aEnd.Col() - maRange.aStart.Col())) || (nColumn < 0) ||
959  (nRow > (maRange.aEnd.Row() - maRange.aStart.Row())) || (nRow < 0))
960  throw lang::IndexOutOfBoundsException();
961 
962  bool bResult(false);
963  if (mpViewShell)
964  {
965  const ScMarkData& rMarkdata = mpViewShell->GetViewData().GetMarkData();
966  bResult = rMarkdata.IsCellMarked(static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow));
967  }
968  return bResult;
969 }
970 
971  //===== XAccessibleComponent ============================================
972 
973 uno::Reference< XAccessible > SAL_CALL ScAccessibleSpreadsheet::getAccessibleAtPoint(const awt::Point& rPoint)
974 {
975  uno::Reference< XAccessible > xAccessible;
976  if (containsPoint(rPoint))
977  {
978  SolarMutexGuard aGuard;
979  IsObjectValid();
980  if (mpViewShell)
981  {
982  SCCOL nX;
983  SCROW nY;
984  mpViewShell->GetViewData().GetPosFromPixel( rPoint.X, rPoint.Y, meSplitPos, nX, nY);
985  try {
986  xAccessible = getAccessibleCellAt(nY, nX);
987  }
988  catch(const css::lang::IndexOutOfBoundsException &)
989  {
990  return nullptr;
991  }
992  }
993  }
994  return xAccessible;
995 }
996 
998 {
999  if (getAccessibleParent().is())
1000  {
1001  uno::Reference<XAccessibleComponent> xAccessibleComponent(getAccessibleParent()->getAccessibleContext(), uno::UNO_QUERY);
1002  if (xAccessibleComponent.is())
1003  xAccessibleComponent->grabFocus();
1004  }
1005 }
1006 
1008 {
1009  return sal_Int32(COL_BLACK);
1010 }
1011 
1013 {
1014  SolarMutexGuard aGuard;
1015  IsObjectValid();
1016  return sal_Int32(SC_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor);
1017 }
1018 
1019  //===== XAccessibleContext ==============================================
1020 
1021 uno::Reference<XAccessibleRelationSet> SAL_CALL ScAccessibleSpreadsheet::getAccessibleRelationSet()
1022 {
1024  if(mpAccDoc)
1025  pRelationSet = mpAccDoc->GetRelationSet(nullptr);
1026  if (pRelationSet)
1027  return pRelationSet;
1028  return new utl::AccessibleRelationSetHelper();
1029 }
1030 
1031 uno::Reference<XAccessibleStateSet> SAL_CALL
1033 {
1034  SolarMutexGuard aGuard;
1035  uno::Reference<XAccessibleStateSet> xParentStates;
1036  if (getAccessibleParent().is())
1037  {
1038  uno::Reference<XAccessibleContext> xParentContext = getAccessibleParent()->getAccessibleContext();
1039  xParentStates = xParentContext->getAccessibleStateSet();
1040  }
1042  if (IsDefunc(xParentStates))
1043  pStateSet->AddState(AccessibleStateType::DEFUNC);
1044  else
1045  {
1046  pStateSet->AddState(AccessibleStateType::MANAGES_DESCENDANTS);
1047  if (IsEditable())
1048  pStateSet->AddState(AccessibleStateType::EDITABLE);
1049  pStateSet->AddState(AccessibleStateType::ENABLED);
1050  pStateSet->AddState(AccessibleStateType::FOCUSABLE);
1051  if (IsFocused())
1052  pStateSet->AddState(AccessibleStateType::FOCUSED);
1053  pStateSet->AddState(AccessibleStateType::MULTI_SELECTABLE);
1054  pStateSet->AddState(AccessibleStateType::OPAQUE);
1055  pStateSet->AddState(AccessibleStateType::SELECTABLE);
1057  pStateSet->AddState(AccessibleStateType::SELECTED);
1058  if (isShowing())
1059  pStateSet->AddState(AccessibleStateType::SHOWING);
1060  if (isVisible())
1061  pStateSet->AddState(AccessibleStateType::VISIBLE);
1062  }
1063  return pStateSet;
1064 }
1065 
1067 
1068 void SAL_CALL ScAccessibleSpreadsheet::selectAccessibleChild( sal_Int32 nChildIndex )
1069 {
1070  SolarMutexGuard aGuard;
1071  IsObjectValid();
1072  if (nChildIndex < 0 || nChildIndex >= getAccessibleChildCount())
1073  throw lang::IndexOutOfBoundsException();
1074 
1075  if (mpViewShell)
1076  {
1077  sal_Int32 nCol(getAccessibleColumn(nChildIndex));
1078  sal_Int32 nRow(getAccessibleRow(nChildIndex));
1079 
1080  SelectCell(nRow, nCol, false);
1081  }
1082 }
1083 
1084 void SAL_CALL
1086 {
1087  SolarMutexGuard aGuard;
1088  IsObjectValid();
1089  if (mpViewShell && !IsFormulaMode())
1090  mpViewShell->Unmark();
1091 }
1092 
1094 {
1095  SolarMutexGuard aGuard;
1096  IsObjectValid();
1097  if (!mpViewShell)
1098  return;
1099 
1100  if (IsFormulaMode())
1101  {
1103  ScViewData& rViewData = mpViewShell->GetViewData();
1104  mpViewShell->InitRefMode( 0, 0, rViewData.GetTabNo(), SC_REFTYPE_REF );
1105  rViewData.SetRefStart(0, 0, rViewData.GetTabNo());
1106  rViewData.SetRefEnd(pDoc->MaxCol(), pDoc->MaxRow(), rViewData.GetTabNo());
1107  mpViewShell->UpdateRef(pDoc->MaxCol(), pDoc->MaxRow(), rViewData.GetTabNo());
1108  }
1109  else
1111 }
1112 
1113 sal_Int32 SAL_CALL
1115 {
1116  SolarMutexGuard aGuard;
1117  IsObjectValid();
1118  sal_Int32 nResult(0);
1119  if (mpViewShell)
1120  {
1121  if (IsFormulaMode())
1122  {
1123  nResult = GetRowAll() * GetColAll() ;
1124  }
1125  else
1126  {
1127  if (!mpMarkedRanges)
1128  {
1129  mpMarkedRanges.reset(new ScRangeList());
1131  aMarkData.FillRangeListWithMarks(mpMarkedRanges.get(), false);
1132  }
1133  // is possible, because there shouldn't be overlapped ranges in it
1134  if (mpMarkedRanges)
1135  nResult = mpMarkedRanges->GetCellCount();
1136  }
1137  }
1138  return nResult;
1139 }
1140 
1141 uno::Reference<XAccessible > SAL_CALL
1143 {
1144  SolarMutexGuard aGuard;
1145  IsObjectValid();
1146  uno::Reference < XAccessible > xAccessible;
1147  if (IsFormulaMode())
1148  {
1149  if(CheckChildIndex(nSelectedChildIndex))
1150  {
1151  ScAddress addr = GetChildIndexAddress(nSelectedChildIndex);
1152  xAccessible = getAccessibleCellAt(addr.Row(), addr.Col());
1153  }
1154  return xAccessible;
1155  }
1156  if (mpViewShell)
1157  {
1158  if (!mpMarkedRanges)
1159  {
1160  mpMarkedRanges.reset(new ScRangeList());
1162  }
1163  if (mpMarkedRanges)
1164  {
1165  if ((nSelectedChildIndex < 0) ||
1166  (mpMarkedRanges->GetCellCount() <= o3tl::make_unsigned(nSelectedChildIndex)))
1167  {
1168  throw lang::IndexOutOfBoundsException();
1169  }
1170  ScMyAddress addr = CalcScAddressFromRangeList(mpMarkedRanges.get(),nSelectedChildIndex);
1171  if( m_mapSelectionSend.find(addr) != m_mapSelectionSend.end() )
1172  xAccessible = m_mapSelectionSend[addr];
1173  else
1174  xAccessible = getAccessibleCellAt(addr.Row(), addr.Col());
1175  }
1176  }
1177  return xAccessible;
1178 }
1179 
1180 void SAL_CALL ScAccessibleSpreadsheet::deselectAccessibleChild( sal_Int32 nChildIndex )
1181 {
1182  SolarMutexGuard aGuard;
1183  IsObjectValid();
1184 
1185  if (nChildIndex < 0 || nChildIndex >= getAccessibleChildCount())
1186  throw lang::IndexOutOfBoundsException();
1187 
1188  if (!mpViewShell)
1189  return;
1190 
1191  sal_Int32 nCol(getAccessibleColumn(nChildIndex));
1192  sal_Int32 nRow(getAccessibleRow(nChildIndex));
1193 
1194  if (IsFormulaMode())
1195  {
1196  if(IsScAddrFormulaSel(
1197  ScAddress(static_cast<SCCOL>(nCol), nRow,mpViewShell->GetViewData().GetTabNo()))
1198  )
1199  {
1200  SelectCell(nRow, nCol, true);
1201  }
1202  return ;
1203  }
1204  if (mpViewShell->GetViewData().GetMarkData().IsCellMarked(static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow)))
1205  SelectCell(nRow, nCol, true);
1206 }
1207 
1208 void ScAccessibleSpreadsheet::SelectCell(sal_Int32 nRow, sal_Int32 nCol, bool bDeselect)
1209 {
1210  if (IsFormulaMode())
1211  {
1212  if (bDeselect)
1213  {//??
1214  return;
1215  }
1216  else
1217  {
1218  ScViewData& rViewData = mpViewShell->GetViewData();
1219 
1220  mpViewShell->InitRefMode( static_cast<SCCOL>(nCol), nRow, rViewData.GetTabNo(), SC_REFTYPE_REF );
1221  mpViewShell->UpdateRef(static_cast<SCCOL>(nCol), nRow, rViewData.GetTabNo());
1222  }
1223  return ;
1224  }
1226 
1227  mpViewShell->DoneBlockMode( true ); // continue selecting
1228  mpViewShell->InitBlockMode( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), maRange.aStart.Tab(), bDeselect );
1229 
1231 }
1232 
1233 /*
1234 void ScAccessibleSpreadsheet::CreateSortedMarkedCells()
1235 {
1236  mpSortedMarkedCells = new std::vector<ScMyAddress>();
1237  mpSortedMarkedCells->reserve(mpMarkedRanges->GetCellCount());
1238  for ( size_t i = 0, ListSize = mpMarkedRanges->size(); i < ListSize; ++i )
1239  {
1240  ScRange* pRange = (*mpMarkedRanges)[i];
1241  if (pRange->aStart.Tab() != pRange->aEnd.Tab())
1242  {
1243  if ((maActiveCell.Tab() >= pRange->aStart.Tab()) ||
1244  maActiveCell.Tab() <= pRange->aEnd.Tab())
1245  {
1246  ScRange aRange(*pRange);
1247  aRange.aStart.SetTab(maActiveCell.Tab());
1248  aRange.aEnd.SetTab(maActiveCell.Tab());
1249  AddMarkedRange(aRange);
1250  }
1251  else
1252  {
1253  OSL_FAIL("Range of wrong table");
1254  }
1255  }
1256  else if(pRange->aStart.Tab() == maActiveCell.Tab())
1257  AddMarkedRange(*pRange);
1258  else
1259  {
1260  OSL_FAIL("Range of wrong table");
1261  }
1262  }
1263  std::sort(mpSortedMarkedCells->begin(), mpSortedMarkedCells->end());
1264 }
1265 
1266 void ScAccessibleSpreadsheet::AddMarkedRange(const ScRange& rRange)
1267 {
1268  for (SCROW nRow = rRange.aStart.Row(); nRow <= rRange.aEnd.Row(); ++nRow)
1269  {
1270  for (SCCOL nCol = rRange.aStart.Col(); nCol <= rRange.aEnd.Col(); ++nCol)
1271  {
1272  ScMyAddress aCell(nCol, nRow, maActiveCell.Tab());
1273  mpSortedMarkedCells->push_back(aCell);
1274  }
1275  }
1276 }*/
1277 
1278  //===== XServiceInfo ====================================================
1279 
1281 {
1282  return "ScAccessibleSpreadsheet";
1283 }
1284 
1285 uno::Sequence< OUString> SAL_CALL
1287 {
1288  const css::uno::Sequence<OUString> vals { "com.sun.star.AccessibleSpreadsheet" };
1290 }
1291 
1292 //===== XTypeProvider =======================================================
1293 
1294 uno::Sequence<sal_Int8> SAL_CALL
1296 {
1297  return css::uno::Sequence<sal_Int8>();
1298 }
1299 
1301 
1302 void SAL_CALL ScAccessibleSpreadsheet::addAccessibleEventListener(const uno::Reference<XAccessibleEventListener>& xListener)
1303 {
1304  SolarMutexGuard aGuard;
1305  IsObjectValid();
1307 
1308 }
1309 
1310 //==== internal =========================================================
1311 
1313 {
1314  tools::Rectangle aRect;
1315  if (mpViewShell)
1316  {
1318  if (pWindow)
1319  aRect = pWindow->GetWindowExtentsRelative(nullptr);
1320  }
1321  return aRect;
1322 }
1323 
1325 {
1326  tools::Rectangle aRect;
1327  if (mpViewShell)
1328  {
1330  if (pWindow)
1331  //#101986#; extends to the same window, because the parent is the document and it has the same window
1332  aRect = pWindow->GetWindowExtentsRelative(pWindow);
1333  }
1334  return aRect;
1335 }
1336 
1338  const uno::Reference<XAccessibleStateSet>& rxParentStates)
1339 {
1340  return ScAccessibleContextBase::IsDefunc() || (mpViewShell == nullptr) || !getAccessibleParent().is() ||
1341  (rxParentStates.is() && rxParentStates->contains(AccessibleStateType::DEFUNC));
1342 }
1343 
1345 {
1346  if (IsFormulaMode())
1347  {
1348  return false;
1349  }
1350  bool bProtected(false);
1352  bProtected = true;
1353  return !bProtected;
1354 }
1355 
1357 {
1358  bool bFocused(false);
1359  if (mpViewShell)
1360  {
1362  bFocused = mpViewShell->GetActiveWin()->HasFocus();
1363  }
1364  return bFocused;
1365 }
1366 
1368 {
1369  if (IsFormulaMode())
1370  {
1371  return false;
1372  }
1373 
1374  bool bResult(false);
1375  if(mpViewShell)
1376  {
1377  //#103800#; use a copy of MarkData
1379  if (aMarkData.IsAllMarked(maRange))
1380  bResult = true;
1381  }
1382  return bResult;
1383 }
1384 
1386 {
1387  ScDocument* pDoc = nullptr;
1388  if (pViewShell)
1389  pDoc = &pViewShell->GetViewData().GetDocument();
1390  return pDoc;
1391 }
1392 
1394 {
1395  SolarMutexGuard g;
1396 
1397  if (IsFormulaMode())
1398  {
1399  return false;
1400  }
1401 
1404  mpViewShell->DoneBlockMode( true ); // continue selecting
1405  mpViewShell->InitBlockMode( 0, row, maRange.aStart.Tab(), false, false, true );
1406  mpViewShell->MarkCursor( pDoc->MaxCol(), row, maRange.aStart.Tab(), false, true );
1408  return true;
1409 }
1410 
1412 {
1413  SolarMutexGuard g;
1414 
1415  if (IsFormulaMode())
1416  {
1417  return false;
1418  }
1419 
1422  mpViewShell->DoneBlockMode( true ); // continue selecting
1423  mpViewShell->InitBlockMode( static_cast<SCCOL>(column), 0, maRange.aStart.Tab(), false, true );
1424  mpViewShell->MarkCursor( static_cast<SCCOL>(column), pDoc->MaxRow(), maRange.aStart.Tab(), true );
1426  return true;
1427 }
1428 
1430 {
1431  SolarMutexGuard g;
1432 
1433  if (IsFormulaMode())
1434  {
1435  return false;
1436  }
1437 
1440  mpViewShell->DoneBlockMode( true ); // continue selecting
1441  mpViewShell->InitBlockMode( 0, row, maRange.aStart.Tab(), false, false, true, true );
1442  mpViewShell->MarkCursor( pDoc->MaxCol(), row, maRange.aStart.Tab(), false, true );
1444  mpViewShell->DoneBlockMode( true );
1445  return true;
1446 }
1447 
1449 {
1450  SolarMutexGuard g;
1451 
1452  if (IsFormulaMode())
1453  {
1454  return false;
1455  }
1456 
1459  mpViewShell->DoneBlockMode( true ); // continue selecting
1460  mpViewShell->InitBlockMode( static_cast<SCCOL>(column), 0, maRange.aStart.Tab(), false, true, false, true );
1461  mpViewShell->MarkCursor( static_cast<SCCOL>(column), pDoc->MaxRow(), maRange.aStart.Tab(), true );
1463  mpViewShell->DoneBlockMode( true );
1464  return true;
1465 }
1466 
1468 {
1469  if (IsFormulaMode())
1470  {
1471  return ;
1472  }
1473  if (mbIsFocusSend)
1474  {
1475  return ;
1476  }
1477  mbIsFocusSend = true;
1478  AccessibleEventObject aEvent;
1479  aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
1480  aEvent.Source = uno::Reference< XAccessible >(this);
1481  aEvent.NewValue <<= getAccessibleCellAt(maActiveCell.Row(), maActiveCell.Col());
1482  CommitChange(aEvent);
1483 }
1484 
1486 {
1487  ScViewData& rViewData = mpViewShell->GetViewData();
1488  if (!rViewData.IsRefMode())
1489  // Not in reference mode. Bail out.
1490  return;
1491 
1492  sal_uInt16 nRefStartX = rViewData.GetRefStartX();
1493  sal_Int32 nRefStartY = rViewData.GetRefStartY();
1494  sal_uInt16 nRefEndX = rViewData.GetRefEndX();
1495  sal_Int32 nRefEndY = rViewData.GetRefEndY();
1496  ScAddress aFormulaAddr;
1497  if(!GetFormulaCurrentFocusCell(aFormulaAddr))
1498  {
1499  return ;
1500  }
1501  if (m_aFormulaActiveCell != aFormulaAddr)
1502  {//New Focus
1503  m_nMinX =std::min(nRefStartX,nRefEndX);
1504  m_nMaxX =std::max(nRefStartX,nRefEndX);
1505  m_nMinY = std::min(nRefStartY,nRefEndY);
1506  m_nMaxY = std::max(nRefStartY,nRefEndY);
1508  AccessibleEventObject aEvent;
1509  aEvent.Source = uno::Reference< XAccessible >(this);
1510  aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
1511  aEvent.OldValue <<= uno::Reference<XAccessible>(m_pAccFormulaCell);
1512  m_pAccFormulaCell = GetAccessibleCellAt(aFormulaAddr.Row(), aFormulaAddr.Col());
1513  uno::Reference< XAccessible > xNew = m_pAccFormulaCell;
1514  aEvent.NewValue <<= xNew;
1515  CommitChange(aEvent);
1516  if (nRefStartX == nRefEndX && nRefStartY == nRefEndY)
1517  {//Selection Single
1518  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
1519  aEvent.NewValue <<= xNew;
1520  CommitChange(aEvent);
1521  m_mapFormulaSelectionSend.emplace(aFormulaAddr,xNew);
1522  m_vecFormulaLastMyAddr.clear();
1523  m_vecFormulaLastMyAddr.emplace_back(aFormulaAddr);
1524  }
1525  else
1526  {
1527  std::vector<ScMyAddress> vecCurSel;
1528  int nCurSize = (m_nMaxX - m_nMinX +1)*(m_nMaxY - m_nMinY +1) ;
1529  vecCurSel.reserve(nCurSize);
1530  for (sal_uInt16 x = m_nMinX ; x <= m_nMaxX ; ++x)
1531  {
1532  for (sal_Int32 y = m_nMinY ; y <= m_nMaxY ; ++y)
1533  {
1534  ScMyAddress aAddr(x,y,0);
1535  vecCurSel.push_back(aAddr);
1536  }
1537  }
1538  std::sort(vecCurSel.begin(), vecCurSel.end());
1539  std::vector<ScMyAddress> vecNew;
1540  std::set_difference(vecCurSel.begin(),vecCurSel.end(),
1542  std::back_insert_iterator(vecNew));
1543  int nNewSize = vecNew.size();
1544  if ( nNewSize > 10 )
1545  {
1546  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
1547  aEvent.NewValue.clear();
1548  CommitChange(aEvent);
1549  }
1550  else
1551  {
1552  for(const auto& rAddr : vecNew)
1553  {
1554  uno::Reference< XAccessible > xChild;
1555  if (rAddr == aFormulaAddr)
1556  {
1557  xChild = m_pAccFormulaCell.get();
1558  }
1559  else
1560  {
1561  xChild = getAccessibleCellAt(rAddr.Row(),rAddr.Col());
1562  aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS;
1563  aEvent.NewValue <<= xChild;
1564  CommitChange(aEvent);
1565  }
1566  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD;
1567  aEvent.NewValue <<= xChild;
1568  CommitChange(aEvent);
1569  m_mapFormulaSelectionSend.emplace(rAddr,xChild);
1570  }
1571  }
1572  m_vecFormulaLastMyAddr.swap(vecCurSel);
1573  }
1574  }
1575  m_aFormulaActiveCell = aFormulaAddr;
1576 }
1577 
1579 {
1580  AccessibleEventObject aEvent;
1581  aEvent.Source = uno::Reference< XAccessible >(this);
1582  MAP_ADDR_XACC::iterator miRemove = m_mapFormulaSelectionSend.begin();
1583  while (miRemove != m_mapFormulaSelectionSend.end())
1584  {
1585  if( !bRemoveAll && IsScAddrFormulaSel(miRemove->first) )
1586  {
1587  ++miRemove;
1588  continue;
1589  }
1590  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
1591  aEvent.NewValue <<= miRemove->second;
1592  CommitChange(aEvent);
1593  miRemove = m_mapFormulaSelectionSend.erase(miRemove);
1594  }
1595 }
1596 
1598 {
1599  return addr.Col() >= m_nMinX && addr.Col() <= m_nMaxX &&
1600  addr.Row() >= m_nMinY && addr.Row() <= m_nMaxY &&
1601  addr.Tab() == mpViewShell->GetViewData().GetTabNo();
1602 }
1603 
1604 bool ScAccessibleSpreadsheet::CheckChildIndex(sal_Int32 nIndex) const
1605 {
1606  sal_Int32 nMaxIndex = (m_nMaxX - m_nMinX +1)*(m_nMaxY - m_nMinY +1) -1 ;
1607  return nIndex <= nMaxIndex && nIndex >= 0 ;
1608 }
1609 
1611 {
1612  sal_Int32 nRowAll = GetRowAll();
1613  sal_uInt16 nColAll = GetColAll();
1614  if (nIndex < 0 || nIndex >= nRowAll * nColAll )
1615  {
1616  return ScAddress();
1617  }
1618  return ScAddress(
1619  static_cast<SCCOL>((nIndex - nIndex % nRowAll) / nRowAll + + m_nMinX),
1620  nIndex % nRowAll + m_nMinY,
1622  );
1623 }
1624 
1625 sal_Int32 ScAccessibleSpreadsheet::GetAccessibleIndexFormula( sal_Int32 nRow, sal_Int32 nColumn )
1626 {
1627  sal_uInt16 nColRelative = sal_uInt16(nColumn) - GetColAll();
1628  sal_Int32 nRowRelative = nRow - GetRowAll();
1629  if (nRow < 0 || nColumn < 0 || nRowRelative >= GetRowAll() || nColRelative >= GetColAll() )
1630  {
1631  return -1;
1632  }
1633  return GetRowAll() * nRowRelative + nColRelative;
1634 }
1635 
1637 {
1638  ScViewData& rViewData = mpViewShell->GetViewData();
1639  m_bFormulaMode = rViewData.IsRefMode() || SC_MOD()->IsFormulaMode();
1640  return m_bFormulaMode ;
1641 }
1642 
1644 {
1645  ScViewData& rViewData = mpViewShell->GetViewData();
1646  sal_uInt16 nRefX=0;
1647  sal_Int32 nRefY=0;
1648  if(m_bFormulaLastMode)
1649  {
1650  nRefX=rViewData.GetRefEndX();
1651  nRefY=rViewData.GetRefEndY();
1652  }
1653  else
1654  {
1655  nRefX=rViewData.GetRefStartX();
1656  nRefY=rViewData.GetRefStartY();
1657  }
1659  if( /* Always true: nRefX >= 0 && */ nRefX <= pDoc->MaxCol() && nRefY >= 0 && nRefY <= pDoc->MaxRow())
1660  {
1661  addr = ScAddress(nRefX,nRefY,rViewData.GetTabNo());
1662  return true;
1663  }
1664  return false;
1665 }
1666 
1667 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3135
void InitRefMode(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScRefType eType)
Definition: tabview4.cxx:309
void SelectAll(bool bContinue=false)
Definition: tabview2.cxx:1099
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &rPoint) override
===== XAccessibleComponent ============================================
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
Return the number of currently visible children.
SC_DLLPUBLIC const ScRange * GetRepeatColRange(SCTAB nTab)
Definition: document.cxx:6389
rtl::Reference< utl::AccessibleRelationSetHelper > GetRelationSet(const ScAddress *pAddress) const
======== internal =====================================================
ScAddress aStart
Definition: address.hxx:497
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
Definition: documen3.cxx:1913
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:42
SCROW GetRefEndY() const
Definition: viewdata.hxx:536
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows() override
Returns the selected rows in a table.
void CommitFocusCell(const ScAddress &aNewCell)
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
===== XAccessibleEventBroadcaster =====================================
void RemoveSelection(const ScMarkData &refScMarkData)
SCROW Row() const
Definition: address.hxx:274
virtual void SAL_CALL clearAccessibleSelection() override
rtl::Reference< ScAccessibleCell > m_pAccFormulaCell
bool GetDelMark(ScRange &rRange) const
Definition: viewdata.hxx:549
static rtl::Reference< ScAccessibleCell > create(const css::uno::Reference< css::accessibility::XAccessible > &rxParent, ScTabViewShell *pViewShell, const ScAddress &rCellAddress, sal_Int32 nIndex, ScSplitPos eSplitPos, ScAccessibleDocument *pAccDoc)
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
===== XAccessibleContext ==============================================
bool Intersects(const ScRange &rRange) const
Definition: address.hxx:734
SCROW GetRefStartY() const
Definition: viewdata.hxx:533
void AddAccessibilityObject(SfxListener &rObject)
Definition: tabvwshh.cxx:210
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
===== SfxListener =====================================================
virtual sal_Bool SAL_CALL unselectColumn(sal_Int32 column) override
virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders() override
Returns the column headers as an AccessibleTable.
void FillRangeListWithMarks(ScRangeList *pList, bool bClear, SCTAB nForTab=-1) const
Create a range list of marks.
Definition: markdata.cxx:372
sal_Int16 nId
virtual sal_Bool SAL_CALL isAccessibleSelected(sal_Int32 nRow, sal_Int32 nColumn) override
Returns a boolean value indicating whether the accessible at a specified row and column is selected...
bool GetForceFocusOnCurCell() const
Definition: tabvwsh.hxx:388
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
virtual void SAL_CALL deselectAccessibleChild(sal_Int32 nChildIndex) override
static ScDocument * GetDocument(ScTabViewShell *pViewShell)
void Unmark()
Definition: tabview3.cxx:1725
ScAddress aEnd
Definition: address.hxx:498
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
Return a reference to the parent.
ScSplitPos GetActivePart() const
Definition: viewdata.hxx:398
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
void ConstructScAccessibleSpreadsheet(ScAccessibleDocument *pAccDoc, ScTabViewShell *pViewShell, SCTAB nTab, ScSplitPos eSplitPos)
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn) override
Returns the Accessible at a specified row and column in the table.
SwNodeOffset abs(const SwNodeOffset &a)
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &rPoint) override
===== XAccessibleComponent ============================================
float x
virtual void SAL_CALL selectAccessibleChild(sal_Int32 nChildIndex) override
===== XAccessibleSelection ===========================================
SfxHintId GetId() const
ScSplitPos
Definition: viewdata.hxx:44
const ScRange & GetMarkArea() const
Definition: markdata.hxx:83
bool IsCellMarked(SCCOL nCol, SCROW nRow, bool bNoSimple=false) const
Definition: markdata.cxx:270
virtual sal_Int32 SAL_CALL getAccessibleColumn(sal_Int32 nChildIndex) override
Returns the column number of an index in the table.
void RemoveFormulaSelection(bool bRemoveAll=false)
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:891
ScAccessibleSpreadsheet(ScAccessibleDocument *pAccDoc, ScTabViewShell *pViewShell, SCTAB nTab, ScSplitPos eSplitPos)
bool IsMultiMarked() const
Definition: markdata.hxx:81
void SelectCell(sal_Int32 nRow, sal_Int32 nCol, bool bDeselect)
int nCount
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
Definition: document.cxx:3536
virtual tools::Rectangle GetBoundingBox() const override
Return the object's current bounding box relative to the parent object.
SCTAB Tab() const
Definition: address.hxx:283
void DoneBlockMode(bool bContinue=false)
Definition: tabview2.cxx:409
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
===== SfxListener =====================================================
tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const
ScViewData & GetViewData()
Definition: tabview.hxx:333
ScGridWindow * GetActiveWin()
Definition: tabview.cxx:887
void SelectionChanged(bool bFromPaste=false)
Definition: tabview3.cxx:532
void SetRefStart(SCCOL nNewX, SCROW nNewY, SCTAB nNewZ)
Definition: viewdata.cxx:4126
virtual ~ScAccessibleSpreadsheet() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Returns a list of all supported services.
float y
bool IsRowMarked(SCROW nRow) const
Definition: markdata.cxx:303
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Returns a list of all supported services.
virtual sal_Bool SAL_CALL isAccessibleColumnSelected(sal_Int32 nColumn) override
Returns a boolean value indicating whether the specified column is selected.
std::unique_ptr< ScRangeList > mpMarkedRanges
void CommitTableModelChange(sal_Int32 nStartRow, sal_Int32 nStartCol, sal_Int32 nEndRow, sal_Int32 nEndCol, sal_uInt16 nId)
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:890
vcl::Window * GetWindowByPos(ScSplitPos ePos) const
Definition: tabview.hxx:371
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
===== XAccessibleEventBroadcaster =====================================
bool IsMarked() const
Definition: markdata.hxx:80
int i
bool IsColumnMarked(SCCOL nCol) const
Definition: markdata.cxx:287
void GetPosFromPixel(tools::Long nClickX, tools::Long nClickY, ScSplitPos eWhich, SCCOL &rPosX, SCROW &rPosY, bool bTestMerge=true, bool bRepair=false, SCTAB nForTab=-1)
Definition: viewdata.cxx:2774
sal_Int16 SCCOL
Definition: types.hxx:21
rtl::Reference< ScAccessibleCell > GetAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn)
#define SC_MOD()
Definition: scmod.hxx:249
virtual void SAL_CALL disposing() override
ScMyAddress CalcScAddressFromRangeList(ScRangeList *pMarkedRanges, sal_Int32 nSelectedChildIndex)
virtual sal_Bool SAL_CALL isAccessibleRowSelected(sal_Int32 nRow) override
Returns a boolean value indicating whether the specified row is selected.
std::vector< ScMyAddress > m_vecFormulaLastMyAddr
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
Definition: tabview3.cxx:1800
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
size_t size() const
Definition: rangelst.hxx:89
unsigned char sal_Bool
void CommitFocusGained() const
Calls all FocusListener to tell they that the focus is gained.
virtual OUString SAL_CALL getImplementationName() override
===== XServiceInfo ====================================================
static bool CalcScRangeDifferenceMax(const ScRange &rSrc, const ScRange &rDest, int nMax, std::vector< ScMyAddress > &vecRet, int &nSize)
virtual sal_Bool SAL_CALL selectRow(sal_Int32 row) override
This base class provides an implementation of the AccessibleTable service.
virtual void SAL_CALL grabFocus() override
SCCOL GetRefEndX() const
Definition: viewdata.hxx:535
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &...rSn)
bool IsScAddrFormulaSel(const ScAddress &addr) const
sal_uInt64 GetCellCount() const
Definition: rangelst.cxx:1087
SCCOL Col() const
Definition: address.hxx:279
SCCOL GetRefStartX() const
Definition: viewdata.hxx:532
ScAddress GetCurPos() const
Definition: viewdata.cxx:4121
virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() override
virtual void SAL_CALL disposing() override
ScAccessibleDocument * mpAccDoc
ScAddress GetChildIndexAddress(sal_Int32) const
virtual sal_Int32 SAL_CALL getAccessibleRow(sal_Int32 nChildIndex) override
Returns the row number of an index in the table.
sal_Int32 SCROW
Definition: types.hxx:17
bool GetFormulaCurrentFocusCell(ScAddress &addr)
rtl::Reference< ScAccessibleCell > mpAccCell
SC_DLLPUBLIC const ScRange * GetRepeatRowRange(SCTAB nTab)
Definition: document.cxx:6397
virtual sal_Int32 SAL_CALL getForeground() override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
===== XTypeProvider ===================================================
void RemoveAccessibilityObject(SfxListener &rObject)
Definition: tabvwshh.cxx:220
virtual sal_Bool SAL_CALL selectColumn(sal_Int32 column) override
virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override
Return the set of current states.
void CommitFocusLost() const
Calls all FocusListener to tell they that the focus is lost.
bool Contains(const ScAddress &) const
is Address& fully in Range?
Definition: address.hxx:718
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
virtual sal_Bool SAL_CALL unselectRow(sal_Int32 row) override
virtual sal_Int32 SAL_CALL getAccessibleIndex(sal_Int32 nRow, sal_Int32 nColumn) override
===== XAccessibleExtendedTable ========================================
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int32 nSelectedChildIndex) override
void SetRefEnd(SCCOL nNewX, SCROW nNewY, SCTAB nNewZ)
Definition: viewdata.cxx:4131
static bool CalcScRangeListDifferenceMax(ScRangeList *pSrc, ScRangeList *pDest, int nMax, std::vector< ScMyAddress > &vecRet)
sal_Int32 GetAccessibleIndexFormula(sal_Int32 nRow, sal_Int32 nColumn)
void CommitChange(const css::accessibility::AccessibleEventObject &rEvent) const
Calls all Listener to tell they the change.
ScRange & front()
Definition: rangelst.hxx:92
#define SAL_WARN(area, stream)
virtual tools::Rectangle GetBoundingBoxOnScreen() const override
Return the object's current bounding box relative to the desktop.
virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders() override
===== XAccessibleTable ================================================
void CompleteSelectionChanged(bool bNewState)
void UpdateRef(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ)
Definition: tabview4.cxx:186
virtual void SAL_CALL selectAllAccessibleChildren() override
bool GetTableSelect(SCTAB nTab) const
Definition: markdata.cxx:169
void MarkCursor(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, bool bCols=false, bool bRows=false, bool bCellSelection=false)
Definition: tabview2.cxx:449
bool HasFocus() const
bool IsRefMode() const
Definition: viewdata.hxx:530
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns() override
Returns the selected columns in a table.
static bool CompMinCol(const std::pair< sal_uInt16, sal_uInt16 > &pc1, const std::pair< sal_uInt16, sal_uInt16 > &pc2)
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:215
AnyEventRef aEvent
virtual sal_Int32 SAL_CALL getBackground() override
void InitBlockMode(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, bool bTestNeg=false, bool bCols=false, bool bRows=false, bool bForceNeg=false)
Definition: tabview2.cxx:353
ScRange maRange
contains the range of the table, because it could be a subrange of the complete table ...
bool CheckChildIndex(sal_Int32) const
sal_Int16 SCTAB
Definition: types.hxx:22
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
===== XAccessible =====================================================
bool m_bDetectedRangeSegmentation false