From 4cc9925e87a7efc1e5a9e0b452549d2bce0cb847 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 30 Dec 2020 14:54:30 -0800 Subject: [PATCH] spv-file-format: Document "show-title" option. --- doc/dev/spv-file-format.texi | 8 ++++++-- src/output/pivot-output.c | 2 +- src/output/pivot-table.c | 1 + src/output/pivot-table.h | 1 + src/output/spv/light-binary.grammar | 4 +++- src/output/spv/spv-light-decoder.c | 2 ++ src/output/spv/spv-writer.c | 6 ++++-- 7 files changed, 18 insertions(+), 6 deletions(-) diff --git a/doc/dev/spv-file-format.texi b/doc/dev/spv-file-format.texi index 9f78e042a6..0e3eb19e88 100644 --- a/doc/dev/spv-file-format.texi +++ b/doc/dev/spv-file-format.texi @@ -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}. diff --git a/src/output/pivot-output.c b/src/output/pivot-output.c index deb71fa354..44a044b8b0 100644 --- a/src/output/pivot-output.c +++ b/src/output/pivot-output.c @@ -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, diff --git a/src/output/pivot-table.c b/src/output/pivot-table.c index d3f2c4d041..adebd84ffa 100644 --- a/src/output/pivot-table.c +++ b/src/output/pivot-table.c @@ -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; diff --git a/src/output/pivot-table.h b/src/output/pivot-table.h index 2770c611d6..6769b600ba 100644 --- a/src/output/pivot-table.h +++ b/src/output/pivot-table.h @@ -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; diff --git a/src/output/spv/light-binary.grammar b/src/output/spv/light-binary.grammar index cf6e6c5fc3..05ba2a2d90 100644 --- a/src/output/spv/light-binary.grammar +++ b/src/output/spv/light-binary.grammar @@ -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] diff --git a/src/output/spv/spv-light-decoder.c b/src/output/spv/spv-light-decoder.c index 93ca8a29e4..0d059c7036 100644 --- a/src/output/spv/spv-light-decoder.c +++ b/src/output/spv/spv-light-decoder.c @@ -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. */ diff --git a/src/output/spv/spv-writer.c b/src/output/spv/spv-writer.c index f1aa798dc0..a1069f963a 100644 --- a/src/output/spv/spv-writer.c +++ b/src/output/spv/spv-writer.c @@ -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 -- 2.30.2