LibreOffice Module sc (master)  1
tabview2.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 <scitems.hxx>
21 #include <vcl/svapp.hxx>
22 #include <vcl/weld.hxx>
23 #include <sfx2/bindings.hxx>
24 #include <osl/diagnose.h>
25 
26 #include <attrib.hxx>
27 #include <pagedata.hxx>
28 #include <tabview.hxx>
29 #include <tabvwsh.hxx>
30 #include <printfun.hxx>
31 #include <stlpool.hxx>
32 #include <docsh.hxx>
33 #include <gridwin.hxx>
34 #include <sc.hrc>
35 #include <viewutil.hxx>
36 #include <colrowba.hxx>
37 #include <globstr.hrc>
38 #include <scresid.hxx>
39 #include <scmod.hxx>
40 #include <tabprotection.hxx>
41 #include <markdata.hxx>
42 #include <inputopt.hxx>
43 #include <comphelper/lok.hxx>
44 
45 namespace {
46 
47 bool isCellQualified(const ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, bool bSelectLocked, bool bSelectUnlocked)
48 {
49  bool bCellProtected = pDoc->HasAttrib(
50  nCol, nRow, nTab, nCol, nRow, nTab, HasAttrFlags::Protected);
51 
52  if (bCellProtected && !bSelectLocked)
53  return false;
54 
55  if (!bCellProtected && !bSelectUnlocked)
56  return false;
57 
58  return true;
59 }
60 
61 void moveCursorByProtRule(
62  SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, const ScDocument* pDoc)
63 {
64  bool bSelectLocked = true;
65  bool bSelectUnlocked = true;
66  const ScTableProtection* pTabProtection = pDoc->GetTabProtection(nTab);
67  if (pTabProtection && pTabProtection->isProtected())
68  {
69  bSelectLocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
70  bSelectUnlocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
71  }
72 
73  if (nMovX > 0)
74  {
75  for (SCCOL i = 0; i < nMovX && rCol < pDoc->MaxCol(); ++i)
76  {
77  SCCOL nNewUnhiddenCol = rCol + 1;
78  SCCOL nEndCol = 0;
79  while(pDoc->ColHidden(nNewUnhiddenCol, nTab, nullptr, &nEndCol))
80  {
81  if(nNewUnhiddenCol >= pDoc->MaxCol())
82  return;
83 
84  i += nEndCol - nNewUnhiddenCol + 1;
85  nNewUnhiddenCol = nEndCol +1;
86  }
87 
88  if (!isCellQualified(pDoc, nNewUnhiddenCol, rRow, nTab, bSelectLocked, bSelectUnlocked))
89  break;
90  rCol = nNewUnhiddenCol;
91  }
92  }
93  else if (nMovX < 0)
94  {
95  for (SCCOL i = 0; i > nMovX && rCol > 0; --i)
96  {
97  SCCOL nNewUnhiddenCol = rCol - 1;
98  SCCOL nStartCol = 0;
99  while(pDoc->ColHidden(nNewUnhiddenCol, nTab, &nStartCol))
100  {
101  if(nNewUnhiddenCol <= 0)
102  return;
103 
104  i -= nNewUnhiddenCol - nStartCol + 1;
105  nNewUnhiddenCol = nStartCol - 1;
106  }
107 
108  if (!isCellQualified(pDoc, nNewUnhiddenCol, rRow, nTab, bSelectLocked, bSelectUnlocked))
109  break;
110  rCol = nNewUnhiddenCol;
111  }
112  }
113 
114  if (nMovY > 0)
115  {
116  for (SCROW i = 0; i < nMovY && rRow < pDoc->MaxRow(); ++i)
117  {
118  SCROW nNewUnhiddenRow = rRow + 1;
119  SCROW nEndRow = 0;
120  while(pDoc->RowHidden(nNewUnhiddenRow, nTab, nullptr, &nEndRow))
121  {
122  if(nNewUnhiddenRow >= pDoc->MaxRow())
123  return;
124 
125  i += nEndRow - nNewUnhiddenRow + 1;
126  nNewUnhiddenRow = nEndRow + 1;
127  }
128 
129  if (!isCellQualified(pDoc, rCol, nNewUnhiddenRow, nTab, bSelectLocked, bSelectUnlocked))
130  break;
131  rRow = nNewUnhiddenRow;
132  }
133  }
134  else if (nMovY < 0)
135  {
136  for (SCROW i = 0; i > nMovY && rRow > 0; --i)
137  {
138  SCROW nNewUnhiddenRow = rRow - 1;
139  SCROW nStartRow = 0;
140  while(pDoc->RowHidden(nNewUnhiddenRow, nTab, &nStartRow))
141  {
142  if(nNewUnhiddenRow <= 0)
143  return;
144 
145  i -= nNewUnhiddenRow - nStartRow + 1;
146  nNewUnhiddenRow = nStartRow - 1;
147  }
148 
149  if (!isCellQualified(pDoc, rCol, nNewUnhiddenRow, nTab, bSelectLocked, bSelectUnlocked))
150  break;
151  rRow = nNewUnhiddenRow;
152  }
153  }
154 }
155 
156 bool checkBoundary(const ScDocument* pDoc, SCCOL& rCol, SCROW& rRow)
157 {
158  bool bGood = true;
159  if (rCol < 0)
160  {
161  rCol = 0;
162  bGood = false;
163  }
164  else if (rCol > pDoc->MaxCol())
165  {
166  rCol = pDoc->MaxCol();
167  bGood = false;
168  }
169 
170  if (rRow < 0)
171  {
172  rRow = 0;
173  bGood = false;
174  }
175  else if (rRow > pDoc->MaxRow())
176  {
177  rRow = pDoc->MaxRow();
178  bGood = false;
179  }
180  return bGood;
181 }
182 
183 void moveCursorByMergedCell(
184  SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab,
185  const ScDocument* pDoc, const ScViewData& rViewData)
186 {
187  SCCOL nOrigX = rViewData.GetCurX();
188  SCROW nOrigY = rViewData.GetCurY();
189 
190  const ScTableProtection* pTabProtection = pDoc->GetTabProtection(nTab);
191  bool bSelectLocked = true;
192  bool bSelectUnlocked = true;
193  if (pTabProtection && pTabProtection->isProtected())
194  {
195  bSelectLocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
196  bSelectUnlocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
197  }
198 
199  const ScMergeAttr* pMergeAttr = pDoc->GetAttr(nOrigX, nOrigY, nTab, ATTR_MERGE);
200 
201  bool bOriginMerged = false;
202  SCCOL nColSpan = 1;
203  SCROW nRowSpan = 1;
204  if (pMergeAttr && pMergeAttr->IsMerged())
205  {
206  nColSpan = pMergeAttr->GetColMerge();
207  nRowSpan = pMergeAttr->GetRowMerge();
208  bOriginMerged = true;
209  }
210 
211  if (nMovX > 0)
212  {
213  SCCOL nOld = rCol;
214  if (bOriginMerged)
215  {
216  // Original cell is merged. Push the block end outside the merged region.
217  if (nOrigX < pDoc->MaxCol() && nOrigX < rCol && rCol <= nOrigX + nColSpan - 1)
218  rCol = nOrigX + nColSpan;
219  }
220  else
221  {
222  pDoc->SkipOverlapped(rCol, rRow, nTab);
223  }
224 
225  if (nOld < rCol)
226  {
227  // The block end has moved. Check the protection setting and move back if needed.
228  checkBoundary(pDoc, rCol, rRow);
229  if (!isCellQualified(pDoc, rCol, rRow, nTab, bSelectLocked, bSelectUnlocked))
230  --rCol;
231  }
232  }
233  if (nMovX < 0)
234  {
235  SCCOL nOld = rCol;
236  if (bOriginMerged)
237  {
238  if (nOrigX > 0 && nOrigX <= rCol && rCol < nOrigX + nColSpan - 1)
239  // Block end is still within the merged region. Push it outside.
240  rCol = nOrigX - 1;
241  }
242  else
243  {
244  pDoc->SkipOverlapped(rCol, rRow, nTab);
245  }
246 
247  if (nOld > rCol)
248  {
249  // The block end has moved. Check the protection setting and move back if needed.
250  checkBoundary(pDoc, rCol, rRow);
251  if (!isCellQualified(pDoc, rCol, rRow, nTab, bSelectLocked, bSelectUnlocked))
252  ++rCol;
253  }
254  }
255  if (nMovY > 0)
256  {
257  SCROW nOld = rRow;
258  if (bOriginMerged)
259  {
260  // Original cell is merged. Push the block end outside the merged region.
261  if (nOrigY < pDoc->MaxRow() && nOrigY < rRow && rRow <= nOrigY + nRowSpan - 1)
262  rRow = nOrigY + nRowSpan;
263  }
264  else
265  {
266  pDoc->SkipOverlapped(rCol, rRow, nTab);
267  }
268 
269  if (nOld < rRow)
270  {
271  // The block end has moved. Check the protection setting and move back if needed.
272  checkBoundary(pDoc, rCol, rRow);
273  if (!isCellQualified(pDoc, rCol, rRow, nTab, bSelectLocked, bSelectUnlocked))
274  --rRow;
275  }
276  }
277  if (nMovY >= 0)
278  return;
279 
280  SCROW nOld = rRow;
281  if (bOriginMerged)
282  {
283  if (nOrigY > 0 && nOrigY <= rRow && rRow < nOrigY + nRowSpan - 1)
284  // Block end is still within the merged region. Push it outside.
285  rRow = nOrigY - 1;
286  }
287  else
288  {
289  pDoc->SkipOverlapped(rCol, rRow, nTab);
290  }
291 
292  if (nOld > rRow)
293  {
294  // The block end has moved. Check the protection setting and move back if needed.
295  checkBoundary(pDoc, rCol, rRow);
296  if (!isCellQualified(pDoc, rCol, rRow, nTab, bSelectLocked, bSelectUnlocked))
297  ++rRow;
298  }
299 }
300 
301 }
302 
303 void ScTabView::PaintMarks(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow )
304 {
305  auto& rDoc = aViewData.GetDocument();
306  if (!rDoc.ValidCol(nStartCol)) nStartCol = rDoc.MaxCol();
307  if (!rDoc.ValidRow(nStartRow)) nStartRow = rDoc.MaxRow();
308  if (!rDoc.ValidCol(nEndCol)) nEndCol = rDoc.MaxCol();
309  if (!rDoc.ValidRow(nEndRow)) nEndRow = rDoc.MaxRow();
310 
311  bool bLeft = (nStartCol==0 && nEndCol==rDoc.MaxCol());
312  bool bTop = (nStartRow==0 && nEndRow==rDoc.MaxRow());
313 
314  if (bLeft)
315  PaintLeftArea( nStartRow, nEndRow );
316  if (bTop)
317  PaintTopArea( nStartCol, nEndCol );
318 
319  aViewData.GetDocument().ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow,
320  aViewData.GetTabNo() );
321  PaintArea( nStartCol, nStartRow, nEndCol, nEndRow, ScUpdateMode::Marks );
322 }
323 
324 bool ScTabView::IsMarking( SCCOL nCol, SCROW nRow, SCTAB nTab ) const
325 {
326  return IsBlockMode()
327  && nBlockStartX == nCol
328  && nBlockStartY == nRow
329  && nBlockStartZ == nTab;
330 }
331 
332 void ScTabView::InitOwnBlockMode( const ScRange& rMarkRange )
333 {
334  if (IsBlockMode())
335  return;
336 
337  // when there is no (old) selection anymore, delete anchor in SelectionEngine:
338  ScMarkData& rMark = aViewData.GetMarkData();
339  if (!rMark.IsMarked() && !rMark.IsMultiMarked())
340  GetSelEngine()->CursorPosChanging( false, false );
341 
342  meBlockMode = Own;
343  nBlockStartX = rMarkRange.aStart.Col();
344  nBlockStartY = rMarkRange.aStart.Row();
345  nBlockStartZ = rMarkRange.aStart.Tab();
346  nBlockEndX = rMarkRange.aEnd.Col();
347  nBlockEndY = rMarkRange.aEnd.Row();
348  nBlockEndZ = rMarkRange.aEnd.Tab();
349 
350  SelectionChanged(); // status is checked with mark set
351 }
352 
353 void ScTabView::InitBlockMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
354  bool bTestNeg, bool bCols, bool bRows, bool bForceNeg )
355 {
356  if (IsBlockMode())
357  return;
358 
359  auto& rDoc = aViewData.GetDocument();
360  if (!rDoc.ValidCol(nCurX)) nCurX = rDoc.MaxCol();
361  if (!rDoc.ValidRow(nCurY)) nCurY = rDoc.MaxRow();
362 
363  ScMarkData& rMark = aViewData.GetMarkData();
364  SCTAB nTab = aViewData.GetTabNo();
365 
366  // unmark part?
367  if (bForceNeg)
368  bBlockNeg = true;
369  else if (bTestNeg)
370  {
371  if ( bCols )
372  bBlockNeg = rMark.IsColumnMarked( nCurX );
373  else if ( bRows )
374  bBlockNeg = rMark.IsRowMarked( nCurY );
375  else
376  bBlockNeg = rMark.IsCellMarked( nCurX, nCurY );
377  }
378  else
379  bBlockNeg = false;
380  rMark.SetMarkNegative(bBlockNeg);
381 
383  bBlockCols = bCols;
384  bBlockRows = bRows;
385  nBlockStartX = nBlockStartXOrig = nCurX;
386  nBlockStartY = nBlockStartYOrig = nCurY;
387  nBlockStartZ = nCurZ;
391 
392  if (bBlockCols)
393  {
395  nBlockEndY = rDoc.MaxRow();
396  }
397 
398  if (bBlockRows)
399  {
401  nBlockEndX = rDoc.MaxCol();
402  }
403 
405 
407 }
408 
409 void ScTabView::DoneBlockMode( bool bContinue )
410 {
411  // When switching between sheet and header SelectionEngine DeselectAll may be called,
412  // because the other engine does not have any anchor.
413  // bMoveIsShift prevents the selection to be canceled.
414 
415  if (!IsBlockMode() || bMoveIsShift)
416  return;
417 
418  ScMarkData& rMark = aViewData.GetMarkData();
419  bool bFlag = rMark.GetMarkingFlag();
420  rMark.SetMarking(false);
421 
422  if (bBlockNeg && !bContinue)
423  rMark.MarkToMulti();
424 
425  if (bContinue)
426  rMark.MarkToMulti();
427  else
428  {
429  // the sheet may be invalid at this point because DoneBlockMode from SetTabNo is
430  // called (for example, when the current sheet is closed from another View)
431  SCTAB nTab = aViewData.GetTabNo();
432  ScDocument& rDoc = aViewData.GetDocument();
433  if ( rDoc.HasTable(nTab) )
434  PaintBlock( true ); // true -> delete block
435  else
436  rMark.ResetMark();
437  }
438  meBlockMode = None;
439 
440  rMark.SetMarking(bFlag);
441  rMark.SetMarkNegative(false);
442 }
443 
445 {
446  return meBlockMode != None;
447 }
448 
449 void ScTabView::MarkCursor( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
450  bool bCols, bool bRows, bool bCellSelection )
451 {
452  ScDocument& rDocument = aViewData.GetDocument();
453  if (!rDocument.ValidCol(nCurX)) nCurX = rDocument.MaxCol();
454  if (!rDocument.ValidRow(nCurY)) nCurY = rDocument.MaxRow();
455 
456  if (!IsBlockMode())
457  {
458  OSL_FAIL( "MarkCursor not in BlockMode" );
459  InitBlockMode( nCurX, nCurY, nCurZ, false, bCols, bRows );
460  }
461 
462  if (bCols)
463  nCurY = rDocument.MaxRow();
464  if (bRows)
465  nCurX = rDocument.MaxCol();
466 
467  ScMarkData& rMark = aViewData.GetMarkData();
468  OSL_ENSURE(rMark.IsMarked() || rMark.IsMultiMarked(), "MarkCursor, !IsMarked()");
469  const ScRange& aMarkRange = rMark.GetMarkArea();
470  if (( aMarkRange.aStart.Col() != nBlockStartX && aMarkRange.aEnd.Col() != nBlockStartX ) ||
471  ( aMarkRange.aStart.Row() != nBlockStartY && aMarkRange.aEnd.Row() != nBlockStartY ) ||
472  ( meBlockMode == Own ))
473  {
474  // Mark has been changed
475  // (Eg MarkToSimple if by negative everything was erased, except for a rectangle)
476  // or after InitOwnBlockMode is further marked with shift-
477  bool bOldShift = bMoveIsShift;
478  bMoveIsShift = false; // really move
479  DoneBlockMode();
480  bMoveIsShift = bOldShift;
481 
482  InitBlockMode( aMarkRange.aStart.Col(), aMarkRange.aStart.Row(),
483  nBlockStartZ, rMark.IsMarkNegative(), bCols, bRows );
484  }
485 
486  if ( nCurX != nOldCurX || nCurY != nOldCurY )
487  {
488  // Current cursor has moved
489 
490  SCTAB nTab = nCurZ;
491 
492  if ( bCellSelection )
493  {
494  // Expand selection area accordingly when the current selection ends
495  // with a merged cell.
496  SCCOL nCurXOffset = 0;
497  SCCOL nBlockStartXOffset = 0;
498  SCROW nCurYOffset = 0;
499  SCROW nBlockStartYOffset = 0;
500  bool bBlockStartMerged = false;
501 
502  // The following block checks whether or not the "BlockStart" (anchor)
503  // cell is merged. If it's merged, it'll then move the position of the
504  // anchor cell to the corner that's diagonally opposite of the
505  // direction of a current selection area. For instance, if a current
506  // selection is moving in the upperleft direction, the anchor cell will
507  // move to the lower-right corner of the merged anchor cell, and so on.
508 
509  const ScMergeAttr* pMergeAttr =
511  if ( pMergeAttr->IsMerged() )
512  {
513  SCCOL nColSpan = pMergeAttr->GetColMerge();
514  SCROW nRowSpan = pMergeAttr->GetRowMerge();
515 
516  if ( nCurX < nBlockStartXOrig + nColSpan - 1 || nCurY < nBlockStartYOrig + nRowSpan - 1 )
517  {
518  nBlockStartX = nCurX >= nBlockStartXOrig ? nBlockStartXOrig : nBlockStartXOrig + nColSpan - 1;
519  nBlockStartY = nCurY >= nBlockStartYOrig ? nBlockStartYOrig : nBlockStartYOrig + nRowSpan - 1;
520  nCurXOffset = (nCurX >= nBlockStartXOrig && nCurX < nBlockStartXOrig + nColSpan - 1) ?
521  nBlockStartXOrig - nCurX + nColSpan - 1 : 0;
522  nCurYOffset = (nCurY >= nBlockStartYOrig && nCurY < nBlockStartYOrig + nRowSpan - 1) ?
523  nBlockStartYOrig - nCurY + nRowSpan - 1 : 0;
524  bBlockStartMerged = true;
525  }
526  }
527 
528  // The following block checks whether or not the current cell is
529  // merged. If it is, it'll then set the appropriate X & Y offset
530  // values (nCurXOffset & nCurYOffset) such that the selection area will
531  // grow by those specified offset amounts. Note that the values of
532  // nCurXOffset/nCurYOffset may also be specified in the previous code
533  // block, in which case whichever value is greater will take on.
534 
535  pMergeAttr = rDocument.GetAttr( nCurX, nCurY, nTab, ATTR_MERGE );
536  if ( pMergeAttr->IsMerged() )
537  {
538  SCCOL nColSpan = pMergeAttr->GetColMerge();
539  SCROW nRowSpan = pMergeAttr->GetRowMerge();
540 
541  if ( nBlockStartX < nCurX + nColSpan - 1 || nBlockStartY < nCurY + nRowSpan - 1 )
542  {
543  if ( nBlockStartX <= nCurX + nColSpan - 1 )
544  {
545  SCCOL nCurXOffsetTemp = (nCurX < nCurX + nColSpan - 1) ? nColSpan - 1 : 0;
546  nCurXOffset = std::max(nCurXOffset, nCurXOffsetTemp);
547  }
548  if ( nBlockStartY <= nCurY + nRowSpan - 1 )
549  {
550  SCROW nCurYOffsetTemp = (nCurY < nCurY + nRowSpan - 1) ? nRowSpan - 1 : 0;
551  nCurYOffset = std::max(nCurYOffset, nCurYOffsetTemp);
552  }
553  if ( ( nBlockStartX > nCurX || nBlockStartY > nCurY ) &&
554  ( nBlockStartX <= nCurX + nColSpan - 1 || nBlockStartY <= nCurY + nRowSpan - 1 ) )
555  {
556  nBlockStartXOffset = (nBlockStartX > nCurX && nBlockStartX <= nCurX + nColSpan - 1) ? nCurX - nBlockStartX : 0;
557  nBlockStartYOffset = (nBlockStartY > nCurY && nBlockStartY <= nCurY + nRowSpan - 1) ? nCurY - nBlockStartY : 0;
558  }
559  }
560  }
561  else
562  {
563  // The current cell is not merged. Move the anchor cell to its
564  // original position.
565  if ( !bBlockStartMerged )
566  {
569  }
570  }
571 
572  nBlockStartX = nBlockStartX + nBlockStartXOffset >= 0 ? nBlockStartX + nBlockStartXOffset : 0;
573  nBlockStartY = nBlockStartY + nBlockStartYOffset >= 0 ? nBlockStartY + nBlockStartYOffset : 0;
574  nBlockEndX = std::min<SCCOL>(nCurX + nCurXOffset, rDocument.MaxCol());
575  nBlockEndY = std::min(nCurY + nCurYOffset, rDocument.MaxRow());
576  }
577  else
578  {
579  nBlockEndX = nCurX;
580  nBlockEndY = nCurY;
581  }
582 
583  // Set new selection area
585 
588 
589  nOldCurX = nCurX;
590  nOldCurY = nCurY;
591 
593  }
594 
595  if ( !bCols && !bRows )
596  aHdrFunc.SetAnchorFlag( false );
597 }
598 
599 void ScTabView::GetPageMoveEndPosition(SCCOL nMovX, SCROW nMovY, SCCOL& rPageX, SCROW& rPageY)
600 {
601  SCCOL nCurX;
602  SCROW nCurY;
603  if (aViewData.IsRefMode())
604  {
605  nCurX = aViewData.GetRefEndX();
606  nCurY = aViewData.GetRefEndY();
607  }
608  else if (IsBlockMode())
609  {
610  // block end position.
611  nCurX = nBlockEndX;
612  nCurY = nBlockEndY;
613  }
614  else
615  {
616  // cursor position
617  nCurX = aViewData.GetCurX();
618  nCurY = aViewData.GetCurY();
619  }
620 
622  ScHSplitPos eWhichX = WhichH( eWhich );
623  ScVSplitPos eWhichY = WhichV( eWhich );
624 
625  sal_uInt16 nScrSizeY = SC_SIZE_NONE;
628  }
629 
630  SCCOL nPageX;
631  SCROW nPageY;
632  if (nMovX >= 0)
633  nPageX = aViewData.CellsAtX( nCurX, 1, eWhichX ) * nMovX;
634  else
635  nPageX = aViewData.CellsAtX( nCurX, -1, eWhichX ) * nMovX;
636 
637  if (nMovY >= 0)
638  nPageY = aViewData.CellsAtY( nCurY, 1, eWhichY, nScrSizeY ) * nMovY;
639  else
640  nPageY = aViewData.CellsAtY( nCurY, -1, eWhichY, nScrSizeY ) * nMovY;
641 
642  if (nMovX != 0 && nPageX == 0) nPageX = (nMovX>0) ? 1 : -1;
643  if (nMovY != 0 && nPageY == 0) nPageY = (nMovY>0) ? 1 : -1;
644 
645  rPageX = nPageX;
646  rPageY = nPageY;
647 }
648 
650  SCCOL& rAreaX, SCROW& rAreaY, ScFollowMode& rMode)
651 {
652  SCCOL nNewX = -1;
653  SCROW nNewY = -1;
654 
655  // current cursor position.
656  SCCOL nCurX = aViewData.GetCurX();
657  SCROW nCurY = aViewData.GetCurY();
658 
659  if (aViewData.IsRefMode())
660  {
661  nNewX = aViewData.GetRefEndX();
662  nNewY = aViewData.GetRefEndY();
663  nCurX = aViewData.GetRefStartX();
664  nCurY = aViewData.GetRefStartY();
665  }
666  else if (IsBlockMode())
667  {
668  // block end position.
669  nNewX = nBlockEndX;
670  nNewY = nBlockEndY;
671  }
672  else
673  {
674  nNewX = nCurX;
675  nNewY = nCurY;
676  }
677 
678  ScDocument& rDoc = aViewData.GetDocument();
679  SCTAB nTab = aViewData.GetTabNo();
680 
681  // FindAreaPos knows only -1 or 1 as direction
682  ScModule* pScModule = SC_MOD();
683  bool bLegacyCellSelection = pScModule->GetInputOptions().GetLegacyCellSelection();
684  SCCOL nVirtualX = bLegacyCellSelection ? nNewX : nCurX;
685  SCROW nVirtualY = bLegacyCellSelection ? nNewY : nCurY;
686 
687  SCCOLROW i;
688  if ( nMovX > 0 )
689  for ( i=0; i<nMovX; i++ )
690  rDoc.FindAreaPos( nNewX, nVirtualY, nTab, SC_MOVE_RIGHT );
691  if ( nMovX < 0 )
692  for ( i=0; i<-nMovX; i++ )
693  rDoc.FindAreaPos( nNewX, nVirtualY, nTab, SC_MOVE_LEFT );
694  if ( nMovY > 0 )
695  for ( i=0; i<nMovY; i++ )
696  rDoc.FindAreaPos( nVirtualX, nNewY, nTab, SC_MOVE_DOWN );
697  if ( nMovY < 0 )
698  for ( i=0; i<-nMovY; i++ )
699  rDoc.FindAreaPos( nVirtualX, nNewY, nTab, SC_MOVE_UP );
700 
701  if (eMode==SC_FOLLOW_JUMP) // bottom right do not show too much grey
702  {
703  if (nMovX != 0 && nNewX == rDoc.MaxCol())
704  eMode = SC_FOLLOW_LINE;
705  if (nMovY != 0 && nNewY == rDoc.MaxRow())
706  eMode = SC_FOLLOW_LINE;
707  }
708 
709  if (aViewData.IsRefMode())
710  {
711  rAreaX = nNewX - aViewData.GetRefEndX();
712  rAreaY = nNewY - aViewData.GetRefEndY();
713  }
714  else if (IsBlockMode())
715  {
716  rAreaX = nNewX - nBlockEndX;
717  rAreaY = nNewY - nBlockEndY;
718  }
719  else
720  {
721  rAreaX = nNewX - nCurX;
722  rAreaY = nNewY - nCurY;
723  }
724  rMode = eMode;
725 }
726 
727 void ScTabView::SkipCursorHorizontal(SCCOL& rCurX, SCROW& rCurY, SCCOL nOldX, SCCOL nMovX)
728 {
729  ScDocument& rDoc = aViewData.GetDocument();
730  SCTAB nTab = aViewData.GetTabNo();
731 
732  bool bSkipProtected = false, bSkipUnprotected = false;
733  const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
734  if (pProtect && pProtect->isProtected())
735  {
736  bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
737  bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
738  }
739 
740  bool bSkipCell = false;
741  bool bHFlip = false;
742  // If a number of last columns are hidden, search up to and including the first of them,
743  // because after it nothing changes.
744  SCCOL nMaxCol;
745  if(rDoc.ColHidden(rDoc.MaxCol(), nTab, &nMaxCol))
746  ++nMaxCol;
747  else
748  nMaxCol = rDoc.MaxCol();
749  // Search also at least up to and including the first unallocated column (all unallocated columns
750  // share a set of attrs).
751  nMaxCol = std::max( nMaxCol, std::min<SCCOL>( rDoc.GetAllocatedColumnsCount(nTab) + 1, rDoc.MaxCol()));
752  do
753  {
754  bSkipCell = rDoc.ColHidden(rCurX, nTab) || rDoc.IsHorOverlapped(rCurX, rCurY, nTab);
755  if (bSkipProtected && !bSkipCell)
756  bSkipCell = rDoc.HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected);
757  if (bSkipUnprotected && !bSkipCell)
758  bSkipCell = !rDoc.HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected);
759 
760  if (bSkipCell)
761  {
762  if (rCurX <= 0 || rCurX >= nMaxCol)
763  {
764  if (bHFlip)
765  {
766  rCurX = nOldX;
767  bSkipCell = false;
768  }
769  else
770  {
771  nMovX = -nMovX;
772  if (nMovX > 0)
773  ++rCurX;
774  else
775  --rCurX;
776  bHFlip = true;
777  }
778  }
779  else
780  if (nMovX > 0)
781  ++rCurX;
782  else
783  --rCurX;
784  }
785  }
786  while (bSkipCell);
787 
788  if (rDoc.IsVerOverlapped(rCurX, rCurY, nTab))
789  {
790  aViewData.SetOldCursor(rCurX, rCurY);
791  while (rDoc.IsVerOverlapped(rCurX, rCurY, nTab))
792  --rCurY;
793  }
794 }
795 
796 void ScTabView::SkipCursorVertical(SCCOL& rCurX, SCROW& rCurY, SCROW nOldY, SCROW nMovY)
797 {
798  ScDocument& rDoc = aViewData.GetDocument();
799  SCTAB nTab = aViewData.GetTabNo();
800 
801  bool bSkipProtected = false, bSkipUnprotected = false;
802  const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
803  if (pProtect && pProtect->isProtected())
804  {
805  bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
806  bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
807  }
808 
809  bool bSkipCell = false;
810  bool bVFlip = false;
811  // Avoid repeated calls to RowHidden(), IsVerOverlapped() and HasAttrib().
812  SCROW nFirstSameHiddenRow = -1;
813  SCROW nLastSameHiddenRow = -1;
814  bool bRowHidden = false;
815  SCROW nFirstSameIsVerOverlapped = -1;
816  SCROW nLastSameIsVerOverlapped = -1;
817  bool bIsVerOverlapped = false;
818  SCROW nFirstSameHasAttribRow = -1;
819  SCROW nLastSameHasAttribRow = -1;
820  bool bHasAttribProtected = false;
821  do
822  {
823  if( rCurY < nFirstSameHiddenRow || rCurY > nLastSameHiddenRow )
824  bRowHidden = rDoc.RowHidden(rCurY, nTab, &nFirstSameHiddenRow, &nLastSameHiddenRow);
825  bSkipCell = bRowHidden;
826  if( !bSkipCell )
827  {
828  if( rCurY < nFirstSameIsVerOverlapped || rCurY > nLastSameIsVerOverlapped )
829  bIsVerOverlapped = rDoc.IsVerOverlapped(rCurX, rCurY, nTab, &nFirstSameIsVerOverlapped, &nLastSameIsVerOverlapped);
830  bSkipCell = bIsVerOverlapped;
831  }
832  if (bSkipProtected && !bSkipCell)
833  {
834  if( rCurY < nFirstSameHasAttribRow || rCurY > nLastSameHasAttribRow )
835  bHasAttribProtected = rDoc.HasAttrib(rCurX, rCurY, nTab, HasAttrFlags::Protected,
836  &nFirstSameHasAttribRow, &nLastSameHasAttribRow);
837  bSkipCell = bHasAttribProtected;
838  }
839  if (bSkipUnprotected && !bSkipCell)
840  {
841  if( rCurY < nFirstSameHasAttribRow || rCurY > nLastSameHasAttribRow )
842  bHasAttribProtected = rDoc.HasAttrib(rCurX, rCurY, nTab, HasAttrFlags::Protected,
843  &nFirstSameHasAttribRow, &nLastSameHasAttribRow);
844  bSkipCell = !bHasAttribProtected;
845  }
846 
847  if (bSkipCell)
848  {
849  if (rCurY <= 0 || rCurY >= rDoc.MaxRow())
850  {
851  if (bVFlip)
852  {
853  rCurY = nOldY;
854  bSkipCell = false;
855  }
856  else
857  {
858  nMovY = -nMovY;
859  if (nMovY > 0)
860  ++rCurY;
861  else
862  --rCurY;
863  bVFlip = true;
864  }
865  }
866  else
867  if (nMovY > 0)
868  ++rCurY;
869  else
870  --rCurY;
871  }
872  }
873  while (bSkipCell);
874 
875  if (rDoc.IsHorOverlapped(rCurX, rCurY, nTab))
876  {
877  aViewData.SetOldCursor(rCurX, rCurY);
878  while (rDoc.IsHorOverlapped(rCurX, rCurY, nTab))
879  --rCurX;
880  }
881 }
882 
884 {
885  if (!nMovX && !nMovY)
886  // Nothing to do. Bail out.
887  return;
888 
889  ScTabViewShell* pViewShell = aViewData.GetViewShell();
890  bool bRefInputMode = pViewShell && pViewShell->IsRefInputMode();
891  if (bRefInputMode && !aViewData.IsRefMode())
892  // initialize formula reference mode if it hasn't already.
894 
895  ScDocument& rDoc = aViewData.GetDocument();
896 
897  if (aViewData.IsRefMode())
898  {
899  // formula reference mode
900 
901  SCCOL nNewX = aViewData.GetRefEndX();
902  SCROW nNewY = aViewData.GetRefEndY();
903  SCTAB nRefTab = aViewData.GetRefEndZ();
904 
905  bool bSelectLocked = true;
906  bool bSelectUnlocked = true;
907  const ScTableProtection* pTabProtection = rDoc.GetTabProtection(nRefTab);
908  if (pTabProtection && pTabProtection->isProtected())
909  {
910  bSelectLocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
911  bSelectUnlocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
912  }
913 
914  moveCursorByProtRule(nNewX, nNewY, nMovX, nMovY, nRefTab, &rDoc);
915  checkBoundary(&rDoc, nNewX, nNewY);
916 
917  if (nMovX)
918  {
919  SCCOL nTempX = nNewX;
920  while (rDoc.IsHorOverlapped(nTempX, nNewY, nRefTab))
921  {
922  if (nMovX > 0)
923  ++nTempX;
924  else
925  --nTempX;
926  if (!checkBoundary(&rDoc, nTempX, nNewY))
927  break;
928  }
929  if (isCellQualified(&rDoc, nTempX, nNewY, nRefTab, bSelectLocked, bSelectUnlocked))
930  nNewX = nTempX;
931  }
932 
933  if (nMovY)
934  {
935  SCROW nTempY = nNewY;
936  while (rDoc.IsVerOverlapped(nNewX, nTempY, nRefTab))
937  {
938  if (nMovY > 0)
939  ++nTempY;
940  else
941  --nTempY;
942  if (!checkBoundary(&rDoc, nNewX, nTempY))
943  break;
944  }
945  if (isCellQualified(&rDoc, nNewX, nTempY, nRefTab, bSelectLocked, bSelectUnlocked))
946  nNewY = nTempY;
947  }
948 
949  rDoc.SkipOverlapped(nNewX, nNewY, nRefTab);
950  UpdateRef(nNewX, nNewY, nRefTab);
951  SCCOL nTargetCol = nNewX;
952  SCROW nTargetRow = nNewY;
953  if (((aViewData.GetRefStartX() == 0) || (aViewData.GetRefStartY() == 0)) &&
954  ((nNewX != rDoc.MaxCol()) || (nNewY != rDoc.MaxRow())))
955  {
956  // Row selection
957  if ((aViewData.GetRefStartX() == 0) && (nNewX == rDoc.MaxCol()))
958  nTargetCol = aViewData.GetCurX();
959  // Column selection
960  if ((aViewData.GetRefStartY() == 0) && (nNewY == rDoc.MaxRow()))
961  nTargetRow = aViewData.GetCurY();
962  }
963  AlignToCursor(nTargetCol, nTargetRow, eMode);
964  }
965  else
966  {
967  // normal selection mode
968 
969  SCTAB nTab = aViewData.GetTabNo();
970  SCCOL nOrigX = aViewData.GetCurX();
971  SCROW nOrigY = aViewData.GetCurY();
972 
973  // Note that the origin position *never* moves during selection.
974 
975  if (!IsBlockMode())
976  InitBlockMode(nOrigX, nOrigY, nTab, true);
977 
978  moveCursorByProtRule(nBlockEndX, nBlockEndY, nMovX, nMovY, nTab, &rDoc);
979  checkBoundary(&rDoc, nBlockEndX, nBlockEndY);
980  moveCursorByMergedCell(nBlockEndX, nBlockEndY, nMovX, nMovY, nTab, &rDoc, aViewData);
981  checkBoundary(&rDoc, nBlockEndX, nBlockEndY);
982 
983  MarkCursor(nBlockEndX, nBlockEndY, nTab, false, false, true);
984 
985  // Check if the entire row(s) or column(s) are selected.
986  ScSplitPos eActive = aViewData.GetActivePart();
987  bool bRowSelected = (nBlockStartX == 0 && nBlockEndX == rDoc.MaxCol());
988  bool bColSelected = (nBlockStartY == 0 && nBlockEndY == rDoc.MaxRow());
989  SCCOL nAlignX = bRowSelected ? aViewData.GetPosX(WhichH(eActive)) : nBlockEndX;
990  SCROW nAlignY = bColSelected ? aViewData.GetPosY(WhichV(eActive)) : nBlockEndY;
991  AlignToCursor(nAlignX, nAlignY, eMode);
992 
994  }
995 }
996 
998 {
999  SCCOL nPageX;
1000  SCROW nPageY;
1001  GetPageMoveEndPosition(nMovX, nMovY, nPageX, nPageY);
1002  ExpandBlock(nPageX, nPageY, SC_FOLLOW_FIX);
1003 }
1004 
1006 {
1007  SCCOL nAreaX;
1008  SCROW nAreaY;
1010  GetAreaMoveEndPosition(nMovX, nMovY, SC_FOLLOW_JUMP, nAreaX, nAreaY, eMode);
1011  ExpandBlock(nAreaX, nAreaY, eMode);
1012 }
1013 
1015 {
1016  for (VclPtr<ScGridWindow> & pWin : pGridWin)
1017  if (pWin && pWin->IsVisible())
1018  pWin->UpdateCopySourceOverlay();
1019 }
1020 
1022 {
1023  for (VclPtr<ScGridWindow> & pWin : pGridWin)
1024  if ( pWin && pWin->IsVisible() )
1025  pWin->UpdateSelectionOverlay();
1026 }
1027 
1029 {
1030  for (VclPtr<ScGridWindow> & pWin : pGridWin)
1031  if ( pWin && pWin->IsVisible() )
1032  pWin->UpdateShrinkOverlay();
1033 }
1034 
1036 {
1037  for (VclPtr<ScGridWindow> & pWin : pGridWin)
1038  if ( pWin && pWin->IsVisible() )
1039  pWin->UpdateAllOverlays();
1040 }
1041 
1045 
1046 void ScTabView::PaintBlock( bool bReset )
1047 {
1048  ScMarkData& rMark = aViewData.GetMarkData();
1049  SCTAB nTab = aViewData.GetTabNo();
1050  bool bMulti = rMark.IsMultiMarked();
1051  if (!(rMark.IsMarked() || bMulti))
1052  return;
1053 
1054  ScRange aMarkRange;
1055  HideAllCursors();
1056  if (bMulti)
1057  {
1058  bool bFlag = rMark.GetMarkingFlag();
1059  rMark.SetMarking(false);
1060  rMark.MarkToMulti();
1061  aMarkRange = rMark.GetMultiMarkArea();
1062  rMark.MarkToSimple();
1063  rMark.SetMarking(bFlag);
1064  }
1065  else
1066  aMarkRange = rMark.GetMarkArea();
1067 
1068  nBlockStartX = aMarkRange.aStart.Col();
1069  nBlockStartY = aMarkRange.aStart.Row();
1070  nBlockStartZ = aMarkRange.aStart.Tab();
1071  nBlockEndX = aMarkRange.aEnd.Col();
1072  nBlockEndY = aMarkRange.aEnd.Row();
1073  nBlockEndZ = aMarkRange.aEnd.Tab();
1074 
1075  bool bDidReset = false;
1076 
1077  if ( nTab>=nBlockStartZ && nTab<=nBlockEndZ )
1078  {
1079  if ( bReset )
1080  {
1081  // Inverting when deleting only on active View
1082  if ( aViewData.IsActive() )
1083  {
1084  rMark.ResetMark();
1086  bDidReset = true;
1087  }
1088  }
1089  else
1091  }
1092 
1093  if ( bReset && !bDidReset )
1094  rMark.ResetMark();
1095 
1096  ShowAllCursors();
1097 }
1098 
1099 void ScTabView::SelectAll( bool bContinue )
1100 {
1101  ScDocument& rDoc = aViewData.GetDocument();
1102  ScMarkData& rMark = aViewData.GetMarkData();
1103  SCTAB nTab = aViewData.GetTabNo();
1104 
1105  if (rMark.IsMarked())
1106  {
1107  if ( rMark.GetMarkArea() == ScRange( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab ) )
1108  return;
1109  }
1110 
1111  DoneBlockMode( bContinue );
1112  InitBlockMode( 0,0,nTab );
1113  MarkCursor( rDoc.MaxCol(),rDoc.MaxRow(),nTab );
1114 
1115  SelectionChanged();
1116 }
1117 
1119 {
1120  ScDocument& rDoc = aViewData.GetDocument();
1121  ScMarkData& rMark = aViewData.GetMarkData();
1122  SCTAB nCount = rDoc.GetTableCount();
1123 
1124  if (nCount>1)
1125  {
1126  for (SCTAB i=0; i<nCount; i++)
1127  rMark.SelectTable( i, true );
1128 
1130  SfxBindings& rBind = aViewData.GetBindings();
1131  rBind.Invalidate( FID_FILL_TAB );
1132  rBind.Invalidate( FID_TAB_DESELECTALL );
1133  }
1134 }
1135 
1137 {
1138  ScDocument& rDoc = aViewData.GetDocument();
1139  ScMarkData& rMark = aViewData.GetMarkData();
1140  SCTAB nTab = aViewData.GetTabNo();
1141  SCTAB nCount = rDoc.GetTableCount();
1142 
1143  for (SCTAB i=0; i<nCount; i++)
1144  rMark.SelectTable( i, ( i == nTab ) );
1145 
1147  SfxBindings& rBind = aViewData.GetBindings();
1148  rBind.Invalidate( FID_FILL_TAB );
1149  rBind.Invalidate( FID_TAB_DESELECTALL );
1150 }
1151 
1152 static bool lcl_FitsInWindow( double fScaleX, double fScaleY, sal_uInt16 nZoom,
1153  tools::Long nWindowX, tools::Long nWindowY, const ScDocument* pDoc, SCTAB nTab,
1154  SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1155  SCCOL nFixPosX, SCROW nFixPosY )
1156 {
1157  double fZoomFactor = static_cast<double>(Fraction(nZoom,100));
1158  fScaleX *= fZoomFactor;
1159  fScaleY *= fZoomFactor;
1160 
1161  tools::Long nBlockX = 0;
1162  SCCOL nCol;
1163  for (nCol=0; nCol<nFixPosX; nCol++)
1164  {
1165  // for frozen panes, add both parts
1166  sal_uInt16 nColTwips = pDoc->GetColWidth( nCol, nTab );
1167  if (nColTwips)
1168  {
1169  nBlockX += static_cast<tools::Long>(nColTwips * fScaleX);
1170  if (nBlockX > nWindowX)
1171  return false;
1172  }
1173  }
1174  for (nCol=nStartCol; nCol<=nEndCol; nCol++)
1175  {
1176  sal_uInt16 nColTwips = pDoc->GetColWidth( nCol, nTab );
1177  if (nColTwips)
1178  {
1179  nBlockX += static_cast<tools::Long>(nColTwips * fScaleX);
1180  if (nBlockX > nWindowX)
1181  return false;
1182  }
1183  }
1184 
1185  tools::Long nBlockY = 0;
1186  for (SCROW nRow = 0; nRow <= nFixPosY-1; ++nRow)
1187  {
1188  if (pDoc->RowHidden(nRow, nTab))
1189  continue;
1190 
1191  // for frozen panes, add both parts
1192  sal_uInt16 nRowTwips = pDoc->GetRowHeight(nRow, nTab);
1193  if (nRowTwips)
1194  {
1195  nBlockY += static_cast<tools::Long>(nRowTwips * fScaleY);
1196  if (nBlockY > nWindowY)
1197  return false;
1198  }
1199  }
1200  for (SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow)
1201  {
1202  sal_uInt16 nRowTwips = pDoc->GetRowHeight(nRow, nTab);
1203  if (nRowTwips)
1204  {
1205  nBlockY += static_cast<tools::Long>(nRowTwips * fScaleY);
1206  if (nBlockY > nWindowY)
1207  return false;
1208  }
1209  }
1210 
1211  return true;
1212 }
1213 
1214 sal_uInt16 ScTabView::CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom )
1215 {
1216  sal_uInt16 nZoom = 100;
1217 
1218  switch ( eType )
1219  {
1220  case SvxZoomType::PERCENT: // rZoom is no particular percent value
1221  nZoom = nOldZoom;
1222  break;
1223 
1224  case SvxZoomType::OPTIMAL: // nZoom corresponds to the optimal size
1225  {
1226  ScMarkData& rMark = aViewData.GetMarkData();
1227  ScDocument& rDoc = aViewData.GetDocument();
1228 
1229  if (!rMark.IsMarked() && !rMark.IsMultiMarked())
1230  nZoom = 100; // nothing selected
1231  else
1232  {
1233  SCTAB nTab = aViewData.GetTabNo();
1234  ScRange aMarkRange;
1235  if ( aViewData.GetSimpleArea( aMarkRange ) != SC_MARK_SIMPLE )
1236  aMarkRange = rMark.GetMultiMarkArea();
1237 
1238  SCCOL nStartCol = aMarkRange.aStart.Col();
1239  SCROW nStartRow = aMarkRange.aStart.Row();
1240  SCTAB nStartTab = aMarkRange.aStart.Tab();
1241  SCCOL nEndCol = aMarkRange.aEnd.Col();
1242  SCROW nEndRow = aMarkRange.aEnd.Row();
1243  SCTAB nEndTab = aMarkRange.aEnd.Tab();
1244 
1245  if ( nTab < nStartTab && nTab > nEndTab )
1246  nTab = nStartTab;
1247 
1248  ScSplitPos eUsedPart = aViewData.GetActivePart();
1249 
1250  SCCOL nFixPosX = 0;
1251  SCROW nFixPosY = 0;
1253  {
1254  // use right part
1255  eUsedPart = (WhichV(eUsedPart)==SC_SPLIT_TOP) ? SC_SPLIT_TOPRIGHT : SC_SPLIT_BOTTOMRIGHT;
1256  nFixPosX = aViewData.GetFixPosX();
1257  if ( nStartCol < nFixPosX )
1258  nStartCol = nFixPosX;
1259  }
1261  {
1262  // use bottom part
1263  eUsedPart = (WhichH(eUsedPart)==SC_SPLIT_LEFT) ? SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT;
1264  nFixPosY = aViewData.GetFixPosY();
1265  if ( nStartRow < nFixPosY )
1266  nStartRow = nFixPosY;
1267  }
1268 
1269  if (pGridWin[eUsedPart])
1270  {
1271  // Because scale is rounded to pixels, the only reliable way to find
1272  // the right scale is to check if a zoom fits
1273 
1274  Size aWinSize = pGridWin[eUsedPart]->GetOutputSizePixel();
1275 
1276  // for frozen panes, use sum of both parts for calculation
1277 
1278  if ( nFixPosX != 0 )
1279  aWinSize.AdjustWidth(GetGridWidth( SC_SPLIT_LEFT ) );
1280  if ( nFixPosY != 0 )
1281  aWinSize.AdjustHeight(GetGridHeight( SC_SPLIT_TOP ) );
1282 
1283  ScDocShell* pDocSh = aViewData.GetDocShell();
1284  double nPPTX = ScGlobal::nScreenPPTX / pDocSh->GetOutputFactor();
1285  double nPPTY = ScGlobal::nScreenPPTY;
1286 
1287  sal_uInt16 nMin = MINZOOM;
1288  sal_uInt16 nMax = MAXZOOM;
1289  while ( nMax > nMin )
1290  {
1291  sal_uInt16 nTest = (nMin+nMax+1)/2;
1292  if ( lcl_FitsInWindow(
1293  nPPTX, nPPTY, nTest, aWinSize.Width(), aWinSize.Height(),
1294  &rDoc, nTab, nStartCol, nStartRow, nEndCol, nEndRow,
1295  nFixPosX, nFixPosY ) )
1296  nMin = nTest;
1297  else
1298  nMax = nTest-1;
1299  }
1300  OSL_ENSURE( nMin == nMax, "Nesting is wrong" );
1301  nZoom = nMin;
1302 
1303  if ( nZoom != nOldZoom )
1304  {
1305  // scroll to block only in active split part
1306  // (the part for which the size was calculated)
1307 
1308  if ( nStartCol <= nEndCol )
1309  aViewData.SetPosX( WhichH(eUsedPart), nStartCol );
1310  if ( nStartRow <= nEndRow )
1311  aViewData.SetPosY( WhichV(eUsedPart), nStartRow );
1312  }
1313  }
1314  }
1315  }
1316  break;
1317 
1318  case SvxZoomType::WHOLEPAGE: // nZoom corresponds to the whole page or
1319  case SvxZoomType::PAGEWIDTH: // nZoom corresponds to the page width
1320  {
1321  SCTAB nCurTab = aViewData.GetTabNo();
1322  ScDocument& rDoc = aViewData.GetDocument();
1323  ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
1324  SfxStyleSheetBase* pStyleSheet =
1325  pStylePool->Find( rDoc.GetPageStyle( nCurTab ),
1326  SfxStyleFamily::Page );
1327 
1328  OSL_ENSURE( pStyleSheet, "PageStyle not found :-/" );
1329 
1330  if ( pStyleSheet )
1331  {
1332  ScPrintFunc aPrintFunc( aViewData.GetDocShell(),
1334  nCurTab );
1335 
1336  Size aPageSize = aPrintFunc.GetDataSize();
1337 
1338  // use the size of the largest GridWin for normal split,
1339  // or both combined for frozen panes, with the (document) size
1340  // of the frozen part added to the page size
1341  // (with frozen panes, the size of the individual parts
1342  // depends on the scale that is to be calculated)
1343 
1345  return nZoom;
1346 
1347  Size aWinSize = pGridWin[SC_SPLIT_BOTTOMLEFT]->GetOutputSizePixel();
1348  ScSplitMode eHMode = aViewData.GetHSplitMode();
1349  if ( eHMode != SC_SPLIT_NONE && pGridWin[SC_SPLIT_BOTTOMRIGHT] )
1350  {
1351  tools::Long nOtherWidth = pGridWin[SC_SPLIT_BOTTOMRIGHT]->
1352  GetOutputSizePixel().Width();
1353  if ( eHMode == SC_SPLIT_FIX )
1354  {
1355  aWinSize.AdjustWidth(nOtherWidth );
1356  for ( SCCOL nCol = aViewData.GetPosX(SC_SPLIT_LEFT);
1357  nCol < aViewData.GetFixPosX(); nCol++ )
1358  aPageSize.AdjustWidth(rDoc.GetColWidth( nCol, nCurTab ) );
1359  }
1360  else if ( nOtherWidth > aWinSize.Width() )
1361  aWinSize.setWidth( nOtherWidth );
1362  }
1363  ScSplitMode eVMode = aViewData.GetVSplitMode();
1364  if ( eVMode != SC_SPLIT_NONE && pGridWin[SC_SPLIT_TOPLEFT] )
1365  {
1366  tools::Long nOtherHeight = pGridWin[SC_SPLIT_TOPLEFT]->
1367  GetOutputSizePixel().Height();
1368  if ( eVMode == SC_SPLIT_FIX )
1369  {
1370  aWinSize.AdjustHeight(nOtherHeight );
1371  aPageSize.AdjustHeight(rDoc.GetRowHeight(
1373  aViewData.GetFixPosY()-1, nCurTab) );
1374  }
1375  else if ( nOtherHeight > aWinSize.Height() )
1376  aWinSize.setHeight( nOtherHeight );
1377  }
1378 
1380  double nPPTY = ScGlobal::nScreenPPTY;
1381 
1382  tools::Long nZoomX = static_cast<tools::Long>( aWinSize.Width() * 100 /
1383  ( aPageSize.Width() * nPPTX ) );
1384  tools::Long nZoomY = static_cast<tools::Long>( aWinSize.Height() * 100 /
1385  ( aPageSize.Height() * nPPTY ) );
1386 
1387  if (nZoomX > 0)
1388  nZoom = static_cast<sal_uInt16>(nZoomX);
1389 
1390  if (eType == SvxZoomType::WHOLEPAGE && nZoomY > 0 && nZoomY < nZoom)
1391  nZoom = static_cast<sal_uInt16>(nZoomY);
1392  }
1393  }
1394  break;
1395 
1396  default:
1397  OSL_FAIL("Unknown Zoom-Revision");
1398  }
1399 
1400  return nZoom;
1401 }
1402 
1403 // is called for instance when the view window is shifted:
1404 
1406 {
1407  ScSplitPos eActive = aViewData.GetActivePart();
1408  if (pGridWin[eActive])
1409  pGridWin[eActive]->StopMarking();
1410 
1411  ScHSplitPos eH = WhichH(eActive);
1412  if (pColBar[eH])
1413  pColBar[eH]->StopMarking();
1414 
1415  ScVSplitPos eV = WhichV(eActive);
1416  if (pRowBar[eV])
1417  pRowBar[eV]->StopMarking();
1418 }
1419 
1421 {
1422  for (VclPtr<ScGridWindow> & pWin : pGridWin)
1423  if (pWin && pWin->IsVisible())
1424  pWin->HideNoteMarker();
1425 }
1426 
1428 {
1429  if (pDrawView)
1430  return;
1431 
1433 
1434  // pDrawView is set per Notify
1435  OSL_ENSURE(pDrawView,"ScTabView::MakeDrawLayer does not work");
1436 
1437  for(VclPtr<ScGridWindow> & pWin : pGridWin)
1438  {
1439  if(pWin)
1440  {
1441  pWin->DrawLayerCreated();
1442  }
1443  }
1444 }
1445 
1447 {
1448  if ( SC_MOD()->IsInExecuteDrop() )
1449  {
1450  // #i28468# don't show error message when called from Drag&Drop, silently abort instead
1451  return;
1452  }
1453 
1454  StopMarking(); // if called by Focus from MouseButtonDown
1455 
1456  weld::Window* pParent = aViewData.GetDialogParent();
1457  weld::WaitObject aWaitOff( pParent );
1458  bool bFocus = pParent && pParent->has_focus();
1459 
1460  if (pGlobStrId && pGlobStrId == STR_PROTECTIONERR)
1461  {
1462  if (aViewData.GetDocShell()->IsReadOnly())
1463  {
1464  pGlobStrId = STR_READONLYERR;
1465  }
1466  }
1467 
1469  VclMessageType::Info, VclButtonsType::Ok,
1470  ScResId(pGlobStrId)));
1471  weld::Window* pGrabOnClose = bFocus ? pParent : nullptr;
1472  m_xMessageBox->runAsync(m_xMessageBox, [this, pGrabOnClose](sal_Int32 /*nResult*/) {
1473  m_xMessageBox.reset();
1474  if (pGrabOnClose)
1475  pGrabOnClose->grab_focus();
1476  });
1477 }
1478 
1479 void ScTabView::UpdatePageBreakData( bool bForcePaint )
1480 {
1481  std::unique_ptr<ScPageBreakData> pNewData;
1482 
1483  if (aViewData.IsPagebreakMode())
1484  {
1485  ScDocShell* pDocSh = aViewData.GetDocShell();
1486  ScDocument& rDoc = pDocSh->GetDocument();
1487  SCTAB nTab = aViewData.GetTabNo();
1488 
1489  sal_uInt16 nCount = rDoc.GetPrintRangeCount(nTab);
1490  if (!nCount)
1491  nCount = 1;
1492  pNewData.reset( new ScPageBreakData(nCount) );
1493 
1494  ScPrintFunc aPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab, 0,0,nullptr, nullptr, pNewData.get() );
1495  // ScPrintFunc fills the PageBreakData in ctor
1496  if ( nCount > 1 )
1497  {
1498  aPrintFunc.ResetBreaks(nTab);
1499  pNewData->AddPages();
1500  }
1501 
1502  // print area changed?
1503  if ( bForcePaint || ( pPageBreakData && !( *pPageBreakData == *pNewData ) ) )
1504  PaintGrid();
1505  }
1506 
1507  pPageBreakData = std::move(pNewData);
1508 }
1509 
1510 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define MAXZOOM
Definition: global.hxx:79
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3135
constexpr double nPPTY
SCCOL GetColMerge() const
Definition: attrib.hxx:68
void InitRefMode(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScRefType eType)
Definition: tabview4.cxx:309
void SelectAll(bool bContinue=false)
Definition: tabview2.cxx:1099
void MarkToSimple()
Definition: markdata.cxx:222
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:354
ScAddress aStart
Definition: address.hxx:497
static bool lcl_FitsInWindow(double fScaleX, double fScaleY, sal_uInt16 nZoom, tools::Long nWindowX, tools::Long nWindowY, const ScDocument *pDoc, SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCCOL nFixPosX, SCROW nFixPosY)
Definition: tabview2.cxx:1152
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:42
std::array< VclPtr< ScRowBar >, 2 > pRowBar
Definition: tabview.hxx:144
SfxPrinter * GetPrinter(bool bCreateIfNotExist=true)
Definition: docsh3.cxx:451
SCROW GetRefEndY() const
Definition: viewdata.hxx:536
bool bBlockCols
Definition: tabview.hxx:214
ScVSplitPos WhichV(ScSplitPos ePos)
Definition: viewdata.hxx:728
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
void ErrorMessage(TranslateId pGlobStrId)
Definition: tabview2.cxx:1446
void InitOwnBlockMode(const ScRange &rMarkRange)
Definition: tabview2.cxx:332
SCROW Row() const
Definition: address.hxx:274
ScVSplitPos
Definition: viewdata.hxx:46
void setWidth(tools::Long nWidth)
void MarkToMulti()
Definition: markdata.cxx:209
sheet protection state container
bool bBlockRows
Definition: tabview.hxx:215
void ResetMark()
Definition: markdata.cxx:80
void SelectAllTables()
Definition: tabview2.cxx:1118
SCROW GetRefStartY() const
Definition: viewdata.hxx:533
long Long
void HideNoteMarker()
Definition: tabview2.cxx:1420
SCROW GetCurY() const
Definition: viewdata.hxx:402
ScHSplitPos WhichH(ScSplitPos ePos)
Definition: viewdata.hxx:722
void ResetBreaks(SCTAB nTab)
Definition: printfun.cxx:3002
SCTAB nBlockEndZ
Definition: tabview.hxx:193
double GetOutputFactor() const
Definition: docsh.hxx:358
ScFollowMode
Screen behavior related to cursor movements.
Definition: viewdata.hxx:52
double GetPPTX() const
Definition: viewdata.hxx:468
void PostPaintExtras()
Definition: docsh3.cxx:198
SCROW GetFixPosY() const
Definition: viewdata.hxx:421
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
void PaintGrid()
Definition: tabview3.cxx:2633
tools::Long GetGridWidth(ScHSplitPos eWhich)
Definition: tabview3.cxx:2994
ScAddress aEnd
Definition: address.hxx:498
ScSplitPos GetActivePart() const
Definition: viewdata.hxx:398
std::shared_ptr< weld::MessageDialog > m_xMessageBox
Definition: tabview.hxx:140
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
void UpdateAllOverlays()
Definition: tabview2.cxx:1035
bool IsHorOverlapped(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:5824
void Invalidate(sal_uInt16 nId)
void CursorPosChanging(bool bShift, bool bMod1)
SCCOL GetPosX(ScHSplitPos eWhich, SCTAB nForTab=-1) const
Definition: viewdata.cxx:1402
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
Definition: document.cxx:5265
SCCOL CellsAtX(SCCOL nPosX, SCCOL nDir, ScHSplitPos eWhichX, sal_uInt16 nScrSizeY=SC_SIZE_NONE) const
Definition: viewdata.cxx:2623
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4212
ScSplitPos
Definition: viewdata.hxx:44
const ScRange & GetMarkArea() const
Definition: markdata.hxx:83
bool IsCellMarked(SCCOL nCol, SCROW nRow, bool bNoSimple=false) const
Definition: markdata.cxx:270
SCCOL nBlockStartXOrig
Definition: tabview.hxx:185
void DeselectAllTables()
Definition: tabview2.cxx:1136
constexpr tools::Long Width() const
void UpdateCopySourceOverlay()
Definition: tabview2.cxx:1014
tools::Long GetGridHeight(ScVSplitPos eWhich)
Definition: tabview3.cxx:3016
BlockMode meBlockMode
Definition: tabview.hxx:182
static tools::Long ToPixel(sal_uInt16 nTwips, double nFactor)
Definition: viewdata.hxx:700
bool isOptionEnabled(Option eOption) const
void PaintLeftArea(SCROW nStartRow, SCROW nEndRow)
Definition: tabview3.cxx:2722
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:894
std::array< VclPtr< ScGridWindow >, 4 > pGridWin
Definition: tabview.hxx:142
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:316
void SetPosX(ScHSplitPos eWhich, SCCOL nNewPosX)
Definition: viewdata.cxx:2903
bool IsMultiMarked() const
Definition: markdata.hxx:81
SCROW nOldCurY
Definition: tabview.hxx:196
int nCount
void PaintBlock(bool bReset)
divide PaintBlock into two methods: RepaintBlock and RemoveBlock or similar
Definition: tabview2.cxx:1046
void UpdateShrinkOverlay()
Definition: tabview2.cxx:1028
SC_DLLPUBLIC bool HasTable(SCTAB nTab) const
Definition: document.cxx:193
Mode eMode
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
Definition: tabvwsha.cxx:656
SCTAB Tab() const
Definition: address.hxx:283
void DoneBlockMode(bool bContinue=false)
Definition: tabview2.cxx:409
SCROW GetPosY(ScVSplitPos eWhich, SCTAB nForTab=-1) const
Definition: viewdata.cxx:1416
ScSplitMode GetHSplitMode() const
Definition: viewdata.hxx:416
bool IsBlockMode() const
Definition: tabview2.cxx:444
void SkipCursorVertical(SCCOL &rCurX, SCROW &rCurY, SCROW nOldY, SCROW nMovY)
Definition: tabview2.cxx:796
ScDrawLayer * MakeDrawLayer()
Definition: docsh2.cxx:169
SCCOL nBlockEndX
Definition: tabview.hxx:186
void SelectionChanged(bool bFromPaste=false)
Definition: tabview3.cxx:532
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
Definition: document.cxx:4765
SC_DLLPUBLIC SCCOL GetAllocatedColumnsCount(SCTAB nTab) const
Definition: documen3.cxx:2149
bool IsRowMarked(SCROW nRow) const
Definition: markdata.cxx:303
void PaintArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScUpdateMode eMode=ScUpdateMode::All)
Definition: tabview3.cxx:2308
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:357
constexpr double nPPTX
std::unique_ptr< ScPageBreakData > pPageBreakData
Definition: tabview.hxx:162
void ExpandBlock(SCCOL nMovX, SCROW nMovY, ScFollowMode eMode)
Definition: tabview2.cxx:883
void SetMarkArea(const ScRange &rRange)
Definition: markdata.cxx:92
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:893
SCROW nBlockStartYOrig
Definition: tabview.hxx:189
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: document.cxx:4496
SC_DLLPUBLIC sal_uInt16 GetPrintRangeCount(SCTAB nTab)
Definition: document.cxx:6374
bool IsMarked() const
Definition: markdata.hxx:80
SCTAB GetRefEndZ() const
Definition: viewdata.hxx:537
int i
bool IsColumnMarked(SCCOL nCol) const
Definition: markdata.cxx:287
SCTAB nBlockStartZ
Definition: tabview.hxx:192
void SelectTable(SCTAB nTab, bool bNew)
Definition: markdata.cxx:157
SfxBindings & GetBindings()
Definition: viewdata.cxx:3123
sal_Int16 SCCOL
Definition: types.hxx:21
bool ValidCol(SCCOL nCol) const
Definition: document.hxx:900
bool GetLegacyCellSelection() const
Definition: inputopt.hxx:67
static SC_DLLPUBLIC double nScreenPPTY
Vertical pixel per twips factor.
Definition: global.hxx:576
virtual bool has_focus() const =0
#define SC_MOD()
Definition: scmod.hxx:249
void ExpandBlockArea(SCCOL nMovX, SCROW nMovY)
Definition: tabview2.cxx:1005
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
Definition: viewdata.cxx:1181
bool IsActive() const
Definition: viewdata.hxx:382
SC_DLLPUBLIC OUString GetPageStyle(SCTAB nTab) const
Definition: document.cxx:6289
#define SC_SIZE_NONE
Definition: viewdata.hxx:31
SCCOL nBlockStartX
Definition: tabview.hxx:184
sal_uInt16 CalcZoom(SvxZoomType eType, sal_uInt16 nOldZoom)
Definition: tabview2.cxx:1214
weld::Window * GetDialogParent()
Definition: viewdata.cxx:3145
SCCOL GetRefEndX() const
Definition: viewdata.hxx:535
void UpdateSelectionOverlay()
Definition: tabview2.cxx:1021
SC_DLLPUBLIC bool ExtendMerge(SCCOL nStartCol, SCROW nStartRow, SCCOL &rEndCol, SCROW &rEndRow, SCTAB nTab, bool bRefresh=false)
Definition: document.cxx:5663
bool IsMarkNegative() const
Definition: markdata.hxx:101
virtual bool isProtected() const override
SCCOL Col() const
Definition: address.hxx:279
bool IsReadOnly() const
void SetAnchorFlag(bool bSet)
Definition: select.hxx:99
SCCOL GetRefStartX() const
Definition: viewdata.hxx:532
bool IsVerOverlapped(SCCOL nCol, SCROW nRow, SCTAB nTab, SCROW *nStartRow=nullptr, SCROW *nEndRow=nullptr) const
Definition: document.cxx:5836
bool IsMerged() const
Definition: attrib.hxx:71
SCCOL GetFixPosX() const
Definition: viewdata.hxx:420
tools::Long GetPageUpDownOffset() const
Definition: viewdata.hxx:570
void PaintMarks(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow)
Definition: tabview2.cxx:303
ScHSplitPos
Definition: viewdata.hxx:45
void SkipOverlapped(SCCOL &rCol, SCROW &rRow, SCTAB nTab) const
Definition: document.cxx:5816
sal_Int32 SCROW
Definition: types.hxx:17
void MakeDrawLayer()
Definition: tabview2.cxx:1427
bool ValidRow(SCROW nRow) const
Definition: document.hxx:901
void HideAllCursors()
Definition: tabview3.cxx:220
constexpr tools::Long Height() const
void FindAreaPos(SCCOL &rCol, SCROW &rRow, SCTAB nTab, ScMoveDirection eDirection) const
Definition: document.cxx:6191
virtual void grab_focus()=0
ScHeaderFunctionSet aHdrFunc
Definition: tabview.hxx:128
void StopMarking()
Definition: tabview2.cxx:1405
tools::Long AdjustWidth(tools::Long n)
bool bBlockNeg
Definition: tabview.hxx:213
bool GetMarkingFlag() const
Definition: markdata.hxx:103
void SetPosY(ScVSplitPos eWhich, SCROW nNewPosY)
Definition: viewdata.cxx:2942
SC_DLLPUBLIC const ScInputOptions & GetInputOptions()
Definition: scmod.cxx:822
static SC_DLLPUBLIC double nScreenPPTX
Horizontal pixel per twips factor.
Definition: global.hxx:574
const ScDocument & GetDocument() const
Definition: docsh.hxx:220
void GetPageMoveEndPosition(SCCOL nMovX, SCROW nMovY, SCCOL &rPageX, SCROW &rPageY)
Definition: tabview2.cxx:599
void GetAreaMoveEndPosition(SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, SCCOL &rAreaX, SCROW &rAreaY, ScFollowMode &rMode)
Definition: tabview2.cxx:649
ScViewSelectionEngine * GetSelEngine()
Definition: tabview.hxx:337
tools::Long AdjustHeight(tools::Long n)
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6162
std::array< VclPtr< ScColBar >, 2 > pColBar
Definition: tabview.hxx:143
void AlignToCursor(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, const ScSplitPos *pWhich=nullptr)
Definition: tabview3.cxx:920
void SetMarking(bool bFlag)
Definition: markdata.hxx:102
void SetMarkNegative(bool bFlag)
Definition: markdata.hxx:100
ScSplitMode
Definition: viewdata.hxx:42
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4480
void setHeight(tools::Long nHeight)
SCCOL nOldCurX
Definition: tabview.hxx:195
SCROW CellsAtY(SCROW nPosY, SCROW nDir, ScVSplitPos eWhichY, sal_uInt16 nScrSizeX=SC_SIZE_NONE) const
Definition: viewdata.cxx:2665
void SetOldCursor(SCCOL nNewX, SCROW nNewY)
Definition: viewdata.cxx:1390
#define MINZOOM
Definition: global.hxx:78
void SkipCursorHorizontal(SCCOL &rCurX, SCROW &rCurY, SCCOL nOldX, SCCOL nMovX)
Definition: tabview2.cxx:727
bool IsRefInputMode() const
Definition: tabvwsha.cxx:606
SCROW GetRowMerge() const
Definition: attrib.hxx:69
ScViewData aViewData
Definition: tabview.hxx:122
virtual SfxPrinter * GetPrinter(bool bCreate=false) override
Definition: tabvwsh4.cxx:1080
SvxZoomType
void UpdateRef(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ)
Definition: tabview4.cxx:186
std::unique_ptr< ScDrawView > pDrawView
Definition: tabview.hxx:130
void PaintTopArea(SCCOL nStartCol, SCCOL nEndCol)
Definition: tabview3.cxx:2664
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4171
bool IsPagebreakMode() const
Definition: viewdata.hxx:425
void MarkCursor(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, bool bCols=false, bool bRows=false, bool bCellSelection=false)
Definition: tabview2.cxx:449
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
SCROW nBlockStartY
Definition: tabview.hxx:188
void ExpandBlockPage(SCCOL nMovX, SCROW nMovY)
Definition: tabview2.cxx:997
bool IsRefMode() const
Definition: viewdata.hxx:530
const ScRange & GetMultiMarkArea() const
Definition: markdata.hxx:84
void UpdatePageBreakData(bool bForcePaint=false)
Definition: tabview2.cxx:1479
SCROW nBlockEndY
Definition: tabview.hxx:190
bool bMoveIsShift
Definition: tabview.hxx:209
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
ScSplitMode GetVSplitMode() const
Definition: viewdata.hxx:417
void InitBlockMode(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, bool bTestNeg=false, bool bCols=false, bool bRows=false, bool bForceNeg=false)
Definition: tabview2.cxx:353
bool IsMarking(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: tabview2.cxx:324
sal_Int16 SCTAB
Definition: types.hxx:22
void ShowAllCursors()
Definition: tabview3.cxx:234
SCCOL GetCurX() const
Definition: viewdata.hxx:401
SC_DLLPUBLIC const ScTableProtection * GetTabProtection(SCTAB nTab) const
Definition: documen3.cxx:1922