LibreOffice Module sc (master)  1
tabview5.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 <svx/fmshell.hxx>
21 #include <svx/svdobj.hxx>
22 #include <svx/svdocapt.hxx>
23 #include <svx/svdoutl.hxx>
24 #include <sfx2/bindings.hxx>
25 #include <sfx2/dispatch.hxx>
26 #include <sfx2/lokhelper.hxx>
27 #include <sfx2/objsh.hxx>
28 #include <sfx2/viewfrm.hxx>
29 
30 #include <tabview.hxx>
31 #include <tabvwsh.hxx>
32 #include <document.hxx>
33 #include <gridwin.hxx>
34 #include <olinewin.hxx>
35 #include <tabsplit.hxx>
36 #include <colrowba.hxx>
37 #include <tabcont.hxx>
38 #include <sc.hrc>
39 #include <pagedata.hxx>
40 #include <hiranges.hxx>
41 #include <drawview.hxx>
42 #include <drwlayer.hxx>
43 #include <fusel.hxx>
44 #include <seltrans.hxx>
45 #include <scmod.hxx>
46 #include <docsh.hxx>
47 #include <viewuno.hxx>
48 #include <postit.hxx>
49 
50 #include <vcl/settings.hxx>
51 
52 #include <comphelper/lok.hxx>
53 #include <officecfg/Office/Calc.hxx>
54 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
55 
56 using namespace com::sun::star;
57 
59 {
60  /* RTL layout of the view windows is done manually, because it depends on
61  the sheet orientation, not the UI setting. Note: controls that are
62  already constructed (e.g. scroll bars) have the RTL setting of the GUI.
63  Eventually this has to be disabled manually (see below). */
64  pFrameWin->EnableRTL( false );
65 
66  sal_uInt16 i;
67 
68  mbInlineWithScrollbar = officecfg::Office::Calc::Layout::Other::TabbarInlineWithScrollbar::get();
69 
70  aScrollTimer.SetTimeout(10);
71  aScrollTimer.SetInvokeHandler( LINK( this, ScTabView, TimerHdl ) );
72 
73  for (i=0; i<4; i++)
74  pGridWin[i] = nullptr;
75  pGridWin[SC_SPLIT_BOTTOMLEFT] = VclPtr<ScGridWindow>::Create( pFrameWin, aViewData, SC_SPLIT_BOTTOMLEFT );
76 
77  pSelEngine.reset( new ScViewSelectionEngine( pGridWin[SC_SPLIT_BOTTOMLEFT], this,
78  SC_SPLIT_BOTTOMLEFT ) );
79  aFunctionSet.SetSelectionEngine( pSelEngine.get() );
80 
81  pHdrSelEng.reset( new ScHeaderSelectionEngine( pFrameWin, &aHdrFunc ) );
82 
84  &aHdrFunc, pHdrSelEng.get(), this );
85  pColBar[SC_SPLIT_RIGHT] = nullptr;
87  &aHdrFunc, pHdrSelEng.get(), this );
88  pRowBar[SC_SPLIT_TOP] = nullptr;
89  for (i=0; i<2; i++)
90  pColOutline[i] = pRowOutline[i] = nullptr;
91 
92  pHSplitter = VclPtr<ScTabSplitter>::Create( pFrameWin, WinBits( WB_HSCROLL ), &aViewData );
93  pVSplitter = VclPtr<ScTabSplitter>::Create( pFrameWin, WinBits( WB_VSCROLL ), &aViewData );
94 
95  // SSA: override default keyboard step size to allow snap to row/column
96  pHSplitter->SetKeyboardStepSize( 1 );
97  pVSplitter->SetKeyboardStepSize( 1 );
98 
99  pTabControl = VclPtr<ScTabControl>::Create(pFrameWin, &aViewData);
100  if (mbInlineWithScrollbar)
101  pTabControl->SetStyle(pTabControl->GetStyle() | WB_SIZEABLE);
102 
103  /* #i97900# The tab control has to remain in RTL mode if GUI is RTL, this
104  is needed to draw the 3D effect correctly. The base TabBar implements
105  mirroring independent from the GUI direction. Have to set RTL mode
106  explicitly because the parent frame window is already RTL disabled. */
107  pTabControl->EnableRTL( AllSettings::GetLayoutRTL() );
108 
109  InitScrollBar( *aHScrollLeft, aViewData.GetDocument().MaxCol()+1 );
110  InitScrollBar( *aHScrollRight, aViewData.GetDocument().MaxCol()+1 );
111  InitScrollBar( *aVScrollTop, aViewData.GetDocument().MaxRow()+1 );
112  InitScrollBar( *aVScrollBottom, aViewData.GetDocument().MaxRow()+1 );
113  /* #i97900# scrollbars remain in correct RTL mode, needed mirroring etc.
114  is now handled correctly at the respective places. */
115 
116  // Don't show anything here, because still in wrong order
117  // Show is received from UpdateShow during first resize
118  // pTabControl, pGridWin, aHScrollLeft, aVScrollBottom,
119  // aCornerButton, aScrollBarBox, pHSplitter, pVSplitter
120 
121  // fragment
122 
123  pHSplitter->SetSplitHdl( LINK( this, ScTabView, SplitHdl ) );
124  pVSplitter->SetSplitHdl( LINK( this, ScTabView, SplitHdl ) );
125 
126  // UpdateShow is done during resize or a copy of an existing view from ctor
127 
128  pDrawActual = nullptr;
129  pDrawOld = nullptr;
130 
131  // DrawView cannot be create in the TabView - ctor
132  // when the ViewShell isn't constructed yet...
133  // The also applies to ViewOptionsHasChanged()
134 
135  TestHintWindow();
136 }
137 
139 {
140  sal_uInt16 i;
141 
142  // remove selection object
143  ScModule* pScMod = SC_MOD();
145  if ( pOld && pOld->GetView() == this )
146  {
147  pOld->ForgetView();
148  pScMod->SetSelectionTransfer( nullptr );
149  TransferableHelper::ClearSelection( GetActiveWin() ); // may delete pOld
150  }
151 
152  pBrushDocument.reset();
153  pDrawBrushSet.reset();
154 
155  pPageBreakData.reset();
156 
157  delete pDrawActual;
158  pDrawActual = nullptr;
159  delete pDrawOld;
160  pDrawOld = nullptr;
161 
163  {
164  ScTabViewShell* pThisViewShell = GetViewData().GetViewShell();
165 
166  auto lRemoveWindows =
167  [pThisViewShell] (ScTabViewShell* pOtherViewShell)
168  {
169  ScViewData& rOtherViewData = pOtherViewShell->GetViewData();
170  for (int k = 0; k < 4; ++k)
171  {
172  if (rOtherViewData.HasEditView(static_cast<ScSplitPos>(k)))
173  pThisViewShell->RemoveWindowFromForeignEditView(pOtherViewShell, static_cast<ScSplitPos>(k));
174  }
175  };
176 
177  SfxLokHelper::forEachOtherView(pThisViewShell, lRemoveWindows);
178  }
179 
180  aViewData.KillEditView(); // as long as GridWins still exist
181 
182  if (pDrawView)
183  {
184  for (i=0; i<4; i++)
185  if (pGridWin[i])
186  {
187  pDrawView->DeleteWindowFromPaintView(pGridWin[i]);
188  }
189 
190  pDrawView->HideSdrPage();
191  pDrawView.reset();
192  }
193 
194  pSelEngine.reset();
195 
196  mxInputHintOO.reset();
197  for (i=0; i<4; i++)
198  pGridWin[i].disposeAndClear();
199 
200  pHdrSelEng.reset();
201 
202  for (i=0; i<2; i++)
203  {
204  pColBar[i].disposeAndClear();
205  pRowBar[i].disposeAndClear();
206  pColOutline[i].disposeAndClear();
207  pRowOutline[i].disposeAndClear();
208  }
209 
210  aScrollBarBox.disposeAndClear();
211  aCornerButton.disposeAndClear();
212  aTopButton.disposeAndClear();
213  aHScrollLeft.disposeAndClear();
214  aHScrollRight.disposeAndClear();
215  aVScrollTop.disposeAndClear();
216  aVScrollBottom.disposeAndClear();
217 
218  pHSplitter.disposeAndClear();
219  pVSplitter.disposeAndClear();
220  pTabControl.disposeAndClear();
221 }
222 
223 void ScTabView::MakeDrawView( TriState nForceDesignMode )
224 {
225  if (pDrawView)
226  return;
227 
228  ScDrawLayer* pLayer = aViewData.GetDocument().GetDrawLayer();
229  OSL_ENSURE(pLayer, "Where is the Draw Layer ??");
230 
231  sal_uInt16 i;
232  pDrawView.reset( new ScDrawView( pGridWin[SC_SPLIT_BOTTOMLEFT], &aViewData ) );
233  for (i=0; i<4; i++)
234  if (pGridWin[i])
235  {
236  if ( SC_SPLIT_BOTTOMLEFT != static_cast<ScSplitPos>(i) )
237  pDrawView->AddWindowToPaintView(pGridWin[i], nullptr);
238  }
239  pDrawView->RecalcScale();
240  for (i=0; i<4; i++)
241  if (pGridWin[i])
242  {
243  pGridWin[i]->SetMapMode(pGridWin[i]->GetDrawMapMode());
244 
245  pGridWin[i]->PaintImmediately(); // because of Invalidate in DrawView ctor (ShowPage),
246  // so that immediately can be drawn
247  }
248  SfxRequest aSfxRequest(SID_OBJECT_SELECT, SfxCallMode::SLOT, aViewData.GetViewShell()->GetPool());
249  SetDrawFuncPtr(new FuSelection(*aViewData.GetViewShell(), GetActiveWin(), pDrawView.get(),
250  pLayer,aSfxRequest));
251 
252  // used when switching back from page preview: restore saved design mode state
253  // (otherwise, keep the default from the draw view ctor)
254  if ( nForceDesignMode != TRISTATE_INDET )
255  pDrawView->SetDesignMode( nForceDesignMode != TRISTATE_FALSE );
256 
257  // register at FormShell
258  FmFormShell* pFormSh = aViewData.GetViewShell()->GetFormShell();
259  if (pFormSh)
260  pFormSh->SetView(pDrawView.get());
261 
262  if (aViewData.GetViewShell()->HasAccessibilityObjects())
263  aViewData.GetViewShell()->BroadcastAccessibility(SfxHint(SfxHintId::ScAccMakeDrawLayer));
264 }
265 
267 {
268  if (pDrawView)
269  {
270  pDrawView->AddWindowToPaintView(pWin, nullptr);
271 
272  pWin->DrawLayerCreated();
273  }
274 }
275 
276 void ScTabView::TabChanged( bool bSameTabButMoved )
277 {
278  if (pDrawView)
279  {
280  DrawDeselectAll(); // end also text edit mode
281 
282  SCTAB nTab = aViewData.GetTabNo();
283  pDrawView->HideSdrPage();
284  pDrawView->ShowSdrPage(pDrawView->GetModel()->GetPage(nTab));
285 
286  UpdateLayerLocks();
287 
288  pDrawView->RecalcScale();
289  pDrawView->UpdateWorkArea(); // PageSize is different per page
290  }
291 
292  SfxBindings& rBindings = aViewData.GetBindings();
293 
294  // There is no easy way to invalidate all slots of the FormShell
295  // (for disabled slots on protected tables), therefore simply everything...
296  rBindings.InvalidateAll(false);
297 
298  if (aViewData.GetViewShell()->HasAccessibilityObjects())
299  {
300  SfxHint aAccHint(SfxHintId::ScAccTableChanged);
301  aViewData.GetViewShell()->BroadcastAccessibility(aAccHint);
302  }
303 
304  // notification for XActivationBroadcaster
305  SfxViewFrame* pViewFrame = aViewData.GetViewShell()->GetViewFrame();
306  if (pViewFrame)
307  {
308  uno::Reference<frame::XController> xController = pViewFrame->GetFrame().GetController();
309  if (xController.is())
310  {
311  ScTabViewObj* pImp = comphelper::getUnoTunnelImplementation<ScTabViewObj>( xController );
312  if (pImp)
313  pImp->SheetChanged( bSameTabButMoved );
314  }
315  }
316 
318  return;
319 
320  ScDocShell* pDocSh = GetViewData().GetDocShell();
321  ScModelObj* pModelObj = pDocSh ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocSh->GetModel()) : nullptr;
322 
323  if (!pModelObj)
324  return;
325 
326  Size aDocSize = pModelObj->getDocumentSize();
327  std::stringstream ss;
328  ss << aDocSize.Width() << ", " << aDocSize.Height();
329  OString sRect = ss.str().c_str();
330  ScTabViewShell* pViewShell = aViewData.GetViewShell();
331 
332  // Invalidate first
333  tools::Rectangle aRectangle(0, 0, 1000000000, 1000000000);
334  OString sPayload = aRectangle.toString() + ", " + OString::number(aViewData.GetTabNo());
335  pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sPayload.getStr());
336 
337  ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument());
338  SfxLokHelper::notifyDocumentSizeChanged(pViewShell, sRect, pModel, false);
339 }
340 
342 {
343  if (!pDrawView)
344  return;
345 
346  SCTAB nTab = aViewData.GetTabNo();
347  bool bEx = aViewData.GetViewShell()->IsDrawSelMode();
348  bool bProt = aViewData.GetDocument().IsTabProtected( nTab ) ||
349  aViewData.GetSfxDocShell()->IsReadOnly();
350  bool bShared = aViewData.GetDocShell()->IsDocShared();
351 
352  SdrLayer* pLayer;
353  SdrLayerAdmin& rAdmin = pDrawView->GetModel()->GetLayerAdmin();
354  pLayer = rAdmin.GetLayerPerID(SC_LAYER_BACK);
355  if (pLayer)
356  pDrawView->SetLayerLocked( pLayer->GetName(), bProt || !bEx || bShared );
357  pLayer = rAdmin.GetLayerPerID(SC_LAYER_INTERN);
358  if (pLayer)
359  pDrawView->SetLayerLocked( pLayer->GetName() );
360  pLayer = rAdmin.GetLayerPerID(SC_LAYER_FRONT);
361  if (pLayer)
362  pDrawView->SetLayerLocked( pLayer->GetName(), bProt || bShared );
363  pLayer = rAdmin.GetLayerPerID(SC_LAYER_CONTROLS);
364  if (pLayer)
365  pDrawView->SetLayerLocked( pLayer->GetName(), bProt || bShared );
366  pLayer = rAdmin.GetLayerPerID(SC_LAYER_HIDDEN);
367  if (pLayer)
368  {
369  pDrawView->SetLayerLocked( pLayer->GetName(), bProt || bShared );
370  pDrawView->SetLayerVisible( pLayer->GetName(), false);
371  }
372 }
373 
375 {
376  if (!pDrawView)
377  return;
378 
379  ScTabViewShell* pViewSh = aViewData.GetViewShell();
380  if ( pDrawActual &&
381  ( pViewSh->IsDrawTextShell() || pDrawActual->GetSlotID() == SID_DRAW_NOTEEDIT ) )
382  {
383  // end text edit (as if escape pressed, in FuDraw)
384  aViewData.GetDispatcher().Execute( pDrawActual->GetSlotID(),
385  SfxCallMode::SLOT | SfxCallMode::RECORD );
386  }
387 
388  pDrawView->ScEndTextEdit();
389  pDrawView->UnmarkAll();
390 
391  if (!pViewSh->IsDrawSelMode())
392  pViewSh->SetDrawShell( false );
393 }
394 
396 {
397  if (pDrawView)
398  return pDrawView->IsTextEdit();
399  else
400  return false;
401 }
402 
404 {
405  return aViewData.GetZoomType();
406 }
407 
408 void ScTabView::SetZoomType( SvxZoomType eNew, bool bAll )
409 {
410  aViewData.SetZoomType( eNew, bAll );
411 }
412 
413 void ScTabView::SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAll )
414 {
415  aViewData.SetZoom( rNewX, rNewY, bAll );
416  if (pDrawView)
417  pDrawView->RecalcScale();
418  ZoomChanged();
419 }
420 
422 {
423  aViewData.RefreshZoom();
424  if (pDrawView)
425  pDrawView->RecalcScale();
426  ZoomChanged();
427 }
428 
430 {
431  aViewData.SetPagebreakMode(bSet);
432  if (pDrawView)
433  pDrawView->RecalcScale();
434  ZoomChanged();
435 }
436 
438 {
439  if (pDrawView)
440  pDrawView->SetDragMode( SdrDragMode::Move );
441 }
442 
443 void ScTabView::ViewOptionsHasChanged( bool bHScrollChanged, bool bGraphicsChanged )
444 {
445  // create DrawView when grid should be displayed
446  if ( !pDrawView && aViewData.GetOptions().GetGridOptions().GetGridVisible() )
447  MakeDrawLayer();
448 
449  if (pDrawView)
450  pDrawView->UpdateUserViewOptions();
451 
452  if (bGraphicsChanged)
453  DrawEnableAnim(true); // DrawEnableAnim checks the options state
454 
455  // if TabBar is set to visible, make sure its size is not 0
456  bool bGrow = ( aViewData.IsTabMode() && pTabControl->GetSizePixel().Width() <= 0 );
457 
458  // if ScrollBar is set to visible, TabBar must make room
459  bool bShrink = ( bHScrollChanged && aViewData.IsTabMode() && aViewData.IsHScrollMode() &&
460  pTabControl->GetSizePixel().Width() > SC_TABBAR_DEFWIDTH );
461 
462  if ( bGrow || bShrink )
463  {
464  Size aSize = pTabControl->GetSizePixel();
465  aSize.setWidth( SC_TABBAR_DEFWIDTH ); // initial size
466  pTabControl->SetSizePixel(aSize); // DoResize is called later...
467  }
468 }
469 
470 // helper function against including the drawing layer
471 
473 {
474  if ( pDrawView )
475  pDrawView->MarkListHasChanged();
476 }
477 
479 {
480  if ( pDrawView )
481  pDrawView->AdjustMarkHdl();
482 }
483 
485 {
486  if ( pDrawView )
487  pDrawView->UpdateIMap( pObj );
488 }
489 
491 {
492  sal_uInt16 i;
493  if ( !pDrawView )
494  return;
495 
496  // don't start animations if display of graphics is disabled
497  // graphics are controlled by VOBJ_TYPE_OLE
498  if ( bSet && aViewData.GetOptions().GetObjMode(VOBJ_TYPE_OLE) == VOBJ_MODE_SHOW )
499  {
500  if ( !pDrawView->IsAnimationEnabled() )
501  {
502  pDrawView->SetAnimationEnabled();
503 
504  // animated GIFs must be restarted:
505  ScDocument& rDoc = aViewData.GetDocument();
506  for (i=0; i<4; i++)
507  if ( pGridWin[i] && pGridWin[i]->IsVisible() )
508  rDoc.StartAnimations( aViewData.GetTabNo() );
509  }
510  }
511  else
512  {
513  pDrawView->SetAnimationEnabled(false);
514  }
515 }
516 
518 {
519  if ( pDrawView )
520  {
521  Outliner* pOL = pDrawView->GetTextEditOutliner();
522  if (pOL)
523  aViewData.UpdateOutlinerFlags( *pOL );
524  }
525 }
526 
528 {
529  LanguageType eNewLang = SC_MOD()->GetOptDigitLanguage();
530  for (VclPtr<ScGridWindow> & pWin : pGridWin)
531  if ( pWin )
532  pWin->SetDigitLanguage( eNewLang );
533 }
534 
535 void ScTabView::ScrollToObject( const SdrObject* pDrawObj )
536 {
537  if ( pDrawObj )
538  {
539  // #i118524# use the BoundRect, this defines the visible area
540  MakeVisible(pDrawObj->GetCurrentBoundRect());
541  }
542 }
543 
545 {
546  vcl::Window* pWin = GetActiveWin();
547  Size aWinSize = pWin->GetOutputSizePixel();
548  SCTAB nTab = aViewData.GetTabNo();
549 
550  tools::Rectangle aRect = pWin->LogicToPixel( rHMMRect );
551 
552  tools::Long nScrollX=0, nScrollY=0; // pixel
553 
554  if ( aRect.Right() >= aWinSize.Width() ) // right out
555  {
556  nScrollX = aRect.Right() - aWinSize.Width() + 1; // right border visible
557  if ( aRect.Left() < nScrollX )
558  nScrollX = aRect.Left(); // left visible (if too big)
559  }
560  if ( aRect.Bottom() >= aWinSize.Height() ) // bottom out
561  {
562  nScrollY = aRect.Bottom() - aWinSize.Height() + 1; // bottom border visible
563  if ( aRect.Top() < nScrollY )
564  nScrollY = aRect.Top(); // top visible (if too big)
565  }
566 
567  if ( aRect.Left() < 0 ) // left out
568  nScrollX = aRect.Left(); // left border visible
569  if ( aRect.Top() < 0 ) // top out
570  nScrollY = aRect.Top(); // top border visible
571 
572  if (!(nScrollX || nScrollY))
573  return;
574 
575  ScDocument& rDoc = aViewData.GetDocument();
576  if ( rDoc.IsNegativePage( nTab ) )
577  nScrollX = -nScrollX;
578 
579  double nPPTX = aViewData.GetPPTX();
580  double nPPTY = aViewData.GetPPTY();
581  ScSplitPos eWhich = aViewData.GetActivePart();
582  SCCOL nPosX = aViewData.GetPosX(WhichH(eWhich));
583  SCROW nPosY = aViewData.GetPosY(WhichV(eWhich));
584 
585  tools::Long nLinesX=0, nLinesY=0; // columns/rows - scroll at least nScrollX/Y
586 
587  if (nScrollX > 0)
588  while (nScrollX > 0 && nPosX < rDoc.MaxCol())
589  {
590  nScrollX -= static_cast<tools::Long>( rDoc.GetColWidth(nPosX, nTab) * nPPTX );
591  ++nPosX;
592  ++nLinesX;
593  }
594  else if (nScrollX < 0)
595  while (nScrollX < 0 && nPosX > 0)
596  {
597  --nPosX;
598  nScrollX += static_cast<tools::Long>( rDoc.GetColWidth(nPosX, nTab) * nPPTX );
599  --nLinesX;
600  }
601 
602  if (nScrollY > 0)
603  while (nScrollY > 0 && nPosY < rDoc.MaxRow())
604  {
605  nScrollY -= static_cast<tools::Long>( rDoc.GetRowHeight(nPosY, nTab) * nPPTY );
606  ++nPosY;
607  ++nLinesY;
608  }
609  else if (nScrollY < 0)
610  while (nScrollY < 0 && nPosY > 0)
611  {
612  --nPosY;
613  nScrollY += static_cast<tools::Long>( rDoc.GetRowHeight(nPosY, nTab) * nPPTY );
614  --nLinesY;
615  }
616 
617  ScrollLines( nLinesX, nLinesY ); // execute
618 }
619 
621 {
622  pDrawBrushSet.reset();
623  pBrushDocument = std::move(pNew);
624 
625  bLockPaintBrush = bLock;
626 
627  aViewData.GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
628 }
629 
630 void ScTabView::SetDrawBrushSet( std::unique_ptr<SfxItemSet> pNew, bool bLock )
631 {
632  pBrushDocument.reset();
633  pDrawBrushSet = std::move(pNew);
634 
635  bLockPaintBrush = bLock;
636 
637  aViewData.GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
638 }
639 
641 {
642  if ( HasPaintBrush() )
643  {
644  SetBrushDocument( nullptr, false );
645  SetActivePointer( PointerStyle::Arrow ); // switch pointers also when ended with escape key
646  }
647 }
648 
650 {
652  return;
653 
654  const SdrCaptionObj* pCaption = pNote->GetCaption();
655  if (!pCaption) return;
656 
657  tools::Rectangle aRect = pCaption->GetLogicRect();
658  basegfx::B2DRange aTailRange = pCaption->getTailPolygon().getB2DRange();
659  tools::Rectangle aTailRect(aTailRange.getMinX(), aTailRange.getMinY(),
660  aTailRange.getMaxX(), aTailRange.getMaxY());
661  aRect.Union( aTailRect );
662 
663  // This is a temporary workaround: sometime in tiled rendering mode
664  // the tip of the note arrow is misplaced by a fixed offset.
665  // The value used below is enough to get the tile, where the arrow tip is
666  // placed, invalidated.
667  const int nBorderSize = 200;
668  tools::Rectangle aInvalidRect = aRect;
669  aInvalidRect.AdjustLeft( -nBorderSize );
670  aInvalidRect.AdjustRight( nBorderSize );
671  aInvalidRect.AdjustTop( -nBorderSize );
672  aInvalidRect.AdjustBottom( nBorderSize );
673 
674  SfxViewShell* pCurrentViewShell = SfxViewShell::Current();
675  SfxViewShell* pViewShell = SfxViewShell::GetFirst();
676  while (pViewShell)
677  {
678  ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
679  if (pTabViewShell && pViewShell->GetDocId() == pCurrentViewShell->GetDocId())
680  {
681  for (auto& pWin: pTabViewShell->pGridWin)
682  {
683  if (pWin && pWin->IsVisible())
684  {
685  pWin->Invalidate(aInvalidRect);
686  }
687  }
688  }
689  pViewShell = SfxViewShell::GetNext(*pViewShell);
690  }
691 }
692 
693 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxViewFrame * GetViewFrame() const
SvxZoomType GetZoomType() const
Definition: tabview5.cxx:403
constexpr double nPPTY
void ResetBrushDocument()
Definition: tabview5.cxx:640
bool IsDrawSelMode() const
Definition: tabview.hxx:315
static void notifyDocumentSizeChanged(SfxViewShell const *pThisView, const OString &rPayload, vcl::ITiledRenderable *pDoc, bool bInvalidateAll=true)
virtual const tools::Rectangle & GetCurrentBoundRect() const
#define SC_TABBAR_DEFWIDTH
Definition: tabcont.hxx:30
ScVSplitPos WhichV(ScSplitPos ePos)
Definition: viewdata.hxx:710
void RemoveWindowFromForeignEditView(SfxViewShell *pViewShell, ScSplitPos eWhich)
Definition: tabview3.cxx:2036
SC_DLLPUBLIC void RefreshZoom()
Definition: tabview5.cxx:421
SC_DLLPUBLIC bool IsNegativePage(SCTAB nTab) const
Definition: document.cxx:1002
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
void setWidth(tools::Long nWidth)
void SetBrushDocument(ScDocumentUniquePtr pNew, bool bLock)
Definition: tabview5.cxx:620
void SetPagebreakMode(bool bSet)
Definition: tabview5.cxx:429
long Long
ScHSplitPos WhichH(ScSplitPos ePos)
Definition: viewdata.hxx:704
virtual const tools::Rectangle & GetLogicRect() const override
ViewShellDocId GetDocId() const override
void DrawLayerCreated()
Definition: gridwin.cxx:5492
bool HasEditView(ScSplitPos eWhich) const
Definition: viewdata.hxx:564
constexpr SdrLayerID SC_LAYER_BACK(1)
void ViewOptionsHasChanged(bool bHScrollChanged, bool bGraphicsChanged)
Definition: tabview5.cxx:443
void UpdateIMap(SdrObject *pObj)
Definition: tabview5.cxx:484
::basegfx::B2DPolygon getTailPolygon() const
void SheetChanged(bool bSameTabButMoved)
Definition: viewuno.cxx:534
WinBits const WB_VSCROLL
Base class for all functions.
Definition: fusel.hxx:28
css::uno::Reference< css::frame::XModel > GetModel() const
void TabChanged(bool bSameTabButMoved=false)
Called after moving, copying, inserting or deleting a sheet.
Definition: tabview5.cxx:276
static void forEachOtherView(ViewShellType *pThisViewShell, FunctionType f)
double getMaxX() const
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4161
void StartAnimations(SCTAB nTab)
Definition: documen9.cxx:317
ScSplitPos
Definition: viewdata.hxx:45
sal_Int64 WinBits
Reference< XController > xController
tools::Long Left() const
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:873
Additional class containing cell annotation data.
Definition: postit.hxx:160
WinBits const WB_HSCROLL
SfxFrame & GetFrame() const
static SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
tools::Long Bottom() const
static SfxViewShell * Current()
void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
bool IsDrawTextShell() const
Definition: tabvwsh4.cxx:991
void DrawMarkListHasChanged()
Definition: tabview5.cxx:472
const tools::Long nScrollY
double getMaxY() const
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
TRISTATE_INDET
void SetView(FmFormView *pView)
void ScrollToObject(const SdrObject *pDrawObj)
Definition: tabview5.cxx:535
const tools::Long nScrollX
constexpr double nPPTX
ScDocument * GetDocument() const
Definition: drwlayer.hxx:122
void SetZoom(const Fraction &rNewX, const Fraction &rNewY, bool bAll)
Definition: tabview5.cxx:413
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1059
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:872
SfxDispatcher * GetDispatcher() const
int i
void DoAddWin(ScGridWindow *pWin)
Definition: tabview5.cxx:266
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2613
sal_Int16 SCCOL
Definition: types.hxx:22
#define SC_MOD()
Definition: scmod.hxx:253
TRISTATE_FALSE
void DrawEnableAnim(bool bSet)
Definition: tabview5.cxx:490
tools::Long Width() const
void SetDrawShell(bool bActive)
Definition: tabvwsh4.cxx:596
const OUString & GetName() const
static bool GetLayoutRTL()
virtual css::uno::Reference< css::frame::XModel > GetCurrentDocument() const
SdrLayer * GetLayerPerID(SdrLayerID nID)
void MakeVisible(const tools::Rectangle &rHMMRect)
Definition: tabview5.cxx:544
void ResetDrawDragMode()
Definition: tabview5.cxx:437
static void ClearSelection(vcl::Window *pWindow)
Size GetOutputSizePixel() const
tools::Long Top() const
static SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
SfxViewShell * GetViewShell() const
ScSelectionTransferObj * GetSelectionTransfer() const
Definition: scmod.hxx:155
tools::Long AdjustTop(tools::Long nVertMoveDelta)
void DigitLanguageChanged()
Definition: tabview5.cxx:527
Point LogicToPixel(const Point &rLogicPt) const
WinBits const WB_SIZEABLE
B2DRange const & getB2DRange() const
sal_Int32 SCROW
Definition: types.hxx:18
SdrCaptionObj * GetCaption() const
Returns an existing note caption object.
Definition: postit.hxx:237
double getMinY() const
constexpr SdrLayerID SC_LAYER_HIDDEN(4)
tools::Rectangle & Union(const tools::Rectangle &rRect)
void DrawDeselectAll()
Definition: tabview5.cxx:374
virtual void Invalidate(sal_uInt16 nId=0)
constexpr SdrLayerID SC_LAYER_FRONT(0)
bool IsDrawTextEdit() const
Definition: tabview5.cxx:395
css::uno::Reference< css::frame::XController > GetController() const
constexpr SdrLayerID SC_LAYER_INTERN(2)
static VclPtr< reference_type > Create(Arg &&...arg)
tools::Long Height() const
static void OnLOKNoteStateChanged(const ScPostIt *pNote)
Definition: tabview5.cxx:649
void UpdateAnchorHandles()
Definition: tabview5.cxx:478
void SetSelectionTransfer(ScSelectionTransferObj *pNew)
Definition: scmod.cxx:650
void SetZoomType(SvxZoomType eNew, bool bAll)
Definition: tabview5.cxx:408
void InvalidateAll(bool bWithMsg)
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
double getMinX() const
void UpdateDrawTextOutliner()
Definition: tabview5.cxx:517
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
SvxZoomType
void UpdateLayerLocks()
Definition: tabview5.cxx:341
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4120
TriState
rtl::OString toString() const
constexpr SdrLayerID SC_LAYER_CONTROLS(3)
void SetDrawBrushSet(std::unique_ptr< SfxItemSet > pNew, bool bLock)
Definition: tabview5.cxx:630
tools::Long Right() const
sal_Int16 SCTAB
Definition: types.hxx:23
virtual Size getDocumentSize() override
Definition: docuno.cxx:650
void MakeDrawView(TriState nForceDesignMode)
Definition: tabview5.cxx:223
ScTabView * GetView() const
Definition: seltrans.hxx:62
void Init()
Definition: tabview5.cxx:58