510f47c6e5d11c0e69e2c11e98a7a9957cf4cdb1
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, signed int target,
70 Glib::ustring attribute, Glib::ustring value);
72 void changeNew(Glib::ustring target, Glib::ustring,
73 signed int index, Pedro::Element* data);
76 protected:
77 /**
78 * Copy constructor.
79 *
80 * \param orig Instance to copy.
81 */
82 InkboardDocument(InkboardDocument const& orig) :
83 XML::Node(), XML::SimpleNode(orig), XML::Document(), recipient(orig.recipient)
84 {
85 _initBindings();
86 }
88 XML::SimpleNode* _duplicate() const
89 {
90 return new InkboardDocument(*this);
91 }
93 private:
95 void _initBindings();
97 SessionManager *sm;
99 State::SessionType sessionType;
101 Glib::ustring sessionId;
102 Glib::ustring recipient;
103 };
105 }
107 }
109 #endif
111 /*
112 Local Variables:
113 mode:c++
114 c-file-style:"stroustrup"
115 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
116 indent-tabs-mode:nil
117 fill-column:99
118 End:
119 */
120 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :