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