Sync-to-go: update copyright for 2015
[s-roff.git] / src / dev-html / html-table.h
blob0d4b0c0661e6e65549dfb581449c04d38155ffd3
1 /*@ Provides the methods necessary to handle indentation and tab
2 *@ positions using html tables.
4 * Copyright (c) 2014 - 2015 Steffen (Daode) Nurpmeso <sdaoden@users.sf.net>.
6 * Copyright (C) 2002 - 2005, 2007 Free Software Foundation, Inc.
7 * Written by Gaius Mulley (gaius@glam.ac.uk)
8 */
9 /*
10 * This is free software; you can redistribute it and/or modify it under
11 * the terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 2, or (at your option) any later
13 * version.
15 * This is distributed in the hope that it will be useful, but WITHOUT ANY
16 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with groff; see the file COPYING. If not, write to the Free Software
22 * Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
24 #ifndef _HTML_TABLE_H
25 #define _HTML_TABLE_H
27 #include "html.h"
29 typedef struct tab_position {
30 char alignment;
31 int position;
32 struct tab_position *next;
33 } tab_position;
35 class tabs
37 void delete_list (void);
38 tab_position *tab;
40 public:
41 tabs ();
42 ~tabs ();
43 void clear (void);
44 int compatible (const char *s);
45 void init (const char *s);
46 void check_init (const char *s);
47 int find_tab (int pos);
48 int get_tab_pos (int n);
49 char get_tab_align (int n);
50 void dump_tabs (void);
54 * define a column
57 typedef struct cols {
58 int left, right;
59 int no;
60 char alignment;
61 struct cols *next;
62 } cols;
64 class html_table
66 cols *columns; /* column entries */
67 int linelength;
68 cols *last_col; /* last column started */
69 int start_space; /* have we seen a `.sp' tag? */
71 void remove_cols (cols *c);
73 public:
74 html_table (simple_output *op, int linelen);
75 ~html_table (void);
76 int add_column (int coln, int hstart, int hend, char align);
77 cols *get_column (int coln);
78 int insert_column (int coln, int hstart, int hend, char align);
79 int modify_column (cols *c, int hstart, int hend, char align);
80 int find_tab_column (int pos);
81 int find_column (int pos);
82 int get_tab_pos (int n);
83 char get_tab_align (int n);
84 void set_linelength (int linelen);
85 int no_columns (void);
86 int no_gaps (void);
87 int is_gap (cols *c);
88 void dump_table (void);
89 void emit_table_header (int space);
90 void emit_col (int n);
91 void emit_new_row (void);
92 void emit_finish_table (void);
93 int get_right (cols *c);
94 void add_indent (int indent);
95 void finish_row (void);
96 int get_effective_linelength (void);
97 void set_space (int space);
98 void emit_colspan (void);
99 void emit_td (int percentage, const char *s = ">");
101 tabs *tab_stops; /* tab stop positions */
102 simple_output *out;
106 * the indentation wrapper.
107 * Builds an indentation from a html-table.
108 * This table is only emitted if the paragraph is emitted.
111 class html_indent
113 void end (void);
114 int is_used;
115 int pg; // values of the registers as passed via initialization
116 int ll;
117 int in;
118 html_table *table;
120 public:
121 html_indent (simple_output *op, int ind, int pageoffset, int linelength);
122 ~html_indent (void);
123 void begin (int space); // called if we need to use the indent
124 void get_reg (int *ind, int *pageoffset, int *linelength);
126 // the indent is shutdown when it is deleted
129 #endif // _HTML_TABLE_H
130 // s-it2-mode