Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

static void fix_up_refs ( const refmap_type *  refmap,
const id_changelist_type &  id_changes 
) [static]

Fix up references to changed IDs.

Definition at line 218 of file id-clash.cpp.

Referenced by prevent_id_clashes().

{
    id_changelist_type::const_iterator pp;
    const id_changelist_type::const_iterator pp_end = id_changes.end();
    for (pp = id_changes.begin(); pp != pp_end; ++pp) {
        SPObject *obj = pp->first;
        refmap_type::const_iterator pos = refmap->find(pp->second);
        std::list<IdReference>::const_iterator it;
        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));
                SP_OBJECT_REPR(it->elem)->setAttribute(it->attr, new_uri);
                g_free(new_uri);
            }
            else if (it->type == REF_STYLE) {
                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));
                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));
                sp_repr_css_set_property(style, it->attr, url);
                g_free(url);
                gchar *style_string = sp_repr_css_write_string(style);
                SP_OBJECT_REPR(it->elem)->setAttribute("style", style_string);
                g_free(style_string);
            }
            else g_assert(0); // shouldn't happen
        }
    }
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index