diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-05-13 08:26:32 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-05-13 09:10:25 +0200 |
commit | c7d80d229a5660a0ee702477bfbd2ca137992a7d (patch) | |
tree | 841439801c80dab822561b224b162f86c748f4e5 /libreofficekit/source | |
parent | 09e0cfd9b3e391435c39d3bc933d26a87e2b082e (diff) |
sw content controls, dropdown: add LOK API
- expose the available list items in a new "items" key of the
LOK_CALLBACK_CONTENT_CONTROL callback
- add a new lok::Document::sendContentControlEvent() function to be able
to select a list item from the current drop-down
- add a new listbox to the gtktiledviewer toolbar to select a content
control list item when the cursor is inside a dropdown
- add tests for the array API of tools::JsonWriter
Change-Id: I47f1333a7815d67952f7c20a9cba1b248886f6dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134256
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'libreofficekit/source')
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.cxx | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 1bf7e7301d7c..b20cc85af875 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -1410,8 +1410,8 @@ callback (gpointer pData) { priv->m_aContentControlRectangles.clear(); } - bool bIsTextSelected = !priv->m_aContentControlRectangles.empty(); - g_signal_emit(pDocView, doc_view_signals[CONTENT_CONTROL], 0, bIsTextSelected); + g_signal_emit(pCallback->m_pDocView, doc_view_signals[CONTENT_CONTROL], 0, + pCallback->m_aPayload.c_str()); gtk_widget_queue_draw(GTK_WIDGET(pDocView)); } break; @@ -3325,7 +3325,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) /** * LOKDocView::content-control: * @pDocView: the #LOKDocView on which the signal is emitted - * @bIsTextSelected: whether current content control is non-null + * @pPayload: the JSON string containing the information about ruler properties */ doc_view_signals[CONTENT_CONTROL] = g_signal_new("content-control", @@ -3333,9 +3333,9 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) G_SIGNAL_RUN_FIRST, 0, nullptr, nullptr, - g_cclosure_marshal_VOID__BOOLEAN, + g_cclosure_marshal_generic, G_TYPE_NONE, 1, - G_TYPE_BOOLEAN); + G_TYPE_STRING); /** * LOKDocView::password-required: @@ -3726,6 +3726,23 @@ lok_doc_view_set_part (LOKDocView* pDocView, int nPart) priv->m_nPartId = nPart; } +SAL_DLLPUBLIC_EXPORT void lok_doc_view_send_content_control_event(LOKDocView* pDocView, + const gchar* pArguments) +{ + LOKDocViewPrivate& priv = getPrivate(pDocView); + if (!priv->m_pDocument) + { + return; + } + + std::scoped_lock<std::mutex> aGuard(g_aLOKMutex); + std::stringstream ss; + ss << "lok::Document::sendContentControlEvent('" << pArguments << "')"; + g_info("%s", ss.str().c_str()); + priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId); + return priv->m_pDocument->pClass->sendContentControlEvent(priv->m_pDocument, pArguments); +} + SAL_DLLPUBLIC_EXPORT gchar* lok_doc_view_get_part_name (LOKDocView* pDocView, int nPart) { |