diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-08-01 02:13:47 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-08-01 02:23:32 +0200 |
commit | 512b782cf466a19ed77d818fa660e1a0dc74fc35 (patch) | |
tree | 905c5ae71d2556a8658030a97c3aa083c016798f /libreofficekit | |
parent | 75a84417af72ce0f540e7a5063a81a1e57a5c6a1 (diff) |
LOK: Implement parts for Writer too.
In Writer, the meaning of 'parts' is a bit different than in Calc or Impress.
In Writer, the parts mean pages, and the document does not give a completely
different view, the cursor just jumps to the given page.
It is up to the client to follow the cursor appropriately to have the desired
effect.
Change-Id: I56b3264e0340cd639bdabfa92b74b52bd1f391a5
Diffstat (limited to 'libreofficekit')
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 8 | ||||
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.cxx | 18 |
2 files changed, 26 insertions, 0 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx index 46d31769ee18..73db97680c38 100644 --- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -359,6 +359,13 @@ static void populatePartSelector() lok_doc_view_get_part( LOK_DOC_VIEW(pDocView) ) ); } +static void signalSize(LOKDocView* /*pLOKDocView*/, gpointer /*pData*/) +{ + g_bPartSelectorBroadcast = false; + populatePartSelector(); + g_bPartSelectorBroadcast = true; +} + static void changePart( GtkWidget* pSelector, gpointer /* pItem */ ) { int nPart = gtk_combo_box_get_active( GTK_COMBO_BOX(pSelector) ); @@ -567,6 +574,7 @@ int main( int argc, char* argv[] ) g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL); g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL); g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL); + g_signal_connect(pDocView, "size-changed", G_CALLBACK(signalSize), NULL); g_signal_connect(pDocView, "hyperlink-clicked", G_CALLBACK(signalHyperlink), NULL); diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index d13fb9b6fc99..b864d6f0ac06 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -114,6 +114,7 @@ enum COMMAND_CHANGED, SEARCH_NOT_FOUND, PART_CHANGED, + SIZE_CHANGED, HYPERLINK_CLICKED, LAST_SIGNAL @@ -581,6 +582,8 @@ callback (gpointer pData) gtk_widget_set_size_request(GTK_WIDGET(pDocView), twipToPixel(priv->m_nDocumentWidthTwips, priv->m_fZoom), twipToPixel(priv->m_nDocumentHeightTwips, priv->m_fZoom)); + + g_signal_emit(pDocView, doc_view_signals[SIZE_CHANGED], 0, NULL); } break; case LOK_CALLBACK_SET_PART: @@ -1707,6 +1710,21 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) G_TYPE_INT); /** + * LOKDocView::size-changed: + * @pDocView: the #LOKDocView on which the signal is emitted + * @aCommand: NULL, we just notify that want to notify the UI elements that are interested. + */ + doc_view_signals[SIZE_CHANGED] = + g_signal_new("size-changed", + G_TYPE_FROM_CLASS(pGObjectClass), + G_SIGNAL_RUN_FIRST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 1, + G_TYPE_INT); + + /** * LOKDocView::hyperlinked-clicked: * @pDocView: the #LOKDocView on which the signal is emitted * @aHyperlink: the URI which the application should handle |