Blame SOURCES/0147-sfx2-add-SfxViewShell-libreOfficeKitViewCallback.patch

f325b2
From 62d05c21fdfe3e75e52fc275df6ef0ea95cb93d1 Mon Sep 17 00:00:00 2001
f325b2
From: Miklos Vajna <vmiklos@collabora.co.uk>
f325b2
Date: Thu, 17 Sep 2015 10:58:56 +0200
f325b2
Subject: [PATCH 147/398] sfx2: add SfxViewShell::libreOfficeKitViewCallback()
f325b2
f325b2
This is similar to the existing LOK callback, the difference is that the
f325b2
existing one assumes there is only one SfxViewShell instance at the same
f325b2
time.
f325b2
f325b2
This newer callback is precisely per-view, so model notifications can
f325b2
invoke all view callbacks, while view notifications can invoke only the
f325b2
callback of the relevant view.
f325b2
f325b2
This is just the framework, all actual client code has to be still
f325b2
ported over (and then the existing callback can be removed).
f325b2
f325b2
(cherry picked from commit c74ccac7cd94eba052d21cf74e03e214d58942e4)
f325b2
f325b2
Change-Id: I3d8f27740c69fcf6ffbbdce12db2ea088321493d
f325b2
---
f325b2
 include/sfx2/viewsh.hxx      |  7 +++++++
f325b2
 sfx2/source/view/viewimp.hxx |  5 ++++-
f325b2
 sfx2/source/view/viewsh.cxx  | 14 ++++++++++++++
f325b2
 3 files changed, 25 insertions(+), 1 deletion(-)
f325b2
f325b2
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
f325b2
index c6e7f4a2ca12..69bd32c5ee25 100644
f325b2
--- a/include/sfx2/viewsh.hxx
f325b2
+++ b/include/sfx2/viewsh.hxx
f325b2
@@ -39,6 +39,8 @@
f325b2
 #include <o3tl/typed_flags_set.hxx>
f325b2
 #include <vcl/vclptr.hxx>
f325b2
 #include <sfx2/tabdlg.hxx>
f325b2
+#define LOK_USE_UNSTABLE_API
f325b2
+#include <LibreOfficeKit/LibreOfficeKitTypes.h>
f325b2
 
f325b2
 class SfxBaseController;
f325b2
 class Size;
f325b2
@@ -317,6 +319,11 @@ public:
f325b2
     SAL_DLLPRIVATE void TakeOwnership_Impl();
f325b2
     SAL_DLLPRIVATE void TakeFrameOwnership_Impl();
f325b2
     SAL_DLLPRIVATE bool ExecKey_Impl(const KeyEvent& aKey);
f325b2
+
f325b2
+    /// The actual implementation of the lok::Document::registerViewCallback() API.
f325b2
+    void registerLibreOfficeKitViewCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData);
f325b2
+    /// Invokes the registered callback, if there are any.
f325b2
+    void libreOfficeKitViewCallback(int nType, const char* pPayload) const;
f325b2
 };
f325b2
 
f325b2
 
f325b2
diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx
f325b2
index 43b25d045eca..9f3ee1e3872b 100644
f325b2
--- a/sfx2/source/view/viewimp.hxx
f325b2
+++ b/sfx2/source/view/viewimp.hxx
f325b2
@@ -65,7 +65,10 @@ struct SfxViewShell_Impl
f325b2
 
f325b2
     mutable SfxInPlaceClientList* mpIPClientList;
f325b2
 
f325b2
-    SfxViewShell_Impl(SfxViewShellFlags const nFlags);
f325b2
+    LibreOfficeKitCallback m_pLibreOfficeKitViewCallback;
f325b2
+    void* m_pLibreOfficeKitViewData;
f325b2
+
f325b2
+    explicit SfxViewShell_Impl(SfxViewShellFlags const nFlags);
f325b2
     ~SfxViewShell_Impl();
f325b2
 
f325b2
     SfxInPlaceClientList* GetIPClientList_Impl( bool bCreate = true ) const;
f325b2
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
f325b2
index 939c590ffa82..8e7e68598dda 100644
f325b2
--- a/sfx2/source/view/viewsh.cxx
f325b2
+++ b/sfx2/source/view/viewsh.cxx
f325b2
@@ -310,6 +310,8 @@ SfxViewShell_Impl::SfxViewShell_Impl(SfxViewShellFlags const nFlags)
f325b2
 ,   m_nFamily(0xFFFF)   // undefined, default set by TemplateDialog
f325b2
 ,   m_pController(0)
f325b2
 ,   mpIPClientList(NULL)
f325b2
+,   m_pLibreOfficeKitViewCallback(0)
f325b2
+,   m_pLibreOfficeKitViewData(0)
f325b2
 {}
f325b2
 
f325b2
 SfxViewShell_Impl::~SfxViewShell_Impl()
f325b2
@@ -1633,6 +1635,18 @@ bool SfxViewShell::ExecKey_Impl(const KeyEvent& aKey)
f325b2
     return pImp->m_xAccExec->execute(aKey.GetKeyCode());
f325b2
 }
f325b2
 
f325b2
+void SfxViewShell::registerLibreOfficeKitViewCallback(LibreOfficeKitCallback pCallback, void* pData)
f325b2
+{
f325b2
+    pImp->m_pLibreOfficeKitViewCallback = pCallback;
f325b2
+    pImp->m_pLibreOfficeKitViewData = pData;
f325b2
+}
f325b2
+
f325b2
+void SfxViewShell::libreOfficeKitViewCallback(int nType, const char* pPayload) const
f325b2
+{
f325b2
+    if (pImp->m_pLibreOfficeKitViewCallback)
f325b2
+        pImp->m_pLibreOfficeKitViewCallback(nType, pPayload, pImp->m_pLibreOfficeKitViewData);
f325b2
+}
f325b2
+
f325b2
 bool SfxViewShell::KeyInput( const KeyEvent &rKeyEvent )
f325b2
 
f325b2
 /*  [Description]
f325b2
-- 
f325b2
2.12.0
f325b2