~valavanisalex/ubuntu/precise/inkscape/fix-943984

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/libcroco/cr-style.h

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
 
2
 
 
3
/*
 
4
 * This file is part of The Croco Library
 
5
 *
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or
 
8
 * modify it under the terms of version 2.1 of the GNU Lesser General Public
 
9
 * License as published by the Free Software Foundation.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Lesser General Public License
 
17
 * along with this program; if not, write to the Free Software
 
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 
19
 * USA
 
20
 *
 
21
 * Author: Dodji Seketeli.
 
22
 * See COPYRIGHTS file for copyright information.
 
23
 */
 
24
 
 
25
#ifndef __CR_STYLE_H__
 
26
#define __CR_STYLE_H__
 
27
 
 
28
#include "cr-utils.h"
 
29
#include "cr-statement.h"
 
30
#include "cr-fonts.h"
 
31
 
 
32
/**
 
33
 *@file
 
34
 *The declaration of the #CRStyle class.
 
35
 */
 
36
G_BEGIN_DECLS
 
37
 
 
38
typedef struct _CRStyle CRStyle ;
 
39
 
 
40
enum CRBorderStyle
 
41
{
 
42
        BORDER_STYLE_NONE = 0,
 
43
        BORDER_STYLE_HIDDEN,
 
44
        BORDER_STYLE_DOTTED,
 
45
        BORDER_STYLE_DASHED,
 
46
        BORDER_STYLE_SOLID,
 
47
        BORDER_STYLE_DOUBLE,
 
48
        BORDER_STYLE_GROOVE,
 
49
        BORDER_STYLE_RIDGE,
 
50
        BORDER_STYLE_INSET,
 
51
        BORDER_STYLE_OUTSET,
 
52
        BORDER_STYLE_INHERIT
 
53
} ;
 
54
 
 
55
enum CRDisplayType
 
56
{
 
57
        DISPLAY_NONE,
 
58
        DISPLAY_INLINE,
 
59
        DISPLAY_BLOCK,
 
60
        DISPLAY_LIST_ITEM,
 
61
        DISPLAY_RUN_IN,
 
62
        DISPLAY_COMPACT,
 
63
        DISPLAY_MARKER,
 
64
        DISPLAY_TABLE,
 
65
        DISPLAY_INLINE_TABLE,
 
66
        DISPLAY_TABLE_ROW_GROUP,
 
67
        DISPLAY_TABLE_HEADER_GROUP,
 
68
        DISPLAY_TABLE_FOOTER_GROUP,
 
69
        DISPLAY_TABLE_ROW,
 
70
        DISPLAY_TABLE_COLUMN_GROUP,
 
71
        DISPLAY_TABLE_COLUMN,
 
72
        DISPLAY_TABLE_CELL,
 
73
        DISPLAY_TABLE_CAPTION,
 
74
        DISPLAY_INHERIT
 
75
} ;
 
76
 
 
77
enum CRPositionType
 
78
{
 
79
        POSITION_STATIC,
 
80
        POSITION_RELATIVE,
 
81
        POSITION_ABSOLUTE,
 
82
        POSITION_FIXED,
 
83
        POSITION_INHERIT,
 
84
} ;
 
85
 
 
86
enum CRFloatType
 
87
{
 
88
        FLOAT_NONE,
 
89
        FLOAT_LEFT,
 
90
        FLOAT_RIGHT,
 
91
        FLOAT_INHERIT
 
92
} ;
 
93
 
 
94
enum CRWhiteSpaceType
 
95
{
 
96
        WHITE_SPACE_NORMAL,
 
97
        WHITE_SPACE_PRE,
 
98
        WHITE_SPACE_NOWRAP,
 
99
        WHITE_SPACE_INHERIT
 
100
} ;
 
101
 
 
102
 
 
103
#define BORDER_THIN 2
 
104
#define BORDER_MEDIUM 4
 
105
#define BORDER_THICK 6
 
106
 
 
107
 
 
108
/**
 
109
 *A numerical css property value.
 
110
 *This data type is actually split in 3 parts:
 
111
 *1/the specified value
 
112
 *2/the computed value
 
113
 *3/the actual value.
 
114
 *To understand the semantic of these three parts,
 
115
 *see css2 spec chap 6.1 ("Specified, computed and actual values.").
 
116
 */
 
117
typedef struct _CRNumPropVal CRNumPropVal ;
 
118
struct _CRNumPropVal
 
119
{
 
120
        /**specified value*/
 
121
        CRNum sv ;
 
122
        /**computed value*/
 
123
        CRNum cv ;
 
124
        /**actual value*/
 
125
        CRNum av ;
 
126
} ;
 
127
 
 
128
/**
 
129
 *An rgb css property value.
 
130
 *This data type is actually split in 3 parts:
 
131
 *1/the specified value
 
132
 *2/the computed value
 
133
 *3/the actual value.
 
134
 *To understand the semantic of these three parts,
 
135
 *see css2 spec chap 6.1 ("Specified, computed and actual values.").
 
136
 */
 
137
typedef struct _CRRgbPropVal CRRgbPropVal ;
 
138
struct _CRRgbPropVal
 
139
{        
 
140
        /**specified value*/
 
141
        CRRgb sv ;
 
142
        /**computed value*/
 
143
        CRRgb cv ;
 
144
        /**actual value*/
 
145
        CRRgb av ;
 
146
} ;
 
147
 
 
148
 
 
149
enum CRNumProp
 
150
{        
 
151
        NUM_PROP_TOP=0,
 
152
        NUM_PROP_RIGHT,
 
153
        NUM_PROP_BOTTOM,
 
154
        NUM_PROP_LEFT,/*3*/
 
155
 
 
156
        NUM_PROP_PADDING_TOP,
 
157
        NUM_PROP_PADDING_RIGHT,
 
158
        NUM_PROP_PADDING_BOTTOM,
 
159
        NUM_PROP_PADDING_LEFT,/*7*/
 
160
 
 
161
        NUM_PROP_BORDER_TOP,
 
162
        NUM_PROP_BORDER_RIGHT,
 
163
        NUM_PROP_BORDER_BOTTOM,
 
164
        NUM_PROP_BORDER_LEFT,/*11*/
 
165
 
 
166
        NUM_PROP_MARGIN_TOP,
 
167
        NUM_PROP_MARGIN_RIGHT,
 
168
        NUM_PROP_MARGIN_BOTTOM,
 
169
        NUM_PROP_MARGIN_LEFT,/*15*/
 
170
 
 
171
        NUM_PROP_WIDTH,
 
172
 
 
173
        /*must be last*/
 
174
        NB_NUM_PROPS
 
175
} ;
 
176
 
 
177
enum CRRgbProp
 
178
{
 
179
        RGB_PROP_BORDER_TOP_COLOR = 0,
 
180
        RGB_PROP_BORDER_RIGHT_COLOR,
 
181
        RGB_PROP_BORDER_BOTTOM_COLOR,
 
182
        RGB_PROP_BORDER_LEFT_COLOR,
 
183
        RGB_PROP_COLOR,
 
184
        RGB_PROP_BACKGROUND_COLOR,
 
185
 
 
186
        /*must be last*/
 
187
        NB_RGB_PROPS
 
188
} ;
 
189
 
 
190
 
 
191
enum CRBorderStyleProp
 
192
{
 
193
        BORDER_STYLE_PROP_TOP = 0,
 
194
        BORDER_STYLE_PROP_RIGHT,
 
195
        BORDER_STYLE_PROP_BOTTOM,
 
196
        BORDER_STYLE_PROP_LEFT,
 
197
        
 
198
        /*must be last*/
 
199
        NB_BORDER_STYLE_PROPS
 
200
} ;
 
201
 
 
202
enum CRBoxOffsetProp
 
203
{
 
204
        BOX_OFFSET_PROP_TOP = 0,
 
205
        BOX_OFFSET_PROP_RIGHT,
 
206
        BOX_OFFSET_PROP_BOTTOM,
 
207
        BOX_OFFSET_PROP_LEFT,
 
208
 
 
209
        /*must be last*/
 
210
        NB_BOX_OFFSET_PROPS
 
211
} ;
 
212
 
 
213
typedef struct _CRFontSizeVal CRFontSizeVal ;
 
214
struct _CRFontSizeVal {
 
215
        /*specified value*/
 
216
        CRFontSize sv ;
 
217
        /*computed value*/
 
218
        CRFontSize cv ;
 
219
        /*actual value*/
 
220
        CRFontSize av ;
 
221
} ;
 
222
 
 
223
/**
 
224
 *The css2 style class.
 
225
 *Contains computed and actual values
 
226
 *inferred from the declarations found
 
227
 *in the stylesheets.
 
228
 *See css2 spec chapter 6.
 
229
 */
 
230
struct _CRStyle
 
231
{
 
232
        /**
 
233
         *numerical properties.
 
234
         *the properties are indexed by
 
235
         *enum #CRNumProp. 
 
236
         */
 
237
        CRNumPropVal num_props[NB_NUM_PROPS] ;
 
238
 
 
239
        /**
 
240
         *color properties.
 
241
         *They are indexed by enum #CRRgbProp .
 
242
         */
 
243
        CRRgbPropVal rgb_props[NB_RGB_PROPS] ;
 
244
 
 
245
        /**
 
246
         *border style properties.
 
247
         *They are indexed by enum #CRBorderStyleProp .
 
248
         */
 
249
        enum CRBorderStyle border_style_props[NB_BORDER_STYLE_PROPS] ;
 
250
 
 
251
        /**box display type*/
 
252
        enum CRDisplayType display ;
 
253
 
 
254
        /**the positioning scheme*/
 
255
        enum CRPositionType position ;
 
256
 
 
257
        /**the float property*/
 
258
        enum CRFloatType float_type ;
 
259
 
 
260
        /*
 
261
         *the 'font-family' property.
 
262
         */
 
263
        CRFontFamily *font_family ;
 
264
 
 
265
        /**
 
266
         *the 'font-size' property.
 
267
         */
 
268
        CRFontSizeVal font_size ;
 
269
        CRFontSizeAdjust *font_size_adjust ;
 
270
        enum CRFontStyle font_style ;
 
271
        enum CRFontVariant font_variant ;
 
272
        enum CRFontWeight font_weight ;
 
273
        enum CRFontStretch font_stretch ;
 
274
 
 
275
        /**
 
276
         * the 'tex' properties
 
277
         */
 
278
        enum CRWhiteSpaceType white_space;
 
279
 
 
280
        gboolean inherited_props_resolved ;
 
281
        CRStyle *parent_style ;
 
282
        gulong ref_count ;
 
283
} ;
 
284
 
 
285
enum CRStatus cr_style_white_space_type_to_string (enum CRWhiteSpaceType a_code,
 
286
                                                   GString * a_str, guint a_nb_indent) ;
 
287
 
 
288
enum CRStatus cr_style_num_prop_val_to_string (CRNumPropVal *a_prop_val,
 
289
                                               GString *a_str,
 
290
                                               guint a_nb_indent) ;
 
291
 
 
292
enum CRStatus cr_style_rgb_prop_val_to_string (CRRgbPropVal *a_prop_val,
 
293
                                               GString *a_str,
 
294
                                               guint a_nb_indent) ;
 
295
 
 
296
enum CRStatus cr_style_border_style_to_string (enum CRBorderStyle a_prop,
 
297
                                               GString *a_str,
 
298
                                               guint a_nb_indent) ;
 
299
 
 
300
enum CRStatus cr_style_display_type_to_string (enum CRDisplayType a_code,
 
301
                                               GString *a_str,
 
302
                                               guint a_nb_indent) ;
 
303
 
 
304
enum CRStatus cr_style_position_type_to_string (enum CRPositionType a_code,
 
305
                                                GString *a_str,
 
306
                                                guint a_nb_indent) ;
 
307
 
 
308
enum CRStatus cr_style_float_type_to_string (enum CRFloatType a_code,
 
309
                                             GString *a_str,
 
310
                                             guint a_nb_indent) ;
 
311
 
 
312
CRStyle * cr_style_new (gboolean a_set_props_to_initial_values) ;
 
313
 
 
314
enum CRStatus cr_style_set_props_to_default_values (CRStyle *a_this) ;
 
315
enum CRStatus cr_style_set_props_to_initial_values (CRStyle *a_this) ;
 
316
enum CRStatus cr_style_resolve_inherited_properties (CRStyle *a_this) ;
 
317
enum CRStatus cr_style_propagate_from_parent (CRStyle *a_this);
 
318
 
 
319
enum CRStatus cr_style_set_style_from_decl (CRStyle *a_this, 
 
320
                                            CRDeclaration *a_decl) ;
 
321
 
 
322
 
 
323
enum CRStatus cr_style_copy (CRStyle *a_dest, CRStyle *a_src) ;
 
324
 
 
325
enum CRStatus cr_style_ref (CRStyle *a_this) ;
 
326
 
 
327
gboolean cr_style_unref (CRStyle *a_this) ;
 
328
 
 
329
void cr_style_destroy (CRStyle *a_this) ;
 
330
 
 
331
CRStyle * cr_style_dup (CRStyle *a_this) ;
 
332
 
 
333
enum CRStatus cr_style_to_string (CRStyle *a_this, 
 
334
                                  GString **a_str, 
 
335
                                  guint a_nb_indent) ;
 
336
 
 
337
G_END_DECLS
 
338
 
 
339
#endif /*__CR_STYLE_H__*/