1
/* HTStyle: Style management for libwww
2
STYLE DEFINITION FOR HYPERTEXT
4
Styles allow the translation between a logical property of a piece of text and its
5
physical representation.
7
A StyleSheet is a collection of styles, defining the translation necessary to represent
8
a document. It is a linked list of styles.
10
Overriding this module
12
Why is the style structure declared in the HTStyle.h module, instead of having the user
13
browser define the structure, and the HTStyle routines just use sizeof() for copying?
15
It's not obvious whether HTStyle.c should be common code. It's useful to have common
16
code for loading style sheets, especially if the movement toward standard style sheets
19
If it IS common code, then both the hypertext object and HTStyle.c must know the
20
structure of a style, so HTStyle.h is a suitable place to put that. HTStyle.c has to
21
be compiled with a knowledge of the
23
It we take it out of the library, then of course HTStyle could be declared as an
24
undefined structure. The only references to it are in the structure-flattening code
25
HTML.c and HTPlain.c, which only use HTStypeNamed().
27
You can in any case override this function in your own code, which will prevent the
28
HTStyle from being loaded. You will be able to redefine your style structure in this
29
case without problems, as no other moule needs to know it.
37
typedef long int HTFont; /* Dummy definition instead */
39
#ifdef NeXT_suppressed
40
#include <appkit/appkit.h>
41
typedef NXCoord HTCoord;
42
#define HTParagraphStyle NXTextStyle
43
#define HTCoord NXCoord
44
typedef struct _color {
50
typedef int HTCoord; /* changed from float to int - kw */
52
typedef struct _HTParagraphStyle {
53
HTCoord left_indent; /* @@@@ junk! etc etc*/
56
typedef int HTColor; /* Sorry about the US spelling! */
62
#define STYLE_NAME_LENGTH 80 /* @@@@@@@@@@@ */
65
short kind; /* only NX_LEFTTAB implemented*/
66
HTCoord position; /* x coordinate for stop */
70
/* The Style Structure
71
** -------------------
74
typedef struct _HTStyle {
76
/* Style management information
78
struct _HTStyle *next; /* Link for putting into stylesheet */
79
char * name; /* Style name */
80
int id; /* equivalent of name, for speed */
81
char * SGMLTag; /* Tag name to start */
84
/* Character attributes (a la NXRun)
86
HTFont font; /* Font id */
87
HTCoord fontSize; /* The size of font, not independent */
88
HTColor color; /* text gray of current run */
89
int superscript; /* superscript (-sub) in points */
91
HTAnchor *anchor; /* Anchor id if any, else zero */
93
/* Paragraph Attribtes (a la NXTextStyle)
95
HTCoord indent1st; /* how far first line in paragraph is
97
HTCoord leftIndent; /* how far second line is indented */
98
HTCoord rightIndent; /* (Missing from NeXT version */
99
short alignment; /* quad justification */
100
HTCoord lineHt; /* line height */
101
HTCoord descentLine; /* descender bottom from baseline */
102
CONST HTTabStop *tabs; /* array of tab stops, 0 terminated */
104
BOOL wordWrap; /* Yes means wrap at space not char */
105
BOOL freeFormat; /* Yes means \n is just white space */
106
HTCoord spaceBefore; /* Omissions from NXTextStyle */
108
int paraFlags; /* Paragraph flags, bits as follows: */
110
#define PARA_KEEP 1 /* Do not break page within this paragraph */
111
#define PARA_WITH_NEXT 2 /* Do not break page after this paragraph */
113
#define HT_JUSTIFY 0 /* For alignment */
120
#define HT_ALIGN_NONE (-1)
124
extern HTStyle * HTStyleNew NOPARAMS;
125
extern HTStyle * HTStyleNewNamed PARAMS ((CONST char * name));
126
extern HTStyle * HTStyleFree PARAMS((HTStyle * self));
128
extern HTStyle * HTStyleRead PARAMS((HTStyle * self, HTStream * stream));
129
extern HTStyle * HTStyleWrite PARAMS((HTStyle * self, HTStream * stream));
134
typedef struct _HTStyleSheet {
140
/* Stylesheet functions:
142
extern HTStyleSheet * HTStyleSheetNew NOPARAMS;
143
extern HTStyleSheet * HTStyleSheetFree PARAMS((HTStyleSheet * self));
144
extern HTStyle * HTStyleNamed PARAMS((HTStyleSheet * self, CONST char * name));
145
extern HTStyle * HTStyleForParagraph PARAMS((HTStyleSheet * self,
146
HTParagraphStyle * paraStyle));
147
extern HTStyle * HTStyleMatching PARAMS((HTStyleSheet *self, HTStyle * style));
148
/* extern HTStyle * HTStyleForRun PARAMS((HTStyleSheet *self, NXRun * run)); */
149
extern HTStyleSheet * HTStyleSheetAddStyle PARAMS((HTStyleSheet * self,
151
extern HTStyleSheet * HTStyleSheetRemoveStyle PARAMS((HTStyleSheet * self,
154
extern HTStyleSheet * HTStyleSheetRead PARAMS((HTStyleSheet * self,
156
extern HTStyleSheet * HTStyleSheetWrite PARAMS((HTStyleSheet * self,
159
#define CLEAR_POINTER ((void *)-1) /* Pointer value means "clear me" */
162
extern HTStyleSheet * DefaultStyle PARAMS((HTStyle*** result_array));
164
/* enum, use this instead of HTStyle name comparisons */
218
#endif /* HTStyle_H */