Add support for reading and writing SPV files.
[pspp] / src / output / pivot-table.h
index 6104cb13133b04a0de008c9a99756e84e7e90d4a..f26378d703dde2b594e1755b2ff72df33b0d475c 100644 (file)
@@ -100,6 +100,7 @@ enum pivot_area
   };
 
 const char *pivot_area_to_string (enum pivot_area);
+void pivot_area_get_default_style (enum pivot_area, struct area_style *);
 
 /* Table borders for styling purposes. */
 enum pivot_border
@@ -138,6 +139,8 @@ enum pivot_border
   };
 
 const char *pivot_border_to_string (enum pivot_border);
+void pivot_border_get_default_style (enum pivot_border,
+                                     struct table_border_style *);
 
 /* Sizing for rows or columns of a rendered table.  The comments below talk
    about columns and their widths but they apply equally to rows and their
@@ -365,6 +368,11 @@ bool pivot_result_class_change (const char *, const struct fmt_spec *);
 /* A pivot table.  See the top of this file for more information. */
 struct pivot_table
   {
+    /* Reference count.  A pivot_table may be shared between multiple owners,
+       indicated by a reference count greater than 1.  When this is the case,
+       the output item must not be modified. */
+    int ref_cnt;
+
     /* Display settings. */
     bool rotate_inner_column_labels;
     bool rotate_outer_row_labels;
@@ -441,7 +449,10 @@ struct pivot_table *pivot_table_create (const char *title);
 struct pivot_table *pivot_table_create__ (struct pivot_value *title);
 struct pivot_table *pivot_table_create_for_text (struct pivot_value *title,
                                                  struct pivot_value *content);
-void pivot_table_destroy (struct pivot_table *);
+
+struct pivot_table *pivot_table_ref (const struct pivot_table *);
+void pivot_table_unref (struct pivot_table *);
+bool pivot_table_is_shared (const struct pivot_table *);
 
 /* Format of PIVOT_RC_COUNT cells. */
 void pivot_table_set_weight_var (struct pivot_table *,
@@ -633,7 +644,8 @@ struct pivot_value
         /* PIVOT_VALUE_TEMPLATE. */
         struct
           {
-            char *s;
+            char *local;              /* Localized. */
+            char *id;                 /* Identifier. */
             struct pivot_argument *args;
             size_t n_args;
           }
@@ -687,7 +699,8 @@ void pivot_value_destroy (struct pivot_value *);
 
 /* Styling. */
 void pivot_value_get_style (struct pivot_value *,
-                            const struct area_style *default_style,
+                            const struct font_style *base_font_style,
+                            const struct cell_style *base_cell_style,
                             struct area_style *);
 void pivot_value_set_style (struct pivot_value *, const struct area_style *);
 
@@ -699,5 +712,13 @@ struct pivot_argument
   };
 
 void pivot_argument_uninit (struct pivot_argument *);
+\f
+/* One piece of data within a pivot table. */
+struct pivot_cell
+  {
+    struct hmap_node hmap_node; /* In struct pivot_table's 'cells' hmap. */
+    struct pivot_value *value;
+    unsigned int idx[];         /* One index per table dimension. */
+  };
 
 #endif /* output/pivot-table.h */