[Libreoffice-commits] online.git: bundled/include kit/ChildSession.cpp kit/KitHelper.hpp tools/KitClient.cpp wsd/protocol.txt

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 12 17:24:15 UTC 2018


 bundled/include/LibreOfficeKit/LibreOfficeKit.h      |    9 +++++++
 bundled/include/LibreOfficeKit/LibreOfficeKit.hxx    |   24 ++++++++++++-------
 bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h |   14 +++++++++++
 bundled/include/LibreOfficeKit/LibreOfficeKitInit.h  |    3 --
 kit/ChildSession.cpp                                 |   15 +++++++++++
 kit/KitHelper.hpp                                    |   10 +++++++
 tools/KitClient.cpp                                  |    2 -
 wsd/protocol.txt                                     |   10 +++++++
 8 files changed, 74 insertions(+), 13 deletions(-)

New commits:
commit efe291c320f04db6ca664dcdb5f3ce76d700e65d
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Tue Nov 6 11:21:35 2018 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Mon Nov 12 18:10:57 2018 +0100

    Notify about the editing context.
    
    And also:
    
    * Hint the compiler to warn about the missing callbacks.
    * Add few missing ones.
    * Update the bundled headers.
    
    Change-Id: I8d31363eaaea289e8a517c0b9b1142b33ce3027e

diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKit.h b/bundled/include/LibreOfficeKit/LibreOfficeKit.h
index e052765ac..27d968c4a 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKit.h
@@ -309,6 +309,15 @@ struct _LibreOfficeKitDocumentClass
     /// @see lok::Document::getPartInfo().
     char* (*getPartInfo) (LibreOfficeKitDocument* pThis, int nPart);
 
+    /// Paints window with given id to the buffer with the give DPI scale
+    /// (every pixel is dpiscale-times larger).
+    /// @see lok::Document::paintWindow().
+    void (*paintWindowDPI) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
+                            unsigned char* pBuffer,
+                            const int x, const int y,
+                            const int width, const int height,
+                            const double dpiscale);
+
 #ifdef IOS
     /// @see lok::Document::paintTileToCGContext().
     void (*paintTileToCGContext) (LibreOfficeKitDocument* pThis,
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx b/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
index 4057686a9..4a0ec6784 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -164,16 +164,23 @@ public:
      * @param y y-coordinate from where the dialog should start painting
      * @param width The width of the dialog image to be painted
      * @param height The height of the dialog image to be painted
+     * @param dpiscale The dpi scale value used by the client.  Please note
+     *                 that the x, y, width, height are supposed to be the
+     *                 values with dpiscale applied (ie. dialog covering
+     *                 100x100 "normal" pixels with dpiscale '2' will have
+     *                 200x200 width x height), so that it is easy to compute
+     *                 the buffer sizes etc.
      */
     void paintWindow(unsigned nWindowId,
                      unsigned char* pBuffer,
                      const int x,
                      const int y,
                      const int width,
-                     const int height)
+                     const int height,
+                     const double dpiscale = 1.0)
     {
-        return mpDoc->pClass->paintWindow(mpDoc, nWindowId, pBuffer,
-                                          x, y, width, height);
+        return mpDoc->pClass->paintWindowDPI(mpDoc, nWindowId, pBuffer,
+                                             x, y, width, height, dpiscale);
     }
 
     /**
@@ -582,13 +589,13 @@ public:
      *  Insert certificate (in binary form) to the certificate store.
      */
     bool insertCertificate(const unsigned char* pCertificateBinary,
-                           const int nCertificateBinarySize,
+                           const int pCertificateBinarySize,
                            const unsigned char* pPrivateKeyBinary,
                            const int nPrivateKeyBinarySize)
     {
         return mpDoc->pClass->insertCertificate(mpDoc,
-                        pCertificateBinary, nCertificateBinarySize,
-                        pPrivateKeyBinary, nPrivateKeyBinarySize);
+                                                pCertificateBinary, pCertificateBinarySize,
+                                                pPrivateKeyBinary, nPrivateKeyBinarySize);
     }
 
     /**
@@ -596,9 +603,10 @@ public:
      *
      */
     bool addCertificate(const unsigned char* pCertificateBinary,
-                        const int pCertificateBinarySize)
+                         const int pCertificateBinarySize)
     {
-        return mpDoc->pClass->addCertificate(mpDoc, pCertificateBinary, pCertificateBinarySize);
+        return mpDoc->pClass->addCertificate(mpDoc,
+                                             pCertificateBinary, pCertificateBinarySize);
     }
 
     /**
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
index c3ccc6aa0..cb9091711 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -594,6 +594,20 @@ typedef enum
      * convenience.
      */
     LOK_CALLBACK_CLIPBOARD_CHANGED = 38,
+
+    /**
+     * When the (editing) context changes - like the user switches from
+     * editing textbox in Impress to editing a shape there.
+     *
+     * Payload is the application ID and context, delimited by space.
+     * Eg. com.sun.star.presentation.PresentationDocument TextObject
+     */
+    LOK_CALLBACK_CONTEXT_CHANGED = 39,
+
+    /**
+     * On-load notification of the document signature status.
+     */
+    LOK_CALLBACK_SIGNATURE_STATUS = 40,
 }
 LibreOfficeKitCallbackType;
 
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h b/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h
index ae779f468..5dbf2f83f 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -250,8 +250,7 @@ typedef LibreOfficeKit *(LokHookFunction2)( const char *install_path, const char
 typedef int             (LokHookPreInit)  ( const char *install_path, const char *user_profile_url );
 
 #if defined(IOS)
-extern __attribute__ ((visibility("default")))
-    LibreOfficeKit *libreofficekit_hook_2(const char* install_path, const char* user_profile_path);
+LibreOfficeKit *libreofficekit_hook_2(const char* install_path, const char* user_profile_path);
 #endif
 
 static LibreOfficeKit *lok_init_2( const char *install_path,  const char *user_profile_url )
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index bef59c779..da9e7ae36 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -1514,7 +1514,7 @@ void ChildSession::loKitCallback(const int type, const std::string& payload)
         }
     }
 
-    switch (type)
+    switch (static_cast<LibreOfficeKitCallbackType>(type))
     {
     case LOK_CALLBACK_INVALIDATE_TILES:
         {
@@ -1703,11 +1703,24 @@ void ChildSession::loKitCallback(const int type, const std::string& payload)
         sendTextFrame("clipboardchanged: " + selection);
         break;
     }
+    case LOK_CALLBACK_CONTEXT_CHANGED:
+        sendTextFrame("context: " + payload);
+        break;
     case LOK_CALLBACK_SIGNATURE_STATUS:
         sendTextFrame("signaturestatus: " + payload);
         break;
+
+    case LOK_CALLBACK_DOCUMENT_PASSWORD:
+    case LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY:
+        // these are not handled here.
+        break;
+
+#if !ENABLE_DEBUG
+    // we want a compilation-time failure in the debug builds; but ERR in the
+    // log in the release ones
     default:
         LOG_ERR("Unknown callback event (" << type << "): " << payload);
+#endif
     }
 }
 
diff --git a/kit/KitHelper.hpp b/kit/KitHelper.hpp
index 5212e32ca..c3ca6dfaa 100644
--- a/kit/KitHelper.hpp
+++ b/kit/KitHelper.hpp
@@ -47,7 +47,7 @@ namespace LOKitHelper
     inline std::string kitCallbackTypeToString(const int type)
     {
         // Keep in the same order as in LibreOfficeKitEnums.h
-        switch (type)
+        switch (static_cast<LibreOfficeKitCallbackType>(type))
         {
         case LOK_CALLBACK_INVALIDATE_TILES:
             return "INVALIDATE_TILES";
@@ -109,6 +109,10 @@ namespace LOKitHelper
             return "VIEW_CURSOR_VISIBLE";
         case LOK_CALLBACK_VIEW_LOCK:
             return "VIEW_LOCK";
+        case LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED:
+            return "REDLINE_TABLE_SIZE_CHANGED";
+        case LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED:
+            return "REDLINE_TABLE_ENTRY_MODIFIED";
         case LOK_CALLBACK_COMMENT:
             return "COMMENT";
         case LOK_CALLBACK_INVALIDATE_HEADER:
@@ -123,6 +127,10 @@ namespace LOKitHelper
             return "VALIDITY_LIST_BUTTON";
         case LOK_CALLBACK_CLIPBOARD_CHANGED:
             return "CLIPBOARD_CHANGED";
+        case LOK_CALLBACK_CONTEXT_CHANGED:
+            return "CONTEXT_CHANGED";
+        case LOK_CALLBACK_SIGNATURE_STATUS:
+            return "SIGNATURE_STATUS";
        }
 
         return std::to_string(type);
diff --git a/tools/KitClient.cpp b/tools/KitClient.cpp
index 597f9fc63..6cafbe48e 100644
--- a/tools/KitClient.cpp
+++ b/tools/KitClient.cpp
@@ -82,8 +82,8 @@ extern "C"
             CASE(WINDOW);
             CASE(VALIDITY_LIST_BUTTON);
             CASE(CLIPBOARD_CHANGED);
-            CASE(SIGNATURE_STATUS);
             CASE(CONTEXT_CHANGED);
+            CASE(SIGNATURE_STATUS);
 #undef CASE
         }
         std::cout << " payload: " << payload << std::endl;
diff --git a/wsd/protocol.txt b/wsd/protocol.txt
index bafebd452..e975c44f8 100644
--- a/wsd/protocol.txt
+++ b/wsd/protocol.txt
@@ -483,6 +483,16 @@ versionrestore: <action>
      - prerestore_ack: The host can go ahead with restoring the document to an
        earlier revision.
 
+clipboardchanged: <selection>
+
+    Sent when the content of the internal clipboard has changed.
+
+context: <applicationId> <context>
+
+    Sent when the editing context changes in the application; like when the
+    user switches from editing a textframe to editing a graphic object, etc.
+    Can be used eg. for contextual change of the toolbars.
+
 signaturestatus: <sign status>
     Possible values:
         0xffff - Unknown


More information about the Libreoffice-commits mailing list