Code

manually merging the INKBOARD_PEDRO branch into trunk
[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 "pedro/pedroxmpp.h"
19 #include "jabber_whiteboard/internal-constants.h"
21 #include "xml/simple-session.h"
22 #include "util/share.h"
24 namespace Inkscape {
26 namespace Whiteboard {
28 class InkboardSession : public GC::Managed<>,
29                                                 public XML::Session,
30                                                 public XML::TransactionLogger
31 {
32 public:
33         InkboardSession() : _in_transaction(false) { }
34         InkboardSession(Glib::ustring const& name) : _in_transaction(false), _name(name) { }
35         virtual ~InkboardSession() { }
36     
37     /**
38      * Returns the name of this session.
39          * \return The name of this session.
40      */
41     virtual Glib::ustring getName() const
42         { return _name; }
43         
44     /**
45      * Sets the name of this session.
46          *
47          * \param val The name to use.
48      */
49     virtual void setName(const Glib::ustring &val)
50         { _name = val; }
52         /**
53          * Returns status attributes of this session.
54          *
55          * \return Status of this session.
56          */
57         virtual std::bitset< NUM_FLAGS > const& getStatus() const
58         {
59                 return status;
60         }
62         //
63         // XML::TransactionLogger methods
64         //
65         Session& session()
66         {
67                 return *this;
68         }
70         // 
71         // XML::Session methods
72         // 
73         bool inTransaction() 
74         {
75                 return _in_transaction;
76         }
78         void beginTransaction();
79         void rollback();
80         void commit();
82         XML::Event* commitUndoable();
84         XML::Node* createElementNode(char const* name);
85         XML::Node* createTextNode(char const* content);
86         XML::Node* createCommentNode(char const* content);
88         //
89         // XML::NodeObserver methods
90         // (inherited from XML::TransactionLogger)
91         //
92     void notifyChildAdded(Inkscape::XML::Node &parent, Inkscape::XML::Node &child, Inkscape::XML::Node *prev);
94     void notifyChildRemoved(Inkscape::XML::Node &parent, Inkscape::XML::Node &child, Inkscape::XML::Node *prev);
96     void notifyChildOrderChanged(Inkscape::XML::Node &parent, Inkscape::XML::Node &child,
97                                  Inkscape::XML::Node *old_prev, Inkscape::XML::Node *new_prev);
99     void notifyContentChanged(Inkscape::XML::Node &node,
100                               Util::ptr_shared<char> old_content,
101                               Util::ptr_shared<char> new_content);
103     void notifyAttributeChanged(Inkscape::XML::Node &node, GQuark name,
104                                 Util::ptr_shared<char> old_value,
105                                 Util::ptr_shared<char> new_value);
107 private:
108     InkboardSession(InkboardSession const &); // no copy
109     void operator=(InkboardSession const &); // no assign
111         bool _in_transaction;
113     std::bitset< NUM_FLAGS > status;
114         Glib::ustring _name;
115 };
121 #endif