kbrown / rpms / libreoffice

Forked from rpms/libreoffice 2 years ago
Clone

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

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