Code

Merge and cleanup of GSoC C++-ification project.
[inkscape.git] / src / sp-use.cpp
index 075c7f8044d52f9a0c09ab4bd9248f1624caabb4..505c64fd225b326e448dca557ad9e1fb31b4c525 100644 (file)
@@ -1,11 +1,11 @@
-#define __SP_USE_C__
-
 /*
  * SVG <use> implementation
  *
  * Authors:
  *   Lauris Kaplinski <lauris@kaplinski.com>
  *   bulia byak <buliabyak@users.sf.net>
+ *   Jon A. Cruz <jon@joncruz.org>
+ *   Abhishek Sharma
  *
  * Copyright (C) 1999-2005 authors
  * Copyright (C) 2000-2001 Ximian, Inc.
@@ -160,11 +160,11 @@ sp_use_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
         (* ((SPObjectClass *) parent_class)->build)(object, document, repr);
     }
 
-    object->readAttr( "x");
-    object->readAttr( "y");
-    object->readAttr( "width");
-    object->readAttr( "height");
-    object->readAttr( "xlink:href");
+    object->readAttr( "x" );
+    object->readAttr( "y" );
+    object->readAttr( "width" );
+    object->readAttr( "height" );
+    object->readAttr( "xlink:href" );
 
     // We don't need to create child here:
     // reading xlink:href will attach ref, and that will cause the changed signal to be emitted,
@@ -664,21 +664,26 @@ sp_use_modified(SPObject *object, guint flags)
     }
 }
 
-SPItem *
-sp_use_unlink(SPUse *use)
+SPItem *sp_use_unlink(SPUse *use)
 {
-    if (!use) return NULL;
+    if (!use) {
+        return NULL;
+    }
 
     Inkscape::XML::Node *repr = SP_OBJECT_REPR(use);
-    if (!repr) return NULL;
+    if (!repr) {
+        return NULL;
+    }
 
     Inkscape::XML::Node *parent = sp_repr_parent(repr);
     SPDocument *document = SP_OBJECT(use)->document;
-    Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
+    Inkscape::XML::Document *xml_doc = document->getReprDoc();
 
     // Track the ultimate source of a chain of uses.
     SPItem *orig = sp_use_root(use);
-    g_return_val_if_fail(orig, NULL);
+    if (!orig) {
+        return NULL;
+    }
 
     // Calculate the accumulated transform, starting from the original.
     Geom::Matrix t = sp_use_get_root_transform(use);