summaryrefslogtreecommitdiffstats
path: root/src/sp-object.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-02-01 11:33:34 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-02-01 11:33:34 +0000
commit8876bc4df731a56a0153ef999feed9a70c2b887a (patch)
treeb4490d39ce050d302d621e25ce6b56ed3e119c38 /src/sp-object.cpp
parentAdd correct preview for coninuing paths whith pencil and draw modes (diff)
parentFix some formatting problems and add formatting info at end of file. (diff)
downloadinkscape-8876bc4df731a56a0153ef999feed9a70c2b887a.tar.gz
inkscape-8876bc4df731a56a0153ef999feed9a70c2b887a.zip
update to trunk
(bzr r11950.1.246)
Diffstat (limited to 'src/sp-object.cpp')
-rw-r--r--src/sp-object.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/sp-object.cpp b/src/sp-object.cpp
index 0e6eef6ae..764b5f260 100644
--- a/src/sp-object.cpp
+++ b/src/sp-object.cpp
@@ -585,23 +585,22 @@ SPObject *SPObject::get_child_by_repr(Inkscape::XML::Node *repr)
void SPObject::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) {
SPObject* object = this;
- try {
- const std::string typeString = NodeTraits::get_type_string(*child);
+ const std::string type_string = NodeTraits::get_type_string(*child);
- SPObject* ochild = SPFactory::instance().createObject(typeString);
-
- SPObject *prev = ref ? object->get_child_by_repr(ref) : NULL;
- object->attach(ochild, prev);
- sp_object_unref(ochild, NULL);
-
- ochild->invoke_build(object->document, child, object->cloned);
- } catch (const FactoryExceptions::TypeNotRegistered& e) {
+ SPObject* ochild = SPFactory::instance().createObject(type_string);
+ if (ochild == NULL) {
// Currenty, there are many node types that do not have
// corresponding classes in the SPObject tree.
// (rdf:RDF, inkscape:clipboard, ...)
// Thus, simply ignore this case for now.
return;
}
+
+ SPObject *prev = ref ? object->get_child_by_repr(ref) : NULL;
+ object->attach(ochild, prev);
+ sp_object_unref(ochild, NULL);
+
+ ochild->invoke_build(object->document, child, object->cloned);
}
void SPObject::release() {
@@ -645,21 +644,20 @@ void SPObject::build(SPDocument *document, Inkscape::XML::Node *repr) {
object->readAttr("inkscape:collect");
for (Inkscape::XML::Node *rchild = repr->firstChild() ; rchild != NULL; rchild = rchild->next()) {
- try {
- const std::string typeString = NodeTraits::get_type_string(*rchild);
-
- SPObject* child = SPFactory::instance().createObject(typeString);
+ const std::string typeString = NodeTraits::get_type_string(*rchild);
- object->attach(child, object->lastChild());
- sp_object_unref(child, NULL);
- child->invoke_build(document, rchild, object->cloned);
- } catch (const FactoryExceptions::TypeNotRegistered& e) {
+ SPObject* child = SPFactory::instance().createObject(typeString);
+ if (child == NULL) {
// Currenty, there are many node types that do not have
// corresponding classes in the SPObject tree.
// (rdf:RDF, inkscape:clipboard, ...)
// Thus, simply ignore this case for now.
continue;
}
+
+ object->attach(child, object->lastChild());
+ sp_object_unref(child, NULL);
+ child->invoke_build(document, rchild, object->cloned);
}
}