[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sc/source

Marco Cecchetti marco.cecchetti at collabora.com
Thu Oct 20 11:40:40 UTC 2016


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

New commits:
commit ec32631e7cf8442dc4a7f1f8a361787eeefcbfdf
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/30093
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
    Tested-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 604af85..5305b74 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1226,6 +1226,7 @@ bool ScDocFunc::ShowNote( const ScAddress& rPos, bool bShow )
     if (rDoc.IsStreamValid(rPos.Tab()))
         rDoc.SetStreamValid(rPos.Tab(), false);
 
+    rDocShell.GetViewData()->GetViewShell()->OnLOKNoteStateChanged(rPos);
     rDocShell.SetDocumentModified();
 
     return true;
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 43aaf7d..cbb26bf 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -581,6 +581,7 @@ public:
     void SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector<editeng::MisspellRanges>* pRanges );
     /// @see ScModelObj::getRowColumnHeaders().
     OUString getRowColumnHeaders(const Rectangle& rRectangle);
+    void OnLOKNoteStateChanged(const ScAddress& rPos);
 };
 
 #endif
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 83d9094..49650b6 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>
@@ -48,6 +49,7 @@
 #include "AccessibilityHints.hxx"
 #include "docsh.hxx"
 #include "viewuno.hxx"
+#include "postit.hxx"
 
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
@@ -648,4 +650,46 @@ void ScTabView::ResetBrushDocument()
     }
 }
 
+void ScTabView::OnLOKNoteStateChanged(const ScAddress& rPos)
+{
+    ScDocument* pDoc = GetViewData().GetDocument();
+    if (!pDoc) return;
+    ScPostIt* pNote = pDoc->GetNote(rPos);
+    if (!pNote) return;
+    SdrCaptionObj* pCaption = pNote->GetCaption();
+    if (!pCaption) return;
+
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        Rectangle aRect = pCaption->GetLogicRect();
+        basegfx::B2DRange aTailRange = pCaption->getTailPolygon().getB2DRange();
+        Rectangle aTailRect(aTailRange.getMinX(), aTailRange.getMinY(),
+                            aTailRange.getMaxX(), aTailRange.getMaxY());
+        aRect.Union( aTailRect );
+        static const int nBorderSize = 200;
+
+        SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+        while (pViewShell)
+        {
+            ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
+            if (pTabViewShell)
+            {
+                for (auto& pWin: pTabViewShell->pGridWin)
+                {
+                    if (pWin && pWin->IsVisible())
+                    {
+                        Rectangle aInvalidRect = aRect;
+                        aInvalidRect.Left() -= nBorderSize;
+                        aInvalidRect.Right() += nBorderSize;
+                        aInvalidRect.Top() -= nBorderSize;
+                        aInvalidRect.Bottom() += nBorderSize;
+                        pWin->Invalidate(aInvalidRect);
+                    }
+                }
+            }
+            pViewShell = SfxViewShell::GetNext(*pViewShell);
+        }
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list