Logo Search packages:      
Sourcecode: inkscape version File versions

Inkscape::XML::Node * SPObject::updateRepr ( Inkscape::XML::Document doc,
Inkscape::XML::Node repr,
unsigned int  flags 
) [inherited]

Updates the given repr based on the object's state.

This method updates the given repr to reflect the object's current state. There are several flags that affect this:

SP_OBJECT_WRITE_BUILD - create new reprs

SP_OBJECT_WRITE_EXT - write elements and attributes which are not part of pure SVG (i.e. the Inkscape and Sodipodi namespaces)

SP_OBJECT_WRITE_ALL - create all nodes and attributes, even those which might be redundant

repr the repr to update
flags object write flags that apply to this update
the updated repr
Used both to create reprs in the original document, and to create reprs in another document (e.g. a temporary document used when saving as "Plain SVG"

FIXME: else probably error (Lauris) */

Definition at line 1209 of file sp-object.cpp.

References Inkscape::XML::Node::mergeFrom().

    g_assert(doc != NULL);

    if (SP_OBJECT_IS_CLONED(this)) {
        /* cloned objects have no repr */
        return NULL;
    if (((SPObjectClass *) G_OBJECT_GET_CLASS(this))->write) {
        if (!(flags & SP_OBJECT_WRITE_BUILD) && !repr) {
            repr = SP_OBJECT_REPR(this);
        return ((SPObjectClass *) G_OBJECT_GET_CLASS(this))->write(this, doc, repr, flags);
    } else {
        g_warning("Class %s does not implement ::write", G_OBJECT_TYPE_NAME(this));
        if (!repr) {
            if (flags & SP_OBJECT_WRITE_BUILD) {
                repr = SP_OBJECT_REPR(this)->duplicate(doc);
            /// \todo FIXME: else probably error (Lauris) */
        } else {
            repr->mergeFrom(SP_OBJECT_REPR(this), "id");
        return repr;

Generated by  Doxygen 1.6.0   Back to index