~ubuntu-branches/debian/experimental/inkscape/experimental

« back to all changes in this revision

Viewing changes to src/jabber_whiteboard/inkboard-document.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-09-09 23:29:02 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080909232902-c50iujhk1w79u8e7
Tags: 0.46-2.1
* Non-maintainer upload.
* Add upstream patch fixing a crash in the open dialog
  in the zh_CN.utf8 locale. Closes: #487623.
  Thanks to Luca Bruno for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 */
 
11
 
 
12
#ifndef __INKSCAPE_WHITEBOARD_INKBOARDDOCUMENT_H__
 
13
#define __INKSCAPE_WHITEBOARD_INKBOARDDOCUMENT_H__
 
14
 
 
15
#include <glibmm.h>
 
16
 
 
17
#include "document.h"
 
18
#include "xml/document.h"
 
19
#include "xml/simple-node.h"
 
20
#include "xml/node-observer.h"
 
21
#include "jabber_whiteboard/defines.h"
 
22
#include "jabber_whiteboard/keynode.h"
 
23
#include "jabber_whiteboard/session-manager.h"
 
24
 
 
25
namespace Inkscape {
 
26
 
 
27
namespace Whiteboard {
 
28
 
 
29
class InkboardDocument : public XML::SimpleNode,
 
30
                         public XML::Document,
 
31
                         public XML::NodeObserver
 
32
{
 
33
public:
 
34
        
 
35
    explicit InkboardDocument(int code, State::SessionType sessionType, Glib::ustring const& to);
 
36
 
 
37
    XML::NodeType type() const
 
38
    {
 
39
        return Inkscape::XML::DOCUMENT_NODE;
 
40
    }
 
41
 
 
42
    State::SessionState state;
 
43
    KeyNodeTable *tracker;
 
44
 
 
45
    void setRecipient(Glib::ustring const& val);
 
46
    Glib::ustring getRecipient() const;
 
47
 
 
48
    void setSessionId(Glib::ustring const& val);
 
49
    Glib::ustring getSessionId() const;
 
50
 
 
51
    void startSessionNegotiation();
 
52
    void terminateSession();
 
53
 
 
54
    void recieve(Message::Wrapper &wrapper, Pedro::Element* data);
 
55
    bool send(const Glib::ustring &destJid, Message::Wrapper &mwrapper, 
 
56
            Message::Message &message);
 
57
 
 
58
    void sendDocument(Inkscape::XML::Node* root);
 
59
 
 
60
    bool handleOutgoingState(Message::Wrapper &wrapper,Glib::ustring const& message);
 
61
    bool handleIncomingState(Message::Wrapper &wrapper,Pedro::Element* data);
 
62
 
 
63
    bool handleState(State::SessionState expectedState, 
 
64
            State::SessionState newstate);
 
65
 
 
66
    void handleChange(Message::Wrapper &wrapper, Pedro::Element* data);
 
67
 
 
68
    NodeObserver *logger() { return this; }
 
69
 
 
70
    // 
 
71
    // XML::Session methods
 
72
    // 
 
73
    bool inTransaction() 
 
74
    {
 
75
        return _in_transaction;
 
76
    }
 
77
 
 
78
    void beginTransaction();
 
79
    void rollback();
 
80
    void commit();
 
81
 
 
82
    XML::Event* commitUndoable();
 
83
 
 
84
    XML::Node* createElement(char const* name);
 
85
    XML::Node* createTextNode(char const* content);
 
86
    XML::Node* createComment(char const* content);
 
87
 
 
88
    //
 
89
    // XML::NodeObserver methods
 
90
    //
 
91
    void notifyChildAdded(Inkscape::XML::Node &parent, Inkscape::XML::Node &child, Inkscape::XML::Node *prev);
 
92
 
 
93
    void notifyChildRemoved(Inkscape::XML::Node &parent, Inkscape::XML::Node &child, Inkscape::XML::Node *prev);
 
94
 
 
95
    void notifyChildOrderChanged(Inkscape::XML::Node &parent, Inkscape::XML::Node &child,
 
96
                                 Inkscape::XML::Node *old_prev, Inkscape::XML::Node *new_prev);
 
97
 
 
98
    void notifyContentChanged(Inkscape::XML::Node &node,
 
99
                              Util::ptr_shared<char> old_content,
 
100
                              Util::ptr_shared<char> new_content);
 
101
 
 
102
    void notifyAttributeChanged(Inkscape::XML::Node &node, GQuark name,
 
103
                                Util::ptr_shared<char> old_value,
 
104
                                Util::ptr_shared<char> new_value);
 
105
 
 
106
    /* Functions below are defined in inkboard-node.cpp */
 
107
    Glib::ustring addNodeToTracker(Inkscape::XML::Node* node);
 
108
    Message::Message composeNewMessage(Inkscape::XML::Node *node);
 
109
 
 
110
    void changeConfigure(Glib::ustring target, unsigned int version,
 
111
            Glib::ustring attribute, Glib::ustring value);
 
112
 
 
113
    void changeNew(Glib::ustring target, Glib::ustring, 
 
114
            signed int index, Pedro::Element* data);
 
115
 
 
116
    void changeConfigureText(Glib::ustring target, unsigned int version,
 
117
            Glib::ustring text);
 
118
 
 
119
protected:
 
120
        /**
 
121
         * Copy constructor.
 
122
         * 
 
123
         * \param orig Instance to copy.
 
124
         */
 
125
        InkboardDocument(InkboardDocument const& orig) :
 
126
                XML::Node(), XML::SimpleNode(orig),
 
127
                XML::Document(), XML::NodeObserver(),
 
128
                recipient(orig.recipient), _in_transaction(false)
 
129
        {
 
130
                _initBindings();
 
131
        }
 
132
 
 
133
        XML::SimpleNode* _duplicate(XML::Document* xml_doc) const
 
134
        {
 
135
                return new InkboardDocument(*this);
 
136
        }
 
137
 
 
138
private:
 
139
    void _initBindings();
 
140
 
 
141
    SessionManager      *sm;
 
142
 
 
143
    State::SessionType  sessionType;
 
144
 
 
145
    Glib::ustring sessionId;
 
146
    Glib::ustring recipient;
 
147
 
 
148
    bool _in_transaction;
 
149
};
 
150
 
 
151
}
 
152
 
 
153
}
 
154
 
 
155
#endif
 
156
 
 
157
/*
 
158
  Local Variables:
 
159
  mode:c++
 
160
  c-file-style:"stroustrup"
 
161
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
162
  indent-tabs-mode:nil
 
163
  fill-column:99
 
164
  End:
 
165
*/
 
166
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :