output: Support decimal and mixed alignment,
[pspp] / src / output / tab.h
index 3109e39439d165f0c94a4dd3e7cf8117d5f86b27..abd786119c13c5ab39ef8f97cf5cdd3a2056db33 100644 (file)
@@ -51,6 +51,30 @@ enum result_class
     n_RC
   };
 
+#define TAB_STYLE_MASK (7u << (TAB_FIRST_AVAILABLE + 1))
+#define TAB_STYLE_SHIFT (TAB_FIRST_AVAILABLE + 1)
+
+enum
+  {
+    /* Horizontal alignment of cell contents. */
+    TAB_RIGHT      = 0 << (TAB_FIRST_AVAILABLE + 2),
+    TAB_LEFT       = 1 << (TAB_FIRST_AVAILABLE + 2),
+    TAB_CENTER     = 2 << (TAB_FIRST_AVAILABLE + 2),
+    TAB_HALIGN     = 3 << (TAB_FIRST_AVAILABLE + 2), /* Alignment mask. */
+
+    /* Vertical alignment of cell contents. */
+    TAB_TOP        = 0 << (TAB_FIRST_AVAILABLE + 4),
+    TAB_MIDDLE     = 1 << (TAB_FIRST_AVAILABLE + 4),
+    TAB_BOTTOM     = 2 << (TAB_FIRST_AVAILABLE + 4),
+    TAB_VALIGN     = 3 << (TAB_FIRST_AVAILABLE + 4), /* Alignment mask. */
+  };
+
+/* Rule masks. */
+#define TAB_RULE_TYPE_MASK   7
+#define TAB_RULE_TYPE_SHIFT  0
+#define TAB_RULE_STYLE_MASK  (31 << TAB_RULE_STYLE_SHIFT)
+#define TAB_RULE_STYLE_SHIFT 3
+
 /* A table. */
 struct tab_table
   {
@@ -68,11 +92,13 @@ struct tab_table
        however, it is a joined cell and the corresponding element of cc[]
        points to a struct tab_joined_cell. */
     void **cc;                  /* Cell contents; void *[nr][nc]. */
-    unsigned char *ct;         /* Cell types; unsigned char[nr][nc]. */
+    unsigned short *ct;                /* Cell types; unsigned short[nr][nc]. */
+    struct area_style *styles[8];
 
     /* Rules. */
     unsigned char *rh;         /* Horiz rules; unsigned char[nr+1][nc]. */
     unsigned char *rv;         /* Vert rules; unsigned char[nr][nc+1]. */
+    struct cell_color *rule_colors[32];
 
     /* X and Y offsets. */
     int col_ofs, row_ofs;
@@ -125,11 +151,11 @@ void tab_set_format (struct tab_table *, enum result_class, const struct fmt_spe
 struct fmt_spec;
 struct dictionary;
 union value;
-void tab_value (struct tab_table *, int c, int r, unsigned char opt,
+void tab_value (struct tab_table *, int c, int r, unsigned short opt,
                const union value *, const struct variable *,
                const struct fmt_spec *);
 
-void tab_double (struct tab_table *, int c, int r, unsigned char opt,
+void tab_double (struct tab_table *, int c, int r, unsigned short opt,
                 double v, const struct fmt_spec *, enum result_class );
 
 void tab_text (struct tab_table *, int c, int r, unsigned opt, const char *);
@@ -143,8 +169,14 @@ void tab_joint_text_format (struct tab_table *, int x1, int y1, int x2, int y2,
                             unsigned opt, const char *, ...)
      PRINTF_FORMAT (7, 8);
 
-void tab_footnote (struct tab_table *, int x, int y, const char *format, ...)
-  PRINTF_FORMAT (4, 5);
+struct footnote *tab_create_footnote (struct tab_table *, size_t idx,
+                                      const char *content, const char *marker,
+                                      struct area_style *);
+void tab_add_footnote (struct tab_table *, int x, int y,
+                       const struct footnote *);
+
+void tab_add_style (struct tab_table *, int x, int y,
+                    const struct area_style *);
 
 bool tab_cell_is_empty (const struct tab_table *, int c, int r);