Code

Changes to the document are registered through inkboard-session, inkboard-node extend...
[inkscape.git] / src / jabber_whiteboard / inkboard-document.h
1 /**
2  * Inkscape::Whiteboard::InkboardDocument - Inkboard document implementation
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_INKBOARDDOCUMENT_H__
13 #define __INKSCAPE_WHITEBOARD_INKBOARDDOCUMENT_H__
15 #include <glibmm.h>
17 #include "document.h"
18 #include "xml/document.h"
19 #include "xml/simple-node.h"
20 #include "jabber_whiteboard/defines.h"
21 #include "jabber_whiteboard/keynode.h"
22 #include "jabber_whiteboard/session-manager.h"
24 namespace Inkscape {
26 namespace Whiteboard {
28 class InkboardDocument : public XML::SimpleNode, public XML::Document {
29 public:
30         
31     explicit InkboardDocument(int code, State::SessionType sessionType, Glib::ustring const& to);
33     XML::NodeType type() const
34     {
35         return Inkscape::XML::DOCUMENT_NODE;
36     }
38     State::SessionState state;
39     KeyNodeTable *tracker;
41     void setRecipient(Glib::ustring const& val);
42     Glib::ustring getRecipient() const;
44     void setSessionId(Glib::ustring const& val);
45     Glib::ustring getSessionId() const;
47     void startSessionNegotiation();
48     void terminateSession();
50     void recieve(Message::Wrapper &wrapper, Pedro::Element* data);
51     bool send(const Glib::ustring &destJid, Message::Wrapper &mwrapper, Message::Message &message);
53     void sendDocument(Inkscape::XML::Node* root);
55     bool handleOutgoingState(Message::Wrapper &wrapper,Glib::ustring const& message);
56     bool handleIncomingState(Message::Wrapper &wrapper,Pedro::Element* data);
58     bool handleState(State::SessionState expectedState, State::SessionState newstate);
60     Glib::ustring addNodeToTracker(Inkscape::XML::Node* node);
61     Message::Message composeNewMessage(Inkscape::XML::Node *node);
63 protected:
64         /**
65          * Copy constructor.
66          * 
67          * \param orig Instance to copy.
68          */
69         InkboardDocument(InkboardDocument const& orig) :
70                 XML::Node(), XML::SimpleNode(orig), XML::Document(), recipient(orig.recipient)
71         {
72                 _initBindings();
73         }
75         XML::SimpleNode* _duplicate() const
76         {
77                 return new InkboardDocument(*this);
78         }
80 private:
82     void _initBindings();
84     SessionManager      *sm;
86     State::SessionType  sessionType;
88     Glib::ustring sessionId;
89     Glib::ustring recipient;
90 };
92 }
94 }
96 #endif
98 /*
99   Local Variables:
100   mode:c++
101   c-file-style:"stroustrup"
102   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
103   indent-tabs-mode:nil
104   fill-column:99
105   End:
106 */
107 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :