Code

Translations. French translation minor update.
[inkscape.git] / src / xml / simple-document.h
1 /*
2  * Inkscape::XML::SimpleDocument - generic XML document implementation
3  *
4  * Copyright 2004-2005 MenTaLguY <mental@rydia.net>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * See the file COPYING for details.
12  *
13  */
15 #ifndef SEEN_INKSCAPE_XML_SIMPLE_DOCUMENT_H
16 #define SEEN_INKSCAPE_XML_SIMPLE_DOCUMENT_H
18 #include "xml/document.h"
19 #include "xml/simple-node.h"
20 #include "xml/node-observer.h"
21 #include "xml/log-builder.h"
23 namespace Inkscape {
25 namespace XML {
27 class SimpleDocument : public SimpleNode,
28                        public Document,
29                        public NodeObserver
30 {
31 public:
32     explicit SimpleDocument()
33     : SimpleNode(g_quark_from_static_string("xml"), this),
34       _in_transaction(false) {}
36     NodeType type() const { return Inkscape::XML::DOCUMENT_NODE; }
38     bool inTransaction() { return _in_transaction; }
40     void beginTransaction();
41     void rollback();
42     void commit();
43     Inkscape::XML::Event *commitUndoable();
45     Node *createElement(char const *name);
46     Node *createTextNode(char const *content);
47     Node *createComment(char const *content);
48     Node *createPI(char const *target, char const *content);
50     void notifyChildAdded(Node &parent, Node &child, Node *prev);
52     void notifyChildRemoved(Node &parent, Node &child, Node *prev);
54     void notifyChildOrderChanged(Node &parent, Node &child,
55                                  Node *old_prev, Node *new_prev);
57     void notifyContentChanged(Node &node,
58                               Util::ptr_shared<char> old_content,
59                               Util::ptr_shared<char> new_content);
61     void notifyAttributeChanged(Node &node, GQuark name,
62                                 Util::ptr_shared<char> old_value,
63                                 Util::ptr_shared<char> new_value);
65 protected:
66     SimpleDocument(SimpleDocument const &doc)
67     : Node(), SimpleNode(doc), Document(), NodeObserver(),
68       _in_transaction(false) {}
70     SimpleNode *_duplicate(Document* /*doc*/) const
71     {
72         return new SimpleDocument(*this);
73     }
74     NodeObserver *logger() { return this; }
76 private:
77     bool _in_transaction;
78     LogBuilder _log_builder;
79 };
81 }
83 }
85 #endif
86 /*
87   Local Variables:
88   mode:c++
89   c-file-style:"stroustrup"
90   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
91   indent-tabs-mode:nil
92   fill-column:99
93   End:
94 */
95 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :