diff --git a/src/sp-anchor.cpp b/src/sp-anchor.cpp
index 5d61d543b08bf97b368fd68ce069ca29c0cd7748..aabefdfdb4cfe14d87607bd310b746fcad061e11 100644 (file)
--- a/src/sp-anchor.cpp
+++ b/src/sp-anchor.cpp
#include "attributes.h"
#include "sp-anchor.h"
#include "ui/view/view.h"
+#include "document.h"
static void sp_anchor_class_init(SPAnchorClass *ac);
static void sp_anchor_init(SPAnchor *anchor);
static void sp_anchor_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_anchor_release(SPObject *object);
static void sp_anchor_set(SPObject *object, unsigned int key, const gchar *value);
-static Inkscape::XML::Node *sp_anchor_write(SPObject *object, Inkscape::XML::Node *repr, guint flags);
+static Inkscape::XML::Node *sp_anchor_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static gchar *sp_anchor_description(SPItem *item);
static gint sp_anchor_event(SPItem *item, SPEvent *event);
GType sp_anchor_get_type(void)
{
static GType type = 0;
-
+
if (!type) {
GTypeInfo info = {
sizeof(SPAnchorClass),
};
type = g_type_register_static(SP_TYPE_GROUP, "SPAnchor", &info, (GTypeFlags) 0);
}
-
+
return type;
}
static void sp_anchor_class_init(SPAnchorClass *ac)
{
- SPObjectClass *sp_object_class = (SPObjectClass *) ac;
+ SPObjectClass *sp_object_class = (SPObjectClass *) ac;
SPItemClass *item_class = (SPItemClass *) ac;
-
+
parent_class = (SPGroupClass *) g_type_class_ref(SP_TYPE_GROUP);
-
+
sp_object_class->build = sp_anchor_build;
sp_object_class->release = sp_anchor_release;
sp_object_class->set = sp_anchor_set;
@@ -142,12 +143,12 @@ static void sp_anchor_set(SPObject *object, unsigned int key, const gchar *value
#define COPY_ATTR(rd,rs,key) (rd)->setAttribute((key), rs->attribute(key));
-static Inkscape::XML::Node *sp_anchor_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
+static Inkscape::XML::Node *sp_anchor_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
SPAnchor *anchor = SP_ANCHOR(object);
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- repr = sp_repr_new("svg:a");
+ repr = xml_doc->createElement("svg:a");
}
repr->setAttribute("xlink:href", anchor->href);
@@ -163,7 +164,7 @@ static Inkscape::XML::Node *sp_anchor_write(SPObject *object, Inkscape::XML::Nod
}
if (((SPObjectClass *) (parent_class))->write) {
- ((SPObjectClass *) (parent_class))->write(object, repr, flags);
+ ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags);
}
return repr;
static gint sp_anchor_event(SPItem *item, SPEvent *event)
{
SPAnchor *anchor = SP_ANCHOR(item);
-
+
switch (event->type) {
case SP_EVENT_ACTIVATE:
if (anchor->href) {
default:
break;
}
-
+
return FALSE;
}