1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
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>
40 #include <pagedata.hxx>
41 #include <hiranges.hxx>
42 #include <drawview.hxx>
43 #include <drwlayer.hxx>
45 #include <seltrans.hxx>
48 #include <viewuno.hxx>
50 #include <spellcheckcontext.hxx>
52 #include <vcl/settings.hxx>
54 #include <comphelper/lok.hxx>
55 #include <comphelper/scopeguard.hxx>
56 #include <officecfg/Office/Calc.hxx>
58 using namespace com::sun::star
;
60 void ScTabView::Init()
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 );
70 mbInlineWithScrollbar
= officecfg::Office::Calc::Layout::Other::TabbarInlineWithScrollbar::get();
72 aScrollTimer
.SetTimeout(10);
73 aScrollTimer
.SetInvokeHandler( LINK( this, ScTabView
, TimerHdl
) );
76 pGridWin
[i
] = nullptr;
77 pGridWin
[SC_SPLIT_BOTTOMLEFT
] = VclPtr
<ScGridWindow
>::Create( pFrameWin
, aViewData
, SC_SPLIT_BOTTOMLEFT
);
79 pSelEngine
.reset( new ScViewSelectionEngine( pGridWin
[SC_SPLIT_BOTTOMLEFT
], this,
80 SC_SPLIT_BOTTOMLEFT
) );
81 aFunctionSet
.SetSelectionEngine( pSelEngine
.get() );
83 pHdrSelEng
.reset( new ScHeaderSelectionEngine( pFrameWin
, &aHdrFunc
) );
85 pColBar
[SC_SPLIT_LEFT
] = VclPtr
<ScColBar
>::Create( pFrameWin
, SC_SPLIT_LEFT
,
86 &aHdrFunc
, pHdrSelEng
.get(), this );
87 pColBar
[SC_SPLIT_RIGHT
] = nullptr;
88 pRowBar
[SC_SPLIT_BOTTOM
] = VclPtr
<ScRowBar
>::Create( pFrameWin
, SC_SPLIT_BOTTOM
,
89 &aHdrFunc
, pHdrSelEng
.get(), this );
90 pRowBar
[SC_SPLIT_TOP
] = nullptr;
92 pColOutline
[i
] = pRowOutline
[i
] = nullptr;
94 pHSplitter
= VclPtr
<ScTabSplitter
>::Create( pFrameWin
, WinBits( WB_HSCROLL
), &aViewData
);
95 pVSplitter
= VclPtr
<ScTabSplitter
>::Create( pFrameWin
, WinBits( WB_VSCROLL
), &aViewData
);
97 // SSA: override default keyboard step size to allow snap to row/column
98 pHSplitter
->SetKeyboardStepSize( 1 );
99 pVSplitter
->SetKeyboardStepSize( 1 );
101 pTabControl
= VclPtr
<ScTabControl
>::Create(pFrameWin
, &aViewData
);
102 if (mbInlineWithScrollbar
)
103 pTabControl
->SetStyle(pTabControl
->GetStyle() | WB_SIZEABLE
);
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() );
111 InitScrollBar( *aHScrollLeft
, aViewData
.GetDocument().MaxCol()+1, LINK(this, ScTabView
, HScrollLeftHdl
) );
112 InitScrollBar( *aHScrollRight
, aViewData
.GetDocument().MaxCol()+1, LINK(this, ScTabView
, HScrollRightHdl
) );
113 InitScrollBar( *aVScrollTop
, aViewData
.GetDocument().MaxRow()+1, LINK(this, ScTabView
, VScrollTopHdl
) );
114 InitScrollBar( *aVScrollBottom
, aViewData
.GetDocument().MaxRow()+1, LINK(this, ScTabView
, VScrollBottomHdl
) );
115 /* #i97900# scrollbars remain in correct RTL mode, needed mirroring etc.
116 is now handled correctly at the respective places. */
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, pHSplitter, pVSplitter
125 pHSplitter
->SetSplitHdl( LINK( this, ScTabView
, SplitHdl
) );
126 pVSplitter
->SetSplitHdl( LINK( this, ScTabView
, SplitHdl
) );
128 // UpdateShow is done during resize or a copy of an existing view from ctor
130 pDrawActual
= nullptr;
133 // DrawView cannot be create in the TabView - ctor
134 // when the ViewShell isn't constructed yet...
135 // The also applies to ViewOptionsHasChanged()
140 ScTabView::~ScTabView()
144 // remove selection object
145 ScModule
* pScMod
= ScModule::get();
146 ScSelectionTransferObj
* pOld
= pScMod
->GetSelectionTransfer();
147 if ( pOld
&& pOld
->GetView() == this )
150 pScMod
->SetSelectionTransfer( nullptr );
151 TransferableHelper::ClearPrimarySelection(); // may delete pOld
154 pBrushDocument
.reset();
155 pDrawBrushSet
.reset();
157 pPageBreakData
.reset();
160 pDrawActual
= nullptr;
164 if (comphelper::LibreOfficeKit::isActive())
166 ScTabViewShell
* pThisViewShell
= GetViewData().GetViewShell();
168 auto lRemoveWindows
=
169 [pThisViewShell
] (ScTabViewShell
* pOtherViewShell
)
171 ScViewData
& rOtherViewData
= pOtherViewShell
->GetViewData();
172 for (int k
= 0; k
< 4; ++k
)
174 if (rOtherViewData
.HasEditView(static_cast<ScSplitPos
>(k
)))
175 pThisViewShell
->RemoveWindowFromForeignEditView(pOtherViewShell
, static_cast<ScSplitPos
>(k
));
179 SfxLokHelper::forEachOtherView(pThisViewShell
, lRemoveWindows
);
182 aViewData
.KillEditView(); // as long as GridWins still exist
189 pDrawView
->DeleteDeviceFromPaintView(*pGridWin
[i
]->GetOutDev());
192 pDrawView
->HideSdrPage();
199 mpSpellCheckCxt
->dispose();
200 mpSpellCheckCxt
.reset();
202 mxInputHintOO
.reset();
204 pGridWin
[i
].disposeAndClear();
210 pColBar
[i
].disposeAndClear();
211 pRowBar
[i
].disposeAndClear();
212 pColOutline
[i
].disposeAndClear();
213 pRowOutline
[i
].disposeAndClear();
216 aCornerButton
.disposeAndClear();
217 aTopButton
.disposeAndClear();
218 aHScrollLeft
.disposeAndClear();
219 aHScrollRight
.disposeAndClear();
220 aVScrollTop
.disposeAndClear();
221 aVScrollBottom
.disposeAndClear();
223 pHSplitter
.disposeAndClear();
224 pVSplitter
.disposeAndClear();
225 pTabControl
.disposeAndClear();
228 void ScTabView::MakeDrawView( TriState nForceDesignMode
)
233 ScDrawLayer
* pLayer
= aViewData
.GetDocument().GetDrawLayer();
234 OSL_ENSURE(pLayer
, "Where is the Draw Layer ??");
237 pDrawView
.reset( new ScDrawView( pGridWin
[SC_SPLIT_BOTTOMLEFT
]->GetOutDev(), &aViewData
) );
241 if ( SC_SPLIT_BOTTOMLEFT
!= static_cast<ScSplitPos
>(i
) )
242 pDrawView
->AddDeviceToPaintView(*pGridWin
[i
]->GetOutDev(), nullptr);
244 pDrawView
->RecalcScale();
248 pGridWin
[i
]->SetMapMode(pGridWin
[i
]->GetDrawMapMode());
250 pGridWin
[i
]->PaintImmediately(); // because of Invalidate in DrawView ctor (ShowPage),
251 // so that immediately can be drawn
253 SfxRequest
aSfxRequest(SID_OBJECT_SELECT
, SfxCallMode::SLOT
, aViewData
.GetViewShell()->GetPool());
254 SetDrawFuncPtr(new FuSelection(*aViewData
.GetViewShell(), GetActiveWin(), pDrawView
.get(),
255 pLayer
,aSfxRequest
));
257 // used when switching back from page preview: restore saved design mode state
258 // (otherwise, keep the default from the draw view ctor)
259 if ( nForceDesignMode
!= TRISTATE_INDET
)
260 pDrawView
->SetDesignMode( nForceDesignMode
!= TRISTATE_FALSE
);
262 // register at FormShell
263 FmFormShell
* pFormSh
= aViewData
.GetViewShell()->GetFormShell();
265 pFormSh
->SetView(pDrawView
.get());
267 if (aViewData
.GetViewShell()->HasAccessibilityObjects())
268 aViewData
.GetViewShell()->BroadcastAccessibility(SfxHint(SfxHintId::ScAccMakeDrawLayer
));
271 void ScTabView::DoAddWin( ScGridWindow
* pWin
)
275 pDrawView
->AddDeviceToPaintView(*pWin
->GetOutDev(), nullptr);
276 pWin
->DrawLayerCreated();
278 pWin
->SetAutoSpellContext(mpSpellCheckCxt
);
281 void ScTabView::ImplTabChanged(bool bSameTabButMoved
)
283 // For kit ignore invalidations during tab change
284 ScTabViewShell
* pViewShell
= aViewData
.GetViewShell();
285 SfxLokCallbackInterface
* pCallback
= pViewShell
->getLibreOfficeKitViewCallback();
286 pViewShell
->setLibreOfficeKitViewCallback(nullptr);
287 comphelper::ScopeGuard
aOutputGuard(
288 [this, pViewShell
, pCallback
] {
289 pViewShell
->setLibreOfficeKitViewCallback(pCallback
);
290 // But possibly update any out of date formulas on the tab we switched to
296 DrawDeselectAll(); // end also text edit mode
298 SCTAB nTab
= aViewData
.GetTabNo();
299 pDrawView
->HideSdrPage();
300 pDrawView
->ShowSdrPage(pDrawView
->GetModel().GetPage(nTab
));
304 pDrawView
->RecalcScale();
305 pDrawView
->UpdateWorkArea(); // PageSize is different per page
308 SfxBindings
& rBindings
= aViewData
.GetBindings();
310 // There is no easy way to invalidate all slots of the FormShell
311 // (for disabled slots on protected tables), therefore simply everything...
312 rBindings
.InvalidateAll(false);
314 if (aViewData
.GetViewShell()->HasAccessibilityObjects())
316 SfxHint
aAccHint(SfxHintId::ScAccTableChanged
);
317 aViewData
.GetViewShell()->BroadcastAccessibility(aAccHint
);
320 // notification for XActivationBroadcaster
321 SfxViewFrame
& rViewFrame
= aViewData
.GetViewShell()->GetViewFrame();
322 uno::Reference
<frame::XController
> xController
= rViewFrame
.GetFrame().GetController();
323 if (xController
.is())
325 ScTabViewObj
* pImp
= dynamic_cast<ScTabViewObj
*>( xController
.get() );
327 pImp
->SheetChanged( bSameTabButMoved
);
330 for (int i
= 0; i
< 4; i
++)
334 pGridWin
[i
]->initiatePageBreaks();
335 // Trigger calculating page breaks only once.
341 void ScTabView::TabChanged( bool bSameTabButMoved
)
343 ImplTabChanged(bSameTabButMoved
);
345 if (!comphelper::LibreOfficeKit::isActive())
348 ScDocShell
* pDocSh
= GetViewData().GetDocShell();
349 ScModelObj
* pModelObj
= pDocSh
? pDocSh
->GetModel() : nullptr;
354 Size aDocSize
= pModelObj
->getDocumentSize();
355 std::stringstream ss
;
356 ss
<< aDocSize
.Width() << ", " << aDocSize
.Height();
357 OString
sRect(ss
.str());
358 ScTabViewShell
* pViewShell
= aViewData
.GetViewShell();
359 ScModelObj
* pModel
= comphelper::getFromUnoTunnel
<ScModelObj
>(pViewShell
->GetCurrentDocument());
360 SfxLokHelper::notifyDocumentSizeChanged(pViewShell
, sRect
, pModel
, false);
363 void ScTabView::UpdateLayerLocks()
368 SCTAB nTab
= aViewData
.GetTabNo();
369 bool bEx
= aViewData
.GetViewShell()->IsDrawSelMode();
370 bool bProt
= aViewData
.GetDocument().IsTabProtected( nTab
) ||
371 aViewData
.GetSfxDocShell()->IsReadOnly();
372 bool bShared
= aViewData
.GetDocShell()->IsDocShared();
375 SdrLayerAdmin
& rAdmin
= pDrawView
->GetModel().GetLayerAdmin();
376 pLayer
= rAdmin
.GetLayerPerID(SC_LAYER_BACK
);
378 pDrawView
->SetLayerLocked( pLayer
->GetName(), bProt
|| !bEx
|| bShared
);
379 pLayer
= rAdmin
.GetLayerPerID(SC_LAYER_INTERN
);
381 pDrawView
->SetLayerLocked( pLayer
->GetName() );
382 pLayer
= rAdmin
.GetLayerPerID(SC_LAYER_FRONT
);
384 pDrawView
->SetLayerLocked( pLayer
->GetName(), bProt
|| bShared
);
385 pLayer
= rAdmin
.GetLayerPerID(SC_LAYER_CONTROLS
);
387 pDrawView
->SetLayerLocked( pLayer
->GetName(), bProt
|| bShared
);
388 pLayer
= rAdmin
.GetLayerPerID(SC_LAYER_HIDDEN
);
391 pDrawView
->SetLayerLocked( pLayer
->GetName(), bProt
|| bShared
);
392 pDrawView
->SetLayerVisible( pLayer
->GetName(), false);
394 pTabControl
->SetAddButtonEnabled(aViewData
.GetDocument().IsDocEditable());
397 void ScTabView::DrawDeselectAll()
402 ScTabViewShell
* pViewSh
= aViewData
.GetViewShell();
404 ( pViewSh
->IsDrawTextShell() || pDrawActual
->GetSlotID() == SID_DRAW_NOTEEDIT
) )
406 // end text edit (as if escape pressed, in FuDraw)
407 aViewData
.GetDispatcher().Execute( pDrawActual
->GetSlotID(),
408 SfxCallMode::SLOT
| SfxCallMode::RECORD
);
411 pDrawView
->ScEndTextEdit();
412 pDrawView
->UnmarkAll();
414 if (!pViewSh
->IsDrawSelMode())
415 pViewSh
->SetDrawShell( false );
418 bool ScTabView::IsDrawTextEdit() const
421 return pDrawView
->IsTextEdit();
426 SvxZoomType
ScTabView::GetZoomType() const
428 return aViewData
.GetZoomType();
431 void ScTabView::SetZoomType( SvxZoomType eNew
, bool bAll
)
433 aViewData
.SetZoomType( eNew
, bAll
);
436 void ScTabView::SetZoom( const Fraction
& rNewX
, const Fraction
& rNewY
, bool bAll
)
438 aViewData
.SetZoom( rNewX
, rNewY
, bAll
);
440 pDrawView
->RecalcScale();
444 void ScTabView::RefreshZoom()
446 aViewData
.RefreshZoom();
448 pDrawView
->RecalcScale();
452 void ScTabView::SetPagebreakMode( bool bSet
)
454 aViewData
.SetPagebreakMode(bSet
);
456 pDrawView
->RecalcScale();
460 void ScTabView::ResetDrawDragMode()
463 pDrawView
->SetDragMode( SdrDragMode::Move
);
466 void ScTabView::ViewOptionsHasChanged( bool bHScrollChanged
, bool bGraphicsChanged
)
468 // create DrawView when grid should be displayed
469 if ( !pDrawView
&& aViewData
.GetOptions().GetGridOptions().GetGridVisible() )
473 pDrawView
->UpdateUserViewOptions();
475 if (bGraphicsChanged
)
476 DrawEnableAnim(true); // DrawEnableAnim checks the options state
478 // if TabBar is set to visible, make sure its size is not 0
479 bool bGrow
= ( aViewData
.IsTabMode() && pTabControl
->GetSizePixel().Width() <= 0 );
481 // if ScrollBar is set to visible, TabBar must make room
482 bool bShrink
= ( bHScrollChanged
&& aViewData
.IsTabMode() && aViewData
.IsHScrollMode() &&
483 pTabControl
->GetSizePixel().Width() > SC_TABBAR_DEFWIDTH
);
485 if ( bGrow
|| bShrink
)
487 Size aSize
= pTabControl
->GetSizePixel();
488 aSize
.setWidth( SC_TABBAR_DEFWIDTH
); // initial size
489 pTabControl
->SetSizePixel(aSize
); // DoResize is called later...
493 // helper function against including the drawing layer
495 void ScTabView::DrawMarkListHasChanged()
498 pDrawView
->MarkListHasChanged();
501 void ScTabView::UpdateAnchorHandles()
504 pDrawView
->AdjustMarkHdl();
507 void ScTabView::UpdateIMap( SdrObject
* pObj
)
510 pDrawView
->UpdateIMap( pObj
);
513 void ScTabView::DrawEnableAnim(bool bSet
)
519 // don't start animations if display of graphics is disabled
520 // graphics are controlled by VOBJ_TYPE_OLE
521 if ( bSet
&& aViewData
.GetOptions().GetObjMode(VOBJ_TYPE_OLE
) == VOBJ_MODE_SHOW
)
523 if ( !pDrawView
->IsAnimationEnabled() )
525 pDrawView
->SetAnimationEnabled();
527 // animated GIFs must be restarted:
528 ScDocument
& rDoc
= aViewData
.GetDocument();
530 if ( pGridWin
[i
] && pGridWin
[i
]->IsVisible() )
531 rDoc
.StartAnimations( aViewData
.GetTabNo() );
536 pDrawView
->SetAnimationEnabled(false);
540 void ScTabView::UpdateDrawTextOutliner()
544 Outliner
* pOL
= pDrawView
->GetTextEditOutliner();
546 aViewData
.UpdateOutlinerFlags( *pOL
);
550 void ScTabView::DigitLanguageChanged()
552 LanguageType eNewLang
= ScModule::GetOptDigitLanguage();
553 for (VclPtr
<ScGridWindow
> & pWin
: pGridWin
)
555 pWin
->GetOutDev()->SetDigitLanguage( eNewLang
);
558 void ScTabView::ScrollToObject( const SdrObject
* pDrawObj
)
562 // #i118524# use the BoundRect, this defines the visible area
563 MakeVisible(pDrawObj
->GetCurrentBoundRect());
567 void ScTabView::MakeVisible( const tools::Rectangle
& rHMMRect
)
569 vcl::Window
* pWin
= GetActiveWin();
570 Size aWinSize
= pWin
->GetOutputSizePixel();
571 SCTAB nTab
= aViewData
.GetTabNo();
573 tools::Rectangle aRect
= pWin
->LogicToPixel( rHMMRect
);
575 tools::Long nScrollX
=0, nScrollY
=0; // pixel
577 if ( aRect
.Right() >= aWinSize
.Width() ) // right out
579 nScrollX
= aRect
.Right() - aWinSize
.Width() + 1; // right border visible
580 if ( aRect
.Left() < nScrollX
)
581 nScrollX
= aRect
.Left(); // left visible (if too big)
583 if ( aRect
.Bottom() >= aWinSize
.Height() ) // bottom out
585 nScrollY
= aRect
.Bottom() - aWinSize
.Height() + 1; // bottom border visible
586 if ( aRect
.Top() < nScrollY
)
587 nScrollY
= aRect
.Top(); // top visible (if too big)
590 if ( aRect
.Left() < 0 ) // left out
591 nScrollX
= aRect
.Left(); // left border visible
592 if ( aRect
.Top() < 0 ) // top out
593 nScrollY
= aRect
.Top(); // top border visible
595 if (!(nScrollX
|| nScrollY
))
598 ScDocument
& rDoc
= aViewData
.GetDocument();
599 if ( rDoc
.IsNegativePage( nTab
) )
600 nScrollX
= -nScrollX
;
602 double nPPTX
= aViewData
.GetPPTX();
603 double nPPTY
= aViewData
.GetPPTY();
604 ScSplitPos eWhich
= aViewData
.GetActivePart();
605 SCCOL nPosX
= aViewData
.GetPosX(WhichH(eWhich
));
606 SCROW nPosY
= aViewData
.GetPosY(WhichV(eWhich
));
608 tools::Long nLinesX
=0, nLinesY
=0; // columns/rows - scroll at least nScrollX/Y
611 while (nScrollX
> 0 && nPosX
< rDoc
.MaxCol())
613 nScrollX
-= static_cast<tools::Long
>( rDoc
.GetColWidth(nPosX
, nTab
) * nPPTX
);
617 else if (nScrollX
< 0)
618 while (nScrollX
< 0 && nPosX
> 0)
621 nScrollX
+= static_cast<tools::Long
>( rDoc
.GetColWidth(nPosX
, nTab
) * nPPTX
);
626 while (nScrollY
> 0 && nPosY
< rDoc
.MaxRow())
628 nScrollY
-= static_cast<tools::Long
>( rDoc
.GetRowHeight(nPosY
, nTab
) * nPPTY
);
632 else if (nScrollY
< 0)
633 while (nScrollY
< 0 && nPosY
> 0)
636 nScrollY
+= static_cast<tools::Long
>( rDoc
.GetRowHeight(nPosY
, nTab
) * nPPTY
);
640 ScrollLines( nLinesX
, nLinesY
); // execute
643 void ScTabView::SetBrushDocument( ScDocumentUniquePtr pNew
, bool bLock
)
645 pDrawBrushSet
.reset();
646 pBrushDocument
= std::move(pNew
);
648 bLockPaintBrush
= bLock
;
650 aViewData
.GetBindings().Invalidate(SID_FORMATPAINTBRUSH
);
653 void ScTabView::SetDrawBrushSet( std::unique_ptr
<SfxItemSet
> pNew
, bool bLock
)
655 pBrushDocument
.reset();
656 pDrawBrushSet
= std::move(pNew
);
658 bLockPaintBrush
= bLock
;
660 aViewData
.GetBindings().Invalidate(SID_FORMATPAINTBRUSH
);
663 void ScTabView::ResetBrushDocument()
665 if ( HasPaintBrush() )
667 SetBrushDocument( nullptr, false );
668 SetActivePointer( aViewData
.IsThemedCursor() ? PointerStyle::FatCross
: PointerStyle::Arrow
); // switch pointers also when ended with escape key
672 void ScTabView::OnLOKNoteStateChanged(const ScPostIt
* pNote
)
674 if (!comphelper::LibreOfficeKit::isActive())
677 const SdrCaptionObj
* pCaption
= pNote
->GetCaption();
681 SfxViewShell
* pCurrentViewShell
= SfxViewShell::Current();
682 if (!pCurrentViewShell
)
685 tools::Rectangle aRect
= pCaption
->GetLogicRect();
686 basegfx::B2DRange aTailRange
= pCaption
->getTailPolygon().getB2DRange();
687 tools::Rectangle
aTailRect(aTailRange
.getMinX(), aTailRange
.getMinY(),
688 aTailRange
.getMaxX(), aTailRange
.getMaxY());
689 aRect
.Union( aTailRect
);
691 // This is a temporary workaround: sometime in tiled rendering mode
692 // the tip of the note arrow is misplaced by a fixed offset.
693 // The value used below is enough to get the tile, where the arrow tip is
694 // placed, invalidated.
695 const int nBorderSize
= 200;
696 tools::Rectangle aInvalidRect
= aRect
;
697 aInvalidRect
.AdjustLeft( -nBorderSize
);
698 aInvalidRect
.AdjustRight( nBorderSize
);
699 aInvalidRect
.AdjustTop( -nBorderSize
);
700 aInvalidRect
.AdjustBottom( nBorderSize
);
702 SfxViewShell
* pViewShell
= SfxViewShell::GetFirst();
705 ScTabViewShell
* pTabViewShell
= dynamic_cast<ScTabViewShell
*>(pViewShell
);
706 if (pTabViewShell
&& pViewShell
->GetDocId() == pCurrentViewShell
->GetDocId())
708 for (auto& pWin
: pTabViewShell
->pGridWin
)
710 if (pWin
&& pWin
->IsVisible())
712 pWin
->Invalidate(aInvalidRect
);
716 pViewShell
= SfxViewShell::GetNext(*pViewShell
);
720 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */