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

Pranav Kant pranavk at collabora.co.uk
Thu Jan 4 10:28:29 UTC 2018


 include/LibreOfficeKit/LibreOfficeKitEnums.h |   32 +++++++++++-
 libreofficekit/source/gtk/lokdocview.cxx     |   68 +++++++++++++++++++++++++--
 2 files changed, 94 insertions(+), 6 deletions(-)

New commits:
commit 58637672b2b444cb0a3c14229c0948dbbd95d6e1
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Dec 21 13:20:26 2017 +0530

    lokdocview: Handle INVALIDATE_HEADER cb
    
    With this calc gtktiledviewer or any other lok client shouldn't crash
    anymore when a new view is opened.
    
    And while at it, update documentation of callbacks.
    
    Change-Id: I436c3b424dd4e2e6b8c312b0d3ba43d7006e944b
    Reviewed-on: https://gerrit.libreoffice.org/47306
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 9cf635bb4c40..46be3f25fea8 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -514,11 +514,12 @@ typedef enum
      * The column/row header is no more valid because of a column/row insertion
      * or a similar event. Clients must query a new column/row header set.
      *
-     * The payload says if we are invalidating a row or column header.
+     * The payload says if we are invalidating a row or column header. So,
+     * payload values can be: "row", "column", "all".
      */
     LOK_CALLBACK_INVALIDATE_HEADER = 33,
     /**
-     * The text content of the address field in Calc.
+     * The text content of the address field in Calc. Eg: "A7"
      */
     LOK_CALLBACK_CELL_ADDRESS = 34,
     /**
@@ -539,7 +540,32 @@ typedef enum
      */
     LOK_CALLBACK_RULER_UPDATE = 35,
     /**
-     * Dialog invalidation
+     * Window related callbacks are emitted under this category. It includes
+     * external windows like dialogs, autopopups for now.
+     *
+     * The payload format is:
+     *
+     * {
+     *    "id": "unique integer id of the dialog",
+     *    "action": "<see below>",
+     *    "type": "<see below>"
+     *    "rectangle": "x, y, width, height"
+     * }
+     *
+     * "type" tells the type of the window the action is associated with
+     *  - "dialog" - window is a dialog
+     *  - "child" - window is a floating window (combo boxes, etc.)
+     *
+     * "action" can take following values:
+     * - "created" - window is created in the backend, client can render it now
+     * - "title_changed" - window's title is changed
+     * - "size_changed" - window's size is changed
+     * - "invalidate" - the area as described by "rectangle" is invalidated
+     *    Clients must request the new area
+     * - "cursor_invalidate" - cursor is invalidated. New position is in "rectangle"
+     * - "cursor_visible" - cursor visible status is changed. Status is availabe
+     *    in "visible" field
+     * - "close" - window is closed
      */
     LOK_CALLBACK_WINDOW = 36,
 }
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 5ae3d24b3685..714d937772d2 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -277,6 +277,7 @@ enum
     COMMENT,
     RULER,
     WINDOW,
+    INVALIDATE_HEADER,
 
     LAST_SIGNAL
 };
@@ -430,6 +431,8 @@ callbackTypeToString (int nType)
         return "LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED";
     case LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED:
         return "LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED";
+    case LOK_CALLBACK_INVALIDATE_HEADER:
+        return "LOK_CALLBACK_INVALIDATE_HEADER";
     case LOK_CALLBACK_COMMENT:
         return "LOK_CALLBACK_COMMENT";
     case LOK_CALLBACK_RULER_UPDATE:
@@ -1413,6 +1416,9 @@ callback (gpointer pData)
     case LOK_CALLBACK_WINDOW:
         g_signal_emit(pCallback->m_pDocView, doc_view_signals[WINDOW], 0, pCallback->m_aPayload.c_str());
         break;
+    case LOK_CALLBACK_INVALIDATE_HEADER:
+        g_signal_emit(pCallback->m_pDocView, doc_view_signals[INVALIDATE_HEADER], 0, pCallback->m_aPayload.c_str());
+        break;
     default:
         g_assert(false);
         break;
@@ -3180,6 +3186,22 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
                      G_TYPE_NONE, 1,
                      G_TYPE_STRING);
 
+    /**
+     * The key ruler related properties on change are reported by this.
+     *
+     * The payload format is:
+     *
+     * {
+     *      "margin1": "...",
+     *      "margin2": "...",
+     *      "leftOffset": "...",
+     *      "pageOffset": "...",
+     *      "pageWidth": "...",
+     *      "unit": "..."
+     *  }
+     *
+     * Here all aproperties are same as described in svxruler.
+     */
     doc_view_signals[RULER] =
         g_signal_new("ruler",
                      G_TYPE_FROM_CLASS(pGObjectClass),
@@ -3191,9 +3213,32 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
                      G_TYPE_STRING);
 
     /**
-     * LOKDocView::window
-     * @pDocView: the #LOKDocView on which the signal is emitted
-     * @pPayload: JSON containing the information, including id, about the window
+     * Window related callbacks are emitted under this category. It includes
+     * external windows like dialogs, autopopups for now.
+     *
+     * The payload format is:
+     *
+     * {
+     *    "id": "unique integer id of the dialog",
+     *    "action": "<see below>",
+     *    "type": "<see below>"
+     *    "rectangle": "x, y, width, height"
+     * }
+     *
+     * "type" tells the type of the window the action is associated with
+     *  - "dialog" - window is a dialog
+     *  - "child" - window is a floating window (combo boxes, etc.)
+     *
+     * "action" can take following values:
+     * - "created" - window is created in the backend, client can render it now
+     * - "title_changed" - window's title is changed
+     * - "size_changed" - window's size is changed
+     * - "invalidate" - the area as described by "rectangle" is invalidated
+     *    Clients must request the new area
+     * - "cursor_invalidate" - cursor is invalidated. New position is in "rectangle"
+     * - "cursor_visible" - cursor visible status is changed. Status is availabe
+     *    in "visible" field
+     * - "close" - window is closed
      */
     doc_view_signals[WINDOW] =
         g_signal_new("window",
@@ -3204,6 +3249,23 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
                      g_cclosure_marshal_generic,
                      G_TYPE_NONE, 1,
                      G_TYPE_STRING);
+
+    /**
+     * The column/row header is no more valid because of a column/row insertion
+     * or a similar event. Clients must query a new column/row header set.
+     *
+     * The payload says if we are invalidating a row or column header. So,
+     * payload values can be: "row", "column", "all".
+     */
+    doc_view_signals[INVALIDATE_HEADER] =
+        g_signal_new("invalidate-header",
+                     G_TYPE_FROM_CLASS(pGObjectClass),
+                     G_SIGNAL_RUN_FIRST,
+                     0,
+                     nullptr, nullptr,
+                     g_cclosure_marshal_generic,
+                     G_TYPE_NONE, 1,
+                     G_TYPE_STRING);
 }
 
 SAL_DLLPUBLIC_EXPORT GtkWidget*


More information about the Libreoffice-commits mailing list