#ifndef HRSH
#define HRSH

/******************************************************************************
               HRS Constants
*******************************************************************************/
#if defined (_WIN32)
   #if !defined(WIN32)
     #define WIN32
   #endif
#endif

#define XLATE_HTML_TO_RTF  1
#define XLATE_RTF_TO_HTML  2

// flags
#define HRFLAG_RETURN_MSG_ID 0x1
#define HRFLAG_SEGMENT_ONLY  0x2
#define HRFLAG_EMBED_PICTURE 0x4
#define HRFLAG_NO_PICT_PATH  0x8
#define HRFLAG_LIST_TO_TEXT  0x10
#define HRFLAG_NO_LINK_IN_RTF 0x20     // ignore links when converting from html to rtf
#define HRFLAG_WORDPAD_COMPATIBLE_PICT 0x40     // create WordPad compatible pictures in the rtf output
#define HRFLAG_NO_SPAN_TAG    0x80     // do not write the span tags
#define HRFLAG_NO_FONT        0x100    // do not write the font tag
#define HRFLAG_FLASH_SUPPORT  0x200    // html output for flash support
#define HRFLAG_XLATE_SINGLE_QUOTE 0x400  // translate single quote to &#39;
#define HRFLAG_SAVE_PICT_AS_BMP   0x800  // save picture as bmp in html output
#define HRFLAG_PNG_RGB           0x1000  // save png in rgb (high quality)
#define HRFLAG_ENABLE_GDIPLUS    0x2000  // enable gdi_plus when ssgp file is also available
#define HRFLAG_WRITE_HTML_BULLET_CHAR 0x4000    // replace char 183 by &bull; in html output
#define HRFLAG_SKIP_DELETED_TEXT      0x8000    // don't write to html the text deleted using track-changes
#define HRFLAG_IN_SERVER             0x10000    // when hosted in a server
#define HRFLAG_NO_CRLF               0x20000    //  dont't output cr/lf in html
#define HRFLAG_NO_FIXED_TABLE_LAYOUT 0x40000    // do not write the table-layout:fixed tag  **not used in demo.c
#define HRFLAG_NO_INTERNET           0x100000    // do not access internet urls  **not used in demo.c
#define HRFLAG_FIELD_TO_TEXT_BOX     0x200000    // convert text input field to text-box during html output
#define HRFLAG_NO_FLOATING_OBJECTS   0x400000    // 20110717: don't allow floating objects
#define HRFLAG_IN_DESKTOP            0x800000    // 20231208: being called from a desktop application - single theraded application
#define HRFLAG_DONT_WRITE_IMAGE_BORDER 0x1000000  // don't write border attribute for the <img> tag since IE produces looses the picture when creating rtf copy clipboard copy from IE when using the generated html
#define HRFLAG_TEXT_INPUT              0x2000000  // Assume the input file/string to be in the text format
#define HRFLAG_TEXT_OUTPUT             0x4000000  // convert to the text format
#define HRFLAG_EMBED_HTML_PICTURE      0x8000000  // embed picture data in html
#define HRFLAG_USE_FIRST_FONT         0x10000000  // use the first font in a font-family specification
#define HRFLAG_OUTLOOK_SUPPORT        0x20000000  // 20180429: support for outlook for very old IE
#define HRFLAG_UTEXT_OUTPUT           0x40000000  // convert to the unicode text format, 20220317
#define HRFLAG_UTF8_HTML_INPUT        0x80000000  // 20231207: default html input UTF-8


#define HF_FIRST_HDR         0
#define HF_FIRST_FTR         1
#define HF_HDR               2
#define HF_FTR               3

#define HFTYPE_TEXT          0
#define HFTYPE_RTF           1
#define HFTYPE_HTML          2

// Error messages
#define MSG_FILE_NOT_FOUND     1
#define MSG_NO_EDITOR_INSTANCE 2
#define MSG_READ_ERROR         3
#define MSG_WRITE_ERROR        4
#define MSG_MEMORY_LOCK        5
#define MSG_NO_FILE_SIGNATURE  6
#define MSG_BAD_RTF_FILE       7
#define MSG_BAD_HTML_FILE      8
#define MSG_EXPIRED            9
#define MSG_LICENSE_EXCEEDED   15
#define MSG_BAD_LICENSE_NUMBER 16
#define MSG_BAD_LICENSE_KEY    17
#define MSG_INVALID_SERVER_LICENSE 18
#define MSG_LICENSE_EXPIRED    19

#define MSG_OTHER             99

