diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-12-21 13:20:26 +0530 |
---|---|---|
committer | Pranav Kant <pranavk@collabora.co.uk> | 2017-12-21 13:26:05 +0530 |
commit | 71cd37fad9792038279969c82e0cb209df06f024 (patch) | |
tree | d1713eef1c79019fd16930505f737767130b568f /libreofficekit/source | |
parent | 9d2e0d60c0381a4bb23fada14c80e032b68bf2a8 (diff) |
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
Diffstat (limited to 'libreofficekit/source')
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.cxx | 68 |
1 files changed, 65 insertions, 3 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 9070cb902236..f2609149de06 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -275,6 +275,7 @@ enum COMMENT, RULER, WINDOW, + INVALIDATE_HEADER, LAST_SIGNAL }; @@ -428,6 +429,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: @@ -1410,6 +1413,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; @@ -3198,6 +3204,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), @@ -3209,9 +3231,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", @@ -3222,6 +3267,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* |