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 */
12 #ifndef __INKSCAPE_EXTENSION_IMPLEMENTATION_H__
13 #define __INKSCAPE_EXTENSION_IMPLEMENTATION_H__
15 #include <gtk/gtkdialog.h>
16 #include <gdkmm/types.h>
17 #include <gtkmm/widget.h>
19 #include "forward.h"
20 #include "extension/extension-forward.h"
21 #include "libnr/nr-forward.h"
22 #include "libnr/nr-point.h"
23 #include "xml/node.h"
25 namespace Inkscape {
26 namespace Extension {
27 namespace Implementation {
29 /**
30 * Base class for all implementations of modules. This is whether they are done systematically by
31 * having something like the scripting system, or they are implemented internally they all derive
32 * from this class.
33 */
34 class Implementation {
35 public:
36 /* ----- Constructor / destructor ----- */
37 Implementation() {}
39 virtual ~Implementation() {}
41 /* ----- Basic functions for all Extension ----- */
42 virtual bool load(Inkscape::Extension::Extension *module);
44 virtual void unload(Inkscape::Extension::Extension *module);
46 /** Verify any dependencies. */
47 virtual bool check(Inkscape::Extension::Extension *module);
49 virtual bool cancelProcessing (void);
50 virtual void commitDocument (void);
52 /* ----- Input functions ----- */
53 /** Find out information about the file. */
54 virtual Gtk::Widget *prefs_input(Inkscape::Extension::Input *module,
55 gchar const *filename);
57 virtual SPDocument *open(Inkscape::Extension::Input *module,
58 gchar const *filename);
60 /* ----- Output functions ----- */
61 /** Find out information about the file. */
62 virtual Gtk::Widget *prefs_output(Inkscape::Extension::Output *module);
63 virtual void save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename);
65 /* ----- Effect functions ----- */
66 /** Find out information about the file. */
67 virtual Gtk::Widget * prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal);
68 /* TODO: need to figure out what we need here */
70 virtual void effect(Inkscape::Extension::Effect *module,
71 Inkscape::UI::View::View *document);
73 /* ----- Print functions ----- */
74 virtual unsigned setup(Inkscape::Extension::Print *module);
75 virtual unsigned set_preview(Inkscape::Extension::Print *module);
77 virtual unsigned begin(Inkscape::Extension::Print *module,
78 SPDocument *doc);
79 virtual unsigned finish(Inkscape::Extension::Print *module);
80 virtual bool textToPath(Inkscape::Extension::Print *ext);
81 virtual bool fontEmbedded(Inkscape::Extension::Print * ext);
83 /* ----- Rendering methods ----- */
84 virtual unsigned bind(Inkscape::Extension::Print *module,
85 NRMatrix const *transform,
86 float opacity);
87 virtual unsigned release(Inkscape::Extension::Print *module);
88 virtual unsigned comment(Inkscape::Extension::Print *module, const char * comment);
89 virtual unsigned fill(Inkscape::Extension::Print *module,
90 NRBPath const *bpath,
91 NRMatrix const *ctm,
92 SPStyle const *style,
93 NRRect const *pbox,
94 NRRect const *dbox,
95 NRRect const *bbox);
96 virtual unsigned stroke(Inkscape::Extension::Print *module,
97 NRBPath const *bpath,
98 NRMatrix const *transform,
99 SPStyle const *style,
100 NRRect const *pbox,
101 NRRect const *dbox,
102 NRRect const *bbox);
103 virtual unsigned image(Inkscape::Extension::Print *module,
104 unsigned char *px,
105 unsigned int w,
106 unsigned int h,
107 unsigned int rs,
108 NRMatrix const *transform,
109 SPStyle const *style);
110 virtual unsigned text(Inkscape::Extension::Print *module,
111 char const *text,
112 NR::Point p,
113 SPStyle const *style);
114 virtual void processPath(Inkscape::XML::Node * node);
115 };
117 } /* namespace Implementation */
118 } /* namespace Extension */
119 } /* namespace Inkscape */
121 #endif /* __INKSCAPE_EXTENSION_IMPLEMENTATION_H__ */
123 /*
124 Local Variables:
125 mode:c++
126 c-file-style:"stroustrup"
127 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
128 indent-tabs-mode:nil
129 fill-column:99
130 End:
131 */
132 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :