Code

0395434c91bde0faf9f96e96c422eb5c43efb7c0
[inkscape.git] / src / file.h
1 #ifndef __SP_FILE_H__
2 #define __SP_FILE_H__
4 /*
5  * File/Print operations
6  *
7  * Authors:
8  *   Lauris Kaplinski <lauris@kaplinski.com>
9  *   Chema Celorio <chema@celorio.com>
10  *
11  * Copyright (C) 1999-2002 Authors
12  * Copyright (C) 2001-2002 Ximian, Inc.
13  *
14  * Released under GNU GPL, read the file 'COPYING' for more information
15  */
17 #include <gtkmm.h>
18 #include <glib/gslist.h>
19 #include <gtk/gtkwidget.h>
21 #include "extension/extension-forward.h"
23 struct SPDesktop;
24 struct SPDocument;
26 namespace Inkscape {
27     namespace Extension {
28         struct Extension;
29     }
30 }
32 /*######################
33 ## N E W
34 ######################*/
36 /**
37  * Creates a new Inkscape document and window.
38  * Return value is a pointer to the newly created desktop.
39  */
40 SPDesktop* sp_file_new (const Glib::ustring &templ);
41 SPDesktop* sp_file_new_default (void);
43 /*######################
44 ## D E L E T E
45 ######################*/
47 /**
48  * Close the document/view
49  */
50 void sp_file_exit (void);
52 /*######################
53 ## O P E N
54 ######################*/
56 /**
57  * Opens a new file and window from the given URI
58  */
59 bool sp_file_open(
60     const Glib::ustring &uri,
61     Inkscape::Extension::Extension *key,
62     bool add_to_recent = true,
63     bool replace_empty = true
64     );
66 /**
67  * Displays a file open dialog. Calls sp_file_open on
68  * an OK.
69  */
70 void sp_file_open_dialog (gpointer object, gpointer data);
72 /**
73  * Reverts file to disk-copy on "YES"
74  */
75 void sp_file_revert_dialog ();
77 /*######################
78 ## S A V E
79 ######################*/
81 /**
82  *
83  */
84 bool sp_file_save (gpointer object, gpointer data);
86 /**
87  *  Saves the given document.  Displays a file select dialog
88  *  to choose the new name.
89  */
90 bool sp_file_save_as (gpointer object, gpointer data);
92 /**
93  *  Saves the given document.  Displays a file select dialog
94  *  if needed.
95  */
96 bool sp_file_save_document (SPDocument *document);
98 /* Do the saveas dialog with a document as the parameter */
99 bool sp_file_save_dialog (SPDocument *doc);
102 /*######################
103 ## I M P O R T
104 ######################*/
106 /**
107  * Displays a file selector dialog, to allow the
108  * user to import data into the current document.
109  */
110 void sp_file_import (GtkWidget * widget);
112 /**
113  * Imports a resource
114  */
115 void file_import(SPDocument *in_doc, const Glib::ustring &uri,
116                  Inkscape::Extension::Extension *key);
118 /*######################
119 ## E X P O R T
120 ######################*/
122 /**
123  * Displays a "Save as" dialog for the user, with an
124  * additional type selection, to allow the user to export
125  * the a document as a given type.
126  */
127 void sp_file_export_dialog (void *widget);
129 /**
130  * Export the given document as a Portable Network Graphics (PNG)
131  * file.  Returns FALSE if an error was encountered while writing
132  * the file, TRUE otherwise.
133  */
134 int sp_export_png_file (SPDocument *doc, const gchar *filename,
135                          double x0, double y0, double x1, double y1,
136                          unsigned int width, unsigned int height, double xdpi, double ydpi,
137                          unsigned long bgcolor,
138                          unsigned int (*status) (float, void *), void *data, bool force_overwrite = false, GSList *items_only = NULL);
141 /*######################
142 ## P R I N T
143 ######################*/
145 /* These functions are redundant now, but
146 would be useful as instance methods
147 */
149 /**
150  *
151  */
152 void sp_file_print (void);
154 /**
155  *
156  */
157 void sp_file_print_direct (void);
159 /**
160  *
161  */
162 void sp_file_print_preview (gpointer object, gpointer data);
164 /*#####################
165 ## U T I L I T Y
166 #####################*/
168 /**
169  * clean unused defs out of file
170  */
171 void sp_file_vacuum ();
174 namespace Inkscape {
175 namespace IO {
177 void fixupHrefs( SPDocument *doc, const gchar *uri, gboolean spns );
183 #endif