Code

DBUS. Patch for Bug #696062, dbus builds no more.
[inkscape.git] / src / extension / dbus / document-interface.h
1 /*
2  * This is where the implementation of the DBus based document API lives.
3  * All the methods in here (except in the helper section) are 
4  * designed to be called remotly via DBus. application-interface.cpp
5  * has the methods used to connect to the bus and get a document instance.
6  *
7  * Documentation for these methods is in document-interface.xml
8  * which is the "gold standard" as to how the interface should work.
9  *
10  * Authors:
11  *   Soren Berg <Glimmer07@gmail.com>
12  *
13  * Copyright (C) 2009 Soren Berg
14  *
15  * Released under GNU GPL, read the file 'COPYING' for more information
16  */
17  
18 #ifndef INKSCAPE_EXTENSION_DOCUMENT_INTERFACE_H_
19 #define INKSCAPE_EXTENSION_DOCUMENT_INTERFACE_H_
21 #include <glib.h>
22 #include <dbus/dbus-glib.h>
23 #include <dbus/dbus-glib-bindings.h>
24 #include <dbus/dbus-glib-lowlevel.h>
25 #include "desktop.h"
27 #define DBUS_DOCUMENT_INTERFACE_PATH  "/org/inkscape/document"
28         
29 #define TYPE_DOCUMENT_INTERFACE            (document_interface_get_type ())
30 #define DOCUMENT_INTERFACE(object)         (G_TYPE_CHECK_INSTANCE_CAST ((object), TYPE_DOCUMENT_INTERFACE, DocumentInterface))
31 #define DOCUMENT_INTERFACE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DOCUMENT_INTERFACE, DocumentInterfaceClass))
32 #define IS_DOCUMENT_INTERFACE(object)      (G_TYPE_CHECK_INSTANCE_TYPE ((object), TYPE_DOCUMENT_INTERFACE))
33 #define IS_DOCUMENT_INTERFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DOCUMENT_INTERFACE))
34 #define DOCUMENT_INTERFACE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DOCUMENT_INTERFACE, DocumentInterfaceClass))
36 G_BEGIN_DECLS
38 typedef struct _DocumentInterface DocumentInterface;
39 typedef struct _DocumentInterfaceClass DocumentInterfaceClass;
41 struct _DocumentInterface {
42         GObject parent;
43         SPDesktop *desk;
44     gboolean updates;
45 };
47 struct _DocumentInterfaceClass {
48         GObjectClass parent;
49 };
51 typedef enum
52 {
53   INKSCAPE_ERROR_SELECTION,
54   INKSCAPE_ERROR_OBJECT,
55   INKSCAPE_ERROR_VERB,
56   INKSCAPE_ERROR_OTHER
57 } InkscapeError;
59 #define INKSCAPE_ERROR (inkscape_error_quark ())
60 #define INKSCAPE_TYPE_ERROR (inkscape_error_get_type ()) 
62 GQuark inkscape_error_quark (void);
63 GType inkscape_error_get_type (void);
65 struct DBUSPoint {
66     int x;
67     int y;
68 };
69 /****************************************************************************
70      MISC FUNCTIONS
71 ****************************************************************************/
73 gboolean 
74 document_interface_delete_all (DocumentInterface *object, GError **error);
76 gboolean
77 document_interface_call_verb (DocumentInterface *object, 
78                               gchar *verbid, GError **error);
80 /****************************************************************************
81      CREATION FUNCTIONS
82 ****************************************************************************/
84 gchar* 
85 document_interface_rectangle (DocumentInterface *object, int x, int y, 
86                               int width, int height, GError **error);
88 gchar* 
89 document_interface_ellipse (DocumentInterface *object, int x, int y, 
90                               int width, int height, GError **error);
92 gchar* 
93 document_interface_polygon (DocumentInterface *object, int cx, int cy, 
94                             int radius, int rotation, int sides, 
95                             GError **error);
97 gchar* 
98 document_interface_star (DocumentInterface *object, int cx, int cy, 
99                          int r1, int r2, int sides, gdouble rounded,
100                          gdouble arg1, gdouble arg2, GError **error);
102 gchar* 
103 document_interface_spiral (DocumentInterface *object, int cx, int cy, 
104                                    int r, int revolutions, GError **error);
106 gchar* 
107 document_interface_line (DocumentInterface *object, int x, int y, 
108                               int x2, int y2, GError **error);
110 gboolean
111 document_interface_text (DocumentInterface *object, int x, int y, 
112                          gchar *text, GError **error);
113                          
114 gchar *
115 document_interface_image (DocumentInterface *object, int x, int y, 
116                           gchar *filename, GError **error);
118 gchar* 
119 document_interface_node (DocumentInterface *object, gchar *svgtype, 
120                              GError **error);
123 /****************************************************************************
124      ENVIORNMENT FUNCTIONS
125 ****************************************************************************/
126 gdouble
127 document_interface_document_get_width (DocumentInterface *object);
129 gdouble
130 document_interface_document_get_height (DocumentInterface *object);
132 gchar *
133 document_interface_document_get_css (DocumentInterface *object, GError **error);
135 gboolean 
136 document_interface_document_merge_css (DocumentInterface *object,
137                                        gchar *stylestring, GError **error);
139 gboolean 
140 document_interface_document_set_css (DocumentInterface *object,
141                                      gchar *stylestring, GError **error);
143 gboolean 
144 document_interface_document_resize_to_fit_selection (DocumentInterface *object,
145                                                      GError **error);
147 /****************************************************************************
148      OBJECT FUNCTIONS
149 ****************************************************************************/
151 gboolean
152 document_interface_set_attribute (DocumentInterface *object, 
153                                   char *shape, char *attribute, 
154                                   char *newval, GError **error);
156 gboolean
157 document_interface_set_int_attribute (DocumentInterface *object, 
158                                       char *shape, char *attribute, 
159                                       int newval, GError **error);
161 gboolean
162 document_interface_set_double_attribute (DocumentInterface *object, 
163                                          char *shape, char *attribute, 
164                                          double newval, GError **error);
166 gchar * 
167 document_interface_get_attribute (DocumentInterface *object, 
168                                   char *shape, char *attribute, GError **error);
170 gboolean 
171 document_interface_move (DocumentInterface *object, gchar *name, 
172                          gdouble x, gdouble y, GError **error);
174 gboolean 
175 document_interface_move_to (DocumentInterface *object, gchar *name, 
176                             gdouble x, gdouble y, GError **error);
178 gboolean
179 document_interface_object_to_path (DocumentInterface *object, 
180                                    char *shape, GError **error);
182 gchar *
183 document_interface_get_path (DocumentInterface *object, 
184                              char *pathname, GError **error);
186 gboolean 
187 document_interface_transform (DocumentInterface *object, gchar *shape,
188                               gchar *transformstr, GError **error);
190 gchar *
191 document_interface_get_css (DocumentInterface *object, gchar *shape,
192                             GError **error);
194 gboolean 
195 document_interface_modify_css (DocumentInterface *object, gchar *shape,
196                                gchar *cssattrb, gchar *newval, GError **error);
198 gboolean 
199 document_interface_merge_css (DocumentInterface *object, gchar *shape,
200                                gchar *stylestring, GError **error);
202 gboolean 
203 document_interface_set_color (DocumentInterface *object, gchar *shape,
204                               int r, int g, int b, gboolean fill, GError **error);
206 gboolean 
207 document_interface_move_to_layer (DocumentInterface *object, gchar *shape, 
208                               gchar *layerstr, GError **error);
211 GArray *
212 document_interface_get_node_coordinates (DocumentInterface *object, gchar *shape);
214 /****************************************************************************
215      FILE I/O FUNCTIONS
216 ****************************************************************************/
218 gboolean 
219 document_interface_save (DocumentInterface *object, GError **error);
221 gboolean 
222 document_interface_load (DocumentInterface *object, 
223                         gchar *filename, GError **error);
225 gboolean 
226 document_interface_save_as (DocumentInterface *object, 
227                            const gchar *filename, GError **error);
229 gboolean 
230 document_interface_mark_as_unmodified (DocumentInterface *object, GError **error);
231 /*
232 gboolean 
233 document_interface_print_to_file (DocumentInterface *object, GError **error);
234 */
236 /****************************************************************************
237      PROGRAM CONTROL FUNCTIONS
238 ****************************************************************************/
240 gboolean
241 document_interface_close (DocumentInterface *object, GError **error);
243 gboolean
244 document_interface_exit (DocumentInterface *object, GError **error);
246 gboolean
247 document_interface_undo (DocumentInterface *object, GError **error);
249 gboolean
250 document_interface_redo (DocumentInterface *object, GError **error);
253 /****************************************************************************
254      UPDATE FUNCTIONS
255 ****************************************************************************/
256 void
257 document_interface_pause_updates (DocumentInterface *object, GError **error);
259 void
260 document_interface_resume_updates (DocumentInterface *object, GError **error);
262 void
263 document_interface_update (DocumentInterface *object, GError **error);
265 /****************************************************************************
266      SELECTION FUNCTIONS
267 ****************************************************************************/
268 gboolean
269 document_interface_selection_get (DocumentInterface *object, char ***out, GError **error);
271 gboolean
272 document_interface_selection_add (DocumentInterface *object, 
273                                   char *name, GError **error);
275 gboolean
276 document_interface_selection_add_list (DocumentInterface *object, 
277                                        char **names, GError **error);
279 gboolean
280 document_interface_selection_set (DocumentInterface *object, 
281                                   char *name, GError **error);
283 gboolean
284 document_interface_selection_set_list (DocumentInterface *object, 
285                                        gchar **names, GError **error);
287 gboolean
288 document_interface_selection_rotate (DocumentInterface *object, 
289                                      int angle, GError **error);
291 gboolean
292 document_interface_selection_delete(DocumentInterface *object, GError **error);
294 gboolean
295 document_interface_selection_clear(DocumentInterface *object, GError **error);
297 gboolean
298 document_interface_select_all(DocumentInterface *object, GError **error);
300 gboolean
301 document_interface_select_all_in_all_layers(DocumentInterface *object, 
302                                             GError **error);
304 gboolean
305 document_interface_selection_box (DocumentInterface *object, int x, int y,
306                                   int x2, int y2, gboolean replace, 
307                                   GError **error);
309 gboolean
310 document_interface_selection_invert (DocumentInterface *object, GError **error);
312 gboolean
313 document_interface_selection_group(DocumentInterface *object, GError **error);
315 gboolean
316 document_interface_selection_ungroup(DocumentInterface *object, GError **error);
318 gboolean
319 document_interface_selection_cut(DocumentInterface *object, GError **error);
321 gboolean
322 document_interface_selection_copy(DocumentInterface *object, GError **error);
324 gboolean
325 document_interface_selection_paste(DocumentInterface *object, GError **error);
327 gboolean
328 document_interface_selection_scale (DocumentInterface *object, 
329                                     gdouble grow, GError **error);
331 gboolean
332 document_interface_selection_move (DocumentInterface *object, gdouble x, 
333                                    gdouble y, GError **error);
335 gboolean
336 document_interface_selection_move_to (DocumentInterface *object, gdouble x, 
337                                       gdouble y, GError **error);
339 gboolean 
340 document_interface_selection_move_to_layer (DocumentInterface *object,
341                                             gchar *layerstr, GError **error);
343 GArray * 
344 document_interface_selection_get_center (DocumentInterface *object);
346 gboolean 
347 document_interface_selection_to_path (DocumentInterface *object, GError **error);
349 gchar *
350 document_interface_selection_combine (DocumentInterface *object, gchar *cmd,
351                                       GError **error);
353 gboolean
354 document_interface_selection_divide (DocumentInterface *object, 
355                                      char ***out, GError **error);
358 gboolean
359 document_interface_selection_change_level (DocumentInterface *object, gchar *cmd,
360                                       GError **error);
362 /****************************************************************************
363      LAYER FUNCTIONS
364 ****************************************************************************/
366 gchar *
367 document_interface_layer_new (DocumentInterface *object, GError **error);
369 gboolean 
370 document_interface_layer_set (DocumentInterface *object,
371                               gchar *layerstr, GError **error);
373 gchar **
374 document_interface_layer_get_all (DocumentInterface *object);
376 gboolean 
377 document_interface_layer_change_level (DocumentInterface *object,
378                                        gchar *cmd, GError **error);
380 gboolean 
381 document_interface_layer_next (DocumentInterface *object, GError **error);
383 gboolean 
384 document_interface_layer_previous (DocumentInterface *object, GError **error);
393 DocumentInterface *document_interface_new (void);
394 GType document_interface_get_type (void);
397 G_END_DECLS
399 #endif // INKSCAPE_EXTENSION_DOCUMENT_INTERFACE_H_