1 #ifndef __SP_DESKTOP_STYLE_H__
2 #define __SP_DESKTOP_STYLE_H__
4 /*
5 * Desktop style management
6 *
7 * Authors:
8 * bulia byak
9 * verbalshadow
10 *
11 * Copyright (C) 2004, 2006 authors
12 *
13 * Released under GNU GPL, read the file 'COPYING' for more information
14 */
16 #include <glib/gtypes.h>
18 class ColorRGBA;
19 struct SPCSSAttr;
20 struct SPDesktop;
21 struct SPObject;
22 struct SPStyle;
23 namespace Inkscape {
24 namespace XML {
25 struct Node;
26 }
27 }
29 enum { // what kind of a style the query is returning
30 QUERY_STYLE_NOTHING, // nothing was queried - e.g. no selection
31 QUERY_STYLE_SINGLE, // single object was queried
32 QUERY_STYLE_MULTIPLE_SAME, // multiple objects were queried, the results were the same
33 QUERY_STYLE_MULTIPLE_DIFFERENT, // multiple objects were queried, the results could NOT be meaningfully averaged
34 QUERY_STYLE_MULTIPLE_AVERAGED // multiple objects were queried, the results were meaningfully averaged
35 };
37 enum { // which property was queried (add when you need more)
38 QUERY_STYLE_PROPERTY_EVERYTHING,
39 QUERY_STYLE_PROPERTY_FILL, // fill, fill-opacity
40 QUERY_STYLE_PROPERTY_STROKE, // stroke, stroke-opacity
41 QUERY_STYLE_PROPERTY_STROKEWIDTH, // stroke-width
42 QUERY_STYLE_PROPERTY_STROKEMITERLIMIT, // miter limit
43 QUERY_STYLE_PROPERTY_STROKEJOIN, // stroke join
44 QUERY_STYLE_PROPERTY_STROKECAP, // stroke cap
45 QUERY_STYLE_PROPERTY_STROKESTYLE, // markers, dasharray, miterlimit, stroke-width, stroke-cap, stroke-join
46 QUERY_STYLE_PROPERTY_FONTFAMILY, // font-family
47 QUERY_STYLE_PROPERTY_FONTSTYLE, // font style
48 QUERY_STYLE_PROPERTY_FONTNUMBERS, // size, spacings
49 QUERY_STYLE_PROPERTY_MASTEROPACITY // opacity
50 };
52 void sp_desktop_apply_css_recursive(SPObject *o, SPCSSAttr *css, bool skip_lines);
53 void sp_desktop_set_color(SPDesktop *desktop, ColorRGBA const &color, bool is_relative, bool fill);
54 void sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change = true, bool write_current = true);
55 SPCSSAttr *sp_desktop_get_style(SPDesktop *desktop, bool with_text);
56 guint32 sp_desktop_get_color (SPDesktop *desktop, bool is_fill);
57 double sp_desktop_get_master_opacity_tool(SPDesktop *desktop, char const *tool);
58 double sp_desktop_get_opacity_tool(SPDesktop *desktop, char const *tool, bool is_fill);
59 guint32 sp_desktop_get_color_tool(SPDesktop *desktop, char const *tool, bool is_fill);
60 double sp_desktop_get_font_size_tool (SPDesktop *desktop);
61 void sp_desktop_apply_style_tool(SPDesktop *desktop, Inkscape::XML::Node *repr, char const *tool, bool with_text);
63 gdouble stroke_average_width (GSList const *objects);
65 int objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill);
66 int objects_query_fontnumbers (GSList *objects, SPStyle *style_res);
67 int objects_query_fontstyle (GSList *objects, SPStyle *style_res);
68 int objects_query_fontfamily (GSList *objects, SPStyle *style_res);
69 int objects_query_opacity (GSList *objects, SPStyle *style_res);
70 int objects_query_strokewidth (GSList *objects, SPStyle *style_res);
71 int objects_query_miterlimit (GSList *objects, SPStyle *style_res);
72 int objects_query_strokecap (GSList *objects, SPStyle *style_res);
73 int objects_query_strokejoin (GSList *objects, SPStyle *style_res);
75 int sp_desktop_query_style_from_list (GSList *list, SPStyle *style, int property);
76 int sp_desktop_query_style(SPDesktop *desktop, SPStyle *style, int property);
77 bool sp_desktop_query_style_all (SPDesktop *desktop, SPStyle *query);
79 #endif
82 /*
83 Local Variables:
84 mode:c++
85 c-file-style:"stroustrup"
86 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
87 indent-tabs-mode:nil
88 fill-column:99
89 End:
90 */
91 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :