1 /*
2 Author: Ted Gould <ted@gould.cx>
3 Copyright (c) 2003-2005
5 This code is licensed under the GNU GPL. See COPYING for details.
7 This file is the backend to the extensions system. These are
8 the parts of the system that most users will never see, but are
9 important for implementing the extensions themselves. This file
10 contains the base class for all of that.
11 */
13 #ifdef HAVE_CONFIG_H
14 # include <config.h>
15 #endif
16 #include "implementation.h"
18 #include <extension/output.h>
19 #include <extension/input.h>
20 #include <extension/effect.h>
22 namespace Inkscape {
23 namespace Extension {
24 namespace Implementation {
26 /**
27 * \return Was the load sucessful?
28 * \brief This function is the stub load. It just returns success.
29 * \param module The Extension that should be loaded.
30 */
31 bool
32 Implementation::load(Inkscape::Extension::Extension *module) {
33 return TRUE;
34 } /* Implementation::load */
36 void
37 Implementation::unload(Inkscape::Extension::Extension *module) {
38 return;
39 } /* Implementation::unload */
41 /** \brief Create a new document cache object
42 \param ext The extension that is referencing us
43 \param doc The document to create the cache of
44 \return A new document cache that is valid as long as the document
45 is not changed.
47 This function just returns \c NULL. Subclasses are likely
48 to reimplement it to do something useful.
49 */
50 ImplementationDocumentCache *
51 Implementation::newDocCache (Inkscape::Extension::Extension * ext, SPDocument * doc) {
52 return NULL;
53 }
55 bool
56 Implementation::check(Inkscape::Extension::Extension *module) {
57 /* If there are no checks, they all pass */
58 return TRUE;
59 } /* Implemenation::check */
61 bool
62 Implementation::cancelProcessing (void) {
63 return true;
64 }
66 void
67 Implementation::commitDocument (void) {
68 return;
69 }
71 Gtk::Widget *
72 Implementation::prefs_input(Inkscape::Extension::Input *module, gchar const *filename) {
73 return module->autogui(NULL, NULL);
74 } /* Implementation::prefs_input */
76 SPDocument *
77 Implementation::open(Inkscape::Extension::Input *module, gchar const *filename) {
78 /* throw open_failed(); */
79 return NULL;
80 } /* Implementation::open */
82 Gtk::Widget *
83 Implementation::prefs_output(Inkscape::Extension::Output *module) {
84 return module->autogui(NULL, NULL);
85 } /* Implementation::prefs_output */
87 void
88 Implementation::save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename) {
89 /* throw save_fail */
90 return;
91 } /* Implementation::save */
93 Gtk::Widget *
94 Implementation::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *view, sigc::signal<void> * changeSignal, ImplementationDocumentCache * docCache) {
95 return module->autogui(NULL, NULL);
96 } /* Implementation::prefs_effect */
98 void
99 Implementation::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document, ImplementationDocumentCache * docCache) {
100 /* throw filter_fail */
101 return;
102 } /* Implementation::filter */
104 unsigned int
105 Implementation::setup(Inkscape::Extension::Print *module)
106 {
107 return 0;
108 }
110 unsigned int
111 Implementation::set_preview(Inkscape::Extension::Print *module)
112 {
113 return 0;
114 }
117 unsigned int
118 Implementation::begin(Inkscape::Extension::Print *module, SPDocument *doc)
119 {
120 return 0;
121 }
123 unsigned int
124 Implementation::finish(Inkscape::Extension::Print *module)
125 {
126 return 0;
127 }
130 /* Rendering methods */
131 unsigned int
132 Implementation::bind(Inkscape::Extension::Print *module, NRMatrix const *transform, float opacity)
133 {
134 return 0;
135 }
137 unsigned int
138 Implementation::release(Inkscape::Extension::Print *module)
139 {
140 return 0;
141 }
143 unsigned int
144 Implementation::comment(Inkscape::Extension::Print *module, char const *comment)
145 {
146 return 0;
147 }
149 unsigned int
150 Implementation::fill(Inkscape::Extension::Print *module, NRBPath const *bpath, NRMatrix const *ctm, SPStyle const *style,
151 NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
152 {
153 return 0;
154 }
156 unsigned int
157 Implementation::stroke(Inkscape::Extension::Print *module, NRBPath const *bpath, NRMatrix const *transform, SPStyle const *style,
158 NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
159 {
160 return 0;
161 }
163 unsigned int
164 Implementation::image(Inkscape::Extension::Print *module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs,
165 NRMatrix const *transform, SPStyle const *style)
166 {
167 return 0;
168 }
170 unsigned int
171 Implementation::text(Inkscape::Extension::Print *module, char const *text,
172 NR::Point p, SPStyle const *style)
173 {
174 return 0;
175 }
177 void
178 Implementation::processPath(Inkscape::XML::Node * node)
179 {
180 return;
181 }
183 /**
184 \brief Tell the printing engine whether text should be text or path
185 \retval true Render the text as a path
186 \retval false Render text using the text function (above)
188 Default value is false because most printing engines will support
189 paths more than they'll support text. (at least they do today)
190 */
191 bool
192 Implementation::textToPath(Inkscape::Extension::Print *ext)
193 {
194 return false;
195 }
197 /**
198 \brief Get "fontEmbedded" param, i.e. tell the printing engine whether fonts should be embedded
199 \retval TRUE Fonts have to be embedded in the output so that the user might not need to install fonts to have the interpreter read the document correctly
200 \retval FALSE Not embed fonts
202 Only available for Adobe Type 1 fonts in EPS output as of now
203 */
205 bool
206 Implementation::fontEmbedded(Inkscape::Extension::Print * ext)
207 {
208 return false;
209 }
211 } /* namespace Implementation */
212 } /* namespace Extension */
213 } /* namespace Inkscape */
215 /*
216 Local Variables:
217 mode:c++
218 c-file-style:"stroustrup"
219 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
220 indent-tabs-mode:nil
221 fill-column:99
222 End:
223 */
224 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :