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