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 
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 = 0;
344  nBlockStartY = 0;
345  nBlockStartZ = 0;
346  nBlockEndX = 0;
347  nBlockEndY = 0;
348  nBlockEndZ = 0;
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  ScRange aMarkRange;
470  rMark.GetMarkArea(aMarkRange);
471  if (( aMarkRange.aStart.Col() != nBlockStartX && aMarkRange.aEnd.Col() != nBlockStartX ) ||
472  ( aMarkRange.aStart.Row() != nBlockStartY && aMarkRange.aEnd.Row() != nBlockStartY ) ||
473  ( meBlockMode == Own ))
474  {
475  // Mark has been changed
476  // (Eg MarkToSimple if by negative everything was erased, except for a rectangle)
477  // or after InitOwnBlockMode is further marked with shift-
478  bool bOldShift = bMoveIsShift;
479  bMoveIsShift = false; // really move
480  DoneBlockMode();
481  bMoveIsShift = bOldShift;
482 
483  InitBlockMode( aMarkRange.aStart.Col(), aMarkRange.aStart.Row(),
484  nBlockStartZ, rMark.IsMarkNegative(), bCols, bRows );
485  }
486 
487  if ( nCurX != nOldCurX || nCurY != nOldCurY )
488  {
489  // Current cursor has moved
490 
491  SCTAB nTab = nCurZ;
492 
493  if ( bCellSelection )
494  {
495  // Expand selection area accordingly when the current selection ends
496  // with a merged cell.
497  SCCOL nCurXOffset = 0;
498  SCCOL nBlockStartXOffset = 0;
499  SCROW nCurYOffset = 0;
500  SCROW nBlockStartYOffset = 0;
501  bool bBlockStartMerged = false;
502 
503  // The following block checks whether or not the "BlockStart" (anchor)
504  // cell is merged. If it's merged, it'll then move the position of the
505  // anchor cell to the corner that's diagonally opposite of the
506  // direction of a current selection area. For instance, if a current
507  // selection is moving in the upperleft direction, the anchor cell will
508  // move to the lower-right corner of the merged anchor cell, and so on.
509 
510  const ScMergeAttr* pMergeAttr =
512  if ( pMergeAttr->IsMerged() )
513  {
514  SCCOL nColSpan = pMergeAttr->GetColMerge();
515  SCROW nRowSpan = pMergeAttr->GetRowMerge();
516 
517  if ( nCurX < nBlockStartXOrig + nColSpan - 1 || nCurY < nBlockStartYOrig + nRowSpan - 1 )
518  {
519  nBlockStartX = nCurX >= nBlockStartXOrig ? nBlockStartXOrig : nBlockStartXOrig + nColSpan - 1;
520  nBlockStartY = nCurY >= nBlockStartYOrig ? nBlockStartYOrig : nBlockStartYOrig + nRowSpan - 1;
521  nCurXOffset = (nCurX >= nBlockStartXOrig && nCurX < nBlockStartXOrig + nColSpan - 1) ?
522  nBlockStartXOrig - nCurX + nColSpan - 1 : 0;
523  nCurYOffset = (nCurY >= nBlockStartYOrig && nCurY < nBlockStartYOrig + nRowSpan - 1) ?
524  nBlockStartYOrig - nCurY + nRowSpan - 1 : 0;
525  bBlockStartMerged = true;
526  }
527  }
528 
529  // The following block checks whether or not the current cell is
530  // merged. If it is, it'll then set the appropriate X & Y offset
531  // values (nCurXOffset & nCurYOffset) such that the selection area will
532  // grow by those specified offset amounts. Note that the values of
533  // nCurXOffset/nCurYOffset may also be specified in the previous code
534  // block, in which case whichever value is greater will take on.
535 
536  pMergeAttr = rDocument.GetAttr( nCurX, nCurY, nTab, ATTR_MERGE );
537  if ( pMergeAttr->IsMerged() )
538  {
539  SCCOL nColSpan = pMergeAttr->GetColMerge();
540  SCROW nRowSpan = pMergeAttr->GetRowMerge();
541 
542  if ( nBlockStartX < nCurX + nColSpan - 1 || nBlockStartY < nCurY + nRowSpan - 1 )
543  {
544  if ( nBlockStartX <= nCurX + nColSpan - 1 )
545  {
546  SCCOL nCurXOffsetTemp = (nCurX < nCurX + nColSpan - 1) ? nColSpan - 1 : 0;
547  nCurXOffset = std::max(nCurXOffset, nCurXOffsetTemp);
548  }
549  if ( nBlockStartY <= nCurY + nRowSpan - 1 )
550  {
551  SCROW nCurYOffsetTemp = (nCurY < nCurY + nRowSpan - 1) ? nRowSpan - 1 : 0;
552  nCurYOffset = std::max(nCurYOffset, nCurYOffsetTemp);
553  }
554  if ( ( nBlockStartX > nCurX || nBlockStartY > nCurY ) &&
555  ( nBlockStartX <= nCurX + nColSpan - 1 || nBlockStartY <= nCurY + nRowSpan - 1 ) )
556  {
557  nBlockStartXOffset = (nBlockStartX > nCurX && nBlockStartX <= nCurX + nColSpan - 1) ? nCurX - nBlockStartX : 0;
558  nBlockStartYOffset = (nBlockStartY > nCurY && nBlockStartY <= nCurY + nRowSpan - 1) ? nCurY - nBlockStartY : 0;
559  }
560  }
561  }
562  else
563  {
564  // The current cell is not merged. Move the anchor cell to its
565  // original position.
566  if ( !bBlockStartMerged )
567  {
570  }
571  }
572 
573  nBlockStartX = nBlockStartX + nBlockStartXOffset >= 0 ? nBlockStartX + nBlockStartXOffset : 0;
574  nBlockStartY = nBlockStartY + nBlockStartYOffset >= 0 ? nBlockStartY + nBlockStartYOffset : 0;
575  nBlockEndX = std::min<SCCOL>(nCurX + nCurXOffset, rDocument.MaxCol());
576  nBlockEndY = std::min(nCurY + nCurYOffset, rDocument.MaxRow());
577  }
578  else
579  {
580  nBlockEndX = nCurX;
581  nBlockEndY = nCurY;
582  }
583 
584  // Set new selection area
586 
589 
590  nOldCurX = nCurX;
591  nOldCurY = nCurY;
592 
594  }
595 
596  if ( !bCols && !bRows )
597  aHdrFunc.SetAnchorFlag( false );
598 }
599 
600 void ScTabView::GetPageMoveEndPosition(SCCOL nMovX, SCROW nMovY, SCCOL& rPageX, SCROW& rPageY)
601 {
602  SCCOL nCurX;
603  SCROW nCurY;
604  if (aViewData.IsRefMode())
605  {
606  nCurX = aViewData.GetRefEndX();
607  nCurY = aViewData.GetRefEndY();
608  }
609  else if (IsBlockMode())
610  {
611  // block end position.
612  nCurX = nBlockEndX;
613  nCurY = nBlockEndY;
614  }
615  else
616  {
617  // cursor position
618  nCurX = aViewData.GetCurX();
619  nCurY = aViewData.GetCurY();
620  }
621 
623  ScHSplitPos eWhichX = WhichH( eWhich );
624  ScVSplitPos eWhichY = WhichV( eWhich );
625 
626  sal_uInt16 nScrSizeY = SC_SIZE_NONE;
629  }
630 
631  SCCOL nPageX;
632  SCROW nPageY;
633  if (nMovX >= 0)
634  nPageX = aViewData.CellsAtX( nCurX, 1, eWhichX ) * nMovX;
635  else
636  nPageX = aViewData.CellsAtX( nCurX, -1, eWhichX ) * nMovX;
637 
638  if (nMovY >= 0)
639  nPageY = aViewData.CellsAtY( nCurY, 1, eWhichY, nScrSizeY ) * nMovY;
640  else
641  nPageY = aViewData.CellsAtY( nCurY, -1, eWhichY, nScrSizeY ) * nMovY;
642 
643  if (nMovX != 0 && nPageX == 0) nPageX = (nMovX>0) ? 1 : -1;
644  if (nMovY != 0 && nPageY == 0) nPageY = (nMovY>0) ? 1 : -1;
645 
646  rPageX = nPageX;
647  rPageY = nPageY;
648 }
649 
651  SCCOL& rAreaX, SCROW& rAreaY, ScFollowMode& rMode)
652 {
653  SCCOL nNewX = -1;
654  SCROW nNewY = -1;
655 
656  // current cursor position.
657  SCCOL nCurX = aViewData.GetCurX();
658  SCROW nCurY = aViewData.GetCurY();
659 
660  if (aViewData.IsRefMode())
661  {
662  nNewX = aViewData.GetRefEndX();
663  nNewY = aViewData.GetRefEndY();
664  nCurX = aViewData.GetRefStartX();
665  nCurY = aViewData.GetRefStartY();
666  }
667  else if (IsBlockMode())
668  {
669  // block end position.
670  nNewX = nBlockEndX;
671  nNewY = nBlockEndY;
672  }
673  else
674  {
675  nNewX = nCurX;
676  nNewY = nCurY;
677  }
678 
679  ScDocument& rDoc = aViewData.GetDocument();
680  SCTAB nTab = aViewData.GetTabNo();
681 
682  // FindAreaPos knows only -1 or 1 as direction
683  ScModule* pScModule = SC_MOD();
684  bool bLegacyCellSelection = pScModule->GetInputOptions().GetLegacyCellSelection();
685  SCCOL nVirtualX = bLegacyCellSelection ? nNewX : nCurX;
686  SCROW nVirtualY = bLegacyCellSelection ? nNewY : nCurY;
687 
688  SCCOLROW i;
689  if ( nMovX > 0 )
690  for ( i=0; i<nMovX; i++ )
691  rDoc.FindAreaPos( nNewX, nVirtualY, nTab, SC_MOVE_RIGHT );
692  if ( nMovX < 0 )
693  for ( i=0; i<-nMovX; i++ )
694  rDoc.FindAreaPos( nNewX, nVirtualY, nTab, SC_MOVE_LEFT );
695  if ( nMovY > 0 )
696  for ( i=0; i<nMovY; i++ )
697  rDoc.FindAreaPos( nVirtualX, nNewY, nTab, SC_MOVE_DOWN );
698  if ( nMovY < 0 )
699  for ( i=0; i<-nMovY; i++ )
700  rDoc.FindAreaPos( nVirtualX, nNewY, nTab, SC_MOVE_UP );
701 
702  if (eMode==SC_FOLLOW_JUMP) // bottom right do not show too much grey
703  {
704  if (nMovX != 0 && nNewX == rDoc.MaxCol())
705  eMode = SC_FOLLOW_LINE;
706  if (nMovY != 0 && nNewY == rDoc.MaxRow())
707  eMode = SC_FOLLOW_LINE;
708  }
709 
710  if (aViewData.IsRefMode())
711  {
712  rAreaX = nNewX - aViewData.GetRefEndX();
713  rAreaY = nNewY - aViewData.GetRefEndY();
714  }
715  else if (IsBlockMode())
716  {
717  rAreaX = nNewX - nBlockEndX;
718  rAreaY = nNewY - nBlockEndY;
719  }
720  else
721  {
722  rAreaX = nNewX - nCurX;
723  rAreaY = nNewY - nCurY;
724  }
725  rMode = eMode;
726 }
727 
728 void ScTabView::SkipCursorHorizontal(SCCOL& rCurX, SCROW& rCurY, SCCOL nOldX, SCCOL nMovX)
729 {
730  ScDocument& rDoc = aViewData.GetDocument();
731  SCTAB nTab = aViewData.GetTabNo();
732 
733  bool bSkipProtected = false, bSkipUnprotected = false;
734  const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
735  if (pProtect && pProtect->isProtected())
736  {
737  bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
738  bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
739  }
740 
741  bool bSkipCell = false;
742  bool bHFlip = false;
743  auto nMaxCol = rDoc.ClampToAllocatedColumns(nTab, rDoc.MaxCol());
744  do
745  {
746  bSkipCell = rDoc.ColHidden(rCurX, nTab) || rDoc.IsHorOverlapped(rCurX, rCurY, nTab);
747  if (bSkipProtected && !bSkipCell)
748  bSkipCell = rDoc.HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected);
749  if (bSkipUnprotected && !bSkipCell)
750  bSkipCell = !rDoc.HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected);
751 
752  if (bSkipCell)
753  {
754  if (rCurX <= 0 || rCurX >= nMaxCol)
755  {
756  if (bHFlip)
757  {
758  rCurX = nOldX;
759  bSkipCell = false;
760  }
761  else
762  {
763  nMovX = -nMovX;
764  if (nMovX > 0)
765  ++rCurX;
766  else
767  --rCurX;
768  bHFlip = true;
769  }
770  }
771  else
772  if (nMovX > 0)
773  ++rCurX;
774  else
775  --rCurX;
776  }
777  }
778  while (bSkipCell);
779 
780  if (rDoc.IsVerOverlapped(rCurX, rCurY, nTab))
781  {
782  aViewData.SetOldCursor(rCurX, rCurY);
783  while (rDoc.IsVerOverlapped(rCurX, rCurY, nTab))
784  --rCurY;
785  }
786 }
787 
788 void ScTabView::SkipCursorVertical(SCCOL& rCurX, SCROW& rCurY, SCROW nOldY, SCROW nMovY)
789 {
790  ScDocument& rDoc = aViewData.GetDocument();
791  SCTAB nTab = aViewData.GetTabNo();
792 
793  bool bSkipProtected = false, bSkipUnprotected = false;
794  const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
795  if (pProtect && pProtect->isProtected())
796  {
797  bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
798  bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
799  }
800 
801  bool bSkipCell = false;
802  bool bVFlip = false;
803  do
804  {
805  SCROW nLastRow = -1;
806  bSkipCell = rDoc.RowHidden(rCurY, nTab, nullptr, &nLastRow) || rDoc.IsVerOverlapped( rCurX, rCurY, nTab );
807  if (bSkipProtected && !bSkipCell)
808  bSkipCell = rDoc.HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected);
809  if (bSkipUnprotected && !bSkipCell)
810  bSkipCell = !rDoc.HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected);
811 
812  if (bSkipCell)
813  {
814  if (rCurY <= 0 || rCurY >= rDoc.MaxRow())
815  {
816  if (bVFlip)
817  {
818  rCurY = nOldY;
819  bSkipCell = false;
820  }
821  else
822  {
823  nMovY = -nMovY;
824  if (nMovY > 0)
825  ++rCurY;
826  else
827  --rCurY;
828  bVFlip = true;
829  }
830  }
831  else
832  if (nMovY > 0)
833  ++rCurY;
834  else
835  --rCurY;
836  }
837  }
838  while (bSkipCell);
839 
840  if (rDoc.IsHorOverlapped(rCurX, rCurY, nTab))
841  {
842  aViewData.SetOldCursor(rCurX, rCurY);
843  while (rDoc.IsHorOverlapped(rCurX, rCurY, nTab))
844  --rCurX;
845  }
846 }
847 
849 {
850  if (!nMovX && !nMovY)
851  // Nothing to do. Bail out.
852  return;
853 
854  ScTabViewShell* pViewShell = aViewData.GetViewShell();
855  bool bRefInputMode = pViewShell && pViewShell->IsRefInputMode();
856  if (bRefInputMode && !aViewData.IsRefMode())
857  // initialize formula reference mode if it hasn't already.
859 
860  ScDocument& rDoc = aViewData.GetDocument();
861 
862  if (aViewData.IsRefMode())
863  {
864  // formula reference mode
865 
866  SCCOL nNewX = aViewData.GetRefEndX();
867  SCROW nNewY = aViewData.GetRefEndY();
868  SCTAB nRefTab = aViewData.GetRefEndZ();
869 
870  bool bSelectLocked = true;
871  bool bSelectUnlocked = true;
872  const ScTableProtection* pTabProtection = rDoc.GetTabProtection(nRefTab);
873  if (pTabProtection && pTabProtection->isProtected())
874  {
875  bSelectLocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
876  bSelectUnlocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
877  }
878 
879  moveCursorByProtRule(nNewX, nNewY, nMovX, nMovY, nRefTab, &rDoc);
880  checkBoundary(&rDoc, nNewX, nNewY);
881 
882  if (nMovX)
883  {
884  SCCOL nTempX = nNewX;
885  while (rDoc.IsHorOverlapped(nTempX, nNewY, nRefTab))
886  {
887  if (nMovX > 0)
888  ++nTempX;
889  else
890  --nTempX;
891  if (!checkBoundary(&rDoc, nTempX, nNewY))
892  break;
893  }
894  if (isCellQualified(&rDoc, nTempX, nNewY, nRefTab, bSelectLocked, bSelectUnlocked))
895  nNewX = nTempX;
896  }
897 
898  if (nMovY)
899  {
900  SCROW nTempY = nNewY;
901  while (rDoc.IsVerOverlapped(nNewX, nTempY, nRefTab))
902  {
903  if (nMovY > 0)
904  ++nTempY;
905  else
906  --nTempY;
907  if (!checkBoundary(&rDoc, nNewX, nTempY))
908  break;
909  }
910  if (isCellQualified(&rDoc, nNewX, nTempY, nRefTab, bSelectLocked, bSelectUnlocked))
911  nNewY = nTempY;
912  }
913 
914  rDoc.SkipOverlapped(nNewX, nNewY, nRefTab);
915  UpdateRef(nNewX, nNewY, nRefTab);
916  SCCOL nTargetCol = nNewX;
917  SCROW nTargetRow = nNewY;
918  if (((aViewData.GetRefStartX() == 0) || (aViewData.GetRefStartY() == 0)) &&
919  ((nNewX != rDoc.MaxCol()) || (nNewY != rDoc.MaxRow())))
920  {
921  // Row selection
922  if ((aViewData.GetRefStartX() == 0) && (nNewX == rDoc.MaxCol()))
923  nTargetCol = aViewData.GetCurX();
924  // Column selection
925  if ((aViewData.GetRefStartY() == 0) && (nNewY == rDoc.MaxRow()))
926  nTargetRow = aViewData.GetCurY();
927  }
928  AlignToCursor(nTargetCol, nTargetRow, eMode);
929  }
930  else
931  {
932  // normal selection mode
933 
934  SCTAB nTab = aViewData.GetTabNo();
935  SCCOL nOrigX = aViewData.GetCurX();
936  SCROW nOrigY = aViewData.GetCurY();
937 
938  // Note that the origin position *never* moves during selection.
939 
940  if (!IsBlockMode())
941  InitBlockMode(nOrigX, nOrigY, nTab, true);
942 
943  moveCursorByProtRule(nBlockEndX, nBlockEndY, nMovX, nMovY, nTab, &rDoc);
944  checkBoundary(&rDoc, nBlockEndX, nBlockEndY);
945  moveCursorByMergedCell(nBlockEndX, nBlockEndY, nMovX, nMovY, nTab, &rDoc, aViewData);
946  checkBoundary(&rDoc, nBlockEndX, nBlockEndY);
947 
948  MarkCursor(nBlockEndX, nBlockEndY, nTab, false, false, true);
949 
950  // Check if the entire row(s) or column(s) are selected.
951  ScSplitPos eActive = aViewData.GetActivePart();
952  bool bRowSelected = (nBlockStartX == 0 && nBlockEndX == rDoc.MaxCol());
953  bool bColSelected = (nBlockStartY == 0 && nBlockEndY == rDoc.MaxRow());
954  SCCOL nAlignX = bRowSelected ? aViewData.GetPosX(WhichH(eActive)) : nBlockEndX;
955  SCROW nAlignY = bColSelected ? aViewData.GetPosY(WhichV(eActive)) : nBlockEndY;
956  AlignToCursor(nAlignX, nAlignY, eMode);
957 
959  }
960 }
961 
963 {
964  SCCOL nPageX;
965  SCROW nPageY;
966  GetPageMoveEndPosition(nMovX, nMovY, nPageX, nPageY);
967  ExpandBlock(nPageX, nPageY, SC_FOLLOW_FIX);
968 }
969 
971 {
972  SCCOL nAreaX;
973  SCROW nAreaY;
975  GetAreaMoveEndPosition(nMovX, nMovY, SC_FOLLOW_JUMP, nAreaX, nAreaY, eMode);
976  ExpandBlock(nAreaX, nAreaY, eMode);
977 }
978 
980 {
981  for (VclPtr<ScGridWindow> & pWin : pGridWin)
982  if (pWin && pWin->IsVisible())
983  pWin->UpdateCopySourceOverlay();
984 }
985 
987 {
988  for (VclPtr<ScGridWindow> & pWin : pGridWin)
989  if ( pWin && pWin->IsVisible() )
990  pWin->UpdateSelectionOverlay();
991 }
992 
994 {
995  for (VclPtr<ScGridWindow> & pWin : pGridWin)
996  if ( pWin && pWin->IsVisible() )
997  pWin->UpdateShrinkOverlay();
998 }
999 
1001 {
1002  for (VclPtr<ScGridWindow> & pWin : pGridWin)
1003  if ( pWin && pWin->IsVisible() )
1004  pWin->UpdateAllOverlays();
1005 }
1006 
1010 
1011 void ScTabView::PaintBlock( bool bReset )
1012 {
1013  ScMarkData& rMark = aViewData.GetMarkData();
1014  SCTAB nTab = aViewData.GetTabNo();
1015  bool bMulti = rMark.IsMultiMarked();
1016  if (!(rMark.IsMarked() || bMulti))
1017  return;
1018 
1019  ScRange aMarkRange;
1020  HideAllCursors();
1021  if (bMulti)
1022  {
1023  bool bFlag = rMark.GetMarkingFlag();
1024  rMark.SetMarking(false);
1025  rMark.MarkToMulti();
1026  rMark.GetMultiMarkArea(aMarkRange);
1027  rMark.MarkToSimple();
1028  rMark.SetMarking(bFlag);
1029  }
1030  else
1031  rMark.GetMarkArea(aMarkRange);
1032 
1033  nBlockStartX = aMarkRange.aStart.Col();
1034  nBlockStartY = aMarkRange.aStart.Row();
1035  nBlockStartZ = aMarkRange.aStart.Tab();
1036  nBlockEndX = aMarkRange.aEnd.Col();
1037  nBlockEndY = aMarkRange.aEnd.Row();
1038  nBlockEndZ = aMarkRange.aEnd.Tab();
1039 
1040  bool bDidReset = false;
1041 
1042  if ( nTab>=nBlockStartZ && nTab<=nBlockEndZ )
1043  {
1044  if ( bReset )
1045  {
1046  // Inverting when deleting only on active View
1047  if ( aViewData.IsActive() )
1048  {
1049  rMark.ResetMark();
1051  bDidReset = true;
1052  }
1053  }
1054  else
1056  }
1057 
1058  if ( bReset && !bDidReset )
1059  rMark.ResetMark();
1060 
1061  ShowAllCursors();
1062 }
1063 
1064 void ScTabView::SelectAll( bool bContinue )
1065 {
1066  ScDocument& rDoc = aViewData.GetDocument();
1067  ScMarkData& rMark = aViewData.GetMarkData();
1068  SCTAB nTab = aViewData.GetTabNo();
1069 
1070  if (rMark.IsMarked())
1071  {
1072  ScRange aMarkRange;
1073  rMark.GetMarkArea( aMarkRange );
1074  if ( aMarkRange == ScRange( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab ) )
1075  return;
1076  }
1077 
1078  DoneBlockMode( bContinue );
1079  InitBlockMode( 0,0,nTab );
1080  MarkCursor( rDoc.MaxCol(),rDoc.MaxRow(),nTab );
1081 
1082  SelectionChanged();
1083 }
1084 
1086 {
1087  ScDocument& rDoc = aViewData.GetDocument();
1088  ScMarkData& rMark = aViewData.GetMarkData();
1089  SCTAB nCount = rDoc.GetTableCount();
1090 
1091  if (nCount>1)
1092  {
1093  for (SCTAB i=0; i<nCount; i++)
1094  rMark.SelectTable( i, true );
1095 
1097  SfxBindings& rBind = aViewData.GetBindings();
1098  rBind.Invalidate( FID_FILL_TAB );
1099  rBind.Invalidate( FID_TAB_DESELECTALL );
1100  }
1101 }
1102 
1104 {
1105  ScDocument& rDoc = aViewData.GetDocument();
1106  ScMarkData& rMark = aViewData.GetMarkData();
1107  SCTAB nTab = aViewData.GetTabNo();
1108  SCTAB nCount = rDoc.GetTableCount();
1109 
1110  for (SCTAB i=0; i<nCount; i++)
1111  rMark.SelectTable( i, ( i == nTab ) );
1112 
1114  SfxBindings& rBind = aViewData.GetBindings();
1115  rBind.Invalidate( FID_FILL_TAB );
1116  rBind.Invalidate( FID_TAB_DESELECTALL );
1117 }
1118 
1119 static bool lcl_FitsInWindow( double fScaleX, double fScaleY, sal_uInt16 nZoom,
1120  tools::Long nWindowX, tools::Long nWindowY, const ScDocument* pDoc, SCTAB nTab,
1121  SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1122  SCCOL nFixPosX, SCROW nFixPosY )
1123 {
1124  double fZoomFactor = static_cast<double>(Fraction(nZoom,100));
1125  fScaleX *= fZoomFactor;
1126  fScaleY *= fZoomFactor;
1127 
1128  tools::Long nBlockX = 0;
1129  SCCOL nCol;
1130  for (nCol=0; nCol<nFixPosX; nCol++)
1131  {
1132  // for frozen panes, add both parts
1133  sal_uInt16 nColTwips = pDoc->GetColWidth( nCol, nTab );
1134  if (nColTwips)
1135  {
1136  nBlockX += static_cast<tools::Long>(nColTwips * fScaleX);
1137  if (nBlockX > nWindowX)
1138  return false;
1139  }
1140  }
1141  for (nCol=nStartCol; nCol<=nEndCol; nCol++)
1142  {
1143  sal_uInt16 nColTwips = pDoc->GetColWidth( nCol, nTab );
1144  if (nColTwips)
1145  {
1146  nBlockX += static_cast<tools::Long>(nColTwips * fScaleX);
1147  if (nBlockX > nWindowX)
1148  return false;
1149  }
1150  }
1151 
1152  tools::Long nBlockY = 0;
1153  for (SCROW nRow = 0; nRow <= nFixPosY-1; ++nRow)
1154  {
1155  if (pDoc->RowHidden(nRow, nTab))
1156  continue;
1157 
1158  // for frozen panes, add both parts
1159  sal_uInt16 nRowTwips = pDoc->GetRowHeight(nRow, nTab);
1160  if (nRowTwips)
1161  {
1162  nBlockY += static_cast<tools::Long>(nRowTwips * fScaleY);
1163  if (nBlockY > nWindowY)
1164  return false;
1165  }
1166  }
1167  for (SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow)
1168  {
1169  sal_uInt16 nRowTwips = pDoc->GetRowHeight(nRow, nTab);
1170  if (nRowTwips)
1171  {
1172  nBlockY += static_cast<tools::Long>(nRowTwips * fScaleY);
1173  if (nBlockY > nWindowY)
1174  return false;
1175  }
1176  }
1177 
1178  return true;
1179 }
1180 
1181 sal_uInt16 ScTabView::CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom )
1182 {
1183  sal_uInt16 nZoom = 100;
1184 
1185  switch ( eType )
1186  {
1187  case SvxZoomType::PERCENT: // rZoom is no particular percent value
1188  nZoom = nOldZoom;
1189  break;
1190 
1191  case SvxZoomType::OPTIMAL: // nZoom corresponds to the optimal size
1192  {
1193  ScMarkData& rMark = aViewData.GetMarkData();
1194  ScDocument& rDoc = aViewData.GetDocument();
1195 
1196  if (!rMark.IsMarked() && !rMark.IsMultiMarked())
1197  nZoom = 100; // nothing selected
1198  else
1199  {
1200  SCTAB nTab = aViewData.GetTabNo();
1201  ScRange aMarkRange;
1202  if ( aViewData.GetSimpleArea( aMarkRange ) != SC_MARK_SIMPLE )
1203  rMark.GetMultiMarkArea( aMarkRange );
1204 
1205  SCCOL nStartCol = aMarkRange.aStart.Col();
1206  SCROW nStartRow = aMarkRange.aStart.Row();
1207  SCTAB nStartTab = aMarkRange.aStart.Tab();
1208  SCCOL nEndCol = aMarkRange.aEnd.Col();
1209  SCROW nEndRow = aMarkRange.aEnd.Row();
1210  SCTAB nEndTab = aMarkRange.aEnd.Tab();
1211 
1212  if ( nTab < nStartTab && nTab > nEndTab )
1213  nTab = nStartTab;
1214 
1215  ScSplitPos eUsedPart = aViewData.GetActivePart();
1216 
1217  SCCOL nFixPosX = 0;
1218  SCROW nFixPosY = 0;
1220  {
1221  // use right part
1222  eUsedPart = (WhichV(eUsedPart)==SC_SPLIT_TOP) ? SC_SPLIT_TOPRIGHT : SC_SPLIT_BOTTOMRIGHT;
1223  nFixPosX = aViewData.GetFixPosX();
1224  if ( nStartCol < nFixPosX )
1225  nStartCol = nFixPosX;
1226  }
1228  {
1229  // use bottom part
1230  eUsedPart = (WhichH(eUsedPart)==SC_SPLIT_LEFT) ? SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT;
1231  nFixPosY = aViewData.GetFixPosY();
1232  if ( nStartRow < nFixPosY )
1233  nStartRow = nFixPosY;
1234  }
1235 
1236  if (pGridWin[eUsedPart])
1237  {
1238  // Because scale is rounded to pixels, the only reliable way to find
1239  // the right scale is to check if a zoom fits
1240 
1241  Size aWinSize = pGridWin[eUsedPart]->GetOutputSizePixel();
1242 
1243  // for frozen panes, use sum of both parts for calculation
1244 
1245  if ( nFixPosX != 0 )
1246  aWinSize.AdjustWidth(GetGridWidth( SC_SPLIT_LEFT ) );
1247  if ( nFixPosY != 0 )
1248  aWinSize.AdjustHeight(GetGridHeight( SC_SPLIT_TOP ) );
1249 
1250  ScDocShell* pDocSh = aViewData.GetDocShell();
1251  double nPPTX = ScGlobal::nScreenPPTX / pDocSh->GetOutputFactor();
1252  double nPPTY = ScGlobal::nScreenPPTY;
1253 
1254  sal_uInt16 nMin = MINZOOM;
1255  sal_uInt16 nMax = MAXZOOM;
1256  while ( nMax > nMin )
1257  {
1258  sal_uInt16 nTest = (nMin+nMax+1)/2;
1259  if ( lcl_FitsInWindow(
1260  nPPTX, nPPTY, nTest, aWinSize.Width(), aWinSize.Height(),
1261  &rDoc, nTab, nStartCol, nStartRow, nEndCol, nEndRow,
1262  nFixPosX, nFixPosY ) )
1263  nMin = nTest;
1264  else
1265  nMax = nTest-1;
1266  }
1267  OSL_ENSURE( nMin == nMax, "Nesting is wrong" );
1268  nZoom = nMin;
1269 
1270  if ( nZoom != nOldZoom )
1271  {
1272  // scroll to block only in active split part
1273  // (the part for which the size was calculated)
1274 
1275  if ( nStartCol <= nEndCol )
1276  aViewData.SetPosX( WhichH(eUsedPart), nStartCol );
1277  if ( nStartRow <= nEndRow )
1278  aViewData.SetPosY( WhichV(eUsedPart), nStartRow );
1279  }
1280  }
1281  }
1282  }
1283  break;
1284 
1285  case SvxZoomType::WHOLEPAGE: // nZoom corresponds to the whole page or
1286  case SvxZoomType::PAGEWIDTH: // nZoom corresponds to the page width
1287  {
1288  SCTAB nCurTab = aViewData.GetTabNo();
1289  ScDocument& rDoc = aViewData.GetDocument();
1290  ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
1291  SfxStyleSheetBase* pStyleSheet =
1292  pStylePool->Find( rDoc.GetPageStyle( nCurTab ),
1293  SfxStyleFamily::Page );
1294 
1295  OSL_ENSURE( pStyleSheet, "PageStyle not found :-/" );
1296 
1297  if ( pStyleSheet )
1298  {
1299  ScPrintFunc aPrintFunc( aViewData.GetDocShell(),
1301  nCurTab );
1302 
1303  Size aPageSize = aPrintFunc.GetDataSize();
1304 
1305  // use the size of the largest GridWin for normal split,
1306  // or both combined for frozen panes, with the (document) size
1307  // of the frozen part added to the page size
1308  // (with frozen panes, the size of the individual parts
1309  // depends on the scale that is to be calculated)
1310 
1312  return nZoom;
1313 
1314  Size aWinSize = pGridWin[SC_SPLIT_BOTTOMLEFT]->GetOutputSizePixel();
1315  ScSplitMode eHMode = aViewData.GetHSplitMode();
1316  if ( eHMode != SC_SPLIT_NONE && pGridWin[SC_SPLIT_BOTTOMRIGHT] )
1317  {
1318  tools::Long nOtherWidth = pGridWin[SC_SPLIT_BOTTOMRIGHT]->
1319  GetOutputSizePixel().Width();
1320  if ( eHMode == SC_SPLIT_FIX )
1321  {
1322  aWinSize.AdjustWidth(nOtherWidth );
1323  for ( SCCOL nCol = aViewData.GetPosX(SC_SPLIT_LEFT);
1324  nCol < aViewData.GetFixPosX(); nCol++ )
1325  aPageSize.AdjustWidth(rDoc.GetColWidth( nCol, nCurTab ) );
1326  }
1327  else if ( nOtherWidth > aWinSize.Width() )
1328  aWinSize.setWidth( nOtherWidth );
1329  }
1330  ScSplitMode eVMode = aViewData.GetVSplitMode();
1331  if ( eVMode != SC_SPLIT_NONE && pGridWin[SC_SPLIT_TOPLEFT] )
1332  {
1333  tools::Long nOtherHeight = pGridWin[SC_SPLIT_TOPLEFT]->
1334  GetOutputSizePixel().Height();
1335  if ( eVMode == SC_SPLIT_FIX )
1336  {
1337  aWinSize.AdjustHeight(nOtherHeight );
1338  aPageSize.AdjustHeight(rDoc.GetRowHeight(
1340  aViewData.GetFixPosY()-1, nCurTab) );
1341  }
1342  else if ( nOtherHeight > aWinSize.Height() )
1343  aWinSize.setHeight( nOtherHeight );
1344  }
1345 
1347  double nPPTY = ScGlobal::nScreenPPTY;
1348 
1349  tools::Long nZoomX = static_cast<tools::Long>( aWinSize.Width() * 100 /
1350  ( aPageSize.Width() * nPPTX ) );
1351  tools::Long nZoomY = static_cast<tools::Long>( aWinSize.Height() * 100 /
1352  ( aPageSize.Height() * nPPTY ) );
1353 
1354  if (nZoomX > 0)
1355  nZoom = static_cast<sal_uInt16>(nZoomX);
1356 
1357  if (eType == SvxZoomType::WHOLEPAGE && nZoomY > 0 && nZoomY < nZoom)
1358  nZoom = static_cast<sal_uInt16>(nZoomY);
1359  }
1360  }
1361  break;
1362 
1363  default:
1364  OSL_FAIL("Unknown Zoom-Revision");
1365  }
1366 
1367  return nZoom;
1368 }
1369 
1370 // is called for instance when the view window is shifted:
1371 
1373 {
1374  ScSplitPos eActive = aViewData.GetActivePart();
1375  if (pGridWin[eActive])
1376  pGridWin[eActive]->StopMarking();
1377 
1378  ScHSplitPos eH = WhichH(eActive);
1379  if (pColBar[eH])
1380  pColBar[eH]->StopMarking();
1381 
1382  ScVSplitPos eV = WhichV(eActive);
1383  if (pRowBar[eV])
1384  pRowBar[eV]->StopMarking();
1385 }
1386 
1388 {
1389  for (VclPtr<ScGridWindow> & pWin : pGridWin)
1390  if (pWin && pWin->IsVisible())
1391  pWin->HideNoteMarker();
1392 }
1393 
1395 {
1396  if (pDrawView)
1397  return;
1398 
1400 
1401  // pDrawView is set per Notify
1402  OSL_ENSURE(pDrawView,"ScTabView::MakeDrawLayer does not work");
1403 
1404  for(VclPtr<ScGridWindow> & pWin : pGridWin)
1405  {
1406  if(pWin)
1407  {
1408  pWin->DrawLayerCreated();
1409  }
1410  }
1411 }
1412 
1413 void ScTabView::ErrorMessage(const char* pGlobStrId)
1414 {
1415  if ( SC_MOD()->IsInExecuteDrop() )
1416  {
1417  // #i28468# don't show error message when called from Drag&Drop, silently abort instead
1418  return;
1419  }
1420 
1421  StopMarking(); // if called by Focus from MouseButtonDown
1422 
1423  weld::Window* pParent = aViewData.GetDialogParent();
1424  weld::WaitObject aWaitOff( pParent );
1425  bool bFocus = pParent && pParent->has_focus();
1426 
1427  if (pGlobStrId && strcmp(pGlobStrId, STR_PROTECTIONERR) == 0)
1428  {
1429  if (aViewData.GetDocShell()->IsReadOnly())
1430  {
1431  pGlobStrId = STR_READONLYERR;
1432  }
1433  }
1434 
1436  VclMessageType::Info, VclButtonsType::Ok,
1437  ScResId(pGlobStrId)));
1438  weld::Window* pGrabOnClose = bFocus ? pParent : nullptr;
1439  m_xMessageBox->runAsync(m_xMessageBox, [this, pGrabOnClose](sal_Int32 /*nResult*/) {
1440  m_xMessageBox.reset();
1441  if (pGrabOnClose)
1442  pGrabOnClose->grab_focus();
1443  });
1444 }
1445 
1446 void ScTabView::UpdatePageBreakData( bool bForcePaint )
1447 {
1448  std::unique_ptr<ScPageBreakData> pNewData;
1449 
1450  if (aViewData.IsPagebreakMode())
1451  {
1452  ScDocShell* pDocSh = aViewData.GetDocShell();
1453  ScDocument& rDoc = pDocSh->GetDocument();
1454  SCTAB nTab = aViewData.GetTabNo();
1455 
1456  sal_uInt16 nCount = rDoc.GetPrintRangeCount(nTab);
1457  if (!nCount)
1458  nCount = 1;
1459  pNewData.reset( new ScPageBreakData(nCount) );
1460 
1461  ScPrintFunc aPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab, 0,0,nullptr, nullptr, pNewData.get() );
1462  // ScPrintFunc fills the PageBreakData in ctor
1463  if ( nCount > 1 )
1464  {
1465  aPrintFunc.ResetBreaks(nTab);
1466  pNewData->AddPages();
1467  }
1468 
1469  // print area changed?
1470  if ( bForcePaint || ( pPageBreakData && !( *pPageBreakData == *pNewData ) ) )
1471  PaintGrid();
1472  }
1473 
1474  pPageBreakData = std::move(pNewData);
1475 }
1476 
1477 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define MAXZOOM
Definition: global.hxx:77
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3047
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:1064
void MarkToSimple()
Definition: markdata.cxx:237
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:353
ScAddress aStart
Definition: address.hxx:499
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:1119
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:450
SCROW GetRefEndY() const
Definition: viewdata.hxx:518
bool bBlockCols
Definition: tabview.hxx:214
ScVSplitPos WhichV(ScSplitPos ePos)
Definition: viewdata.hxx:709
SCROW Row() const
Definition: address.hxx:261
ScVSplitPos
Definition: viewdata.hxx:46
void setWidth(tools::Long nWidth)
void MarkToMulti()
Definition: markdata.cxx:224
sheet protection state container
bool bBlockRows
Definition: tabview.hxx:215
void ResetMark()
Definition: markdata.cxx:85
void SelectAllTables()
Definition: tabview2.cxx:1085
SCROW GetRefStartY() const
Definition: viewdata.hxx:515
long Long
void HideNoteMarker()
Definition: tabview2.cxx:1387
SCROW GetCurY() const
Definition: viewdata.hxx:401
ScHSplitPos WhichH(ScSplitPos ePos)
Definition: viewdata.hxx:703
void ResetBreaks(SCTAB nTab)
Definition: printfun.cxx:2982
SCTAB nBlockEndZ
Definition: tabview.hxx:193
double GetOutputFactor() const
Definition: docsh.hxx:353
ScFollowMode
Screen behavior related to cursor movements.
Definition: viewdata.hxx:52
double GetPPTX() const
Definition: viewdata.hxx:467
void PostPaintExtras()
Definition: docsh3.cxx:197
SCROW GetFixPosY() const
Definition: viewdata.hxx:420
SCTAB GetTabNo() const
Definition: viewdata.hxx:394
void PaintGrid()
Definition: tabview3.cxx:2626
tools::Long GetGridWidth(ScHSplitPos eWhich)
Definition: tabview3.cxx:2983
ScAddress aEnd
Definition: address.hxx:500
ScSplitPos GetActivePart() const
Definition: viewdata.hxx:397
std::shared_ptr< weld::MessageDialog > m_xMessageBox
Definition: tabview.hxx:140
ScDocument & GetDocument() const
Definition: viewdata.hxx:379
void UpdateAllOverlays()
Definition: tabview2.cxx:1000
bool IsHorOverlapped(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:5774
void Invalidate(sal_uInt16 nId)
void CursorPosChanging(bool bShift, bool bMod1)
SCCOL GetPosX(ScHSplitPos eWhich, SCTAB nForTab=-1) const
Definition: viewdata.cxx:1342
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
Definition: document.cxx:5224
SCCOL CellsAtX(SCCOL nPosX, SCCOL nDir, ScHSplitPos eWhichX, sal_uInt16 nScrSizeY=SC_SIZE_NONE) const
Definition: viewdata.cxx:2544
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4211
ScSplitPos
Definition: viewdata.hxx:44
bool IsCellMarked(SCCOL nCol, SCROW nRow, bool bNoSimple=false) const
Definition: markdata.cxx:285
SCCOL nBlockStartXOrig
Definition: tabview.hxx:185
void GetMarkArea(ScRange &rRange) const
Definition: markdata.cxx:112
void DeselectAllTables()
Definition: tabview2.cxx:1103
constexpr tools::Long Width() const
void UpdateCopySourceOverlay()
Definition: tabview2.cxx:979
tools::Long GetGridHeight(ScVSplitPos eWhich)
Definition: tabview3.cxx:2994
BlockMode meBlockMode
Definition: tabview.hxx:182
static tools::Long ToPixel(sal_uInt16 nTwips, double nFactor)
Definition: viewdata.hxx:681
bool isOptionEnabled(Option eOption) const
void PaintLeftArea(SCROW nStartRow, SCROW nEndRow)
Definition: tabview3.cxx:2713
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:871
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:313
void SetPosX(ScHSplitPos eWhich, SCCOL nNewPosX)
Definition: viewdata.cxx:2821
bool IsMultiMarked() const
Definition: markdata.hxx:82
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:1011
void UpdateShrinkOverlay()
Definition: tabview2.cxx:993
SC_DLLPUBLIC bool HasTable(SCTAB nTab) const
Definition: document.cxx:190
Mode eMode
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
Definition: tabvwsha.cxx:653
SCTAB Tab() const
Definition: address.hxx:270
void DoneBlockMode(bool bContinue=false)
Definition: tabview2.cxx:409
SCROW GetPosY(ScVSplitPos eWhich, SCTAB nForTab=-1) const
Definition: viewdata.cxx:1356
ScSplitMode GetHSplitMode() const
Definition: viewdata.hxx:415
bool IsBlockMode() const
Definition: tabview2.cxx:444
void SkipCursorVertical(SCCOL &rCurX, SCROW &rCurY, SCROW nOldY, SCROW nMovY)
Definition: tabview2.cxx:788
ScDrawLayer * MakeDrawLayer()
Definition: docsh2.cxx:169
SCCOL nBlockEndX
Definition: tabview.hxx:186
void SelectionChanged(bool bFromPaste=false)
Definition: tabview3.cxx:531
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
Definition: document.cxx:4764
bool IsRowMarked(SCROW nRow) const
Definition: markdata.cxx:318
void PaintArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScUpdateMode eMode=ScUpdateMode::All)
Definition: tabview3.cxx:2304
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:356
constexpr double nPPTX
std::unique_ptr< ScPageBreakData > pPageBreakData
Definition: tabview.hxx:162
void ExpandBlock(SCCOL nMovX, SCROW nMovY, ScFollowMode eMode)
Definition: tabview2.cxx:848
void SetMarkArea(const ScRange &rRange)
Definition: markdata.cxx:97
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:870
SCROW nBlockStartYOrig
Definition: tabview.hxx:189
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: document.cxx:4495
SC_DLLPUBLIC sal_uInt16 GetPrintRangeCount(SCTAB nTab)
Definition: document.cxx:6316
bool IsMarked() const
Definition: markdata.hxx:81
SCTAB GetRefEndZ() const
Definition: viewdata.hxx:519
int i
bool IsColumnMarked(SCCOL nCol) const
Definition: markdata.cxx:302
SCTAB nBlockStartZ
Definition: tabview.hxx:192
void SelectTable(SCTAB nTab, bool bNew)
Definition: markdata.cxx:172
SfxBindings & GetBindings()
Definition: viewdata.cxx:3035
sal_Int16 SCCOL
Definition: types.hxx:21
bool ValidCol(SCCOL nCol) const
Definition: document.hxx:873
bool GetLegacyCellSelection() const
Definition: inputopt.hxx:69
static SC_DLLPUBLIC double nScreenPPTY
Vertical pixel per twips factor.
Definition: global.hxx:578
virtual bool has_focus() const =0
#define SC_MOD()
Definition: scmod.hxx:249
void ExpandBlockArea(SCCOL nMovX, SCROW nMovY)
Definition: tabview2.cxx:970
SC_DLLPUBLIC SCCOL ClampToAllocatedColumns(SCTAB nTab, SCCOL nCol) const
Definition: documen3.cxx:2140
OUString ScResId(const char *pId)
Definition: scdll.cxx:89
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
Definition: viewdata.cxx:1171
bool IsActive() const
Definition: viewdata.hxx:381
SC_DLLPUBLIC OUString GetPageStyle(SCTAB nTab) const
Definition: document.cxx:6231
#define SC_SIZE_NONE
Definition: viewdata.hxx:31
void InitOwnBlockMode()
Definition: tabview2.cxx:332
SCCOL nBlockStartX
Definition: tabview.hxx:184
sal_uInt16 CalcZoom(SvxZoomType eType, sal_uInt16 nOldZoom)
Definition: tabview2.cxx:1181
weld::Window * GetDialogParent()
Definition: viewdata.cxx:3057
SCCOL GetRefEndX() const
Definition: viewdata.hxx:517
void UpdateSelectionOverlay()
Definition: tabview2.cxx:986
SC_DLLPUBLIC bool ExtendMerge(SCCOL nStartCol, SCROW nStartRow, SCCOL &rEndCol, SCROW &rEndRow, SCTAB nTab, bool bRefresh=false)
Definition: document.cxx:5613
bool IsMarkNegative() const
Definition: markdata.hxx:101
virtual bool isProtected() const override
SCCOL Col() const
Definition: address.hxx:266
bool IsReadOnly() const
void SetAnchorFlag(bool bSet)
Definition: select.hxx:99
SCCOL GetRefStartX() const
Definition: viewdata.hxx:514
bool IsMerged() const
Definition: attrib.hxx:71
SCCOL GetFixPosX() const
Definition: viewdata.hxx:419
tools::Long GetPageUpDownOffset() const
Definition: viewdata.hxx:551
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:5766
sal_Int32 SCROW
Definition: types.hxx:17
void MakeDrawLayer()
Definition: tabview2.cxx:1394
bool IsVerOverlapped(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:5786
bool ValidRow(SCROW nRow) const
Definition: document.hxx:874
void HideAllCursors()
Definition: tabview3.cxx:218
constexpr tools::Long Height() const
void ErrorMessage(const char *pGlobStrId)
Definition: tabview2.cxx:1413
void FindAreaPos(SCCOL &rCol, SCROW &rRow, SCTAB nTab, ScMoveDirection eDirection) const
Definition: document.cxx:6133
virtual void grab_focus()=0
ScHeaderFunctionSet aHdrFunc
Definition: tabview.hxx:128
void StopMarking()
Definition: tabview2.cxx:1372
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:2860
SC_DLLPUBLIC const ScInputOptions & GetInputOptions()
Definition: scmod.cxx:776
static SC_DLLPUBLIC double nScreenPPTX
Horizontal pixel per twips factor.
Definition: global.hxx:576
const ScDocument & GetDocument() const
Definition: docsh.hxx:216
void GetPageMoveEndPosition(SCCOL nMovX, SCROW nMovY, SCCOL &rPageX, SCROW &rPageY)
Definition: tabview2.cxx:600
void GetAreaMoveEndPosition(SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, SCCOL &rAreaX, SCROW &rAreaY, ScFollowMode &rMode)
Definition: tabview2.cxx:650
ScViewSelectionEngine * GetSelEngine()
Definition: tabview.hxx:337
tools::Long AdjustHeight(tools::Long n)
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6111
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:914
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:4479
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:2586
void SetOldCursor(SCCOL nNewX, SCROW nNewY)
Definition: viewdata.cxx:1330
#define MINZOOM
Definition: global.hxx:76
void SkipCursorHorizontal(SCCOL &rCurX, SCROW &rCurY, SCCOL nOldX, SCCOL nMovX)
Definition: tabview2.cxx:728
bool IsRefInputMode() const
Definition: tabvwsha.cxx:603
SCROW GetRowMerge() const
Definition: attrib.hxx:69
void GetMultiMarkArea(ScRange &rRange) const
Definition: markdata.cxx:117
ScViewData aViewData
Definition: tabview.hxx:122
virtual SfxPrinter * GetPrinter(bool bCreate=false) override
Definition: tabvwsh4.cxx:1043
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:2657
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4170
bool IsPagebreakMode() const
Definition: viewdata.hxx:424
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:962
bool IsRefMode() const
Definition: viewdata.hxx:512
void UpdatePageBreakData(bool bForcePaint=false)
Definition: tabview2.cxx:1446
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:416
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:232
SCCOL GetCurX() const
Definition: viewdata.hxx:400
SC_DLLPUBLIC const ScTableProtection * GetTabProtection(SCTAB nTab) const
Definition: documen3.cxx:1915