content_types.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * libxlsxwriter
  3. *
  4. * Copyright 2014-2018, John McNamara, [email protected]. See LICENSE.txt.
  5. *
  6. * content_types - A libxlsxwriter library for creating Excel XLSX
  7. * content_types files.
  8. *
  9. */
  10. #ifndef __LXW_CONTENT_TYPES_H__
  11. #define __LXW_CONTENT_TYPES_H__
  12. #include <stdint.h>
  13. #include <string.h>
  14. #include "common.h"
  15. #define LXW_APP_PACKAGE "application/vnd.openxmlformats-package."
  16. #define LXW_APP_DOCUMENT "application/vnd.openxmlformats-officedocument."
  17. /*
  18. * Struct to represent a content_types.
  19. */
  20. typedef struct lxw_content_types {
  21. FILE *file;
  22. struct lxw_tuples *default_types;
  23. struct lxw_tuples *overrides;
  24. } lxw_content_types;
  25. /* *INDENT-OFF* */
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. /* *INDENT-ON* */
  30. lxw_content_types *lxw_content_types_new();
  31. void lxw_content_types_free(lxw_content_types *content_types);
  32. void lxw_content_types_assemble_xml_file(lxw_content_types *content_types);
  33. void lxw_ct_add_default(lxw_content_types *content_types, const char *key,
  34. const char *value);
  35. void lxw_ct_add_override(lxw_content_types *content_types, const char *key,
  36. const char *value);
  37. void lxw_ct_add_worksheet_name(lxw_content_types *content_types,
  38. const char *name);
  39. void lxw_ct_add_chart_name(lxw_content_types *content_types,
  40. const char *name);
  41. void lxw_ct_add_drawing_name(lxw_content_types *content_types,
  42. const char *name);
  43. void lxw_ct_add_shared_strings(lxw_content_types *content_types);
  44. void lxw_ct_add_calc_chain(lxw_content_types *content_types);
  45. void lxw_ct_add_custom_properties(lxw_content_types *content_types);
  46. /* Declarations required for unit testing. */
  47. #ifdef TESTING
  48. STATIC void _content_types_xml_declaration(lxw_content_types *self);
  49. STATIC void _write_default(lxw_content_types *self, const char *ext,
  50. const char *type);
  51. STATIC void _write_override(lxw_content_types *self, const char *part_name,
  52. const char *type);
  53. #endif /* TESTING */
  54. /* *INDENT-OFF* */
  55. #ifdef __cplusplus
  56. }
  57. #endif
  58. /* *INDENT-ON* */
  59. #endif /* __LXW_CONTENT_TYPES_H__ */