tdf#151073 - enable firebird for appstore build w/o experimental mode
[LibreOffice.git] / include / LibreOfficeKit / LibreOfficeKitGtk.h
blob83a2a1f750f68a81ca43a865424c29736507e33b
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #ifndef INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITGTK_H
11 #define INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITGTK_H
13 #include <gtk/gtk.h>
14 #include <gdk/gdk.h>
16 #include <LibreOfficeKit/LibreOfficeKit.h>
18 G_BEGIN_DECLS
20 #define LOK_TYPE_DOC_VIEW (lok_doc_view_get_type())
21 #define LOK_DOC_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LOK_TYPE_DOC_VIEW, LOKDocView))
22 #define LOK_IS_DOC_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LOK_TYPE_DOC_VIEW))
23 #define LOK_DOC_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LOK_TYPE_DOC_VIEW, LOKDocViewClass))
24 #define LOK_IS_DOC_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), LOK_TYPE_DOC_VIEW))
25 #define LOK_DOC_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), LOK_TYPE_DOC_VIEW, LOKDocViewClass))
27 typedef struct _LOKDocView LOKDocView;
28 typedef struct _LOKDocViewClass LOKDocViewClass;
29 typedef struct _LOKDocViewPrivate LOKDocViewPrivate;
31 struct _LOKDocView
33 GtkDrawingArea aDrawingArea;
36 struct _LOKDocViewClass
38 GtkDrawingAreaClass parent_class;
41 GType lok_doc_view_get_type (void) G_GNUC_CONST;
43 /**
44 * lok_doc_view_new:
45 * @pPath: (nullable) (allow-none): LibreOffice install path. Pass null to set it to default
46 * path which in most cases would be $libdir/libreoffice/program
47 * @cancellable: The cancellable object that you can use to cancel this
48 * operation.
49 * @error: The error that will be set if the object fails to initialize.
51 * Returns: (transfer none): The #LOKDocView widget instance.
53 GtkWidget* lok_doc_view_new (const gchar* pPath,
54 GCancellable *cancellable,
55 GError **error);
57 /**
58 * lok_doc_view_new_from_user_profile:
59 * @pPath: (nullable) (allow-none): LibreOffice install path. Pass null to set it to default
60 * path which in most cases would be $libdir/libreoffice/program
61 * @pUserProfile: (nullable) (allow-none): User profile URL. Must be either a file URL or a
62 * special vnd.sun.star.pathname URL. Pass non-null to be able to use this
63 * widget and LibreOffice itself in parallel.
64 * @cancellable: The cancellable object that you can use to cancel this
65 * operation.
66 * @error: The error that will be set if the object fails to initialize.
68 * Returns: (transfer none): The #LOKDocView widget instance.
70 GtkWidget* lok_doc_view_new_from_user_profile (const gchar* pPath,
71 const gchar* pUserProfile,
72 GCancellable *cancellable,
73 GError **error);
75 /**
76 * lok_doc_view_new_from_widget:
77 * @pDocView: The #LOKDocView instance
78 * @pRenderingArguments: (nullable) (allow-none): lok::Document::initializeForRendering() arguments.
80 * Returns: (transfer none): The #LOKDocView widget instance.
82 GtkWidget* lok_doc_view_new_from_widget (LOKDocView* pDocView,
83 const gchar* pRenderingArguments);
85 /**
86 * lok_doc_view_open_document:
87 * @pDocView: The #LOKDocView instance
88 * @pPath: (transfer full): The path of the document that #LOKDocView widget should try to open
89 * @pRenderingArguments: (nullable) (allow-none): lok::Document::initializeForRendering() arguments.
90 * @cancellable:
91 * @callback:
92 * @userdata:
94 void lok_doc_view_open_document (LOKDocView* pDocView,
95 const gchar* pPath,
96 const gchar* pRenderingArguments,
97 GCancellable* cancellable,
98 GAsyncReadyCallback callback,
99 gpointer userdata);
102 * lok_doc_view_open_document_finish:
103 * @pDocView: The #LOKDocView instance
104 * @res:
105 * @error:
107 * Returns: %TRUE if the document is loaded successfully, %FALSE otherwise
109 gboolean lok_doc_view_open_document_finish (LOKDocView* pDocView,
110 GAsyncResult* res,
111 GError** error);
114 * lok_doc_view_get_document:
115 * @pDocView: The #LOKDocView instance
117 * Gets the document the viewer displays.
119 * Returns: The #LibreOfficeKitDocument instance the widget is currently showing
121 LibreOfficeKitDocument* lok_doc_view_get_document (LOKDocView* pDocView);
124 * lok_doc_view_set_zoom:
125 * @pDocView: The #LOKDocView instance
126 * @fZoom: The new zoom level that pDocView must set it into.
128 * Sets the new zoom level for the widget. Does nothing if fZoom is equal to
129 * existing zoom level. Values outside the range [0.25, 5.0] are clamped into
130 * the nearest allowed value in the interval.
132 void lok_doc_view_set_zoom (LOKDocView* pDocView,
133 float fZoom);
135 * lok_doc_view_set_visible_area:
136 * @pDocView: The #LOKDocView instance
137 * @pVisibleArea: The new visible area of pDocView in twips.
139 * Sets the new visible area of the widget. This helps e.g. the page down key
140 * to jump the correct length, which depends on the amount of visible height of
141 * the document.
143 void lok_doc_view_set_visible_area (LOKDocView* pDocView,
144 GdkRectangle* pVisibleArea);
147 * lok_doc_view_get_zoom:
148 * @pDocView: The #LOKDocView instance
150 * Returns: The current zoom factor value in float for pDocView
152 gfloat lok_doc_view_get_zoom (LOKDocView* pDocView);
155 * lok_doc_view_get_parts:
156 * @pDocView: The #LOKDocView instance
158 * Returns: Part refers to either individual sheets in a Calc, or slides in Impress,
159 * and has no relevance for Writer. Returns -1 if no document is set currently.
161 gint lok_doc_view_get_parts (LOKDocView* pDocView);
164 * lok_doc_view_get_part:
165 * @pDocView: The #LOKDocView instance
167 * Returns: Current part number of the document. Returns -1 if no document is set currently.
169 gint lok_doc_view_get_part (LOKDocView* pDocView);
172 * lok_doc_view_set_part:
173 * @pDocView: The #LOKDocView instance
174 * @nPart:
176 void lok_doc_view_set_part (LOKDocView* pDocView,
177 int nPart);
180 * lok_doc_view_get_part_name:
181 * @pDocView: The #LOKDocView instance
182 * @nPart:
184 * Returns: Get current part name of loaded document. Returns null if no
185 * document is set, or document has been destroyed using lok_doc_view_destroy_document.
187 gchar* lok_doc_view_get_part_name (LOKDocView* pDocView,
188 int nPart);
191 * lok_doc_view_set_partmode:
192 * @pDocView: The #LOKDocView instance
193 * @nPartMode:
195 void lok_doc_view_set_partmode (LOKDocView* pDocView,
196 int nPartMode);
199 * lok_doc_view_reset_view:
200 * @pDocView: The #LOKDocView instance
202 void lok_doc_view_reset_view (LOKDocView* pDocView);
205 * lok_doc_view_set_edit:
206 * @pDocView: The #LOKDocView instance
207 * @bEdit: %TRUE if the pDocView should go in edit mode, %FALSE otherwise
209 * Sets if the viewer is actually an editor or not.
211 void lok_doc_view_set_edit (LOKDocView* pDocView,
212 gboolean bEdit);
215 * lok_doc_view_get_edit:
216 * @pDocView: The #LOKDocView instance
218 * Gets if the viewer is actually an editor or not.
220 * Returns: %TRUE if the given pDocView is in edit mode.
222 gboolean lok_doc_view_get_edit (LOKDocView* pDocView);
225 * lok_doc_view_post_command:
226 * @pDocView: the #LOKDocView instance
227 * @pCommand: the command to issue to LO core
228 * @pArguments: the arguments to the given command
229 * @bNotifyWhenFinished: normally false, but it may be useful for eg. .uno:Save
231 * Posts the .uno: command to the LibreOfficeKit.
233 void lok_doc_view_post_command (LOKDocView* pDocView,
234 const gchar* pCommand,
235 const gchar* pArguments,
236 gboolean bNotifyWhenFinished);
239 * lok_doc_view_get_command_values:
240 * @pDocView: the #LOKDocView instance
241 * @pCommand: the command to issue to LO core
243 * Get a json mapping of the possible values for the given command.
244 * In the form of: {commandName: unoCmd, commandValues: {possible_values}}
246 * Returns: A json mapping of the possible values for the given command
248 gchar * lok_doc_view_get_command_values (LOKDocView* pDocView,
249 const gchar* pCommand);
252 * lok_doc_view_find_next:
253 * @pDocView: The #LOKDocView instance
254 * @pText: text to search for
255 * @bHighlightAll: Whether all the matches should be highlighted or not
257 * Highlights the next matching text in the view. `search-not-found` signal will
258 * be emitted when no search is found
260 void lok_doc_view_find_next (LOKDocView* pDocView,
261 const gchar* pText,
262 gboolean bHighlightAll);
265 * lok_doc_view_find_prev:
266 * @pDocView: The #LOKDocView instance
267 * @pText: text to search for
268 * @bHighlightAll: Whether all the matches should be highlighted or not
270 * Highlights the previous matching text in the view. `search-not-found` signal
271 * will be emitted when no search is found
273 void lok_doc_view_find_prev (LOKDocView* pDocView,
274 const gchar* pText,
275 gboolean bHighlightAll);
278 * lok_doc_view_highlight_all:
279 * @pDocView: The #LOKDocView instance
280 * @pText: text to search for
282 * Highlights all matching texts in the view. `search-not-found` signal
283 * will be emitted when no search is found
285 void lok_doc_view_highlight_all (LOKDocView* pDocView,
286 const gchar* pText);
289 * lok_doc_view_copy_selection:
290 * @pDocView: The #LOKDocView instance
291 * @pMimeType: suggests the return format, for example text/plain;charset=utf-8
292 * @pUsedMimeType: (out): output parameter to inform about the determined format
293 * (suggested or plain text).
295 * Returns: Selected text. The caller must free the returned buffer after
296 * use. Returns null if no document is set.
298 gchar* lok_doc_view_copy_selection (LOKDocView* pDocView,
299 const gchar* pMimeType,
300 gchar** pUsedMimeType);
303 * lok_doc_view_paste:
304 * @pDocView: The #LOKDocView instance
305 * @pMimeType: format of pData, for example text/plain;charset=utf-8
306 * @pData: the data to be pasted
307 * @nSize: length of data to be pasted
309 * Pastes the content at the current cursor position
311 * Returns: if pData was pasted successfully.
313 gboolean lok_doc_view_paste (LOKDocView* pDocView,
314 const gchar* pMimeType,
315 const gchar* pData,
316 gsize nSize);
319 * lok_doc_view_set_document_password:
320 * @pDocView: The #LOKDocView instance
321 * @pURL: the URL of the document to set password for, as sent with signal `password-required`
322 * @pPassword: (nullable) (allow-none): the password, NULL for no password
324 * Set the password for password protected documents
326 void lok_doc_view_set_document_password (LOKDocView* pDocView,
327 const gchar* pURL,
328 const gchar* pPassword);
331 * lok_doc_view_get_version_info:
332 * @pDocView: The #LOKDocView instance
334 * Get version information of the LOKit process
336 * Returns: JSON string containing version information in format:
337 * {ProductName: <>, ProductVersion: <>, ProductExtension: <>, BuildId: <>}
339 * Eg: {"ProductName": "LibreOffice",
340 * "ProductVersion": "5.3",
341 * "ProductExtension": ".0.0.alpha0",
342 * "BuildId": "<full 40 char git hash>"}
344 gchar* lok_doc_view_get_version_info (LOKDocView* pDocView);
347 * lok_doc_view_pixel_to_twip:
348 * @pDocView: The #LOKDocView instance
349 * @fInput: The value in pixels to convert to twips
351 * Converts the value in pixels to twips according to zoom level.
353 * Returns: The corresponding value in twips
355 gfloat lok_doc_view_pixel_to_twip (LOKDocView* pDocView,
356 float fInput);
359 * lok_doc_view_twip_to_pixel:
360 * @pDocView: The #LOKDocView instance
361 * @fInput: The value in twips to convert to pixels
363 * Converts the value in twips to pixels according to zoom level.
365 * Returns: The corresponding value in pixels
367 gfloat lok_doc_view_twip_to_pixel (LOKDocView* pDocView,
368 float fInput);
371 * lok_doc_view_send_content_control_event:
372 * @pDocView: The #LOKDocView instance
373 * @pArguments: (nullable) (allow-none): see lok::Document::sendContentControlEvent() for the details.
375 void lok_doc_view_send_content_control_event(LOKDocView* pDocView, const gchar* pArguments);
377 G_END_DECLS
379 #endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITGTK_H
381 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */