Code

Fixed const/non-const mismatch loop.
[inkscape.git] / src / extension / system.h
1 /*
2  * This is file is kind of the junk file.  Basically everything that
3  * didn't fit in one of the other well defined areas, well, it's now
4  * here.  Which is good in someways, but this file really needs some
5  * definition.  Hopefully that will come ASAP.
6  *
7  * Authors:
8  *   Ted Gould <ted@gould.cx>
9  *
10  * Copyright (C) 2002-2004 Authors
11  *
12  * Released under GNU GPL, read the file 'COPYING' for more information
13  */
15 #ifndef INKSCAPE_EXTENSION_SYSTEM_H__
16 #define INKSCAPE_EXTENSION_SYSTEM_H__
18 #include "document.h"
19 #include "extension/extension.h"
21 namespace Inkscape {
22 namespace Extension {
24 /**
25  * Used to distinguish between the various invocations of the save dialogs (and thus to determine
26  * the file type and save path offered in the dialog)
27  */
28 enum FileSaveMethod {
29     FILE_SAVE_METHOD_SAVE_AS,
30     FILE_SAVE_METHOD_SAVE_COPY,
31     FILE_SAVE_METHOD_EXPORT,
32     // Fallback for special cases (e.g., when saving a document for the first time or after saving
33     // it in a lossy format)
34     FILE_SAVE_METHOD_INKSCAPE_SVG,
35     // For saving temporary files; we return the same data as for FILE_SAVE_METHOD_SAVE_AS
36     FILE_SAVE_METHOD_TEMPORARY,
37 };
39 SPDocument *open(Extension *key, gchar const *filename);
40 void save(Extension *key, SPDocument *doc, gchar const *filename,
41           bool setextension, bool check_overwrite, bool official,
42           Inkscape::Extension::FileSaveMethod save_method);
43 Print *get_print(gchar const *key);
44 Extension *build_from_file(gchar const *filename);
45 Extension *build_from_mem(gchar const *buffer, Implementation::Implementation *in_imp);
47 /**
48  * Determine the desired default file extension depending on the given file save method.
49  * The returned string is guaranteed to be non-empty.
50  *
51  * @param method the file save method of the dialog
52  * @return the corresponding default file extension
53  */
54 Glib::ustring get_file_save_extension (FileSaveMethod method);
56 /**
57  * Determine the desired default save path depending on the given FileSaveMethod.
58  * The returned string is guaranteed to be non-empty.
59  *
60  * @param method the file save method of the dialog
61  * @param doc the file's document
62  * @return the corresponding default save path
63  */
64 Glib::ustring get_file_save_path (SPDocument *doc, FileSaveMethod method);
66 /**
67  * Write the given file extension back to prefs so that it can be used later on.
68  *
69  * @param extension the file extension which should be written to prefs
70  * @param method the file save mathod of the dialog
71  */
72 void store_file_extension_in_prefs (Glib::ustring extension, FileSaveMethod method);
74 /**
75  * Write the given path back to prefs so that it can be used later on.
76  *
77  * @param path the path which should be written to prefs
78  * @param method the file save mathod of the dialog
79  */
80 void store_save_path_in_prefs (Glib::ustring path, FileSaveMethod method);
82 } } /* namespace Inkscape::Extension */
84 #endif /* INKSCAPE_EXTENSION_SYSTEM_H__ */
86 /*
87   Local Variables:
88   mode:c++
89   c-file-style:"stroustrup"
90   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
91   indent-tabs-mode:nil
92   fill-column:99
93   End:
94 */
95 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :