diff options
| author | Martin Owens <doctormo@gmail.com> | 2014-01-22 22:58:40 +0000 |
|---|---|---|
| committer | Martin Owens <doctormo@gmail.com> | 2014-01-22 22:58:40 +0000 |
| commit | 423ea7c0373e77a83c8a9ef62df9a786b4feb7ac (patch) | |
| tree | 148e75843778f8b96619d73b7242d880682bd134 /src/uri-references.cpp | |
| parent | Protect against infinate looping of new included hrefs (diff) | |
| download | inkscape-423ea7c0373e77a83c8a9ef62df9a786b4feb7ac.tar.gz inkscape-423ea7c0373e77a83c8a9ef62df9a786b4feb7ac.zip | |
Move sub-document reference creation code from uri-reference to document.cpp as createChildDoc(path)
(bzr r12971)
Diffstat (limited to 'src/uri-references.cpp')
| -rw-r--r-- | src/uri-references.cpp | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/src/uri-references.cpp b/src/uri-references.cpp index 30e832c04..1684c6ade 100644 --- a/src/uri-references.cpp +++ b/src/uri-references.cpp @@ -59,42 +59,7 @@ void URIReference::attach(const URI &uri) throw(BadURIException) // The path contains references to seperate document files to load. const char *path = uri.getPath(); if(path && document != NULL) { - // Calculate the absolute path from an available document - std::string basePath = std::string( document->getBase() ); - std::string absPath = Glib::build_filename(basePath, std::string( path ) ); - path = absPath.c_str(); - - SPDocument *parent = document; - SPDocument *original = document; - document = NULL; - - while(parent != NULL && document == NULL) { - // Check myself and any parents int he chain - if(strcmp(parent->getURI(), path)==0) { - document = parent; - break; - } - // Then check children of those. - boost::ptr_list<SPDocument>::iterator iter; - for (iter = parent->child_documents.begin(); - iter != parent->child_documents.end(); ++iter) { - if(strcmp(iter->getURI(), path)==0) { - document = &*iter; - break; - } - } - parent = parent->parent_document; - } - - // Load a fresh document from the svg source. - if(!document) { - document = SPDocument::createNewDoc(path, false, false, original); - if(document) { - original->child_documents.push_back(document); - } else { - g_warning("Could not load svg file: %s", path); - } - } + document = document->createChildDoc(path); } g_return_if_fail(document != NULL); |
