3636#include "exception.h"
3737#include "format.h"
3838#include "chart.h"
39+ #include "rich_string.h"
3940#include "help.h"
4041
4142#ifdef ENABLE_READER
@@ -95,6 +96,10 @@ typedef struct {
9596 lxw_chart_series * series ;
9697} xls_resource_chart_t ;
9798
99+ typedef struct {
100+ lxw_rich_string_tuple * tuple ;
101+ } xls_resource_rich_string_t ;
102+
98103typedef struct _vtiful_xls_object {
99104 xls_resource_read_t read_ptr ;
100105 xls_resource_write_t write_ptr ;
@@ -118,16 +123,22 @@ typedef struct _vtiful_validation_object {
118123 zend_object zo ;
119124} validation_object ;
120125
126+ typedef struct _vtiful_rich_string_object {
127+ xls_resource_rich_string_t ptr ;
128+ zend_object zo ;
129+ } rich_string_object ;
130+
121131#define REGISTER_CLASS_CONST_LONG (class_name , const_name , value ) \
122132 zend_declare_class_constant_long(class_name, const_name, sizeof(const_name)-1, (zend_long)value);
123133
124134#define REGISTER_CLASS_PROPERTY_NULL (class_name , property_name , acc ) \
125135 zend_declare_property_null(class_name, ZEND_STRL(property_name), acc);
126136
127- #define Z_XLS_P (zv ) php_vtiful_xls_fetch_object(Z_OBJ_P(zv));
128- #define Z_CHART_P (zv ) php_vtiful_chart_fetch_object(Z_OBJ_P(zv));
129- #define Z_FORMAT_P (zv ) php_vtiful_format_fetch_object(Z_OBJ_P(zv));
130- #define Z_VALIDATION_P (zv ) php_vtiful_validation_fetch_object(Z_OBJ_P(zv));
137+ #define Z_XLS_P (zv ) php_vtiful_xls_fetch_object(Z_OBJ_P(zv));
138+ #define Z_CHART_P (zv ) php_vtiful_chart_fetch_object(Z_OBJ_P(zv));
139+ #define Z_FORMAT_P (zv ) php_vtiful_format_fetch_object(Z_OBJ_P(zv));
140+ #define Z_VALIDATION_P (zv ) php_vtiful_validation_fetch_object(Z_OBJ_P(zv));
141+ #define Z_RICH_STR_P (zv ) php_vtiful_rich_string_fetch_object(Z_OBJ_P(zv));
131142
132143#define WORKBOOK_NOT_INITIALIZED (xls_object_t ) \
133144 do { \
@@ -254,6 +265,14 @@ static inline validation_object *php_vtiful_validation_fetch_object(zend_object
254265 return (validation_object * )((char * )(obj ) - XtOffsetOf (validation_object , zo ));
255266}
256267
268+ static inline rich_string_object * php_vtiful_rich_string_fetch_object (zend_object * obj ) {
269+ if (obj == NULL ) {
270+ return NULL ;
271+ }
272+
273+ return (rich_string_object * )((char * )(obj ) - XtOffsetOf (validation_object , zo ));
274+ }
275+
257276static inline void php_vtiful_close_resource (zend_object * obj ) {
258277 if (obj == NULL ) {
259278 return ;
@@ -287,10 +306,11 @@ static inline void php_vtiful_close_resource(zend_object *obj) {
287306 intern -> read_ptr .data_type_default = READ_TYPE_EMPTY ;
288307}
289308
290- lxw_format * zval_get_format (zval * handle );
291- lxw_data_validation * zval_get_validation (zval * resource );
292- xls_resource_write_t * zval_get_resource (zval * handle );
293- xls_resource_chart_t * zval_get_chart (zval * resource );
309+ lxw_format * zval_get_format (zval * handle );
310+ lxw_data_validation * zval_get_validation (zval * resource );
311+ lxw_rich_string_tuple * zval_get_rich_string (zval * resource );
312+ xls_resource_write_t * zval_get_resource (zval * handle );
313+ xls_resource_chart_t * zval_get_chart (zval * resource );
294314
295315STATIC lxw_error _store_defined_name (lxw_workbook * self , const char * name , const char * app_name , const char * formula , int16_t index , uint8_t hidden );
296316
@@ -327,6 +347,7 @@ void worksheet_set_rows(lxw_row_t start, lxw_row_t end, double height, xls_resou
327347void image_writer (zval * value , zend_long row , zend_long columns , double width , double height , xls_resource_write_t * res );
328348void formula_writer (zend_string * value , zend_long row , zend_long columns , xls_resource_write_t * res , lxw_format * format );
329349void type_writer (zval * value , zend_long row , zend_long columns , xls_resource_write_t * res , zend_string * format , lxw_format * format_handle );
350+ void rich_string_writer (zend_long row , zend_long columns , xls_resource_write_t * res , zval * rich_strings , lxw_format * format );
330351void datetime_writer (lxw_datetime * datetime , zend_long row , zend_long columns , zend_string * format , xls_resource_write_t * res , lxw_format * format_handle );
331352void url_writer (zend_long row , zend_long columns , xls_resource_write_t * res , zend_string * url , zend_string * text , zend_string * tool_tip , lxw_format * format );
332353
0 commit comments