Add support for PNG images in .spv files.
[pspp] / src / output / spv / spv.h
index 91321adc67485b778eb02f1293e3381b86d4171b..fdcd9f9f8daf804d172e9a14e1d4ad33f6aa7905 100644 (file)
 #include <stdbool.h>
 #include <stddef.h>
 #include <stdint.h>
+
+#ifdef HAVE_CAIRO
+#include <cairo.h>
+#endif
+
 #include "libpspp/compiler.h"
 
 struct fmt_spec;
@@ -68,7 +73,7 @@ enum spv_item_type
     SPV_ITEM_TABLE,
     SPV_ITEM_GRAPH,
     SPV_ITEM_MODEL,
-    SPV_ITEM_OBJECT,
+    SPV_ITEM_IMAGE,
     SPV_ITEM_TREE,
   };
 
@@ -116,8 +121,8 @@ struct spv_item
     char *structure_member;
 
     enum spv_item_type type;
-    char *label;
-    char *command_id;           /* Unique command identifier. */
+    char *label;                /* Localized label. */
+    char *command_id;           /* Non-localized unique command identifier. */
 
     /* Whether the item is visible.
        For SPV_ITEM_HEADING, false indicates that the item is collapsed.
@@ -130,7 +135,7 @@ struct spv_item
 
     /* SPV_ITEM_TABLE only. */
     struct pivot_table *table;    /* NULL if not yet loaded. */
-    struct spv_legacy_properties *legacy_properties;
+    struct pivot_table_look *table_look;
     char *bin_member;
     char *xml_member;
     char *subtype;
@@ -138,9 +143,11 @@ struct spv_item
     /* SPV_ITEM_TEXT only.  */
     struct pivot_value *text;
 
-    /* SPV_ITEM_OBJECT only. */
-    char *object_type;
-    char *uri;
+    /* SPV_ITEM_IMAGE only. */
+    char *png_member;
+#ifdef HAVE_CAIRO
+    cairo_surface_t *image;
+#endif
   };
 
 void spv_item_format_path (const struct spv_item *, struct string *);
@@ -157,11 +164,16 @@ size_t spv_item_get_n_children (const struct spv_item *);
 struct spv_item *spv_item_get_child (const struct spv_item *, size_t idx);
 
 bool spv_item_is_table (const struct spv_item *);
-struct pivot_table *spv_item_get_table (const struct spv_item *);
+const struct pivot_table *spv_item_get_table (const struct spv_item *);
 
 bool spv_item_is_text (const struct spv_item *);
 const struct pivot_value *spv_item_get_text (const struct spv_item *);
 
+bool spv_item_is_image (const struct spv_item *);
+#ifdef HAVE_CAIRO
+cairo_surface_t *spv_item_get_image (const struct spv_item *);
+#endif
+
 bool spv_item_is_visible (const struct spv_item *);
 
 #define SPV_ITEM_FOR_EACH(ITER, ROOT) \
@@ -173,7 +185,6 @@ struct spv_item *spv_item_next (const struct spv_item *);
 const struct spv_item *spv_item_get_parent (const struct spv_item *);
 size_t spv_item_get_level (const struct spv_item *);
 
-const char *spv_item_get_member_name (const struct spv_item *);
 const char *spv_item_get_command_id (const struct spv_item *);
 const char *spv_item_get_subtype (const struct spv_item *);
 
@@ -197,6 +208,9 @@ char *spv_item_get_legacy_data (const struct spv_item *, struct spv_data *)
 char *spv_item_get_legacy_table (const struct spv_item *, struct _xmlDoc **)
   WARN_UNUSED_RESULT;
 
+void spv_item_set_table_look (struct spv_item *,
+                              const struct pivot_table_look *);
+
 char *spv_decode_fmt_spec (uint32_t u32, struct fmt_spec *) WARN_UNUSED_RESULT;
 
 #endif /* output/spv/spv.h */