summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-05-13 08:26:32 +0200
committerMiklos Vajna <vmiklos@collabora.com>2022-05-16 11:59:46 +0200
commit49c87cd2c82f0203593487e579e84283ffb9f1fd (patch)
tree5e99f58e34307f514a06083f90721d26c8a9ee1b /include
parentebd760cffb9bf607b58f1eead796830a89e3cbba (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 (cherry picked from commit c7d80d229a5660a0ee702477bfbd2ca137992a7d) Change-Id: I47f1333a7815d67952f7c20a9cba1b248886f6dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134385 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h3
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx19
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitGtk.h7
-rw-r--r--include/vcl/ITiledRenderable.hxx6
4 files changed, 35 insertions, 0 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 75b10017b6f6..6ebf81aacaa4 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -469,6 +469,9 @@ struct _LibreOfficeKitDocumentClass
unsigned char** pBitmapBuffer,
int* pWidth, int* pHeight, size_t* pByteSize);
+ /// @see lok::Document::sendContentControlEvent().
+ void (*sendContentControlEvent)(LibreOfficeKitDocument* pThis, const char* pArguments);
+
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 912b3e0d2203..3140e121151d 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -807,6 +807,25 @@ public:
return mpDoc->pClass->renderSearchResult(mpDoc, pSearchResult, pBitmapBuffer, pWidth, pHeight, pByteSize);
}
+ /**
+ * Posts an event for the content control at the cursor position.
+ *
+ * @param pArguments arguments of the event.
+ *
+ * Example argument string:
+ *
+ * {
+ * "type": "drop-down",
+ * "selected": "2"
+ * }
+ *
+ * selects the 3rd list item of the drop-down.
+ */
+ void sendContentControlEvent(const char* pArguments)
+ {
+ mpDoc->pClass->sendContentControlEvent(mpDoc, pArguments);
+ }
+
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index 15958e35644b..83a2a1f750f6 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -367,6 +367,13 @@ gfloat lok_doc_view_pixel_to_twip (LOKDocView*
gfloat lok_doc_view_twip_to_pixel (LOKDocView* pDocView,
float fInput);
+/**
+ * lok_doc_view_send_content_control_event:
+ * @pDocView: The #LOKDocView instance
+ * @pArguments: (nullable) (allow-none): see lok::Document::sendContentControlEvent() for the details.
+ */
+void lok_doc_view_send_content_control_event(LOKDocView* pDocView, const gchar* pArguments);
+
G_END_DECLS
#endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITGTK_H
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index c40c6f1cfb44..3c0a4cacabe0 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -337,6 +337,12 @@ public:
{
return std::vector<basegfx::B2DRange>();
}
+
+ /**
+ * Execute a content control event in the document.
+ * E.g. select a list item from a drop down content control.
+ */
+ virtual void executeContentControlEvent(const StringMap&) {}
};
} // namespace vcl