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