LibreOffice Module sc (master)  1
tabview3.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <rangelst.hxx>
21 #include <scitems.hxx>
22 
23 #include <editeng/editview.hxx>
24 #include <svx/fmshell.hxx>
26 #include <svx/svdoole2.hxx>
27 #include <sfx2/bindings.hxx>
28 #include <sfx2/lokhelper.hxx>
29 #include <sfx2/viewfrm.hxx>
30 #include <vcl/cursor.hxx>
31 #include <vcl/uitest/logger.hxx>
33 #include <sal/log.hxx>
34 
35 #include <IAnyRefDialog.hxx>
36 #include <tabview.hxx>
37 #include <tabvwsh.hxx>
38 #include <docsh.hxx>
39 #include <gridwin.hxx>
40 #include <olinewin.hxx>
41 #include <overlayobject.hxx>
42 #include <colrowba.hxx>
43 #include <tabcont.hxx>
44 #include <scmod.hxx>
45 #include <sc.hrc>
46 #include <viewutil.hxx>
47 #include <editutil.hxx>
48 #include <inputhdl.hxx>
49 #include <inputwin.hxx>
50 #include <validat.hxx>
51 #include <inputopt.hxx>
52 #include <rfindlst.hxx>
53 #include <hiranges.hxx>
54 #include <viewuno.hxx>
55 #include <dpobject.hxx>
56 #include <seltrans.hxx>
57 #include <fillinfo.hxx>
58 #include <rangeutl.hxx>
59 #include <client.hxx>
60 #include <tabprotection.hxx>
61 #include <spellcheckcontext.hxx>
62 #include <markdata.hxx>
64 #include <comphelper/lok.hxx>
65 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
66 #include <output.hxx>
67 
68 #include <com/sun/star/chart2/data/HighlightedRange.hpp>
69 
70 namespace
71 {
72 
73 ScRange lcl_getSubRangeByIndex( const ScRange& rRange, sal_Int32 nIndex )
74 {
75  ScAddress aResult( rRange.aStart );
76 
77  SCCOL nWidth = rRange.aEnd.Col() - rRange.aStart.Col() + 1;
78  SCROW nHeight = rRange.aEnd.Row() - rRange.aStart.Row() + 1;
79  SCTAB nDepth = rRange.aEnd.Tab() - rRange.aStart.Tab() + 1;
80  if( (nWidth > 0) && (nHeight > 0) && (nDepth > 0) )
81  {
82  // row by row from first to last sheet
83  sal_Int32 nArea = nWidth * nHeight;
84  aResult.IncCol( static_cast< SCCOL >( nIndex % nWidth ) );
85  aResult.IncRow( static_cast< SCROW >( (nIndex % nArea) / nWidth ) );
86  aResult.IncTab( static_cast< SCTAB >( nIndex / nArea ) );
87  if( !rRange.In( aResult ) )
88  aResult = rRange.aStart;
89  }
90 
91  return ScRange( aResult );
92 }
93 
94 } // anonymous namespace
95 
96 using namespace com::sun::star;
97 
99 {
100  DBG_ASSERT(nTotalWindows == 0, "ScExtraEditViewManager dtor: some out window has not yet been removed!");
101 }
102 
103 inline void ScExtraEditViewManager::Add(SfxViewShell* pViewShell, ScSplitPos eWhich)
104 {
105  Apply<Adder>(pViewShell, eWhich);
106 }
107 
109 {
110  Apply<Remover>(pViewShell, eWhich);
111 }
112 
113 
114 template<ScExtraEditViewManager::ModifierTagType ModifierTag>
116 {
117  ScTabViewShell* pOtherViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
118  if (pOtherViewShell == nullptr || pOtherViewShell == mpThisViewShell)
119  return;
120 
121  mpOtherEditView = pOtherViewShell->GetViewData().GetEditView(eWhich);
122  if (mpOtherEditView != nullptr)
123  {
124  DBG_ASSERT(mpOtherEditView->GetEditEngine(), "Edit view has no valid engine.");
125  for (int i = 0; i < 4; ++i)
126  {
127  ScGridWindow* pWin = mpGridWin[i].get();
128  if (pWin != nullptr)
129  {
130  Modifier<ModifierTag>(pWin);
131  }
132  }
133  }
134 }
135 
136 template<ScExtraEditViewManager::ModifierTagType ModifierTag>
138 {
139  (void)this;
140  SAL_WARN("sc", "ScExtraEditViewManager::Modifier<ModifierTag>: non-specialized version should not be invoked.");
141 }
142 
143 template<>
144 void ScExtraEditViewManager::Modifier<ScExtraEditViewManager::Adder>(ScGridWindow* pWin)
145 {
146  if (mpOtherEditView->AddOtherViewWindow(pWin))
147  ++nTotalWindows;
148 }
149 
150 template<>
151 void ScExtraEditViewManager::Modifier<ScExtraEditViewManager::Remover>(ScGridWindow* pWin)
152 {
153  if (mpOtherEditView->RemoveOtherViewWindow(pWin))
154  --nTotalWindows;
155 }
156 
157 // --- public functions
158 
159 void ScTabView::ClickCursor( SCCOL nPosX, SCROW nPosY, bool bControl )
160 {
161  ScDocument& rDoc = aViewData.GetDocument();
162  SCTAB nTab = aViewData.GetTabNo();
163  rDoc.SkipOverlapped(nPosX, nPosY, nTab);
164 
165  bool bRefMode = SC_MOD()->IsFormulaMode();
166 
167  if ( bRefMode )
168  {
169  DoneRefMode();
170 
171  if (bControl)
172  SC_MOD()->AddRefEntry();
173 
174  InitRefMode( nPosX, nPosY, nTab, SC_REFTYPE_REF );
175  }
176  else
177  {
178  DoneBlockMode( bControl );
179  aViewData.ResetOldCursor();
180  SetCursor( nPosX, nPosY );
181  }
182 }
183 
184 void ScTabView::UpdateAutoFillMark(bool bFromPaste)
185 {
186  // single selection or cursor
187  ScRange aMarkRange;
188  bool bMarked = (aViewData.GetSimpleArea( aMarkRange ) == SC_MARK_SIMPLE);
189 
190  for (sal_uInt16 i = 0; i < 4; i++)
191  {
192  if (pGridWin[i] && pGridWin[i]->IsVisible())
193  pGridWin[i]->UpdateAutoFillMark( bMarked, aMarkRange );
194  }
195 
196  for (sal_uInt16 i = 0; i < 2; i++)
197  {
198  if (pColBar[i] && pColBar[i]->IsVisible())
199  pColBar[i]->SetMark( bMarked, aMarkRange.aStart.Col(), aMarkRange.aEnd.Col() );
200  if (pRowBar[i] && pRowBar[i]->IsVisible())
201  pRowBar[i]->SetMark( bMarked, aMarkRange.aStart.Row(), aMarkRange.aEnd.Row() );
202  }
203 
204  // selection transfer object is checked together with AutoFill marks,
205  // because it has the same requirement of a single continuous block.
206  if (!bFromPaste)
207  CheckSelectionTransfer(); // update selection transfer object
208 }
209 
211 {
212  if (pGridWin[eWhich])
213  pGridWin[eWhich]->FakeButtonUp();
214 }
215 
217 {
218  for (VclPtr<ScGridWindow> & pWin : pGridWin)
219  {
220  if (pWin && pWin->IsVisible())
221  {
222  vcl::Cursor* pCur = pWin->GetCursor();
223  if (pCur && pCur->IsVisible())
224  pCur->Hide();
225  pWin->HideCursor();
226  }
227  }
228 }
229 
231 {
232  for (VclPtr<ScGridWindow> & pWin : pGridWin)
233  {
234  if (pWin && pWin->IsVisible())
235  {
236  pWin->ShowCursor();
237  pWin->CursorChanged();
238  }
239  }
240 }
241 
243 {
244  pGridWin[aViewData.GetActivePart()]->ShowCursor();
245  pGridWin[aViewData.GetActivePart()]->CursorChanged();
246 }
247 
249 {
250  SfxBindings& rBindings = aViewData.GetBindings();
251 
252  rBindings.Invalidate( SID_STYLE_APPLY );
253  rBindings.Invalidate( SID_STYLE_FAMILY2 );
254  // StarCalc knows only paragraph- or cell format templates
255 
256  rBindings.Invalidate( SID_ATTR_CHAR_FONT );
257  rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
258  rBindings.Invalidate( SID_ATTR_CHAR_COLOR );
259 
260  rBindings.Invalidate( SID_ATTR_CHAR_WEIGHT );
261  rBindings.Invalidate( SID_ATTR_CHAR_POSTURE );
262  rBindings.Invalidate( SID_ATTR_CHAR_UNDERLINE );
263  rBindings.Invalidate( SID_ULINE_VAL_NONE );
264  rBindings.Invalidate( SID_ULINE_VAL_SINGLE );
265  rBindings.Invalidate( SID_ULINE_VAL_DOUBLE );
266  rBindings.Invalidate( SID_ULINE_VAL_DOTTED );
267 
268  rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE );
269 
270  rBindings.Invalidate( SID_ATTR_CHAR_KERNING );
271  rBindings.Invalidate( SID_SET_SUPER_SCRIPT );
272  rBindings.Invalidate( SID_SET_SUB_SCRIPT );
273  rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT );
274  rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED );
275 
276  rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT );
277  rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT );
278  rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK );
279  rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER);
280  rBindings.Invalidate( SID_NUMBER_TYPE_FORMAT);
281 
282  rBindings.Invalidate( SID_ALIGNLEFT );
283  rBindings.Invalidate( SID_ALIGNRIGHT );
284  rBindings.Invalidate( SID_ALIGNBLOCK );
285  rBindings.Invalidate( SID_ALIGNCENTERHOR );
286 
287  rBindings.Invalidate( SID_ALIGNTOP );
288  rBindings.Invalidate( SID_ALIGNBOTTOM );
289  rBindings.Invalidate( SID_ALIGNCENTERVER );
290 
291  rBindings.Invalidate( SID_SCATTR_CELLPROTECTION );
292 
293  // stuff for sidebar panels
294  {
295  rBindings.Invalidate( SID_H_ALIGNCELL );
296  rBindings.Invalidate( SID_V_ALIGNCELL );
297  rBindings.Invalidate( SID_ATTR_ALIGN_INDENT );
298  rBindings.Invalidate( SID_FRAME_LINECOLOR );
299  rBindings.Invalidate( SID_FRAME_LINESTYLE );
300  rBindings.Invalidate( SID_ATTR_BORDER_OUTER );
301  rBindings.Invalidate( SID_ATTR_BORDER_INNER );
302  rBindings.Invalidate( SID_ATTR_BORDER_DIAG_TLBR );
303  rBindings.Invalidate( SID_ATTR_BORDER_DIAG_BLTR );
304  rBindings.Invalidate( SID_NUMBER_TYPE_FORMAT );
305  }
306 
307  rBindings.Invalidate( SID_BACKGROUND_COLOR );
308 
309  rBindings.Invalidate( SID_ATTR_ALIGN_LINEBREAK );
310  rBindings.Invalidate( SID_NUMBER_FORMAT );
311 
312  rBindings.Invalidate( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
313  rBindings.Invalidate( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
314  rBindings.Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT );
315  rBindings.Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT );
316 
317  // pseudo slots for Format menu
318  rBindings.Invalidate( SID_ALIGN_ANY_HDEFAULT );
319  rBindings.Invalidate( SID_ALIGN_ANY_LEFT );
320  rBindings.Invalidate( SID_ALIGN_ANY_HCENTER );
321  rBindings.Invalidate( SID_ALIGN_ANY_RIGHT );
322  rBindings.Invalidate( SID_ALIGN_ANY_JUSTIFIED );
323  rBindings.Invalidate( SID_ALIGN_ANY_VDEFAULT );
324  rBindings.Invalidate( SID_ALIGN_ANY_TOP );
325  rBindings.Invalidate( SID_ALIGN_ANY_VCENTER );
326  rBindings.Invalidate( SID_ALIGN_ANY_BOTTOM );
327 
328  rBindings.Invalidate( SID_NUMBER_CURRENCY );
329  rBindings.Invalidate( SID_NUMBER_SCIENTIFIC );
330  rBindings.Invalidate( SID_NUMBER_DATE );
331  rBindings.Invalidate( SID_NUMBER_CURRENCY );
332  rBindings.Invalidate( SID_NUMBER_PERCENT );
333  rBindings.Invalidate( SID_NUMBER_TWODEC );
334  rBindings.Invalidate( SID_NUMBER_TIME );
335  rBindings.Invalidate( SID_NUMBER_STANDARD );
336  rBindings.Invalidate( SID_NUMBER_THOUSANDS );
337 }
338 
339 namespace {
340 
341 void collectUIInformation(const std::map<OUString, OUString>& aParameters)
342 {
343  EventDescription aDescription;
344  aDescription.aID = "grid_window";
345  aDescription.aAction = "SELECT";
346  aDescription.aParameters = aParameters;
347  aDescription.aParent = "MainWindow";
348  aDescription.aKeyWord = "ScGridWinUIObject";
349 
350  UITestLogger::getInstance().logEvent(aDescription);
351 }
352 
353 }
354 
355 // SetCursor - Cursor, set, draw, update InputWin
356 // or send reference
357 // Optimising breaks the functionality
358 
359 void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew )
360 {
361  SCCOL nOldX = aViewData.GetCurX();
362  SCROW nOldY = aViewData.GetCurY();
363 
364  // DeactivateIP only for MarkListHasChanged
365 
366  // FIXME: this is to limit the number of rows handled in the Online
367  // to 1000; this will be removed again when the performance
368  // bottlenecks are sorted out
370  nPosY = std::min(nPosY, MAXTILEDROW);
371 
372  if ( !(nPosX != nOldX || nPosY != nOldY || bNew) )
373  return;
374 
375  ScTabViewShell* pViewShell = aViewData.GetViewShell();
376  bool bRefMode = pViewShell && pViewShell->IsRefInputMode();
377  if ( aViewData.HasEditView( aViewData.GetActivePart() ) && !bRefMode ) // 23259 or so
378  {
379  UpdateInputLine();
380  }
381 
382  HideAllCursors();
383 
384  aViewData.SetCurX( nPosX );
385  aViewData.SetCurY( nPosY );
386 
387  ShowAllCursors();
388 
389  CursorPosChanged();
390 
391  OUString aCurrAddress = ScAddress(nPosX,nPosY,0).GetColRowString();
392  collectUIInformation({{"CELL", aCurrAddress}});
393 
395  return;
396 
397  if (nPosX <= aViewData.GetMaxTiledCol() - 10 && nPosY <= aViewData.GetMaxTiledRow() - 25)
398  return;
399 
400  ScDocument& rDoc = aViewData.GetDocument();
401  ScDocShell* pDocSh = aViewData.GetDocShell();
402  ScModelObj* pModelObj = pDocSh ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocSh->GetModel() ) : nullptr;
403  Size aOldSize(0, 0);
404  if (pModelObj)
405  aOldSize = pModelObj->getDocumentSize();
406 
407  if (nPosX > aViewData.GetMaxTiledCol() - 10)
408  aViewData.SetMaxTiledCol(std::min<SCCOL>(std::max(nPosX, aViewData.GetMaxTiledCol()) + 10, rDoc.MaxCol()));
409 
410  if (nPosY > aViewData.GetMaxTiledRow() - 25)
411  aViewData.SetMaxTiledRow(std::min<SCROW>(std::max(nPosY, aViewData.GetMaxTiledRow()) + 25, MAXTILEDROW));
412 
413  Size aNewSize(0, 0);
414  if (pModelObj)
415  aNewSize = pModelObj->getDocumentSize();
416 
417  if (!pDocSh)
418  return;
419 
420  // New area extended to the right of the sheet after last column
421  // including overlapping area with aNewRowArea
422  tools::Rectangle aNewColArea(aOldSize.getWidth(), 0, aNewSize.getWidth(), aNewSize.getHeight());
423  // New area extended to the bottom of the sheet after last row
424  // excluding overlapping area with aNewColArea
425  tools::Rectangle aNewRowArea(0, aOldSize.getHeight(), aOldSize.getWidth(), aNewSize.getHeight());
426 
427  // Only invalidate if spreadsheet extended to the right
428  if (aNewColArea.getWidth())
429  {
430  SfxLokHelper::notifyInvalidation(aViewData.GetViewShell(), aNewColArea.toString());
431  }
432 
433  // Only invalidate if spreadsheet extended to the bottom
434  if (aNewRowArea.getHeight())
435  {
436  SfxLokHelper::notifyInvalidation(aViewData.GetViewShell(), aNewRowArea.toString());
437  }
438 
439  // Provide size in the payload, so clients don't have to
440  // call lok::Document::getDocumentSize().
441  std::stringstream ss;
442  ss << aNewSize.Width() << ", " << aNewSize.Height();
443  OString sSize = ss.str().c_str();
444  ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(aViewData.GetViewShell()->GetCurrentDocument());
445  SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel, false);
446 }
447 
448 static bool lcl_IsRefDlgActive(SfxViewFrame* pViewFrm)
449 {
450  ScModule* pScMod = SC_MOD();
451  if (!pScMod->IsRefDialogOpen())
452  return false;
453 
454  auto nDlgId = pScMod->GetCurRefDlgId();
455  if (!pViewFrm->HasChildWindow(nDlgId))
456  return false;
457 
458  SfxChildWindow* pChild = pViewFrm->GetChildWindow(nDlgId);
459  if (!pChild)
460  return false;
461 
462  auto xDlgController = pChild->GetController();
463  if (!xDlgController || !xDlgController->getDialog()->get_visible())
464  return false;
465 
466  IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(xDlgController.get());
467  return pRefDlg && pRefDlg->IsRefInputMode();
468 }
469 
471 {
472  if ( !aViewData.IsActive() ) // only for active view
473  return;
474 
475  ScModule* pScMod = SC_MOD();
478  if ( !pNew )
479  return;
480 
481  // create new selection
482 
483  if (pOld)
484  pOld->ForgetView();
485 
486  pScMod->SetSelectionTransfer( pNew.get() );
487 
488  // tdf#124975/tdf#136242 changing the calc selection can trigger removal of the
489  // selection of an open RefDlg dialog, so don't inform the
490  // desktop clipboard of the changed selection if that dialog is open
491  if (!lcl_IsRefDlgActive(aViewData.GetViewShell()->GetViewFrame()))
492  pNew->CopyToSelection( GetActiveWin() ); // may delete pOld
493 
494  // Log the selection change
495  ScMarkData& rMark = aViewData.GetMarkData();
496  if (rMark.IsMarked())
497  {
498  ScRange aMarkRange;
499  rMark.GetMarkArea( aMarkRange );
500  OUString aStartAddress = aMarkRange.aStart.GetColRowString();
501  OUString aEndAddress = aMarkRange.aEnd.GetColRowString();
502  collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}});
503  }
504 }
505 
506 // update input row / menus
507 // CursorPosChanged calls SelectionChanged
508 // SelectionChanged calls CellContentChanged
509 
511 {
512  SfxBindings& rBindings = aViewData.GetBindings();
513 
514  rBindings.Invalidate( SID_ATTR_SIZE ); // -> show error message
515  rBindings.Invalidate( SID_THESAURUS );
516  rBindings.Invalidate( SID_HYPERLINK_GETLINK );
517  rBindings.Invalidate( SID_ROWCOL_SELCOUNT );
518 
519  InvalidateAttribs(); // attribut updates
520 
521  aViewData.GetViewShell()->UpdateInputHandler();
522 }
523 
524 void ScTabView::SetTabProtectionSymbol( SCTAB nTab, const bool bProtect )
525 {
526  pTabControl->SetProtectionSymbol( static_cast<sal_uInt16>(nTab)+1, bProtect);
527 }
528 
529 void ScTabView::SelectionChanged(bool bFromPaste)
530 {
531  SfxViewFrame* pViewFrame = aViewData.GetViewShell()->GetViewFrame();
532  if (pViewFrame)
533  {
534  uno::Reference<frame::XController> xController = pViewFrame->GetFrame().GetController();
535  if (xController.is())
536  {
537  ScTabViewObj* pImp = comphelper::getUnoTunnelImplementation<ScTabViewObj>( xController );
538  if (pImp)
539  pImp->SelectionChanged();
540  }
541  }
542 
543  UpdateAutoFillMark(bFromPaste); // also calls CheckSelectionTransfer
544 
545  SfxBindings& rBindings = aViewData.GetBindings();
546 
547  rBindings.Invalidate( SID_CURRENTCELL ); // -> Navigator
548  rBindings.Invalidate( SID_AUTO_FILTER ); // -> Menu
549  rBindings.Invalidate( FID_NOTE_VISIBLE );
550  rBindings.Invalidate( FID_SHOW_NOTE );
551  rBindings.Invalidate( FID_HIDE_NOTE );
552  rBindings.Invalidate( FID_SHOW_ALL_NOTES );
553  rBindings.Invalidate( FID_HIDE_ALL_NOTES );
554  rBindings.Invalidate( SID_TOGGLE_NOTES );
555  rBindings.Invalidate( SID_DELETE_NOTE );
556  rBindings.Invalidate( SID_ROWCOL_SELCOUNT );
557 
558  // functions than may need to be disabled
559 
560  rBindings.Invalidate( FID_INS_ROWBRK );
561  rBindings.Invalidate( FID_INS_COLBRK );
562  rBindings.Invalidate( FID_DEL_ROWBRK );
563  rBindings.Invalidate( FID_DEL_COLBRK );
564  rBindings.Invalidate( FID_MERGE_ON );
565  rBindings.Invalidate( FID_MERGE_OFF );
566  rBindings.Invalidate( FID_MERGE_TOGGLE );
567  rBindings.Invalidate( SID_AUTOFILTER_HIDE );
568  rBindings.Invalidate( SID_UNFILTER );
569  rBindings.Invalidate( SID_REIMPORT_DATA );
570  rBindings.Invalidate( SID_REFRESH_DBAREA );
571  rBindings.Invalidate( SID_OUTLINE_SHOW );
572  rBindings.Invalidate( SID_OUTLINE_HIDE );
573  rBindings.Invalidate( SID_OUTLINE_REMOVE );
574  rBindings.Invalidate( FID_FILL_TO_BOTTOM );
575  rBindings.Invalidate( FID_FILL_TO_RIGHT );
576  rBindings.Invalidate( FID_FILL_TO_TOP );
577  rBindings.Invalidate( FID_FILL_TO_LEFT );
578  rBindings.Invalidate( FID_FILL_SERIES );
579  rBindings.Invalidate( SID_SCENARIOS );
580  rBindings.Invalidate( SID_AUTOFORMAT );
581  rBindings.Invalidate( SID_OPENDLG_TABOP );
582  rBindings.Invalidate( SID_DATA_SELECT );
583 
584  rBindings.Invalidate( SID_CUT );
585  rBindings.Invalidate( SID_COPY );
586  rBindings.Invalidate( SID_PASTE );
587  rBindings.Invalidate( SID_PASTE_SPECIAL );
588  rBindings.Invalidate( SID_PASTE_UNFORMATTED );
589 
590  rBindings.Invalidate( FID_INS_ROW );
591  rBindings.Invalidate( FID_INS_COLUMN );
592  rBindings.Invalidate( FID_INS_ROWS_BEFORE );
593  rBindings.Invalidate( FID_INS_COLUMNS_BEFORE );
594  rBindings.Invalidate( FID_INS_ROWS_AFTER );
595  rBindings.Invalidate( FID_INS_COLUMNS_AFTER );
596  rBindings.Invalidate( FID_INS_CELL );
597  rBindings.Invalidate( FID_INS_CELLSDOWN );
598  rBindings.Invalidate( FID_INS_CELLSRIGHT );
599 
600  rBindings.Invalidate( FID_CHG_COMMENT );
601 
602  // only due to protect cell:
603 
604  rBindings.Invalidate( SID_CELL_FORMAT_RESET );
605  rBindings.Invalidate( SID_DELETE );
606  rBindings.Invalidate( SID_DELETE_CONTENTS );
607  rBindings.Invalidate( FID_DELETE_CELL );
608  rBindings.Invalidate( FID_CELL_FORMAT );
609  rBindings.Invalidate( SID_ENABLE_HYPHENATION );
610  rBindings.Invalidate( SID_INSERT_POSTIT );
611  rBindings.Invalidate( SID_CHARMAP );
612  rBindings.Invalidate( SID_OPENDLG_FUNCTION );
613  rBindings.Invalidate( FID_VALIDATION );
614  rBindings.Invalidate( SID_EXTERNAL_SOURCE );
615  rBindings.Invalidate( SID_TEXT_TO_COLUMNS );
616  rBindings.Invalidate( SID_SORT_ASCENDING );
617  rBindings.Invalidate( SID_SORT_DESCENDING );
618  rBindings.Invalidate( SID_SELECT_UNPROTECTED_CELLS );
619 
620  if (aViewData.GetViewShell()->HasAccessibilityObjects())
621  aViewData.GetViewShell()->BroadcastAccessibility(SfxHint(SfxHintId::ScAccCursorChanged));
622 
623  CellContentChanged();
624 }
625 
627 {
628  bool bRefMode = SC_MOD()->IsFormulaMode();
629  if ( !bRefMode ) // check that RefMode works when switching sheets
630  aViewData.GetDocShell()->Broadcast( SfxHint( SfxHintId::ScKillEditView ) );
631 
632  // Broadcast, so that other Views of the document also switch
633 
634  ScDocument& rDoc = aViewData.GetDocument();
635  bool bDP = nullptr != rDoc.GetDPAtCursor(
636  aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo() );
637  aViewData.GetViewShell()->SetPivotShell(bDP);
638 
639  // UpdateInputHandler now in CellContentChanged
640 
641  SelectionChanged();
642 
643  aViewData.SetTabStartCol( SC_TABSTART_NONE );
644 }
645 
646 namespace {
647 
648 Point calcHintWindowPosition(
649  const Point& rCellPos, const Size& rCellSize, const Size& rFrameWndSize, const Size& rHintWndSize)
650 {
651  const tools::Long nMargin = 20;
652 
653  tools::Long nMLeft = rCellPos.X();
654  tools::Long nMRight = rFrameWndSize.Width() - rCellPos.X() - rCellSize.Width();
655  tools::Long nMTop = rCellPos.Y();
656  tools::Long nMBottom = rFrameWndSize.Height() - rCellPos.Y() - rCellSize.Height();
657 
658  // First, see if we can fit the entire hint window in the visible region.
659 
660  if (nMRight - nMargin >= rHintWndSize.Width())
661  {
662  // Right margin is wide enough.
663  if (rFrameWndSize.Height() >= rHintWndSize.Height())
664  {
665  // The frame has enough height. Take it.
666  Point aPos = rCellPos;
667  aPos.AdjustX(rCellSize.Width() + nMargin );
668  if (aPos.Y() + rHintWndSize.Height() > rFrameWndSize.Height())
669  {
670  // Push the hint window up a bit to make it fit.
671  aPos.setY( rFrameWndSize.Height() - rHintWndSize.Height() );
672  }
673  return aPos;
674  }
675  }
676 
677  if (nMBottom - nMargin >= rHintWndSize.Height())
678  {
679  // Bottom margin is high enough.
680  if (rFrameWndSize.Width() >= rHintWndSize.Width())
681  {
682  // The frame has enough width. Take it.
683  Point aPos = rCellPos;
684  aPos.AdjustY(rCellSize.Height() + nMargin );
685  if (aPos.X() + rHintWndSize.Width() > rFrameWndSize.Width())
686  {
687  // Move the hint window to the left to make it fit.
688  aPos.setX( rFrameWndSize.Width() - rHintWndSize.Width() );
689  }
690  return aPos;
691  }
692  }
693 
694  if (nMLeft - nMargin >= rHintWndSize.Width())
695  {
696  // Left margin is wide enough.
697  if (rFrameWndSize.Height() >= rHintWndSize.Height())
698  {
699  // The frame is high enough. Take it.
700  Point aPos = rCellPos;
701  aPos.AdjustX( -(rHintWndSize.Width() + nMargin) );
702  if (aPos.Y() + rHintWndSize.Height() > rFrameWndSize.Height())
703  {
704  // Push the hint window up a bit to make it fit.
705  aPos.setY( rFrameWndSize.Height() - rHintWndSize.Height() );
706  }
707  return aPos;
708  }
709  }
710 
711  if (nMTop - nMargin >= rHintWndSize.Height())
712  {
713  // Top margin is high enough.
714  if (rFrameWndSize.Width() >= rHintWndSize.Width())
715  {
716  // The frame is wide enough. Take it.
717  Point aPos = rCellPos;
718  aPos.AdjustY( -(rHintWndSize.Height() + nMargin) );
719  if (aPos.X() + rHintWndSize.Width() > rFrameWndSize.Width())
720  {
721  // Move the hint window to the left to make it fit.
722  aPos.setX( rFrameWndSize.Width() - rHintWndSize.Width() );
723  }
724  return aPos;
725  }
726  }
727 
728  // The popup doesn't fit in any direction in its entirety. Do our best.
729 
730  if (nMRight - nMargin >= rHintWndSize.Width())
731  {
732  // Right margin is good enough.
733  Point aPos = rCellPos;
734  aPos.AdjustX(nMargin + rCellSize.Width() );
735  aPos.setY( 0 );
736  return aPos;
737  }
738 
739  if (nMBottom - nMargin >= rHintWndSize.Height())
740  {
741  // Bottom margin is good enough.
742  Point aPos = rCellPos;
743  aPos.AdjustY(nMargin + rCellSize.Height() );
744  aPos.setX( 0 );
745  return aPos;
746  }
747 
748  if (nMLeft - nMargin >= rHintWndSize.Width())
749  {
750  // Left margin is good enough.
751  Point aPos = rCellPos;
752  aPos.AdjustX( -(rHintWndSize.Width() + nMargin) );
753  aPos.setY( 0 );
754  return aPos;
755  }
756 
757  if (nMTop - nMargin >= rHintWndSize.Height())
758  {
759  // Top margin is good enough.
760  Point aPos = rCellPos;
761  aPos.AdjustY( -(rHintWndSize.Height() + nMargin) );
762  aPos.setX( 0 );
763  return aPos;
764  }
765 
766  // None of the above. Hopeless. At least try not to cover the current
767  // cell.
768  Point aPos = rCellPos;
769  aPos.AdjustX(rCellSize.Width() );
770  return aPos;
771 }
772 
773 }
774 
776 {
777  // show input help window and list drop-down button for validity
778 
779  mxInputHintOO.reset();
780 
781  bool bListValButton = false;
782  ScAddress aListValPos;
783 
784  ScDocument& rDoc = aViewData.GetDocument();
785  const SfxUInt32Item* pItem = rDoc.GetAttr( aViewData.GetCurX(),
786  aViewData.GetCurY(),
787  aViewData.GetTabNo(),
788  ATTR_VALIDDATA );
789  if ( pItem->GetValue() )
790  {
791  const ScValidationData* pData = rDoc.GetValidationEntry( pItem->GetValue() );
792  OSL_ENSURE(pData,"ValidationData not found");
793  OUString aTitle, aMessage;
794 
795  if ( pData && pData->GetInput( aTitle, aMessage ) && !aMessage.isEmpty() )
796  {
797  ScSplitPos eWhich = aViewData.GetActivePart();
798  ScGridWindow* pWin = pGridWin[eWhich].get();
799  SCCOL nCol = aViewData.GetCurX();
800  SCROW nRow = aViewData.GetCurY();
801  Point aPos = aViewData.GetScrPos( nCol, nRow, eWhich );
802  Size aWinSize = pWin->GetOutputSizePixel();
803  // cursor visible?
804  if ( nCol >= aViewData.GetPosX(WhichH(eWhich)) &&
805  nRow >= aViewData.GetPosY(WhichV(eWhich)) &&
806  aPos.X() < aWinSize.Width() && aPos.Y() < aWinSize.Height() )
807  {
808  const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
809  Color aCommentColor = rColorCfg.GetColorValue(svtools::CALCNOTESBACKGROUND).nColor;
810  // create HintWindow, determines its size by itself
811  ScOverlayHint* pOverlay = new ScOverlayHint(aTitle, aMessage, aCommentColor, pFrameWin->GetFont());
812 
813  mxInputHintOO.reset(new sdr::overlay::OverlayObjectList);
814  mxInputHintOO->append(std::unique_ptr<sdr::overlay::OverlayObject>(pOverlay));
815 
816  Size aHintWndSize = pOverlay->GetSizePixel();
817  tools::Long nCellSizeX = 0;
818  tools::Long nCellSizeY = 0;
819  aViewData.GetMergeSizePixel(nCol, nRow, nCellSizeX, nCellSizeY);
820 
821  Point aHintPos = calcHintWindowPosition(
822  aPos, Size(nCellSizeX,nCellSizeY), aWinSize, aHintWndSize);
823 
824  pOverlay->SetPos(pWin->PixelToLogic(aHintPos, pWin->GetDrawMapMode()), pWin->GetDrawMapMode());
825  for (VclPtr<ScGridWindow> & pWindow : pGridWin)
826  {
827  if (!pWindow)
828  continue;
829  if (!pWindow->IsVisible())
830  continue;
831  rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = pWindow->getOverlayManager();
832  if (!xOverlayManager.is())
833  continue;
834  if (pWindow == pWin)
835  {
836  xOverlayManager->add(*pOverlay);
837  pWindow->updateLOKInputHelp(aTitle, aMessage);
838  }
839  else
840  {
841  //tdf#92530 if the help tip doesn't fit into its allocated area in a split window
842  //scenario, then because here we place it into the other split windows as well the
843  //missing portions will be displayed in the other split windows to form an apparent
844  //single tip, albeit "under" the split lines
845  Point aOtherPos(pWindow->ScreenToOutputPixel(pWin->OutputToScreenPixel(aHintPos)));
846  std::unique_ptr<ScOverlayHint> pOtherOverlay(new ScOverlayHint(aTitle, aMessage, aCommentColor, pFrameWin->GetFont()));
847  Point aFooPos(pWindow->PixelToLogic(aOtherPos, pWindow->GetDrawMapMode()));
848  pOtherOverlay->SetPos(aFooPos, pWindow->GetDrawMapMode());
849  xOverlayManager->add(*pOtherOverlay);
850  mxInputHintOO->append(std::move(pOtherOverlay));
851  }
852  }
853  }
854  }
855 
856  // list drop-down button
857  if ( pData && pData->HasSelectionList() )
858  {
859  aListValPos.Set( aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo() );
860  bListValButton = true;
861  }
862  }
863 
864  for (VclPtr<ScGridWindow> const & pWin : pGridWin)
865  {
866  if (pWin && pWin->IsVisible())
867  pWin->UpdateListValPos(bListValButton, aListValPos);
868  }
869 }
870 
871 bool ScTabView::HasHintWindow() const { return mxInputHintOO != nullptr; }
872 
874 {
875  mxInputHintOO.reset();
876 }
877 
878 // find window that should not be over the cursor
880 {
882 
883  // search & replace
884  if (pViewFrm->HasChildWindow(SID_SEARCH_DLG))
885  {
886  SfxChildWindow* pChild = pViewFrm->GetChildWindow(SID_SEARCH_DLG);
887  if (pChild)
888  {
889  auto xDlgController = pChild->GetController();
890  if (xDlgController && xDlgController->getDialog()->get_visible())
891  return xDlgController->getDialog();
892  }
893  }
894 
895  // apply changes
896  if ( pViewFrm->HasChildWindow(FID_CHG_ACCEPT) )
897  {
898  SfxChildWindow* pChild = pViewFrm->GetChildWindow(FID_CHG_ACCEPT);
899  if (pChild)
900  {
901  auto xDlgController = pChild->GetController();
902  if (xDlgController && xDlgController->getDialog()->get_visible())
903  return xDlgController->getDialog();
904  }
905  }
906 
907  return nullptr;
908 }
909 
910  // adjust screen with respect to cursor position
911 
913  const ScSplitPos* pWhich )
914 {
915  // now switch active part here
916 
917  ScSplitPos eActive = aViewData.GetActivePart();
918  ScHSplitPos eActiveX = WhichH(eActive);
919  ScVSplitPos eActiveY = WhichV(eActive);
920  bool bHFix = (aViewData.GetHSplitMode() == SC_SPLIT_FIX);
921  bool bVFix = (aViewData.GetVSplitMode() == SC_SPLIT_FIX);
922  if (bHFix && eActiveX == SC_SPLIT_LEFT && nCurX >= aViewData.GetFixPosX())
923  {
924  ActivatePart( (eActiveY==SC_SPLIT_TOP) ? SC_SPLIT_TOPRIGHT : SC_SPLIT_BOTTOMRIGHT );
925  eActiveX = SC_SPLIT_RIGHT;
926  }
927  if (bVFix && eActiveY == SC_SPLIT_TOP && nCurY >= aViewData.GetFixPosY())
928  {
929  ActivatePart( (eActiveX==SC_SPLIT_LEFT) ? SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT );
930  eActiveY = SC_SPLIT_BOTTOM;
931  }
932 
933  // actual align
934 
935  if ( eMode != SC_FOLLOW_NONE )
936  {
937  ScSplitPos eAlign;
938  if (pWhich)
939  eAlign = *pWhich;
940  else
941  eAlign = aViewData.GetActivePart();
942  ScHSplitPos eAlignX = WhichH(eAlign);
943  ScVSplitPos eAlignY = WhichV(eAlign);
944 
945  SCCOL nDeltaX = aViewData.GetPosX(eAlignX);
946  SCROW nDeltaY = aViewData.GetPosY(eAlignY);
947  SCCOL nSizeX = aViewData.VisibleCellsX(eAlignX);
948  SCROW nSizeY = aViewData.VisibleCellsY(eAlignY);
949 
950  tools::Long nCellSizeX;
951  tools::Long nCellSizeY;
952  if ( nCurX >= 0 && nCurY >= 0 )
953  aViewData.GetMergeSizePixel( nCurX, nCurY, nCellSizeX, nCellSizeY );
954  else
955  nCellSizeX = nCellSizeY = 0;
956  Size aScrSize = aViewData.GetScrSize();
957  tools::Long nSpaceX = ( aScrSize.Width() - nCellSizeX ) / 2;
958  tools::Long nSpaceY = ( aScrSize.Height() - nCellSizeY ) / 2;
959  // nSpaceY: desired start position of cell for FOLLOW_JUMP, modified if dialog interferes
960 
961  bool bForceNew = false; // force new calculation of JUMP position (vertical only)
962 
963  // VisibleCellsY == CellsAtY( GetPosY( eWhichY ), 1, eWhichY )
964 
965  // when for instance a search dialog is open, don't put the cursor behind the dialog
966  // if possible, put the row with the cursor above or below the dialog
968 
969  if ( eMode == SC_FOLLOW_JUMP )
970  {
971  weld::Window* pCare = lcl_GetCareWin( aViewData.GetViewShell()->GetViewFrame() );
972  if (pCare)
973  {
974  bool bLimit = false;
975  tools::Rectangle aDlgPixel;
976  Size aWinSize;
977  vcl::Window* pWin = GetActiveWin();
978  weld::Window* pFrame = pWin ? pWin->GetFrameWeld() : nullptr;
979  int x, y, width, height;
980  if (pFrame && pCare->get_extents_relative_to(*pFrame, x, y, width, height))
981  {
982  aDlgPixel = tools::Rectangle(Point(x, y), Size(width, height));
983  aWinSize = pWin->GetOutputSizePixel();
984  // dos the dialog cover the GridWin?
985  if ( aDlgPixel.Right() >= 0 && aDlgPixel.Left() < aWinSize.Width() )
986  {
987  if ( nCurX < nDeltaX || nCurX >= nDeltaX+nSizeX ||
988  nCurY < nDeltaY || nCurY >= nDeltaY+nSizeY )
989  bLimit = true; // scroll anyway
990  else
991  {
992  // cursor is on the screen
993  Point aStart = aViewData.GetScrPos( nCurX, nCurY, eAlign );
994  tools::Long nCSX, nCSY;
995  aViewData.GetMergeSizePixel( nCurX, nCurY, nCSX, nCSY );
996  tools::Rectangle aCursor( aStart, Size( nCSX, nCSY ) );
997  if ( aCursor.IsOver( aDlgPixel ) )
998  bLimit = true; // cell is covered by the dialog
999  }
1000  }
1001  }
1002 
1003  if (bLimit)
1004  {
1005  bool bBottom = false;
1006  tools::Long nTopSpace = aDlgPixel.Top();
1007  tools::Long nBotSpace = aWinSize.Height() - aDlgPixel.Bottom();
1008  if ( nBotSpace > 0 && nBotSpace > nTopSpace )
1009  {
1010  tools::Long nDlgBot = aDlgPixel.Bottom();
1011  SCCOL nWPosX;
1012  SCROW nWPosY;
1013  aViewData.GetPosFromPixel( 0,nDlgBot, eAlign, nWPosX, nWPosY );
1014  ++nWPosY; // below the last affected cell
1015 
1016  SCROW nDiff = nWPosY - nDeltaY;
1017  if ( nCurY >= nDiff ) // position can not be negative
1018  {
1019  nSpaceY = nDlgBot + ( nBotSpace - nCellSizeY ) / 2;
1020  bBottom = true;
1021  bForceNew = true;
1022  }
1023  }
1024  if ( !bBottom && nTopSpace > 0 )
1025  {
1026  nSpaceY = ( nTopSpace - nCellSizeY ) / 2;
1027  bForceNew = true;
1028  }
1029  }
1030  }
1031  }
1032 
1033  SCCOL nNewDeltaX = nDeltaX;
1034  SCROW nNewDeltaY = nDeltaY;
1035  bool bDoLine = false;
1036 
1037  switch (eMode)
1038  {
1039  case SC_FOLLOW_JUMP:
1040  if ( nCurX < nDeltaX || nCurX >= nDeltaX+nSizeX )
1041  {
1042  nNewDeltaX = nCurX - aViewData.CellsAtX( nCurX, -1, eAlignX, static_cast<sal_uInt16>(nSpaceX) );
1043  if (nNewDeltaX < 0)
1044  nNewDeltaX = 0;
1045  nSizeX = aViewData.CellsAtX( nNewDeltaX, 1, eAlignX );
1046  }
1047  if ( nCurY < nDeltaY || nCurY >= nDeltaY+nSizeY || bForceNew )
1048  {
1049  nNewDeltaY = nCurY - aViewData.CellsAtY( nCurY, -1, eAlignY, static_cast<sal_uInt16>(nSpaceY) );
1050  if (nNewDeltaY < 0)
1051  nNewDeltaY = 0;
1052  nSizeY = aViewData.CellsAtY( nNewDeltaY, 1, eAlignY );
1053  }
1054  bDoLine = true;
1055  break;
1056 
1057  case SC_FOLLOW_LINE:
1058  bDoLine = true;
1059  break;
1060 
1061  case SC_FOLLOW_FIX:
1062  if ( nCurX < nDeltaX || nCurX >= nDeltaX+nSizeX )
1063  {
1064  nNewDeltaX = nDeltaX + nCurX - aViewData.GetCurX();
1065  if (nNewDeltaX < 0)
1066  nNewDeltaX = 0;
1067  nSizeX = aViewData.CellsAtX( nNewDeltaX, 1, eAlignX );
1068  }
1069  if ( nCurY < nDeltaY || nCurY >= nDeltaY+nSizeY )
1070  {
1071  nNewDeltaY = nDeltaY + nCurY - aViewData.GetCurY();
1072  if (nNewDeltaY < 0)
1073  nNewDeltaY = 0;
1074  nSizeY = aViewData.CellsAtY( nNewDeltaY, 1, eAlignY );
1075  }
1076 
1077  // like old version of SC_FOLLOW_JUMP:
1078 
1079  if ( nCurX < nNewDeltaX || nCurX >= nNewDeltaX+nSizeX )
1080  {
1081  nNewDeltaX = nCurX - (nSizeX / 2);
1082  if (nNewDeltaX < 0)
1083  nNewDeltaX = 0;
1084  nSizeX = aViewData.CellsAtX( nNewDeltaX, 1, eAlignX );
1085  }
1086  if ( nCurY < nNewDeltaY || nCurY >= nNewDeltaY+nSizeY )
1087  {
1088  nNewDeltaY = nCurY - (nSizeY / 2);
1089  if (nNewDeltaY < 0)
1090  nNewDeltaY = 0;
1091  nSizeY = aViewData.CellsAtY( nNewDeltaY, 1, eAlignY );
1092  }
1093 
1094  bDoLine = true;
1095  break;
1096 
1097  case SC_FOLLOW_NONE:
1098  break;
1099  default:
1100  OSL_FAIL("Wrong cursor mode");
1101  break;
1102  }
1103 
1104  ScDocument& rDoc = aViewData.GetDocument();
1105  if (bDoLine)
1106  {
1107  while ( nCurX >= nNewDeltaX+nSizeX )
1108  {
1109  nNewDeltaX = nCurX-nSizeX+1;
1110  SCTAB nTab = aViewData.GetTabNo();
1111  while ( nNewDeltaX < rDoc.MaxCol() && !rDoc.GetColWidth( nNewDeltaX, nTab ) )
1112  ++nNewDeltaX;
1113  nSizeX = aViewData.CellsAtX( nNewDeltaX, 1, eAlignX );
1114  }
1115  while ( nCurY >= nNewDeltaY+nSizeY )
1116  {
1117  nNewDeltaY = nCurY-nSizeY+1;
1118  SCTAB nTab = aViewData.GetTabNo();
1119  while ( nNewDeltaY < rDoc.MaxRow() && !rDoc.GetRowHeight( nNewDeltaY, nTab ) )
1120  ++nNewDeltaY;
1121  nSizeY = aViewData.CellsAtY( nNewDeltaY, 1, eAlignY );
1122  }
1123  if ( nCurX < nNewDeltaX )
1124  nNewDeltaX = nCurX;
1125  if ( nCurY < nNewDeltaY )
1126  nNewDeltaY = nCurY;
1127  }
1128 
1129  if ( nNewDeltaX != nDeltaX )
1130  nSizeX = aViewData.CellsAtX( nNewDeltaX, 1, eAlignX );
1131  if (nNewDeltaX+nSizeX-1 > rDoc.MaxCol())
1132  nNewDeltaX = rDoc.MaxCol()-nSizeX+1;
1133  if (nNewDeltaX < 0)
1134  nNewDeltaX = 0;
1135 
1136  if ( nNewDeltaY != nDeltaY )
1137  nSizeY = aViewData.CellsAtY( nNewDeltaY, 1, eAlignY );
1138  if (nNewDeltaY+nSizeY-1 > rDoc.MaxRow())
1139  nNewDeltaY = rDoc.MaxRow()-nSizeY+1;
1140  if (nNewDeltaY < 0)
1141  nNewDeltaY = 0;
1142 
1143  if ( nNewDeltaX != nDeltaX )
1144  ScrollX( nNewDeltaX - nDeltaX, eAlignX );
1145  if ( nNewDeltaY != nDeltaY )
1146  ScrollY( nNewDeltaY - nDeltaY, eAlignY );
1147  }
1148 
1149  // switch active part again
1150 
1151  if (bHFix)
1152  if (eActiveX == SC_SPLIT_RIGHT && nCurX < aViewData.GetFixPosX())
1153  {
1154  ActivatePart( (eActiveY==SC_SPLIT_TOP) ? SC_SPLIT_TOPLEFT : SC_SPLIT_BOTTOMLEFT );
1155  eActiveX = SC_SPLIT_LEFT;
1156  }
1157  if (bVFix)
1158  if (eActiveY == SC_SPLIT_BOTTOM && nCurY < aViewData.GetFixPosY())
1159  {
1160  ActivatePart( (eActiveX==SC_SPLIT_LEFT) ? SC_SPLIT_TOPLEFT : SC_SPLIT_TOPRIGHT );
1161  }
1162 }
1163 
1165 {
1166  bool bRet = false;
1167 
1168  // #i3875# *Hack*
1169  bool bMod1Locked = (aViewData.GetViewShell()->GetLockedModifiers() & KEY_MOD1) != 0;
1170  aViewData.SetSelCtrlMouseClick( rMEvt.IsMod1() || bMod1Locked );
1171 
1172  if ( pSelEngine )
1173  {
1174  bMoveIsShift = rMEvt.IsShift();
1175  bRet = pSelEngine->SelMouseButtonDown( rMEvt );
1176  bMoveIsShift = false;
1177  }
1178 
1179  aViewData.SetSelCtrlMouseClick( false ); // #i3875# *Hack*
1180 
1181  return bRet;
1182 }
1183 
1184  // MoveCursor - with adjustment of the view section
1185 
1187  bool bShift, bool bControl, bool bKeepOld, bool bKeepSel )
1188 {
1189  if (!bKeepOld)
1190  aViewData.ResetOldCursor();
1191 
1192  ScDocument& rDoc = aViewData.GetDocument();
1193  // #i123629#
1194  if( aViewData.GetViewShell()->GetForceFocusOnCurCell() )
1195  aViewData.GetViewShell()->SetForceFocusOnCurCell( !rDoc.ValidColRow(nCurX, nCurY) );
1196 
1197  if (nCurX < 0) nCurX = 0;
1198  if (nCurY < 0) nCurY = 0;
1199  if (nCurX > rDoc.MaxCol()) nCurX = rDoc.MaxCol();
1200  if (nCurY > rDoc.MaxRow()) nCurY = rDoc.MaxRow();
1201 
1202  // FIXME: this is to limit the number of rows handled in the Online
1203  // to 1000; this will be removed again when the performance
1204  // bottlenecks are sorted out
1206  nCurY = std::min(nCurY, MAXTILEDROW);
1207 
1208  HideAllCursors();
1209 
1210  // switch of active now in AlignToCursor
1211 
1212  AlignToCursor( nCurX, nCurY, eMode );
1213 
1214  if (bKeepSel)
1215  {
1216  SetCursor( nCurX, nCurY ); // keep selection
1217 
1218  // If the cursor is in existing selection, it's a cursor movement by
1219  // ENTER or TAB. If not, then it's a new selection during ADD
1220  // selection mode.
1221 
1222  const ScMarkData& rMark = aViewData.GetMarkData();
1223  ScRangeList aSelList;
1224  rMark.FillRangeListWithMarks(&aSelList, false);
1225  if (!aSelList.In(ScRange(nCurX, nCurY, aViewData.GetTabNo())))
1226  // Cursor not in existing selection. Start a new selection.
1227  DoneBlockMode(true);
1228  }
1229  else
1230  {
1231  if (!bShift)
1232  {
1233  // Remove all marked data on cursor movement unless the Shift is locked.
1234  ScMarkData& rMark = aViewData.GetMarkData();
1235  bool bMarked = rMark.IsMarked() || rMark.IsMultiMarked();
1236  if (bMarked)
1237  {
1238  rMark.ResetMark();
1239  DoneBlockMode();
1240  InitOwnBlockMode();
1241  MarkDataChanged();
1242  }
1243  }
1244 
1245  bool bSame = ( nCurX == aViewData.GetCurX() && nCurY == aViewData.GetCurY() );
1246  bMoveIsShift = bShift;
1247  pSelEngine->CursorPosChanging( bShift, bControl );
1248  bMoveIsShift = false;
1249  aFunctionSet.SetCursorAtCell( nCurX, nCurY, false );
1250 
1251  // If the cursor has not been moved, the SelectionChanged for canceling the
1252  // selection has to happen here individually:
1253  if (bSame)
1254  SelectionChanged();
1255  }
1256 
1257  ShowAllCursors();
1258  TestHintWindow();
1259 }
1260 
1262  bool bShift, bool bKeepSel )
1263 {
1264  ScDocument& rDoc = aViewData.GetDocument();
1265  SCTAB nTab = aViewData.GetTabNo();
1266 
1267  bool bSkipProtected = false, bSkipUnprotected = false;
1268  const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
1269  if ( pProtect && pProtect->isProtected() )
1270  {
1271  bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
1272  bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
1273  }
1274 
1275  if ( bSkipProtected && bSkipUnprotected )
1276  return;
1277 
1278  SCCOL nOldX;
1279  SCROW nOldY;
1280  SCCOL nCurX;
1281  SCROW nCurY;
1282  if ( aViewData.IsRefMode() )
1283  {
1284  nOldX = aViewData.GetRefEndX();
1285  nOldY = aViewData.GetRefEndY();
1286  nCurX = nOldX + nMovX;
1287  nCurY = nOldY + nMovY;
1288  }
1289  else
1290  {
1291  nOldX = aViewData.GetCurX();
1292  nOldY = aViewData.GetCurY();
1293  nCurX = (nMovX != 0) ? nOldX+nMovX : aViewData.GetOldCurX();
1294  nCurY = (nMovY != 0) ? nOldY+nMovY : aViewData.GetOldCurY();
1295  }
1296 
1297  if (nMovX < 0 && nOldX == 0)
1298  { // trying to go left from 1st column
1299  if (nMovY == 0) // done, because no vertical move is requested
1300  return;
1301  }
1302  if (nMovY < 0 && nOldY == 0)
1303  { // trying to go up from 1st row
1304  if (nMovX == 0) // done, because no horizontal move is requested
1305  return;
1306  }
1307 
1308  aViewData.ResetOldCursor();
1309 
1310  if (nMovX != 0 && rDoc.ValidColRow(nCurX,nCurY))
1311  SkipCursorHorizontal(nCurX, nCurY, nOldX, nMovX);
1312 
1313  if (nMovY != 0 && rDoc.ValidColRow(nCurX,nCurY))
1314  SkipCursorVertical(nCurX, nCurY, nOldY, nMovY);
1315 
1316  MoveCursorAbs( nCurX, nCurY, eMode, bShift, false, true, bKeepSel );
1317 }
1318 
1319 void ScTabView::MoveCursorPage( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, bool bShift, bool bKeepSel )
1320 {
1321  SCCOL nPageX;
1322  SCROW nPageY;
1323  GetPageMoveEndPosition(nMovX, nMovY, nPageX, nPageY);
1324  MoveCursorRel( nPageX, nPageY, eMode, bShift, bKeepSel );
1325 }
1326 
1327 void ScTabView::MoveCursorArea( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, bool bShift, bool bKeepSel )
1328 {
1329  SCCOL nNewX;
1330  SCROW nNewY;
1331  GetAreaMoveEndPosition(nMovX, nMovY, eMode, nNewX, nNewY, eMode);
1332  MoveCursorRel(nNewX, nNewY, eMode, bShift, bKeepSel);
1333 }
1334 
1335 void ScTabView::MoveCursorEnd( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, bool bShift, bool bKeepSel )
1336 {
1337  ScDocument& rDoc = aViewData.GetDocument();
1338  SCTAB nTab = aViewData.GetTabNo();
1339 
1340  SCCOL nCurX;
1341  SCROW nCurY;
1342  aViewData.GetMoveCursor( nCurX,nCurY );
1343  SCCOL nNewX = nCurX;
1344  SCROW nNewY = nCurY;
1345 
1346  SCCOL nUsedX = 0;
1347  SCROW nUsedY = 0;
1348  if ( nMovX > 0 || nMovY > 0 )
1349  rDoc.GetPrintArea( nTab, nUsedX, nUsedY ); // get end
1350 
1351  if (nMovX<0)
1352  nNewX=0;
1353  else if (nMovX>0)
1354  nNewX=nUsedX; // last used range
1355 
1356  if (nMovY<0)
1357  nNewY=0;
1358  else if (nMovY>0)
1359  nNewY=nUsedY;
1360 
1361  aViewData.ResetOldCursor();
1362  MoveCursorRel( nNewX-nCurX, nNewY-nCurY, eMode, bShift, bKeepSel );
1363 }
1364 
1365 void ScTabView::MoveCursorScreen( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, bool bShift )
1366 {
1367  ScDocument& rDoc = aViewData.GetDocument();
1368  SCTAB nTab = aViewData.GetTabNo();
1369 
1370  SCCOL nCurX;
1371  SCROW nCurY;
1372  aViewData.GetMoveCursor( nCurX,nCurY );
1373  SCCOL nNewX = nCurX;
1374  SCROW nNewY = nCurY;
1375 
1376  ScSplitPos eWhich = aViewData.GetActivePart();
1377  SCCOL nPosX = aViewData.GetPosX( WhichH(eWhich) );
1378  SCROW nPosY = aViewData.GetPosY( WhichV(eWhich) );
1379 
1380  SCCOL nAddX = aViewData.VisibleCellsX( WhichH(eWhich) );
1381  if (nAddX != 0)
1382  --nAddX;
1383  SCROW nAddY = aViewData.VisibleCellsY( WhichV(eWhich) );
1384  if (nAddY != 0)
1385  --nAddY;
1386 
1387  if (nMovX<0)
1388  nNewX=nPosX;
1389  else if (nMovX>0)
1390  nNewX=nPosX+nAddX;
1391 
1392  if (nMovY<0)
1393  nNewY=nPosY;
1394  else if (nMovY>0)
1395  nNewY=nPosY+nAddY;
1396 
1397  aViewData.SetOldCursor( nNewX,nNewY );
1398  rDoc.SkipOverlapped(nNewX, nNewY, nTab);
1399  MoveCursorAbs( nNewX, nNewY, eMode, bShift, false, true );
1400 }
1401 
1402 void ScTabView::MoveCursorEnter( bool bShift ) // bShift -> up/down
1403 {
1404  const ScInputOptions& rOpt = SC_MOD()->GetInputOptions();
1405  if (!rOpt.GetMoveSelection())
1406  {
1407  aViewData.UpdateInputHandler(true);
1408  return;
1409  }
1410 
1411  SCCOL nMoveX = 0;
1412  SCROW nMoveY = 0;
1413  switch (static_cast<ScDirection>(rOpt.GetMoveDir()))
1414  {
1415  case DIR_BOTTOM:
1416  nMoveY = bShift ? -1 : 1;
1417  break;
1418  case DIR_RIGHT:
1419  nMoveX = bShift ? -1 : 1;
1420  break;
1421  case DIR_TOP:
1422  nMoveY = bShift ? 1 : -1;
1423  break;
1424  case DIR_LEFT:
1425  nMoveX = bShift ? 1 : -1;
1426  break;
1427  }
1428 
1429  SCCOL nCurX;
1430  SCROW nCurY;
1431  aViewData.GetMoveCursor( nCurX,nCurY );
1432  SCCOL nNewX = nCurX;
1433  SCROW nNewY = nCurY;
1434  SCTAB nTab = aViewData.GetTabNo();
1435 
1436  ScMarkData& rMark = aViewData.GetMarkData();
1437  ScDocument& rDoc = aViewData.GetDocument();
1438 
1439  if (rMark.IsMarked() || rMark.IsMultiMarked())
1440  {
1441  rDoc.GetNextPos( nNewX, nNewY, nTab, nMoveX, nMoveY, true, false, rMark );
1442 
1443  MoveCursorRel( nNewX - nCurX, nNewY - nCurY, SC_FOLLOW_LINE, false, true );
1444 
1445  // update input line even if cursor was not moved
1446  if ( nNewX == nCurX && nNewY == nCurY )
1447  aViewData.UpdateInputHandler(true);
1448  }
1449  else
1450  {
1451  // After Tab and Enter back to the starting column again.
1452  const SCCOL nTabStartCol = ((nMoveY != 0 && !nMoveX) ? aViewData.GetTabStartCol() : SC_TABSTART_NONE);
1453  rDoc.GetNextPos( nNewX, nNewY, nTab, nMoveX, nMoveY, false, true, rMark, nTabStartCol );
1454 
1455  MoveCursorRel( nNewX - nCurX, nNewY - nCurY, SC_FOLLOW_LINE, false);
1456  }
1457 }
1458 
1459 bool ScTabView::MoveCursorKeyInput( const KeyEvent& rKeyEvent )
1460 {
1461  const vcl::KeyCode& rKCode = rKeyEvent.GetKeyCode();
1462 
1463  enum { MOD_NONE, MOD_CTRL, MOD_ALT, MOD_BOTH } eModifier =
1464  rKCode.IsMod1() ?
1465  (rKCode.IsMod2() ? MOD_BOTH : MOD_CTRL) :
1466  (rKCode.IsMod2() ? MOD_ALT : MOD_NONE);
1467 
1468  bool bSel = rKCode.IsShift();
1469  sal_uInt16 nCode = rKCode.GetCode();
1470 
1471  // CURSOR keys
1472  SCCOL nDX = 0;
1473  SCROW nDY = 0;
1474  switch( nCode )
1475  {
1476  case KEY_LEFT: nDX = -1; break;
1477  case KEY_RIGHT: nDX = 1; break;
1478  case KEY_UP: nDY = -1; break;
1479  case KEY_DOWN: nDY = 1; break;
1480  }
1481  if( nDX != 0 || nDY != 0 )
1482  {
1483  switch( eModifier )
1484  {
1485  case MOD_NONE: MoveCursorRel( nDX, nDY, SC_FOLLOW_LINE, bSel ); break;
1486  case MOD_CTRL: MoveCursorArea( nDX, nDY, SC_FOLLOW_JUMP, bSel ); break;
1487  default:
1488  {
1489  // added to avoid warnings
1490  }
1491  }
1492  // always true to suppress changes of col/row size (ALT+CURSOR)
1493  return true;
1494  }
1495 
1496  // PAGEUP/PAGEDOWN
1497  if( (nCode == KEY_PAGEUP) || (nCode == KEY_PAGEDOWN) )
1498  {
1499  nDX = (nCode == KEY_PAGEUP) ? -1 : 1;
1500  switch( eModifier )
1501  {
1502  case MOD_NONE: MoveCursorPage( 0, static_cast<SCCOLROW>(nDX), SC_FOLLOW_FIX, bSel ); break;
1503  case MOD_ALT: MoveCursorPage( nDX, 0, SC_FOLLOW_FIX, bSel ); break;
1504  case MOD_CTRL: SelectNextTab( nDX, false ); break;
1505  default:
1506  {
1507  // added to avoid warnings
1508  }
1509  }
1510  return true;
1511  }
1512 
1513  // HOME/END
1514  if( (nCode == KEY_HOME) || (nCode == KEY_END) )
1515  {
1516  nDX = (nCode == KEY_HOME) ? -1 : 1;
1518  switch( eModifier )
1519  {
1520  case MOD_NONE: MoveCursorEnd( nDX, 0, eMode, bSel ); break;
1521  case MOD_CTRL: MoveCursorEnd( nDX, static_cast<SCCOLROW>(nDX), eMode, bSel ); break;
1522  default:
1523  {
1524  // added to avoid warnings
1525  }
1526  }
1527  return true;
1528  }
1529 
1530  return false;
1531 }
1532 
1533  // next/previous unprotected cell
1534 void ScTabView::FindNextUnprot( bool bShift, bool bInSelection )
1535 {
1536  short nMove = bShift ? -1 : 1;
1537 
1538  ScMarkData& rMark = aViewData.GetMarkData();
1539  bool bMarked = bInSelection && (rMark.IsMarked() || rMark.IsMultiMarked());
1540 
1541  SCCOL nCurX;
1542  SCROW nCurY;
1543  aViewData.GetMoveCursor( nCurX,nCurY );
1544  SCCOL nNewX = nCurX;
1545  SCROW nNewY = nCurY;
1546  SCTAB nTab = aViewData.GetTabNo();
1547 
1548  ScDocument& rDoc = aViewData.GetDocument();
1549  rDoc.GetNextPos( nNewX,nNewY, nTab, nMove,0, bMarked, true, rMark );
1550 
1551  SCCOL nTabCol = aViewData.GetTabStartCol();
1552  if ( nTabCol == SC_TABSTART_NONE )
1553  nTabCol = nCurX; // back to this column after Enter
1554 
1555  MoveCursorRel( nNewX-nCurX, nNewY-nCurY, SC_FOLLOW_LINE, false, true );
1556 
1557  // TabCol is reset in MoveCursorRel...
1558  aViewData.SetTabStartCol( nTabCol );
1559 }
1560 
1562 {
1563  SCCOL nStartCol;
1564  SCCOL nEndCol;
1565 
1566  ScMarkData& rMark = aViewData.GetMarkData();
1567  if (rMark.IsMarked())
1568  {
1569  ScRange aMarkRange;
1570  rMark.GetMarkArea( aMarkRange );
1571  nStartCol = aMarkRange.aStart.Col();
1572  nEndCol = aMarkRange.aEnd.Col();
1573  }
1574  else
1575  {
1576  SCROW nDummy;
1577  aViewData.GetMoveCursor( nStartCol, nDummy );
1578  nEndCol=nStartCol;
1579  }
1580 
1581  SCTAB nTab = aViewData.GetTabNo();
1582  ScDocument& rDoc = aViewData.GetDocument();
1583  DoneBlockMode();
1584  InitBlockMode( nStartCol,0, nTab );
1585  MarkCursor( nEndCol, rDoc.MaxRow(), nTab );
1586  SelectionChanged();
1587 }
1588 
1590 {
1591  SCROW nStartRow;
1592  SCROW nEndRow;
1593 
1594  ScMarkData& rMark = aViewData.GetMarkData();
1595  if (rMark.IsMarked())
1596  {
1597  ScRange aMarkRange;
1598  rMark.GetMarkArea( aMarkRange );
1599  nStartRow = aMarkRange.aStart.Row();
1600  nEndRow = aMarkRange.aEnd.Row();
1601  }
1602  else
1603  {
1604  SCCOL nDummy;
1605  aViewData.GetMoveCursor( nDummy, nStartRow );
1606  nEndRow=nStartRow;
1607  }
1608 
1609  SCTAB nTab = aViewData.GetTabNo();
1610  ScDocument& rDoc = aViewData.GetDocument();
1611  DoneBlockMode();
1612  InitBlockMode( 0,nStartRow, nTab );
1613  MarkCursor( rDoc.MaxCol(), nEndRow, nTab );
1614  SelectionChanged();
1615 }
1616 
1617 
1618 void ScTabView::MarkColumns(SCCOL nCol, sal_Int16 nModifier)
1619 {
1620  ScDocument& rDoc = aViewData.GetDocument();
1621  SCCOL nStartCol = nCol;
1622  SCTAB nTab = aViewData.GetTabNo();
1623 
1624  if ((nModifier & KEY_SHIFT) == KEY_SHIFT)
1625  bMoveIsShift = true;
1626 
1627  DoneBlockMode( nModifier != 0 );
1628  InitBlockMode( nStartCol, 0, nTab, true, true);
1629  MarkCursor( nCol, rDoc.MaxRow(), nTab );
1630  bMoveIsShift = false;
1631  SetCursor( nCol, 0 );
1632  SelectionChanged();
1633 }
1634 
1635 void ScTabView::MarkRows(SCROW nRow, sal_Int16 nModifier)
1636 {
1637  ScDocument& rDoc = aViewData.GetDocument();
1638  SCROW nStartRow = nRow;
1639  SCTAB nTab = aViewData.GetTabNo();
1640 
1641  if ((nModifier & KEY_SHIFT) == KEY_SHIFT)
1642  bMoveIsShift = true;
1643 
1644  DoneBlockMode( nModifier != 0 );
1645  InitBlockMode( 0, nStartRow, nTab, true, false, true );
1646  MarkCursor( rDoc.MaxCol(), nRow, nTab );
1647  bMoveIsShift = false;
1648  SetCursor( 0, nRow );
1649  SelectionChanged();
1650 }
1651 
1652 void ScTabView::MarkDataArea( bool bIncludeCursor )
1653 {
1654  ScDocument& rDoc = aViewData.GetDocument();
1655  SCTAB nTab = aViewData.GetTabNo();
1656  SCCOL nStartCol = aViewData.GetCurX();
1657  SCROW nStartRow = aViewData.GetCurY();
1658  SCCOL nEndCol = nStartCol;
1659  SCROW nEndRow = nStartRow;
1660 
1661  rDoc.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, bIncludeCursor, false );
1662 
1663  HideAllCursors();
1664  DoneBlockMode();
1665  InitBlockMode( nStartCol, nStartRow, nTab );
1666  MarkCursor( nEndCol, nEndRow, nTab );
1667  ShowAllCursors();
1668 
1669  SelectionChanged();
1670 }
1671 
1673 {
1674  ScDocument& rDoc = aViewData.GetDocument();
1675  ScAddress aCursor( aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo() );
1676  ScRange aMatrix;
1677  if ( rDoc.GetMatrixFormulaRange( aCursor, aMatrix ) )
1678  {
1679  MarkRange( aMatrix, false ); // cursor is already within the range
1680  }
1681 }
1682 
1683 void ScTabView::MarkRange( const ScRange& rRange, bool bSetCursor, bool bContinue )
1684 {
1685  ScDocument& rDoc = aViewData.GetDocument();
1686  SCTAB nTab = rRange.aStart.Tab();
1687  SetTabNo( nTab );
1688 
1689  HideAllCursors();
1690  DoneBlockMode( bContinue ); // bContinue==true -> clear old mark
1691  if (bSetCursor) // if Cursor is set, also always align
1692  {
1693  SCCOL nAlignX = rRange.aStart.Col();
1694  SCROW nAlignY = rRange.aStart.Row();
1695  bool bCol = ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == rDoc.MaxCol() ) && !aViewData.GetDocument().IsInVBAMode();
1696  bool bRow = ( rRange.aStart.Row() == 0 && rRange.aEnd.Row() == rDoc.MaxRow() );
1697  if ( bCol )
1698  nAlignX = aViewData.GetPosX(WhichH(aViewData.GetActivePart()));
1699  if ( bRow )
1700  nAlignY = aViewData.GetPosY(WhichV(aViewData.GetActivePart()));
1701  AlignToCursor( nAlignX, nAlignY, SC_FOLLOW_JUMP );
1702  }
1703  InitBlockMode( rRange.aStart.Col(), rRange.aStart.Row(), nTab );
1704  MarkCursor( rRange.aEnd.Col(), rRange.aEnd.Row(), nTab );
1705  if (bSetCursor)
1706  {
1707  SCCOL nPosX = rRange.aStart.Col();
1708  SCROW nPosY = rRange.aStart.Row();
1709  rDoc.SkipOverlapped(nPosX, nPosY, nTab);
1710 
1711  aViewData.ResetOldCursor();
1712  SetCursor( nPosX, nPosY );
1713  }
1714  ShowAllCursors();
1715 
1716  SelectionChanged();
1717 }
1718 
1720 {
1721  ScMarkData& rMark = aViewData.GetMarkData();
1722  if ( rMark.IsMarked() || rMark.IsMultiMarked() )
1723  {
1724  SCCOL nCurX;
1725  SCROW nCurY;
1726  aViewData.GetMoveCursor( nCurX,nCurY );
1727  MoveCursorAbs( nCurX, nCurY, SC_FOLLOW_NONE, false, false );
1728 
1729  SelectionChanged();
1730  }
1731 }
1732 
1734 {
1735  DoneBlockMode();
1736  InitOwnBlockMode();
1737  aViewData.GetMarkData() = rNew;
1738 
1739  MarkDataChanged();
1740 }
1741 
1743 {
1744  // has to be called after making direct changes to mark data (not via MarkCursor etc)
1745 
1746  UpdateSelectionOverlay();
1747 }
1748 
1749 void ScTabView::SelectNextTab( short nDir, bool bExtendSelection )
1750 {
1751  if (!nDir)
1752  return;
1753  OSL_ENSURE( nDir==-1 || nDir==1, "SelectNextTab: invalid value");
1754 
1755  ScDocument& rDoc = aViewData.GetDocument();
1756  SCTAB nTab = aViewData.GetTabNo();
1757  if (nDir<0)
1758  {
1759  if (!nTab)
1760  return;
1761  --nTab;
1762  while (!rDoc.IsVisible(nTab))
1763  {
1764  if (!nTab)
1765  return;
1766  --nTab;
1767  }
1768  }
1769  else
1770  {
1771  SCTAB nCount = rDoc.GetTableCount();
1772  ++nTab;
1773  if (nTab >= nCount)
1774  return;
1775  while (!rDoc.IsVisible(nTab))
1776  {
1777  ++nTab;
1778  if (nTab >= nCount)
1779  return;
1780  }
1781  }
1782 
1783  SetTabNo( nTab, false, bExtendSelection );
1784  PaintExtras();
1785 }
1786 
1787 void ScTabView::SelectTabPage( const sal_uInt16 nTab )
1788 {
1789  pTabControl->SwitchToPageId( nTab );
1790 }
1791 
1792 // SetTabNo - set the displayed sheet
1793 
1794 void ScTabView::SetTabNo( SCTAB nTab, bool bNew, bool bExtendSelection, bool bSameTabButMoved )
1795 {
1796  if ( !ValidTab(nTab) )
1797  {
1798  OSL_FAIL("SetTabNo: invalid sheet");
1799  return;
1800  }
1801 
1802  if ( !(nTab != aViewData.GetTabNo() || bNew) )
1803  return;
1804 
1805  // FormShell would like to be informed before the switch
1806  FmFormShell* pFormSh = aViewData.GetViewShell()->GetFormShell();
1807  if (pFormSh)
1808  {
1809  bool bAllowed = pFormSh->PrepareClose();
1810  if (!bAllowed)
1811  {
1814 
1815  return; // FormShell says that it can not be switched
1816  }
1817  }
1818 
1819  // not InputEnterHandler due to reference input
1820 
1821  ScDocument& rDoc = aViewData.GetDocument();
1822 
1823  rDoc.MakeTable( nTab );
1824 
1825  // Update pending row heights before switching the sheet, so Reschedule from the progress bar
1826  // doesn't paint the new sheet with old heights
1827  aViewData.GetDocShell()->UpdatePendingRowHeights( nTab );
1828 
1829  SCTAB nTabCount = rDoc.GetTableCount();
1830  SCTAB nOldPos = nTab;
1831  while (!rDoc.IsVisible(nTab)) // search for next visible
1832  {
1833  bool bUp = (nTab>=nOldPos);
1834  if (bUp)
1835  {
1836  ++nTab;
1837  if (nTab>=nTabCount)
1838  {
1839  nTab = nOldPos;
1840  bUp = false;
1841  }
1842  }
1843 
1844  if (!bUp)
1845  {
1846  if (nTab != 0)
1847  --nTab;
1848  else
1849  {
1850  OSL_FAIL("no visible sheets");
1851  rDoc.SetVisible( 0, true );
1852  }
1853  }
1854  }
1855 
1856  // #i71490# Deselect drawing objects before changing the sheet number in view data,
1857  // so the handling of notes still has the sheet selected on which the notes are.
1858  DrawDeselectAll();
1859 
1860  ScModule* pScMod = SC_MOD();
1861  bool bRefMode = pScMod->IsFormulaMode();
1862  if ( !bRefMode ) // query, so that RefMode works when switching sheet
1863  {
1864  DoneBlockMode();
1865  pSelEngine->Reset(); // reset all flags, including locked modifiers
1866  aViewData.SetRefTabNo( nTab );
1867  }
1868 
1869  ScSplitPos eOldActive = aViewData.GetActivePart(); // before switching
1870  bool bFocus = pGridWin[eOldActive] && pGridWin[eOldActive]->HasFocus();
1871 
1872  aViewData.SetTabNo( nTab );
1873  if (mpSpellCheckCxt)
1874  mpSpellCheckCxt->setTabNo( nTab );
1875  // UpdateShow before SetCursor, so that UpdateAutoFillMark finds the correct
1876  // window (is called from SetCursor)
1877  UpdateShow();
1878 
1879  SfxBindings& rBindings = aViewData.GetBindings();
1880  ScMarkData& rMark = aViewData.GetMarkData();
1881 
1882  bool bAllSelected = true;
1883  for (SCTAB nSelTab = 0; nSelTab < nTabCount; ++nSelTab)
1884  {
1885  if (!rDoc.IsVisible(nSelTab) || rMark.GetTableSelect(nSelTab))
1886  {
1887  if (nTab == nSelTab)
1888  // This tab is already in selection. Keep the current
1889  // selection.
1890  bExtendSelection = true;
1891  }
1892  else
1893  {
1894  bAllSelected = false;
1895  if (bExtendSelection)
1896  // We got what we need. No need to stay in the loop.
1897  break;
1898  }
1899  }
1900  if (bAllSelected && !bNew)
1901  // #i6327# if all tables are selected, a selection event (#i6330#) will deselect all
1902  // (not if called with bNew to update settings)
1903  bExtendSelection = false;
1904 
1905  if (bExtendSelection)
1906  rMark.SelectTable( nTab, true );
1907  else
1908  {
1909  rMark.SelectOneTable( nTab );
1910  rBindings.Invalidate( FID_FILL_TAB );
1911  rBindings.Invalidate( FID_TAB_DESELECTALL );
1912  }
1913 
1914  bool bUnoRefDialog = pScMod->IsRefDialogOpen() && pScMod->GetCurRefDlgId() == WID_SIMPLE_REF;
1915 
1916  // recalc zoom-dependent values (before TabChanged, before UpdateEditViewPos)
1917  RefreshZoom();
1918  UpdateVarZoom();
1919 
1920  if ( bRefMode ) // hide EditView if necessary (after aViewData.SetTabNo !)
1921  {
1922  for (VclPtr<ScGridWindow> & pWin : pGridWin)
1923  {
1924  if (pWin && pWin->IsVisible())
1925  pWin->UpdateEditViewPos();
1926  }
1927  }
1928 
1929  TabChanged(bSameTabButMoved); // DrawView
1930  collectUIInformation({{"TABLE", OUString::number(nTab)}});
1931  UpdateVisibleRange();
1932 
1933  aViewData.GetViewShell()->WindowChanged(); // if the active window has changed
1934  aViewData.ResetOldCursor();
1935  SetCursor( aViewData.GetCurX(), aViewData.GetCurY(), true );
1936 
1937  if ( !bUnoRefDialog )
1938  aViewData.GetViewShell()->DisconnectAllClients(); // important for floating frames
1939  else
1940  {
1941  // hide / show inplace client
1942  ScClient* pClient = static_cast<ScClient*>(aViewData.GetViewShell()->GetIPClient());
1943  if ( pClient && pClient->IsObjectInPlaceActive() )
1944  {
1945  tools::Rectangle aObjArea = pClient->GetObjArea();
1946  if ( nTab == aViewData.GetRefTabNo() )
1947  {
1948  // move to its original position
1949 
1950  SdrOle2Obj* pDrawObj = pClient->GetDrawObj();
1951  if ( pDrawObj )
1952  {
1953  tools::Rectangle aRect = pDrawObj->GetLogicRect();
1954  MapMode aMapMode( MapUnit::Map100thMM );
1955  Size aOleSize = pDrawObj->GetOrigObjSize( &aMapMode );
1956  aRect.SetSize( aOleSize );
1957  aObjArea = aRect;
1958  }
1959  }
1960  else
1961  {
1962  // move to an invisible position
1963 
1964  aObjArea.SetPos( Point( 0, -2*aObjArea.GetHeight() ) );
1965  }
1966  pClient->SetObjArea( aObjArea );
1967  }
1968  }
1969 
1970  if ( bFocus && aViewData.GetActivePart() != eOldActive && !bRefMode )
1971  ActiveGrabFocus(); // grab focus to the pane that's active now
1972 
1973  // freeze
1974 
1975  bool bResize = false;
1976  if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX )
1977  if (aViewData.UpdateFixX())
1978  bResize = true;
1979  if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX )
1980  if (aViewData.UpdateFixY())
1981  bResize = true;
1982  if (bResize)
1983  RepeatResize();
1984  InvalidateSplit();
1985 
1986  if ( aViewData.IsPagebreakMode() )
1987  UpdatePageBreakData();
1988 
1989  // Form Layer must know the visible area of the new sheet
1990  // that is why MapMode must already be correct here
1991  for (VclPtr<ScGridWindow> & pWin : pGridWin)
1992  {
1993  if (pWin)
1994  pWin->SetMapMode(pWin->GetDrawMapMode());
1995  }
1996  SetNewVisArea();
1997 
1998  PaintGrid();
1999  PaintTop();
2000  PaintLeft();
2001  PaintExtras();
2002 
2003  DoResize( aBorderPos, aFrameSize );
2004  rBindings.Invalidate( SID_DELETE_PRINTAREA ); // Menu
2005  rBindings.Invalidate( FID_DEL_MANUALBREAKS );
2006  rBindings.Invalidate( FID_RESET_PRINTZOOM );
2007  rBindings.Invalidate( SID_STATUS_DOCPOS ); // Status bar
2008  rBindings.Invalidate( SID_ROWCOL_SELCOUNT ); // Status bar
2009  rBindings.Invalidate( SID_STATUS_PAGESTYLE ); // Status bar
2010  rBindings.Invalidate( SID_CURRENTTAB ); // Navigator
2011  rBindings.Invalidate( SID_STYLE_FAMILY2 ); // Designer
2012  rBindings.Invalidate( SID_STYLE_FAMILY4 ); // Designer
2013  rBindings.Invalidate( SID_TABLES_COUNT );
2014 
2015  if (pScMod->IsRefDialogOpen())
2016  {
2017  sal_uInt16 nCurRefDlgId=pScMod->GetCurRefDlgId();
2018  SfxViewFrame* pViewFrm = aViewData.GetViewShell()->GetViewFrame();
2019  SfxChildWindow* pChildWnd = pViewFrm->GetChildWindow( nCurRefDlgId );
2020  if (pChildWnd)
2021  {
2022  if (pChildWnd->GetController())
2023  {
2024  IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
2025  if (pRefDlg)
2026  pRefDlg->ViewShellChanged();
2027  }
2028  }
2029  }
2030 
2031  OnLibreOfficeKitTabChanged();
2032 }
2033 
2035 {
2036  aExtraEditViewManager.Add(pViewShell, eWhich);
2037 }
2038 
2040 {
2041  aExtraEditViewManager.Remove(pViewShell, eWhich);
2042 }
2043 
2045 {
2047  return;
2048 
2049  ScTabViewShell* pThisViewShell = aViewData.GetViewShell();
2050  SCTAB nThisTabNo = pThisViewShell->GetViewData().GetTabNo();
2051  auto lTabSwitch = [pThisViewShell, nThisTabNo] (ScTabViewShell* pOtherViewShell)
2052  {
2053  ScViewData& rOtherViewData = pOtherViewShell->GetViewData();
2054  SCTAB nOtherTabNo = rOtherViewData.GetTabNo();
2055  if (nThisTabNo == nOtherTabNo)
2056  {
2057  for (int i = 0; i < 4; ++i)
2058  {
2059  if (rOtherViewData.HasEditView(ScSplitPos(i)))
2060  {
2061  pThisViewShell->AddWindowToForeignEditView(pOtherViewShell, ScSplitPos(i));
2062  }
2063  }
2064  }
2065  else
2066  {
2067  for (int i = 0; i < 4; ++i)
2068  {
2069  if (rOtherViewData.HasEditView(ScSplitPos(i)))
2070  {
2071  pThisViewShell->RemoveWindowFromForeignEditView(pOtherViewShell, ScSplitPos(i));
2072  }
2073  }
2074  }
2075  };
2076 
2077  SfxLokHelper::forEachOtherView(pThisViewShell, lTabSwitch);
2078 
2079  pThisViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_HEADER, "all");
2080 
2081  if (pThisViewShell->GetInputHandler())
2082  pThisViewShell->GetInputHandler()->UpdateLokReferenceMarks();
2083 }
2084 
2085 // paint functions - only for this View
2086 
2088 {
2089  DrawDeselectAll();
2090 
2091  if (pDrawView)
2092  DrawEnableAnim( false );
2093 
2094  EditView* pSpellingView = aViewData.GetSpellingView();
2095 
2096  for (sal_uInt16 i = 0; i < 4; i++)
2097  {
2098  if (pGridWin[i] && pGridWin[i]->IsVisible() && !aViewData.HasEditView(ScSplitPos(i)))
2099  {
2100  ScHSplitPos eHWhich = WhichH( static_cast<ScSplitPos>(i) );
2101  ScVSplitPos eVWhich = WhichV( static_cast<ScSplitPos>(i) );
2102  SCCOL nScrX = aViewData.GetPosX( eHWhich );
2103  SCROW nScrY = aViewData.GetPosY( eVWhich );
2104 
2105  bool bPosVisible =
2106  ( nCol >= nScrX && nCol <= nScrX + aViewData.VisibleCellsX(eHWhich) - 1 &&
2107  nRow >= nScrY && nRow <= nScrY + aViewData.VisibleCellsY(eVWhich) - 1 );
2108 
2109  // for the active part, create edit view even if outside the visible area,
2110  // so input isn't lost (and the edit view may be scrolled into the visible area)
2111 
2112  // #i26433# during spelling, the spelling view must be active
2113  if ( bPosVisible || aViewData.GetActivePart() == static_cast<ScSplitPos>(i) ||
2114  ( pSpellingView && aViewData.GetEditView(static_cast<ScSplitPos>(i)) == pSpellingView ) )
2115  {
2116  pGridWin[i]->HideCursor();
2117 
2118  pGridWin[i]->DeleteCursorOverlay();
2119  pGridWin[i]->DeleteAutoFillOverlay();
2120  pGridWin[i]->DeleteCopySourceOverlay();
2121 
2122  // flush OverlayManager before changing MapMode to text edit
2123  pGridWin[i]->flushOverlayManager();
2124 
2125  // MapMode must be set after HideCursor
2126  pGridWin[i]->SetMapMode(aViewData.GetLogicMode());
2127 
2128  aViewData.SetEditEngine( static_cast<ScSplitPos>(i), pEngine, pGridWin[i], nCol, nRow );
2129 
2130  if ( !bPosVisible )
2131  {
2132  // move the edit view area to the real (possibly negative) position,
2133  // or hide if completely above or left of the window
2134  pGridWin[i]->UpdateEditViewPos();
2135  }
2136  }
2137  }
2138  }
2139 
2140  if (aViewData.GetViewShell()->HasAccessibilityObjects())
2141  aViewData.GetViewShell()->BroadcastAccessibility(SfxHint(SfxHintId::ScAccEnterEditMode));
2142 }
2143 
2145 {
2146  ScSplitPos eActive = aViewData.GetActivePart();
2147  for (sal_uInt16 i = 0; i < 4; i++)
2148  {
2149  ScSplitPos eCurrent = ScSplitPos(i);
2150  if (aViewData.HasEditView(eCurrent))
2151  {
2152  EditView* pEditView = aViewData.GetEditView(eCurrent);
2153 
2154  tools::Long nRefTabNo = GetViewData().GetRefTabNo();
2155  tools::Long nX = GetViewData().GetCurXForTab(nRefTabNo);
2156  tools::Long nY = GetViewData().GetCurYForTab(nRefTabNo);
2157 
2158  aViewData.SetEditEngine(eCurrent,
2159  static_cast<ScEditEngineDefaulter*>(pEditView->GetEditEngine()),
2160  pGridWin[i], nX, nY );
2161  if (eCurrent == eActive)
2162  pEditView->ShowCursor( false );
2163  }
2164  }
2165 }
2166 
2167 void ScTabView::KillEditView( bool bNoPaint )
2168 {
2169  SCCOL nCol1 = aViewData.GetEditStartCol();
2170  SCROW nRow1 = aViewData.GetEditStartRow();
2171  SCCOL nCol2 = aViewData.GetEditEndCol();
2172  SCROW nRow2 = aViewData.GetEditEndRow();
2173  bool bPaint[4];
2174  bool bNotifyAcc = false;
2175  tools::Rectangle aRectangle[4];
2176 
2177  bool bExtended = nRow1 != nRow2; // column is painted to the end anyway
2178 
2179  bool bAtCursor = nCol1 <= aViewData.GetCurX() &&
2180  nCol2 >= aViewData.GetCurX() &&
2181  nRow1 == aViewData.GetCurY();
2182  for (sal_uInt16 i = 0; i < 4; i++)
2183  {
2184  bPaint[i] = aViewData.HasEditView( static_cast<ScSplitPos>(i) );
2185  if (bPaint[i])
2186  {
2187  bNotifyAcc = true;
2188 
2189  EditView* pView = aViewData.GetEditView( static_cast<ScSplitPos>(i) );
2190  aRectangle[i] = pView->GetInvalidateRect();
2191  }
2192  }
2193 
2194  // notify accessibility before all things happen
2195  if (bNotifyAcc && aViewData.GetViewShell()->HasAccessibilityObjects())
2196  aViewData.GetViewShell()->BroadcastAccessibility(SfxHint(SfxHintId::ScAccLeaveEditMode));
2197 
2198  aViewData.ResetEditView();
2199  for (sal_uInt16 i = 0; i < 4; i++)
2200  {
2201  if (pGridWin[i] && bPaint[i] && pGridWin[i]->IsVisible())
2202  {
2203  pGridWin[i]->ShowCursor();
2204 
2205  pGridWin[i]->SetMapMode(pGridWin[i]->GetDrawMapMode());
2206 
2208  {
2209  const tools::Rectangle& rInvRect = aRectangle[i];
2210  pGridWin[i]->Invalidate(rInvRect);
2211 
2212  // invalidate other views
2213  auto lInvalidateWindows =
2214  [&rInvRect] (ScTabView* pTabView)
2215  {
2216  for (VclPtr<ScGridWindow> const & pWin: pTabView->pGridWin)
2217  {
2218  if (pWin)
2219  pWin->Invalidate(rInvRect);
2220  }
2221  };
2222 
2223  SfxLokHelper::forEachOtherView(GetViewData().GetViewShell(), lInvalidateWindows);
2224  }
2225  // #i73567# the cell still has to be repainted
2226  else if (bExtended || ( bAtCursor && !bNoPaint ))
2227  {
2228  pGridWin[i]->Draw( nCol1, nRow1, nCol2, nRow2, ScUpdateMode::All );
2229  pGridWin[i]->UpdateSelectionOverlay();
2230  }
2231  }
2232  }
2233 
2234  if (pDrawView)
2235  DrawEnableAnim( true );
2236 
2237  // GrabFocus always when this View is active and
2238  // when the input row has the focus
2239 
2240  bool bGrabFocus = false;
2241  if (aViewData.IsActive())
2242  {
2243  ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl();
2244  if ( pInputHdl )
2245  {
2246  ScInputWindow* pInputWin = pInputHdl->GetInputWindow();
2247  if (pInputWin && pInputWin->IsInputActive())
2248  bGrabFocus = true;
2249  }
2250  }
2251 
2252  if (bGrabFocus)
2253  {
2254 // should be done like this, so that Sfx notice it, but it does not work:
2256 // therefore first like this:
2257  GetActiveWin()->GrabFocus();
2258  }
2259 
2260  // cursor query only after GrabFocus
2261 
2262  for (sal_uInt16 i = 0; i < 4; i++)
2263  {
2264  if (pGridWin[i] && pGridWin[i]->IsVisible())
2265  {
2266  vcl::Cursor* pCur = pGridWin[i]->GetCursor();
2267  if (pCur && pCur->IsVisible())
2268  pCur->Hide();
2269 
2270  if (bPaint[i])
2271  {
2272  pGridWin[i]->UpdateCursorOverlay();
2273  pGridWin[i]->UpdateAutoFillOverlay();
2274  }
2275  }
2276  }
2277 }
2278 
2279 void ScTabView::UpdateFormulas(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow)
2280 {
2281  if ( aViewData.GetDocument().IsAutoCalcShellDisabled() )
2282  return;
2283 
2284  for (sal_uInt16 i = 0; i < 4; i++)
2285  {
2286  if (pGridWin[i] && pGridWin[i]->IsVisible())
2287  pGridWin[i]->UpdateFormulas(nStartCol, nStartRow, nEndCol, nEndRow);
2288  }
2289 
2290  if ( aViewData.IsPagebreakMode() )
2291  UpdatePageBreakData();
2292 
2293  UpdateHeaderWidth();
2294 
2295  // if in edit mode, adjust edit view area because widths/heights may have changed
2296  if ( aViewData.HasEditView( aViewData.GetActivePart() ) )
2297  UpdateEditView();
2298 }
2299 
2300 // PaintArea - repaint block
2301 
2302 void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
2303  ScUpdateMode eMode )
2304 {
2305  SCCOL nCol1;
2306  SCROW nRow1;
2307  SCCOL nCol2;
2308  SCROW nRow2;
2309  bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
2310  ScDocument& rDoc = aViewData.GetDocument();
2311 
2312  PutInOrder( nStartCol, nEndCol );
2313  PutInOrder( nStartRow, nEndRow );
2314 
2315  for (size_t i = 0; i < 4; ++i)
2316  {
2317  if (!pGridWin[i] || !pGridWin[i]->IsVisible())
2318  continue;
2319 
2320  ScHSplitPos eHWhich = WhichH( static_cast<ScSplitPos>(i) );
2321  ScVSplitPos eVWhich = WhichV( static_cast<ScSplitPos>(i) );
2322  bool bOut = false;
2323 
2324  nCol1 = nStartCol;
2325  nRow1 = nStartRow;
2326  nCol2 = nEndCol;
2327  nRow2 = nEndRow;
2328 
2329  SCCOL nLastX = 0;
2330  SCROW nLastY = 0;
2331 
2332  if (bIsTiledRendering)
2333  {
2334  nLastX = aViewData.GetMaxTiledCol();
2335  nLastY = aViewData.GetMaxTiledRow();
2336  }
2337  else
2338  {
2339 
2340  SCCOL nScrX = aViewData.GetPosX( eHWhich );
2341  SCROW nScrY = aViewData.GetPosY( eVWhich );
2342 
2343  if (nCol1 < nScrX)
2344  nCol1 = nScrX;
2345  if (nCol2 < nScrX)
2346  {
2347  if ( eMode == ScUpdateMode::All ) // for UPDATE_ALL, paint anyway
2348  nCol2 = nScrX; // (because of extending strings to the right)
2349  else
2350  bOut = true; // completely outside the window
2351  }
2352  if (nRow1 < nScrY)
2353  nRow1 = nScrY;
2354  if (nRow2 < nScrY)
2355  bOut = true;
2356 
2357  nLastX = nScrX + aViewData.VisibleCellsX( eHWhich ) + 1;
2358  nLastY = nScrY + aViewData.VisibleCellsY( eVWhich ) + 1;
2359  }
2360 
2361  if (nCol1 > nLastX)
2362  bOut = true;
2363  if (nCol2 > nLastX)
2364  nCol2 = nLastX;
2365  if (nRow1 > nLastY)
2366  bOut = true;
2367  if (nRow2 > nLastY)
2368  nRow2 = nLastY;
2369 
2370  if (bOut)
2371  continue;
2372 
2373  bool bLayoutRTL = aViewData.GetDocument().IsLayoutRTL( aViewData.GetTabNo() );
2374  tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
2375 
2376  Point aStart = aViewData.GetScrPos( nCol1, nRow1, static_cast<ScSplitPos>(i) );
2377  Point aEnd = aViewData.GetScrPos( nCol2+1, nRow2+1, static_cast<ScSplitPos>(i) );
2378  if ( eMode == ScUpdateMode::All )
2379  {
2380  if (bIsTiledRendering)
2381  {
2382  // When a cell content is deleted we have no clue about
2383  // the width of the embedded text.
2384  // Anyway, clients will ask only for tiles that overlaps
2385  // the visible area.
2386  // Remember that wsd expects int and that aEnd.X() is
2387  // in pixels and will be converted in twips, before performing
2388  // the lok callback, so we need to avoid that an overflow occurs.
2389  aEnd.setX( bLayoutRTL ? 0 : std::numeric_limits<int>::max() / 1000 );
2390  }
2391  else
2392  {
2393  aEnd.setX( bLayoutRTL ? 0 : pGridWin[i]->GetOutputSizePixel().Width() );
2394  }
2395  }
2396  aEnd.AdjustX( -nLayoutSign );
2397  aEnd.AdjustY( -1 );
2398 
2399  // #i85232# include area below cells (could be done in GetScrPos?)
2400  if ( eMode == ScUpdateMode::All && nRow2 >= rDoc.MaxRow() && !bIsTiledRendering )
2401  aEnd.setY( pGridWin[i]->GetOutputSizePixel().Height() );
2402 
2403  aStart.AdjustX( -nLayoutSign ); // include change marks
2404  aStart.AdjustY( -1 );
2405 
2406  bool bMarkClipped = aViewData.GetOptions().GetOption( VOPT_CLIPMARKS );
2407  if (bMarkClipped)
2408  {
2409  // ScColumn::IsEmptyBlock has to be optimized for this
2410  // (switch to Search() )
2414  tools::Long nMarkPixel = static_cast<tools::Long>( SC_CLIPMARK_SIZE * aViewData.GetPPTX() );
2415  aStart.AdjustX( -(nMarkPixel * nLayoutSign) );
2416  }
2417 
2418  pGridWin[i]->Invalidate( pGridWin[i]->PixelToLogic( tools::Rectangle( aStart,aEnd ) ) );
2419  }
2420 
2421  // #i79909# Calling UpdateAllOverlays here isn't necessary and would lead to overlay calls from a timer,
2422  // with a wrong MapMode if editing in a cell (reference input).
2423  // #i80499# Overlays need updates in a lot of cases, e.g. changing row/column size,
2424  // or showing/hiding outlines. TODO: selections in inactive windows are vanishing.
2425  // #i84689# With relative conditional formats, PaintArea may be called often (for each changed cell),
2426  // so UpdateAllOverlays was moved to ScTabViewShell::Notify and is called only if PaintPartFlags::Left/PaintPartFlags::Top
2427  // is set (width or height changed).
2428 }
2429 
2431 {
2432  ScRange aRef = pData->aRef;
2433  aRef.PutInOrder(); // PutInOrder for the queries below
2434 
2435  if ( aRef.aStart == aRef.aEnd )
2436  aViewData.GetDocument().ExtendMerge(aRef);
2437 
2438  if (aRef.aStart.Tab() < nTab || aRef.aEnd.Tab() > nTab)
2439  return;
2440 
2441  SCCOL nCol1 = aRef.aStart.Col();
2442  SCROW nRow1 = aRef.aStart.Row();
2443  SCCOL nCol2 = aRef.aEnd.Col();
2444  SCROW nRow2 = aRef.aEnd.Row();
2445 
2446  // remove -> repaint
2447  // ScUpdateMode::Marks: Invalidate, nothing until end of row
2448 
2449  bool bHiddenEdge = false;
2450  SCROW nTmp;
2451  ScDocument& rDoc = aViewData.GetDocument();
2452  while ( nCol1 > 0 && rDoc.ColHidden(nCol1, nTab) )
2453  {
2454  --nCol1;
2455  bHiddenEdge = true;
2456  }
2457  while ( nCol2 < rDoc.MaxCol() && rDoc.ColHidden(nCol2, nTab) )
2458  {
2459  ++nCol2;
2460  bHiddenEdge = true;
2461  }
2462  nTmp = rDoc.LastVisibleRow(0, nRow1, nTab);
2463  if (!rDoc.ValidRow(nTmp))
2464  nTmp = 0;
2465  if (nTmp < nRow1)
2466  {
2467  nRow1 = nTmp;
2468  bHiddenEdge = true;
2469  }
2470  nTmp = rDoc.FirstVisibleRow(nRow2, rDoc.MaxRow(), nTab);
2471  if (!rDoc.ValidRow(nTmp))
2472  nTmp = rDoc.MaxRow();
2473  if (nTmp > nRow2)
2474  {
2475  nRow2 = nTmp;
2476  bHiddenEdge = true;
2477  }
2478 
2479  if ( nCol2 - nCol1 > 1 && nRow2 - nRow1 > 1 && !bHiddenEdge )
2480  {
2481  // only along the edges
2482  PaintArea( nCol1, nRow1, nCol2, nRow1, ScUpdateMode::Marks );
2483  PaintArea( nCol1, nRow1+1, nCol1, nRow2-1, ScUpdateMode::Marks );
2484  PaintArea( nCol2, nRow1+1, nCol2, nRow2-1, ScUpdateMode::Marks );
2485  PaintArea( nCol1, nRow2, nCol2, nRow2, ScUpdateMode::Marks );
2486  }
2487  else // all in one
2488  PaintArea( nCol1, nRow1, nCol2, nRow2, ScUpdateMode::Marks );
2489 }
2490 
2492 {
2493  ScInputHandler* pHdl = SC_MOD()->GetInputHdl( aViewData.GetViewShell() );
2494  if (!pHdl)
2495  return;
2496 
2497  ScRangeFindList* pRangeFinder = pHdl->GetRangeFindList();
2498  if ( !(pRangeFinder && pRangeFinder->GetDocName() == aViewData.GetDocShell()->GetTitle()) )
2499  return;
2500 
2501  SCTAB nTab = aViewData.GetTabNo();
2502  sal_uInt16 nCount = static_cast<sal_uInt16>(pRangeFinder->Count());
2503 
2504  if (nNumber < 0)
2505  {
2506  for (sal_uInt16 i=0; i<nCount; i++)
2507  PaintRangeFinderEntry(&pRangeFinder->GetObject(i),nTab);
2508  }
2509  else
2510  {
2511  sal_uInt16 idx = nNumber;
2512  if (idx < nCount)
2513  PaintRangeFinderEntry(&pRangeFinder->GetObject(idx),nTab);
2514  }
2515 }
2516 
2517 // for chart data selection
2518 
2519 void ScTabView::AddHighlightRange( const ScRange& rRange, const Color& rColor )
2520 {
2521  maHighlightRanges.emplace_back( rRange, rColor );
2522 
2523  SCTAB nTab = aViewData.GetTabNo();
2524  if ( nTab >= rRange.aStart.Tab() && nTab <= rRange.aEnd.Tab() )
2525  PaintArea( rRange.aStart.Col(), rRange.aStart.Row(),
2526  rRange.aEnd.Col(), rRange.aEnd.Row(), ScUpdateMode::Marks );
2527 }
2528 
2530 {
2531  SCTAB nTab = aViewData.GetTabNo();
2532  for (ScHighlightEntry const & rEntry : maHighlightRanges)
2533  {
2534  ScRange aRange = rEntry.aRef;
2535  if ( nTab >= aRange.aStart.Tab() && nTab <= aRange.aEnd.Tab() )
2536  PaintArea( aRange.aStart.Col(), aRange.aStart.Row(),
2537  aRange.aEnd.Col(), aRange.aEnd.Row(), ScUpdateMode::Marks );
2538  }
2539 
2540  maHighlightRanges.clear();
2541 }
2542 
2544  const uno::Sequence< chart2::data::HighlightedRange > & rHilightRanges )
2545 {
2546  ClearHighlightRanges();
2548  size_t nSize = 0;
2549  size_t nIndex = 0;
2550  std::vector<ReferenceMark> aReferenceMarks( nSize );
2551 
2552  for (chart2::data::HighlightedRange const & rHighlightedRange : rHilightRanges)
2553  {
2554  Color aSelColor(rHighlightedRange.PreferredColor);
2555  ScRangeList aRangeList;
2556  ScDocument& rDoc = aViewData.GetDocShell()->GetDocument();
2558  aRangeList, rHighlightedRange.RangeRepresentation, rDoc, rDoc.GetAddressConvention(), sep ))
2559  {
2560  size_t nListSize = aRangeList.size();
2561  nSize += nListSize;
2562  aReferenceMarks.resize(nSize);
2563 
2564  for ( size_t j = 0; j < nListSize; ++j )
2565  {
2566  ScRange& p = aRangeList[j];
2567  ScRange aTargetRange;
2568  if( rHighlightedRange.Index == - 1 )
2569  {
2570  aTargetRange = p;
2571  AddHighlightRange( aTargetRange, aSelColor );
2572  }
2573  else
2574  {
2575  aTargetRange = lcl_getSubRangeByIndex( p, rHighlightedRange.Index );
2576  AddHighlightRange( aTargetRange, aSelColor );
2577  }
2578 
2579  if ( comphelper::LibreOfficeKit::isActive() && aViewData.GetViewShell() )
2580  {
2581  aTargetRange.PutInOrder();
2582 
2583  tools::Long nX1 = aTargetRange.aStart.Col();
2584  tools::Long nX2 = aTargetRange.aEnd.Col();
2585  tools::Long nY1 = aTargetRange.aStart.Row();
2586  tools::Long nY2 = aTargetRange.aEnd.Row();
2587  tools::Long nTab = aTargetRange.aStart.Tab();
2588 
2589  aReferenceMarks[nIndex++] = ScInputHandler::GetReferenceMark( aViewData, aViewData.GetDocShell(),
2590  nX1, nX2, nY1, nY2,
2591  nTab, aSelColor );
2592  }
2593  }
2594  }
2595  }
2596 
2597  if ( comphelper::LibreOfficeKit::isActive() && aViewData.GetViewShell() )
2598  ScInputHandler::SendReferenceMarks( aViewData.GetViewShell(), aReferenceMarks );
2599 }
2600 
2601 void ScTabView::DoDPFieldPopup(std::u16string_view rPivotTableName, sal_Int32 nDimensionIndex, Point aPoint, Size aSize)
2602 {
2603  ScDocument& rDocument = aViewData.GetDocShell()->GetDocument();
2604  ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()].get();
2605 
2606  if (!pWin)
2607  return;
2608 
2609  ScDPCollection* pDPCollection = rDocument.GetDPCollection();
2610  ScDPObject* pDPObject = pDPCollection->GetByName(rPivotTableName);
2611  if (!pDPObject)
2612  return;
2613 
2614  pDPObject->BuildAllDimensionMembers();
2615 
2616  Point aScreenPoint = pWin->OutputToScreenPixel(pWin->LogicToPixel(aPoint));
2617  Size aScreenSize = pWin->LogicToPixel(aSize);
2618 
2619  pWin->DPLaunchFieldPopupMenu(aScreenPoint, aScreenSize, nDimensionIndex, pDPObject);
2620 }
2621 
2622 // PaintGrid - repaint data range
2623 
2625 {
2626  for (sal_uInt16 i = 0; i < 4; i++)
2627  {
2628  if (pGridWin[i] && pGridWin[i]->IsVisible())
2629  pGridWin[i]->Invalidate();
2630  }
2631 }
2632 
2633 // PaintTop - repaint top control elements
2634 
2636 {
2637  for (sal_uInt16 i = 0; i < 2; i++)
2638  {
2639  if (pColBar[i])
2640  pColBar[i]->Invalidate();
2641  if (pColOutline[i])
2642  pColOutline[i]->Invalidate();
2643  }
2644 }
2645 
2647 {
2648  for (sal_uInt16 i = 0; i < 4; i++)
2649  {
2650  if(pGridWin[i] && pGridWin[i]->IsVisible())
2651  pGridWin[i]->CreateAnchorHandle(rHdl, rAddress);
2652  }
2653 }
2654 
2655 void ScTabView::PaintTopArea( SCCOL nStartCol, SCCOL nEndCol )
2656 {
2657  // pixel position of the left edge
2658 
2659  if ( nStartCol < aViewData.GetPosX(SC_SPLIT_LEFT) ||
2660  nStartCol < aViewData.GetPosX(SC_SPLIT_RIGHT) )
2661  aViewData.RecalcPixPos();
2662 
2663  // adjust freeze (UpdateFixX resets HSplitPos)
2664 
2665  if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX && nStartCol < aViewData.GetFixPosX() )
2666  if (aViewData.UpdateFixX())
2667  RepeatResize();
2668 
2669  // paint
2670 
2671  if (nStartCol>0)
2672  --nStartCol;
2673 
2674  ScDocument& rDoc = aViewData.GetDocument();
2675  bool bLayoutRTL = rDoc.IsLayoutRTL( aViewData.GetTabNo() );
2676  tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
2677 
2678  for (sal_uInt16 i = 0; i < 2; i++)
2679  {
2680  ScHSplitPos eWhich = ScHSplitPos(i);
2681  if (pColBar[eWhich])
2682  {
2683  Size aWinSize = pColBar[eWhich]->GetSizePixel();
2684  tools::Long nStartX = aViewData.GetScrPos( nStartCol, 0, eWhich ).X();
2685  tools::Long nEndX;
2686  if (nEndCol >= rDoc.MaxCol())
2687  nEndX = nStartX + (bLayoutRTL ? 0 : ( aWinSize.Width()-1 ));
2688  else
2689  nEndX = aViewData.GetScrPos( nEndCol+1, 0, eWhich ).X() - nLayoutSign;
2690  pColBar[eWhich]->Invalidate(
2691  tools::Rectangle( nStartX, 0, nEndX, aWinSize.Height()-1 ) );
2692  }
2693  if (pColOutline[eWhich])
2694  pColOutline[eWhich]->Invalidate();
2695  }
2696 }
2697 
2698 // PaintLeft - repaint left control elements
2699 
2701 {
2702  for (sal_uInt16 i = 0; i < 2; i++)
2703  {
2704  if (pRowBar[i])
2705  pRowBar[i]->Invalidate();
2706  if (pRowOutline[i])
2707  pRowOutline[i]->Invalidate();
2708  }
2709 }
2710 
2711 void ScTabView::PaintLeftArea( SCROW nStartRow, SCROW nEndRow )
2712 {
2713  // pixel position of the upper edge
2714 
2715  if ( nStartRow < aViewData.GetPosY(SC_SPLIT_TOP) ||
2716  nStartRow < aViewData.GetPosY(SC_SPLIT_BOTTOM) )
2717  aViewData.RecalcPixPos();
2718 
2719  // adjust freeze (UpdateFixY reset VSplitPos)
2720 
2721  if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX && nStartRow < aViewData.GetFixPosY() )
2722  if (aViewData.UpdateFixY())
2723  RepeatResize();
2724 
2725  // paint
2726 
2727  if (nStartRow>0)
2728  --nStartRow;
2729 
2730  ScDocument& rDoc = aViewData.GetDocument();
2731  for (sal_uInt16 i = 0; i < 2; i++)
2732  {
2733  ScVSplitPos eWhich = ScVSplitPos(i);
2734  if (pRowBar[eWhich])
2735  {
2736  Size aWinSize = pRowBar[eWhich]->GetSizePixel();
2737  tools::Long nStartY = aViewData.GetScrPos( 0, nStartRow, eWhich ).Y();
2738  tools::Long nEndY;
2739  if (nEndRow >= rDoc.MaxRow())
2740  nEndY = nStartY + aWinSize.Height() - 1;
2741  else
2742  nEndY = aViewData.GetScrPos( 0, nEndRow+1, eWhich ).Y() - 1;
2743  pRowBar[eWhich]->Invalidate(
2744  tools::Rectangle( 0, nStartY, aWinSize.Width()-1, nEndY ) );
2745  }
2746  if (pRowOutline[eWhich])
2747  pRowOutline[eWhich]->Invalidate();
2748  }
2749 }
2750 
2752 {
2753  bool bRet = false;
2754  ScDocument& rDoc = aViewData.GetDocument();
2755  SCTAB nTab = aViewData.GetTabNo();
2756  if (!rDoc.HasTable(nTab)) // sheet is deleted?
2757  {
2758  SCTAB nCount = rDoc.GetTableCount();
2759  aViewData.SetTabNo(nCount-1);
2760  bRet = true;
2761  }
2762  pTabControl->UpdateStatus(); // true = active
2763  return bRet;
2764 }
2765 
2767 {
2768  // called after changes that require the PPT values to be recalculated
2769  // (currently from detective operations)
2770 
2771  double nOldX = aViewData.GetPPTX();
2772  double nOldY = aViewData.GetPPTY();
2773 
2774  aViewData.RefreshZoom(); // pre-calculate new PPT values
2775 
2776  bool bChangedX = ( aViewData.GetPPTX() != nOldX );
2777  bool bChangedY = ( aViewData.GetPPTY() != nOldY );
2778  if ( !(bChangedX || bChangedY) )
2779  return;
2780 
2781  // call view SetZoom (including draw scale, split update etc)
2782  // and paint only if values changed
2783 
2784  Fraction aZoomX = aViewData.GetZoomX();
2785  Fraction aZoomY = aViewData.GetZoomY();
2786  SetZoom( aZoomX, aZoomY, false );
2787 
2788  PaintGrid();
2789  if (bChangedX)
2790  PaintTop();
2791  if (bChangedY)
2792  PaintLeft();
2793 }
2794 
2795 void ScTabView::ActivateView( bool bActivate, bool bFirst )
2796 {
2797  if ( bActivate == aViewData.IsActive() && !bFirst )
2798  {
2799  // no assertion anymore - occurs when previously in Drag&Drop switching over
2800  // to another document
2801  return;
2802  }
2803 
2804  // is only called for MDI-(De)Activate
2805  // aViewData.Activate behind due to cursor show for KillEditView
2806  // don't delete selection - if Activate(false) is set in ViewData,
2807  // then the selection is not displayed
2808 
2809  if (!bActivate)
2810  {
2811  ScModule* pScMod = SC_MOD();
2812  bool bRefMode = pScMod->IsFormulaMode();
2813 
2814  // don't cancel reference input, to allow reference
2815  // to other document
2816 
2817  if (!bRefMode)
2818  {
2819  // pass view to GetInputHdl, this view may not be current anymore
2820  ScInputHandler* pHdl = SC_MOD()->GetInputHdl(aViewData.GetViewShell());
2821  if (pHdl)
2822  pHdl->EnterHandler();
2823  }
2824  }
2825 
2826  PaintExtras();
2827 
2828  aViewData.Activate(bActivate);
2829 
2830  PaintBlock(false); // repaint, selection after active status
2831 
2832  if (!bActivate)
2833  HideAllCursors(); // Cursor
2834  else if (!bFirst)
2835  ShowAllCursors();
2836 
2837  if (bActivate)
2838  {
2839  if ( bFirst )
2840  {
2841  ScSplitPos eWin = aViewData.GetActivePart();
2842  OSL_ENSURE( pGridWin[eWin], "Corrupted document, not all SplitPos in GridWin" );
2843  if ( !pGridWin[eWin] )
2844  {
2845  eWin = SC_SPLIT_BOTTOMLEFT;
2846  if ( !pGridWin[eWin] )
2847  {
2848  short i;
2849  for ( i=0; i<4; i++ )
2850  {
2851  if ( pGridWin[i] )
2852  {
2853  eWin = static_cast<ScSplitPos>(i);
2854  break; // for
2855  }
2856  }
2857  OSL_ENSURE( i<4, "and BOOM" );
2858  }
2859  aViewData.SetActivePart( eWin );
2860  }
2861  }
2862  // do not call GrabFocus from here!
2863  // if the document is processed, then Sfx calls GrabFocus in the window of the shell.
2864  // if it is a mail body for instance, then it can't get the focus
2865  UpdateInputContext();
2866  }
2867  else
2868  pGridWin[aViewData.GetActivePart()]->ClickExtern();
2869 }
2870 
2872 {
2873  ScSplitPos eOld = aViewData.GetActivePart();
2874  if ( eOld == eWhich )
2875  return;
2876 
2877  bInActivatePart = true;
2878 
2879  bool bRefMode = SC_MOD()->IsFormulaMode();
2880 
2881  // the HasEditView call during SetCursor would fail otherwise
2882  if ( aViewData.HasEditView(eOld) && !bRefMode )
2883  UpdateInputLine();
2884 
2885  ScHSplitPos eOldH = WhichH(eOld);
2886  ScVSplitPos eOldV = WhichV(eOld);
2887  ScHSplitPos eNewH = WhichH(eWhich);
2888  ScVSplitPos eNewV = WhichV(eWhich);
2889  bool bTopCap = pColBar[eOldH] && pColBar[eOldH]->IsMouseCaptured();
2890  bool bLeftCap = pRowBar[eOldV] && pRowBar[eOldV]->IsMouseCaptured();
2891 
2892  bool bFocus = pGridWin[eOld]->HasFocus();
2893  bool bCapture = pGridWin[eOld]->IsMouseCaptured();
2894  if (bCapture)
2895  pGridWin[eOld]->ReleaseMouse();
2896  pGridWin[eOld]->ClickExtern();
2897  pGridWin[eOld]->HideCursor();
2898  pGridWin[eWhich]->HideCursor();
2899  aViewData.SetActivePart( eWhich );
2900 
2901  ScTabViewShell* pShell = aViewData.GetViewShell();
2902  pShell->WindowChanged();
2903 
2904  pSelEngine->SetWindow(pGridWin[eWhich]);
2905  pSelEngine->SetWhich(eWhich);
2906  pSelEngine->SetVisibleArea( tools::Rectangle(Point(), pGridWin[eWhich]->GetOutputSizePixel()) );
2907 
2908  pGridWin[eOld]->MoveMouseStatus(*pGridWin[eWhich]);
2909 
2910  if ( bCapture || pGridWin[eWhich]->IsMouseCaptured() )
2911  {
2912  // tracking instead of CaptureMouse, so it can be cancelled cleanly
2913  // (SelectionEngine calls CaptureMouse for SetWindow)
2915  pGridWin[eWhich]->ReleaseMouse();
2916  pGridWin[eWhich]->StartTracking();
2917  }
2918 
2919  if ( bTopCap && pColBar[eNewH] )
2920  {
2921  pColBar[eOldH]->SetIgnoreMove(true);
2922  pColBar[eNewH]->SetIgnoreMove(false);
2923  pHdrSelEng->SetWindow( pColBar[eNewH] );
2924  tools::Long nWidth = pColBar[eNewH]->GetOutputSizePixel().Width();
2925  pHdrSelEng->SetVisibleArea( tools::Rectangle( 0, LONG_MIN, nWidth-1, LONG_MAX ) );
2926  pColBar[eNewH]->CaptureMouse();
2927  }
2928  if ( bLeftCap && pRowBar[eNewV] )
2929  {
2930  pRowBar[eOldV]->SetIgnoreMove(true);
2931  pRowBar[eNewV]->SetIgnoreMove(false);
2932  pHdrSelEng->SetWindow( pRowBar[eNewV] );
2933  tools::Long nHeight = pRowBar[eNewV]->GetOutputSizePixel().Height();
2934  pHdrSelEng->SetVisibleArea( tools::Rectangle( LONG_MIN, 0, LONG_MAX, nHeight-1 ) );
2935  pRowBar[eNewV]->CaptureMouse();
2936  }
2937  aHdrFunc.SetWhich(eWhich);
2938 
2939  pGridWin[eOld]->ShowCursor();
2940  pGridWin[eWhich]->ShowCursor();
2941 
2942  SfxInPlaceClient* pClient = aViewData.GetViewShell()->GetIPClient();
2943  bool bOleActive = ( pClient && pClient->IsObjectInPlaceActive() );
2944 
2945  // don't switch ViewShell's active window during RefInput, because the focus
2946  // might change, and subsequent SetReference calls wouldn't find the right EditView
2947  if ( !bRefMode && !bOleActive )
2948  aViewData.GetViewShell()->SetWindow( pGridWin[eWhich] );
2949 
2950  if ( bFocus && !aViewData.IsAnyFillMode() && !bRefMode )
2951  {
2952  // GrabFocus only if previously the other GridWindow had the focus
2953  // (for instance due to search and replace)
2954  pGridWin[eWhich]->GrabFocus();
2955  }
2956 
2957  bInActivatePart = false;
2958 }
2959 
2961 {
2962  for (VclPtr<ScGridWindow> & pWin : pGridWin)
2963  {
2964  if (pWin)
2965  pWin->ClickExtern();
2966  }
2967 }
2968 
2970 {
2971  ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()].get();
2972  if (pWin)
2973  pWin->UpdateInputContext();
2974 
2975  if (pTabControl)
2976  pTabControl->UpdateInputContext();
2977 }
2978 
2979 // GetGridWidth - width of an output range (for ViewData)
2980 
2982 {
2983  ScSplitPos eGridWhich = ( eWhich == SC_SPLIT_LEFT ) ? SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT;
2984  if (pGridWin[eGridWhich])
2985  return pGridWin[eGridWhich]->GetSizePixel().Width();
2986  else
2987  return 0;
2988 }
2989 
2990 // GetGridHeight - height of an output range (for ViewData)
2991 
2993 {
2994  ScSplitPos eGridWhich = ( eWhich == SC_SPLIT_TOP ) ? SC_SPLIT_TOPLEFT : SC_SPLIT_BOTTOMLEFT;
2995  if (pGridWin[eGridWhich])
2996  return pGridWin[eGridWhich]->GetSizePixel().Height();
2997  else
2998  return 0;
2999 }
3000 
3002 {
3003  SC_MOD()->InputEnterHandler();
3004 }
3005 
3007 {
3008  ScInputHandler* pHdl = SC_MOD()->GetInputHdl(aViewData.GetViewShell());
3009  if (pHdl)
3010  pHdl->SetRefScale( aViewData.GetZoomX(), aViewData.GetZoomY() );
3011 
3012  UpdateFixPos();
3013 
3014  UpdateScrollBars();
3015 
3016  // VisArea...
3017  // AW: Discussed with NN if there is a reason that new map mode was only set for one window,
3018  // but is not. Setting only on one window causes the first repaint to have the old mapMode
3019  // in three of four views, so the overlay will save the wrong content e.g. when zooming out.
3020  // Changing to setting map mode at all windows.
3021 
3022  for (sal_uInt32 i = 0; i < 4; i++)
3023  {
3024  if (pGridWin[i])
3025  pGridWin[i]->SetMapMode(pGridWin[i]->GetDrawMapMode());
3026  }
3027 
3028  SetNewVisArea();
3029 
3030  InterpretVisible(); // have everything calculated before painting
3031 
3032  SfxBindings& rBindings = aViewData.GetBindings();
3033  rBindings.Invalidate( SID_ATTR_ZOOM );
3034  rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
3035  rBindings.Invalidate(SID_ZOOM_IN);
3036  rBindings.Invalidate(SID_ZOOM_OUT);
3037 
3038  HideNoteMarker();
3039 
3040  // To not change too much, use pWin here
3041  ScGridWindow* pWin = pGridWin[aViewData.GetActivePart()].get();
3042 
3043  if ( pWin && aViewData.HasEditView( aViewData.GetActivePart() ) )
3044  {
3045  // flush OverlayManager before changing the MapMode
3046  pWin->flushOverlayManager();
3047 
3048  // make sure the EditView's position and size are updated
3049  // with the right (logic, not drawing) MapMode
3050  pWin->SetMapMode( aViewData.GetLogicMode() );
3051  UpdateEditView();
3052  }
3053 }
3054 
3056 {
3057  for (sal_uInt16 i = 0; i < 4; i++)
3058  {
3059  if (pGridWin[i] && pGridWin[i]->IsVisible())
3060  pGridWin[i]->CheckNeedsRepaint();
3061  }
3062 }
3063 
3065 {
3066  for (VclPtr<ScGridWindow> & pWin : pGridWin)
3067  {
3068  if (pWin && pWin->IsVisible() && pWin->NeedsRepaint())
3069  return true;
3070  }
3071  return false;
3072 }
3073 
3074 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< SfxDialogController > & GetController()
void FindNextUnprot(bool bShift, bool bInSelection)
Definition: tabview3.cxx:1534
SC_DLLPUBLIC bool GetPrintArea(SCTAB nTab, SCCOL &rEndCol, SCROW &rEndRow, bool bNotes=true) const
Definition: documen2.cxx:572
void TestHintWindow()
Definition: tabview3.cxx:775
SfxViewFrame * GetViewFrame() const
void SetPos(const Point &rPoint)
SC_DLLPUBLIC ScDPObject * GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: documen3.cxx:371
void DoChartSelection(const css::uno::Sequence< css::chart2::data::HighlightedRange > &rHilightRanges)
Definition: tabview3.cxx:2543
void MarkDataArea(bool bIncludeCursor=true)
Definition: tabview3.cxx:1652
OUString GetColRowString() const
Create a human-readable string representation of the cell address.
Definition: address.cxx:2497
static weld::Window * lcl_GetCareWin(SfxViewFrame *pViewFrm)
Definition: tabview3.cxx:879
bool GetMoveSelection() const
Definition: inputopt.hxx:50
ScAddress aStart
Definition: address.hxx:500
static void notifyDocumentSizeChanged(SfxViewShell const *pThisView, const OString &rPayload, vcl::ITiledRenderable *pDoc, bool bInvalidateAll=true)
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
SfxChildWindow * GetChildWindow(sal_uInt16)
ScVSplitPos WhichV(ScSplitPos ePos)
Definition: viewdata.hxx:710
constexpr sal_uInt16 KEY_MOD1
void RemoveWindowFromForeignEditView(SfxViewShell *pViewShell, ScSplitPos eWhich)
Definition: tabview3.cxx:2039
void flushOverlayManager()
Definition: gridwin.cxx:6630
bool SetObjArea(const tools::Rectangle &)
MapMode GetDrawMapMode(bool bForce=false)
MapMode for the drawinglayer objects.
Definition: gridwin3.cxx:246
SCROW Row() const
Definition: address.hxx:262
ScVSplitPos
Definition: viewdata.hxx:47
std::unique_ptr< ContentProperties > pData
void SetTabProtectionSymbol(SCTAB nTab, const bool bProtect)
Definition: tabview3.cxx:524
void UpdateInputContext()
Definition: tabview3.cxx:2969
bool IsObjectInPlaceActive() const
void CursorPosChanged()
Definition: tabview3.cxx:626
bool PaintExtras()
Definition: tabview3.cxx:2751
void MarkRange(const ScRange &rRange, bool bSetCursor=true, bool bContinue=false)
Definition: tabview3.cxx:1683
sheet protection state container
void ResetMark()
Definition: markdata.cxx:85
tools::Long getWidth() const
long Long
ScHSplitPos WhichH(ScSplitPos ePos)
Definition: viewdata.hxx:704
void ShowCursor(bool bGotoCursor=true, bool bForceVisCursor=true, bool bActivate=false)
SC_DLLPUBLIC ScDPCollection * GetDPCollection()
Definition: documen3.cxx:359
ScFollowMode
Screen behavior related to cursor movements.
Definition: viewdata.hxx:53
CALCNOTESBACKGROUND
void FillRangeListWithMarks(ScRangeList *pList, bool bClear, SCTAB nForTab=-1) const
Create a range list of marks.
Definition: markdata.cxx:387
void Remove(SfxViewShell *pViewShell, ScSplitPos eWhich)
Definition: tabview3.cxx:108
bool IsShift() const
bool IsOver(const tools::Rectangle &rRect) const
const sal_uInt8 SC_CLIPMARK_SIZE
Definition: fillinfo.hxx:52
bool HasEditView(ScSplitPos eWhich) const
Definition: viewdata.hxx:564
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
sal_uInt16 GetCode() const
SC_DLLPUBLIC SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const
Definition: document.cxx:4473
void PaintGrid()
Definition: tabview3.cxx:2624
void Unmark()
Definition: tabview3.cxx:1719
tools::Long GetGridWidth(ScHSplitPos eWhich)
Definition: tabview3.cxx:2981
ScAddress aEnd
Definition: address.hxx:501
SC_DLLPUBLIC SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const
Definition: document.cxx:4481
static void UpdateInputLine()
Definition: tabview3.cxx:3001
void RemoveHintWindow()
Definition: tabview3.cxx:873
bool NeedsRepaint()
Definition: tabview3.cxx:3064
Size GetOrigObjSize(MapMode const *pTargetMapMode=nullptr) const
void AddHighlightRange(const ScRange &rRange, const Color &rColor)
Definition: tabview3.cxx:2519
bool HasSelectionList() const
Returns true, if the validation cell will show a selection list.
Definition: validat.cxx:711
css::uno::Reference< css::frame::XModel > GetModel() const
void Invalidate(sal_uInt16 nId)
static void forEachOtherView(ViewShellType *pThisViewShell, FunctionType f)
float x
SC_DLLPUBLIC void SetCursor(SCCOL nPosX, SCROW nPosY, bool bNew=false)
Definition: tabview3.cxx:359
SC_DLLPUBLIC void SetVisible(SCTAB nTab, bool bVisible)
Definition: document.cxx:899
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:488
void SetMapMode()
ScDPObject * GetByName(std::u16string_view rName) const
Definition: dpobject.cxx:3692
void PaintRangeFinderEntry(const ScRangeFindData *pData, SCTAB nTab)
Update marks for a selected Range.
Definition: tabview3.cxx:2430
constexpr sal_uInt16 KEY_UP
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4159
ScSplitPos
Definition: viewdata.hxx:45
SC_DLLPUBLIC void MoveCursorAbs(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, bool bShift, bool bControl, bool bKeepOld=false, bool bKeepSel=false)
Definition: tabview3.cxx:1186
constexpr sal_uInt16 KEY_END
void GetMarkArea(ScRange &rRange) const
Definition: markdata.cxx:112
SC_DLLPUBLIC const ScValidationData * GetValidationEntry(sal_uLong nIndex) const
Definition: documen4.cxx:871
static UITestLogger & getInstance()
void KillEditView(bool bNoPaint)
Definition: tabview3.cxx:2167
tools::Long GetGridHeight(ScVSplitPos eWhich)
Definition: tabview3.cxx:2992
weld::Window * GetFrameWeld() const
void MoveCursorScreen(SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, bool bShift)
Definition: tabview3.cxx:1365
void UpdateAutoFillMark(bool bFromPaste=false)
Definition: tabview3.cxx:184
void logEvent(const EventDescription &rDescription)
sal_uInt16 sal_Unicode
Reference< XController > xController
void PaintLeft()
Definition: tabview3.cxx:2700
static void notifyInvalidation(SfxViewShell const *pThisView, const OString &rPayload)
bool isOptionEnabled(Option eOption) const
void PaintLeftArea(SCROW nStartRow, SCROW nEndRow)
Definition: tabview3.cxx:2711
tools::Long Left() const
bool IsFormulaMode()
Definition: scmod.cxx:1622
void MoveCursorEnd(SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, bool bShift, bool bKeepSel=false)
Definition: tabview3.cxx:1335
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:870
void UpdateInputContext()
Definition: gridwin.cxx:3427
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:312
static bool lcl_IsRefDlgActive(SfxViewFrame *pViewFrm)
Definition: tabview3.cxx:448
bool In(const ScRange &) const
Definition: rangelst.cxx:1087
bool IsMultiMarked() const
Definition: markdata.hxx:83
void MarkDataChanged()
Definition: tabview3.cxx:1742
void OnLibreOfficeKitTabChanged()
Definition: tabview3.cxx:2044
SfxFrame & GetFrame() const
int nCount
void PaintRangeFinder(tools::Long nNumber)
Definition: tabview3.cxx:2491
constexpr sal_uInt16 KEY_PAGEUP
tools::Long Bottom() const
ScInputWindow * GetInputWindow()
Definition: inputhdl.hxx:263
void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
void Modifier(ScGridWindow *pWin)
Definition: tabview3.cxx:137
bool SelMouseButtonDown(const MouseEvent &rMEvt)
Definition: tabview3.cxx:1164
void UpdateFormulas(SCCOL nStartCol=-1, SCROW nStartRow=-1, SCCOL nEndCol=-1, SCROW nEndRow=-1)
Definition: tabview3.cxx:2279
void UpdateEditView()
Definition: tabview3.cxx:2144
SC_DLLPUBLIC bool HasTable(SCTAB nTab) const
Definition: document.cxx:189
Mode eMode
SCTAB Tab() const
Definition: address.hxx:271
SC_DLLPUBLIC void GetNextPos(SCCOL &rCol, SCROW &rRow, SCTAB nTab, SCCOL nMovX, SCROW nMovY, bool bMarked, bool bUnprotected, const ScMarkData &rMark, SCCOL nTabStartCol=SC_TABSTART_NONE) const
Definition: document.cxx:6087
void ActivatePart(ScSplitPos eWhich)
Definition: tabview3.cxx:2871
bool IsInputActive()
Definition: inputwin.cxx:638
void RecalcPPT()
Definition: tabview3.cxx:2766
void ClearHighlightRanges()
Definition: tabview3.cxx:2529
static sal_Unicode GetNativeSymbolChar(OpCode eOp)
void ActivateView(bool bActivate, bool bFirst)
Definition: tabview3.cxx:2795
sal_uInt16 nCode
ScViewData & GetViewData()
Definition: tabview.hxx:334
void PaintTop()
Definition: tabview3.cxx:2635
void CheckNeedsRepaint()
Definition: tabview3.cxx:3055
void SelectionChanged(bool bFromPaste=false)
Definition: tabview3.cxx:529
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
Definition: document.cxx:4712
bool HasHintWindow() const
Definition: tabview3.cxx:871
static ScSelectionTransferObj * CreateFromView(ScTabView *pSource)
Definition: seltrans.cxx:69
void PutInOrder(T &nStart, T &nEnd)
Definition: address.hxx:954
float y
ocSep
void PaintArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScUpdateMode eMode=ScUpdateMode::All)
Definition: tabview3.cxx:2302
void UpdateLokReferenceMarks()
Definition: inputhdl.cxx:474
void SelectTabPage(const sal_uInt16 nTab)
Definition: tabview3.cxx:1787
constexpr sal_uInt16 KEY_DOWN
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALIDDATA(153)
SC_DLLPUBLIC void GetDataArea(SCTAB nTab, SCCOL &rStartCol, SCROW &rStartRow, SCCOL &rEndCol, SCROW &rEndRow, bool bIncludeOld, bool bOnlyDown) const
Return the smallest area containing at least all contiguous cells having data.
Definition: document.cxx:1094
tools::Long getHeight() const
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:869
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: document.cxx:4443
sal_uInt16 GetCurRefDlgId() const
Definition: scmod.hxx:229
bool IsMarked() const
Definition: markdata.hxx:82
void SetWindow(vcl::Window *pViewPort)
#define DBG_ASSERT(sCon, aError)
int i
void WindowChanged()
Definition: tabvwsh2.cxx:53
void SelectTable(SCTAB nTab, bool bNew)
Definition: markdata.cxx:172
void Set(SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: address.hxx:406
sal_Int16 SCCOL
Definition: types.hxx:22
constexpr sal_uInt16 KEY_HOME
void CreateAnchorHandles(SdrHdlList &rHdl, const ScAddress &rAddress)
Definition: tabview3.cxx:2646
EditEngine * GetEditEngine() const
void SetPos(const Point &rPos, const MapMode &rMode)
Definition: hintwin.cxx:162
#define SC_MOD()
Definition: scmod.hxx:250
void SetSize(const Size &rSize)
void FakeButtonUp(ScSplitPos eWhich)
Definition: tabview3.cxx:210
void EnterHandler(ScEnterMode nBlockMode=ScEnterMode::NORMAL)
Definition: inputhdl.cxx:2909
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
Definition: tabview3.cxx:1794
tools::Long Width() const
size_t size() const
Definition: rangelst.hxx:90
void SelectOneTable(SCTAB nTab)
Definition: markdata.cxx:189
constexpr sal_uInt16 KEY_PAGEDOWN
virtual void ViewShellChanged()=0
Size GetOutputSizePixel() const
PaintArea
bool In(const ScAddress &) const
is Address& in Range?
Definition: address.hxx:733
void MakeEditView(ScEditEngineDefaulter *pEngine, SCCOL nCol, SCROW nRow)
Definition: tabview3.cxx:2087
tools::Long Top() const
void DoDPFieldPopup(std::u16string_view rPivotTableName, sal_Int32 nDimensionIndex, Point aPoint, Size aSize)
Definition: tabview3.cxx:2601
void GrabFocus()
SfxViewShell * GetViewShell() const
virtual bool isProtected() const override
void InvalidateAttribs()
Definition: tabview3.cxx:248
const long LONG_MAX
SCCOL Col() const
Definition: address.hxx:267
ScSelectionTransferObj * GetSelectionTransfer() const
Definition: scmod.hxx:152
void Apply(SfxViewShell *pViewShell, ScSplitPos eWhich)
Definition: tabview3.cxx:115
const sal_uInt16 idx[]
constexpr sal_uInt16 KEY_RIGHT
void Add(SfxViewShell *pViewShell, ScSplitPos eWhich)
Definition: tabview3.cxx:103
Point PixelToLogic(const Point &rDevicePt) const
Point LogicToPixel(const Point &rLogicPt) const
void ClickCursor(SCCOL nPosX, SCROW nPosY, bool bControl)
Definition: tabview3.cxx:159
SdrOle2Obj * GetDrawObj()
Definition: client.cxx:49
sal_uLong Count() const
Definition: rfindlst.hxx:51
bool ValidColRow(SCCOL nCol, SCROW nRow) const
Definition: document.hxx:874
void SetEditEngine(EditEngine *pEditEngine)
ScHSplitPos
Definition: viewdata.hxx:46
void SkipOverlapped(SCCOL &rCol, SCROW &rRow, SCTAB nTab) const
Definition: document.cxx:5714
ScRange aRef
Definition: rfindlst.hxx:31
void MarkRows()
Definition: tabview3.cxx:1589
sal_Int32 SCROW
Definition: types.hxx:18
const vcl::KeyCode & GetKeyCode() const
SfxViewShell * GetViewShell() const
SC_DLLPUBLIC void PutInOrder()
Definition: address.cxx:1582
static ReferenceMark GetReferenceMark(const ScViewData &rViewData, ScDocShell *pDocSh, tools::Long nX1, tools::Long nX2, tools::Long nY1, tools::Long nY2, tools::Long nTab, const Color &rColor)
Definition: inputhdl.cxx:424
void SelectionChanged()
Definition: viewuno.cxx:1645
void MoveCursorEnter(bool bShift)
Definition: tabview3.cxx:1402
bool HasChildWindow(sal_uInt16)
bool IsShift() const
SfxInPlaceClient * GetIPClient() const
bool ValidRow(SCROW nRow) const
Definition: document.hxx:873
void HideAllCursors()
Definition: tabview3.cxx:216
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
virtual bool IsRefInputMode() const =0
ScUpdateMode
Definition: viewutil.hxx:39
void MoveCursorPage(SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, bool bShift, bool bKeepSel=false)
Definition: tabview3.cxx:1319
void CheckSelectionTransfer()
Definition: tabview3.cxx:470
void AddWindowToForeignEditView(SfxViewShell *pViewShell, ScSplitPos eWhich)
Definition: tabview3.cxx:2034
void MoveCursorArea(SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, bool bShift, bool bKeepSel=false)
Definition: tabview3.cxx:1327
css::uno::Reference< css::frame::XController > GetController() const
void MoveCursorRel(SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, bool bShift, bool bKeepSel=false)
Definition: tabview3.cxx:1261
bool GetInput(OUString &rTitle, OUString &rMsg) const
Definition: validat.hxx:109
const tools::Rectangle & GetObjArea() const
bool PrepareClose(bool bUI=true)
static void SendReferenceMarks(const SfxViewShell *pViewShell, const std::vector< ReferenceMark > &rReferenceMarks)
Definition: inputhdl.cxx:261
bool IsMod1() const
tools::Long Height() const
sal_uInt16 GetMoveDir() const
Definition: inputopt.hxx:48
void * p
void ZoomChanged()
Definition: tabview3.cxx:3006
virtual bool get_extents_relative_to(const Widget &rRelative, int &x, int &y, int &width, int &height) const =0
const SCROW MAXTILEDROW
Definition: address.hxx:76
void AlignToCursor(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, const ScSplitPos *pWhich=nullptr)
Definition: tabview3.cxx:912
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
Definition: document.cxx:992
bool IsVisible() const
void HideListBox()
Definition: tabview3.cxx:2960
static bool GetRangeListFromString(ScRangeList &rRangeList, const OUString &rRangeListStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator= ' ', sal_Unicode cQuote= '\'')
Definition: rangeutl.cxx:526
void ShowCursor()
Definition: tabview3.cxx:242
void SetSelectionTransfer(ScSelectionTransferObj *pNew)
Definition: scmod.cxx:646
void SelectNextTab(short nDir, bool bExtendSelection)
Definition: tabview3.cxx:1749
tools::Long GetHeight() const
sal_uInt32 GetValue() const
ScRangeFindData & GetObject(sal_uLong nIndex)
Definition: rfindlst.hxx:54
Size GetSizePixel() const
Definition: hintwin.cxx:155
SC_DLLPUBLIC bool IsVisible(SCTAB nTab) const
Definition: document.cxx:906
#define SAL_WARN(area, stream)
void DPLaunchFieldPopupMenu(const Point &rScrPos, const Size &rScrSize, const ScAddress &rPos, ScDPObject *pDPObj)
Definition: gridwin2.cxx:436
SC_DLLPUBLIC bool GetMatrixFormulaRange(const ScAddress &rCellPos, ScRange &rMatrix)
Definition: document.cxx:5421
const SCCOL SC_TABSTART_NONE
Definition: address.hxx:89
bool IsRefInputMode() const
Definition: tabvwsha.cxx:603
constexpr sal_uInt16 KEY_LEFT
Point OutputToScreenPixel(const Point &rPos) const
SC_DLLPUBLIC void MakeTable(SCTAB nTab, bool _bNeedsNameCheck=true)
Definition: document.cxx:166
tools::Rectangle GetInvalidateRect() const
const OUString & GetDocName() const
Definition: rfindlst.hxx:58
bool GetTableSelect(SCTAB nTab) const
Definition: markdata.cxx:184
bool IsRefDialogOpen()
Definition: scmod.cxx:1606
std::map< OUString, OUString > aParameters
void PaintTopArea(SCCOL nStartCol, SCCOL nEndCol)
Definition: tabview3.cxx:2655
constexpr sal_uInt16 KEY_SHIFT
void BuildAllDimensionMembers()
Definition: dpobject.cxx:960
ScRangeFindList * GetRangeFindList()
Definition: inputhdl.hxx:252
void MarkColumns()
Definition: tabview3.cxx:1561
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4118
const ScInputHandler * GetInputHandler() const
Definition: tabvwsh.hxx:232
void MarkMatrixFormula()
Definition: tabview3.cxx:1672
SC_DLLPUBLIC void CellContentChanged()
Definition: tabview3.cxx:510
bool ValidTab(SCTAB nTab)
Definition: address.hxx:105
tools::Long Right() const
void GetEditView(ScSplitPos eWhich, EditView *&rViewPtr, SCCOL &rCol, SCROW &rRow)
Definition: viewdata.cxx:2219
sal_Int16 SCTAB
Definition: types.hxx:23
virtual Size getDocumentSize() override
Definition: docuno.cxx:648
bool MoveCursorKeyInput(const KeyEvent &rKeyEvent)
Definition: tabview3.cxx:1459
void ShowAllCursors()
Definition: tabview3.cxx:230
void SetRefScale(const Fraction &rX, const Fraction &rY)
Definition: inputhdl.cxx:818
bool IsMod1() const
virtual const tools::Rectangle & GetLogicRect() const override
void SetMarkData(const ScMarkData &rNew)
Definition: tabview3.cxx:1733
bool IsMod2() const
SC_DLLPUBLIC const ScTableProtection * GetTabProtection(SCTAB nTab) const
Definition: documen3.cxx:1898
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo