styles.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * libxlsxwriter
  3. *
  4. * Copyright 2014-2018, John McNamara, [email protected]. See LICENSE.txt.
  5. *
  6. * styles - A libxlsxwriter library for creating Excel XLSX styles files.
  7. *
  8. */
  9. #ifndef __LXW_STYLES_H__
  10. #define __LXW_STYLES_H__
  11. #include <stdint.h>
  12. #include "format.h"
  13. /*
  14. * Struct to represent a styles.
  15. */
  16. typedef struct lxw_styles {
  17. FILE *file;
  18. uint32_t font_count;
  19. uint32_t xf_count;
  20. uint32_t dxf_count;
  21. uint32_t num_format_count;
  22. uint32_t border_count;
  23. uint32_t fill_count;
  24. struct lxw_formats *xf_formats;
  25. struct lxw_formats *dxf_formats;
  26. } lxw_styles;
  27. /* *INDENT-OFF* */
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /* *INDENT-ON* */
  32. lxw_styles *lxw_styles_new();
  33. void lxw_styles_free(lxw_styles *styles);
  34. void lxw_styles_assemble_xml_file(lxw_styles *self);
  35. /* Declarations required for unit testing. */
  36. #ifdef TESTING
  37. STATIC void _styles_xml_declaration(lxw_styles *self);
  38. STATIC void _write_style_sheet(lxw_styles *self);
  39. STATIC void _write_font_size(lxw_styles *self, double font_size);
  40. STATIC void _write_font_color_theme(lxw_styles *self, uint8_t theme);
  41. STATIC void _write_font_name(lxw_styles *self, const char *font_name);
  42. STATIC void _write_font_family(lxw_styles *self, uint8_t font_family);
  43. STATIC void _write_font_scheme(lxw_styles *self, const char *font_scheme);
  44. STATIC void _write_font(lxw_styles *self, lxw_format *format);
  45. STATIC void _write_fonts(lxw_styles *self);
  46. STATIC void _write_default_fill(lxw_styles *self, const char *pattern);
  47. STATIC void _write_fills(lxw_styles *self);
  48. STATIC void _write_border(lxw_styles *self, lxw_format *format);
  49. STATIC void _write_borders(lxw_styles *self);
  50. STATIC void _write_style_xf(lxw_styles *self);
  51. STATIC void _write_cell_style_xfs(lxw_styles *self);
  52. STATIC void _write_xf(lxw_styles *self, lxw_format *format);
  53. STATIC void _write_cell_xfs(lxw_styles *self);
  54. STATIC void _write_cell_style(lxw_styles *self);
  55. STATIC void _write_cell_styles(lxw_styles *self);
  56. STATIC void _write_dxfs(lxw_styles *self);
  57. STATIC void _write_table_styles(lxw_styles *self);
  58. #endif /* TESTING */
  59. /* *INDENT-OFF* */
  60. #ifdef __cplusplus
  61. }
  62. #endif
  63. /* *INDENT-ON* */
  64. #endif /* __LXW_STYLES_H__ */