[Libreoffice-commits] core.git: sc/source

Marco Cecchetti marco.cecchetti at collabora.com
Tue Jan 17 13:46:33 UTC 2017


 sc/source/ui/docshell/docfunc.cxx |    2 +
 sc/source/ui/inc/tabview.hxx      |    1 
 sc/source/ui/view/tabview5.cxx    |   45 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+)

New commits:
commit ffb1fe4f434a48358a18c0af2c44a112d9ad04be
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Wed Oct 19 22:00:04 2016 +0200

    LOK: Calc: show/hide a note does not perform any tile invalidation
    
    Change-Id: Ia904b6bbe82c395299b269ddbde523d19bf486bc
    Reviewed-on: https://gerrit.libreoffice.org/30099
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 3a5eaee..7dab24b 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1221,6 +1221,8 @@ bool ScDocFunc::ShowNote( const ScAddress& rPos, bool bShow )
     if (rDoc.IsStreamValid(rPos.Tab()))
         rDoc.SetStreamValid(rPos.Tab(), false);
 
+    ScTabView::OnLOKNoteStateChanged(pNote);
+
     rDocShell.SetDocumentModified();
 
     return true;
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 948f599..5afc3d3 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -584,6 +584,7 @@ public:
     void SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector<editeng::MisspellRanges>* pRanges );
     /// @see ScModelObj::getRowColumnHeaders().
     OUString getRowColumnHeaders(const Rectangle& rRectangle);
+    static void OnLOKNoteStateChanged(const ScPostIt* pNote);
 };
 
 #endif
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index a528e51..fe837a7 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -22,6 +22,7 @@
 
 #include <svx/fmshell.hxx>
 #include <svx/svdobj.hxx>
+#include <svx/svdocapt.hxx>
 #include <svx/svdoutl.hxx>
 #include <sfx2/bindings.hxx>
 #include <sfx2/dispatch.hxx>
@@ -47,6 +48,7 @@
 #include "AccessibilityHints.hxx"
 #include "docsh.hxx"
 #include "viewuno.hxx"
+#include "postit.hxx"
 
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
@@ -645,4 +647,47 @@ void ScTabView::ResetBrushDocument()
     }
 }
 
+void ScTabView::OnLOKNoteStateChanged(const ScPostIt* pNote)
+{
+    if (!comphelper::LibreOfficeKit::isActive())
+        return;
+
+    const SdrCaptionObj* pCaption = pNote->GetCaption();
+    if (!pCaption) return;
+
+    Rectangle aRect = pCaption->GetLogicRect();
+    basegfx::B2DRange aTailRange = pCaption->getTailPolygon().getB2DRange();
+    Rectangle aTailRect(aTailRange.getMinX(), aTailRange.getMinY(),
+                        aTailRange.getMaxX(), aTailRange.getMaxY());
+    aRect.Union( aTailRect );
+
+    // This is a temporary workaround: sometime in tiled rendering mode
+    // the tip of the note arrow is misplaced by a fixed offset.
+    // The value used below is enough to get the tile, where the arrow tip is
+    // placed, invalidated.
+    const int nBorderSize = 200;
+    Rectangle aInvalidRect = aRect;
+    aInvalidRect.Left() -= nBorderSize;
+    aInvalidRect.Right() += nBorderSize;
+    aInvalidRect.Top() -= nBorderSize;
+    aInvalidRect.Bottom() += nBorderSize;
+
+    SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+    while (pViewShell)
+    {
+        ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
+        if (pTabViewShell)
+        {
+            for (auto& pWin: pTabViewShell->pGridWin)
+            {
+                if (pWin && pWin->IsVisible())
+                {
+                    pWin->Invalidate(aInvalidRect);
+                }
+            }
+        }
+        pViewShell = SfxViewShell::GetNext(*pViewShell);
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list