summaryrefslogtreecommitdiffstats
path: root/src/document.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2013-09-19 02:05:00 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2013-09-19 02:05:00 +0000
commitf6e99d7d1b76dd7a7933f55ba095bdcb534f81b3 (patch)
treecbee5d1eec2e1afe8c3f8033d528cab4504c3c49 /src/document.cpp
parentEncapsulate the shared memory hack for Cairo and GdkPixbuf in a class (diff)
parentAdded gpl notice (diff)
downloadinkscape-f6e99d7d1b76dd7a7933f55ba095bdcb534f81b3.tar.gz
inkscape-f6e99d7d1b76dd7a7933f55ba095bdcb534f81b3.zip
Merge C++ification of the SP tree by Markus Engel
(bzr r12532)
Diffstat (limited to 'src/document.cpp')
-rw-r--r--src/document.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/document.cpp b/src/document.cpp
index 0b742e491..ec831745c 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -57,9 +57,9 @@
#include "preferences.h"
#include "profile-manager.h"
#include "rdf.h"
+#include "sp-factory.h"
#include "sp-item-group.h"
#include "sp-namedview.h"
-#include "sp-object-repr.h"
#include "sp-symbol.h"
#include "transf_mat_3x4.h"
#include "util/units.h"
@@ -348,7 +348,21 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc,
}
document->name = g_strdup(name);
- document->root = sp_object_repr_build_tree(document, rroot);
+ // Create SPRoot element
+ const std::string typeString = NodeTraits::get_type_string(*rroot);
+ SPObject* rootObj = SPFactory::instance().createObject(typeString);
+ document->root = dynamic_cast<SPRoot*>(rootObj);
+
+ if (document->root == 0) {
+ // Node is not a valid root element
+ delete rootObj;
+
+ // fixme: what to do here?
+ throw;
+ }
+
+ // Recursively build object tree
+ document->root->invoke_build(document, rroot, false);
/* fixme: Not sure about this, but lets assume ::build updates */
rroot->setAttribute("inkscape:version", Inkscape::version_string);