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);
50 /* ----- Input functions ----- */
51 /** Find out information about the file. */
52 virtual Gtk::Widget *prefs_input(Inkscape::Extension::Input *module,
53 gchar const *filename);
55 virtual SPDocument *open(Inkscape::Extension::Input *module,
56 gchar const *filename);
58 /* ----- Output functions ----- */
59 /** Find out information about the file. */
60 virtual Gtk::Widget *prefs_output(Inkscape::Extension::Output *module);
61 virtual void save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename);
63 /* ----- Effect functions ----- */
64 /** Find out information about the file. */
65 virtual Gtk::Widget * prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view);
66 /* TODO: need to figure out what we need here */
68 virtual void effect(Inkscape::Extension::Effect *module,
69 Inkscape::UI::View::View *document);
71 /* ----- Print functions ----- */
72 virtual unsigned setup(Inkscape::Extension::Print *module);
73 virtual unsigned set_preview(Inkscape::Extension::Print *module);
75 virtual unsigned begin(Inkscape::Extension::Print *module,
76 SPDocument *doc);
77 virtual unsigned finish(Inkscape::Extension::Print *module);
78 virtual bool textToPath(Inkscape::Extension::Print *ext);
80 /* ----- Rendering methods ----- */
81 virtual unsigned bind(Inkscape::Extension::Print *module,
82 NRMatrix const *transform,
83 float opacity);
84 virtual unsigned release(Inkscape::Extension::Print *module);
85 virtual unsigned comment(Inkscape::Extension::Print *module, const char * comment);
86 virtual unsigned fill(Inkscape::Extension::Print *module,
87 NRBPath const *bpath,
88 NRMatrix const *ctm,
89 SPStyle const *style,
90 NRRect const *pbox,
91 NRRect const *dbox,
92 NRRect const *bbox);
93 virtual unsigned stroke(Inkscape::Extension::Print *module,
94 NRBPath const *bpath,
95 NRMatrix const *transform,
96 SPStyle const *style,
97 NRRect const *pbox,
98 NRRect const *dbox,
99 NRRect const *bbox);
100 virtual unsigned image(Inkscape::Extension::Print *module,
101 unsigned char *px,
102 unsigned int w,
103 unsigned int h,
104 unsigned int rs,
105 NRMatrix const *transform,
106 SPStyle const *style);
107 virtual unsigned text(Inkscape::Extension::Print *module,
108 char const *text,
109 NR::Point p,
110 SPStyle const *style);
111 virtual void processPath(Inkscape::XML::Node * node);
112 };
114 } /* namespace Implementation */
115 } /* namespace Extension */
116 } /* namespace Inkscape */
118 #endif /* __INKSCAPE_EXTENSION_IMPLEMENTATION_H__ */
120 /*
121 Local Variables:
122 mode:c++
123 c-file-style:"stroustrup"
124 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
125 indent-tabs-mode:nil
126 fill-column:99
127 End:
128 */
129 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :