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