#ifndef PPTHTML_H
#define PPTHTML_H
#include 
#include 
#undef	MAX
#define MAX(a, b)  (((a) > (b)) ? (a) : (b))
#define TRUE 1
#define FALSE 0
#define TYPE_STRING     0x1e	  /*  30, VT_LPSTR */
#define SUMMARY_ID(x) ((x) & 0xff)                               
typedef uint32_t OlePos;
typedef int32_t  OleSPos;
typedef struct _List  List;
typedef void* pointer;
typedef const void *gconstpointer;
typedef int gboolean;
/* definitions for vector array */
typedef vector ole_vector;
/** The initial size of a ole_vector. */
#define OLE_VECTOR_SIZE 10
/** The growth factor of a ole_vector. */
#define OLE_VECTOR_FACTOR 2
#define resize_ole_vector(v, size) \
  vector_resize(v, size, sizeof(OleSummarySection))
#define create_ole_vector(v) \
  vector_create(v, OLE_VECTOR_SIZE, sizeof(OleSummarySection))
#define destroy_ole_vector(v) \
  vector_destroy(v)
#define append_ole(v, token) \
  vector_append(v, token, 0, OLE_VECTOR_FACTOR)
#define insert_ole(v, token, pos) \
  vector_insert(v, token, pos, 0, OLE_VECTOR_FACTOR)
#define insert_ole_space(v, pos, n) \
  vector_insert_space(v, OleSummarySection, pos, n, 0, OLE_VECTOR_FACTOR)
#define ole_at(v, index) \
  element_at(v, index, OleSummarySection)
#define ole_delete(v, pos) \
  vector_delete(v, OleSummarySection, pos)
/* definitions for vector array */
typedef vector item_vector;
/** The initial size of a item_vector. */
#define ITEM_VECTOR_SIZE 10
/** The growth factor of a item_vector. */
#define ITEM_VECTOR_FACTOR 2
#define resize_item_vector(v, size) \
  vector_resize(v, size, sizeof(item_t))
#define create_item_vector(v) \
  vector_create(v, ITEM_VECTOR_SIZE, sizeof(item_t))
#define destroy_item_vector(v) \
  vector_destroy(v)
#define append_item(v, token) \
  vector_append(v, token, 0, ITEM_VECTOR_FACTOR)
#define insert_item(v, token, pos) \
  vector_insert(v, token, pos, 0, ITEM_VECTOR_FACTOR)
#define insert_item_space(v, pos, n) \
  vector_insert_space(v, item_t, pos, n, 0, ITEM_VECTOR_FACTOR)
#define item_at(v, index) \
  element_at(v, index, item_t)
#define item_delete(v, pos) \
  vector_delete(v, item_t, pos)
/* memory allocation functions */
#define allocate_mem(type, count)	  \
      ((type *) malloc((unsigned) sizeof (type) * (count)))
#define GET_UINT16(p) (uint16_t)(*((const uint8_t *)(p)+0) |        \
					(*((const uint8_t *)(p)+1)<<8))
#define GET_UINT32(p) (uint32_t)(*((const uint8_t *)(p)+0) |        \
					(*((const uint8_t *)(p)+1)<<8) |   \
					(*((const uint8_t *)(p)+2)<<16) |  \
					(*((const uint8_t *)(p)+3)<<24))
const uint32_t	sum_fmtid[4] =  {
				 0xF29F85E0,
		           	 0x10684FF9,
		           	 0x000891AB,
		           	 0xD9B3272B
				};
/*
 * Property Set IDs
 * The SummaryInformation stream contains the SummaryInformation property set.
 * The DocumentSummaryInformation stream contains both the
 * DocumentSummaryInformation and the UserDefined property sets as sections.
 */
typedef enum {
	OLE_PS_SUMMARY_INFO,
	OLE_PS_DOCUMENT_SUMMARY_INFO,
	OLE_PS_USER_DEFINED_SUMMARY_INFO
} PropertySetID;						 
typedef enum {
	OLE_ERR_OK,
	OLE_ERR_EXIST,
	OLE_ERR_INVALID,
	OLE_ERR_FORMAT,
	OLE_ERR_PERM,
	OLE_ERR_MEM,
	OLE_ERR_SPACE,
	OLE_ERR_NOTEMPTY,
	OLE_ERR_BADARG
}OleErr;
/* SummaryInformation Stream Properties */
/* String properties */
typedef enum {
	OLE_SUMMARY_TITLE          = 0x1002,
	OLE_SUMMARY_SUBJECT        = 0x1003,
	OLE_SUMMARY_AUTHOR         = 0x1004,
	OLE_SUMMARY_KEYWORDS       = 0x1005,
	OLE_SUMMARY_COMMENTS       = 0x1006
} OleSummaryPID;
struct _List
{
  pointer data;
  List *next;
  List *prev;
};
typedef struct {
  uint8_t          	class_id[16];
  ole_vector *		sections;
  item_vector *		items;
  List *		write_items;
  gboolean		read_mode;
  COLEFILE              *s;
  PropertySetID	ps_id;
} OleSummary;
typedef struct {
  uint32_t	offset;
  uint32_t	props;
  uint32_t	bytes;
  PropertySetID	ps_id;
} OleSummarySection;
typedef struct {
	uint32_t       offset;
	uint32_t       id;
	PropertySetID  ps_id;
} item_t;
#endif