diff options
author | Pranav Kant <pranavk@libreoffice.org> | 2015-12-10 21:10:16 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-12-11 14:02:33 +0000 |
commit | ea5c99428f56e1d3a3e782505aa2f56f905038a4 (patch) | |
tree | 4fbb0b1885df1acf67bd7293dc7d9962bca634c1 /libreofficekit | |
parent | No need for a separate <vcl/combobox.h> (diff) | |
download | core-ea5c99428f56e1d3a3e782505aa2f56f905038a4.tar.gz core-ea5c99428f56e1d3a3e782505aa2f56f905038a4.zip |
tdf#96384: Add a new signal 'text-selection' to lokdocview
To help client know when the user has selected a non-null text.
Change-Id: Ie939612fc5f38e2e50e9ad9792e04e89ae918886
Reviewed-on: https://gerrit.libreoffice.org/20621
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'libreofficekit')
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.cxx | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 59033204b0bb..9c3b5c776cf3 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -185,6 +185,7 @@ enum SEARCH_RESULT_COUNT, COMMAND_RESULT, FORMULA_CHANGED, + TEXT_SELECTION, LAST_SIGNAL }; @@ -924,8 +925,9 @@ callback (gpointer pData) case LOK_CALLBACK_TEXT_SELECTION: { priv->m_aTextSelectionRectangles = payloadToRectangles(pDocView, pCallback->m_aPayload.c_str()); + gboolean bIsTextSelected = !priv->m_aTextSelectionRectangles.empty(); // In case the selection is empty, then we get no LOK_CALLBACK_TEXT_SELECTION_START/END events. - if (priv->m_aTextSelectionRectangles.empty()) + if (!bIsTextSelected) { memset(&priv->m_aTextSelectionStart, 0, sizeof(priv->m_aTextSelectionStart)); memset(&priv->m_aHandleStartRect, 0, sizeof(priv->m_aHandleStartRect)); @@ -934,6 +936,8 @@ callback (gpointer pData) } else memset(&priv->m_aHandleMiddleRect, 0, sizeof(priv->m_aHandleMiddleRect)); + + g_signal_emit(pDocView, doc_view_signals[TEXT_SELECTION], 0, bIsTextSelected); gtk_widget_queue_draw(GTK_WIDGET(pDocView)); } break; @@ -2381,6 +2385,21 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); + + /** + * LOKDocView::text-selection: + * @pDocView: the #LOKDocView on which the signal is emitted + * @bIsTextSelected: whether text selected is non-null + */ + doc_view_signals[TEXT_SELECTION] = + g_signal_new("text-selection", + G_TYPE_FROM_CLASS(pGObjectClass), + G_SIGNAL_RUN_FIRST, + 0, + nullptr, nullptr, + g_cclosure_marshal_VOID__BOOLEAN, + G_TYPE_NONE, 1, + G_TYPE_BOOLEAN); } SAL_DLLPUBLIC_EXPORT GtkWidget* |