Inkscape
Vector Graphics Editor
implementation.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 Author: Ted Gould <ted@gould.cx>
4 Copyright (c) 2003-2005,2007
5
6 Released under GNU GPL v2+, read the file 'COPYING' for more information.
7
8 This file is the backend to the extensions system. These are
9 the parts of the system that most users will never see, but are
10 important for implementing the extensions themselves. This file
11 contains the base class for all of that.
12*/
13#ifndef SEEN_INKSCAPE_EXTENSION_IMPLEMENTATION_H
14#define SEEN_INKSCAPE_EXTENSION_IMPLEMENTATION_H
15
16#include <vector>
17#include <memory>
18#include <sigc++/signal.h>
19#include <glibmm/value.h>
20#include <2geom/forward.h>
21
22namespace Gtk {
23 class Widget;
24}
25
26class SPDesktop;
27class SPDocument;
28class SPPage;
29class SPStyle;
30class SPItem;
31
32namespace Inkscape {
33
34namespace XML {
35 class Node;
36}
37
38namespace Extension {
39
40class Effect;
41class Extension;
42class Template;
43class TemplatePreset;
44class Input;
45class Output;
46class Print;
47
48typedef std::vector<std::shared_ptr<TemplatePreset>> TemplatePresets;
49
50namespace Implementation {
51
56
61public:
63
64 virtual ~ImplementationDocumentCache ( ) { return; };
65 SPDesktop const * desktop() { return _desktop; }
66};
67
74public:
75 // ----- Constructor / destructor -----
76 Implementation() = default;
77
78 virtual ~Implementation() = default;
79
80 // ----- Basic functions for all Extension -----
81 virtual bool load(Inkscape::Extension::Extension * /*module*/) { return true; }
82
83 virtual void unload(Inkscape::Extension::Extension * /*module*/) {}
84
94 virtual ImplementationDocumentCache * newDocCache (Inkscape::Extension::Extension * /*ext*/, SPDesktop * /*desktop*/) { return nullptr; }
95
97 virtual bool check(Inkscape::Extension::Extension * /*module*/) { return true; }
98
99 virtual bool cancelProcessing () { return true; }
100 virtual void commitDocument () {}
101
102 // ---- Template and Page functions -----
104 virtual void get_template_presets(const Template *tmod, TemplatePresets &presets) const {};
106 virtual bool match_template_size(Inkscape::Extension::Template *tmod, double width, double height){ return false; }
107
108 // ----- Input functions -----
110 gchar const * /*filename*/) { return nullptr; }
111
112 // ----- Output functions -----
114 virtual void save(Inkscape::Extension::Output * /*module*/, SPDocument * /*doc*/, gchar const * /*filename*/) {}
115 virtual void export_raster(
116 Inkscape::Extension::Output * /*module*/,
117 const SPDocument * /*doc*/,
118 std::string const &/*png_file*/,
119 gchar const * /*filename*/) {}
120
121 // ----- Effect functions -----
123 virtual Gtk::Widget * prefs_effect(Inkscape::Extension::Effect *module,
124 SPDesktop *desktop,
125 sigc::signal<void ()> *changeSignal,
127 virtual void effect(Inkscape::Extension::Effect * /*module*/,
128 SPDesktop * /*desktop*/,
129 ImplementationDocumentCache * /*docCache*/);
130 virtual void effect(Inkscape::Extension::Effect * /*module*/,
131 SPDocument *document) {}
132
133 virtual bool apply_filter(Inkscape::Extension::Effect* module, SPItem* item) { return false; }
134
135 // ----- Print functions -----
136 virtual unsigned setup(Inkscape::Extension::Print * /*module*/) { return 0; }
137 virtual unsigned set_preview(Inkscape::Extension::Print * /*module*/) { return 0; }
138
139 virtual unsigned begin(Inkscape::Extension::Print * /*module*/,
140 SPDocument * /*doc*/) { return 0; }
141 virtual unsigned finish(Inkscape::Extension::Print * /*module*/) { return 0; }
142
150 virtual bool textToPath(Inkscape::Extension::Print * /*ext*/) { return false; }
151
159 virtual bool fontEmbedded(Inkscape::Extension::Print * /*ext*/) { return false; }
160
161 // ----- Rendering methods -----
162 virtual unsigned bind(Inkscape::Extension::Print * /*module*/,
163 Geom::Affine const & /*transform*/,
164 float /*opacity*/) { return 0; }
165 virtual unsigned release(Inkscape::Extension::Print * /*module*/) { return 0; }
166 virtual unsigned fill(Inkscape::Extension::Print * /*module*/,
167 Geom::PathVector const & /*pathv*/,
168 Geom::Affine const & /*ctm*/,
169 SPStyle const * /*style*/,
170 Geom::OptRect const & /*pbox*/,
171 Geom::OptRect const & /*dbox*/,
172 Geom::OptRect const & /*bbox*/) { return 0; }
173 virtual unsigned stroke(Inkscape::Extension::Print * /*module*/,
174 Geom::PathVector const & /*pathv*/,
175 Geom::Affine const & /*transform*/,
176 SPStyle const * /*style*/,
177 Geom::OptRect const & /*pbox*/,
178 Geom::OptRect const & /*dbox*/,
179 Geom::OptRect const & /*bbox*/) { return 0; }
180 virtual unsigned image(Inkscape::Extension::Print * /*module*/,
181 unsigned char * /*px*/,
182 unsigned int /*w*/,
183 unsigned int /*h*/,
184 unsigned int /*rs*/,
185 Geom::Affine const & /*transform*/,
186 SPStyle const * /*style*/) { return 0; }
187 virtual unsigned text(Inkscape::Extension::Print * /*module*/,
188 char const * /*text*/,
189 Geom::Point const & /*p*/,
190 SPStyle const * /*style*/) { return 0; }
191 virtual void processPath(Inkscape::XML::Node * /*node*/) {}
192
196 virtual void setDetachBase(bool detach) {}
197};
198
199
200} // namespace Implementation
201} // namespace Extension
202} // namespace Inkscape
203
204#endif // SEEN_INKSCAPE_EXTENSION_IMPLEMENTATION_H
205
206/*
207 Local Variables:
208 mode:c++
209 c-file-style:"stroustrup"
210 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
211 indent-tabs-mode:nil
212 fill-column:99
213 End:
214*/
215// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
uint64_t page
Definition: canvas.cpp:172
3x3 matrix representing an affine transformation.
Definition: affine.h:70
Axis-aligned rectangle that can be empty.
Definition: rect.h:180
Sequence of subpaths.
Definition: pathvector.h:122
Two-dimensional point that doubles as a vector.
Definition: point.h:66
Effects are extensions that take a document and do something to it in place.
Definition: effect.h:39
The object that is the basis for the Extension system.
Definition: extension.h:130
A cache for the document and this implementation.
SPDesktop * _desktop
The document that this instance is working on.
Base class for all implementations of modules.
virtual bool match_template_size(Inkscape::Extension::Template *tmod, double width, double height)
virtual unsigned release(Inkscape::Extension::Print *)
virtual bool textToPath(Inkscape::Extension::Print *)
Tell the printing engine whether text should be text or path.
virtual unsigned fill(Inkscape::Extension::Print *, Geom::PathVector const &, Geom::Affine const &, SPStyle const *, Geom::OptRect const &, Geom::OptRect const &, Geom::OptRect const &)
virtual void unload(Inkscape::Extension::Extension *)
virtual unsigned image(Inkscape::Extension::Print *, unsigned char *, unsigned int, unsigned int, unsigned int, Geom::Affine const &, SPStyle const *)
virtual unsigned set_preview(Inkscape::Extension::Print *)
virtual unsigned text(Inkscape::Extension::Print *, char const *, Geom::Point const &, SPStyle const *)
virtual unsigned bind(Inkscape::Extension::Print *, Geom::Affine const &, float)
virtual bool fontEmbedded(Inkscape::Extension::Print *)
Get "fontEmbedded" param, i.e.
virtual void export_raster(Inkscape::Extension::Output *, const SPDocument *, std::string const &, gchar const *)
virtual bool load(Inkscape::Extension::Extension *)
virtual void effect(Inkscape::Extension::Effect *, SPDesktop *, ImplementationDocumentCache *)
virtual void get_template_presets(const Template *tmod, TemplatePresets &presets) const
virtual void setDetachBase(bool detach)
If detach = true, when saving to a file, don't store URIs relative to the filename.
virtual Gtk::Widget * prefs_effect(Inkscape::Extension::Effect *module, SPDesktop *desktop, sigc::signal< void()> *changeSignal, ImplementationDocumentCache *docCache)
Find out information about the file.
virtual bool check(Inkscape::Extension::Extension *)
Verify any dependencies.
virtual void save(Inkscape::Extension::Output *, SPDocument *, gchar const *)
Find out information about the file.
virtual void effect(Inkscape::Extension::Effect *, SPDocument *document)
virtual void processPath(Inkscape::XML::Node *)
virtual unsigned finish(Inkscape::Extension::Print *)
virtual bool apply_filter(Inkscape::Extension::Effect *module, SPItem *item)
virtual unsigned begin(Inkscape::Extension::Print *, SPDocument *)
virtual ImplementationDocumentCache * newDocCache(Inkscape::Extension::Extension *, SPDesktop *)
Create a new document cache object.
virtual SPDocument * open(Inkscape::Extension::Input *, gchar const *)
virtual unsigned setup(Inkscape::Extension::Print *)
virtual void resize_to_template(Inkscape::Extension::Template *tmod, SPDocument *doc, SPPage *page)
virtual SPDocument * new_from_template(Inkscape::Extension::Template *)
virtual unsigned stroke(Inkscape::Extension::Print *, Geom::PathVector const &, Geom::Affine const &, SPStyle const *, Geom::OptRect const &, Geom::OptRect const &, Geom::OptRect const &)
Interface for refcounted XML nodes.
Definition: node.h:80
To do: update description of desktop.
Definition: desktop.h:150
Typed SVG document implementation.
Definition: document.h:106
Base class for visual SVG elements.
Definition: sp-item.h:107
Definition: sp-page.h:31
An SVG style object.
Definition: style.h:45
Contains forward declarations of 2geom types.
SPItem * item
Definition: imagemagick.cpp:43
Definition: desktop.h:51
std::vector< std::shared_ptr< TemplatePreset > > TemplatePresets
CMYK to sRGB conversion routines.
double height
double width