spv-file-format: Document "show-title" option.
authorBen Pfaff <blp@cs.stanford.edu>
Wed, 30 Dec 2020 22:54:30 +0000 (14:54 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 31 Dec 2020 00:20:39 +0000 (16:20 -0800)
doc/dev/spv-file-format.texi
src/output/pivot-output.c
src/output/pivot-table.c
src/output/pivot-table.h
src/output/spv/light-binary.grammar
src/output/spv/spv-light-decoder.c
src/output/spv/spv-writer.c

index 9f78e042a62043578607afe4e2baeb63f4c15499..0e3eb19e88658cf396c726c41c6633a6ca2ddd55 100644 (file)
@@ -1396,7 +1396,9 @@ X1 only appears in version 3 members.
 
 @example
 X1 =>
-    bool byte[x15] bool[x16]
+    bool
+    byte[show-title]
+    bool[x16]
     byte[lang]
     byte[show-variables]
     byte[show-values]
@@ -1423,9 +1425,11 @@ means to display the value, 2 to display the value label when
 available, 3 to display both.  Again, the most common value is 0,
 which probably means to use a global default.
 
+@code{show-title} is 1 to show the caption, 10 to hide it.
+
 @code{show-caption} is true to show the caption, false to hide it.
 
-A writer may safely use false for @code{x14}, 1 for @code{x15}, false
+A writer may safely use false for @code{x14}, false
 for @code{x16}, -1 for @code{x18} and @code{x19}, and false for
 @code{x20}.
 
index deb71fa3546d2ff67bd6fe8054cf7a2b653fbf5f..44a044b8b0ff3bbc67b321d222aa3d04065f911d 100644 (file)
@@ -457,7 +457,7 @@ pivot_table_submit_layer (const struct pivot_table *pt,
 
   struct table_item *ti = table_item_create (table, NULL, NULL, pt->notes);
 
-  if (pt->title)
+  if (pt->title && pt->show_title)
     {
       struct table_item_text *title = pivot_value_to_table_item_text (
         pt->title, &pt->look->areas[PIVOT_AREA_TITLE], footnotes,
index d3f2c4d041de494d2f01305c5c122a599a769864..adebd84ffab723d04245cc2bfeab8c352a0c50e3 100644 (file)
@@ -838,6 +838,7 @@ pivot_table_create__ (struct pivot_value *title, const char *subtype)
 {
   struct pivot_table *table = xzalloc (sizeof *table);
   table->ref_cnt = 1;
+  table->show_title = true;
   table->show_caption = true;
   table->weight_format = (struct fmt_spec) { FMT_F, 40, 0 };
   table->title = title;
index 2770c611d61b3ff27a083e089ea7eb1487b86133..6769b600baada8de089d63c82e7b1b2424f50945 100644 (file)
@@ -430,6 +430,7 @@ struct pivot_table
     bool rotate_inner_column_labels;
     bool rotate_outer_row_labels;
     bool show_grid_lines;
+    bool show_title;
     bool show_caption;
     size_t *current_layer; /* axis[PIVOT_AXIS_LAYER].n_dimensions elements. */
     enum settings_value_show show_values;
index cf6e6c5fc30a877a318553e4884f0e2253b16a51..05ba2a2d9055aa99f764edc10f6d2154cdc1bf2f 100644 (file)
@@ -126,7 +126,9 @@ Y1 =>
 Y2 => CustomCurrency byte[missing] bool[x17]
 
 X1 =>
-   bool[x14] byte[x15] bool[x16]
+   bool[x14]
+   byte[show-title]
+   bool[x16]
    byte[lang]
    byte[show-variables]
    byte[show-values]
index 93ca8a29e43e759d86fce97ec61a1e88b4aab377..0d059c703616e86b38e0ac926a0004c873787d28 100644 (file)
@@ -846,6 +846,7 @@ decode_spvlb_table (const struct spvlb_table *in, struct pivot_table **outp)
   out->rotate_outer_row_labels = in->header->rotate_outer_row_labels;
   out->look->row_labels_in_corner = in->ts->show_row_labels_in_corner;
   out->show_grid_lines = in->borders->show_grid_lines;
+  out->show_title = true;
   out->show_caption = true;
   out->look->footnote_marker_superscripts = in->ts->footnote_marker_superscripts;
   out->look->omit_empty = in->ts->omit_empty;
@@ -861,6 +862,7 @@ decode_spvlb_table (const struct spvlb_table *in, struct pivot_table **outp)
         goto error;
 
       out->show_caption = x1->show_caption;
+      out->show_title = x1->show_title != 10;
     }
 
   /* Column and row display settings. */
index f1aa798dc0dbfb34f193bfa510a2460fb8096439..a1069f963a191a28279169ba68bc5254eac0ae1c 100644 (file)
@@ -714,7 +714,9 @@ put_custom_currency (struct buf *buf, const struct pivot_table *table)
 static void
 put_x1 (struct buf *buf, const struct pivot_table *table)
 {
-  put_bytes (buf, "\0\1\0", 3);
+  put_byte (buf, 0);
+  put_byte (buf, table->show_title ? 1 : 10);
+  put_byte (buf, 0);
   put_byte (buf, 0);
   put_show_values (buf, table->show_variables);
   put_show_values (buf, table->show_values);
@@ -723,7 +725,7 @@ put_x1 (struct buf *buf, const struct pivot_table *table)
   for (int i = 0; i < 17; i++)
     put_byte (buf, 0);
   put_bool (buf, false);
-  put_byte (buf, 1);
+  put_byte (buf, table->show_caption);
 }
 
 static void