Graphviz  2.35.20130930.0449
htmltable.h
Go to the documentation of this file.
1 /* $Id$ $Revision$ */
2 /* vim:set shiftwidth=4 ts=8: */
3 
4 /*************************************************************************
5  * Copyright (c) 2011 AT&T Intellectual Property
6  * All rights reserved. This program and the accompanying materials
7  * are made available under the terms of the Eclipse Public License v1.0
8  * which accompanies this distribution, and is available at
9  * http://www.eclipse.org/legal/epl-v10.html
10  *
11  * Contributors: See CVS logs. Details at http://www.graphviz.org/
12  *************************************************************************/
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #ifndef TABLE_H
19 #define TABLE_H
20 
21 #define FIXED_FLAG 1
22 #define HALIGN_RIGHT (1 << 1)
23 #define HALIGN_LEFT (1 << 2)
24 #define HALIGN_MASK (HALIGN_RIGHT | HALIGN_LEFT)
25 #define HALIGN_TEXT HALIGN_MASK
26 #define VALIGN_TOP (1 << 3)
27 #define VALIGN_BOTTOM (1 << 4)
28 #define VALIGN_MASK (VALIGN_TOP | VALIGN_BOTTOM)
29 #define BORDER_SET (1 << 5)
30 #define PAD_SET (1 << 6)
31 #define SPACE_SET (1 << 7)
32 #define BALIGN_RIGHT (1 << 8)
33 #define BALIGN_LEFT (1 << 9)
34 #define BALIGN_MASK (BALIGN_RIGHT | BALIGN_LEFT)
35 
36 #define UNSET_ALIGN 0
37 
38  /* paras of text within a cell
39  * NOTE: As required, the str field in para is utf-8.
40  * This translation is done when libexpat scans the input.
41  */
42 
43  /* line of textpara_t's */
44  typedef struct {
46  short nitems;
47  char just;
48  double size; /* width of para */
49  double lfsize; /* offset from previous baseline to current one */
50  } htextpara_t;
51 
52  typedef struct {
54  short nparas;
55  char simple;
57  } htmltxt_t;
58 
59  typedef struct {
61  char *src;
62  char *scale;
63  } htmlimg_t;
64 
65  typedef struct {
66  char *href; /* pointer to an external resource */
67  char *port;
68  char *target;
69  char *title;
70  char *id;
71  char *bgcolor;
72  char *pencolor;
74  signed char space;
75  unsigned char border;
76  unsigned char pad;
77  unsigned char sides; /* set of sides exposed to field */
78  unsigned short flags;
79  unsigned short width;
80  unsigned short height;
81  unsigned short style;
82  boxf box; /* its geometric placement in points */
83  } htmldata_t;
84 
85 #define HTML_UNSET 0
86 #define HTML_TBL 1
87 #define HTML_TEXT 2
88 #define HTML_IMAGE 3
89 
90 #define HTML_VRULE 1
91 #define HTML_HRULE 2
92 
93  typedef struct htmlcell_t htmlcell_t;
94  typedef struct htmltbl_t htmltbl_t;
95 
96  struct htmltbl_t {
98  union {
99  struct {
100  htmlcell_t *parent; /* enclosing cell */
101  htmlcell_t **cells; /* cells */
102  } n;
103  struct {
104  htmltbl_t *prev; /* stack */
105  Dt_t *rows; /* cells */
106  } p;
107  } u;
108  signed char cb; /* cell border */
109  int *heights; /* heights of the rows */
110  int *widths; /* widths of the columns */
111  int rc; /* number of rows */
112  int cc; /* number of columns */
113  htmlfont_t *font; /* font info */
114  unsigned char flags;
115  };
116 
117  struct htmllabel_t {
118  union {
122  } u;
123  char kind;
124  };
125 
126  struct htmlcell_t {
128  unsigned short cspan;
129  unsigned short rspan;
130  unsigned short col;
131  unsigned short row;
134  unsigned char ruled;
135  };
136 
137 /* During parsing, table contents are stored as rows of cells.
138  * A row is a list of cells
139  * Rows is a list of rows.
140  * pitems are used for both lists.
141  */
142  typedef struct {
144  union {
147  } u;
148  unsigned char ruled;
149  } pitem;
150 
151  extern htmllabel_t *parseHTML(char *, int *, int);
152 
153  extern int make_html_label(void *obj, textlabel_t * lp);
154  extern void emit_html_label(GVJ_t * job, htmllabel_t * lp, textlabel_t *);
155 
156  extern void free_html_label(htmllabel_t *, int);
157  extern void free_html_data(htmldata_t *);
158  extern void free_html_text(htmltxt_t *);
159  extern void free_html_font(htmlfont_t*);
160 
161  extern boxf *html_port(node_t * n, char *pname, int* sides);
162  extern int html_path(node_t * n, port* p, int side, boxf * rv, int *k);
163  extern int html_inside(node_t * n, pointf p, edge_t * e);
164 
165 #endif
166 
167 #ifdef __cplusplus
168 }
169 #endif