1 #ifndef SEEN_SP_TREF_REFERENCE_H
2 #define SEEN_SP_TREF_REFERENCE_H
4 /*
5 * The reference corresponding to href of <tref> element.
6 *
7 * This file was created based on sp-use-reference.h
8 *
9 * Copyright (C) 2007 Gail Banaszkiewicz
10 *
11 * Released under GNU GPL, read the file 'COPYING' for more information.
12 */
14 #include <forward.h>
15 #include <uri-references.h>
16 #include <sigc++/sigc++.h>
18 #include "util/share.h"
19 #include "xml/node-observer.h"
20 #include "xml/subtree.h"
23 class SPTRefReference : public Inkscape::URIReference,
24 public Inkscape::XML::NodeObserver {
25 public:
26 SPTRefReference(SPObject *owner) : URIReference(owner), subtreeObserved(NULL) {
27 updateObserver();
28 }
30 virtual ~SPTRefReference() {
31 if (subtreeObserved) {
32 subtreeObserved->removeObserver(*this);
33 delete subtreeObserved;
34 }
35 }
37 SPItem *getObject() const {
38 return (SPItem *)URIReference::getObject();
39 }
41 void updateObserver();
43 /////////////////////////////////////////////////////////////////////
44 // Node Observer Functions
45 // -----------------------
46 virtual void notifyChildAdded(Inkscape::XML::Node &node, Inkscape::XML::Node &child, Inkscape::XML::Node *prev);
47 virtual void notifyChildRemoved(Inkscape::XML::Node &node, Inkscape::XML::Node &child, Inkscape::XML::Node *prev);
48 virtual void notifyChildOrderChanged(Inkscape::XML::Node &node, Inkscape::XML::Node &child,
49 Inkscape::XML::Node *old_prev, Inkscape::XML::Node *new_prev);
50 virtual void notifyContentChanged(Inkscape::XML::Node &node,
51 Inkscape::Util::ptr_shared<char> old_content,
52 Inkscape::Util::ptr_shared<char> new_content);
53 virtual void notifyAttributeChanged(Inkscape::XML::Node &node, GQuark name,
54 Inkscape::Util::ptr_shared<char> old_value,
55 Inkscape::Util::ptr_shared<char> new_value);
56 /////////////////////////////////////////////////////////////////////
58 protected:
59 virtual bool _acceptObject(SPObject * obj) const;
61 Inkscape::XML::Subtree *subtreeObserved;
62 };
64 #endif /* !SEEN_SP_TREF_REFERENCE_H */
66 /*
67 Local Variables:
68 mode:c++
69 c-file-style:"stroustrup"
70 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
71 indent-tabs-mode:nil
72 fill-column:99
73 End:
74 */
75 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :