Annotation of libwww/Library/src/HText.html, revision 2.22

2.6       timbl       1: <HTML>
                      2: <HEAD>
2.19      frystyk     3: <TITLE>Rich Hypertext object</TITLE>
2.21      frystyk     4: <!-- Changed by: Henrik Frystyk Nielsen,  1-Sep-1995 -->
2.9       luotonen    5: </HEAD>
2.5       timbl       6: <BODY>
2.13      frystyk     7: 
2.5       timbl       8: <H1>Rich HyperText Object</H1>
2.13      frystyk     9: 
2.1       timbl      10: <PRE>
2.13      frystyk    11: /*
2.16      frystyk    12: **     (c) COPYRIGHT MIT 1995.
2.13      frystyk    13: **     Please first read the full copyright statement in the file COPYRIGH.
                     14: */
                     15: </PRE>
                     16: 
                     17: This is the C interface to the Objective-C (or whatever)
                     18: Style-oriented HyperText class. It is used when a style-oriented text
                     19: object is available or craeted in order to display hypertext. <P>
                     20: 
2.15      frystyk    21: This module is a part of the <A
2.22    ! frystyk    22: HREF="http://www.w3.org/pub/WWW/Library/">
2.17      frystyk    23: W3C Reference Library</A>. However, it is <B>NOT</B> implemented
2.15      frystyk    24: anywhere in the library, as it is client (and often platform) specific
                     25: code. Hence these functions <EM>must</EM> be implemented in the
                     26: client. The <A
2.22    ! frystyk    27: HREF="http://www.w3.org/pub/WWW/LineMode/">Line Mode
2.15      frystyk    28: Browser</A> has the implementation in the <A
2.22    ! frystyk    29: HREF="http://www.w3.org/pub/WWW/LineMode/Implementation/GridText.html">
2.15      frystyk    30: GridText</A> module.
2.13      frystyk    31: 
                     32: <PRE>
                     33: #ifndef HTEXT_H
2.1       timbl      34: #define HTEXT_H
2.15      frystyk    35: 
2.1       timbl      36: #include "HTAnchor.h"
                     37: #include "HTStyle.h"
2.20      frystyk    38: #include "HTStruct.h"
2.1       timbl      39: 
                     40: #ifndef HyperText              /* Objective C version defined HyperText */
                     41: typedef struct _HText HText;   /* Normal Library */
2.9       luotonen   42: #else
                     43: @class HText;                  /* Objective C version for NeXTStep */
2.1       timbl      44: #endif
                     45: 
                     46: extern HText * HTMainText;             /* Pointer to current main text */
                     47: extern HTParentAnchor * HTMainAnchor;  /* Pointer to current text's anchor */
2.19      frystyk    48: </PRE>
2.1       timbl      49: 
2.6       timbl      50: <H2>Creation and deletion</H2>
2.7       timbl      51: 
2.19      frystyk    52: <A NAME="z0"><H3>Create hypertext object</H3></A>
                     53: 
                     54: There are several methods depending on how much you want to specify.
                     55: The output stream is used with objects which need to output the
                     56: hypertext to a stream.  The structure is for objects which need to
                     57: refer to the structure which is kep by the creating stream.
                     58: 
                     59: <PRE>
                     60: extern HText * HText_new       PARAMS((HTParentAnchor *anchor));
                     61: 
                     62: extern HText * HText_new2      PARAMS((HTParentAnchor *anchor,
                     63:                                        HTStream *      output_stream));
                     64: 
                     65: extern HText * HText_new3      PARAMS((HTRequest *     request,
                     66:                                        HTStream *      output_stream,
                     67:                                        HTStructured *  structure));
2.7       timbl      68: </PRE>
2.19      frystyk    69: 
2.7       timbl      70: <H3>Free hypertext object</H3>
2.1       timbl      71: 
2.19      frystyk    72: <PRE>
                     73: extern void    HText_free PARAMS((HText * me));
                     74: </PRE>
                     75: 
                     76: <H2>Object Building methods</H2>
                     77: 
                     78: These are used by a parser to build the text in an object
                     79: HText_beginAppend must be called, then any combination of other append
                     80: calls, then HText_endAppend.  This allows optimised handling using
                     81: buffers and caches which are flushed at the end.
2.1       timbl      82: 
2.19      frystyk    83: <PRE>
                     84: extern void HText_beginAppend PARAMS((HText * text));
2.1       timbl      85: 
                     86: extern void HText_endAppend PARAMS((HText * text));
2.19      frystyk    87: </PRE>
2.1       timbl      88: 
2.6       timbl      89: <H3>Set the style for future text</H3>
2.19      frystyk    90: 
2.6       timbl      91: <PRE>
2.1       timbl      92: extern void HText_setStyle PARAMS((HText * text, HTStyle * style));
                     93: 
2.6       timbl      94: </PRE>
                     95: <H3>Add one character</H3>
                     96: <PRE>extern void HText_appendCharacter PARAMS((HText * text, char ch));
2.1       timbl      97: 
2.6       timbl      98: </PRE>
                     99: <H3>Add a zero-terminated string</H3>
                    100: <PRE>
2.1       timbl     101: extern void HText_appendText PARAMS((HText * text, CONST char * str));
                    102: 
2.6       timbl     103: </PRE>
2.19      frystyk   104: 
                    105: <H3>New Paragraph</H3>
                    106: 
                    107: and similar things
                    108: 
                    109: <PRE>
                    110: extern void HText_appendParagraph PARAMS((HText * text));
2.6       timbl     111: 
                    112: extern void HText_appendLineBreak PARAMS((HText * text));
                    113: 
                    114: extern void HText_appendHorizontalRule PARAMS((HText * text));
2.19      frystyk   115: </PRE>
2.6       timbl     116: 
2.19      frystyk   117: <H3>Start/end sensitive text</H3>
2.1       timbl     118: 
2.19      frystyk   119: The anchor object is created and passed to HText_beginAnchor. The
                    120: senstive text is added to the text object, and then HText_endAnchor is
                    121: called. Anchors may not be nested.
2.1       timbl     122: 
2.6       timbl     123: <PRE>extern void HText_beginAnchor PARAMS((HText * text, HTChildAnchor * anc));
2.1       timbl     124: extern void HText_endAnchor PARAMS((HText * text));
                    125: 
                    126: 
2.6       timbl     127: </PRE>
2.12      timbl     128: <h3>Set the next free identifier</h3>
                    129: The string must be of the form aaannnnn where aaa is the prefix
                    130: for automatically generated ids, normally "z", and nnnn is the
                    131: next unused number.  If not present, defaults to z0.  An
                    132: editor should pick up both the a and n bits, and increment n
                    133: when generating ids. This ensures that old ids are not reused,
                    134: even if the elements using them have been deleted from the document.
                    135: <pre>
                    136: extern void HText_setNextId PARAMS((
                    137:        HText *         text,
                    138:        CONST char *    s));
                    139: 
                    140: </pre>
2.6       timbl     141: <H3>Append an inline image</H3>The image is handled by the creation
                    142: of an anchor whose destination is
                    143: the image document to be included.
                    144: The semantics is the intended inline
                    145: display of the image.<P>
                    146: An alternative implementation could
                    147: be, for example, to begin an anchor,
                    148: append the alternative text or "IMAGE",
                    149: then end the anchor. This would simply
                    150: generate some text linked to the
                    151: image itself as a separate document.
2.8       timbl     152: <H2></H2>
2.6       timbl     153: <PRE>extern void HText_appendImage PARAMS((
                    154:        HText *         text,
                    155:        HTChildAnchor * anc,
                    156:        CONST char *    alternative_text,
2.9       luotonen  157:        CONST char *    alignment,
2.6       timbl     158:        BOOL            isMap));
                    159: 
                    160: </PRE>
2.10      timbl     161: <H3>HText_appendObject:  Append an object
                    162: which does its own work</H3>The SGML parameters are passed untouched.
2.11      timbl     163: Currently this is only used for empty
                    164: elements.  Extensions could be (1)
                    165: to pass CDATA contents as well as
                    166: any attributes and (2) to pass the
                    167: whole structured stream until the
                    168: compound object has parsed itself.
2.10      timbl     169: <PRE>extern void HText_appendObject PARAMS((
                    170:        HText *                 text,
                    171:        int                     element_number,
2.11      timbl     172:        CONST BOOL *            present,
2.10      timbl     173:        CONST char * CONST *    value));
                    174: 
                    175: </PRE>
2.8       timbl     176: <H3>HText_unimplemented: Warn that object
                    177: is not completely rendered.</H3>If the parser realises that it has
                    178: incompletely parsed an object, then
                    179: it can call this to flag it to the
                    180: object.  This will for example prevent
                    181: editing or writing back.
                    182: <PRE>extern void HText_unimplemented PARAMS((
                    183:        HText *         text));
                    184: 
                    185: 
                    186: </PRE>
                    187: <H2>Utilities</H2>
2.6       timbl     188: <H3>Dump diagnostics to stderr</H3>
                    189: <PRE>
2.1       timbl     190: extern void HText_dump PARAMS((HText * me));   
                    191: 
2.6       timbl     192: </PRE>
                    193: <H3>Return the anchor associated with
                    194: this node</H3>
                    195: <PRE>extern HTParentAnchor * HText_nodeAnchor PARAMS((HText * me));
2.1       timbl     196: 
                    197: 
2.6       timbl     198: </PRE>
                    199: <H2>Browsing functions</H2>
                    200: <PRE>
2.1       timbl     201: 
2.6       timbl     202: </PRE>
                    203: <H3>Bring to front and highlight it</H3>
                    204: <PRE>
2.1       timbl     205: 
                    206: extern BOOL HText_select PARAMS((HText * text)); 
                    207: extern BOOL HText_selectAnchor PARAMS((HText * text, HTChildAnchor* anchor)); 
                    208: 
2.6       timbl     209: </PRE>
                    210: <H2>Editing functions</H2>These are called from the application.
                    211: There are many more functions not
                    212: included here from the orginal text
                    213: object. These functions NEED NOT
                    214: BE IMPLEMENTED in a browser which
                    215: cannot edit.
                    216: <PRE>/*        Style handling:
2.1       timbl     217: */
                    218: /*     Apply this style to the selection
                    219: */
                    220: extern void HText_applyStyle PARAMS((HText * me, HTStyle *style));
                    221: 
                    222: /*     Update all text with changed style.
                    223: */
                    224: extern void HText_updateStyle PARAMS((HText * me, HTStyle *style));
                    225: 
                    226: /*     Return style of  selection
                    227: */
                    228: extern HTStyle * HText_selectionStyle PARAMS((
                    229:        HText * me,
                    230:        HTStyleSheet* sheet));
                    231: 
                    232: /*     Paste in styled text
                    233: */
                    234: extern void HText_replaceSel PARAMS((HText * me,
                    235:        CONST char *aString, 
                    236:        HTStyle* aStyle));
                    237: 
                    238: /*     Apply this style to the selection and all similarly formatted text
                    239: **     (style recovery only)
                    240: */
                    241: extern void HTextApplyToSimilar PARAMS((HText * me, HTStyle *style));
                    242:  
                    243: /*     Select the first unstyled run.
                    244: **     (style recovery only)
                    245: */
                    246: extern void HTextSelectUnstyled PARAMS((HText * me, HTStyleSheet *sheet));
                    247: 
                    248: 
                    249: /*     Anchor handling:
                    250: */
                    251: extern void            HText_unlinkSelection PARAMS((HText * me));
                    252: extern HTAnchor *      HText_referenceSelected PARAMS((HText * me));
                    253: extern HTAnchor *      HText_linkSelTo PARAMS((HText * me, HTAnchor* anchor));
                    254: 
                    255: 
                    256: #endif /* HTEXT_H */
2.11      timbl     257: </PRE>end</A></BODY>
2.6       timbl     258: </HTML>

Webmaster