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

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