Code

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