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

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Mon Jan 4 18:36:08 UTC 2021


 desktop/source/lib/init.cxx               |   18 +++++++++++++++++-
 include/LibreOfficeKit/LibreOfficeKit.h   |    5 +++++
 include/LibreOfficeKit/LibreOfficeKit.hxx |   11 +++++++++++
 3 files changed, 33 insertions(+), 1 deletion(-)

New commits:
commit 7d4f929b7d57621cc94cc2c8cc19e2c2f5b80216
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Fri Dec 25 17:30:42 2020 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Mon Jan 4 19:35:34 2021 +0100

    lok: add lo_sendDialogEvent to post dialog events
    
    When the "Macro Security Warning" is shown in client side,
    the model/view/controller are not created yet. It is necessary
    to create a function to posts a dialog event.
    
    Change-Id: I2bfc9edecc708dc79da575ea515e3144e78c10e2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108293
    Tested-by: Jenkins
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108678
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 543e77714da0..6fcb2ca02a17 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2075,6 +2075,10 @@ static void lo_runLoop(LibreOfficeKit* pThis,
                        LibreOfficeKitWakeCallback pWakeCallback,
                        void* pData);
 
+static void lo_sendDialogEvent(LibreOfficeKit* pThis,
+                               unsigned long long int nLOKWindowId,
+                               const char* pArguments);
+
 LibLibreOffice_Impl::LibLibreOffice_Impl()
     : m_pOfficeClass( gOfficeClass.lock() )
     , maThread(nullptr)
@@ -2099,6 +2103,7 @@ LibLibreOffice_Impl::LibLibreOffice_Impl()
         m_pOfficeClass->runMacro = lo_runMacro;
         m_pOfficeClass->signDocument = lo_signDocument;
         m_pOfficeClass->runLoop = lo_runLoop;
+        m_pOfficeClass->sendDialogEvent = lo_sendDialogEvent;
 
         gOfficeClass = m_pOfficeClass;
     }
@@ -3691,7 +3696,7 @@ public:
     virtual void SAL_CALL disposing(const css::lang::EventObject&) override {}
 };
 
-static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned long long int nWindowId, const char* pArguments)
+static void lcl_sendDialogEvent(unsigned long long int nWindowId, const char* pArguments)
 {
     SolarMutexGuard aGuard;
 
@@ -3786,6 +3791,17 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned long
     }
 }
 
+
+static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned long long int nWindowId, const char* pArguments)
+{
+    lcl_sendDialogEvent(nWindowId, pArguments);
+}
+
+static void lo_sendDialogEvent(LibreOfficeKit* /*pThis*/, unsigned long long int nWindowId, const char* pArguments)
+{
+    lcl_sendDialogEvent(nWindowId, pArguments);
+}
+
 static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pCommand, const char* pArguments, bool bNotifyWhenFinished)
 {
     comphelper::ProfileZone aZone("doc_postUnoCommand");
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index f4244def5a6b..2279260d0e90 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -110,6 +110,11 @@ struct _LibreOfficeKitClass
                      LibreOfficeKitPollCallback pPollCallback,
                      LibreOfficeKitWakeCallback pWakeCallback,
                      void* pData);
+
+    /// @see lok::Office::sendDialogEvent
+    void (*sendDialogEvent) (LibreOfficeKit* pThis,
+                            unsigned long long int nLOKWindowId,
+                            const char* pArguments);
 };
 
 #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 2192d9870d01..ad2d887aa99a 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -982,6 +982,17 @@ public:
     {
         mpThis->pClass->runLoop(mpThis, pPollCallback, pWakeCallback, pData);
     }
+
+    /**
+     * Posts a dialog event for the window with given id
+     *
+     * @param nWindowId id of the window to notify
+     * @param pArguments arguments of the event.
+     */
+    void sendDialogEvent(unsigned long long int nWindowId, const char* pArguments = NULL)
+    {
+        mpThis->pClass->sendDialogEvent(mpThis, nWindowId, pArguments);
+    }
 };
 
 /// Factory method to create a lok::Office instance.


More information about the Libreoffice-commits mailing list