5eaeffca8e65ee8434f5707f77fe8003acc63d2a
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:
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,
52 Message::Message &message);
54 void sendDocument(Inkscape::XML::Node* root);
56 bool handleOutgoingState(Message::Wrapper &wrapper,Glib::ustring const& message);
57 bool handleIncomingState(Message::Wrapper &wrapper,Pedro::Element* data);
59 bool handleState(State::SessionState expectedState,
60 State::SessionState newstate);
62 void handleChange(Message::Wrapper &wrapper, Pedro::Element* data);
65 /* Functions below are defined in inkboard-node.cpp */
66 Glib::ustring addNodeToTracker(Inkscape::XML::Node* node);
67 Message::Message composeNewMessage(Inkscape::XML::Node *node);
69 void changeConfigure(Glib::ustring target, unsigned int version,
70 Glib::ustring attribute, Glib::ustring value);
72 void changeNew(Glib::ustring target, Glib::ustring,
73 signed int index, Pedro::Element* data);
75 void changeConfigureText(Glib::ustring target, unsigned int version,
76 Glib::ustring text);
79 protected:
80 /**
81 * Copy constructor.
82 *
83 * \param orig Instance to copy.
84 */
85 InkboardDocument(InkboardDocument const& orig) :
86 XML::Node(), XML::SimpleNode(orig), XML::Document(), recipient(orig.recipient)
87 {
88 _initBindings();
89 }
91 XML::SimpleNode* _duplicate() const
92 {
93 return new InkboardDocument(*this);
94 }
96 private:
98 void _initBindings();
100 SessionManager *sm;
102 State::SessionType sessionType;
104 Glib::ustring sessionId;
105 Glib::ustring recipient;
106 };
108 }
110 }
112 #endif
114 /*
115 Local Variables:
116 mode:c++
117 c-file-style:"stroustrup"
118 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
119 indent-tabs-mode:nil
120 fill-column:99
121 End:
122 */
123 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :