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