Code

Export. Fix PS/EPS export (Bug #698340, PS Level Restriction reversed.
[inkscape.git] / src / jabber_whiteboard / inkboard-document.cpp
index 9f3d8ce4293dac6fb59862965dec2df0ad85de0a..4b27d530a8f9db1402e942499382a8715c68cf39 100644 (file)
@@ -33,6 +33,7 @@
 #include "xml/element-node.h"
 #include "xml/text-node.h"
 #include "xml/comment-node.h"
+#include "xml/pi-node.h"
 
 #include "util/share.h"
 #include "util/ucompose.hpp"
@@ -43,7 +44,7 @@ namespace Whiteboard {
 
 InkboardDocument::InkboardDocument(int code, State::SessionType sessionType,
                                    Glib::ustring const& to)
-: XML::SimpleNode(code), sessionType(sessionType), recipient(to),
+: XML::SimpleNode(code, this), sessionType(sessionType), recipient(to),
   _in_transaction(false)
 {
     _initBindings();
@@ -55,7 +56,6 @@ InkboardDocument::_initBindings()
     this->sm = &SessionManager::instance();
     this->state = State::INITIAL;
     this->tracker = new KeyNodeTable();
-    _bindDocument(*this);
 }
 
 void
@@ -347,25 +347,32 @@ InkboardDocument::commitUndoable()
 XML::Node*
 InkboardDocument::createElement(char const* name)
 {
-    return new XML::ElementNode(g_quark_from_string(name));
+    return new XML::ElementNode(g_quark_from_string(name), this);
 }
 
 XML::Node*
 InkboardDocument::createTextNode(char const* content)
 {
-    return new XML::TextNode(Util::share_string(content));
+    return new XML::TextNode(Util::share_string(content), this);
 }
 
 XML::Node*
 InkboardDocument::createComment(char const* content)
 {
-    return new XML::CommentNode(Util::share_string(content));
+    return new XML::CommentNode(Util::share_string(content), this);
+}
+
+XML::Node*
+InkboardDocument::createPI(char const *target, char const* content)
+{
+    return new XML::PINode(g_quark_from_string(target), Util::share_string(content), this);
 }
 
 
-void InkboardDocument::notifyChildAdded(XML::Node &parent,
+
+void InkboardDocument::notifyChildAdded(XML::Node &/*parent*/,
                                         XML::Node &child,
-                                        XML::Node *prev)
+                                        XML::Node */*prev*/)
 {
     if (_in_transaction && state == State::IN_WHITEBOARD) {
 
@@ -381,9 +388,9 @@ void InkboardDocument::notifyChildAdded(XML::Node &parent,
     }
 }
 
-void InkboardDocument::notifyChildRemoved(XML::Node &parent,
+void InkboardDocument::notifyChildRemoved(XML::Node &/*parent*/,
                                           XML::Node &child,
-                                          XML::Node *prev)
+                                          XML::Node */*prev*/)
 {
     if (_in_transaction && state == State::IN_WHITEBOARD) 
     {
@@ -398,25 +405,22 @@ void InkboardDocument::notifyChildRemoved(XML::Node &parent,
 
 void InkboardDocument::notifyChildOrderChanged(XML::Node &parent,
                                                XML::Node &child,
-                                               XML::Node *old_prev,
-                                               XML::Node *new_prev)
+                                               XML::Node */*old_prev*/,
+                                               XML::Node */*new_prev*/)
 {
     if (_in_transaction && state == State::IN_WHITEBOARD) 
     {
-        XML::Node *element = (XML::Node *)&child;
-        XML::Node *parentElement = (XML::Node *)&parent;
-
-        unsigned int index = parentElement->_childPosition(*element);
+        unsigned int index = child.position();
 
         Message::Message message = String::ucompose(Vars::MOVE_MESSAGE,
-                tracker->get(element),index);
+                tracker->get(&child),index);
 
         send(getRecipient(),Message::MOVE,message);
     }
 }
 
 void InkboardDocument::notifyContentChanged(XML::Node &node,
-                                            Util::ptr_shared<char> old_content,
+                                            Util::ptr_shared<char> /*old_content*/,
                                             Util::ptr_shared<char> new_content)
 {
     if (_in_transaction && state == State::IN_WHITEBOARD) 
@@ -444,7 +448,7 @@ void InkboardDocument::notifyContentChanged(XML::Node &node,
 
 void InkboardDocument::notifyAttributeChanged(XML::Node &node,
                                               GQuark name,
-                                              Util::ptr_shared<char> old_value,
+                                              Util::ptr_shared<char> /*old_value*/,
                                               Util::ptr_shared<char> new_value)
 {
     if (_in_transaction && state == State::IN_WHITEBOARD)