1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /** @file
3  * TODO: insert short description here
4  *//*
5  * Authors: see git history
6  *
7  * Copyright (C) 2018 Authors
8  * Released under GNU GPL v2+, read the file 'COPYING' for more information.
9  */
10 #ifndef INKSCAPE_SP_TEXTPATH_H
11 #define INKSCAPE_SP_TEXTPATH_H
12 
13 #include "svg/svg-length.h"
14 #include "sp-item.h"
15 #include "sp-text.h"
16 
17 class SPUsePath;
18 class Path;
19 
20 #define SP_TEXTPATH(obj) (dynamic_cast<SPTextPath*>((SPObject*)obj))
21 #define SP_IS_TEXTPATH(obj) (dynamic_cast<const SPTextPath*>((SPObject*)obj) != NULL)
22 
23 enum TextPathSide {
24     SP_TEXT_PATH_SIDE_LEFT,
25     SP_TEXT_PATH_SIDE_RIGHT
26 };
27 
28 class SPTextPath : public SPItem {
29 public:
30     SPTextPath();
31     ~SPTextPath() override;
32 
33     TextTagAttributes attributes;
34     SVGLength startOffset;
35     TextPathSide side;
36 
37     Path *originalPath;
38     bool isUpdating;
39     SPUsePath *sourcePath;
40 
41     void build(SPDocument* doc, Inkscape::XML::Node* repr) override;
42     void release() override;
43     void set(SPAttr key, const char* value) override;
44     void update(SPCtx* ctx, unsigned int flags) override;
45     void modified(unsigned int flags) override;
46     Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, unsigned int flags) override;
47 };
48 
49 #define SP_IS_TEXT_TEXTPATH(obj) (SP_IS_TEXT(obj) && obj->firstChild() && SP_IS_TEXTPATH(obj->firstChild()))
50 
51 SPItem *sp_textpath_get_path_item(SPTextPath *tp);
52 void sp_textpath_to_text(SPObject *tp);
53 
54 
55 #endif /* !INKSCAPE_SP_TEXTPATH_H */
56 
57 /*
58   Local Variables:
59   mode:c++
60   c-file-style:"stroustrup"
61   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
62   indent-tabs-mode:nil
63   fill-column:99
64   End:
65 */
66 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
67