summaryrefslogtreecommitdiffstats
path: root/src/attribute-rel-util.cpp
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-03-29 23:52:42 +0000
committerMarkus Engel <markus.engel@tum.de>2013-03-29 23:52:42 +0000
commita168040d5a452544328a1e6ad35aaac351f94d44 (patch)
treefae1ba829f543a473da281bd5fa6e4deabbf6912 /src/attribute-rel-util.cpp
parentRemoved function pointers from SPObject and subclasses. (diff)
parentDutch translation update (diff)
downloadinkscape-a168040d5a452544328a1e6ad35aaac351f94d44.tar.gz
inkscape-a168040d5a452544328a1e6ad35aaac351f94d44.zip
merged from trunk
(bzr r11608.1.56)
Diffstat (limited to 'src/attribute-rel-util.cpp')
-rw-r--r--src/attribute-rel-util.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/attribute-rel-util.cpp b/src/attribute-rel-util.cpp
index 239e359e2..0527dad4e 100644
--- a/src/attribute-rel-util.cpp
+++ b/src/attribute-rel-util.cpp
@@ -76,7 +76,14 @@ void sp_attribute_clean_recursive(Node *repr, unsigned int flags) {
}
for(Node *child=repr->firstChild() ; child ; child = child->next()) {
- sp_attribute_clean_recursive( child, flags );
+
+ // Don't remove default css values if element is in <defs> or is a <symbol>
+ Glib::ustring element = child->name();
+ unsigned int flags_temp = flags;
+ if( element.compare( "svg:defs" ) == 0 || element.compare( "svg:symbol" ) == 0 ) {
+ flags_temp &= ~(SP_ATTR_CLEAN_DEFAULT_WARN|SP_ATTR_CLEAN_DEFAULT_REMOVE);
+ }
+ sp_attribute_clean_recursive( child, flags_temp );
}
}
@@ -128,17 +135,13 @@ void sp_attribute_clean_style(Node *repr, unsigned int flags) {
// Find element's style
SPCSSAttr *css = sp_repr_css_attr( repr, "style" );
-
sp_attribute_clean_style(repr, css, flags);
- // g_warning( "sp_repr_write_stream_element(): Final style:" );
- //sp_repr_css_print( css );
-
// Convert css node's properties data to string and set repr node's attribute "style" to that string.
// sp_repr_css_set( repr, css, "style"); // Don't use as it will cause loop.
- gchar *value = sp_repr_css_write_string(css);
- repr->setAttribute("style", value);
- if (value) g_free (value);
+ Glib::ustring value;
+ sp_repr_css_write_string(css, value);
+ repr->setAttribute("style", value.c_str());
sp_repr_css_attr_unref( css );
}
@@ -147,7 +150,7 @@ void sp_attribute_clean_style(Node *repr, unsigned int flags) {
/**
* Clean CSS style on an element.
*/
-gchar * sp_attribute_clean_style(Node *repr, gchar const *string, unsigned int flags) {
+Glib::ustring sp_attribute_clean_style(Node *repr, gchar const *string, unsigned int flags) {
g_return_val_if_fail (repr != NULL, NULL);
g_return_val_if_fail (repr->type() == Inkscape::XML::ELEMENT_NODE, NULL);
@@ -155,11 +158,12 @@ gchar * sp_attribute_clean_style(Node *repr, gchar const *string, unsigned int f
SPCSSAttr *css = sp_repr_css_attr_new();
sp_repr_css_attr_add_from_string( css, string );
sp_attribute_clean_style(repr, css, flags);
- gchar* string_cleaned = sp_repr_css_write_string( css );
+ Glib::ustring string_cleaned;
+ sp_repr_css_write_string (css, string_cleaned);
sp_repr_css_attr_unref( css );
- return string_cleaned;
+ return string_cleaned;
}
@@ -205,9 +209,9 @@ void sp_attribute_clean_style(Node* repr, SPCSSAttr *css, unsigned int flags) {
}
// Find parent value for same property (property)
- gchar const * property_p = NULL;
gchar const * value_p = NULL;
if( css_parent != NULL ) {
+ gchar const * property_p = NULL;
for ( List<AttributeRecord const> iter_p = css_parent->attributeList() ; iter_p ; ++iter_p ) {
property_p = g_quark_to_string(iter_p->key);