1 /* Style Definition for Hypertext HTStyle.h
2 ** ==============================
4 ** Styles allow the translation between a logical property of a piece of
5 ** text and its physical representation.
7 ** A StyleSheet is a collection of styles, defining the
8 ** translation necessary to represent a document.
9 ** It is a linked list of styles.
19 #define HTStyleNew HTStNew
20 #define HTStyleFree HTStFree
21 #define HTStyleRead HTStRead
22 #define HTStyleWrite HTStWrite
23 #define HTStyleSheetNew HTStShNe
24 #define HTStyleSheetFree HTStShFr
25 #define HTStyleNamed HTStName
26 #define HTStyleForParagraph HTStFoPa
27 #define HTStyleMatching HTStMatc
28 #define HTStyleForRun HTStFoRu
29 #define HTStyleSheetAddStyle HTStShAd
30 #define HTStyleSheetRemoveStyle HTStShRm
31 #define HTStyleSheetRead HTStShRe
32 #define HTStyleSheetWrite HTStShWr
35 #ifdef NeXT_suppressed
36 #include <appkit/appkit.h>
37 typedef NXCoord HTCoord;
38 #define HTParagraphStyle NXTextStyle
39 #define HTCoord NXCoord
40 typedef struct _color {
46 typedef float HTCoord;
48 typedef struct _HTParagraphStyle {
49 HTCoord left_indent; /* @@@@ junk! etc etc*/
52 typedef int HTColor; /* Sorry about the US spelling! */
58 #define STYLE_NAME_LENGTH 80 /* @@@@@@@@@@@ */
61 short kind; /* only NX_LEFTTAB implemented*/
62 HTCoord position; /* x coordinate for stop */
66 /* The Style Structure
67 ** -------------------
70 typedef struct _HTStyle {
72 /* Style management information
74 struct _HTStyle *next; /* Link for putting into stylesheet */
75 char * name; /* Style name */
76 char * SGMLTag; /* Tag name to start */
79 /* Character attributes (a la NXRun)
81 HTFont font; /* Font id */
82 HTCoord fontSize; /* The size of font, not independent */
83 HTColor color; /* text gray of current run */
84 int superscript; /* superscript (-sub) in points */
86 HTAnchor *anchor; /* Anchor id if any, else zero */
88 /* Paragraph Attribtes (a la NXTextStyle)
90 HTCoord indent1st; /* how far first line in paragraph is
92 HTCoord leftIndent; /* how far second line is indented */
93 HTCoord rightIndent; /* (Missing from NeXT version */
94 short alignment; /* quad justification */
95 HTCoord lineHt; /* line height */
96 HTCoord descentLine; /* descender bottom from baseline */
97 HTTabStop *tabs; /* array of tab stops, 0 terminated */
99 BOOL wordWrap; /* Yes means wrap at space not char */
100 BOOL freeFormat; /* Yes means \n is just white space */
101 HTCoord spaceBefore; /* Omissions from NXTextStyle */
103 int paraFlags; /* Paragraph flags, bits as follows: */
105 #define PARA_KEEP 1 /* Do not break page within this paragraph */
106 #define PARA_WITH_NEXT 2 /* Do not break page after this paragraph */
108 #define HT_JUSTIFY 0 /* For alignment */
118 extern HTStyle * HTStyleNew NOPARAMS;
119 extern HTStyle* HTStyleNewNamed PARAMS ((CONST char * name));
120 extern HTStyle * HTStyleFree PARAMS((HTStyle * self));
122 extern HTStyle * HTStyleRead PARAMS((HTStyle * self, HTStream * stream));
123 extern HTStyle * HTStyleWrite PARAMS((HTStyle * self, HTStream * stream));
128 typedef struct _HTStyleSheet {
134 /* Stylesheet functions:
136 extern HTStyleSheet * HTStyleSheetNew NOPARAMS;
137 extern HTStyleSheet * HTStyleSheetFree PARAMS((HTStyleSheet * self));
138 extern HTStyle * HTStyleNamed PARAMS((HTStyleSheet * self, CONST char * name));
139 extern HTStyle * HTStyleForParagraph PARAMS((HTStyleSheet * self,
140 HTParagraphStyle * paraStyle));
141 extern HTStyle * HTStyleMatching PARAMS((HTStyleSheet *self, HTStyle * style));
142 /* extern HTStyle * HTStyleForRun PARAMS((HTStyleSheet *self, NXRun * run)); */
143 extern HTStyleSheet * HTStyleSheetAddStyle PARAMS((HTStyleSheet * self,
145 extern HTStyleSheet * HTStyleSheetRemoveStyle PARAMS((HTStyleSheet * self,
148 extern HTStyleSheet * HTStyleSheetRead PARAMS((HTStyleSheet * self,
150 extern HTStyleSheet * HTStyleSheetWrite PARAMS((HTStyleSheet * self,
153 #define CLEAR_POINTER ((void *)-1) /* Pointer value means "clear me" */
154 #endif /* HTStyle_H */