ad1bbf1d2fff70f3364ec21d65b94fa24fb20083
1 /*
2 Author: Ted Gould <ted@gould.cx>
3 Copyright (c) 2003-2005,2007
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 /** \brief A cache for the document and this implementation */
30 class ImplementationDocumentCache {
31 /** \brief The document that this instance is working on */
32 Inkscape::UI::View::View * _view;
33 public:
34 ImplementationDocumentCache (Inkscape::UI::View::View * view) :
35 _view(view)
36 {
37 return;
38 };
39 virtual ~ImplementationDocumentCache ( ) { return; };
40 Inkscape::UI::View::View const * view ( ) { return _view; };
41 };
43 /**
44 * Base class for all implementations of modules. This is whether they are done systematically by
45 * having something like the scripting system, or they are implemented internally they all derive
46 * from this class.
47 */
48 class Implementation {
49 public:
50 /* ----- Constructor / destructor ----- */
51 Implementation() {}
53 virtual ~Implementation() {}
55 /* ----- Basic functions for all Extension ----- */
56 virtual bool load(Inkscape::Extension::Extension *module);
58 virtual void unload(Inkscape::Extension::Extension *module);
59 ImplementationDocumentCache * newDocCache (Inkscape::Extension::Extension * ext, Inkscape::UI::View::View * doc);
61 /** Verify any dependencies. */
62 virtual bool check(Inkscape::Extension::Extension *module);
64 virtual bool cancelProcessing (void);
65 virtual void commitDocument (void);
67 /* ----- Input functions ----- */
68 /** Find out information about the file. */
69 virtual Gtk::Widget *prefs_input(Inkscape::Extension::Input *module,
70 gchar const *filename);
72 virtual SPDocument *open(Inkscape::Extension::Input *module,
73 gchar const *filename);
75 /* ----- Output functions ----- */
76 /** Find out information about the file. */
77 virtual Gtk::Widget *prefs_output(Inkscape::Extension::Output *module);
78 virtual void save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename);
80 /* ----- Effect functions ----- */
81 /** Find out information about the file. */
82 virtual Gtk::Widget * prefs_effect(Inkscape::Extension::Effect *module,
83 Inkscape::UI::View::View * view,
84 sigc::signal<void> * changeSignal,
85 ImplementationDocumentCache * docCache);
86 virtual void effect(Inkscape::Extension::Effect *module,
87 Inkscape::UI::View::View *document,
88 ImplementationDocumentCache * docCache);
90 /* ----- Print functions ----- */
91 virtual unsigned setup(Inkscape::Extension::Print *module);
92 virtual unsigned set_preview(Inkscape::Extension::Print *module);
94 virtual unsigned begin(Inkscape::Extension::Print *module,
95 SPDocument *doc);
96 virtual unsigned finish(Inkscape::Extension::Print *module);
97 virtual bool textToPath(Inkscape::Extension::Print *ext);
98 virtual bool fontEmbedded(Inkscape::Extension::Print * ext);
100 /* ----- Rendering methods ----- */
101 virtual unsigned bind(Inkscape::Extension::Print *module,
102 NRMatrix const *transform,
103 float opacity);
104 virtual unsigned release(Inkscape::Extension::Print *module);
105 virtual unsigned comment(Inkscape::Extension::Print *module, const char * comment);
106 virtual unsigned fill(Inkscape::Extension::Print *module,
107 NRBPath const *bpath,
108 NRMatrix const *ctm,
109 SPStyle const *style,
110 NRRect const *pbox,
111 NRRect const *dbox,
112 NRRect const *bbox);
113 virtual unsigned stroke(Inkscape::Extension::Print *module,
114 NRBPath const *bpath,
115 NRMatrix const *transform,
116 SPStyle const *style,
117 NRRect const *pbox,
118 NRRect const *dbox,
119 NRRect const *bbox);
120 virtual unsigned image(Inkscape::Extension::Print *module,
121 unsigned char *px,
122 unsigned int w,
123 unsigned int h,
124 unsigned int rs,
125 NRMatrix const *transform,
126 SPStyle const *style);
127 virtual unsigned text(Inkscape::Extension::Print *module,
128 char const *text,
129 NR::Point p,
130 SPStyle const *style);
131 virtual void processPath(Inkscape::XML::Node * node);
132 };
135 } /* namespace Implementation */
136 } /* namespace Extension */
137 } /* namespace Inkscape */
139 #endif /* __INKSCAPE_EXTENSION_IMPLEMENTATION_H__ */
141 /*
142 Local Variables:
143 mode:c++
144 c-file-style:"stroustrup"
145 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
146 indent-tabs-mode:nil
147 fill-column:99
148 End:
149 */
150 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :