output: Add support for layer info in table output.
[pspp] / src / output / table-item.h
index 15f5c568f37b15350363dc40a0fd29692575f2e1..ffdc4b682c204ce8dc2be9e729f6fb438cc2640b 100644 (file)
 /* Table items.
 
    A table item is a subclass of an output item (see output-item.h) that
-   contains a table (see table.h) and some formatting properties (currently
-   just a title). */
+   contains a table (see table.h) and some formatting properties.  Currently
+   the formatting properties are an optional title (a brief description
+   typically displayed above the table) and an optional caption (a more verbose
+   description typically displayed below the table). */
 
 #include "libpspp/compiler.h"
 #include "output/output-item.h"
 
+/* Title or caption in a table item. */
+struct table_item_text
+  {
+    char *content;
+    const struct footnote **footnotes;
+    size_t n_footnotes;
+    int halign;                 /* TAB_*. */
+    struct cell_style *style;
+  };
+
+struct table_item_text *table_item_text_create (const char *);
+struct table_item_text *table_item_text_clone (const struct table_item_text *);
+void table_item_text_destroy (struct table_item_text *);
+
 /* A table item.
 
    The members of struct table_item should not be accessed directly.  Use one
    of the accessor functions defined below. */
 struct table_item
   {
-    struct output_item output_item; /* Superclass. */
-    struct table *table;        /* The table to be rendered. */
-    char *title;                /* May be null if there is no title. */
+    struct output_item output_item;  /* Superclass. */
+    struct table *table;             /* The table to be rendered. */
+    struct table_item_text *title;   /* Null if there is no title. */
+    struct table_item_text *layers;  /* Null if there is no layer info. */
+    struct table_item_text *caption; /* Null if there is no caption. */
   };
 
-struct table_item *table_item_create (struct table *, const char *title);
+struct table_item *table_item_create (struct table *, const char *title,
+                                      const char *caption);
 
 const struct table *table_item_get_table (const struct table_item *);
 
-const char *table_item_get_title (const struct table_item *);
-void table_item_set_title (struct table_item *, const char *);
+const struct table_item_text *table_item_get_title (const struct table_item *);
+void table_item_set_title (struct table_item *,
+                           const struct table_item_text *);
+
+const struct table_item_text *table_item_get_layers (
+  const struct table_item *);
+void table_item_set_layers (struct table_item *,
+                           const struct table_item_text *);
+
+const struct table_item_text *table_item_get_caption (
+  const struct table_item *);
+void table_item_set_caption (struct table_item *,
+                             const struct table_item_text *);
 \f
 /* This boilerplate for table_item, a subclass of output_item, was
    autogenerated by mk-class-boilerplate. */