Code

Node tool: fix Tab and Shift+Tab
[inkscape.git] / src / sp-style-elem.cpp
index fa756242cab2dc53ba362d438b608dcd509241c0..02ed80445346aedd73f1e6fe39bcb6e59221760e 100644 (file)
@@ -12,7 +12,7 @@ static void sp_style_elem_class_init(SPStyleElemClass *klass);
 static void sp_style_elem_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr);
 static void sp_style_elem_set(SPObject *object, unsigned const key, gchar const *const value);
 static void sp_style_elem_read_content(SPObject *);
-static Inkscape::XML::Node *sp_style_elem_write(SPObject *, Inkscape::XML::Node *, guint flags);
+static Inkscape::XML::Node *sp_style_elem_write(SPObject *, Inkscape::XML::Document *, Inkscape::XML::Node *, guint flags);
 
 static SPObjectClass *parent_class;
 
@@ -120,10 +120,9 @@ child_order_changed_cb(Inkscape::XML::Node *, Inkscape::XML::Node *,
 }
 
 static Inkscape::XML::Node *
-sp_style_elem_write(SPObject *const object, Inkscape::XML::Node *repr, guint const flags)
+sp_style_elem_write(SPObject *const object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint const flags)
 {
     if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
-        Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
         repr = xml_doc->createElement("svg:style");
     }
 
@@ -140,7 +139,7 @@ sp_style_elem_write(SPObject *const object, Inkscape::XML::Node *repr, guint con
     /* todo: media */
 
     if (((SPObjectClass *) parent_class)->write)
-        ((SPObjectClass *) parent_class)->write(object, repr, flags);
+        ((SPObjectClass *) parent_class)->write(object, xml_doc, repr, flags);
 
     return repr;
 }
@@ -318,7 +317,8 @@ sp_style_elem_read_content(SPObject *const object)
      * Dodji replies "right, that's *bug*"; just an unexpected oversight.
      */
 
-    GString *const text = concat_children(*style_elem.repr);
+    //XML Tree being used directly here while it shouldn't be.
+    GString *const text = concat_children(*style_elem.getRepr());
     CRParser *parser = cr_parser_new_from_buf(reinterpret_cast<guchar *>(text->str), text->len,
                                               CR_UTF_8, FALSE);
 
@@ -390,8 +390,8 @@ sp_style_elem_build(SPObject *object, SPDocument *document, Inkscape::XML::Node
 {
     sp_style_elem_read_content(object);
 
-    sp_object_read_attr(object, "type");
-    sp_object_read_attr(object, "media");
+    object->readAttr( "type" );
+    object->readAttr( "media" );
 
     static Inkscape::XML::NodeEventVector const nodeEventVector = {
         child_add_rm_cb,   // child_added
@@ -417,4 +417,4 @@ sp_style_elem_build(SPObject *object, SPDocument *document, Inkscape::XML::Node
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :