Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
sp-tag-use.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * SVG <inkscape:tagref> implementation
4 *
5 * Authors:
6 * Theodore Janeczko
7 *
8 * Copyright (C) Theodore Janeczko 2012 <flutterguy317@gmail.com>
9 *
10 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
11 */
12
13#ifndef SEEN_SP_TAG_USE_H
14#define SEEN_SP_TAG_USE_H
15
16#include <memory>
17#include <string>
18#include <optional>
19
20#include <sigc++/scoped_connection.h>
21
22#include "sp-object.h" // for SPObject
23#include "util/cast.h" // for tag_of
24#include "xml/node.h" // for Node
25
26class SPDocument;
27class SPItem;
29enum class SPAttr;
30namespace Inkscape::XML {
31class Node;
32class Document;
33} // namespace Inkscape::XML
34
35class SPTagUse final : public SPObject {
36 int tag() const override { return tag_of<decltype(*this)>; }
37
38 // item built from the original's repr (the visible clone)
39 // relative to the SPUse itself, it is treated as a child, similar to a grouped item relative to its group
40 SPObject *child = nullptr;
41 std::optional<std::string> href;
42
43public:
44 SPTagUse();
45 ~SPTagUse() override;
46
47 void build(SPDocument *doc, Inkscape::XML::Node *repr) override;
48 void set(SPAttr key, char const *value) override;
50 void release() override;
51
52 virtual void href_changed(SPObject* old_ref, SPObject* ref);
53
54 //virtual SPItem* unlink();
55 virtual SPItem* get_original();
56 virtual SPItem* root();
57
58 // the reference to the original object
59 std::unique_ptr<SPTagUseReference> ref;
60 sigc::scoped_connection _changed_connection;
61};
62
63#endif // SEEN_SP_TAG_USE_H
64
65/*
66 Local Variables:
67 mode:c++
68 c-file-style:"stroustrup"
69 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
70 indent-tabs-mode:nil
71 fill-column:99
72 End:
73*/
74// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
SPAttr
Definition attributes.h:27
Hand-rolled LLVM-style RTTI system for class hierarchies where dynamic_cast isn't fast enough.
constexpr int tag_of
Convenience function to retrieve the tag (class id) of a given type.
Definition cast.h:26
Interface for refcounted XML nodes.
Definition node.h:80
Typed SVG document implementation.
Definition document.h:101
Base class for visual SVG elements.
Definition sp-item.h:109
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Definition sp-object.h:160
Inkscape::XML::Node * repr
Definition sp-object.h:193
std::unique_ptr< SPTagUseReference > ref
Definition sp-tag-use.h:59
virtual SPItem * get_original()
virtual void href_changed(SPObject *old_ref, SPObject *ref)
virtual SPItem * root()
Returns the ultimate original of a SPTagUse (i.e.
int tag() const override
Definition sp-tag-use.h:36
SPObject * child
Definition sp-tag-use.h:40
void build(SPDocument *doc, Inkscape::XML::Node *repr) override
sigc::scoped_connection _changed_connection
Definition sp-tag-use.h:60
std::optional< std::string > href
Definition sp-tag-use.h:41
~SPTagUse() override
void release() override
Inkscape::XML::Node * write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned flags) override
@Inkscape XML tree.
static cairo_user_data_key_t key
Interface for XML documents.
Definition document.h:43
Interface for XML nodes.