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/inkboard-node.h"
31 #include "jabber_whiteboard/defines.h"
33 #include "util/share.h"
35 namespace Inkscape {
37 namespace Whiteboard {
39 class InkboardDocument;
41 class InkboardSession : public GC::Managed<>, public XML::Session,
42 public XML::TransactionLogger
43 {
44 public:
46 InkboardSession() : _in_transaction(false) { }
47 InkboardSession(InkboardDocument *document) : _in_transaction(false), doc(document) {}
48 virtual ~InkboardSession() { }
50 //
51 // XML::TransactionLogger methods
52 //
53 Session& session()
54 {
55 return *this;
56 }
58 //
59 // XML::Session methods
60 //
61 bool inTransaction()
62 {
63 return _in_transaction;
64 }
66 void beginTransaction();
67 void rollback();
68 void commit();
70 XML::Event* commitUndoable();
72 XML::Node* createElementNode(char const* name);
73 XML::Node* createTextNode(char const* content);
74 XML::Node* createCommentNode(char const* content);
76 //
77 // XML::NodeObserver methodscd ../
78 // (inherited from XML::TransactionLogger)
79 //
80 void notifyChildAdded(Inkscape::XML::Node &parent, Inkscape::XML::Node &child, Inkscape::XML::Node *prev);
82 void notifyChildRemoved(Inkscape::XML::Node &parent, Inkscape::XML::Node &child, Inkscape::XML::Node *prev);
84 void notifyChildOrderChanged(Inkscape::XML::Node &parent, Inkscape::XML::Node &child,
85 Inkscape::XML::Node *old_prev, Inkscape::XML::Node *new_prev);
87 void notifyContentChanged(Inkscape::XML::Node &node,
88 Util::ptr_shared<char> old_content,
89 Util::ptr_shared<char> new_content);
91 void notifyAttributeChanged(Inkscape::XML::Node &node, GQuark name,
92 Util::ptr_shared<char> old_value,
93 Util::ptr_shared<char> new_value);
95 private:
97 InkboardSession(InkboardSession const &); // no copy
98 void operator=(InkboardSession const &); // no assign
100 bool _in_transaction;
102 InkboardDocument *doc;
103 };
105 }
107 }
109 #endif