Code

Filter effects dialog:
[inkscape.git] / src / uri-references.cpp
index 6b2a8401fdeb9d78799af866b5423fbad5e6ed5e..c9482839d56a5452579583549712eb6ba1b9395d 100644 (file)
@@ -24,19 +24,32 @@ static gchar *uri_to_id(SPDocument *document, const gchar *uri);
 namespace Inkscape {
 
 URIReference::URIReference(SPObject *owner)
-: _owner(owner), _obj(NULL), _uri(NULL)
+       : _owner(owner), _owner_document(NULL), _obj(NULL), _uri(NULL)
 {
        g_assert(_owner != NULL);
        /* FIXME !!! attach to owner's destroy signal to clean up in case */
 }
 
+URIReference::URIReference(SPDocument *owner_document)
+       : _owner(NULL), _owner_document(owner_document), _obj(NULL), _uri(NULL)
+{
+       g_assert(_owner_document != NULL);
+}
+
 URIReference::~URIReference() {
        detach();
 }
 
 void URIReference::attach(const URI &uri) throw(BadURIException)
 {
-       SPDocument *document = SP_OBJECT_DOCUMENT(_owner);
+       SPDocument *document;
+  if (_owner) {
+    document = SP_OBJECT_DOCUMENT(_owner);
+       } else if (_owner_document) {
+    document = _owner_document;
+       } else {
+    g_assert_not_reached();
+       }
        gchar const *fragment = uri.getFragment();
        if ( !uri.isRelative() || uri.getQuery() || !fragment ) {
                throw UnsupportedURIException();