~ubuntu-branches/debian/squeeze/inkscape/squeeze

« back to all changes in this revision

Viewing changes to src/desktop-style.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-09-09 23:29:02 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080909232902-c50iujhk1w79u8e7
Tags: 0.46-2.1
* Non-maintainer upload.
* Add upstream patch fixing a crash in the open dialog
  in the zh_CN.utf8 locale. Closes: #487623.
  Thanks to Luca Bruno for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 * Released under GNU GPL, read the file 'COPYING' for more information
13
13
 */
14
14
 
 
15
#include <string>
 
16
#include <cstring>
 
17
 
15
18
#include "desktop.h"
16
19
#include "color-rgba.h"
17
20
#include "svg/css-ostringstream.h"
18
21
#include "svg/svg.h"
19
22
#include "svg/svg-color.h"
20
23
#include "selection.h"
21
 
#include "sp-tspan.h"
22
 
#include "sp-textpath.h"
23
24
#include "inkscape.h"
24
25
#include "style.h"
25
26
#include "prefs-utils.h"
26
27
#include "sp-use.h"
 
28
#include "sp-feblend.h"
 
29
#include "sp-filter.h"
 
30
#include "sp-filter-reference.h"
 
31
#include "sp-gaussian-blur.h"
27
32
#include "sp-flowtext.h"
28
33
#include "sp-flowregion.h"
29
34
#include "sp-flowdiv.h"
30
35
#include "sp-linear-gradient.h"
 
36
#include "sp-pattern.h"
31
37
#include "sp-radial-gradient.h"
32
 
#include "sp-pattern.h"
 
38
#include "sp-textpath.h"
 
39
#include "sp-tref.h"
 
40
#include "sp-tspan.h"
33
41
#include "xml/repr.h"
34
42
#include "libnrtype/font-style-to-pos.h"
35
 
 
 
43
#include "sp-path.h"
36
44
 
37
45
#include "desktop-style.h"
 
46
#include "svg/svg-icc-color.h"
 
47
#include "box3d-side.h"
38
48
 
39
49
/**
40
50
 * Set color on selection on desktop.
50
60
 
51
61
    guint32 rgba = SP_RGBA32_F_COMPOSE(color[0], color[1], color[2], color[3]);
52
62
    gchar b[64];
53
 
    sp_svg_write_color(b, 64, rgba);
 
63
    sp_svg_write_color(b, sizeof(b), rgba);
54
64
    SPCSSAttr *css = sp_repr_css_attr_new();
55
65
    if (fill) {
56
66
        sp_repr_css_set_property(css, "fill", b);
157
167
        sp_repr_css_merge(css_write, css);
158
168
        sp_css_attr_unset_uris(css_write);
159
169
        sp_repr_css_change(inkscape_get_repr(INKSCAPE, "desktop"), css_write, "style");
 
170
        for (const GSList *i = desktop->selection->itemList(); i != NULL; i = i->next) {
 
171
            /* last used styles for 3D box faces are stored separately */
 
172
            if (SP_IS_BOX3D_SIDE (i->data)) {
 
173
                const char * descr  = box3d_side_axes_string(SP_BOX3D_SIDE(i->data));
 
174
                if (descr != NULL) {
 
175
                    gchar *style_grp = g_strconcat ("desktop.", descr, NULL);
 
176
                    sp_repr_css_change(inkscape_get_repr(INKSCAPE, style_grp), css_write, "style");
 
177
                    g_free (style_grp);
 
178
                }
 
179
            }
 
180
        }
160
181
        sp_repr_css_attr_unref(css_write);
161
182
    }
162
183
 
335
356
double
336
357
sp_desktop_get_font_size_tool(SPDesktop *desktop)
337
358
{
 
359
    (void)desktop; // TODO cleanup
338
360
    gchar const *desktop_style = inkscape_get_repr(INKSCAPE, "desktop")->attribute("style");
339
361
    gchar const *style_str = NULL;
340
362
    if ((prefs_get_int_attribute("tools.text", "usecurrent", 0) != 0) && desktop_style) {
348
370
 
349
371
    double ret = 12;
350
372
    if (style_str) {
351
 
        SPStyle *style = sp_style_new();
 
373
        SPStyle *style = sp_style_new(SP_ACTIVE_DOCUMENT);
352
374
        sp_style_merge_from_style_string(style, style_str);
353
375
        ret = style->font_size.computed;
354
376
        sp_style_unref(style);
376
398
 
377
399
        SPObject *object = SP_OBJECT(l->data);
378
400
 
379
 
        if ( object->style->stroke.type == SP_PAINT_TYPE_NONE ) {
 
401
        if ( object->style->stroke.isNone() ) {
380
402
            ++n_notstroked;   // do not count nonstroked objects
381
403
            continue;
382
404
        } else {
404
426
    }
405
427
 
406
428
    SPIPaint *paint_res = isfill? &style_res->fill : &style_res->stroke;
407
 
    paint_res->type = SP_PAINT_TYPE_IMPOSSIBLE;
 
429
    bool paintImpossible = true;
408
430
    paint_res->set = TRUE;
409
431
 
 
432
    SVGICCColor* iccColor = 0;
 
433
    bool iccSeen = false;
410
434
    gfloat c[4];
411
435
    c[0] = c[1] = c[2] = c[3] = 0.0;
412
436
    gint num = 0;
413
437
 
414
 
    gfloat prev[4];
415
 
    prev[0] = prev[1] = prev[2] = prev[3] = 0.0;
 
438
    gfloat prev[3];
 
439
    prev[0] = prev[1] = prev[2] = 0.0;
416
440
    bool same_color = true;
417
441
 
418
442
    for (GSList const *i = objects; i != NULL; i = i->next) {
424
448
 
425
449
        // We consider paint "effectively set" for anything within text hierarchy
426
450
        SPObject *parent = SP_OBJECT_PARENT (obj);
427
 
        bool paint_effectively_set = paint->set || (SP_IS_TEXT(parent) || SP_IS_TEXTPATH(parent) || SP_IS_TSPAN(parent) || SP_IS_FLOWTEXT(parent) || SP_IS_FLOWDIV(parent) || SP_IS_FLOWPARA(parent) || SP_IS_FLOWTSPAN(parent) || SP_IS_FLOWLINE(parent));
 
451
        bool paint_effectively_set =
 
452
            paint->set || (SP_IS_TEXT(parent) || SP_IS_TEXTPATH(parent) || SP_IS_TSPAN(parent)
 
453
            || SP_IS_FLOWTEXT(parent) || SP_IS_FLOWDIV(parent) || SP_IS_FLOWPARA(parent)
 
454
            || SP_IS_FLOWTSPAN(parent) || SP_IS_FLOWLINE(parent));
428
455
 
429
456
        // 1. Bail out with QUERY_STYLE_MULTIPLE_DIFFERENT if necessary
430
457
 
431
 
        if ((paint_res->type != SP_PAINT_TYPE_IMPOSSIBLE) && (paint->type != paint_res->type || (paint_res->set != paint_effectively_set))) {
 
458
        if ((!paintImpossible) && (!paint->isSameType(*paint_res) || (paint_res->set != paint_effectively_set))) {
432
459
            return QUERY_STYLE_MULTIPLE_DIFFERENT;  // different types of paint
433
460
        }
434
461
 
435
 
        if (paint_res->set && paint->set && paint_res->type == SP_PAINT_TYPE_PAINTSERVER) {
 
462
        if (paint_res->set && paint->set && paint_res->isPaintserver()) {
436
463
            // both previous paint and this paint were a server, see if the servers are compatible
437
464
 
438
465
            SPPaintServer *server_res = isfill? SP_STYLE_FILL_SERVER (style_res) : SP_STYLE_STROKE_SERVER (style_res);
472
499
 
473
500
        // 2. Sum color, copy server from paint to paint_res
474
501
 
475
 
        if (paint_res->set && paint_effectively_set && paint->type == SP_PAINT_TYPE_COLOR) {
476
 
 
 
502
        if (paint_res->set && paint_effectively_set && paint->isColor()) {
477
503
            gfloat d[3];
478
504
            sp_color_get_rgb_floatv (&paint->value.color, d);
479
505
 
480
506
            // Check if this color is the same as previous
481
 
            if (paint_res->type == SP_PAINT_TYPE_IMPOSSIBLE) {
 
507
            if (paintImpossible) {
482
508
                prev[0] = d[0];
483
509
                prev[1] = d[1];
484
510
                prev[2] = d[2];
485
 
                prev[3] = d[3];
 
511
                paint_res->setColor(d[0], d[1], d[2]);
 
512
                iccColor = paint->value.color.icc;
 
513
                iccSeen = true;
486
514
            } else {
487
 
                if (same_color && (prev[0] != d[0] || prev[1] != d[1] || prev[2] != d[2] || prev[3] != d[3]))
 
515
                if (same_color && (prev[0] != d[0] || prev[1] != d[1] || prev[2] != d[2]))
488
516
                    same_color = false;
 
517
                if ( iccSeen ) {
 
518
                    if(paint->value.color.icc) {
 
519
                        // TODO fix this
 
520
                        iccColor = 0;
 
521
                    }
 
522
                }
489
523
            }
490
524
 
491
525
            // average color
496
530
            num ++;
497
531
        }
498
532
 
499
 
       if (paint_res->set && paint_effectively_set && paint->type == SP_PAINT_TYPE_PAINTSERVER) { // copy the server
 
533
       paintImpossible = false;
 
534
       paint_res->colorSet = paint->colorSet;
 
535
       paint_res->currentcolor = paint->currentcolor;
 
536
       if (paint_res->set && paint_effectively_set && paint->isPaintserver()) { // copy the server
500
537
           if (isfill) {
501
 
               SP_STYLE_FILL_SERVER (style_res) = SP_STYLE_FILL_SERVER (style);
 
538
               sp_style_set_to_uri_string (style_res, true, style->getFillURI());
502
539
           } else {
503
 
               SP_STYLE_STROKE_SERVER (style_res) = SP_STYLE_STROKE_SERVER (style);
 
540
               sp_style_set_to_uri_string (style_res, false, style->getStrokeURI());
504
541
           }
505
542
       }
506
 
       paint_res->type = paint->type;
507
543
       paint_res->set = paint_effectively_set;
508
544
       style_res->fill_rule.computed = style->fill_rule.computed; // no averaging on this, just use the last one
509
545
    }
510
546
 
511
547
    // After all objects processed, divide the color if necessary and return
512
 
    if (paint_res->set && paint_res->type == SP_PAINT_TYPE_COLOR) { // set the color
 
548
    if (paint_res->set && paint_res->isColor()) { // set the color
513
549
        g_assert (num >= 1);
514
550
 
515
551
        c[0] /= num;
516
552
        c[1] /= num;
517
553
        c[2] /= num;
518
554
        c[3] /= num;
519
 
        sp_color_set_rgb_float(&paint_res->value.color, c[0], c[1], c[2]);
 
555
        paint_res->setColor(c[0], c[1], c[2]);
520
556
        if (isfill) {
521
557
            style_res->fill_opacity.value = SP_SCALE24_FROM_FLOAT (c[3]);
522
558
        } else {
523
559
            style_res->stroke_opacity.value = SP_SCALE24_FROM_FLOAT (c[3]);
524
560
        }
 
561
 
 
562
 
 
563
        if ( iccSeen && iccColor ) {
 
564
            // TODO check for existing
 
565
            SVGICCColor* tmp = new SVGICCColor(*iccColor);
 
566
            paint_res->value.color.icc = tmp;
 
567
        }
 
568
 
525
569
        if (num > 1) {
526
570
            if (same_color)
527
571
                return QUERY_STYLE_MULTIPLE_SAME;
610
654
        SPStyle *style = SP_OBJECT_STYLE (obj);
611
655
        if (!style) continue;
612
656
 
613
 
        if ( style->stroke.type == SP_PAINT_TYPE_NONE ) {
 
657
        if ( style->stroke.isNone() ) {
614
658
            continue;
615
659
        }
616
660
 
667
711
        SPStyle *style = SP_OBJECT_STYLE (obj);
668
712
        if (!style) continue;
669
713
 
670
 
        if ( style->stroke.type == SP_PAINT_TYPE_NONE ) {
 
714
        if ( style->stroke.isNone() ) {
671
715
            continue;
672
716
        }
673
717
 
720
764
        SPStyle *style = SP_OBJECT_STYLE (obj);
721
765
        if (!style) continue;
722
766
 
723
 
        if ( style->stroke.type == SP_PAINT_TYPE_NONE ) {
 
767
        if ( style->stroke.isNone() ) {
724
768
            continue;
725
769
        }
726
770
 
770
814
        SPStyle *style = SP_OBJECT_STYLE (obj);
771
815
        if (!style) continue;
772
816
 
773
 
        if ( style->stroke.type == SP_PAINT_TYPE_NONE ) {
 
817
        if ( style->stroke.isNone() ) {
774
818
            continue;
775
819
        }
776
820
 
824
868
        SPObject *obj = SP_OBJECT (i->data);
825
869
 
826
870
        if (!SP_IS_TEXT(obj) && !SP_IS_FLOWTEXT(obj)
827
 
            && !SP_IS_TSPAN(obj) && !SP_IS_TEXTPATH(obj)
 
871
            && !SP_IS_TSPAN(obj) && !SP_IS_TREF(obj) && !SP_IS_TEXTPATH(obj)
828
872
            && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj))
829
873
            continue;
830
874
 
917
961
        SPObject *obj = SP_OBJECT (i->data);
918
962
 
919
963
        if (!SP_IS_TEXT(obj) && !SP_IS_FLOWTEXT(obj)
920
 
            && !SP_IS_TSPAN(obj) && !SP_IS_TEXTPATH(obj)
 
964
            && !SP_IS_TSPAN(obj) && !SP_IS_TREF(obj) && !SP_IS_TEXTPATH(obj)
921
965
            && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj))
922
966
            continue;
923
967
 
972
1016
        SPObject *obj = SP_OBJECT (i->data);
973
1017
 
974
1018
        if (!SP_IS_TEXT(obj) && !SP_IS_FLOWTEXT(obj)
975
 
            && !SP_IS_TSPAN(obj) && !SP_IS_TEXTPATH(obj)
 
1019
            && !SP_IS_TSPAN(obj) && !SP_IS_TREF(obj) && !SP_IS_TEXTPATH(obj)
976
1020
            && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj))
977
1021
            continue;
978
1022
 
1009
1053
    }
1010
1054
}
1011
1055
 
 
1056
int
 
1057
objects_query_fontspecification (GSList *objects, SPStyle *style_res)
 
1058
{
 
1059
    bool different = false;
 
1060
    int texts = 0;
 
1061
 
 
1062
    if (style_res->text->font_specification.value) {
 
1063
        g_free(style_res->text->font_specification.value);
 
1064
        style_res->text->font_specification.value = NULL;
 
1065
    }
 
1066
    style_res->text->font_specification.set = FALSE;
 
1067
 
 
1068
    for (GSList const *i = objects; i != NULL; i = i->next) {
 
1069
        SPObject *obj = SP_OBJECT (i->data);
 
1070
 
 
1071
        if (!SP_IS_TEXT(obj) && !SP_IS_FLOWTEXT(obj)
 
1072
            && !SP_IS_TSPAN(obj) && !SP_IS_TREF(obj) && !SP_IS_TEXTPATH(obj)
 
1073
            && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj))
 
1074
            continue;
 
1075
 
 
1076
        SPStyle *style = SP_OBJECT_STYLE (obj);
 
1077
        if (!style) continue;
 
1078
 
 
1079
        texts ++;
 
1080
 
 
1081
        if (style_res->text->font_specification.value && style_res->text->font_specification.set &&   
 
1082
            style->text->font_specification.value && style->text->font_specification.set &&
 
1083
            strcmp (style_res->text->font_specification.value, style->text->font_specification.value)) {
 
1084
            different = true;  // different fonts
 
1085
        }
 
1086
        
 
1087
        if (style->text->font_specification.set) {
 
1088
 
 
1089
            if (style_res->text->font_specification.value) {
 
1090
                g_free(style_res->text->font_specification.value);
 
1091
                style_res->text->font_specification.value = NULL;
 
1092
            }
 
1093
    
 
1094
            style_res->text->font_specification.set = TRUE;
 
1095
            style_res->text->font_specification.value = g_strdup(style->text->font_specification.value);
 
1096
        }
 
1097
    }
 
1098
 
 
1099
    if (texts == 0)
 
1100
        return QUERY_STYLE_NOTHING;
 
1101
 
 
1102
    if (texts > 1) {
 
1103
        if (different) {
 
1104
            return QUERY_STYLE_MULTIPLE_DIFFERENT;
 
1105
        } else {
 
1106
            return QUERY_STYLE_MULTIPLE_SAME;
 
1107
        }
 
1108
    } else {
 
1109
        return QUERY_STYLE_SINGLE;
 
1110
    }
 
1111
}
 
1112
 
 
1113
int
 
1114
objects_query_blend (GSList *objects, SPStyle *style_res)
 
1115
{
 
1116
    const int empty_prev = -2;
 
1117
    const int complex_filter = 5;
 
1118
    int blend = 0;
 
1119
    float blend_prev = empty_prev;
 
1120
    bool same_blend = true;
 
1121
    guint items = 0;
 
1122
    
 
1123
    for (GSList const *i = objects; i != NULL; i = i->next) {
 
1124
        SPObject *obj = SP_OBJECT (i->data);
 
1125
        SPStyle *style = SP_OBJECT_STYLE (obj);
 
1126
        if(!style || !SP_IS_ITEM(obj)) continue;
 
1127
 
 
1128
        items++;
 
1129
 
 
1130
        //if object has a filter
 
1131
        if (style->filter.set && style->getFilter()) {
 
1132
            int blurcount = 0;
 
1133
            int blendcount = 0;
 
1134
 
 
1135
            // determine whether filter is simple (blend and/or blur) or complex
 
1136
            for(SPObject *primitive_obj = style->getFilter()->children;
 
1137
                primitive_obj && SP_IS_FILTER_PRIMITIVE(primitive_obj);
 
1138
                primitive_obj = primitive_obj->next) {
 
1139
                SPFilterPrimitive *primitive = SP_FILTER_PRIMITIVE(primitive_obj);
 
1140
                if(SP_IS_FEBLEND(primitive))
 
1141
                    ++blendcount;
 
1142
                else if(SP_IS_GAUSSIANBLUR(primitive))
 
1143
                    ++blurcount;
 
1144
                else {
 
1145
                    blurcount = complex_filter;
 
1146
                    break;
 
1147
                }
 
1148
            }
 
1149
 
 
1150
            // simple filter
 
1151
            if(blurcount == 1 || blendcount == 1) {
 
1152
                for(SPObject *primitive_obj = style->getFilter()->children;
 
1153
                    primitive_obj && SP_IS_FILTER_PRIMITIVE(primitive_obj);
 
1154
                    primitive_obj = primitive_obj->next) {
 
1155
                    if(SP_IS_FEBLEND(primitive_obj)) {
 
1156
                        SPFeBlend *spblend = SP_FEBLEND(primitive_obj);
 
1157
                        blend = spblend->blend_mode;
 
1158
                    }
 
1159
                }
 
1160
            }
 
1161
            else {
 
1162
                blend = complex_filter;
 
1163
            }
 
1164
        }
 
1165
        // defaults to blend mode = "normal"
 
1166
        else {
 
1167
            blend = 0;
 
1168
        }
 
1169
 
 
1170
        if(blend_prev != empty_prev && blend_prev != blend)
 
1171
            same_blend = false;
 
1172
        blend_prev = blend;
 
1173
    }
 
1174
 
 
1175
    if (items > 0) {
 
1176
        style_res->filter_blend_mode.value = blend;
 
1177
    }
 
1178
 
 
1179
    if (items == 0) {
 
1180
        return QUERY_STYLE_NOTHING;
 
1181
    } else if (items == 1) {
 
1182
        return QUERY_STYLE_SINGLE;
 
1183
    } else {
 
1184
        if(same_blend)
 
1185
            return QUERY_STYLE_MULTIPLE_SAME;
 
1186
        else
 
1187
            return QUERY_STYLE_MULTIPLE_DIFFERENT;
 
1188
    }
 
1189
}
 
1190
 
 
1191
/**
 
1192
 * Write to style_res the average blurring of a list of objects.
 
1193
 */
 
1194
int
 
1195
objects_query_blur (GSList *objects, SPStyle *style_res)
 
1196
{
 
1197
   if (g_slist_length(objects) == 0) {
 
1198
        /* No objects, set empty */
 
1199
        return QUERY_STYLE_NOTHING;
 
1200
    }
 
1201
 
 
1202
    float blur_sum = 0;
 
1203
    float blur_prev = -1;
 
1204
    bool same_blur = true;
 
1205
    guint blur_items = 0;
 
1206
    guint items = 0;
 
1207
    
 
1208
    for (GSList const *i = objects; i != NULL; i = i->next) {
 
1209
        SPObject *obj = SP_OBJECT (i->data);
 
1210
        SPStyle *style = SP_OBJECT_STYLE (obj);
 
1211
        if (!style) continue;
 
1212
        if (!SP_IS_ITEM(obj)) continue;
 
1213
 
 
1214
        NR::Matrix i2d = sp_item_i2d_affine (SP_ITEM(obj));
 
1215
 
 
1216
        items ++;
 
1217
 
 
1218
        //if object has a filter
 
1219
        if (style->filter.set && style->getFilter()) {
 
1220
            //cycle through filter primitives
 
1221
            SPObject *primitive_obj = style->getFilter()->children;
 
1222
            while (primitive_obj) {
 
1223
                if (SP_IS_FILTER_PRIMITIVE(primitive_obj)) {
 
1224
                    SPFilterPrimitive *primitive = SP_FILTER_PRIMITIVE(primitive_obj);
 
1225
                    
 
1226
                    //if primitive is gaussianblur
 
1227
                    if(SP_IS_GAUSSIANBLUR(primitive)) {
 
1228
                        SPGaussianBlur * spblur = SP_GAUSSIANBLUR(primitive);
 
1229
                        float num = spblur->stdDeviation.getNumber();
 
1230
                        blur_sum += num * NR::expansion(i2d);
 
1231
                        if (blur_prev != -1 && fabs (num - blur_prev) > 1e-2) // rather low tolerance because difference in blur radii is much harder to notice than e.g. difference in sizes
 
1232
                            same_blur = false;
 
1233
                        blur_prev = num;
 
1234
                        //TODO: deal with opt number, for the moment it's not necessary to the ui.
 
1235
                        blur_items ++;
 
1236
                    }
 
1237
                }
 
1238
                primitive_obj = primitive_obj->next;
 
1239
            }
 
1240
        }
 
1241
    }
 
1242
 
 
1243
    if (items > 0) {
 
1244
        if (blur_items > 0)
 
1245
            blur_sum /= blur_items;
 
1246
        style_res->filter_gaussianBlur_deviation.value = blur_sum;
 
1247
    }
 
1248
 
 
1249
    if (items == 0) {
 
1250
        return QUERY_STYLE_NOTHING;
 
1251
    } else if (items == 1) {
 
1252
        return QUERY_STYLE_SINGLE;
 
1253
    } else {
 
1254
        if (same_blur)
 
1255
            return QUERY_STYLE_MULTIPLE_SAME;
 
1256
        else
 
1257
            return QUERY_STYLE_MULTIPLE_AVERAGED;
 
1258
    }
 
1259
}
 
1260
 
1012
1261
/**
1013
1262
 * Query the given list of objects for the given property, write
1014
1263
 * the result to style, return appropriate flag.
1032
1281
 
1033
1282
    } else if (property == QUERY_STYLE_PROPERTY_MASTEROPACITY) {
1034
1283
        return objects_query_opacity (list, style);
1035
 
 
 
1284
        
 
1285
    } else if (property == QUERY_STYLE_PROPERTY_FONT_SPECIFICATION) {
 
1286
        return objects_query_fontspecification (list, style);
1036
1287
    } else if (property == QUERY_STYLE_PROPERTY_FONTFAMILY) {
1037
1288
        return objects_query_fontfamily (list, style);
1038
1289
    } else if (property == QUERY_STYLE_PROPERTY_FONTSTYLE) {
1039
1290
        return objects_query_fontstyle (list, style);
1040
1291
    } else if (property == QUERY_STYLE_PROPERTY_FONTNUMBERS) {
1041
1292
        return objects_query_fontnumbers (list, style);
 
1293
 
 
1294
    } else if (property == QUERY_STYLE_PROPERTY_BLEND) {
 
1295
        return objects_query_blend (list, style);
 
1296
    } else if (property == QUERY_STYLE_PROPERTY_BLUR) {
 
1297
        return objects_query_blur (list, style);
1042
1298
    }
1043
 
 
1044
1299
    return QUERY_STYLE_NOTHING;
1045
1300
}
1046
1301
 
1062
1317
}
1063
1318
 
1064
1319
/**
1065
 
 * Do the same as sp_desktop_query_style for all (defined) style properties, return true if none of
1066
 
 * the properties returned QUERY_STYLE_NOTHING.
 
1320
 * Do the same as sp_desktop_query_style for all (defined) style properties, return true if at 
 
1321
 * least one of the properties did not return QUERY_STYLE_NOTHING.
1067
1322
 */
1068
1323
bool
1069
1324
sp_desktop_query_style_all (SPDesktop *desktop, SPStyle *query)
1078
1333
        int result_strokecap = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_STROKECAP);
1079
1334
        int result_strokejoin = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_STROKEJOIN);
1080
1335
        int result_opacity = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_MASTEROPACITY);
1081
 
 
1082
 
        return (result_family != QUERY_STYLE_NOTHING && result_fstyle != QUERY_STYLE_NOTHING && result_fnumbers != QUERY_STYLE_NOTHING && result_fill != QUERY_STYLE_NOTHING && result_stroke != QUERY_STYLE_NOTHING && result_opacity != QUERY_STYLE_NOTHING && result_strokewidth != QUERY_STYLE_NOTHING && result_strokemiterlimit != QUERY_STYLE_NOTHING && result_strokecap != QUERY_STYLE_NOTHING && result_strokejoin != QUERY_STYLE_NOTHING);
 
1336
        int result_blur = sp_desktop_query_style (desktop, query, QUERY_STYLE_PROPERTY_BLUR);
 
1337
        
 
1338
        return (result_family != QUERY_STYLE_NOTHING || 
 
1339
                result_fstyle != QUERY_STYLE_NOTHING || 
 
1340
                result_fnumbers != QUERY_STYLE_NOTHING || 
 
1341
                result_fill != QUERY_STYLE_NOTHING || 
 
1342
                result_stroke != QUERY_STYLE_NOTHING || 
 
1343
                result_opacity != QUERY_STYLE_NOTHING || 
 
1344
                result_strokewidth != QUERY_STYLE_NOTHING || 
 
1345
                result_strokemiterlimit != QUERY_STYLE_NOTHING ||
 
1346
                result_strokecap != QUERY_STYLE_NOTHING ||
 
1347
                result_strokejoin != QUERY_STYLE_NOTHING ||
 
1348
                result_blur != QUERY_STYLE_NOTHING);
1083
1349
}
1084
1350
 
1085
1351