1818#endif
1919
2020#include <php.h>
21+ #include "ext/date/php_date.h"
2122
2223#include "zend_smart_str.h"
2324#include "zend_exceptions.h"
3132
3233#include "php_xlswriter.h"
3334#include "excel.h"
35+ #include "validation.h"
3436#include "exception.h"
3537#include "format.h"
3638#include "chart.h"
@@ -84,6 +86,10 @@ typedef struct {
8486 lxw_format * format ;
8587} xls_resource_format_t ;
8688
89+ typedef struct {
90+ lxw_data_validation * validation ;
91+ } xls_resource_validation_t ;
92+
8793typedef struct {
8894 lxw_chart * chart ;
8995 lxw_chart_series * series ;
@@ -107,6 +113,11 @@ typedef struct _vtiful_chart_object {
107113 zend_object zo ;
108114} chart_object ;
109115
116+ typedef struct _vtiful_validation_object {
117+ xls_resource_validation_t ptr ;
118+ zend_object zo ;
119+ } validation_object ;
120+
110121static inline xls_object * php_vtiful_xls_fetch_object (zend_object * obj ) {
111122 return (xls_object * )((char * )(obj ) - XtOffsetOf (xls_object , zo ));
112123}
@@ -119,15 +130,20 @@ static inline chart_object *php_vtiful_chart_fetch_object(zend_object *obj) {
119130 return (chart_object * )((char * )(obj ) - XtOffsetOf (chart_object , zo ));
120131}
121132
133+ static inline validation_object * php_vtiful_validation_fetch_object (zend_object * obj ) {
134+ return (validation_object * )((char * )(obj ) - XtOffsetOf (validation_object , zo ));
135+ }
136+
122137#define REGISTER_CLASS_CONST_LONG (class_name , const_name , value ) \
123138 zend_declare_class_constant_long(class_name, const_name, sizeof(const_name)-1, (zend_long)value);
124139
125140#define REGISTER_CLASS_PROPERTY_NULL (class_name , property_name , acc ) \
126141 zend_declare_property_null(class_name, ZEND_STRL(property_name), acc);
127142
128- #define Z_XLS_P (zv ) php_vtiful_xls_fetch_object(Z_OBJ_P(zv));
129- #define Z_CHART_P (zv ) php_vtiful_chart_fetch_object(Z_OBJ_P(zv));
130- #define Z_FORMAT_P (zv ) php_vtiful_format_fetch_object(Z_OBJ_P(zv));
143+ #define Z_XLS_P (zv ) php_vtiful_xls_fetch_object(Z_OBJ_P(zv));
144+ #define Z_CHART_P (zv ) php_vtiful_chart_fetch_object(Z_OBJ_P(zv));
145+ #define Z_FORMAT_P (zv ) php_vtiful_format_fetch_object(Z_OBJ_P(zv));
146+ #define Z_VALIDATION_P (zv ) php_vtiful_validation_fetch_object(Z_OBJ_P(zv));
131147
132148#define WORKBOOK_NOT_INITIALIZED (xls_object_t ) \
133149 do { \
@@ -209,6 +225,7 @@ static inline chart_object *php_vtiful_chart_fetch_object(zend_object *obj) {
209225
210226
211227lxw_format * zval_get_format (zval * handle );
228+ lxw_data_validation * zval_get_validation (zval * resource );
212229xls_resource_write_t * zval_get_resource (zval * handle );
213230xls_resource_chart_t * zval_get_chart (zval * resource );
214231
@@ -235,6 +252,7 @@ void printed_direction(xls_resource_write_t *res, unsigned int direction);
235252void xls_file_path (zend_string * file_name , zval * dir_path , zval * file_path );
236253void freeze_panes (xls_resource_write_t * res , zend_long row , zend_long column );
237254void set_row (zend_string * range , double height , xls_resource_write_t * res , lxw_format * format );
255+ void validation (xls_resource_write_t * res , zend_string * range , lxw_data_validation * validation );
238256void set_column (zend_string * range , double width , xls_resource_write_t * res , lxw_format * format );
239257void merge_cells (zend_string * range , zval * value , xls_resource_write_t * res , lxw_format * format );
240258void comment_writer (zend_string * comment , zend_long row , zend_long columns , xls_resource_write_t * res );
@@ -249,6 +267,7 @@ void url_writer(zend_long row, zend_long columns, xls_resource_write_t *res, zen
249267
250268lxw_error workbook_file (xls_resource_write_t * self );
251269
270+ lxw_datetime timestamp_to_datetime (zend_long timestamp );
252271zend_string * str_pick_up (zend_string * left , const char * right , size_t len );
253272
254273#endif
0 commit comments