diff --git a/src/id-clash.cpp b/src/id-clash.cpp
index b215576a4d506f8ca39fc9a875313dfe31edf0e4..0594fe8e66f6191d82faf2169bd553e98a12f659 100644 (file)
--- a/src/id-clash.cpp
+++ b/src/id-clash.cpp
-#define __ID_CLASH_C__
/** \file
* Routines for resolving ID clashes when importing or pasting.
*
* Authors:
* Stephen Silver <sasilver@users.sourceforge.net>
+ * Jon A. Cruz <jon@joncruz.org>
+ * Abhishek Sharma
*
* Copyright (C) 2008 authors
*
if (paint->isPaintserver() && paint->value.href) {
const SPObject *obj = paint->value.href->getObject();
if (obj) {
- const gchar *id = SP_OBJECT_ID(obj);
+ const gchar *id = obj->getId();
IdReference idref = { REF_STYLE, elem, SPIPaint_properties[i] };
(*refmap)[id].push_back(idref);
}
if (filter->href) {
const SPObject *obj = filter->href->getObject();
if (obj) {
- const gchar *id = SP_OBJECT_ID(obj);
+ const gchar *id = obj->getId();
IdReference idref = { REF_STYLE, elem, "filter" };
(*refmap)[id].push_back(idref);
}
}
}
- /* recurse */
- for (SPObject *child = sp_object_first_child(elem);
- child; child = SP_OBJECT_NEXT(child) )
+ // recurse
+ for (SPObject *child = elem->firstChild(); child; child = child->getNext() )
{
find_references(child, refmap);
}
SPObject *elem, const refmap_type *refmap,
id_changelist_type *id_changes)
{
- const gchar *id = SP_OBJECT_ID(elem);
+ const gchar *id = elem->getId();
if (id && current_doc->getObjectById(id)) {
// Choose a new ID.
id_changes->push_back(id_changeitem_type(elem, old_id));
}
- /* recurse */
- for (SPObject *child = sp_object_first_child(elem);
- child; child = SP_OBJECT_NEXT(child) )
+ // recurse
+ for (SPObject *child = elem->firstChild(); child; child = child->getNext() )
{
change_clashing_ids(imported_doc, current_doc, child, refmap, id_changes);
}
const std::list<IdReference>::const_iterator it_end = pos->second.end();
for (it = pos->second.begin(); it != it_end; ++it) {
if (it->type == REF_HREF) {
- gchar *new_uri = g_strdup_printf("#%s", SP_OBJECT_ID(obj));
+ gchar *new_uri = g_strdup_printf("#%s", obj->getId());
SP_OBJECT_REPR(it->elem)->setAttribute(it->attr, new_uri);
g_free(new_uri);
}
sp_style_set_property_url(it->elem, it->attr, obj, false);
}
else if (it->type == REF_URL) {
- gchar *url = g_strdup_printf("url(#%s)", SP_OBJECT_ID(obj));
+ gchar *url = g_strdup_printf("url(#%s)", obj->getId());
SP_OBJECT_REPR(it->elem)->setAttribute(it->attr, url);
g_free(url);
}
else if (it->type == REF_CLIPBOARD) {
SPCSSAttr *style = sp_repr_css_attr(SP_OBJECT_REPR(it->elem), "style");
- gchar *url = g_strdup_printf("url(#%s)", SP_OBJECT_ID(obj));
+ gchar *url = g_strdup_printf("url(#%s)", obj->getId());
sp_repr_css_set_property(style, it->attr, url);
g_free(url);
gchar *style_string = sp_repr_css_write_string(style);
{
refmap_type *refmap = new refmap_type;
id_changelist_type id_changes;
- SPObject *imported_root = SP_DOCUMENT_ROOT(imported_doc);
+ SPObject *imported_root = imported_doc->getRoot();
find_references(imported_root, refmap);
change_clashing_ids(imported_doc, current_doc, imported_root, refmap,