/misc/src/release/graphviz-2.18-1/src/graphviz-2.18/lib/common/htmltable.h

Go to the documentation of this file.
00001 /* $Id: htmltable.h,v 1.22 2007/11/02 22:15:52 erg Exp $ $Revision: 1.22 $ */
00002 /* vim:set shiftwidth=4 ts=8: */
00003 
00004 /**********************************************************
00005 *      This software is part of the graphviz package      *
00006 *                http://www.graphviz.org/                 *
00007 *                                                         *
00008 *            Copyright (c) 1994-2004 AT&T Corp.           *
00009 *                and is licensed under the                *
00010 *            Common Public License, Version 1.0           *
00011 *                      by AT&T Corp.                      *
00012 *                                                         *
00013 *        Information and Software Systems Research        *
00014 *              AT&T Research, Florham Park NJ             *
00015 **********************************************************/
00016 
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020 
00021 #ifndef TABLE_H
00022 #define TABLE_H
00023 
00024 #define FIXED_FLAG 1
00025 #define HALIGN_RIGHT (1 << 1)
00026 #define HALIGN_LEFT (1 << 2)
00027 #define HALIGN_MASK (HALIGN_RIGHT | HALIGN_LEFT)
00028 #define HALIGN_TEXT HALIGN_MASK
00029 #define VALIGN_TOP (1 << 3)
00030 #define VALIGN_BOTTOM (1 << 4)
00031 #define VALIGN_MASK (VALIGN_TOP | VALIGN_BOTTOM)
00032 #define BORDER_SET (1 << 5)
00033 #define PAD_SET (1 << 6)
00034 #define SPACE_SET (1 << 7)
00035 #define BALIGN_RIGHT (1 << 8)
00036 #define BALIGN_LEFT (1 << 9)
00037 #define BALIGN_MASK (BALIGN_RIGHT | BALIGN_LEFT)
00038 
00039 #define UNSET_ALIGN 0
00040 
00041     /* font information
00042      * If name or color is NULL, or size < 0, that attribute
00043      * is unspecified. 
00044      */
00045     typedef struct {
00046         char*  name;
00047         char*  color;
00048         double size;
00049         int    cnt;   /* reference count */
00050     } htmlfont_t;
00051 
00052     /* paras of text within a cell
00053      * NOTE: As required, the str field in para is utf-8.
00054      * This translation is done when libexpat scans the input.
00055      */
00056 #ifdef OLD
00057     typedef struct {
00058         textpara_t *para;
00059         short nparas;
00060         box box;
00061         htmlfont_t *font;       /* font info */
00062     } htmltxt_t;
00063 #endif
00064         
00065     typedef struct {
00066         char *str;
00067         char *xshow;
00068         PostscriptAlias *postscript_alias;
00069         void *layout;
00070         void (*free_layout) (void *layout);
00071         htmlfont_t *font;
00072         double size, yoffset_layout, yoffset_centerline;
00073     } textitem_t;
00074         
00075     typedef struct {
00076         textitem_t *items;
00077         short nitems;
00078         char just;
00079         double size;   /* width of para */
00080         double lfsize; /* offset from previous baseline to current one */
00081     } htextpara_t;
00082         
00083     typedef struct {
00084         htextpara_t *paras;
00085         short nparas;
00086         box box;
00087     } htmltxt_t;
00088 
00089     typedef struct {
00090         box box;
00091         char *src;
00092         char *scale;
00093     } htmlimg_t;
00094 
00095     typedef struct {
00096         char *href;             /* pointer to an external resource */
00097         char *port;
00098         char *target;
00099         char *title;
00100         char *bgcolor;
00101         char *pencolor;
00102         signed char space;
00103         unsigned char border;
00104         unsigned char pad;
00105         unsigned char sides;    /* set of sides exposed to field */
00106         unsigned short flags;
00107         unsigned short width;
00108         unsigned short height;
00109         box box;                /* its geometric placement in points */
00110     } htmldata_t;
00111 
00112 #define HTML_UNSET 0
00113 #define HTML_TBL 1
00114 #define HTML_TEXT 2
00115 #define HTML_IMAGE 3
00116 
00117     typedef struct htmlcell_t htmlcell_t;
00118     typedef struct htmltbl_t htmltbl_t;
00119         
00120     struct htmltbl_t {
00121         htmldata_t data;
00122         union {
00123             struct {
00124                 htmlcell_t *parent;     /* enclosing cell */
00125                 htmlcell_t **cells;     /* cells */
00126             } n;
00127             struct {
00128                 htmltbl_t *prev;        /* stack */
00129                 Dt_t *rows;     /* cells */
00130             } p;
00131         } u;
00132         signed char cb;         /* cell border */
00133         int *heights;           /* heights of the rows */
00134         int *widths;            /* widths of the columns */
00135         int rc;                 /* number of rows */
00136         int cc;                 /* number of columns */
00137         htmlfont_t *font;       /* font info */
00138     };
00139 
00140     struct htmllabel_t {
00141         union {
00142             htmltbl_t *tbl;
00143             htmltxt_t *txt;
00144             htmlimg_t *img;
00145         } u;
00146         char kind;
00147     };
00148 
00149     struct htmlcell_t {
00150         htmldata_t data;
00151         unsigned short cspan;
00152         unsigned short rspan;
00153         unsigned short col;
00154         unsigned short row;
00155         htmllabel_t child;
00156         htmltbl_t *parent;
00157     };
00158 
00159 /* During parsing, table contents are stored as rows of cells.
00160  * A row is a list of cells
00161  * Rows is a list of rows.
00162  * pitems are used for both lists.
00163  */
00164     typedef struct {
00165         Dtlink_t link;
00166         union {
00167             Dt_t *rp;
00168             htmlcell_t *cp;
00169         } u;
00170     } pitem;
00171         
00172     extern htmllabel_t *parseHTML(char *, int *, int);
00173 
00174     extern int make_html_label(graph_t *g, textlabel_t * lp, void *obj);
00175     extern void emit_html_label(GVJ_t * job, htmllabel_t * lp, textlabel_t *);
00176 
00177     extern void free_html_label(htmllabel_t *, int);
00178     extern void free_html_data(htmldata_t *);
00179     extern void free_html_text(htmltxt_t *);
00180     extern void free_html_font(htmlfont_t*);
00181 
00182     extern box *html_port(node_t * n, char *pname, int* sides);
00183     extern int html_path(node_t * n, port* p, int side, box * rv, int *k);
00184     extern int html_inside(node_t * n, pointf p, edge_t * e);
00185 
00186 #endif
00187 
00188 #ifdef __cplusplus
00189 }
00190 #endif

Generated on Mon Mar 31 19:03:24 2008 for Graphviz by  doxygen 1.5.1