~mc.../inkscape/inkscape

« back to all changes in this revision

Viewing changes to src/xml/simple-session.h

  • Committer: mental
  • Date: 2006-01-16 02:36:01 UTC
  • Revision ID: mental@users.sourceforge.net-20060116023601-wkr0h7edl5veyudq
moving trunk for module inkscape

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 */
 
14
 
 
15
#ifndef SEEN_INKSCAPE_XML_SIMPLE_SESSION_H
 
16
#define SEEN_INKSCAPE_XML_SIMPLE_SESSION_H
 
17
 
 
18
#include "gc-managed.h"
 
19
#include "xml/session.h"
 
20
#include "xml/transaction-logger.h"
 
21
#include "xml/log-builder.h"
 
22
 
 
23
namespace Inkscape {
 
24
 
 
25
namespace XML {
 
26
 
 
27
class SimpleSession : public GC::Managed<>,
 
28
                      public Session,
 
29
                      public TransactionLogger
 
30
{
 
31
public:
 
32
    SimpleSession() : _in_transaction(false) {}
 
33
 
 
34
    bool inTransaction() { return _in_transaction; }
 
35
 
 
36
    void beginTransaction();
 
37
    void rollback();
 
38
    void commit();
 
39
    Inkscape::XML::Event *commitUndoable();
 
40
 
 
41
    Node *createElementNode(char const *name);
 
42
    Node *createTextNode(char const *content);
 
43
    Node *createCommentNode(char const *content);
 
44
 
 
45
    Session &session() { return *this; }
 
46
 
 
47
    void notifyChildAdded(Inkscape::XML::Node &parent, Inkscape::XML::Node &child, Inkscape::XML::Node *prev);
 
48
 
 
49
    void notifyChildRemoved(Inkscape::XML::Node &parent, Inkscape::XML::Node &child, Inkscape::XML::Node *prev);
 
50
 
 
51
    void notifyChildOrderChanged(Inkscape::XML::Node &parent, Inkscape::XML::Node &child,
 
52
                                 Inkscape::XML::Node *old_prev, Inkscape::XML::Node *new_prev);
 
53
 
 
54
    void notifyContentChanged(Inkscape::XML::Node &node,
 
55
                              Util::SharedCStringPtr old_content,
 
56
                              Util::SharedCStringPtr new_content);
 
57
 
 
58
    void notifyAttributeChanged(Inkscape::XML::Node &node, GQuark name,
 
59
                                Util::SharedCStringPtr old_value,
 
60
                                Util::SharedCStringPtr new_value);
 
61
 
 
62
private:
 
63
    SimpleSession(SimpleSession const &); // no copy
 
64
    void operator=(SimpleSession const &); // no assign
 
65
 
 
66
    bool _in_transaction;
 
67
    LogBuilder _log_builder;
 
68
};
 
69
 
 
70
}
 
71
 
 
72
}
 
73
 
 
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 :