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 <stdio.h>
19 #include "forward.h"
20 #include <extension/extension-forward.h>
21 #include <gtk/gtkwidget.h>
23 /*######################
24 ## N E W
25 ######################*/
27 /**
28 * Creates a new Inkscape document and window.
29 * Return value is a pointer to the newly created desktop.
30 */
31 SPDesktop* sp_file_new (const gchar *templ);
32 SPDesktop* sp_file_new_default (void);
34 /*######################
35 ## D E L E T E
36 ######################*/
38 /**
39 * Close the document/view
40 */
41 void sp_file_exit (void);
43 /*######################
44 ## O P E N
45 ######################*/
47 /**
48 * Opens a new file and window from the given URI
49 */
50 bool sp_file_open(
51 const gchar *uri, Inkscape::Extension::Extension *key,
52 bool add_to_recent = true, bool replace_empty = true
53 );
55 /**
56 * Displays a file open dialog. Calls sp_file_open on
57 * an OK.
58 */
59 void sp_file_open_dialog (gpointer object, gpointer data);
61 /**
62 * Reverts file to disk-copy on "YES"
63 */
64 void sp_file_revert_dialog ();
66 /*######################
67 ## S A V E
68 ######################*/
70 /**
71 *
72 */
73 bool sp_file_save (gpointer object, gpointer data);
75 /**
76 * Saves the given document. Displays a file select dialog
77 * to choose the new name.
78 */
79 bool sp_file_save_as (gpointer object, gpointer data);
81 /**
82 * Saves the given document. Displays a file select dialog
83 * if needed.
84 */
85 gboolean sp_file_save_document (SPDocument *document);
87 /* Do the saveas dialog with a document as the parameter */
88 gboolean sp_file_save_dialog (SPDocument *doc);
91 /*######################
92 ## I M P O R T
93 ######################*/
95 /**
96 * Displays a file selector dialog, to allow the
97 * user to import data into the current document.
98 */
99 void sp_file_import (GtkWidget * widget);
101 /**
102 * Imports a resource
103 */
104 void file_import(SPDocument *in_doc, gchar const *uri, Inkscape::Extension::Extension *key);
106 /*######################
107 ## E X P O R T
108 ######################*/
110 /**
111 * Displays a "Save as" dialog for the user, with an
112 * additional type selection, to allow the user to export
113 * the a document as a given type.
114 */
115 void sp_file_export_dialog (void *widget);
117 /**
118 * Export the given document as a Portable Network Graphics (PNG)
119 * file. Returns FALSE if an error was encountered while writing
120 * the file, TRUE otherwise.
121 */
122 int sp_export_png_file (SPDocument *doc, const gchar *filename,
123 double x0, double y0, double x1, double y1,
124 unsigned int width, unsigned int height,
125 unsigned long bgcolor,
126 unsigned int (*status) (float, void *), void *data, bool force_overwrite = false, GSList *items_only = NULL);
129 /*######################
130 ## P R I N T
131 ######################*/
133 /* These functions are redundant now, but
134 would be useful as instance methods
135 */
137 /**
138 *
139 */
140 void sp_file_print (void);
142 /**
143 *
144 */
145 void sp_file_print_direct (void);
147 /**
148 *
149 */
150 void sp_file_print_preview (gpointer object, gpointer data);
152 /*#####################
153 ## U T I L I T Y
154 #####################*/
156 /**
157 * clean unused defs out of file
158 */
159 void sp_file_vacuum ();
162 namespace Inkscape {
163 namespace IO {
165 void fixupHrefs( SPDocument *doc, const gchar *uri, gboolean spns );
167 }
168 }
171 #endif