/******************************************************************************
    WIN32 specific defines
*******************************************************************************/
#if defined (WIN32)
   #define HRS_HUGE
   #define _export
#else
   #define HRS_HUGE huge
#endif


/****************************************************************************
   Instructions for packing the following structure
*****************************************************************************/
#ifndef RC_INVOKED
   #pragma pack(1)
#endif

/****************************************************************************
   Instructions to resume the default structure packing.
*****************************************************************************/
#ifndef RC_INVOKED
   #pragma pack()
#endif


/******************************************************************************
                     Editor Function Prototype
   When calling HRS from a C program, leave the HRS_CPLUSPLUS symbol undefined.

   When calling HRS from a C++ program, define the HRS_CPLUSPLUS as following:

   #define HRS_CPLUSPLUS extern "C"
   #include "ter.h"
*******************************************************************************/
#ifndef HRS_CPLUSPLUS
   #if defined(__cplusplus)
      #define HRS_CPLUSPLUS extern "C"
   #else
      #define HRS_CPLUSPLUS
   #endif
#endif

HRS_CPLUSPLUS DWORD_PTR   WINAPI _export HrsNewSession();
HRS_CPLUSPLUS BOOL    WINAPI _export HrsEndSession(DWORD_PTR);
HRS_CPLUSPLUS BOOL    WINAPI _export HrsConvertFile(DWORD_PTR,LPBYTE,LPBYTE,int);
HRS_CPLUSPLUS HGLOBAL WINAPI _export HrsConvertBuffer(DWORD_PTR,LPBYTE,int,LPINT,int);
HRS_CPLUSPLUS BOOL    WINAPI _export HrsHandleToStr(LPBYTE,int,HANDLE);
HRS_CPLUSPLUS int     WINAPI _export HrsGetLastMessage(DWORD_PTR,LPBYTE,LPBYTE);
HRS_CPLUSPLUS BOOL    WINAPI _export HrsResetLastMessage(DWORD_PTR);
HRS_CPLUSPLUS DWORD   WINAPI _export HrsSetFlags(DWORD_PTR,BOOL,int);
HRS_CPLUSPLUS int     WINAPI _export HrsGetPictCount(DWORD_PTR);
HRS_CPLUSPLUS BOOL    WINAPI _export HrsGetPictName(DWORD_PTR,int,LPWORD);
HRS_CPLUSPLUS BOOL    WINAPI _export HrsSetPaperSize(DWORD_PTR, int, int, int);
HRS_CPLUSPLUS BOOL    WINAPI _export HrsSetPaperOrient(DWORD_PTR, int);
HRS_CPLUSPLUS BOOL    WINAPI _export HrsSetPageMargin(DWORD_PTR, int, int, int, int);
HRS_CPLUSPLUS BOOL    WINAPI _export HrsSetDownloadDir(DWORD_PTR, LPBYTE);
HRS_CPLUSPLUS BOOL    WINAPI _export HrsSetHdrFtrText(DWORD_PTR, int, int, LPBYTE);
HRS_CPLUSPLUS BOOL    WINAPI _export HrsSetPictPrefix(DWORD_PTR, LPBYTE);
HRS_CPLUSPLUS BOOL    WINAPI _export HrsSetPictFolder(DWORD_PTR, LPBYTE);
HRS_CPLUSPLUS BOOL    WINAPI _export HrsSetRelativeFolder(DWORD_PTR, LPBYTE);
HRS_CPLUSPLUS BOOL    WINAPI _export HrsSetImageSrcFolder(DWORD_PTR, LPBYTE);
HRS_CPLUSPLUS HGLOBAL WINAPI _export HrsConvertBufferU(DWORD_PTR, LPWORD ,int, LPINT, int);
HRS_CPLUSPLUS BOOL    WINAPI _export HrsHandleToStrU(LPWORD ,int ,HANDLE);
HRS_CPLUSPLUS int     WINAPI _export HrsSetLicenseInfo(LPBYTE, LPBYTE, LPBYTE);
HRS_CPLUSPLUS int     WINAPI _export HrsSetLicenseInfoU(LPWORD,LPWORD,LPWORD);
HRS_CPLUSPLUS BOOL    WINAPI _export HrsSetInServer(BOOL);
HRS_CPLUSPLUS int     WINAPI _export HrsGetLicenseStatus();
HRS_CPLUSPLUS BOOL    WINAPI _export HrsSetOverrideDPI(DWORD_PTR, int);
HRS_CPLUSPLUS BOOL    WINAPI _export HrsSetRelativeFolder(DWORD_PTR, LPBYTE);


#endif
