Annotation of libwww/Library/src/HTStyle.html, revision 2.28

2.6       timbl       1: <HTML>
                      2: <HEAD>
2.27      frystyk     3: <TITLE>W3C Sample Code Library libwww STYLE MANAGER</TITLE>
2.26      frystyk     4: <!-- Changed by: Henrik Frystyk Nielsen, 23-Mar-1996 -->
2.12      frystyk     5: </HEAD>
2.6       timbl       6: <BODY>
2.11      frystyk     7: 
2.12      frystyk     8: <H1>Style Definition for Hypertext</H1>
                      9: 
                     10: <PRE>
                     11: /*
2.17      frystyk    12: **     (c) COPYRIGHT MIT 1995.
2.12      frystyk    13: **     Please first read the full copyright statement in the file COPYRIGH.
                     14: */
                     15: </PRE>
                     16: 
                     17: Styles allow the translation between a logical property of a piece of
                     18: text and its physical representation. A StyleSheet is a collection of
                     19: styles, defining the translation necessary to represent a document. It
                     20: is a linked list of styles.
2.11      frystyk    21: 
                     22: <H2>Overriding this module</H2>
                     23: 
                     24: Why is the style structure declared in the HTStyle.h module, instead
                     25: of having the user browser define the structure, and the HTStyle
                     26: routines just use sizeof() for copying?<P>
                     27: 
                     28: It's not obvious whether HTStyle.c should be common code.  It's useful
                     29: to have common code for loading style sheets, especially if the
                     30: movement toward standard style sheets gets going.<P>
                     31: 
                     32: If it <B>is</B> common code, then both the hypertext object and
                     33: HTStyle.c must know the structure of a style, so HTStyle.h is a
                     34: suitable place to put that.<P>
                     35: 
                     36: If we take it out of the library, then of course HTStyle could be
                     37: declared as an undefined structure. The only references to it are in
                     38: the structure-flattening code HTML.c and HTPlain.c, which only use
                     39: HTStypeNamed().<P>
                     40: 
                     41: You can in any case override this function in your own code, which
                     42: will prevent the HTStyle from being loaded.  You will be able to
                     43: redefine your style structure in this case without problems, as no
2.12      frystyk    44: other moule needs to know it. <P>
                     45: 
                     46: This module is implemented by <A HREF="HTStyle.c">HTStyle.c</A>, and
                     47: it is a part of the <A
2.28    ! frystyk    48: HREF="http://www.w3.org/Library/">
2.27      frystyk    49: W3C Sample Code Library</A>.
2.11      frystyk    50: 
2.10      timbl      51: <PRE>
                     52: #ifndef HTStyle_H
2.1       timbl      53: #define HTStyle_H
                     54: 
2.8       luotonen   55: #include "HTFormat.h"
2.1       timbl      56: #include "HTAnchor.h"
2.10      timbl      57: #include "HTML.h"
2.1       timbl      58: 
                     59: typedef long int HTFont;       /* Dummy definition instead */
                     60: 
2.9       timbl      61: #ifdef DEFINE_STRUCT_HTSTYLE
2.1       timbl      62: #ifdef NeXT_suppressed
                     63: typedef NXCoord HTCoord;
                     64: #define HTParagraphStyle NXTextStyle
                     65: #define HTCoord NXCoord
                     66: typedef struct _color {
2.15      frystyk    67:        double  grey;
2.1       timbl      68:        int     RGBColor;
                     69: } HTColor;
                     70: #else
                     71: 
2.15      frystyk    72: typedef double HTCoord;
2.1       timbl      73: 
                     74: typedef struct _HTParagraphStyle {
                     75:     HTCoord    left_indent;            /* @@@@ junk! etc etc*/
                     76: } HTParagraphStyle;
                     77: 
                     78: typedef int HTColor;           /* Sorry about the US spelling! */
                     79: 
                     80: #endif
                     81: 
                     82: typedef struct {
                     83:     short              kind;           /* only NX_LEFTTAB implemented*/
                     84:     HTCoord            position;       /* x coordinate for stop */
                     85: } HTTabStop;
                     86: 
