style.cpp revision be395c0b0e020f2695dad4287d44cb9047e94b7b
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof * SVG stylesheets implementation.
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof * Lauris Kaplinski <lauris@kaplinski.com>
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof * Peter Moulder <pmoulder@mail.csse.monash.edu.au>
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof * bulia byak <buliabyak@users.sf.net>
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof * Abhishek Sharma
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof * Tavmjong Bah <tavmjong@free.fr>
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof * Kris De Gussem <Kris.DeGussem@gmail.com>
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof * Copyright (C) 2001-2002 Lauris Kaplinski
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof * Copyright (C) 2001 Ximian, Inc.
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof * Copyright (C) 2005 Monash University
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof * Copyright (C) 2012 Kris De Gussem
81db7808fbee540434bcc6c7198579b95a6a2d88Jabiertxof * Copyright (C) 2014-2015 Tavmjong Bah
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof * Released under GNU GPL, read the file 'COPYING' for more information
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof/*#########################
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof## FORWARD DECLARATIONS
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof#########################*/
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxofvoid sp_style_filter_ref_changed(SPObject *old_ref, SPObject *ref, SPStyle *style);
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxofvoid sp_style_fill_paint_server_ref_changed(SPObject *old_ref, SPObject *ref, SPStyle *style);
2ce2003d5713154f99c32af18fb904a1af109031Jabiertxofvoid sp_style_stroke_paint_server_ref_changed(SPObject *old_ref, SPObject *ref, SPStyle *style);
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxofstatic void sp_style_object_release(SPObject *object, SPStyle *style);
2ce2003d5713154f99c32af18fb904a1af109031Jabiertxof//SPPropMap SPStyle::_propmap;
2ce2003d5713154f99c32af18fb904a1af109031Jabiertxof// C++11 allows one constructor to call another... might be useful. The original C code
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof// had separate calls to create SPStyle, one with only SPDocument and the other with only
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof// SPObject as parameters.
ccbee7d45f91658e83a602a9a28ee26162a261f9JabiertxofSPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) :
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // Unimplemented SVG 1.1: alignment-baseline, clip, clip-path, color-profile, cursor,
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // dominant-baseline, flood-color, flood-opacity, font-size-adjust,
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // glyph-orientation-horizontal, glyph-orientation-vertical, kerning, lighting-color,
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // pointer-events, stop-color, stop-opacity, unicode-bidi
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // For enums: property( name, enumeration, default value , inherits = true );
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // For scale24: property( name, default value = 0, inherits = true );
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // 'font', 'font-size', and 'font-family' must come first as other properties depend on them
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // for calculated values (through 'em' and 'ex'). ('ex' is currently not read.)
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // The following properties can depend on 'em' and 'ex':
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // baseline-shift, kerning, letter-spacing, stroke-dash-offset, stroke-width, word-spacing,
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // Non-SVG 1.1: text-indent, line-spacing
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // Hidden in SPIFontStyle: (to be refactored)
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // font-family
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // font-specification
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // Font related properties and 'font' shorthand
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof font_style( "font-style", enum_font_style, SP_CSS_FONT_STYLE_NORMAL ),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof font_variant( "font-variant", enum_font_variant, SP_CSS_FONT_VARIANT_NORMAL ),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof font_weight( "font-weight", enum_font_weight, SP_CSS_FONT_WEIGHT_NORMAL, SP_CSS_FONT_WEIGHT_400 ),
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof font_stretch( "font-stretch", enum_font_stretch, SP_CSS_FONT_STRETCH_NORMAL ),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof line_height( "line-height", 1.0 ), // SPILengthOrNormal
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof font_family( "font-family", "sans-serif" ), // SPIString w/default
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof font_specification( "-inkscape-font-specification" ), // SPIString
de641d2613f4eea940ba6eb6c52ea9bcda516ba2Jabiertxof // Font variants
721286d6ce40a27fcd8b9483667a43ed09023b17Jabiertxof font_variant_ligatures( "font-variant-ligatures", enum_font_variant_ligatures ),
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof font_variant_position( "font-variant-position", enum_font_variant_position, SP_CSS_FONT_VARIANT_POSITION_NORMAL ),
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof font_variant_caps( "font-variant-caps", enum_font_variant_caps, SP_CSS_FONT_VARIANT_CAPS_NORMAL ),
721286d6ce40a27fcd8b9483667a43ed09023b17Jabiertxof font_variant_numeric( "font-variant-numeric", enum_font_variant_numeric ),
721286d6ce40a27fcd8b9483667a43ed09023b17Jabiertxof font_variant_alternates("font-variant-alternates", enum_font_variant_alternates, SP_CSS_FONT_VARIANT_ALTERNATES_NORMAL ),
721286d6ce40a27fcd8b9483667a43ed09023b17Jabiertxof font_variant_east_asian("font-variant-east_asian", enum_font_variant_east_asian, SP_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL ),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof font_feature_settings( "font-feature-settings", "normal" ),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // Text related properties
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof text_align( "text-align", enum_text_align, SP_CSS_TEXT_ALIGN_START ),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof letter_spacing( "letter-spacing", 0.0 ), // SPILengthOrNormal
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof word_spacing( "word-spacing", 0.0 ), // SPILengthOrNormal
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof text_transform( "text-transform", enum_text_transform, SP_CSS_TEXT_TRANSFORM_NONE ),
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof direction( "direction", enum_direction, SP_CSS_DIRECTION_LTR ),
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof block_progression("block-progression", enum_block_progression, SP_CSS_BLOCK_PROGRESSION_TB),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof writing_mode( "writing-mode", enum_writing_mode, SP_CSS_WRITING_MODE_LR_TB ),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof text_anchor( "text-anchor", enum_text_anchor, SP_CSS_TEXT_ANCHOR_START ),
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof white_space( "white-space", enum_white_space, SP_CSS_WHITE_SPACE_NORMAL ),
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // SVG 2 Text Wrapping
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof //shape_outside( "shape-outside" ), // SPIString
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof shape_padding( "shape-padding", 0.0 ), // SPILength for now
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof //shape_margin( "shape-margin", 0.0 ), // SPILength for now
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof text_decoration_color( "text-decoration-color" ), // SPIColor
0b159142b0b5738b20883b411fe8233657cf8b4fJabiertxof // General visual properties
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof clip_rule( "clip-rule", enum_clip_rule, SP_WIND_RULE_NONZERO ),
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof display( "display", enum_display, SP_CSS_DISPLAY_INLINE, false ),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof overflow( "overflow", enum_overflow, SP_CSS_OVERFLOW_VISIBLE, false ),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof visibility( "visibility", enum_visibility, SP_CSS_VISIBILITY_VISIBLE ),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof isolation( "isolation", enum_isolation, SP_CSS_ISOLATION_AUTO ),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof mix_blend_mode( "mix-blend-mode", enum_blend_mode, SP_CSS_BLEND_NORMAL ),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // Color properties
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof color_interpolation( "color-interpolation", enum_color_interpolation, SP_CSS_COLOR_INTERPOLATION_SRGB),
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof color_interpolation_filters("color-interpolation-filters", enum_color_interpolation, SP_CSS_COLOR_INTERPOLATION_LINEARRGB),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // Solid color properties
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof solid_opacity( "solid-opacity", SP_SCALE24_MAX ),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // Fill properties
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof fill_rule( "fill-rule", enum_fill_rule, SP_WIND_RULE_NONZERO ),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // Stroke properites
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof stroke_width( "stroke-width", 1.0 ), // SPILength
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof stroke_linecap( "stroke-linecap", enum_stroke_linecap, SP_STROKE_LINECAP_BUTT ),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof stroke_linejoin( "stroke-linejoin", enum_stroke_linejoin, SP_STROKE_LINEJOIN_MITER ),
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof stroke_miterlimit("stroke-miterlimit", 4 ), // SPIFloat (only use of float!)
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof stroke_dashoffset("stroke-dashoffset", 0.0 ), // SPILength for now
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof stroke_opacity( "stroke-opacity", SP_SCALE24_MAX ),
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // Filter properties
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof filter_blend_mode("filter-blend-mode", enum_blend_mode, SP_CSS_BLEND_NORMAL),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof filter_gaussianBlur_deviation( "filter-gaussianBlur-deviation", 0.0 ), // SPILength
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof enable_background("enable-background", enum_enable_background, SP_CSS_BACKGROUND_ACCUMULATE, false),
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // Rendering hint properties
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof color_rendering( "color-rendering", enum_color_rendering, SP_CSS_COLOR_RENDERING_AUTO),
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof image_rendering( "image-rendering", enum_image_rendering, SP_CSS_IMAGE_RENDERING_AUTO),
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof shape_rendering( "shape-rendering", enum_shape_rendering, SP_CSS_SHAPE_RENDERING_AUTO),
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof text_rendering( "text-rendering", enum_text_rendering, SP_CSS_TEXT_RENDERING_AUTO )
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // std::cout << "SPStyle::SPStyle( SPDocument ): Entrance: (" << _count << ")" << std::endl;
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // std::cout << " Document: " << (document_in?"present":"null") << std::endl;
0b159142b0b5738b20883b411fe8233657cf8b4fJabiertxof // std::cout << " Object: "
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // << (object_in?(object_in->getId()?object_in->getId():"id null"):"object null") << std::endl;
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // static bool first = true;
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // if( first ) {
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // std::cout << "Size of SPStyle: " << sizeof(SPStyle) << std::endl;
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // std::cout << " SPIBase: " << sizeof(SPIBase) << std::endl;
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof // std::cout << " SPIFloat: " << sizeof(SPIFloat) << std::endl;
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof // std::cout << " SPIScale24: " << sizeof(SPIScale24) << std::endl;
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof // std::cout << " SPILength: " << sizeof(SPILength) << std::endl;
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // std::cout << " SPILengthOrNormal: " << sizeof(SPILengthOrNormal) << std::endl;
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // std::cout << " SPIColor: " << sizeof(SPIColor) << std::endl;
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof // std::cout << " SPIPaint: " << sizeof(SPIPaint) << std::endl;
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // std::cout << " SPITextDecorationLine" << sizeof(SPITextDecorationLine) << std::endl;
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // std::cout << " Glib::ustring:" << sizeof(Glib::ustring) << std::endl;
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // std::cout << " SPColor: " << sizeof(SPColor) << std::endl;
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof // first = false;
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof object->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_style_object_release), this));
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof // 'font' shorthand requires access to included properties.
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof // Properties that depend on 'font-size' for calculating lengths.
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof // Properties that depend on 'color'
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof // color.setStylePointer( this ); // Doen't need reference to self
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof // 'text_decoration' shorthand requires access to included properties.
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof // SPIPaint, SPIFilter needs access to 'this' (SPStyle)
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // for setting up signals... 'fill', 'stroke' already done
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // Used to iterate over markers
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof marker_ptrs[SP_MARKER_LOC_START] = &marker_start;
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // This might be too resource hungary... but for now it possible to loop over properties
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // 'color' must be before 'fill', 'stroke', 'text-decoration-color', ...
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // 'font-size'/'font' must be before properties that need to know em, ex size (SPILength,
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // SPILenghtOrNormal)
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof // Font variants
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof _properties.push_back( &font_variant_ligatures );
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof _properties.push_back( &font_variant_alternates );
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof _properties.push_back( &font_variant_east_asian );
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof _properties.push_back( &color_interpolation_filters );
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof _properties.push_back( &filter_gaussianBlur_deviation );
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof // MAP -------------------------------------------
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // if( _propmap.size() == 0 ) {
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof // // 'color' must be before 'fill', 'stroke', 'text-decoration-color', ...
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof // _propmap.insert( std::make_pair( color.name, reinterpret_cast<SPIBasePtr>(&SPStyle::color ) ) );
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // // 'font-size' must be before properties that need to know em, ex size (SPILength, SPILenghtOrNormal)
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // _propmap.insert( std::make_pair( font_style.name, reinterpret_cast<SPIBasePtr>(&SPStyle::font_style ) ) );
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // _propmap.insert( std::make_pair( font_variant.name, reinterpret_cast<SPIBasePtr>(&SPStyle::font_variant ) ) );
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // _propmap.insert( std::make_pair( font_weight.name, reinterpret_cast<SPIBasePtr>(&SPStyle::font_weight ) ) );
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // _propmap.insert( std::make_pair( font_stretch.name, reinterpret_cast<SPIBasePtr>(&SPStyle::font_stretch ) ) );
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // _propmap.insert( std::make_pair( font_size.name, reinterpret_cast<SPIBasePtr>(&SPStyle::font_size ) ) );
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // _propmap.insert( std::make_pair( line_height.name, reinterpret_cast<SPIBasePtr>(&SPStyle::line_height ) ) );
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // _propmap.insert( std::make_pair( font_family.name, reinterpret_cast<SPIBasePtr>(&SPStyle::font_family ) ) );
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof // _propmap.insert( std::make_pair( font.name, reinterpret_cast<SPIBasePtr>(&SPStyle::font ) ) );
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // _propmap.insert( std::make_pair( font_specification.name, reinterpret_cast<SPIBasePtr>(&SPStyle::font_specification ) ) );
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // font_variant_ligatures );
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // font_variant_position );
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // font_variant_caps );
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // font_variant_numeric );
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // font_variant_alternates );
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // font_variant_east_asian );
dbe3e7dacd7d4490ef69cc21314dc718b4706ae5jabiertxof // font_feature_settings );
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // _propmap.insert( std::make_pair( text_indent.name, reinterpret_cast<SPIBasePtr>(&SPStyle::text_indent ) ) );
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // _propmap.insert( std::make_pair( text_align.name, reinterpret_cast<SPIBasePtr>(&SPStyle::text_align ) ) );
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // _propmap.insert( std::make_pair( text_decoration.name, reinterpret_cast<SPIBasePtr>(&SPStyle::text_decoration ) ) );
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // _propmap.insert( std::make_pair( text_decoration_line.name, reinterpret_cast<SPIBasePtr>(&SPStyle::text_decoration_line ) ) );
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // _propmap.insert( std::make_pair( text_decoration_style.name, reinterpret_cast<SPIBasePtr>(&SPStyle::text_decoration_style ) ) );
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // _propmap.insert( std::make_pair( text_decoration_color.name, reinterpret_cast<SPIBasePtr>(&SPStyle::text_decoration_color ) ) );
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof // _propmap.insert( std::make_pair( letter_spacing.name, reinterpret_cast<SPIBasePtr>(&SPStyle::letter_spacing ) ) );
163aa8601274792f2afe8e24a061fed96b7a6599Jabiertxof // _propmap.insert( std::make_pair( word_spacing.name, reinterpret_cast<SPIBasePtr>(&SPStyle::word_spacing ) ) );
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // _propmap.insert( std::make_pair( text_transform.name, reinterpret_cast<SPIBasePtr>(&SPStyle::text_transform ) ) );
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // _propmap.insert( std::make_pair( direction.name, reinterpret_cast<SPIBasePtr>(&SPStyle::direction ) ) );
ccbee7d45f91658e83a602a9a28ee26162a261f9Jabiertxof // _propmap.insert( std::make_pair( block_progression.name, reinterpret_cast<SPIBasePtr>(&SPStyle::block_progression ) ) );
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof // _propmap.insert( std::make_pair( writing_mode.name, reinterpret_cast<SPIBasePtr>(&SPStyle::writing_mode ) ) );
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof // _propmap.insert( std::make_pair( baseline_shift.name, reinterpret_cast<SPIBasePtr>(&SPStyle::baseline_shift ) ) );
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof // _propmap.insert( std::make_pair( text_anchor.name, reinterpret_cast<SPIBasePtr>(&SPStyle::text_anchor ) ) );
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof // _propmap.insert( std::make_pair( white_space.name, reinterpret_cast<SPIBasePtr>(&SPStyle::white_space ) ) );
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof // _propmap.insert( std::make_pair( shape_inside.name, reinterpret_cast<SPIBasePtr>(&SPStyle::shape_inside ) ) );
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof // _propmap.insert( std::make_pair( shape_padding.name, reinterpret_cast<SPIBasePtr>(&SPStyle::shape_padding ) ) );
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof // _propmap.insert( std::make_pair( clip_rule.name, reinterpret_cast<SPIBasePtr>(&SPStyle::clip_rule ) ) );
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof // _propmap.insert( std::make_pair( display.name, reinterpret_cast<SPIBasePtr>(&SPStyle::display ) ) );
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof // _propmap.insert( std::make_pair( overflow.name, reinterpret_cast<SPIBasePtr>(&SPStyle::overflow ) ) );
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof // _propmap.insert( std::make_pair( visibility.name, reinterpret_cast<SPIBasePtr>(&SPStyle::visibility ) ) );
60db347ea19e568bd09c35a0248a9f78d7931ca0Jabiertxof // _propmap.insert( std::make_pair( opacity.name, reinterpret_cast<SPIBasePtr>(&SPStyle::opacity ) ) );
// _propmap.insert( std::make_pair( isolation.name, reinterpret_cast<SPIBasePtr>(&SPStyle::isolation ) ) );
// _propmap.insert( std::make_pair( mix_blend_mode.name, reinterpret_cast<SPIBasePtr>(&SPStyle::mix_blend_mode ) ) );
// _propmap.insert( std::make_pair( color_interpolation.name, reinterpret_cast<SPIBasePtr>(&SPStyle::color_interpolation ) ) );
// _propmap.insert( std::make_pair( color_interpolation_filters.name, reinterpret_cast<SPIBasePtr>(&SPStyle::color_interpolation_filters ) ) );
// _propmap.insert( std::make_pair( solid_color.name, reinterpret_cast<SPIBasePtr>(&SPStyle::solid_color ) ) );
// _propmap.insert( std::make_pair( solid_opacity.name, reinterpret_cast<SPIBasePtr>(&SPStyle::solid_opacity ) ) );
// _propmap.insert( std::make_pair( fill_opacity.name, reinterpret_cast<SPIBasePtr>(&SPStyle::fill_opacity ) ) );
// _propmap.insert( std::make_pair( fill_rule.name, reinterpret_cast<SPIBasePtr>(&SPStyle::fill_rule ) ) );
// _propmap.insert( std::make_pair( stroke.name, reinterpret_cast<SPIBasePtr>(&SPStyle::stroke ) ) );
// _propmap.insert( std::make_pair( stroke_width.name, reinterpret_cast<SPIBasePtr>(&SPStyle::stroke_width ) ) );
// _propmap.insert( std::make_pair( stroke_linecap.name, reinterpret_cast<SPIBasePtr>(&SPStyle::stroke_linecap ) ) );
// _propmap.insert( std::make_pair( stroke_linejoin.name, reinterpret_cast<SPIBasePtr>(&SPStyle::stroke_linejoin ) ) );
// _propmap.insert( std::make_pair( stroke_miterlimit.name, reinterpret_cast<SPIBasePtr>(&SPStyle::stroke_miterlimit ) ) );
// _propmap.insert( std::make_pair( stroke_dasharray.name, reinterpret_cast<SPIBasePtr>(&SPStyle::stroke_dasharray ) ) );
// _propmap.insert( std::make_pair( stroke_dashoffset.name, reinterpret_cast<SPIBasePtr>(&SPStyle::stroke_dashoffset ) ) );
// _propmap.insert( std::make_pair( stroke_opacity.name, reinterpret_cast<SPIBasePtr>(&SPStyle::stroke_opacity ) ) );
// _propmap.insert( std::make_pair( marker.name, reinterpret_cast<SPIBasePtr>(&SPStyle::marker ) ) );
// _propmap.insert( std::make_pair( marker_start.name, reinterpret_cast<SPIBasePtr>(&SPStyle::marker_start ) ) );
// _propmap.insert( std::make_pair( marker_mid.name, reinterpret_cast<SPIBasePtr>(&SPStyle::marker_mid ) ) );
// _propmap.insert( std::make_pair( marker_end.name, reinterpret_cast<SPIBasePtr>(&SPStyle::marker_end ) ) );
// _propmap.insert( std::make_pair( paint_order.name, reinterpret_cast<SPIBasePtr>(&SPStyle::paint_order ) ) );
// _propmap.insert( std::make_pair( filter.name, reinterpret_cast<SPIBasePtr>(&SPStyle::filter ) ) );
// _propmap.insert( std::make_pair( filter_blend_mode.name, reinterpret_cast<SPIBasePtr>(&SPStyle::filter_blend_mode ) ) );
// _propmap.insert( std::make_pair( filter_gaussianBlur_deviation.name, reinterpret_cast<SPIBasePtr>(&SPStyle::filter_gaussianBlur_deviation ) ) );
// _propmap.insert( std::make_pair( color_rendering.name, reinterpret_cast<SPIBasePtr>(&SPStyle::color_rendering ) ) );
// _propmap.insert( std::make_pair( image_rendering.name, reinterpret_cast<SPIBasePtr>(&SPStyle::image_rendering ) ) );
// _propmap.insert( std::make_pair( shape_rendering.name, reinterpret_cast<SPIBasePtr>(&SPStyle::shape_rendering ) ) );
// _propmap.insert( std::make_pair( text_rendering.name, reinterpret_cast<SPIBasePtr>(&SPStyle::text_rendering ) ) );
// _propmap.insert( std::make_pair( enable_background.name, reinterpret_cast<SPIBasePtr>(&SPStyle::enable_background ) ) );
// incremented and decremented only in the files: display/drawing-item.cpp,
p->clear();
if (document) {
fill_ps_changed_connection = fill.value.href->changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_style_fill_paint_server_ref_changed), this));
stroke_ps_changed_connection = stroke.value.href->changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_style_stroke_paint_server_ref_changed), this));
cloned = false;
cloned = true;
if (object) {
if( object ) {
delete parent;
for (std::vector<Inkscape::Preferences::Entry>::iterator i = attrs.begin(); i != attrs.end(); ++i) {
delete tempdoc;
switch (id) {
case SP_PROP_FONT_FAMILY:
case SP_PROP_FONT_SIZE:
case SP_PROP_FONT_SIZE_ADJUST:
case SP_PROP_FONT_STYLE:
case SP_PROP_FONT_VARIANT:
case SP_PROP_FONT_WEIGHT:
case SP_PROP_FONT_STRETCH:
case SP_PROP_FONT:
case SP_PROP_TEXT_INDENT:
case SP_PROP_TEXT_ALIGN:
case SP_PROP_TEXT_DECORATION:
case SP_PROP_LINE_HEIGHT:
case SP_PROP_LETTER_SPACING:
case SP_PROP_WORD_SPACING:
case SP_PROP_TEXT_TRANSFORM:
case SP_PROP_DIRECTION:
case SP_PROP_WRITING_MODE:
case SP_PROP_TEXT_ANCHOR:
case SP_PROP_WHITE_SPACE:
case SP_PROP_SHAPE_INSIDE:
case SP_PROP_SHAPE_PADDING:
case SP_PROP_BASELINE_SHIFT:
case SP_PROP_TEXT_RENDERING:
case SP_PROP_KERNING:
case SP_PROP_CLIP:
case SP_PROP_COLOR:
case SP_PROP_CURSOR:
case SP_PROP_DISPLAY:
case SP_PROP_OVERFLOW:
case SP_PROP_VISIBILITY:
case SP_PROP_ISOLATION:
case SP_PROP_MIX_BLEND_MODE:
case SP_PROP_CLIP_PATH:
case SP_PROP_CLIP_RULE:
case SP_PROP_MASK:
case SP_PROP_OPACITY:
case SP_PROP_FILTER:
case SP_PROP_FLOOD_COLOR:
case SP_PROP_FLOOD_OPACITY:
case SP_PROP_LIGHTING_COLOR:
case SP_PROP_STOP_COLOR:
case SP_PROP_STOP_OPACITY:
case SP_PROP_POINTER_EVENTS:
case SP_PROP_COLOR_PROFILE:
case SP_PROP_COLOR_RENDERING:
case SP_PROP_SOLID_COLOR:
case SP_PROP_SOLID_OPACITY:
case SP_PROP_FILL:
case SP_PROP_FILL_OPACITY:
case SP_PROP_FILL_RULE:
case SP_PROP_IMAGE_RENDERING:
case SP_PROP_MARKER:
case SP_PROP_MARKER_START:
case SP_PROP_MARKER_MID:
case SP_PROP_MARKER_END:
case SP_PROP_SHAPE_RENDERING:
case SP_PROP_STROKE:
case SP_PROP_STROKE_WIDTH:
case SP_PROP_STROKE_DASHARRAY:
case SP_PROP_STROKE_LINECAP:
case SP_PROP_STROKE_LINEJOIN:
case SP_PROP_STROKE_OPACITY:
case SP_PROP_PAINT_ORDER:
return style_string;
* References: http://www.w3.org/TR/SVG11/propidx.html shows what properties inherit by default.
* http://www.w3.org/TR/SVG11/styling.html#Inheritance gives general rules as to what it means to
* inherit a value. http://www.w3.org/TR/REC-CSS2/cascade.html#computed-value is more precise
_mergeString( p );
// for(std::vector<SPIBase*>::size_type i = 0; i != _properties.size(); ++i) {
if (decl_list) {
// Ref: http://www.w3.org/TR/REC-CSS2/cascade.html#cascading-order point 4.)
if (props) {
// std::cout << "SPStyle::_mergeObjectStylesheet: " << (object->getId()?object->getId():"null") << std::endl;
if (!sel_eng) {
&props);
if (props) {
if (old_ref) {
} else if (server) {
if (old_ref) {
if (old_ref) {
// Called in display/drawing-item.cpp, display/nr-filter-primitive.cpp, libnrtype/Layout-TNG-Input.cpp
SPStyle *
return style;
// Called in display/drawing-item.cpp, display/nr-filter-primitive.cpp, libnrtype/Layout-TNG-Input.cpp
SPStyle *
delete style;
return NULL;
return style;
static CRSelEng *
* http://www.w3.org/TR/SVG11/styling.html#StylingWithCSS says that
return ret;
// Called in: style.cpp, style-internal.cpp
sp_style_set_ipaint_to_uri(SPStyle *style, SPIPaint *paint, const Inkscape::URI *uri, SPDocument *document)
// std::cout << "sp_style_set_ipaint_to_uri: Entrance: " << uri << " " << (void*)document << std::endl;
style->fill_ps_changed_connection = paint->value.href->changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_style_fill_paint_server_ref_changed), style));
style->stroke_ps_changed_connection = paint->value.href->changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_style_stroke_paint_server_ref_changed), style));
// Called in: style.cpp, style-internal.cpp
// Called in: desktop-style.cpp
// Called in: widgets/font-selector.cpp, widgets/text-toolbar.cpp, ui/dialog/text-edit.cpp
gchar const *
switch (unit) {
// Called in: style-internal.cpp, widgets/text-toolbar.cpp, ui/dialog/text-edit.cpp
switch (unit) {
return unit_size;
// Called in: widgets/text-toolbar.cpp, ui/dialog/text-edit.cpp
return size;
if (linked) {
if (recursive) {
// Called in sp-object.cpp
if (!style) {
if (!repr) {
NULL);
return css;
// Called in: selection-chemistry.cpp, widgets/stroke-marker-selector.cpp, widgets/stroke-style.cpp,
NULL);
return result;
// Called in: selection-chemistry.cpp, ui/dialog/inkscape-preferences.cpp
return css;
return css;
// Called in style.cpp
is_url(char const *p)
if (p == NULL)
// Called in: ui/dialog/inkscape-preferences.cpp, ui/tools/tweek-tool.cpp
if (is_url(sp_repr_css_property(css, "clip-path", NULL))) sp_repr_css_set_property(css, "clip-path", NULL);
if (is_url(sp_repr_css_property(css, "color-profile", NULL))) sp_repr_css_set_property(css, "color-profile", NULL);
if (is_url(sp_repr_css_property(css, "cursor", NULL))) sp_repr_css_set_property(css, "cursor", NULL);
if (is_url(sp_repr_css_property(css, "filter", NULL))) sp_repr_css_set_property(css, "filter", NULL);
if (is_url(sp_repr_css_property(css, "marker", NULL))) sp_repr_css_set_property(css, "marker", NULL);
if (is_url(sp_repr_css_property(css, "marker-start", NULL))) sp_repr_css_set_property(css, "marker-start", NULL);
if (is_url(sp_repr_css_property(css, "marker-mid", NULL))) sp_repr_css_set_property(css, "marker-mid", NULL);
if (is_url(sp_repr_css_property(css, "marker-end", NULL))) sp_repr_css_set_property(css, "marker-end", NULL);
if (is_url(sp_repr_css_property(css, "stroke", NULL))) sp_repr_css_set_property(css, "stroke", NULL);
return css;
// Called in style.cpp
// Called in style.cpp for stroke-dasharray
if (string) {
bool first = true;
gchar *w = *i;
if (w == NULL)
g_strfreev(a);
if (!first) {
first = false;
g_strfreev(a);
// Called in: text-editing.cpp,
return css;
* See: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
bool quote = false;
quote = true;
quote = true;
quote = true;
if( quote ) {
// Called in style-internal.cpp, xml/repr-css.cpp
// Called in style-internal.cpp, text-toolbar.cpp