on invalidating other views, specific what Tab is invalidated

the other views might be viewing other tabs and it is only
the tab ('part') this view is on which is invalidated

Change-Id: I9f054ffa6158a6bc62e3eb7b7170450e26870b54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155816
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 979767c..deb3264 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -320,8 +320,6 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public vcl::DocWindow, public DropTarget
    void            SetupInitialPageBreaks(const ScDocument& rDoc, SCTAB nTab);
    DECL_DLLPRIVATE_LINK(InitiatePageBreaksTimer, Timer*, void);

    void            LogicInvalidatePart(const tools::Rectangle* pRectangle, int nPart);

protected:
    virtual void    PrePaint(vcl::RenderContext& rRenderContext) override;
    virtual void    Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
@@ -380,6 +378,7 @@ public:

    /// @see Window::LogicInvalidate().
    void LogicInvalidate(const tools::Rectangle* pRectangle) override;
    void LogicInvalidatePart(const tools::Rectangle* pRectangle, int nPart);

    /// Update the cell selection according to what handles have been dragged.
    /// @see vcl::ITiledRenderable::setTextSelection() for the values of nType.
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 38c8fcc..9a321f7 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2200,6 +2200,7 @@ void ScTabView::KillEditView( bool bNoPaint )
    SCROW nRow1 = aViewData.GetEditStartRow();
    SCCOL nCol2 = aViewData.GetEditEndCol();
    SCROW nRow2 = aViewData.GetEditEndRow();
    SCTAB nTab = aViewData.GetTabNo();
    bool bPaint[4];
    bool bNotifyAcc = false;
    tools::Rectangle aRectangle[4];
@@ -2237,16 +2238,16 @@ void ScTabView::KillEditView( bool bNoPaint )
            if (comphelper::LibreOfficeKit::isActive())
            {
                const tools::Rectangle& rInvRect = aRectangle[i];
                pGridWin[i]->LogicInvalidate(&rInvRect);
                pGridWin[i]->LogicInvalidatePart(&rInvRect, nTab);

                // invalidate other views
                auto lInvalidateWindows =
                        [&rInvRect] (ScTabView* pTabView)
                        [nTab, &rInvRect] (ScTabView* pTabView)
                        {
                            for (VclPtr<ScGridWindow> const & pWin: pTabView->pGridWin)
                            {
                                if (pWin)
                                    pWin->LogicInvalidate(&rInvRect);
                                    pWin->LogicInvalidatePart(&rInvRect, nTab);
                            }
                        };