[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - desktop/source include/vcl vcl/source

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 19 03:06:44 UTC 2021


 desktop/source/lib/init.cxx |    7 +++++--
 include/vcl/svapp.hxx       |   14 +++++++++++++-
 vcl/source/app/svapp.cxx    |   19 +++++++++++++++++++
 3 files changed, 37 insertions(+), 3 deletions(-)

New commits:
commit fc67bb78c08847d8ce96b3b53a902cabcf6106c1
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Fri Dec 25 13:09:00 2020 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Tue Jan 19 04:06:06 2021 +0100

    lok: add missing global notifier
    
    Occurs when server shows the "Macro Security Warning" before
    load the document if enable/disable macros, but there are no
    instances for document/view/controller yet.
    
    So it is required to use the global notifier so it can be sent
    messages to the client side using the JSDialog framework.
    
    Change-Id: I67f15b21cbaf21906b88145f3c5835cf0e1ff79d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108288
    Tested-by: Jenkins
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109168
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 1800ff5ed7db..35ea08209e7e 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2472,11 +2472,14 @@ static void lo_registerCallback (LibreOfficeKit* pThis,
 {
     SolarMutexGuard aGuard;
 
+    Application* pApp = GetpApp();
+    assert(pApp);
+
     LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis);
     pLib->maLastExceptionMsg.clear();
 
-    pLib->mpCallback = pCallback;
-    pLib->mpCallbackData = pData;
+    pApp->m_pCallback = pLib->mpCallback = pCallback;
+    pApp->m_pCallbackData = pLib->mpCallbackData = pData;
 }
 
 static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const char* pFormat, const char* pFilterOptions)
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index db4563b7ba82..d0c1e7f0bb6e 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -27,6 +27,7 @@
 #include <vector>
 
 #include <comphelper/solarmutex.hxx>
+#include <LibreOfficeKit/LibreOfficeKitTypes.h>
 #include <osl/mutex.hxx>
 #include <rtl/ustring.hxx>
 #include <osl/thread.h>
@@ -34,6 +35,7 @@
 #include <tools/link.hxx>
 #include <tools/solar.h>
 #include <vcl/dllapi.h>
+#include <vcl/IDialogRenderable.hxx>
 #include <vcl/inputtypes.hxx>
 #include <vcl/exceptiontypes.hxx>
 #include <vcl/vclevent.hxx>
@@ -235,7 +237,7 @@ enum class DialogCancelMode {
 
  @see   Desktop, ImplSVData
  */
-class VCL_DLLPUBLIC Application
+class VCL_DLLPUBLIC Application : public vcl::ILibreOfficeKitNotifier
 {
 public:
     /** @name Initialization
@@ -1347,6 +1349,16 @@ public:
                                                     bool bMobile = false);
 
     static weld::Window* GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow);
+
+    // ILibreOfficeKitNotifier
+    void* m_pCallbackData;
+    LibreOfficeKitCallback m_pCallback;
+
+    virtual void notifyWindow(vcl::LOKWindowId nLOKWindowId,
+                              const OUString& rAction,
+                              const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>()) const override;
+    virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const override;
+
 private:
     DECL_STATIC_LINK( Application, PostEventHandler, void*, void );
 };
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index e2dbc7753e76..34227013dc23 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -159,6 +159,8 @@ Application::Application()
     osl_setEnvironment(aVar.pData, aValue.pData);
 
     ImplGetSVData()->mpApp = this;
+    m_pCallbackData = nullptr;
+    m_pCallback = nullptr;
 }
 
 Application::~Application()
@@ -313,6 +315,23 @@ void Application::EndAllPopups()
     Application::PostUserEvent( LINK( nullptr, ImplSVAppData, ImplEndAllPopupsMsg ) );
 }
 
+void Application::notifyWindow(vcl::LOKWindowId /*nLOKWindowId*/,
+                               const OUString& /*rAction*/,
+                               const std::vector<vcl::LOKPayloadItem>& /*rPayload = std::vector<LOKPayloadItem>()*/) const
+{
+}
+
+void Application::libreOfficeKitViewCallback(int nType, const char* pPayload) const
+{
+    if (!comphelper::LibreOfficeKit::isActive())
+        return;
+
+    if (m_pCallback)
+    {
+        m_pCallback(nType, pPayload, m_pCallbackData);
+    }
+}
+
 
 namespace
 {


More information about the Libreoffice-commits mailing list