2.9       timbl      87: #else
                     88: typedef struct _HTParagraphStyle HTParagraphStyle;
                     89: #endif
                     90: 
                     91: 
                     92: 
                     93: #define STYLE_NAME_LENGTH      80      /* @@@@@@@@@@@ */
                     94:         
2.1       timbl      95: 
                     96: /*     The Style Structure
                     97: **     -------------------
                     98: */
                     99: 
2.22      frystyk   100: typedef struct _HTStyle HTStyle;
2.26      frystyk   101: </PRE>
2.1       timbl     102: 
2.10      timbl     103: <h2>Style Creation</h2>
2.26      frystyk   104: 
2.10      timbl     105: <h3>HtStyleModify</h3>
2.26      frystyk   106: 
2.10      timbl     107: This routine is passed the style for a particular SGML nesting state,
                    108: and the element number of a new element whithin that state.
                    109: The routine returns a suitable style for text within the new element.
                    110: It is passed a popinter tothe nesting state so that it can link
                    111: the style back to the nesting state for later manipulation
                    112: of the SGML nesting tree.
2.26      frystyk   113: <PRE>
2.10      timbl     114: 
2.23      frystyk   115: extern HTStyle * HTStyleModify (
2.10      timbl     116:                HTStyle *       style, 
                    117:                HTNesting*      nesting,
2.23      frystyk   118:                 int            element_number);
2.10      timbl     119: 
                    120: 
2.1       timbl     121: 
                    122: /*     Style functions:
                    123: */
2.23      frystyk   124: extern HTStyle * HTStyleNew (void);
2.24      frystyk   125: extern HTStyle* HTStyleNewNamed (const char * name);
2.23      frystyk   126: extern HTStyle * HTStyleFree (HTStyle * self);
2.1       timbl     127: #ifdef SUPRESS
2.23      frystyk   128: extern HTStyle * HTStyleRead (HTStyle * self, HTStream * stream);
                    129: extern HTStyle * HTStyleWrite (HTStyle * self, HTStream * stream);
2.1       timbl     130: #endif
                    131: /*             Style Sheet
                    132: **             -----------
                    133: */
                    134: typedef struct _HTStyleSheet {
                    135:        char *          name;
                    136:        HTStyle *       styles;
                    137: } HTStyleSheet;
                    138: 
                    139: 
                    140: /*     Stylesheet functions:
                    141: */
2.23      frystyk   142: extern HTStyleSheet * HTStyleSheetNew (void);
                    143: extern HTStyleSheet * HTStyleSheetFree (HTStyleSheet * self);
2.24      frystyk   144: extern HTStyle * HTStyleNamed (HTStyleSheet * self, const char * name);
2.23      frystyk   145: extern HTStyle * HTStyleMatching (HTStyleSheet *self, HTStyle * style);
                    146: /* extern HTStyle * HTStyleForRun (HTStyleSheet *self, NXRun * run); */
                    147: extern HTStyleSheet * HTStyleSheetAddStyle (HTStyleSheet * self,
                    148:        HTStyle * style);
                    149: extern HTStyleSheet * HTStyleSheetRemoveStyle (HTStyleSheet * self,
                    150:        HTStyle * style);
2.1       timbl     151: #ifdef SUPPRESS
2.23      frystyk   152: extern HTStyleSheet * HTStyleSheetRead (HTStyleSheet * self,
                    153:                                                HTStream * stream);
                    154: extern HTStyleSheet * HTStyleSheetWrite (HTStyleSheet * self,
                    155:                                                HTStream * stream);
2.1       timbl     156: #endif
                    157: #define CLEAR_POINTER ((void *)-1)     /* Pointer value means "clear me" */
                    158: #endif /* HTStyle_H */
2.26      frystyk   159: </PRE>
2.6       timbl     160: 
2.26      frystyk   161: <HR>
                    162: <ADDRESS>
2.28    ! frystyk   163: @(#) $Id: HTStyle.html,v 2.27 1997/02/16 18:43:02 frystyk Exp $
2.26      frystyk   164: </ADDRESS>
2.7       timbl     165: </BODY>
2.6       timbl     166: </HTML>

Webmaster