1 /*
2 * Inkscape::XML::SimpleSession - simple session/logging implementation
3 *
4 * Copyright 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_SESSION_H
16 #define SEEN_INKSCAPE_XML_SIMPLE_SESSION_H
18 #include "gc-managed.h"
19 #include "xml/session.h"
20 #include "xml/transaction-logger.h"
21 #include "xml/log-builder.h"
23 namespace Inkscape {
25 namespace XML {
27 class SimpleSession : public GC::Managed<>,
28 public Session,
29 public TransactionLogger
30 {
31 public:
32 SimpleSession() : _in_transaction(false) {}
34 bool inTransaction() { return _in_transaction; }
36 void beginTransaction();
37 void rollback();
38 void commit();
39 Inkscape::XML::Event *commitUndoable();
41 Node *createElementNode(char const *name);
42 Node *createTextNode(char const *content);
43 Node *createCommentNode(char const *content);
45 Session &session() { return *this; }
47 void notifyChildAdded(Inkscape::XML::Node &parent, Inkscape::XML::Node &child, Inkscape::XML::Node *prev);
49 void notifyChildRemoved(Inkscape::XML::Node &parent, Inkscape::XML::Node &child, Inkscape::XML::Node *prev);
51 void notifyChildOrderChanged(Inkscape::XML::Node &parent, Inkscape::XML::Node &child,
52 Inkscape::XML::Node *old_prev, Inkscape::XML::Node *new_prev);
54 void notifyContentChanged(Inkscape::XML::Node &node,
55 Util::shared_ptr<char> old_content,
56 Util::shared_ptr<char> new_content);
58 void notifyAttributeChanged(Inkscape::XML::Node &node, GQuark name,
59 Util::shared_ptr<char> old_value,
60 Util::shared_ptr<char> new_value);
62 private:
63 SimpleSession(SimpleSession const &); // no copy
64 void operator=(SimpleSession const &); // no assign
66 bool _in_transaction;
67 LogBuilder _log_builder;
68 };
70 }
72 }
74 #endif
75 /*
76 Local Variables:
77 mode:c++
78 c-file-style:"stroustrup"
79 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
80 indent-tabs-mode:nil
81 fill-column:99
82 End:
83 */
84 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :