Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
sp-tref.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2#ifndef SP_TREF_H
3#define SP_TREF_H
4
10/*
11 * Authors:
12 * Gail Banaszkiewicz <Gail.Banaszkiewicz@gmail.com>
13 *
14 * Copyright (C) 2007 Gail Banaszkiewicz
15 *
16 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
17 */
18
19#include "sp-item.h"
20#include "sp-tref-reference.h"
21#include "text-tag-attributes.h"
22
23/* tref base class */
24
25class SPTRef final : public SPItem {
26public:
27 SPTRef();
28 ~SPTRef() override;
29 int tag() const override { return tag_of<decltype(*this)>; }
30
31 // Attributes that are used in the same way they would be in a tspan
33
34 // Text stored in the xlink:href attribute
35 char *href;
36
37 // URI reference to original object
39
40 // Shortcut pointer to the child of the tref (which is a copy
41 // of the character data stored at and/or below the node
42 // referenced by uriOriginalRef)
44
45 // The sigc connections for various notifications
46 sigc::connection _delete_connection;
47 sigc::connection _changed_connection;
48
50 SPObject const *getObjectReferredTo() const;
51
52 void build(SPDocument* doc, Inkscape::XML::Node* repr) override;
53 void release() override;
54 void set(SPAttr key, char const* value) override;
55 void update(SPCtx* ctx, unsigned int flags) override;
56 void modified(unsigned int flags) override;
58
59 Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type) const override;
60 const char* typeName() const override;
61 const char* displayName() const override;
62 char* description() const override;
63};
64
65void sp_tref_update_text(SPTRef *tref);
66bool sp_tref_reference_allowed(SPTRef *tref, SPObject *possible_ref);
67bool sp_tref_fully_contained(SPObject *start_item, Glib::ustring::iterator &start,
68 SPObject *end_item, Glib::ustring::iterator &end);
70
71#endif /* !SP_TREF_H */
72
73/*
74 Local Variables:
75 mode:c++
76 c-file-style:"stroustrup"
77 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
78 indent-tabs-mode:nil
79 fill-column:99
80 End:
81*/
82// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
SPAttr
Definition attributes.h:27
constexpr int tag_of
Convenience function to retrieve the tag (class id) of a given type.
Definition cast.h:26
3x3 matrix representing an affine transformation.
Definition affine.h:70
Axis-aligned rectangle that can be empty.
Definition rect.h:203
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
Geom::Affine transform
Definition sp-item.h:138
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
const char * displayName() const override
The item's type name as a translated human string.
Definition sp-tref.cpp:212
SPTRefReference uriOriginalRef
Definition sp-tref.h:38
SPObject * getObjectReferredTo()
Return the object referred to via the URI reference.
Definition sp-tref.cpp:281
void build(SPDocument *doc, Inkscape::XML::Node *repr) override
Definition sp-tref.cpp:64
TextTagAttributes attributes
Definition sp-tref.h:32
sigc::connection _changed_connection
Definition sp-tref.h:47
~SPTRef() override
Definition sp-tref.cpp:60
char * description() const override
Definition sp-tref.cpp:216
int tag() const override
Definition sp-tref.h:29
Geom::OptRect bbox(Geom::Affine const &transform, SPItem::BBoxType type) const override
Definition sp-tref.cpp:188
void release() override
Definition sp-tref.cpp:75
Inkscape::XML::Node * write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) override
Definition sp-tref.cpp:167
SPObject * stringChild
Definition sp-tref.h:43
void modified(unsigned int flags) override
Definition sp-tref.cpp:147
char * href
Definition sp-tref.h:35
SPTRef()
Definition sp-tref.cpp:51
const char * typeName() const override
The item's type name, not node tag name.
Definition sp-tref.cpp:208
sigc::connection _delete_connection
Definition sp-tref.h:46
void update(SPCtx *ctx, unsigned int flags) override
Definition sp-tref.cpp:127
SPItem * item
Geom::Point start
Geom::Point end
static cairo_user_data_key_t key
Some things pertinent to all visible shapes: SPItem, SPItemView, SPItemCtx.
bool sp_tref_fully_contained(SPObject *start_item, Glib::ustring::iterator &start, SPObject *end_item, Glib::ustring::iterator &end)
Returns true if a tref is fully contained in the confines of the given iterators and layout (or if th...
Definition sp-tref.cpp:324
bool sp_tref_reference_allowed(SPTRef *tref, SPObject *possible_ref)
Returns true when the given tref is allowed to refer to a particular object.
Definition sp-tref.cpp:298
void sp_tref_update_text(SPTRef *tref)
Definition sp-tref.cpp:371
SPObject * sp_tref_convert_to_tspan(SPObject *item)
This function will create a new tspan element with the same attributes as the tref had and add the sa...
Definition sp-tref.cpp:433
Interface for XML documents.
Definition document.h:43
Unused.
Definition sp-object.h:94
contains and manages the attributes common to all types of text tag