2015-12-23 01:03:41 +00:00
|
|
|
/*
|
|
|
|
* libxlsxwriter
|
|
|
|
*
|
2024-02-26 18:47:32 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2025-02-11 00:03:36 +00:00
|
|
|
* Copyright 2014-2025, John McNamara, jmcnamara@cpan.org.
|
2015-12-23 01:03:41 +00:00
|
|
|
*
|
|
|
|
* drawing - A libxlsxwriter library for creating Excel XLSX drawing files.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#ifndef __LXW_DRAWING_H__
|
|
|
|
#define __LXW_DRAWING_H__
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2019-10-11 21:20:18 +01:00
|
|
|
#include <string.h>
|
2015-12-23 01:03:41 +00:00
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
2015-12-24 07:55:20 +00:00
|
|
|
STAILQ_HEAD(lxw_drawing_objects, lxw_drawing_object);
|
|
|
|
|
|
|
|
enum lxw_drawing_types {
|
|
|
|
LXW_DRAWING_NONE = 0,
|
|
|
|
LXW_DRAWING_IMAGE,
|
|
|
|
LXW_DRAWING_CHART,
|
|
|
|
LXW_DRAWING_SHAPE
|
|
|
|
};
|
|
|
|
|
2015-12-31 08:28:23 +00:00
|
|
|
enum image_types {
|
|
|
|
LXW_IMAGE_UNKNOWN = 0,
|
|
|
|
LXW_IMAGE_PNG,
|
|
|
|
LXW_IMAGE_JPEG,
|
2021-05-08 00:25:14 +01:00
|
|
|
LXW_IMAGE_BMP,
|
|
|
|
LXW_IMAGE_GIF
|
2015-12-31 08:28:23 +00:00
|
|
|
};
|
|
|
|
|
2015-12-24 07:55:20 +00:00
|
|
|
/* Coordinates used in a drawing object. */
|
|
|
|
typedef struct lxw_drawing_coords {
|
|
|
|
uint32_t col;
|
|
|
|
uint32_t row;
|
2016-01-01 20:50:01 +00:00
|
|
|
double col_offset;
|
|
|
|
double row_offset;
|
2015-12-24 07:55:20 +00:00
|
|
|
} lxw_drawing_coords;
|
|
|
|
|
|
|
|
/* Object to represent the properties of a drawing. */
|
|
|
|
typedef struct lxw_drawing_object {
|
2020-01-14 21:03:01 +00:00
|
|
|
uint8_t type;
|
|
|
|
uint8_t anchor;
|
2015-12-24 07:55:20 +00:00
|
|
|
struct lxw_drawing_coords from;
|
|
|
|
struct lxw_drawing_coords to;
|
2023-08-12 01:39:40 +01:00
|
|
|
uint64_t col_absolute;
|
|
|
|
uint64_t row_absolute;
|
2015-12-24 07:55:20 +00:00
|
|
|
uint32_t width;
|
|
|
|
uint32_t height;
|
|
|
|
uint8_t shape;
|
2019-12-14 23:54:52 +00:00
|
|
|
uint32_t rel_index;
|
|
|
|
uint32_t url_rel_index;
|
2015-12-24 07:55:20 +00:00
|
|
|
char *description;
|
|
|
|
char *tip;
|
2021-03-28 21:02:40 +01:00
|
|
|
uint8_t decorative;
|
2015-12-24 07:55:20 +00:00
|
|
|
|
|
|
|
STAILQ_ENTRY (lxw_drawing_object) list_pointers;
|
|
|
|
|
|
|
|
} lxw_drawing_object;
|
|
|
|
|
2015-12-23 01:03:41 +00:00
|
|
|
/*
|
2015-12-24 07:55:20 +00:00
|
|
|
* Struct to represent a collection of drawings.
|
2015-12-23 01:03:41 +00:00
|
|
|
*/
|
|
|
|
typedef struct lxw_drawing {
|
|
|
|
|
|
|
|
FILE *file;
|
|
|
|
|
2015-12-24 07:55:20 +00:00
|
|
|
uint8_t embedded;
|
2018-09-08 23:36:09 +01:00
|
|
|
uint8_t orientation;
|
2015-12-24 07:55:20 +00:00
|
|
|
|
|
|
|
struct lxw_drawing_objects *drawing_objects;
|
|
|
|
|
2015-12-23 01:03:41 +00:00
|
|
|
} lxw_drawing;
|
|
|
|
|
|
|
|
|
|
|
|
/* *INDENT-OFF* */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
/* *INDENT-ON* */
|
|
|
|
|
2019-01-30 09:00:00 -05:00
|
|
|
lxw_drawing *lxw_drawing_new(void);
|
2016-01-04 23:26:52 +00:00
|
|
|
void lxw_drawing_free(lxw_drawing *drawing);
|
|
|
|
void lxw_drawing_assemble_xml_file(lxw_drawing *self);
|
|
|
|
void lxw_free_drawing_object(struct lxw_drawing_object *drawing_object);
|
|
|
|
void lxw_add_drawing_object(lxw_drawing *drawing,
|
|
|
|
lxw_drawing_object *drawing_object);
|
2015-12-23 01:03:41 +00:00
|
|
|
|
|
|
|
/* Declarations required for unit testing. */
|
|
|
|
#ifdef TESTING
|
|
|
|
|
|
|
|
STATIC void _drawing_xml_declaration(lxw_drawing *self);
|
|
|
|
#endif /* TESTING */
|
|
|
|
|
|
|
|
/* *INDENT-OFF* */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
/* *INDENT-ON* */
|
|
|
|
|
|
|
|
#endif /* __LXW_DRAWING_H__ */
|