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