text-item: Use struct font_style instead of individual fields.
[pspp] / src / output / spv / spv-writer.c
index db8d03dfbffee47f320e29b6db962895b9a829db..a1069f963a191a28279169ba68bc5254eac0ae1c 100644 (file)
@@ -294,9 +294,6 @@ void
 spv_writer_put_text (struct spv_writer *w, const struct text_item *text,
                      const char *command_id)
 {
-  if (text->type == TEXT_ITEM_EJECT_PAGE)
-    w->need_page_break = true;
-
   bool initial_depth = w->heading_depth;
   if (!initial_depth)
     spv_writer_open_file (w);
@@ -325,6 +322,12 @@ spv_writer_put_text (struct spv_writer *w, const struct text_item *text,
   if (!initial_depth)
     spv_writer_close_file (w, "");
 }
+
+void
+spv_writer_eject_page (struct spv_writer *w)
+{
+  w->need_page_break = true;
+}
 \f
 #define H TABLE_HORZ
 #define V TABLE_VERT
@@ -711,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);
@@ -720,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
@@ -770,10 +775,10 @@ put_light_table (struct buf *buf, uint64_t table_id,
   put_bool (buf, table->rotate_outer_row_labels);
   put_bool (buf, true);
   put_u32 (buf, 0x15);
-  put_u32 (buf, table->sizing[H].range[0]);
-  put_u32 (buf, table->sizing[H].range[1]);
-  put_u32 (buf, table->sizing[V].range[0]);
-  put_u32 (buf, table->sizing[V].range[1]);
+  put_u32 (buf, table->look->width_ranges[H][0]);
+  put_u32 (buf, table->look->width_ranges[H][1]);
+  put_u32 (buf, table->look->width_ranges[V][0]);
+  put_u32 (buf, table->look->width_ranges[V][1]);
   put_u64 (buf, table_id);
 
   /* Titles. */
@@ -795,7 +800,7 @@ put_light_table (struct buf *buf, uint64_t table_id,
   /* Areas. */
   for (size_t i = 0; i < PIVOT_N_AREAS; i++)
     {
-      const struct table_area_style *a = &table->areas[i];
+      const struct table_area_style *a = &table->look->areas[i];
       put_byte (buf, i + 1);
       put_byte (buf, 0x31);
       put_string (buf, (a->font_style.typeface
@@ -838,7 +843,7 @@ put_light_table (struct buf *buf, uint64_t table_id,
   put_be32 (buf, PIVOT_N_BORDERS);
   for (size_t i = 0; i < PIVOT_N_BORDERS; i++)
     {
-      const struct table_border_style *b = &table->borders[i];
+      const struct table_border_style *b = &table->look->borders[i];
       put_be32 (buf, i);
       put_be32 (buf, (b->stroke == TABLE_STROKE_NONE ? 0
                       : b->stroke == TABLE_STROKE_SOLID ? 1
@@ -858,14 +863,14 @@ put_light_table (struct buf *buf, uint64_t table_id,
   /* Print Settings. */
   uint32_t ps_start = start_count (buf);
   put_be32 (buf, 1);
-  put_bool (buf, table->print_all_layers);
-  put_bool (buf, table->paginate_layers);
-  put_bool (buf, table->shrink_to_fit[H]);
-  put_bool (buf, table->shrink_to_fit[V]);
-  put_bool (buf, table->top_continuation);
-  put_bool (buf, table->bottom_continuation);
-  put_be32 (buf, table->n_orphan_lines);
-  put_bestring (buf, table->continuation);
+  put_bool (buf, table->look->print_all_layers);
+  put_bool (buf, table->look->paginate_layers);
+  put_bool (buf, table->look->shrink_to_fit[H]);
+  put_bool (buf, table->look->shrink_to_fit[V]);
+  put_bool (buf, table->look->top_continuation);
+  put_bool (buf, table->look->bottom_continuation);
+  put_be32 (buf, table->look->n_orphan_lines);
+  put_bestring (buf, table->look->continuation);
   end_count_u32 (buf, ps_start);
 
   /* Table Settings. */
@@ -873,10 +878,10 @@ put_light_table (struct buf *buf, uint64_t table_id,
   put_be32 (buf, 1);
   put_be32 (buf, 4);
   put_be32 (buf, 0);            /* XXX current_layer */
-  put_bool (buf, table->omit_empty);
-  put_bool (buf, table->row_labels_in_corner);
-  put_bool (buf, !table->show_numeric_markers);
-  put_bool (buf, table->footnote_marker_superscripts);
+  put_bool (buf, table->look->omit_empty);
+  put_bool (buf, table->look->row_labels_in_corner);
+  put_bool (buf, !table->look->show_numeric_markers);
+  put_bool (buf, table->look->footnote_marker_superscripts);
   put_byte (buf, 0);
   uint32_t keep_start = start_count (buf);
   put_be32 (buf, 0);            /* n-row-breaks */
@@ -887,7 +892,7 @@ put_light_table (struct buf *buf, uint64_t table_id,
   put_be32 (buf, 0);            /* n-column-point-keeps */
   end_count_be32 (buf, keep_start);
   put_bestring (buf, table->notes);
-  put_bestring (buf, table->table_look);
+  put_bestring (buf, table->look->name);
   for (size_t i = 0; i < 82; i++)
     put_byte (buf, 0);
   end_count_u32 (buf, ts_start);