summaryrefslogtreecommitdiffstats
path: root/src/extension/internal/template-base.h
blob: 02481d58dfdf8ffd511b275ec44c3621d772e7c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * A base template generator used by internal template types.
 *
 * Authors:
 *   Martin Owens <doctormo@geek-2.com>
 *
 * Copyright (C) 2022 Authors
 *
 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
 */

#ifndef EXTENSION_INTERNAL_TEMPLATE_BASE_H
#define EXTENSION_INTERNAL_TEMPLATE_BASE_H

#include <glib.h>

#include "2geom/point.h"
#include "extension/extension.h"
#include "extension/implementation/implementation.h"
#include "extension/system.h"
#include "extension/template.h"
#include "util/units.h"

class SPDocument;
class SPPage;

namespace Inkscape {
namespace Extension {
namespace Internal {

class TemplateBase : public Inkscape::Extension::Implementation::Implementation
{
public:
    bool check(Inkscape::Extension::Extension *module) override { return true; };

    SPDocument *new_from_template(Inkscape::Extension::Template *tmod) override;
    void resize_to_template(Inkscape::Extension::Template *tmod, SPDocument *doc, SPPage *page) override;
    bool match_template_size(Inkscape::Extension::Template *tmod, double width, double height) override;

protected:
    virtual Geom::Point get_template_size(Inkscape::Extension::Template *tmod) const;
    virtual Geom::Point get_template_size(Inkscape::Extension::Template *tmod, const Util::Unit *unit) const;
    virtual const Util::Unit *get_template_unit(Inkscape::Extension::Template *tmod) const;

private:
};

} // namespace Internal
} // namespace Extension
} // namespace Inkscape
#endif /* EXTENSION_INTERNAL_TEMPLATE_BASE_H */