summaryrefslogtreecommitdiffstats
path: root/src/sp-anchor.cpp
diff options
context:
space:
mode:
authorMichael Soegtrop <MSoegtrop@yahoo.de>2017-06-05 13:01:17 +0000
committerMichael Soegtrop <MSoegtrop@yahoo.de>2017-06-05 13:01:17 +0000
commit509ca3687330fea576ea67ae6c7f31d16e66b800 (patch)
tree9097520c54e355ded9bd0b4d6618af4e8dacdd91 /src/sp-anchor.cpp
parentupdated to latest trunk (diff)
parent[Bug #1695016] Xaml export misses some radialGradients. (diff)
downloadinkscape-509ca3687330fea576ea67ae6c7f31d16e66b800.tar.gz
inkscape-509ca3687330fea576ea67ae6c7f31d16e66b800.zip
updated to latest trunk
(bzr r14876.2.4)
Diffstat (limited to 'src/sp-anchor.cpp')
-rw-r--r--src/sp-anchor.cpp42
1 files changed, 39 insertions, 3 deletions
diff --git a/src/sp-anchor.cpp b/src/sp-anchor.cpp
index 78ba10c13..b40f53ee1 100644
--- a/src/sp-anchor.cpp
+++ b/src/sp-anchor.cpp
@@ -5,6 +5,7 @@
* Lauris Kaplinski <lauris@kaplinski.com>
* Abhishek Sharma
*
+ * Copyright (C) 2017 Martin Owens
* Copyright (C) 2001-2002 Lauris Kaplinski
* Copyright (C) 2001 Ximian, Inc.
*
@@ -23,6 +24,9 @@
SPAnchor::SPAnchor() : SPGroup() {
this->href = NULL;
+ this->type = NULL;
+ this->title = NULL;
+ this->page = NULL;
}
SPAnchor::~SPAnchor() {
@@ -46,6 +50,18 @@ void SPAnchor::release() {
g_free(this->href);
this->href = NULL;
}
+ if (this->type) {
+ g_free(this->type);
+ this->type = NULL;
+ }
+ if (this->title) {
+ g_free(this->title);
+ this->title = NULL;
+ }
+ if (this->page) {
+ g_free(this->page);
+ this->page = NULL;
+ }
SPGroup::release();
}
@@ -56,12 +72,21 @@ void SPAnchor::set(unsigned int key, const gchar* value) {
g_free(this->href);
this->href = g_strdup(value);
this->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ this->updatePageAnchor();
break;
-
case SP_ATTR_XLINK_TYPE:
+ g_free(this->type);
+ this->type = g_strdup(value);
+ this->updatePageAnchor();
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ break;
case SP_ATTR_XLINK_ROLE:
case SP_ATTR_XLINK_ARCROLE:
case SP_ATTR_XLINK_TITLE:
+ g_free(this->title);
+ this->title = g_strdup(value);
+ this->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ break;
case SP_ATTR_XLINK_SHOW:
case SP_ATTR_XLINK_ACTUATE:
case SP_ATTR_TARGET:
@@ -74,6 +99,17 @@ void SPAnchor::set(unsigned int key, const gchar* value) {
}
}
+/*
+ * Detect if this anchor qualifies as a page link and append
+ * the new page document to this document.
+ */
+void SPAnchor::updatePageAnchor() {
+ if (this->type && !strcmp(this->type, "page")) {
+ if (this->href && !this->page) {
+ this->page = this->document->createChildDoc(this->href);
+ }
+ }
+}
#define COPY_ATTR(rd,rs,key) (rd)->setAttribute((key), rs->attribute(key));
@@ -83,14 +119,14 @@ Inkscape::XML::Node* SPAnchor::write(Inkscape::XML::Document *xml_doc, Inkscape:
}
repr->setAttribute("xlink:href", this->href);
+ if (this->type) repr->setAttribute("xlink:type", this->type);
+ if (this->title) repr->setAttribute("xlink:title", this->title);
if (repr != this->getRepr()) {
// XML Tree being directly used while it shouldn't be in the
// below COPY_ATTR lines
- COPY_ATTR(repr, this->getRepr(), "xlink:type");
COPY_ATTR(repr, this->getRepr(), "xlink:role");
COPY_ATTR(repr, this->getRepr(), "xlink:arcrole");
- COPY_ATTR(repr, this->getRepr(), "xlink:title");
COPY_ATTR(repr, this->getRepr(), "xlink:show");
COPY_ATTR(repr, this->getRepr(), "xlink:actuate");
COPY_ATTR(repr, this->getRepr(), "target");