Blame SOURCES/0150-lok-Document-register-callback-in-the-view-if-reques.patch

135360
From 2dd20703103d2510fa47958743ced3ae203f613d Mon Sep 17 00:00:00 2001
135360
From: Miklos Vajna <vmiklos@collabora.co.uk>
135360
Date: Thu, 17 Sep 2015 15:39:19 +0200
135360
Subject: [PATCH 150/398] lok::Document: register callback in the view, if
135360
 requested
135360
135360
With this, a postKeyEvent() in one view properly results in one
135360
LOK_CALLBACK_INVALIDATE_TILES per view, at least in Writer.
135360
135360
Change-Id: Ia0a9a00ea5a98c38f3d399208b9ef028f3036f79
135360
(cherry picked from commit b8a54763f4f66538f13b6c0e13045e5cb3167ca4)
135360
---
135360
 desktop/source/lib/init.cxx | 20 +++++++++++++++-----
135360
 1 file changed, 15 insertions(+), 5 deletions(-)
135360
135360
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
135360
index 52a78e228a32..64a6c00ffba6 100644
135360
--- a/desktop/source/lib/init.cxx
135360
+++ b/desktop/source/lib/init.cxx
135360
@@ -54,6 +54,8 @@
135360
 #include <sfx2/msgpool.hxx>
135360
 #include <sfx2/dispatch.hxx>
135360
 #include <sfx2/lokhelper.hxx>
135360
+#include <sfx2/viewfrm.hxx>
135360
+#include <sfx2/viewsh.hxx>
135360
 #include <svx/svxids.hrc>
135360
 #include <vcl/svapp.hxx>
135360
 #include <vcl/svpforlokit.hxx>
135360
@@ -816,14 +818,22 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis,
135360
                                 LibreOfficeKitCallback pCallback,
135360
                                 void* pData)
135360
 {
135360
-    ITiledRenderable* pDoc = getTiledRenderable(pThis);
135360
-    if (!pDoc)
135360
+    if (comphelper::LibreOfficeKit::isViewCallback())
135360
     {
135360
-        gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
135360
-        return;
135360
+        if (SfxViewShell* pViewShell = SfxViewFrame::Current()->GetViewShell())
135360
+            pViewShell->registerLibreOfficeKitViewCallback(pCallback, pData);
135360
     }
135360
+    else
135360
+    {
135360
+        ITiledRenderable* pDoc = getTiledRenderable(pThis);
135360
+        if (!pDoc)
135360
+        {
135360
+            gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
135360
+            return;
135360
+        }
135360
 
135360
-    pDoc->registerCallback(pCallback, pData);
135360
+        pDoc->registerCallback(pCallback, pData);
135360
+    }
135360
 }
135360
 
135360
 static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nCharCode, int nKeyCode)
135360
-- 
135360
2.12.0
135360