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  {
227  ScDrawLayer* pLayer = aViewData.GetDocument()->GetDrawLayer();
228  OSL_ENSURE(pLayer, "Where is the Draw Layer ??");
229 
230  sal_uInt16 i;
231  pDrawView.reset( new ScDrawView( pGridWin[SC_SPLIT_BOTTOMLEFT], &aViewData ) );
232  for (i=0; i<4; i++)
233  if (pGridWin[i])
234  {
235  if ( SC_SPLIT_BOTTOMLEFT != static_cast<ScSplitPos>(i) )
236  pDrawView->AddWindowToPaintView(pGridWin[i], nullptr);
237  }
238  pDrawView->RecalcScale();
239  for (i=0; i<4; i++)
240  if (pGridWin[i])
241  {
242  pGridWin[i]->SetMapMode(pGridWin[i]->GetDrawMapMode());
243 
244  pGridWin[i]->PaintImmediately(); // because of Invalidate in DrawView ctor (ShowPage),
245  // so that immediately can be drawn
246  }
247  SfxRequest aSfxRequest(SID_OBJECT_SELECT, SfxCallMode::SLOT, aViewData.GetViewShell()->GetPool());
248  SetDrawFuncPtr(new FuSelection(*aViewData.GetViewShell(), GetActiveWin(), pDrawView.get(),
249  pLayer,aSfxRequest));
250 
251  // used when switching back from page preview: restore saved design mode state
252  // (otherwise, keep the default from the draw view ctor)
253  if ( nForceDesignMode != TRISTATE_INDET )
254  pDrawView->SetDesignMode( nForceDesignMode != TRISTATE_FALSE );
255 
256  // register at FormShell
257  FmFormShell* pFormSh = aViewData.GetViewShell()->GetFormShell();
258  if (pFormSh)
259  pFormSh->SetView(pDrawView.get());
260 
261  if (aViewData.GetViewShell()->HasAccessibilityObjects())
262  aViewData.GetViewShell()->BroadcastAccessibility(SfxHint(SfxHintId::ScAccMakeDrawLayer));
263 
264  }
265 }
266 
268 {
269  if (pDrawView)
270  {
271  pDrawView->AddWindowToPaintView(pWin, nullptr);
272 
273  pWin->DrawLayerCreated();
274  }
275 }
276 
277 void ScTabView::TabChanged( bool bSameTabButMoved )
278 {
279  if (pDrawView)
280  {
281  DrawDeselectAll(); // end also text edit mode
282 
283  SCTAB nTab = aViewData.GetTabNo();
284  pDrawView->HideSdrPage();
285  pDrawView->ShowSdrPage(pDrawView->GetModel()->GetPage(nTab));
286 
287  UpdateLayerLocks();
288 
289  pDrawView->RecalcScale();
290  pDrawView->UpdateWorkArea(); // PageSize is different per page
291  }
292 
293  SfxBindings& rBindings = aViewData.GetBindings();
294 
295  // There is no easy way to invalidate all slots of the FormShell
296  // (for disabled slots on protected tables), therefore simply everything...
297  rBindings.InvalidateAll(false);
298 
299  if (aViewData.GetViewShell()->HasAccessibilityObjects())
300  {
301  SfxHint aAccHint(SfxHintId::ScAccTableChanged);
302  aViewData.GetViewShell()->BroadcastAccessibility(aAccHint);
303  }
304 
305  // notification for XActivationBroadcaster
306  SfxViewFrame* pViewFrame = aViewData.GetViewShell()->GetViewFrame();
307  if (pViewFrame)
308  {
309  uno::Reference<frame::XController> xController = pViewFrame->GetFrame().GetController();
310  if (xController.is())
311  {
312  ScTabViewObj* pImp = comphelper::getUnoTunnelImplementation<ScTabViewObj>( xController );
313  if (pImp)
314  pImp->SheetChanged( bSameTabButMoved );
315  }
316  }
317 
319  {
320  ScDocShell* pDocSh = GetViewData().GetDocShell();
321  ScModelObj* pModelObj = pDocSh ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocSh->GetModel()) : nullptr;
322 
323  if (pModelObj && GetViewData().GetDocument())
324  {
325  Size aDocSize = pModelObj->getDocumentSize();
326  std::stringstream ss;
327  ss << aDocSize.Width() << ", " << aDocSize.Height();
328  OString sRect = ss.str().c_str();
329  ScTabViewShell* pViewShell = aViewData.GetViewShell();
330 
331  // Invalidate first
332  tools::Rectangle aRectangle(0, 0, 1000000000, 1000000000);
333  OString sPayload = aRectangle.toString() + ", " + OString::number(aViewData.GetTabNo());
334  pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sPayload.getStr());
335 
336  ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument());
337  SfxLokHelper::notifyDocumentSizeChanged(pViewShell, sRect, pModel, false);
338  }
339  }
340 }
341 
343 {
344  if (pDrawView)
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 }
374 
376 {
377  if (pDrawView)
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 }
395 
397 {
398  if (pDrawView)
399  return pDrawView->IsTextEdit();
400  else
401  return false;
402 }
403 
405 {
406  return aViewData.GetZoomType();
407 }
408 
409 void ScTabView::SetZoomType( SvxZoomType eNew, bool bAll )
410 {
411  aViewData.SetZoomType( eNew, bAll );
412 }
413 
414 void ScTabView::SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAll )
415 {
416  aViewData.SetZoom( rNewX, rNewY, bAll );
417  if (pDrawView)
418  pDrawView->RecalcScale();
419  ZoomChanged();
420 }
421 
423 {
424  aViewData.RefreshZoom();
425  if (pDrawView)
426  pDrawView->RecalcScale();
427  ZoomChanged();
428 }
429 
431 {
432  aViewData.SetPagebreakMode(bSet);
433  if (pDrawView)
434  pDrawView->RecalcScale();
435  ZoomChanged();
436 }
437 
439 {
440  if (pDrawView)
441  pDrawView->SetDragMode( SdrDragMode::Move );
442 }
443 
444 void ScTabView::ViewOptionsHasChanged( bool bHScrollChanged, bool bGraphicsChanged )
445 {
446  // create DrawView when grid should be displayed
447  if ( !pDrawView && aViewData.GetOptions().GetGridOptions().GetGridVisible() )
448  MakeDrawLayer();
449 
450  if (pDrawView)
451  pDrawView->UpdateUserViewOptions();
452 
453  if (bGraphicsChanged)
454  DrawEnableAnim(true); // DrawEnableAnim checks the options state
455 
456  // if TabBar is set to visible, make sure its size is not 0
457  bool bGrow = ( aViewData.IsTabMode() && pTabControl->GetSizePixel().Width() <= 0 );
458 
459  // if ScrollBar is set to visible, TabBar must make room
460  bool bShrink = ( bHScrollChanged && aViewData.IsTabMode() && aViewData.IsHScrollMode() &&
461  pTabControl->GetSizePixel().Width() > SC_TABBAR_DEFWIDTH );
462 
463  if ( bGrow || bShrink )
464  {
465  Size aSize = pTabControl->GetSizePixel();
466  aSize.setWidth( SC_TABBAR_DEFWIDTH ); // initial size
467  pTabControl->SetSizePixel(aSize); // DoResize is called later...
468  }
469 }
470 
471 // helper function against including the drawing layer
472 
474 {
475  if ( pDrawView )
476  pDrawView->MarkListHasChanged();
477 }
478 
480 {
481  if ( pDrawView )
482  pDrawView->AdjustMarkHdl();
483 }
484 
486 {
487  if ( pDrawView )
488  pDrawView->UpdateIMap( pObj );
489 }
490 
492 {
493  sal_uInt16 i;
494  if ( pDrawView )
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* pDoc = aViewData.GetDocument();
506  for (i=0; i<4; i++)
507  if ( pGridWin[i] && pGridWin[i]->IsVisible() )
508  pDoc->StartAnimations( aViewData.GetTabNo() );
509  }
510  }
511  else
512  {
513  pDrawView->SetAnimationEnabled(false);
514  }
515  }
516 }
517 
519 {
520  if ( pDrawView )
521  {
522  Outliner* pOL = pDrawView->GetTextEditOutliner();
523  if (pOL)
524  aViewData.UpdateOutlinerFlags( *pOL );
525  }
526 }
527 
529 {
530  LanguageType eNewLang = SC_MOD()->GetOptDigitLanguage();
531  for (VclPtr<ScGridWindow> & pWin : pGridWin)
532  if ( pWin )
533  pWin->SetDigitLanguage( eNewLang );
534 }
535 
536 void ScTabView::ScrollToObject( const SdrObject* pDrawObj )
537 {
538  if ( pDrawObj )
539  {
540  // #i118524# use the BoundRect, this defines the visible area
541  MakeVisible(pDrawObj->GetCurrentBoundRect());
542  }
543 }
544 
546 {
547  vcl::Window* pWin = GetActiveWin();
548  Size aWinSize = pWin->GetOutputSizePixel();
549  SCTAB nTab = aViewData.GetTabNo();
550 
551  tools::Rectangle aRect = pWin->LogicToPixel( rHMMRect );
552 
553  long nScrollX=0, nScrollY=0; // pixel
554 
555  if ( aRect.Right() >= aWinSize.Width() ) // right out
556  {
557  nScrollX = aRect.Right() - aWinSize.Width() + 1; // right border visible
558  if ( aRect.Left() < nScrollX )
559  nScrollX = aRect.Left(); // left visible (if too big)
560  }
561  if ( aRect.Bottom() >= aWinSize.Height() ) // bottom out
562  {
563  nScrollY = aRect.Bottom() - aWinSize.Height() + 1; // bottom border visible
564  if ( aRect.Top() < nScrollY )
565  nScrollY = aRect.Top(); // top visible (if too big)
566  }
567 
568  if ( aRect.Left() < 0 ) // left out
569  nScrollX = aRect.Left(); // left border visible
570  if ( aRect.Top() < 0 ) // top out
571  nScrollY = aRect.Top(); // top border visible
572 
573  if (nScrollX || nScrollY)
574  {
575  ScDocument* pDoc = aViewData.GetDocument();
576  if ( pDoc->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  long nLinesX=0, nLinesY=0; // columns/rows - scroll at least nScrollX/Y
586 
587  if (nScrollX > 0)
588  while (nScrollX > 0 && nPosX < pDoc->MaxCol())
589  {
590  nScrollX -= static_cast<long>( pDoc->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<long>( pDoc->GetColWidth(nPosX, nTab) * nPPTX );
599  --nLinesX;
600  }
601 
602  if (nScrollY > 0)
603  while (nScrollY > 0 && nPosY < pDoc->MaxRow())
604  {
605  nScrollY -= static_cast<long>( pDoc->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<long>( pDoc->GetRowHeight(nPosY, nTab) * nPPTY );
614  --nLinesY;
615  }
616 
617  ScrollLines( nLinesX, nLinesY ); // execute
618  }
619 }
620 
622 {
623  pDrawBrushSet.reset();
624  pBrushDocument = std::move(pNew);
625 
626  bLockPaintBrush = bLock;
627 
628  aViewData.GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
629 }
630 
631 void ScTabView::SetDrawBrushSet( std::unique_ptr<SfxItemSet> pNew, bool bLock )
632 {
633  pBrushDocument.reset();
634  pDrawBrushSet = std::move(pNew);
635 
636  bLockPaintBrush = bLock;
637 
638  aViewData.GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
639 }
640 
642 {
643  if ( HasPaintBrush() )
644  {
645  SetBrushDocument( nullptr, false );
646  SetActivePointer( PointerStyle::Arrow ); // switch pointers also when ended with escape key
647  }
648 }
649 
651 {
653  return;
654 
655  const SdrCaptionObj* pCaption = pNote->GetCaption();
656  if (!pCaption) return;
657 
658  tools::Rectangle aRect = pCaption->GetLogicRect();
659  basegfx::B2DRange aTailRange = pCaption->getTailPolygon().getB2DRange();
660  tools::Rectangle aTailRect(aTailRange.getMinX(), aTailRange.getMinY(),
661  aTailRange.getMaxX(), aTailRange.getMaxY());
662  aRect.Union( aTailRect );
663 
664  // This is a temporary workaround: sometime in tiled rendering mode
665  // the tip of the note arrow is misplaced by a fixed offset.
666  // The value used below is enough to get the tile, where the arrow tip is
667  // placed, invalidated.
668  const int nBorderSize = 200;
669  tools::Rectangle aInvalidRect = aRect;
670  aInvalidRect.AdjustLeft( -nBorderSize );
671  aInvalidRect.AdjustRight( nBorderSize );
672  aInvalidRect.AdjustTop( -nBorderSize );
673  aInvalidRect.AdjustBottom( nBorderSize );
674 
675  SfxViewShell* pCurrentViewShell = SfxViewShell::Current();
676  SfxViewShell* pViewShell = SfxViewShell::GetFirst();
677  while (pViewShell)
678  {
679  ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
680  if (pTabViewShell && pViewShell->GetDocId() == pCurrentViewShell->GetDocId())
681  {
682  for (auto& pWin: pTabViewShell->pGridWin)
683  {
684  if (pWin && pWin->IsVisible())
685  {
686  pWin->Invalidate(aInvalidRect);
687  }
688  }
689  }
690  pViewShell = SfxViewShell::GetNext(*pViewShell);
691  }
692 }
693 
694 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxViewFrame * GetViewFrame() const
long Width() const
const long nScrollY
SvxZoomType GetZoomType() const
Definition: tabview5.cxx:404
constexpr double nPPTY
void ResetBrushDocument()
Definition: tabview5.cxx:641
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:714
void RemoveWindowFromForeignEditView(SfxViewShell *pViewShell, ScSplitPos eWhich)
Definition: tabview3.cxx:2029
SC_DLLPUBLIC void RefreshZoom()
Definition: tabview5.cxx:422
SC_DLLPUBLIC bool IsNegativePage(SCTAB nTab) const
Definition: document.cxx:1001
void SetBrushDocument(ScDocumentUniquePtr pNew, bool bLock)
Definition: tabview5.cxx:621
long Height() const
long AdjustLeft(long nHorzMoveDelta)
void SetPagebreakMode(bool bSet)
Definition: tabview5.cxx:430
ScHSplitPos WhichH(ScSplitPos ePos)
Definition: viewdata.hxx:708
virtual const tools::Rectangle & GetLogicRect() const override
ViewShellDocId GetDocId() const override
void DrawLayerCreated()
Definition: gridwin.cxx:5500
bool HasEditView(ScSplitPos eWhich) const
Definition: viewdata.hxx:569
constexpr SdrLayerID SC_LAYER_BACK(1)
void ViewOptionsHasChanged(bool bHScrollChanged, bool bGraphicsChanged)
Definition: tabview5.cxx:444
void UpdateIMap(SdrObject *pObj)
Definition: tabview5.cxx:485
::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:277
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:4163
void StartAnimations(SCTAB nTab)
Definition: documen9.cxx:317
ScSplitPos
Definition: viewdata.hxx:45
long AdjustBottom(long nVertMoveDelta)
const long nScrollX
sal_Int64 WinBits
long Right() const
Reference< XController > xController
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)
static SfxViewShell * Current()
void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
bool IsDrawTextShell() const
Definition: tabvwsh4.cxx:991
long Top() const
void DrawMarkListHasChanged()
Definition: tabview5.cxx:473
double getMaxY() const
TRISTATE_INDET
void SetView(FmFormView *pView)
void ScrollToObject(const SdrObject *pDrawObj)
Definition: tabview5.cxx:536
constexpr double nPPTX
ScDocument * GetDocument() const
Definition: drwlayer.hxx:122
void SetZoom(const Fraction &rNewX, const Fraction &rNewY, bool bAll)
Definition: tabview5.cxx:414
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1062
SfxDispatcher * GetDispatcher() const
int i
void DoAddWin(ScGridWindow *pWin)
Definition: tabview5.cxx:267
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2618
sal_Int16 SCCOL
Definition: types.hxx:22
#define SC_MOD()
Definition: scmod.hxx:253
TRISTATE_FALSE
void DrawEnableAnim(bool bSet)
Definition: tabview5.cxx:491
void SetDrawShell(bool bActive)
Definition: tabvwsh4.cxx:596
const OUString & GetName() const
long Bottom() 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:545
void ResetDrawDragMode()
Definition: tabview5.cxx:438
static void ClearSelection(vcl::Window *pWindow)
Size GetOutputSizePixel() 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
void DigitLanguageChanged()
Definition: tabview5.cxx:528
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)
long AdjustRight(long nHorzMoveDelta)
tools::Rectangle & Union(const tools::Rectangle &rRect)
void DrawDeselectAll()
Definition: tabview5.cxx:375
virtual void Invalidate(sal_uInt16 nId=0)
constexpr SdrLayerID SC_LAYER_FRONT(0)
bool IsDrawTextEdit() const
Definition: tabview5.cxx:396
css::uno::Reference< css::frame::XController > GetController() const
constexpr SdrLayerID SC_LAYER_INTERN(2)
static VclPtr< reference_type > Create(Arg &&...arg)
long AdjustTop(long nVertMoveDelta)
static void OnLOKNoteStateChanged(const ScPostIt *pNote)
Definition: tabview5.cxx:650
long Left() const
void UpdateAnchorHandles()
Definition: tabview5.cxx:479
void SetSelectionTransfer(ScSelectionTransferObj *pNew)
Definition: scmod.cxx:650
void SetZoomType(SvxZoomType eNew, bool bAll)
Definition: tabview5.cxx:409
void InvalidateAll(bool bWithMsg)
double getMinX() const
void UpdateDrawTextOutliner()
Definition: tabview5.cxx:518
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:342
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4122
TriState
rtl::OString toString() const
void setWidth(long nWidth)
constexpr SdrLayerID SC_LAYER_CONTROLS(3)
void SetDrawBrushSet(std::unique_ptr< SfxItemSet > pNew, bool bLock)
Definition: tabview5.cxx:631
sal_Int16 SCTAB
Definition: types.hxx:23
virtual Size getDocumentSize() override
Definition: docuno.cxx:649
void MakeDrawView(TriState nForceDesignMode)
Definition: tabview5.cxx:223
ScTabView * GetView() const
Definition: seltrans.hxx:62
void Init()
Definition: tabview5.cxx:58
ScDocument * GetDocument() const
Definition: docuno.cxx:447