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