1 #ifndef SP_TREF_H
2 #define SP_TREF_H
4 /** \file
5 * SVG <tref> implementation, see sp-tref.cpp.
6 *
7 * This file was created based on skeleton.h
8 */
9 /*
10 * Authors:
11 * Gail Banaszkiewicz <Gail.Banaszkiewicz@gmail.com>
12 *
13 * Copyright (C) 2007 Gail Banaszkiewicz
14 *
15 * Released under GNU GPL, read the file 'COPYING' for more information
16 */
18 #include "sp-item.h"
19 #include "sp-tref-reference.h"
20 #include "text-tag-attributes.h"
23 /* tref base class */
25 #define SP_TYPE_TREF (sp_tref_get_type())
26 #define SP_TREF(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_TREF, SPTRef))
27 #define SP_TREF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_TREF, SPTSpanClass))
28 #define SP_IS_TREF(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_TREF))
29 #define SP_IS_TREF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_TREF))
31 class SPTRef;
32 class SPTRef;
34 struct SPTRef : public SPItem {
35 // Attributes that are used in the same way they would be in a tspan
36 TextTagAttributes attributes;
38 // Text stored in the xlink:href attribute
39 gchar *href;
41 // URI reference to original object
42 SPTRefReference *uriOriginalRef;
44 // Shortcut pointer to the child of the tref (which is a copy
45 // of the character data stored at and/or below the node
46 // referenced by uriOriginalRef)
47 SPObject *stringChild;
49 // The sigc connections for various notifications
50 sigc::connection _delete_connection;
51 sigc::connection _changed_connection;
53 SPObject * getObjectReferredTo();
54 };
56 struct SPTRefClass {
57 SPItemClass parent_class;
58 };
60 GType sp_tref_get_type();
62 void sp_tref_update_text(SPTRef *tref);
63 bool sp_tref_reference_allowed(SPTRef *tref, SPObject *possible_ref);
64 bool sp_tref_fully_contained(SPObject *start_item, Glib::ustring::iterator &start,
65 SPObject *end_item, Glib::ustring::iterator &end);
66 SPObject * sp_tref_convert_to_tspan(SPObject *item);
69 #endif /* !SP_TREF_H */
71 /*
72 Local Variables:
73 mode:c++
74 c-file-style:"stroustrup"
75 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
76 indent-tabs-mode:nil
77 fill-column:99
78 End:
79 */
80 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :