Blame SOURCES/0327-sw-lok-comments-emit-invalidation-events-in-SidebarT.patch

135360
From 08ca67b7742364ecdc8bf7928ce2ef058da0e37e Mon Sep 17 00:00:00 2001
135360
From: Miklos Vajna <vmiklos@collabora.co.uk>
135360
Date: Sat, 14 Nov 2015 10:04:38 +0100
135360
Subject: [PATCH 327/398] sw lok comments: emit invalidation events in
135360
 SidebarTextControl
135360
135360
With this, newly typed characters show up instantly in comments, not
135360
only after changing the zoom level.
135360
135360
(cherry picked from commit 4cbbaf571d3982eccd7f7267df3185b3d321d0da)
135360
135360
Change-Id: I1470db1ec03cc415917375f1f95434cf0944e559
135360
---
135360
 sw/source/uibase/docvw/SidebarTxtControl.cxx | 26 ++++++++++++++++++++++++++
135360
 sw/source/uibase/docvw/SidebarTxtControl.hxx |  2 ++
135360
 2 files changed, 28 insertions(+)
135360
135360
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
135360
index afda8b1952ad..d6887a475312 100644
135360
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
135360
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
135360
@@ -23,6 +23,7 @@
135360
 
135360
 #include <SidebarWin.hxx>
135360
 #include <PostItMgr.hxx>
135360
+#include <edtwin.hxx>
135360
 
135360
 #include <cmdid.h>
135360
 #include <docvw.hrc>
135360
@@ -46,6 +47,7 @@
135360
 #include <editeng/editeng.hxx>
135360
 #include <editeng/editview.hxx>
135360
 #include <editeng/flditem.hxx>
135360
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
135360
 
135360
 #include <uitool.hxx>
135360
 #include <view.hxx>
135360
@@ -186,6 +188,30 @@ void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const Rectang
135360
     }
135360
 }
135360
 
135360
+void SidebarTextControl::LogicInvalidate(const Rectangle* pRectangle)
135360
+{
135360
+    OString sRectangle;
135360
+    if (!pRectangle)
135360
+        sRectangle = "EMPTY";
135360
+    else
135360
+    {
135360
+        // Convert from relative twips to absolute ones.
135360
+        Rectangle aRectangle(*pRectangle);
135360
+        vcl::Window& rParent = *mrSidebarWin.EditWin();
135360
+        Point aOffset(GetOutOffXPixel() - rParent.GetOutOffXPixel(), GetOutOffYPixel() - rParent.GetOutOffYPixel());
135360
+        rParent.Push(PushFlags::MAPMODE);
135360
+        rParent.EnableMapMode();
135360
+        aOffset = rParent.PixelToLogic(aOffset);
135360
+        rParent.Pop();
135360
+        aRectangle.Move(aOffset.getX(), aOffset.getY());
135360
+
135360
+        sRectangle = aRectangle.toString();
135360
+    }
135360
+
135360
+    SwWrtShell& rWrtShell = mrDocView.GetWrtShell();
135360
+    rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
135360
+}
135360
+
135360
 void SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt )
135360
 {
135360
     const vcl::KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
135360
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx
135360
index 43d6b98d82c1..f73b68c950ae 100644
135360
--- a/sw/source/uibase/docvw/SidebarTxtControl.hxx
135360
+++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx
135360
@@ -40,6 +40,8 @@ class SidebarTextControl : public Control
135360
 
135360
     protected:
135360
         virtual void    Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
135360
+        /// @see OutputDevice::LogicInvalidate().
135360
+        void LogicInvalidate(const Rectangle* pRectangle) override;
135360
         virtual void    MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
135360
         virtual void    MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
135360
         virtual void    Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
135360
-- 
135360
2.12.0
135360