/**
* Helper methods for resolving URI References
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
*
* Copyright (C) 2001-2002 Lauris Kaplinski
* Copyright (C) 2001 Ximian, Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <iostream>
#include <cstring>
#include <string>
#include "document.h"
#include "sp-object.h"
#include "uri.h"
#include "uri-references.h"
#include "extract-uri.h"
#include "sp-tag-use.h"
#include <glibmm/miscutils.h>
namespace Inkscape {
{
/* FIXME !!! attach to owner's destroy signal to clean up in case */
}
{
}
/*
* The main ideas here are:
* (1) "If we are inside a clone, then we can accept if and only if our "original thing" can accept the reference"
* (this caused problems when there are clones because a change in ids triggers signals for the object hrefing this id,
*but also its cloned reprs
* (descendants of <use> referencing an ancestor of the href'ing object)). The way it is done here is *atrocious*, but i
*could not find a better way.
* FIXME: find a better and safer way to find the "original object" of anyone with the flag ->cloned
*
* (2) Once we have an (potential owner) object, it can accept a href to obj, iff the graph of objects where directed
*edges are
* either parent->child relations , *** or href'ing to href'ed *** relations, stays acyclic.
* We can go either from owner and up in the tree, or from obj and down, in either case this will be in the worst case
*linear in the number of objects.
* There are no easy objects allowing to do the second proposition, while "hrefList" is a "list of objects href'ing us",
*so we'll take this.
* Then we keep a set of already visited elements, and do a DFS on this graph. if we find obj, then BOOM.
*/
{
// we go back following hrefList and parent to find if the object already references ourselves indirectly
if (!owner)
return true;
int position = 0;
position++;
c = c->next;
}
}
else {
g_warning("cloned object with no known type\n");
return false;
}
}
// once we have the "original" object (hopefully) we look at who is referencing it
return false;
if (!dynamic_cast<SPObject *>(e))
continue;
if (e == obj) {
return false;
}
}
}
return true;
}
{
// Attempt to get the document that contains the URI
if (_owner) {
} else if (_owner_document) {
}
// createChildDoc() assumes that the referenced file is an SVG.
// PNG and JPG files are allowed (in the case of feImage).
bool skip = false;
skip = true;
}
// The path contains references to separate document files to load.
} else {
}
}
if (!document) {
return;
}
throw UnsupportedURIException();
}
/* FIXME !!! real xpointer support should be delegated to document */
/* for now this handles the minimal xpointer form that SVG 1.0
* requires of us
*/
/* FIXME !!! this is wasteful */
/* FIXME: It looks as though this is including "))" in the id. I suggest moving
the strlen calculation and validity testing to before strdup, and copying just
the id without the "))". -- pjrm */
throw MalformedURIException();
}
} else {
throw UnsupportedURIException();
}
} else {
}
/* FIXME !!! validate id as an NCName somewhere */
delete _uri;
}
{
delete _uri;
}
{
}
return;
if (_obj) {
}
if (old_obj) {
/* release the old object _after_ the signal emission */
}
}
/* If an object is deleted, current semantics require that we release
* it on its "release" signal, rather than later, when its ID is actually
* unregistered from the document.
*/
{
}
} /* namespace Inkscape */
{
if (trimmed) {
}
}
return ref;
}
{
}
return ref;
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 :