c2264f83e85516f37246e5b27f4d4aacbc572fa6
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 * Abhishek Sharma
11 *
12 * Released under GNU GPL, read the file 'COPYING' for more information.
13 */
15 #include <forward.h>
16 #include "sp-item.h"
17 #include <uri-references.h>
18 #include <sigc++/sigc++.h>
20 #include "util/share.h"
21 #include "xml/node-observer.h"
22 #include "xml/subtree.h"
25 class SPTRefReference : public Inkscape::URIReference,
26 public Inkscape::XML::NodeObserver {
27 public:
28 SPTRefReference(SPObject *owner) : URIReference(owner), subtreeObserved(NULL) {
29 updateObserver();
30 }
32 virtual ~SPTRefReference() {
33 if (subtreeObserved) {
34 subtreeObserved->removeObserver(*this);
35 delete subtreeObserved;
36 }
37 }
39 SPItem *getObject() const {
40 return (SPItem *)URIReference::getObject();
41 }
43 void updateObserver();
45 /////////////////////////////////////////////////////////////////////
46 // Node Observer Functions
47 // -----------------------
48 virtual void notifyChildAdded(Inkscape::XML::Node &node, Inkscape::XML::Node &child, Inkscape::XML::Node *prev);
49 virtual void notifyChildRemoved(Inkscape::XML::Node &node, Inkscape::XML::Node &child, Inkscape::XML::Node *prev);
50 virtual void notifyChildOrderChanged(Inkscape::XML::Node &node, Inkscape::XML::Node &child,
51 Inkscape::XML::Node *old_prev, Inkscape::XML::Node *new_prev);
52 virtual void notifyContentChanged(Inkscape::XML::Node &node,
53 Inkscape::Util::ptr_shared<char> old_content,
54 Inkscape::Util::ptr_shared<char> new_content);
55 virtual void notifyAttributeChanged(Inkscape::XML::Node &node, GQuark name,
56 Inkscape::Util::ptr_shared<char> old_value,
57 Inkscape::Util::ptr_shared<char> new_value);
58 /////////////////////////////////////////////////////////////////////
60 protected:
61 virtual bool _acceptObject(SPObject * obj) const;
63 Inkscape::XML::Subtree *subtreeObserved;
64 };
66 #endif /* !SEEN_SP_TREF_REFERENCE_H */
68 /*
69 Local Variables:
70 mode:c++
71 c-file-style:"stroustrup"
72 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
73 indent-tabs-mode:nil
74 fill-column:99
75 End:
76 */
77 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :