1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
/*
* "$Id: form.h 6649 2007-07-11 21:46:42Z mike $"
*
* CUPS form header file for the Common UNIX Printing System (CUPS).
*
* Copyright 2007 by Apple Inc.
* Copyright 1997-2005 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
* file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
/*
* Include necessary headers...
*/
#include "common.h"
/*
* Form elements...
*/
typedef enum
{
ELEMENT_FILE = -1, /* Pseudo element, not in file, but above */
ELEMENT_FRAGMENT, /* Text fragment */
ELEMENT_COMMENT, /* <!-- .... --> */
ELEMENT_ARC,
ELEMENT_BOX,
ELEMENT_BR,
ELEMENT_B,
ELEMENT_CUPSFORM,
ELEMENT_DEFVAR,
ELEMENT_FONT,
ELEMENT_H1,
ELEMENT_H2,
ELEMENT_H3,
ELEMENT_H4,
ELEMENT_H5,
ELEMENT_H6,
ELEMENT_HEAD,
ELEMENT_IMG,
ELEMENT_I,
ELEMENT_LINE,
ELEMENT_PAGE,
ELEMENT_PIE,
ELEMENT_POLY,
ELEMENT_PRE,
ELEMENT_P,
ELEMENT_RECT,
ELEMENT_TEXT,
ELEMENT_TT,
ELEMENT_VAR
} element_t;
/*
* Font styles...
*/
typedef enum
{
STYLE_NORMAL,
STYLE_BOLD,
STYLE_ITALIC,
STYLE_BOLD_ITALIC
} style_t;
/*
* Text alignments...
*/
typedef enum
{
HALIGN_LEFT,
HALIGN_CENTER,
HALIGN_RIGHT
} halign_t;
typedef enum
{
VALIGN_BOTTOM,
VALIGN_CENTER,
VALIGN_TOP
} valign_t;
/*
* Text directions...
*/
typedef enun
{
DIR_LEFT_TO_RIGHT,
DIR_RIGHT_TO_LEFT
} dir_t;
/*
* Attribute structure...
*/
typedef struct
{
char *name, /* Name of attribute */
*value; /* Value of attribute */
} attr_t;
/*
* Form document tree structure...
*/
typedef struct tree_str
{
struct tree_str *prev, /* Previous tree node */
*next, /* Next tree node */
*parent, /* Parent tree node */
*child, /* First child node */
*last_child; /* Last child node */
element_t element; /* Element type */
float x, y, w, h; /* Position and size in points */
float bg[3], fg[3]; /* Colors of element */
float thickness; /* Thickness of lines */
int preformatted; /* Preformatted text? */
float size; /* Height of text in points */
char *typeface; /* Typeface of text */
style_t style; /* Style of text */
halign_t halign; /* Horizontal alignment */
valign_t valign; /* Vertical alignment */
dir_t dir; /* Direction of text */
int num_attrs; /* Number of attributes */
attr_t *attrs; /* Attributes */
void *data; /* Text fragment data */
} tree_t;
/*
* Globals...
*/
extern int NumOptions; /* Number of command-line options */
extern cups_option_t *Options; /* Command-line options */
extern ppd_file_t *PPD; /* PPD file */
/*
* Prototypes...
*/
extern void formDelete(tree_t *t);
extern char *formGetAttr(tree_t *t, const char *name);
extern tree_t *formNew(tree_t *p);
extern tree_t *formRead(FILE *fp, tree_t *p);
extern void formSetAttr(tree_t *t, const char *name, const char *value);
extern void formWrite(tree_t *p);
/*
* End of "$Id: form.h 6649 2007-07-11 21:46:42Z mike $".
*/
|