Code

separate updating window from updating layers
[inkscape.git] / src / jabber_whiteboard / inkboard-session.h
1 /**
2  * Inkscape::Whiteboard::InkboardSession - Whiteboard implementation of XML::Session interface
3  *
4  * Authors:
5  * David Yip <yipdw@rose-hulman.edu>
6  *
7  * Copyright (c) 2005 Authors
8  *
9  * Released under GNU GPL, read the file 'COPYING' for more information
10  */
12 #ifndef __INKSCAPE_WHITEBOARD_SESSION_H__
13 #define __INKSCAPE_WHITEBOARD_SESSION_H__
15 #include <glibmm.h>
16 #include <bitset>
18 #include "gc-managed.h"
20 #include "xml/session.h"
21 #include "xml/transaction-logger.h"
22 #include "xml/log-builder.h"
23 #include "xml/node-observer.h"
24 #include "xml/simple-session.h"
26 #include "pedro/pedroxmpp.h"
28 #include "jabber_whiteboard/inkboard-document.h"
29 #include "jabber_whiteboard/defines.h"
31 #include "util/share.h"
33 namespace Inkscape {
35 namespace Whiteboard {
37 class InkboardDocument;
39 class InkboardSession : public GC::Managed<>, public XML::Session,
40                          public XML::TransactionLogger
41 {
42 public:
44     InkboardSession() : _in_transaction(false) { }
45     InkboardSession(InkboardDocument *document) : _in_transaction(false), doc(document) {}
46     virtual ~InkboardSession() { }
48     //
49     // XML::TransactionLogger methods
50     //
51     Session& session()
52     {
53         return *this;
54     }
56     // 
57     // XML::Session methods
58     // 
59     bool inTransaction() 
60     {
61         return _in_transaction;
62     }
64     void beginTransaction();
65     void rollback();
66     void commit();
68     XML::Event* commitUndoable();
70     XML::Node* createElementNode(char const* name);
71     XML::Node* createTextNode(char const* content);
72     XML::Node* createCommentNode(char const* content);
74     //
75     // XML::NodeObserver methodscd ../
76     // (inherited from XML::TransactionLogger)
77     //
78     void notifyChildAdded(Inkscape::XML::Node &parent, Inkscape::XML::Node &child, Inkscape::XML::Node *prev);
80     void notifyChildRemoved(Inkscape::XML::Node &parent, Inkscape::XML::Node &child, Inkscape::XML::Node *prev);
82     void notifyChildOrderChanged(Inkscape::XML::Node &parent, Inkscape::XML::Node &child,
83                                  Inkscape::XML::Node *old_prev, Inkscape::XML::Node *new_prev);
85     void notifyContentChanged(Inkscape::XML::Node &node,
86                               Util::ptr_shared<char> old_content,
87                               Util::ptr_shared<char> new_content);
89     void notifyAttributeChanged(Inkscape::XML::Node &node, GQuark name,
90                                 Util::ptr_shared<char> old_value,
91                                 Util::ptr_shared<char> new_value);
93 private:
95     InkboardSession(InkboardSession const &); // no copy
96     void operator=(InkboardSession const &); // no assign
98     bool _in_transaction;
100     InkboardDocument *doc;
101 };
107 #endif