[Libreoffice-commits] online.git: Branch 'distro/collabora/milestone-2' - loolwsd/LOKitClient.cpp

Tor Lillqvist tml at collabora.com
Fri Jun 12 11:42:48 PDT 2015


 loolwsd/LOKitClient.cpp |   33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

New commits:
commit 96d728eaac57623d9291233d600229980665ec71
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Jun 12 16:58:49 2015 +0300

    Handle callbacks here, too

diff --git a/loolwsd/LOKitClient.cpp b/loolwsd/LOKitClient.cpp
index 8e0e747..97d42da 100644
--- a/loolwsd/LOKitClient.cpp
+++ b/loolwsd/LOKitClient.cpp
@@ -36,6 +36,36 @@ using Poco::StringTokenizer;
 using Poco::TemporaryFile;
 using Poco::Util::Application;
 
+extern "C"
+{
+    static void myCallback(int nType, const char* pPayload, void*)
+    {
+        std::cout << "Callback: ";
+        switch ((LibreOfficeKitCallbackType) nType)
+        {
+#define CASE(x) case LOK_CALLBACK_##x: std::cout << #x; break
+            CASE(INVALIDATE_TILES);
+            CASE(INVALIDATE_VISIBLE_CURSOR);
+            CASE(TEXT_SELECTION);
+            CASE(TEXT_SELECTION_START);
+            CASE(TEXT_SELECTION_END);
+            CASE(CURSOR_VISIBLE);
+            CASE(GRAPHIC_SELECTION);
+            CASE(HYPERLINK_CLICKED);
+            CASE(STATE_CHANGED);
+            CASE(STATUS_INDICATOR_START);
+            CASE(STATUS_INDICATOR_SET_VALUE);
+            CASE(STATUS_INDICATOR_FINISH);
+            CASE(SEARCH_NOT_FOUND);
+            CASE(DOCUMENT_SIZE_CHANGED);
+            CASE(SET_PART);
+#undef CASE
+        }
+        std::cout << " payload: " << pPayload << std::endl;
+    }
+}
+
+
 class LOKitClient: public Application
 {
 public:
@@ -58,6 +88,7 @@ protected:
             return Application::EXIT_UNAVAILABLE;
         }
 
+
         loKitDocument = loKit->pClass->documentLoad(loKit, args[1].c_str());
         if (!loKitDocument)
         {
@@ -65,6 +96,8 @@ protected:
             return Application::EXIT_UNAVAILABLE;
         }
 
+        loKitDocument->pClass->registerCallback(loKitDocument, myCallback, NULL);
+
         loKitDocument->pClass->initializeForRendering(loKitDocument);
 
         if (isatty(0))


More information about the Libreoffice-commits mailing list