{******************************************************************************
               TER Constants
*******************************************************************************}
Const
   TER_CLASS  =    'Ter32Class';

   CROP_LEFT     = 1;
   CROP_RIGHT    = 2;
   CROP_TOP      = 3;
   CROP_BOT      = 4;

   TER_DATA_VER       =101;

   MAX_WIDTH          =1000;
   MAX_TAB_STOPS      =20;
   HILIGHT_OFF        =0;
   HILIGHT_LINE       =1;
   HILIGHT_CHAR       =2;

   OLEPTR_OBJECT      =0;
   OLEPTR_STORAGE     =1;

   PERM_PRINT            =$4;  
   PERM_MOD              =$28;
   PERM_COPY             =$10;

   PDFFLAG_COMPRESS_TEXT =$1; 
   PDFFLAG_NO_BOOKMARK   =$2;    // do not include bookmark
   PDFFLAG_EMBED_FONTS   =$4;    // always embed fonts
   PDFFLAG_NO_HLINK      =$8;    // do not include active hyperlink
   PDFFLAG_BINARY_HINT   =$10;   // write additional binary hit to satish yahoo and hotmail
   PDFFLAG_EXACT_TEXT_PLACEMENT =$20; // place characters at exact positions
   PDFFLAG_NO_CACHING     =$40;   // write directly to disk file
   PDFFLAG_DO_XPARENT     =$80;   // do not support transparency
   PDFFLAG_MULTI_DOC      =$100;  // combining multiple TE documents to create one pdf doc
   PDFFLAG_NO_PAGE_BM     =$200;  // do not create page bitmap, page bitmap is needed to support transparency
   PDFFLAG_NO_BOOKMARK_PANE =$400;  // do not open the bookmark pane - only applicable when bookmarks are enabled
   PDFFLAG_RC4_128          =$800;  // use RC4-128 bit encryption when password is used
   PDFFLAG_AES_128         =$1000;  // use AES-128 bit encryption when password is used

   CLR_AUTO           =$010101;    // auto text color
   CLR_INVALID        =$ffffffff;    // this value indicates an invalid color (windows SDK constant)
   
   SWRAP_NO_WRAP      =1;
   SWRAP_AROUND       =2;
   SWRAP_IGNORE       =3;
   SWRAP_TIGHT        =4;
   SWRAP_THRU         =5;

   TP_TOTAL_LINES     =1;
   TP_TOTAL_PFMTS     =2;
   TP_TOTAL_FONTS     =3;
   TP_TOTAL_STYLES    =4;
   TP_TOTAL_PAGES     =5;
   TP_TOTAL_PARA_FRAMES =6;
   TP_TOTAL_CHAR_TAGS =7;
   TP_TOTAL_IMAGE_MAPS =8;
   TP_TOTAL_BLTS      =9;
   TP_TOTAL_LISTS     =10;
   TP_TOTAL_LIST_OR   =11;
   TP_TOTAL_TABS      =12;
   TP_TOTAL_TABLE_ROWS =13;
   TP_TOTAL_CELLS     =14;
   TP_TOTAL_SECTS     =15;
   TP_CUR_LINE        =16;
   TP_CUR_COL         =17;
   TP_CUR_SECT        =18;
   TP_SELECTION_TYPE  =19;
   TP_SELECTION_START_LINE  =20;
   TP_SELECTION_START_COL   =21;
   TP_SELECTION_END_LINE    =22;
   TP_SELECTION_END_COL     =23;
   TP_WATERMARK_WASH        =24;
   TP_WATERMARK_PICT        =25;
   TP_PAGE_BK_COLOR         =26;
   TP_TOTAL_REVIEWERS       =27;
   TP_MOUSE_ON_TEXT_LINE    =28;
   TP_WIN_ORG_Y             =30;

   TP_MOUSE_FIRST           =31;
   TP_MOUSE_X               =31;
   TP_MOUSE_Y               =32;
   TP_MOUSE_LINE            =33;
   TP_MOUSE_COL             =34;
   TP_MOUSE_FONT_ID         =35;
   TP_MOUSE_PICT_ID         =36;
   TP_MOUSE_FIELD_ID        =37;
   TP_MOUSE_LAST            =37;

   TP_DEF_CHARSET           =60;
   TP_TOTAL_CHARS           =61;  
   TP_PREVIEW_ZOOM_PCT      =62;
   TP_TABLE_COLS_SELECTED   =63;
   TP_TABLE_ROWS_SELECTED   =64;
   TP_HAS_TRACK_CHANGES     =65;    // return true if the document contains unaccepted track-chnages
   TP_CUR_REV_ID            =66;    // current reviever id if track-change is enabled
   TP_INIT_LIST_INDENT      =67;     // initial list indent
   TP_FIXED_BULLET_SIZE     =68;     // fixed bullet size in twips
   TP_DRAGGING_TEXT         =69;     // true when the text is being dragged
   TP_SHOW_HIDDEN_TEXT      =70;     // true when showing hidden text
   TP_TEXT_DEF_BK_COLOR     =71;
   TP_JUST_LINE_BREAK_LINE  =72;

   TPS_INIT_LIST_INDENT     =1;     // initial list indent
   TPS_FIXED_BULLET_SIZE    =2;     // fixed bullet size in twips
   TPS_JUST_LINE_BREAK_LINE =3;
   TPS_PAGE_NUM_FORMAT      =4;     // page number format string, example:  '\* GB4' for the chinese page numbers

   CP_FIX_WIDTH       =0;
   CP_PARENT_CELL     =1;
   CP_LEVEL           =2;
   CP_TEXT_ROTATION   =3;
   CP_WIDTH           =4;        // cell width
   CP_ROW             =5;        // id of the row which includes the cell
   CP_ID              =6;        // curent cell id
   CP_NEXT            =7;        // next cell id
   CP_PREV            =8;        // previous cell id
   CP_ROW_WIDTH       =9;        // width of the row containing the cell
   CP_PAD_LEFT       =10;        // left padding in twips
   CP_PAD_RIGHT      =11;        // right padding in twips
   CP_PAD_TOP        =12;        // top padding in twips
   CP_PAD_BOT        =13;        // bottom padding in twips
   CP_TABLE_PICT     =14;        // table picture id
   CP_CELL_PICT      =15;        // cell picture id
   CP_TEXT_ANGLE     =16;        // text angle
   CP_FLAGS          =17;        // flags


   RP_FIRST_CELL   =  0;         // first cell id for the row
   RP_LAST_CELL    =  1;         // last cell id for the row
   RP_TOP_ROW_HT   =  2;         // height of the top part of a split row
   RP_BOT_ROW_HT   =  3;         // height of the top part of a split row
   RP_FLAGS        =  4;         // row flags


   FP_TEXT_ROTATION   =1;
   FP_WRAP_STYLE      =2;
   FP_YBASE           =3; 
   FP_FILL_PATTERN    =4;
   FP_TEXT_DIST       =5;
   FP_ARROW_TYPE      =6;        // PF2_START_ARROW, PF2_END_ARROW, or 0
   FP_X               =7;        // x position in current base positioning - same as ParaFrame[].x
   FP_Y               =8;        // y position in current base positioning - same as ParaFrame[].y
   FP_ZORDER          =9;        // Z Order
   FP_PICT           =10;        // picture id for the frame
   FP_SHAPE_TYPE     =11;        // shape type
   FP_FLAGS          =12;        // frame flags PARA_FRAME_ constants
   FP_FLAGS2         =13;        // frame flags PF2_ constants
   FP_PAGE_NO        =14;        // page number 
   FP_LINE_THICKNESS =15;        // line thickness twips
   FP_LINE_COLOR     =16;        // line color
   FP_FILL_COLOR     =17;        // fill color
   FP_WIDTH          =18;        // width of the object in twips
   FP_HEIGHT         =19;        // height in twips
   FP_LINE_TYPE      =20;        // height in twips
   FP_CANVAS         =21;        // canvas para-frame id
   FP_SIDE_MARGIN    =22;        // side margin value
   FP_TOP_MARGIN     =23;        // top margin value
   FP_BOT_MARGIN     =24;        // bottom margin value

   FP_ERROR        =9999;        // error return by the TerGetFrameParam function

   SP_FLAGS           =1;        // text rotation constant
   SP_LINE_STEP       =2;        // line step when section line numbering is enabled
   SP_BORDER_TYPE     =3;        // border type
   SP_BORDER_WIDTH    =4;        // border width
   SP_BORDER_SPACE    =5;        // border space
   SP_BORDER_COLOR    =6;        // border color
   SP_FIRST_PAGE_HDR_HT  =7;     // first page header height
   SP_FIRST_PAGE_BODY_HT =8;     // first page body height
   SP_FIRST_PAGE_FTR_HT  =9;     // first page header height
   SP_IN_USE            =10;     // in-use flag
   SP_PREV_SECT         =11;     // previous section id
   SP_NEXT_SECT         =12;     // next section id
   SP_AUX_ID            =13;     // aux id
   SP_LINE_BET_COL      =14;     // line between columns
   SP_LEFT_MARG         =15;     // left margin
   SP_RIGHT_MARG        =16;     // right margin
   SP_TOP_MARG          =17;     // top margin
   SP_BOT_MARG          =18;     // bottom margin
   SP_HDR_MARG          =19;     // distance from the top of the page where the page header begins
   SP_FTR_MARG          =20;     // distance from the bottom of the page where the page footer begins
   SP_GUTTER_MARG       =21;     // gutter margin
   SP_NUM_COLS          =22;     // space number of columns, 20141125
   SP_COL_SPACE         =23;     // space between the columns in twips, 20141125

   PP_PAGE_HDR_HT  =1;           // page header height
   PP_PAGE_BODY_HT =2;           // page body height
   PP_PAGE_FTR_HT  =3;           // page header height
   PP_DISP_NO      =4;           // page number for display
   PP_NO           =5;           // current page number
   PP_TOP_SECT     =6;           // section for the top of the page
   PP_FIRST_LINE   =7;           // first line of the page
   PP_LAST_LINE    =8;           // last line of the page
   PP_FLAGS        =9;           // page flags
   PP_PAGE_BODY_AVAIL_HT = 10;    // available height (in twips) in the body of the page


   LP_LINE_FLAGS      =1;        // line flags LFLAG_
   LP_LINE_FLAGS2     =2;        // line flags LFLAG2_
   LP_LINE_LEN        =3;        // line length
   LP_LIST_NBR        =4;        // list number associate with the line
   LP_LIST_FONT       =5;        // font id to print the list
   LP_CELL_ID         =6;        // cell id for the line
   LP_PARA_FRAME_ID   =7;        // para frame id
   LP_LIST_ID         =8;        // list id
   LP_LIST_OR_ID      =9;        // list or id
   LP_LIST_LEVEL     =10;        // list level
   LP_LINE_NUM       =11;        // current line number
   LP_PARA_MARK      =12;        // para-mark found at the end of this line
   LP_LIST_TEXT_WIDTH =13;       // width of list text in twips
   LP_HEIGHT          =14;       // Line height in twips
   LP_LIST_BULLET_SYM =15;       // list bullet symbol
   LP_LIST_TEXT       =16;       // list text (TerGetListParamStr method)
   LP_PARA_FIRST_LINE =17;       // first line for the paragraph which contains the given line
   LP_PARA_LAST_LINE  =18;       // last line for the paragraph which contains the given line 
   LP_SECT_ID         =19;       // section id for the line

   LP_ERROR        =9999;        // error return by the TerGetLineParam function

   PFRAME_NONE       =0; 
   PFRAME_LEFT       =1;  
   PFRAME_RIGHT      =2; 
   PFRAME_FLOAT      =3; 

   FONTINFO_UCBASE   = 1;
   FONTINFO_CHARSET  = 2;
   FONTINFO_PICT_WIDTH  =3;
   FONTINFO_PICT_HEIGHT =4;
   FONTINFO_ULINE_COLOR =5;
   FONTINFO_AUX_ID      =6;
   FONTINFO_FLAGS       =7;
   FONTINFO_FRAME_TYPE  =8;
   FONTINFO_FRAME_ID    =9;
   FONTINFO_IS_PICT    = 11;
   FONTINFO_IS_OLE     = 12;
   FONTINFO_IS_OCX     = 13;
   FONTINFO_FIELD_ID    =14;
   FONTINFO_INS_REV_ID  =15;
   FONTINFO_DEL_REV_ID  =16;
   FONTINFO_CHAR_SCALEX =17;
   FONTINFO_CHAR_SPACE  =18;
   FONTINFO_IS_RTL      =19;
   FONTINFO_SIZE        =20;
   FONTINFO_STYLE       =21;
   FONTINFO_COLOR       =22;
   FONTINFO_BK_COLOR    =23;
   FONTINFO_WLINE_COLOR =24;
   FONTINFO_FLOW        =25;
   FONTINFO_HAS_COMMENTS =26;
 
   PARAINFO_TEXT_FLOW    =1;
   PARAINFO_BORDER_COLOR =2;
   PARAINFO_BK_COLOR     =3;
   PARAINFO_SPC_BEF      =4;
   PARAINFO_SPC_AFT      =5;
   PARAINFO_SPC_BET      =6;

   SSINFO_NAME          =1;
   SSINFO_CHAR_SPACE    =2;
   SSINFO_CHAR_OFFSET   =3;
   SSINFO_NEXT          =4;
   SSINFO_OUTLINE_LEVEL =5;


   TEXT_HORZ          =0;
   TEXT_TOP_TO_BOT    =1;
   TEXT_BOT_TO_TOP    =2;

   INFO_TITLE         =0;
   INFO_SUBJECT       =1;
   INFO_AUTHOR        =2;
   INFO_MANAGER       =3;
   INFO_COMPANY       =4;
   INFO_OPERATOR      =5;
   INFO_CATEGORY      =6;
   INFO_KEYWORDS      =7;
   INFO_COMMENT       =8;
   INFO_PWHASH        =9;
   INFO_HLINKBASE     =10;

   FFLAG_AUTO_SPELL    =$400;
   FFLAG_EQ_OBJECT     =$800;

   WRAP_OFF           =0;        { suspend wrapping temporarily }
   WRAP_MIN           =1;        { re-wrap minimum number of lines }
   WRAP_PARA          =2;        { re-wrap all lines in the current paragraph }
   WRAP_WIN           =3;        { re-wrap all lines visible in the current window }

   APPLY_IGNORE       =0;        { ignore text data }
   APPLY_MOD_CUR_LINE =1;        { apply the text data to the current line }
   APPLY_BEF_CUR_LINE =2;        { insert after the current line }
   APPLY_AFT_CUR_LINE =3;        { insert after the current line }

   SAVE_TER           =0;        { save in TER format}
   SAVE_TEXT          =1;        { save in text format}
   SAVE_TEXT_LINES    =2;        { text format with line breaks}
   SAVE_RTF           =3;        { save in Rich Text Format}
   SAVE_DEFAULT       =4;        { save in the format of the input file}
   SAVE_HTML          =5;        { save in the html format - requires HTML add-on}
   SAVE_UTEXT         =6;        { save in the unicode foramt}

   SID_NORMAL         = -9999;
   SID_CUR            = -9998;

   ULINE              =$1;
   BOLD               =$2;
   ITALIC             =$4;
   STRIKE             =$8;
   SUPSCR             =$10;
   SUBSCR             =$20;
   HIDDEN             =$40;
   PICT               =$80;
   ULINED             =$100;
   PROTECT            =$200;
   FNOTE              = $400;
   FNOTETEXT          = $800;
   FNOTEREST          = $1000;
   CHAR_BOX           = $2000;
   HLINK              = $4000;
   ENOTETEXT          = $8000;
   CAPS               = $10000;
   SCAPS              = $20000;
   DOUBLE_STRIKE      = $80000;


   DEFAULT_PFMT       =$0;

   CENTER             =$1;
   RIGHT_JUSTIFY      =$2;
   DOUBLE_SPACE       =$4;
   BULLET             =$8;
   PARA_BOX_TOP       =$10;
   PARA_BOX_BOT       =$20;
   PARA_BOX_LEFT      =$40;
   PARA_BOX_RIGHT     =$80;
   PARA_BOX_DOUBLE    =$100;
   PARA_BOX_THICK     =$200;
   PARA_BOX_ATTRIB    =$3F0;
   LEFT               =$400;
   JUSTIFY            =$800;
   PAGE_HDR           =$1000;
   PAGE_FTR           =$2000;
   PAGE_HDR_FTR       =$3000;
   PARA_KEEP          =$4000;
   PARA_KEEP_NEXT     =$8000;
   AUTO_SPACE_BEFORE  =$20000;
   AUTO_SPACE_AFTER   =$40000;

   PARA_BOX           =$F0;

   PFLAG_NO_WRAP      =$10;
   PFLAG_WIDOW        =$20;

   ROWFLAG_HDR        =$4;     
   ROWFLAG_HAS_SUBTABLE =$8;   
   ROWFLAG_SPLIT      =$10;    
   ROWFLAG_KEEP       =$2000;  
   ROWFLAG_PREEXIST   =$4000;  
   ROWFLAG_NEW_TABLE  =$8000;  


   TAB_LEFT            =0;
   TAB_RIGHT           =1;
   TAB_CENTER          =2;
   TAB_DECIMAL         =3;

   TAB_NONE            =0;
   TAB_DOT             =1;
   TAB_HYPH            =2;
   TAB_ULINE           =4;


   TER_WORD_WRAP       =$1;        { TER custom control styles}
   TER_PRINT_VIEW      =$2;
   TER_HSCROLL         =$4;
   TER_VSCROLL         =$8;
   TER_SHOW_STATUS     =$10;
   TER_SHOW_RULER      =$20;
   TER_BORDER_MARGIN   =$40;
   TER_OUTPUT_RTF      =$80;
   TER_USE_PARAMS      =$100;
   TER_READ_ONLY       =$200;
   TER_PAGE_MODE       =$400;
   TER_SHOW_TOOLBAR    =$800;
   TER_INVISIBLE       =$1000;
   TER_NUM_STYLES      =13;

   SRCH_SCROLL         =$1;
   SRCH_SEARCH         =$2;
   SRCH_REPLACE        =$4;
   SRCH_RETRIEVE       =$8;
   SRCH_CASE           =$10;
   SRCH_WORD           =$20;
   SRCH_SKIP_HIDDEN_TEXT = $40;
   SRCH_BACK           =$80;
   SRCH_NO_REPLACE_PROT_TEXT =$100;

   POS_BEG             =0;
   POS_END             =1;

   DOB_TEXT_BOX        =1;
   DOB_RECT            =2;
   DOB_LINE            =3;

   DOB_LINE_NONE       =0;
   DOB_LINE_SOLID      =1;
   DOB_LINE_DOTTED     =2;

   SSTYPE_CHAR         =1;
   SSTYPE_PARA         =2;

   BASE_PAGE      =0;
   BASE_MARG      =1;
   BASE_PARA      =2;

   SEL_CELLS      =1;
   SEL_COLS       =2;
   SEL_ROWS       =3;
   SEL_ALL        =4;

   BKPICT_STRETCH =1;
   BKPICT_TILE    =2;

   RHDR_CHAR           =2;        // right page header character
   RFTR_CHAR           =3;        // right page footer character
   ZWNJ_CHAR           =4;        // zero-width non-joiner - used to unligate
   HPARA_CHAR          =5;        // hidden para character
   HYPH_CHAR      =6;
   LHDR_CHAR           =7;        // left page header character
   LFTR_CHAR           =8;        // left page footer character
   PAGE_CHAR      =12;
   NBSPACE_CHAR   =14;
   LINE_CHAR      =15;
   SECT_CHAR      =20;
   COL_CHAR       =22;
   PARA_CHAR      =21;
   CELL_CHAR      =19;
   ROW_CHAR       =18;
   HDR_CHAR       =17;
   FTR_CHAR       =16;
   NBDASH_CHAR    =23;
   PICT_CHAR      =24;
   FHDR_CHAR      =25;
   FFTR_CHAR      =26;

   BRDRTYPE_SINGLE           =0;
   BRDRTYPE_DBL              =1;
   BRDRTYPE_TRIPLE           =2;
   BRDRTYPE_SHADOW           =3;
   BRDRTYPE_THICK_THIN       =4;
   BRDRTYPE_THICK_THIN_THICK =5;
   BRDRTYPE_THIN_THICK       =6;
   BRDRTYPE_THIN_THICK_THIN  =7;
   BRDRTYPE_NONE             =8;


   TFLAG_RESIZE_BITMAP    = $1;
   TFLAG_METRIC           = $2;
   TFLAG_RETURN_MSG_ID    = $4;
   TFLAG_APPLY_PRT_ORIENT = $8;
   TFLAG_APPLY_PRT_PROPS  = $8;
   TFLAG_IGNORE_PICT_LINK = $10;
   TFLAG_DISABLE_ACCEL    = $20;
   TFLAG_USE_NEXT_ID      = $40;
   TFLAG_SHOW_CARET       = $80;
   TFLAG_UNPROTECTED_DEL  = $100;
   TFLAG_NO_HOUR_GLASS    = $200;
   TFLAG_NO_CHILD_TOP     = $400;
   TFLAG_NO_WRAP          = $800;
   TFLAG_ACTIVATE_MDI_CHILD = $1000;
   TFLAG_COMP_WORD97      = $2000;
   TFLAG_EXCLUDE_HIDDEN_SEL = $4000;
   TFLAG_AUTO_VSCROLL_BAR   = $8000;
   TFLAG_NO_PALETTE         = $10000;
   TFLAG_KEEP_PICT_ASPECT   = $20000;
   TFLAG_KEEP_FRAME_ASPECT  = $40000;
   TFLAG_PICT_IN_FRAME      = $80000;
   TFLAG_NO_PRINTER         = $100000;
   TFLAG_NO_DRAG_TEXT       = $200000;
   TFLAG_NO_EDIT_OLE        = $400000;
   TFLAG_BETTER_256         = $800000;
   TFLAG_NO_EDIT_PICT       = $1000000;
   TFLAG_SHOW_BREAKS        = $2000000;
   TFLAG_SELECT_FULL_HLINK  = $4000000;
   TFLAG_NO_OLE             = $10000000;
   TFLAG_ROW_PASTE          = $20000000;
   TFLAG_NO_AUTO_FULL_CELL_SEL = $40000000;
   TFLAG_SWAP_DECIMAL       = $80000000;

   TFLAG2_COMP_WPF          = $1;
   TFLAG2_RETAIN_BKND       = $2;
   TFLAG2_USE_PAL_FOR_TEXT  = $4;
   TFLAG2_CAN_MERGE_PROT_TEXT = $8;
   TFLAG2_BKPICT_OVER_PAGE_BORDER = $10;
   TFLAG2_NO_CARET          = $40;
   TFLAG2_SHOW_SECT_PAGE_NO = $80;
   TFLAG2_NO_CURSOR_CHANGE  = $100;
   TFLAG2_VERT_THUMB_TRACK  = $200;
   TFLAG2_NO_AUTO_REPAGE    = $400;
   TFLAG2_NO_BKP_FILE       = $800;
   TFLAG2_SELECT_FRAME_PICT = $1000;
   TFLAG2_HIDE_PAGE_BREAK   = $2000;
   TFLAG2_PROTECT_FORMAT    = $4000;
   TFLAG2_NO_HIDDEN_RTF_TEXT = $8000;
   TFLAG2_NO_SHADE_FIELD_TEXT = $10000;
   TFLAG2_IGNORE_TIMER        = $20000;
   TFLAG2_NO_AUTO_HDR_FTR     = $40000;
   TFLAG2_WRITE_FIRST_RTF_COLOR = $80000;
   TFLAG2_FULL_REPAINT      = $100000;
   TFLAG2_KEEP_PRINTER_OPEN = $200000;
   TFLAG2_ALT_PARA_SYM      = $400000;
   TFLAG2_ALT_LINE_SYM      = $800000;
   TFLAG2_NO_LINE_FITTING   = $1000000;
   TFLAG2_NO_PRT_CANCEL_DLG = $2000000;
   TFLAG2_INDENT_FRAMES     = $4000000;
   TFLAG2_INDENT_TABLES     = $8000000;
   TFLAG2_NO_ADJUST_CURSOR  = $10000000;
   TFLAG2_CURSOR_BEF_HIDDEN = $20000000;
   TFLAG2_NO_CURSOR_ON_PROTECT = $40000000;

   TFLAG3_WRAP_SPACES          = $1;
   TFLAG3_NO_EDIT_TABLE_COL    = $2;
   TFLAG3_TABLE_STATUS_LINE    = $4;
   TFLAG3_PLAIN_TABLE_BORDER   = $8;
   TFLAG3_GRAY_READ_ONLY       = $10;
   TFLAG3_CURSOR_IN_CELL       = $20;
   TFLAG3_EXACT_CELL_WIDTH     = $40;
   TFLAG3_NO_SCROLL            = $80;
   TFLAG3_NO_FULL_CELL_COPY    = $100;
   TFLAG3_HTML_CONT_TABLE      = $200;
   TFLAG3_SELECT_FIRST_FIELD   = $400;
   TFLAG3_MULTIPLE_RTF_GROUPS  = $800;
   TFLAG3_OLD_WORD_FORMAT      = $1000;
   TFLAG3_EMBEDDED_TABLES      = $2000;
   TFLAG3_DATA_FIELD_INPUT     = $4000;
   TFLAG3_GET_BUF_HDR_FTR      = $8000;
   TFLAG3_NO_RTF_BKND_COLOR    = $20000;
   TFLAG3_NO_SAVE_UNDO         = $40000;
   TFLAG3_LARGE_PARA_BORDER    = $80000;
   TFLAG3_STYLES_ON_TOOLBAR    = $100000;
   TFLAG3_LINE_SCROLL          = $400000;
   TFLAG3_PRINT_BKND_PICT      = $800000;
   TFLAG3_CLIP_CELL_OVERFLOW   = $2000000;
   TFLAG3_EXACT_SCREEN_FONT    = $4000000;
   TFLAG3_ZERO_CELL_HEIGHT     = $8000000;
   TFLAG3_READ_PNG             = $10000000;
   TFLAG3_NO_TEXT_COLOR_ADJ    = $20000000;
   TFLAG3_NO_MOUSE_SEL         = $40000000;

   TFLAG4_COUNT_PCHAR_AS_CRLF    = $1;
   TFLAG4_SKIP_PROT_TEXT         = $2;
   TFLAG4_HIDE_HIDDEN_PARA_MARK  = $4;
   TFLAG4_READONLY_CONTROLS      = $8;
   TFLAG4_NO_REPAGINATE          = $10;
   TFLAG4_SMOOTH_SCROLL          = $20;
   TFLAG4_TEXT_HIDDEN            = $80;
   TFLAG4_AUTO_SPELL             = $100;
   TFLAG4_BINARY_RTF_PICT        = $200;
   TFLAG4_UNDO_WINDOW_OVERFLOW   = $400;
   TFLAG4_IME_UNICODE            = $800;
   TFLAG4_MOD_END_MARK_FONT      = $1000;
   TFLAG4_ONE_ROW_TOOLBAR        = $2000;
   TFLAG4_NO_OLE_DROP            = $4000;
   TFLAG4_ALWAYS_INVOKE_OLE      = $10000;
   TFLAG4_DISABLE_DATE_UPDATE    = $20000;
   TFLAG4_SAVE_BMP_AS_PNG        = $40000;
   TFLAG4_SAVE_SHAPE_WITH_DRAW_OBJECT = $80000;
   TFLAG4_HTML_INPUT             = $100000;
   TFLAG4_NO_DRAG_PROT_TEXT      = $200000;
   TFLAG4_FULL_DRAG_PROT_TEXT    = $400000;
   TFLAG4_NO_MERGE_TABLE    = $800000;
   TFLAG4_NO_TOC_UPDATE     = $1000000;
   TFLAG4_NO_SHARE_BORDER   = $4000000;
   TFLAG4_ADJ_LEFT_TABLE_COL = $8000000;
   TFLAG4_DONT_FIX_NEG_INDENT = $10000000;
   TFLAG4_PASTE_LAST_PARA_PROP = $20000000;
   TFLAG4_PRINT_WMF_AS_BMP    = $40000000;

   TFLAG5_NO_EXT_DROP         = $1;
   TFLAG5_GROUP_UNDO          = $2;
   TFLAG5_NO_EXACT_ROW_HEIGHT = $4;
   TFLAG5_RTL_CURSOR          = $8;
   TFLAG5_NO_KB_SEL           = $10;
   TFLAG5_WRITE_DOB           = $20;
   TFLAG5_NO_OBJ_IN_STATUS_LINE = $40;
   TFLAG5_NO_CLEAR_SPL_HIST   = $80;
   TFLAG5_NO_NORMALIZE_FNOTE  = $100;
   TFLAG5_INPUT_TO_UNICODE    = $200;
   TFLAG5_NO_NORMALIZE_FIELD  = $400;
   TFLAG5_BEF_AND_AFT_HIDDEN  = $800;
   TFLAG5_NO_DRAW_IMAGE       = $1000;
   TFLAG5_SHOW_PAGE_SETUP     = $2000;
   TFLAG5_FULL_REPAGINATE     = $4000;
   TFLAG5_PNG_RGB             = $8000;
   TFLAG5_NO_SHOW_SPACE_SYM  = $10000;
   TFLAG5_OLD_HLINK          = $20000;
   TFLAG5_NO_DRAG_ROW_LINE   = $40000;
   TFLAG5_NO_SHARE           = $80000;
   TFLAG5_SHOW_PAGE_BREAK    = $100000;
   TFLAG5_VARIABLE_PAGE_SIZE = $200000;
   TFLAG5_SAVE_PICT_AS_WMF   = $400000;
   TFLAG5_NO_DRAG_CELL_LINE  = $800000;
   TFLAG5_RULER_INDENT_FIXED = $1000000;
   TFLAG5_TOP_ROW_TOOLBAR    = $2000000;
   TFLAG5_NO_ADJ_FOR_TABLE   = $4000000;
   TFLAG5_UNLIMITED_OLE_SPACE = $8000000;
   TFLAG5_OLD_RULER           = $10000000;
   TFLAG5_FRAME_TEXT_ONLY     = $20000000;
   TFLAG5_PROTECT_DATA_FIELD  = $40000000;

   TFLAG6_WRITE_DBCS          = $2;
   TFLAG6_WRITE_DEFAULT_COLOR = $4;          // write the default color for the first color
   TFLAG6_HI_RES              = $8;
   TFLAG6_DONT_WRITE_PICT_PATH = $10;        // do not write picture path when writingh out linked pictures 
   TFLAG6_DONT_PROCESS_TAB    = $20;         // this flags stops the processing of the tab key
   TFLAG6_SHOW_PICT_IN_PIXEL_SIZE = $40;
   TFLAG6_DONT_PROCESS_BULLET_KEYS = $80;
   TFLAG6_IN_PLACE_ACTIVATE   = $400;
   TFLAG6_ALLOW_CELL_OVERFLOW = $800;        // allow the excess cell text to overflow the cell
   TFLAG6_INSERT_DROP_PICT_AS_LINK = $1000; 
   TFLAG6_WRAP_AT_WINDOW_WIDTH = $2000;    
   TFLAG6_SAVE_TEXT_BK_COLOR   = $4000;    
   TFLAG6_LIST_TO_TEXT_IN_HTML = $8000; 
   TFLAG6_NO_LINK_MSG          = $20000;     // do not display message when mouse hovers overs a text line
   TFLAG6_NO_TRACK_MSG         = $40000;     // do not display a message when mouse hovers over a track-change text
   TFLAG6_PRINT_EMF_AS_BMP     = $200000; 
   TFLAG6_MBCS_HTML_OUTPUT     = $2000000;    // write mbcs (instead of unicode) on html output
   TFLAG6_SWAP_CR_LINE_BREAK   = $4000000;    // generate line-break when Return is pressed, and generate Return when Shift-Return is pressed
   TFLAG6_USE_ANSI_FONT        = $8000000;     
   TFLAG6_DEL_CELL_TEXT        = $20000000;   // on deletion, delete cell contents but not the cell structure
   TFLAG6_RIGHT_JUST_RTL       = $40000000;   // always drat the rtl text right-justified

   TFLAG7_NO_RTL_FONT          = $1;
   TFLAG7_AUTO_NEW_ROW         = $10;
   TFLAG7_HIDE_TC_FIELD        = $20;         // show tc field contents
   TFLAG7_SKIP_WORD_WRAP       = $40;         // skip word-wrap function temporarily
   TFLAG7_DRAW_OLD_VSCROLL     = $80;         // disables vertical scroll bar if page text is less than window
   TFLAG7_OLD_PICT_IN_FRAME    = $200;        // use old method of automatically creating a frame around an inserted picture
   TFLAG7_NO_TRACK_CHANGE_LINE = $400;        // do not draw the track change line
   TFLAG7_SHRINK_PICT_TO_PAGE  = $800;        // shirnk large pictures to fit in page
   TFLAG7_AUTO_PARA_RTL        = $2000;       // automatic set para rtl when rtl text is entered
   TFLAG7_SHOW_SPACES_AT_PARA_END = $4000;    // show any underline spaces before the line end
   TFLAG7_DISABLE_RULER        = $8000;       // disable editing on ruler
   TFLAG7_AUTO_SET_RTL         = $10000;      // set text to rtl automatically if it contains rtl text
   TFLAG7_ALWAYS_FIRE_MODIFY   = $20000;      // always fire the modified event
   TFLAG7_WRITE_LISTTEXT       = $40000;      // write list text group
   TFLAG7_SET_BOX_CLIPPING     = $200000;     // draw cell/para-frame within its own frame box
   TFLAG7_PASTE_OBJECT         = $400000;     // paste ole object from clipboard if available
   TFLAG7_NO_SPELLCHECK_FIELDS = $800000;     // do not spell-check field text
   TFLAG7_RECORD_CUR_PARA_PROPS = $2000000;   // TRUE to record current paragrah attribute in the style being recorded
   TFLAG7_RECORD_CUR_CHAR_PROPS = $4000000;   // TRUE to record current character attribute in the style being recorded
   TFLAG7_NO_INTERNET          =  $10000000;  // Disable internet access
   TFLAG7_NO_TABLE_AUTO_WIDTH  =  $20000000;  // Disable table auto-width feature 

   TFLAG8_AUTO_REFORMAT_TABLES    = $1;       // automatically reformat the tables
   TFLAG8_HIDE_EMPTY_CELLS_ON_PRINT = $2;     // hide empty cells when printing the document 
   TFLAG8_DONT_SELECT_LAST_CHAR     = $4;     // don't select the last character of the document on select_all
   TFLAG8_ENABLE_GDIPLUS            = $8;     // enable gdi plus
   TFLAG8_FIX_NEG_INDENT            = $20;    // fix negative indent during rtf read
   TFLAG8_IGNORE_LASTROW            = $40;    // ignore the \lastrow rtf tag
   TFLAG8_HIDE_PAGE_BLANK_AREA      = $80;    // for short documents disable the display of non-text area by hiding the vertical scroll bar
   TFLAG8_NO_BOX_CLIPPING          = $200;    // do not clip horizontal text/table overflowing a frame
   TFLAG8_WRAP_ON_HYPHEN           = $400;    // word wrap on hyphen
   TFLAG8_MERGE_TABLES_ON_PASTE    = $800;    // merge the pasted table with the previous table
   TFLAG8_INSERT_ROWS_ON_PASTE     = $1000;   // insert the table rows on paste instead of overlaying it
   TFLAG8_COMP_V14                 = $2000;   // read sse file generated by TE v14.0.42 and TE 14.0.43 (revid=65)
   TFLAG8_NO_TWIPS                 = $4000;   // translate certain dialog units from twips to inches/cm
   TFLAG8_GET_MOUSELEAVE           = $10000;  // Get ACTION_MOUSELEAVE message in the preprocess event when mouse leaves the client area of the control
   TFLAG8_DONT_SPELL_CHECK_HDR_FTR = $2000000;  // don't spell check header/footer
   TFLAG8_GET_TRACKING_CODES       = $4000000;  // get tracking code unconditionally
   TFLAG8_NO_GDIPLUS_FOR_EMF       = $8000000;  // don't use GDI plus for emf display
   TFLAG8_HIDE_PPV_EDIT_BUTTON    = $10000000;  // hide the print-preview close/edit button
   TFLAG8_ALLOW_TEXT_BEF_PROT_FIELD = $20000000;  // allow text before the protected field
   TFLAG8_DONT_USE_KB_LANG          = $40000000;  // don't apply kb font to inserted text 

   TFLAG9_SKIP_STRIKE_TEXT      = $1;         // don't write strike/dbl-strike text to plain clipboard text
   TFLAG9_FIRE_FONT_CHECK       = $2;         // fire the font override event
   TFLAG9_NO_NESTED_TABLE_WIDTH_ADJ = $4;     // don't adjust the width of the nested tables to fit into the main table
   TFLAG9_WRAP_LONG_HTML_WORD    = $8;        // wrap a long word in a fixed with html cell by allowing the word to wrap instead of cell to widen
   TFLAG9_TREAT_DATA_FIELD_AS_ATOM  = $10;    // tream data-field as an atom
   TFLAG9_NO_COMMENTS               = $20;    // dont support comments
   TFLAG9_OLD_TABLE_WIDTH_CALC      = $40;    // used old table width calculations to be compatible with TE 17.0.4.5
   TFLAG9_SHRINK_LIST_TABLE         = $80;    // shrink the list table during the rtf output
   TFLAG9_ALWAYS_WRITE_ROW_PROPS    = $100;   // always write row properties
   TFLAG9_NO_SHADE_DYNAMIC_FIELDS   = $200;   // don't shade the dynamic fields
   TFLAG9_SAME_CURSOR_POS_AFTER_ZOOM = $400;  // don't let the cursor position change after zooming
   TFLAG9_ALWAYS_FIRE_STATUS_EVENT   =$800;   // always fire status event
   TFLAG9_ALWAYS_EMBED_TABLES        =$1000;  // always embed tables during clipboard paste
   TFLAG9_NEW_RTF_LISTS              =$2000;  // create new set of lists when rtf data is pasted
   TFLAG9_TOC_TO_TEXT                =$4000;  // convert table-of-content to plain text
   TFLAG9_CONVERT_COMBO_BOX          =$8000;  // convert box-box to plain-text showing the combo-box selection string
   TFLAG9_DONT_PASTE_TAGS           =$10000;  // don't paste tags and bookmarks
   TFLAG9_ENABLE_POPUP_MENU         =$20000;  // enable showing of pop-up menu
   TFLAG9_USE_ORIG_JPG_FOR_PDF      =$40000;  // use original jpeg data for pdf
   TFLAG9_RETAIN_PROTECT_STYLE      =$80000;  // retain the PROTECT style when a paragraph style is applied
   TFLAG9_DONT_COLOR_PARA_SPACING  =$100000;  // don't apply color to the paragarph before and after space
   TFLAG9_WORD2007_PAGE_BREAK      =$200000;  // Word 2007 compatible page breaks
   TFLAG9_FORCE_STYLE              =$400000;  // set to true to force the new style attributes
   TFLAG9_SHOW_FIELD               =$800000;  // show field name/data on right click
   TFLAG9_RTL_UNICODE_FILE         =$1000000;  // tell TE to apply rtl to the unicode text being read
   TFLAG9_CLIP_PICTURE             =$2000000;  // clip emf pictures to prevent drawing outside the picture rectangle
   TFLAG9_DONT_COUNT_LAST_BLANK_PAGE  =$4000000;  // tell TE not to include the last blank page in the page count display
   TFLAG9_DONT_PROTECT_PARA_BEF_TABLE =$8000000;  // dont protect the para marker before the table from deletion when included in a selection
   TFLAG9_FIRE_ADJUST_COLOR           =$10000000;  // fire the adjust color event
   TFLAG9_HIDE_PRINT_BUTTON           =$20000000;  // hide the print button on the print-preview bar
   TFLAG9_INVOKE_HYPERLINK            =$40000000;  // automatically invoke the hyperlink
   
   TFLAG10_DONT_MARK_WITH_SEL_COL = $1;        // 2014
   TFLAG10_DONT_USE_BKSP_FONT     = $2;        // don//t use the backspace font
   TFlAG10_DONT_PAD_TABLE_HEIGHT  = $4;        // don//t add the bottom padding to the exact height table rows
   TFLAG10_MERGE_NESTED_RTF_PROPS = $8;        // merge nested rtf color tables
   TFLAG10_EXTEND_AUTO_VSCROLL  = $10;         // extend the auto-vertical-scroll bar feature
   TFLAG10_NO_HLINK_BOOKMARK    = $20;         // do not generate bookmark for internal hyperlinks
   TFLAG10_NO_LAST_PARA_MARKER  = $40;         // don//t write the last para-markte to the rtf file
   TFLAG10_DONT_COMBINE_UNDOS   = $80;         // don//t combine undos
   TFLAG10_AUTO_HSCROLL_BAR     = $100;        // automatic horizontal scroll bar
   TFLAG10_DOTTED_GRID_LINES    = $200;        // show the dotted table grid lines
   TFLAG10_NO_CRLF                 = $400;         // don't insert cr/lf in the RTF text
   TFLAG10_WRITE_FIX_WIDTH_TABLE   = $800;         // disard auto-width property when writing RTF
   TFLAG10_USE_LAST_PARA_PROPS    = $1000;         // When last paragraph marker is deleted upon RTF read, use its property for the resulting last paragraph
   TFLAG10_WRITE_DOCX_CUSTOM_TAGS = $2000;         // write custom tags to support ss tags such as AuxId,
   TFLAG10_WRITE_RANDOM_LIST_TMPL_ID = $4000;      // randomize the list template id when writing the RTF output
   TFLAG10_DST                       = $8000;      // enable dst specific changes
   TFLAG10_LOCK_DATA_FIELD          = $10000;      // write the fldlock tag for the data fields
   TFLAG10_LEGACY_SECT_PROPS        = $20000;      // restore section properties input to pre 20140116
   TFLAG10_SHRINK_RTF_IMAGES        = $40000;      // shrink images to fit during rtf input
   TFLAG10_PREFER_PLACEHOLDER_PICT  = $80000;      // use placeholder pictures if available for the linked images
   TFLAG10_NO_PICT_READ_MSG         = $100000;     // do not show the message encountered during picture data import error

   TFLAG11_NO_AUTO_PARA_STYLE_ON_TEXT  = $1;       // don't automcatically apply paragraph style on text (during word-wrapping)
   TFLAG11_DONT_SHRINK_FONT_TABLE      = $2;       // don't shrink the font table when an editor window closes
   TFLAG11_NO_SHPPICT                  = $4;       // do not write the shppict tag
   TFLAG11_NO_EXACT_LINE_SPACING       = $8;       // do not honor exact line height
   TFLAG11_NO_CHAR_BKND                = $10;      // do not read \chcpbat tag
   TFLAG11_NO_BAD_PTR_CHECK            = $20;      // don't use the IsBadReadPtr or IsBadWritePtr flags
   TFLAG11_NO_PASTE_PAPER_PROPS        = $40;      // do not paste section paper poperties

   ALIGN_BOT              = 0;
   ALIGN_MIDDLE           = 1;
   ALIGN_TOP              = 2;

   LFLAG_PARA           = $1;
   LFLAG_BREAK          = $2;
   LFLAG_PARA_FIRST     = $4;
   LFLAG_CONTROL        = $8;
   LFLAG_FNOTE          = $10;
   LFLAG_SOFT_COL       = $20;
   LFLAG_NBSPACE        = $40;
   LFLAG_LINE           = $80;
   LFLAG_HTML_RULE      = $100;
   LFLAG_NBDASH         = $2000;
   LFLAG_PICT           = $4000;
   LFLAG_PICT_SPACE     = $8000;
   LFLAG_FNOTETEXT      = $10000;
   LFLAG_FHDR           = $20000;
   LFLAG_FFTR           = $40000;
   LFLAG_HDR            = $80000;
   LFLAG_FTR            = $100000;
   LFLAG_HYPH           = $200000;
   LFLAG_LHDR           = $400000;  // left header
   LFLAG_LFTR           = $800000;  // left header
   LFLAG_TOC            = $1000000;  // has table of contents
   LFLAG_LIST           = $2000000;  // line contains the list number to display
   LFLAG_HPARA          = $4000000;  // line contains a hidden para marker
   LFLAG_LISTNUM        = $8000000;  // has list number field in it
   LFLAG_SELECTED      = $10000000;  // result of LineSelected function
   LFLAG_ASSUMED_TAB   = $20000000;  // this cell line assumes a decimal tab in the beginning of the line
   LFLAG_AUTONUMLGL    = $40000000;  // has an autonumlgl field in the line

   INFO_TAB            = $1;
   INFO_SECT           = $2;
   INFO_PAGE           = $4;
   INFO_COL            = $8;
   INFO_CELL           = $10;
   INFO_ROW            = $20;
   INFO_TABLE          = $40;
   INFO_JUST           = $80;
   INFO_FRAME          = $400;
   INFO_SPACE_LINE     = $800;
   INFO_PAGE_NUMBER    = $1000;


   REL_SCREEN          =  0;
   REL_WINDOW          =  1;
   REL_TEXT_BOX        =  2;

   ACTION_COMMAND      = 1;
   ACTION_VSCROLL      = 2;
   ACTION_HSCROLL      = 3;
   ACTION_CHAR         = 4;
   ACTION_LBUTTONDOWN  = 5;
   ACTION_RBUTTONDOWN  = 6;
   ACTION_LBUTTONUP    = 7;
   ACTION_RBUTTONUP    = 8;
   ACTION_LBUTTONDBLCLK = 9;
   ACTION_RBUTTONDBLCLK = 10;
   ACTION_SIZE         = 11;
   ACTION_SETFOCUS     = 12;
   ACTION_KILLFOCUS    = 13;
   ACTION_MOUSEMOVE    = 14;
   ACTION_QUERYENDSESSION =15;
   ACTION_CHECKBOX        =16;
   ACTION_MOUSELEAVE      =17;
   ACTION_MBUTTONDOWN     =18;
   ACTION_MBUTTONUP       =19;
   ACTION_MBUTTONDBLCLK   =20;
   ACTION_ROW_INDENT      =21;
   ACTION_ROW_HEIGHT      =22;
   ACTION_CELL_WIDTH      =23;
   ACTION_PICT_SIZE       =24;
   ACTION_FRAME_SIZE      =25;
   ACTION_REPLACESEL      =26;
   ACTION_DRAG_DEL        =27;
   ACTION_DRAGON          =28;

   BLT_ROUND             =1;             // 20101228: incremented the values so that 0 is not used for BLT_ROUND
   BLT_DIAMOND           =2;
   BLT_SQUARE            =3;
   BLT_HOLLOW_SQUARE     =4;
   BLT_4_DIAMONDS        =5;
   BLT_ARROW             =6;
   BLT_CHECK             =7;

   BLTFLAG_HIDDEN        =$1;

   NBR_DEC               =0;
   NBR_UPR_ALPHA         =1;
   NBR_LWR_ALPHA         =2;
   NBR_UPR_ROMAN         =3;
   NBR_LWR_ROMAN         =4;

   PID_LINE              =0;
   PID_PARA              =1;
   PID_BULLET            =2;
   PID_TAB               =3;
   PID_STYLE             =4;

   CFLAG_VALIGN_CTR      = $1000;
   CFLAG_VALIGN_BOT      = $2000;
   CFLAG_FIX_WIDTH       = $100;
   CFLAG_FIX_WIDTH_PCT   = $200;
   CFLAG_VALIGN_BASE     = $10000;

   SCOPE_BEGIN           =0;
   SCOPE_FORWARD         =1;
   SCOPE_BACKWARD        =2;

   PARA_FRAME_HPAGE      = $1;
   PARA_FRAME_USED       = $2;
   PARA_FRAME_RIGHT_JUST = $4;
   PARA_FRAME_CENTER     = $8;
   PARA_FRAME_SET_WIDTH  = $10;
   PARA_FRAME_VPAGE      = $20;
   PARA_FRAME_VMARG      = $40;
   PARA_FRAME_TEXT_BOX   = $80;
   PARA_FRAME_LINE       = $100;
   PARA_FRAME_RECT       = $200;
   PARA_FRAME_BOXED      = $400;
   PARA_FRAME_DOTTED     = $800;
   PARA_FRAME_SELECT     = $1000;
   PARA_FRAME_NO_WRAP    = $2000;
   PARA_FRAME_WRAP_THROUGH = $4000;
   PARA_FRAME_POSITIONED = $8000;
   PARA_FRAME_FILL_PICT  = $800000;

   PF2_END_ARROW          = $1;        // draw arrow head at the end point
   PF2_START_ARROW        = $2;        // draw arrow head at the start point
   PF2_FLIPH              = $4;        // indicates a horizontal flip
   PF2_FLIPV              = $8;        // indicates a vertical flip
   PF2_VBOTTOM           = $10;        // bottom aligned frame
   PF2_PVPARA            = $20;        // set when \pvpara encountered
   PF2_CANVAS            = $40;        // is canvas
   PF2_INLINE            = $80;        // inline
   PF2_HTML_RULE         = $100;       // html ruler
   PF2_ANCHOR_IN_CELL    = $200;       // anchor for this shape is inside a table cell
   PF2_SET_HEIGHT        = $400;       // set height for the frame automatically
   PF2_HIDDEN            = $800;       // hidden para-frame
   PF2_LEFT             = $1000;       // left justified
   PF2_NO_DELETE        = $2000;       // do not allow deletion of this frame
   PF2_NO_MOVE          = $4000;       // do not allow movement
   PF2_NO_SIZE          = $8000;       // do not allow sizing

   SECT_ALL              = -1;
   SECT_CUR              = -2;

   PARAM_IGNORE          =-31234;

   FIELD_PAGE_NUMBER    = 1;
   FIELD_TEXTBOX        = 2;
   FIELD_CHECKBOX       = 3;
   FIELD_LISTBOX        = 4;
   FIELD_PAGE_COUNT     = 5;
   FIELD_NAME           = 6;
   FIELD_DATA           = 7;
   FIELD_DATE           = 8;
   FIELD_TOC            = 9;
   FIELD_PRINTDATE      =10;
   FIELD_LISTNUM        =11;
   FIELD_AUTONUMLGL     =12;
   FIELD_TC             =13;
   FIELD_HLINK          =14;
   FIELD_XE             =15;
   FIELD_PAGE_REF       = 16;
   FIELD_SECT_PAGE_COUNT =17;

   TER_FIRST            = 0;
   TER_LAST             = 1;
   TER_NEXT             = 2;
   TER_PREV             = 4;
   TER_CUR              = 5;

   WC_SELECTION         = $1;
   WC_INCLUDE_HDR_FTR   = $2;
   WC_INCLUDE_HIDDEN    = $4;

   TERTAG_USER             = 0;
   TERTAG_BKM              = 1;


   LIST_DEC              =0;
   LIST_UPR_ROMAN        =1;
   LIST_LWR_ROMAN        =2;
   LIST_UPR_ALPHA        =3;
   LIST_LWR_ALPHA        =4;
   LIST_ORDINAL          =5;
   LIST_CARDINAL         =6;
   LIST_ORDINAL_TEXT     =7;
   LIST_DEC_PAD          =22;
   LIST_BLT              =23;
   LIST_NO_NUM           =255;

   LISTFLAG_RESTART_SEC =$1;

   LISTAFT_TAB           =0;
   LISTAFT_SPACE         =1;
   LISTAFT_NONE          =2;

   LISTLEVEL_RESTART     =$1;
   LISTLEVEL_OLD         =$2;
   LISTLEVEL_RESTARTED   =$4;
   LISTLEVEL_LEGAL       =$8;
   LISTLEVEL_REFORMAT    =$10;
   LISTLEVEL_NO_RESET    =$20;


   { **************** Command ids **************** }

   ID_PGUP         =600;
   ID_PGDN         =601;
   ID_UP           =602;
   ID_DOWN         =603;
   ID_LEFT         =604;
   ID_RIGHT        =605;
   ID_DEL          =606;
   ID_TAB          =608;
   ID_BACK_TAB     =609;
   ID_LINE_BEGIN   =610;
   ID_LINE_END     =611;
   ID_FILE_BEGIN   =612;
   ID_FILE_END     =613;
   ID_CTRL_TAB     =614;
   ID_INS_AFT      =615;
   ID_INS_BEF      =616;
   ID_DEL_LINE     =617;
   ID_SPLIT_LINE   =618;
   ID_JOIN_LINE    =619;
   ID_NEXT_WORD    =620;
   ID_PREV_WORD    =621;
   ID_HILIGHT_LINE =622;
   ID_BLOCK_COPY   =623;
   ID_BLOCK_MOVE   =624;
   ID_SELECT_ALL   =625;
   ID_NEW          =626;
   ID_OPEN         =627;
   ID_CUT          =628;
   ID_COPY         =629;
   ID_PASTE        =630;
   ID_PASTE_SPEC   =631;

   ID_PICT_FROM_FILE =632;
   ID_EMBED_PICT   =632;

   ID_SEARCH       =633;
   ID_SEARCH_FOR   =634;
   ID_SEARCH_BACK  =635;
   ID_REPLACE      =636;
   ID_TER_HELP     =637;
   ID_UNDO         =638;
   ID_INSERT       =639;
   ID_SAVE         =640;
   ID_SAVEAS       =641;
   ID_QUIT         =642;
   ID_PRINT        =643;
   ID_PAGE_OPTIONS =644;
   ID_PRINT_OPTIONS =645;
   ID_JUMP         =646;

   ID_CHAR_NORMAL  =647;
   ID_BOLD_ON      =648;
   ID_ULINE_ON     =649;
   ID_ITALIC_ON    =650;
   ID_STRIKE_ON    =651;
   ID_SUPSCR_ON    =652;
   ID_SUBSCR_ON    =653;

   ID_COLOR        =654;

   ID_FONTS        =655;

   ID_PARA_NORMAL  =656;
   ID_CENTER       =657;
   ID_RIGHT_JUSTIFY =658;
   ID_LEFT_INDENT  =659;
   ID_RIGHT_INDENT =660;
   ID_DOUBLE_SPACE =661;
   ID_HANGING_INDENT =662;
   ID_JUSTIFY      =663;

   ID_TAB_CLEAR     =666;
   ID_TAB_CLEAR_ALL =667;

   ID_PAGE_BREAK    =670;
   ID_REPAGINATE    =671;
   ID_SECT_BREAK    =672;
   ID_SECT_OPTIONS  =673;
   ID_PAGE_MODE     =674;
   ID_COL_BREAK     =675;
   ID_VIEW_HDR_FTR  =676;
   ID_EDIT_HDR_FTR  =677;

   ID_RULER         =680;
   ID_TOOL_BAR      =681;
   ID_STATUS_RIBBON =682;

   ID_EDIT_PICT     =685;
   ID_SHOW_HIDDEN   =686;
   ID_HIDDEN_ON     =687;
   ID_ULINED_ON     =688;
   ID_PROTECT_ON    =689;
   ID_PROTECTION_LOCK =690;

   ID_PARA_BORDER    =691;
   ID_SHOW_PARA_MARK =692;
   ID_INSERT_OBJECT  =693;

   ID_TABLE_INSERT       =694;
   ID_TABLE_INSERT_ROW   =695;
   ID_TABLE_SPLIT_CELL   =696;
   ID_TABLE_MERGE_CELLS  =697;
   ID_TABLE_DEL_CELLS    =698;
   ID_TABLE_SHOW_GRID    =699;
   ID_TABLE_ROW_POS      =700;
   ID_TABLE_CELL_BORDER  =701;
   ID_TABLE_CELL_SHADE   =702;
   ID_TABLE_ROW_HEIGHT   =703;
   ID_TABLE_INSERT_COL   =704;
   ID_TABLE_SPLIT_CELL_VERT  = 705;

   ID_SHOW_HYPERLINK_CURSOR  =710;
   ID_BK_COLOR           =711;

   ID_CTRL_UP            =715;
   ID_CTRL_DOWN          =716;
   ID_PRINT_PREVIEW      =717;

   ID_INSERT_PARA_FRAME  =718;
   ID_INSERT_PAGE_NUMBER =719;

   ID_PARA_SPACING       =720;
   ID_INSERT_FNOTE       =721;
   ID_EDIT_FNOTE         =722;
   ID_PARA_KEEP          =723;
   ID_PARA_KEEP_NEXT     =724;
   ID_BOX_ON             =725;
   ID_INSERT_DRAW_OBJECT =726;

   ID_EDIT_OLE           =727;
   ID_SNAP_TO_GRID       =728;
   ID_BULLET             =729;

   ID_EDIT_STYLE         =730;
   ID_CHAR_STYLE         =731;
   ID_PARA_STYLE         =732;
   ID_ZOOM               =733;
   ID_TAB_SET            =734;
   ID_FRAME_YBASE        =735;
   ID_EDIT_DOB           =736;
   ID_BKND_PICT          =737;
   ID_LINK_PICT          =738;

   ID_FITTED_VIEW        =739;
   ID_INSERT_NBSPACE     =740;
   ID_SPELL              =741;
   ID_HLINK_ON           =742;
   ID_WIDOW_ORPHAN       =743;
   ID_SHOW_PAGE_BORDER   =744;
   ID_SHOW_LAYOUT        =744;
   ID_DEL_PREV_WORD      =745;
   ID_INSERT_NBDASH      =746;
   ID_REDO               =747;
   ID_PARA_NBR           =748;
   ID_PARA_BK_COLOR      =749;
   ID_TABLE_CELL_VALIGN  =750;
   ID_TABLE_SEL_COL      =751;
   ID_INSERT_PAGE_COUNT  =752;
   ID_INSERT_BOOKMARK    =753;
   ID_CREATE_FIRST_HDR   =754;
   ID_CREATE_FIRST_FTR   =755;
   ID_DELETE_FIRST_HDR   =756;
   ID_DELETE_FIRST_FTR   =757;
   ID_SHOW_FIELD_NAMES   =758;
   ID_INSERT_HYPH        =759;
   ID_CHAR_SPACE         =760;
   ID_INLINE_IME         =761;
   ID_TABLE_HDR_ROW      =762;
   ID_RETURN             =763;
   ID_TABLE_ROW_KEEP     =764;
   ID_TABLE_CELL_COLOR   =765;
   ID_INSERT_DATA_FIELD  =766;
   ID_INSERT_INPUT_FIELD =767;
   ID_INSERT_CHECKBOX    =768;
   ID_EDIT_INPUT_FIELD   =769;
   ID_INSERT_DATE_TIME   =770;
   ID_INSERT_TOC         =771;
   ID_LEFT_JUSTIFY       =772;
   ID_PAGE_BREAK_BEFORE  =773;
   ID_CAPS_ON            =774;
   ID_SCAPS_ON           =775;
   ID_AUTO_SPELL         =776;
   ID_INSERT_ENOTE       =777;
   ID_EDIT_ENOTE         =778;
   ID_CREATE_LIST        =779;
   ID_EDIT_LIST          =780;
   ID_CREATE_LIST_OR     =781;
   ID_EDIT_LIST_OR       =782;
   ID_EDIT_LIST_LEVEL    =783;
   ID_PARA_LIST          =784;
   ID_LEFT_INDENT_DEC    =785;
   ID_TABLE_CELL_BORDER_COLOR  = 786;
   ID_PASTE_TEXT         =787;
   ID_TABLE_CELL_WIDTH   =788;
   ID_FRAME_ROTATE_TEXT  =789;
   ID_PARA_RTL           =790;
   ID_TABLE_ROW_RTL      =791;
   ID_SECT_RTL           =792;
   ID_DOC_RTL            =793;
   ID_INSERT_HLINK       =794;
   ID_OVERRIDE_BIN       =795;
   ID_TRACK_CHANGES      =796; 
   ID_ULINE_COLOR        =797;
   ID_LIST_LEVEL_INC     =798;
   ID_LIST_LEVEL_DEC     =799;
   ID_BORDER_MARGIN      =800;
   ID_PROTECT_FORM       =801;
   ID_WATERMARK          =802;
   ID_TABLE_CELL_VTEXT   =803;
   ID_NEXT_CHANGE        =804;
   ID_PREV_CHANGE        =805;
   ID_ACCEPT_CHANGE      =806;
   ID_ACCEPT_ALL_CHANGES =807;
   ID_USER1              =808;
   ID_USER2              =809;
   ID_USER3              =810;
   ID_USER4              =811;
   ID_USER5              =812;
   ID_USER6              =813;
   ID_USER7              =814;
   ID_USER8              =815;
   ID_USER9              =816;
   ID_DEL_NEXT_WORD      =817;
   ID_CHAR_SCALEX        =818;
   ID_REJECT_CHANGE      =819;
   ID_REJECT_ALL_CHANGES =820;
   ID_VRULER             =821;
   ID_PARA_RTL_KEY       =822;
   ID_PARA_LTR_KEY       =823;
   ID_CREATE_RIGHT_HDR   =824;
   ID_CREATE_RIGHT_FTR   =825;
   ID_DELETE_RIGHT_HDR   =826;
   ID_DELETE_RIGHT_FTR   =827;
   ID_CREATE_LEFT_HDR    =828;
   ID_CREATE_LEFT_FTR    =829;
   ID_DELETE_LEFT_HDR    =830;
   ID_DELETE_LEFT_FTR    =831;

   ID_DOUBLE_STRIKE_ON   =832;
   ID_HIDE_CHANGES       =833;
   ID_INSERT_COMBOBOX    =834;
   ID_APPLY_COMMENT      =835;
                                   
   ID_NUM_TO_CHAR        =836;

   ID_PAINT_FORMAT       =837;
   ID_HILIGHT_TEXT       =838;

   ID_INSERT_OLE_FROM_FILE  =839;

   TLB_LINE             =1;
   TLB_TYPEFACE         =2;
   TLB_POINTSIZE        =3;
   TLB_BOLD             =4;
   TLB_ITALIC           =5;
   TLB_ULINE            =6;
   TLB_ALIGN_LEFT       =7;
   TLB_ALIGN_RIGHT      =8;
   TLB_ALIGN_CENTER     =9;
   TLB_ALIGN_JUSTIFY    =10;
   TLB_INC_INDENT       =11;
   TLB_DEC_INDENT       =12;
   TLB_STYLE            =13;
   TLB_ZOOM             =14;
   TLB_CUT              =15;
   TLB_COPY             =16;
   TLB_PASTE            =17;
   TLB_SPACER           =18;
   TLB_NEW              =19;
   TLB_OPEN             =20;
   TLB_SAVE             =21;
   TLB_PRINT            =22;
   TLB_HELP             =23;
   TLB_PAR              =24;
   TLB_PREVIEW          =25;
   TLB_NUMBER           =26;
   TLB_BULLET           =27;
   TLB_UNDO             =28;
   TLB_REDO             =29;
   TLB_FIND             =30;
   TLB_DATE             =31;
   TLB_PAGE_NUM         =32;
   TLB_PAGE_COUNT       =33;
   MAX_TLB              =34;

{***********************************************************************
    Message Ids
************************************************************************}

   MSG_NO_ERROR              = 0;
   MSG_BAD_BMP_FILE          = 1;
   MSG_BAD_FNOTE_MARKER      = 2;
   MSG_BAD_OBJ_SIZE          = 3;
   MSG_BAD_PRINTER_DRV       = 4;
   MSG_CELL_DATA_MISSING     = 5;
   MSG_CELL_WITHOUT_ROW      = 6;
   MSG_CHARSTYLE_IN_USE      = 7;
   MSG_CHAR_FMT_MISSING      = 8;
   MSG_CLIPBOARD_BUSY        = 9;
   MSG_CLIPBOARD_NO_DATA     = 10;
   MSG_CLIPBOARD_NO_FMT      = 11;
   MSG_COUNT_MISMATCH        = 12;
   MSG_CREATE_NEW_FILE       = 13;
   MSG_END_BACKWARD_SEARCH   = 14;
   MSG_END_FORWARD_SEARCH    = 15;
   MSG_ERR_ADDING_STRING     = 16;
   MSG_ERR_ADDING_VALUE      = 17;
   MSG_ERR_ADVISE_CONNECT    = 18;
   MSG_ERR_ADV_CREATE        = 19;
   MSG_ERR_BLOCK_SIZE        = 20;
   MSG_ERR_BMP_CREATE        = 21;
   MSG_ERR_CTL_CREATE        = 22;
   MSG_ERR_DATA_RETRIEVE     = 23;
   MSG_ERR_DIB_CREATE        = 24;
   MSG_ERR_END_PAGE          = 25;
   MSG_ERR_END_PRINTER       = 26;
   MSG_ERR_FILE_LENGTH       = 27;
   MSG_ERR_FILE_OPEN         = 28;
   MSG_ERR_FILE_READ         = 29;
   MSG_ERR_FILE_SEEK         = 30;
   MSG_ERR_FILE_WRITE        = 31;
   MSG_SEL_PROTECTED         = 32;
   MSG_SPELL_OVER            = 33;
   MSG_STYLESHEET_MISSING    = 34;
   MSG_TAB_TBL_MISSING       = 35;
   MSG_TBL_DATA_MISSING      = 36;
   MSG_TYPE_STYLE_NAME       = 37;
   MSG_UNDO_EMPTY            = 38;
   MSG_UNEXPECTED_EOF        = 39;
   MSG_SEL_SPAN_HDRFTR       = 40;
   MSG_SECT_TBL_MISSING      = 41;
   MSG_ERR_FONT_CREATE       = 42;
   MSG_ERR_FONT_SELECT       = 43;
   MSG_ERR_INIT_BMP          = 44;
   MSG_ERR_INIT_OLE          = 45;
   MSG_ERR_INIT_PRINTER      = 46;
   MSG_ERR_INSTANCE          = 47;
   MSG_ERR_LOAD_ACCEL        = 48;
   MSG_ERR_MAIL_MERGE        = 49;
   MSG_ERR_MEM_LOCK          = 50;
   MSG_ERR_META_ACCESS       = 51;
   MSG_ERR_META_BAD_FILE     = 52;
   MSG_ERR_META_COPY         = 53;
   MSG_ERR_META_CREATE       = 54;
   MSG_ERR_META_READ         = 55;
   MSG_ERR_META_RECREATE     = 56;
   MSG_ERR_OBJ_DATA          = 57;
   MSG_ERR_OBJ_SAVE          = 58;
   MSG_ERR_OBJ_SIZE          = 59;
   MSG_ERR_OLE_CLSID         = 60;
   MSG_ERR_OLE_DATA_CONV     = 61;
   MSG_ERR_OLE_LOAD          = 62;
   MSG_ERR_OLE_SAVE          = 63;
   MSG_ERR_OLE_USER          = 64;
   MSG_ERR_OLE_VERSION       = 65;
   MSG_ERR_PEN               = 66;
   MSG_ERR_PICT_FILE_FMT     = 67;
   MSG_ERR_PICT_FILE_OPEN    = 68;
   MSG_ERR_PICT_FILE_READ    = 69;
   MSG_ERR_PRESENT_DATA      = 70;
   MSG_ERR_SITE_CREATE       = 71;
   MSG_ERR_START_PRINTER     = 72;
   MSG_ERR_STORAGE_CREATE    = 73;
   MSG_ERR_STORAGE_RETRIEVE  = 74;
   MSG_ERR_TEXT_METRIC       = 75;
   MSG_ERR_VIEW_RETRIEVE     = 76;
   MSG_FILE_INFO_MISSING     = 77;
   MSG_FILE_SIGN_MISSING     = 78;
   MSG_FONT_TBL_INCOMPL      = 79;
   MSG_INVALID_NUMBER        = 80;
   MSG_INVALID_PRINT_RECT    = 81;
   MSG_INVALID_SECT_DATA     = 82;
   MSG_INVALID_SELECT        = 83;
   MSG_KEEP_HDRFTR_LINE      = 84;
   MSG_LINE_TOO_LONG         = 85;
   MSG_LINE_TRUNCATED        = 86;
   MSG_MARGIN_TOO_LARGE      = 87;
   MSG_MAX_LINES_EXCEEDED    = 88;
   MSG_MERGE_DATA_TOO_LONG   = 89;
   MSG_MISSING_ROW_MARKER    = 90;
   MSG_NODEL_HDRFTR_BODY     = 91;
   MSG_NOT_TE_FILE           = 92;
   MSG_NO_HILIGHT            = 93;
   MSG_NO_OLE_CLASS          = 94;
   MSG_NO_RANGE_PRINTING     = 95;
   MSG_NO_SERVER             = 96;
   MSG_NO_STRING             = 97;
   MSG_NULL_FIELD            = 98;
   MSG_OLEERR_NEED_SHARE     = 99;
   MSG_OLEERR_NO_CLASS      = 100;
   MSG_OUT_OF_CELL_SLOT     = 101;
   MSG_OUT_OF_CHAR_STACK    = 102;
   MSG_OUT_OF_COMP_DC       = 103;
   MSG_OUT_OF_DC            = 104;
   MSG_OUT_OF_DRAG_OBJ      = 105;
   MSG_OUT_OF_FONT_SLOT     = 106;
   MSG_OUT_OF_GROUP         = 107;
   MSG_OUT_OF_MEM           = 108;
   MSG_OUT_OF_PARA_SLOT     = 109;
   MSG_OUT_OF_PARAFID_SLOT  = 110;
   MSG_OUT_OF_RANGE         = 111;
   MSG_OUT_OF_ROW_SLOT      = 112;
   MSG_OUT_OF_STYLESHEET    = 113;
   MSG_OUT_OF_TAB_POS       = 114;
   MSG_OUT_OF_TAB_TABLE     = 115;
   MSG_OUT_OF_TASK          = 116;
   MSG_OUT_OF_WIN_SLOTS     = 117;
   MSG_PARASTYLE_IN_USE     = 118;
   MSG_PARA_FMT_MISSING     = 119;
   MSG_PARA_TBL_INCOMPL     = 120;
   MSG_PFRAME_DATA_MISSING  = 121;
   MSG_PRINT_AREA_SMALL     = 122;
   MSG_PROTECTED            = 123;
   MSG_READ_ABORTED         = 124;
   MSG_REPLACE_STRING       = 125;
   MSG_SAVE_INCOMPL         = 126;
   MSG_SAVE_MODS            = 127;
   MSG_SECTION_FULL         = 128;
   MSG_BAD_WIN_HANDLE       = 129;
   MSG_BAD_VERSION          = 130;
   MSG_NODEL_MIX_HTML       = 131;
   MSG_ERR_TOO_MANY_FILES   = 132;
   MSG_ERR_FILE_ACCESS      = 133;
   MSG_REDO_EMPTY           = 134;
   MSG_OUT_OF_BLT_TABLE     = 135;
   MSG_BULLET_MISSING       = 136;
   MSG_BAD_JPG_FILE         = 137;
   MSG_ERR_JPG_HUFF         = 138;
   MSG_ERR_JPG_MARKER       = 139;
   MSG_ERR_JPG_NO_HUFF      = 140;
   MSG_TAG_TABLE_MISSING    = 141;
   MSG_ERR_ENH_META_HDR     = 142;
   MSG_GET_ENH_META         = 143;
   MSG_MAX_WIN_LINES        = 144;
   MSG_SOFT_PAGE_BREAK      = 145;
   MSG_SECT_BREAK           = 146;
   MSG_PAGE_BREAK           = 147;
   MSG_COL_BREAK            = 148;
   MSG_PAGE_HDR             = 149;
   MSG_PAGE_FTR             = 150;
   MSG_ROW_BREAK            = 151;
   MSG_DEL_DRAW_OBJ         = 152;
   MSG_DEL_FRAME            = 153;
   MSG_IRREVERSIBLE_DEL     = 154;
   MSG_ERR_PRINT            = 155;
   MSG_FIRST_HDR            = 156;
   MSG_FIRST_FTR            = 157;
   MSG_DEL_FIRST_HDR        = 158;
   MSG_DEL_FIRST_FTR        = 159;
   MSG_BAD_PNG_DATA         = 160;
   MSG_PRINTING_CANCELLED   = 161;
   MSG_SMALL_CELL_MARGIN    = 162;
   MSG_READ_ONLY            = 163;
   MSG_NO_PRINTER           = 164;
   MSG_DEL_TOC              = 165;
   MSG_NO_RTF_INFO_BLOCK    = 166;
   MSG_NO_LIST_BLOCK        = 167;
   MSG_NO_LIST_OR_BLOCK     = 168;
   MSG_DEL_HDR              = 169;
   MSG_DEL_FTR              = 170;
   MSG_ERR_JPG_MCU          = 171;
   MSG_OUT_OF_IMAGE_MAP_TABLE = 172;
   MSG_COLUMNS             =173;
   MSG_GIF_FILES           =174;
   MSG_ENH_METAFILES       =175;
   MSG_BMP_FILES           =176; 
   MSG_METAFILES           =177; 
   MSG_JPG_FILES           =178; 
   MSG_PNG_FILES           =179; 
   MSG_PICTURE_SIZE        =180; 
   MSG_SINGLE              =181; 
   MSG_15LINES             =182; 
   MSG_DBL_LINE            =183; 
   MSG_EXACTLY             =184; 
   MSG_MULTIPLE            =185; 
   MSG_LINES               =186; 
   MSG_POINTS              =187; 
   MSG_TAB_POS             =188; 
   MSG_MARGIN              =189; 
   MSG_PNG_ABORT           =190; 
   MSG_FATAL_ERROR         =191; 
   MSG_FILE_OPEN           =192; 
   MSG_ERROR               =193; 
   MSG_SPL_DONE            =194; 
   MSG_BAD_RTF             =195; 
   MSG_UNKNOWN             =196;
   MSG_ATLEAST             =197; 
   MSG_PAGE_BOX = 198; 
   MSG_IGNORE_ALL          = 199; 
   MSG_ADD                 = 200; 
   MSG_SB_INS           =201;
   MSG_SB_OT            =202;
   MSG_SB_PAGE          =203;
   MSG_SB_LINE          =204;
   MSG_SB_ROW           =205;
   MSG_SB_COL           =206;
   MSG_PP_ONE_PAGE      =207;
   MSG_PP_TWO_PAGES     =208;
   MSG_PP_PRINT         =209;
   MSG_PP_EDIT          =210;
   MSG_PP_PG            =211;
   MSG_PP_FITTED        =212;
   MSG_TIFF             =213;
   MSG_TIF_FILES        =214;
   MSG_INVOKE_TEXT_LINK =215;
   MSG_NO_REVIEWER_BLOCK =216;
   MSG_INSERTED_BY       = 217;
   MSG_DELETED_BY        = 218;
   MSG_NO_CHANGED_TEXT   = 219;
   MSG_ACCEPT_CHANGES    = 220;
   MSG_CHANGES_COUNT     = 221;
   MSG_REJECT_CHANGES    = 229;
   MSG_REJECT_COUNT      = 230;
   MSG_DATA_TOO_BIG      = 231;
   MSG_PAGE_LHDR         = 232;
   MSG_PAGE_LFTR         = 233;
   MSG_PAGE_RHDR         = 234;
   MSG_PAGE_RFTR         = 235;
   MSG_XML_READER        = 236;
   MSG_OLD_XML_LIB       = 237;
   MSG_HTML_ADD_ON       = 238;
   MSG_FMT_BY            = 239;
   MSG_PDF               = 240;
   MSG_PARA_FMT_BY       = 241;
   MSG_LOAD_LIBRARY      = 242;

{******************************************************************************
               TER Messages
*******************************************************************************}

{*******************************************************************************
   TER_CLOSE:
   Ter sends this message to the parent window (your application window)
   before closing.  The wParam variables contains the handle of the TER
   window.  lParam is not used.

   If your application is using a GlobalBuffer, you can retrieve the updated
   buffer when receiving this message. Use the GetTerBuffer() function to
   retrived the global handle to updated text data.
*******************************************************************************}
TER_CLOSE    =(WM_USER+1700);

{*******************************************************************************
   TER_MODIFIED:
   Ter sends this message to the parent window once when the editor text is
   modified. The wParam variable contains the handle of the TER window.
*******************************************************************************}
 TER_MODIFIED  =(WM_USER+1701);

{*******************************************************************************
   TER_LINK:
   Ter sends this message to the parent window when the user clicks on
   the hyperlink text.
*******************************************************************************}
 TER_LINK =(WM_USER+1702);

{*******************************************************************************
   TER_MERGE:
   Ter sends this message to the parent window to get the mail merge field
   data for a field name.  The TerMergePrint function first checks the
   supplied list of mail merge code.  Only if the required code is not
   found in the input list, it sends this message.
   The 'wParam' parameter contains the handle to the TER window, and
   the 'lParam' parameter contains the pointer to the field name.
   Your applicaton should return the pointer to the field text, or NULL if text not available.
*******************************************************************************}
TER_MERGE =(WM_USER+1703);

{*******************************************************************************
   TER_NOT_SAVED:
   Ter sends this message to the parent window (your application window)
   if the user abandons the modifications.
   The wParam variables contains the handle of the TER window.  lParam is not used.
   The TER_CLOSE message always follows this message.
*******************************************************************************}
 TER_NOT_SAVED  =  (WM_USER+1704);

{*******************************************************************************
   TER_UPDATE_TOOLBAR:
   This messages notifies your application to update any external toolbar that
   your application might be using.
*******************************************************************************}
 TER_UPDATE_TOOLBAR    =(WM_USER+1705);
 TER_UPDATE_STATUSBAR  =(WM_USER+1706);

{***********************************************************************
TER.PAS This function defines the API functions and constants in the TER DLL
for the use with Borland Delphi Application.  This file is to be included
in your program unit which calls a TER API function.  Use the '$I filename'
directive to include this file.
************************************************************************}

type
  {******************************************************************************
     Argument Structure:
     A set of control variables are passed by the user program to the
     'CreateTerWindow' routine. The variables are passed using the structure
     'arg_list',  as described below. The user program passes the POINTER to
     this structure.
     This file must be included by your application module that calls the
     TER routine.
  *******************************************************************************}
  arg_list = record
    x: integer;         { Initial x position of the editing window,
                          you may specify CW_USEDEFAULT to use default values.}
    y: integer;         { Initial y position of the editing window.}
    width: integer;     { Initial width of the window in device units,
                          you may specify CW_USEDEFAULT to use default values.}
    height: integer;    { Initial height of the editing window.  When you
                          use CW_USEDEFAULT for 'width', the 'height' is
                          ingnored.}
    LineLimit: LongInt; { Number of lines allowed in the editor window.
                          Set to 0 to have unlimited number of lines}

    WordWrap: LongBool;  { Set this flag to true (1),  if you wish to enable the
                          word wrapping feature. }
    PrintView: LongBool; { Set this flag to true if you wish the lines on
                          the screen to be wrapped current page margins.
                          Otherwise, the lines are wrapped at the end of
                          the window. This variable is ignored if 'WordWrap'
                          is set to FALSE }
    PageMode: LongBool;  { Set this flag to true if you wish to edit one page
                          at a time }
    FittedView: LongBool;{Set this flag to enable special PageMode where the
                          text wraps within the window width}
    ShowStatus: LongBool;{ show status line ?}
    ShowMenu: LongBool;  { show the menu bar ?}
    ShowHorBar: LongBool;{ show the horizonatal scroll bar }
    ShowVerBar: LongBool;{ show the vertical scroll bar }
    ruler: LongBool;     { True to show the ruler }
    ToolBar: LongBool;   { True to show the tool bar}
    UserCanClose: LongBool; { TRUE allows the user to close the window }
    BorderMargins: LongBool;{ display margins around the window borders }
    ReadOnly: LongBool;  { TRUE to create a read only session }

    InitLine: LongInt;  { Line number to position at the beginning. }
    InputType: byte;    { This flag specifies the input type. If you wish to
                          edit a file, set the input_type to 'F'. Conversely,
                          if you wish to pass the text for editing in a buffer,
                          set this field to 'B'.}

    FileName: array [1..299] of char;  { 20091022: increased from 131 to 299; If the input type is set to 'F',  specify the file
                          name for editing in this field. }

                        { ===== Buffer input fields only =======}
    hBuffer: THandle;   { Specify the global memory handle containing the
                          input text data.  This handle becomes the property
                          of the editor.  Your program must never try to lock
                          or free this handle }
    BufferLen: LongInt; { Buffer length in number of characters. }
    delim: Byte;        { Line delimiter character.  This character must be
                          used to delimit individual lines within the
                          text buffer. This character is typically set to
                          13 (carriage return)}

    padding1: array [1..3] of Byte;  { This field is not used }

    SaveFormat: Integer;   { The format of the output file:  SAVE_TER, SAVE_TEXT,
                          SAVE_RTF and SAVE_AS_INPUT }

    hInst: THandle;     { Handle of the current instanaces. }
    hParentWnd: THandle;{ Handle to the parent window }
    hTextWnd: THandle;  {  Ter main window handle, will be filled by TER later }
    style: LongInt;     {  Editor window style }
    FontTypeFace: array [1..28] of char; { Default type face, example:  TmwRmn Courier, etc }
    PointSize: integer; { point size of the default font face }

    open: LongBool;      { TRUE indicates an open window }
    modified: integer;  { For internal use }
  end;

{*****************************************************************************
  Field Data Structure:
  This structure is used to retrieve (GetTerFields()) and set (SetTerFields())
  control fields for a TER window.
******************************************************************************}
  StrTerField = record
       { *********************************************************************
         The following fields are read/write fields.  To update a field,
         you must retrieve the current values by calling the GetTerFields function.
         Modify the fields that you wish to, and then call the SetTerFields
         function to make the new value effective
         *********************************************************************}
      size: Integer;            {size of the structure used for version matching}

      CurCol,                   {current window column position}
      PaintEnabled,             {FALSE=disables the painting and word wrapping }
      WrapFlag : Integer;       {wrap control, see WRAP_ constants }

      CurRow,                   {current window row position }
      BeginLine,                {line number of the first window line }
      CurLine : LongInt;        {current line number in the file }

      TextBkColor,              {background color for text }
      StatusBkColor,            {background color of the status line }
      StatusColor : TColorRef;  {foreground color of the status line}

      HilightType,              {line or character block, see HILIGHT_ constants}
      HilightBegCol,            {beginning col}
      HilightEndCol : Integer;  {ending col}

      HilightBegRow,            {beginning row}
      HilightEndRow : LongInt;  {ending row}

      StretchHilight : LongBool;{TRUE = highlight being stretch }


      { please do not use following two fields as they are being phased out.
        To get the text and font information, use TerGetLine function instead.}
      text,                     {line text data, NULL terminated}
      font : array [1..MAX_WIDTH] of char;  {font id for every character in the 'text' array }

      pfmt : Integer;           {paragraph id of the current line }
      LineLen : Integer;        {length of the 'text' array}

      TextApply : Integer;      { use this variable to specify how the 'text'
                                  and 'font' data should be applied to the
                                  current TER window, see APPLY_ constants }

      ReclaimResources: LongBool;  {reuse unused font and para ids}

      ModifyProtectColor,        { modify the color or the protected text}
      LinkDblClick,              { TRUE to activate hyperlink on double click, otherwise use single click}
      ShowProtectCaret: LongBool;{ TRUE to show caret on the protected text}

      LinkStyle: Integer;        { character style of the hyperlink phrase}
      LinkColor: TColorRef;      { color of the linked phrase}

      SnapToGrid: LongBool;      { TRUE to snap ruler items to an invisible grid}

      HtmlMode,                  { TRUE to enable html adjustments}
      ShowTableGridLines: LongBool;  {TRUE to show table grid lines}

      {*************************************************************************
       The following are the read only fields.  TER will ignore any
       modification to these fields.
      *************************************************************************}

      hTerWnd : THandle;        {handle to the editor window }
      hTerDC : THandle;             {handle to TER class DC}

      TerRect,                  {entire client window rectangal}
      TerWinRect : TRect;       {text window rectangal}

      TotalLines,               {total lines in the file}
      MouseLine,                {text line position of mouse}
      MaxColBlock : LongInt;    {biggest column block allowed}

      TotalPfmts,               {total paragraph ids in use by the current window }
      TotalFonts,               {Total font objects in use by the current window }
      TotalStyles,              {Total number of styles}

      WinWidth,                 {current window in columns}
      WinHeight,                {current window height in number of rows}
      TerWinOrgX,               {window origin x co-ordinates}
      MouseCol : Integer;       {text column position of mouse}

      modified: Integer;        {data modified, user needs to select the 'save' option to save data }
      WordWrap: LongBool;       {TRUE when wordwrap turned on}

      ParaLeftIndent,           {paragraph left indent in twips}
      ParaRightIndent,          {paragraph right indent in twips}
      ParaFirstIndent,          {paragraph first line indent in twips}
      ParaFlags,                {paragraph flags,includes such flags as double spacing,centering, right justify etc}
      ParaTabId,                {paragraph tab id, index into the tab table}
      ParaCellId,               {paragraph cell id that the paragraph belongs to}
      ParaShading,              {paragraph shading (0 to 10000)}
      ParaFrameId,              {paragraph frame id }
      ParaSpaceBefore,          {paragraph space before in twips}
      ParaSpaceAfter,           {paragraph space after in twips}
      ParaSpaceBetween,         {paragraph space between the lines in twips}
      ParaStyleId,              {paragraph style id}
      ParaAuxId,                {paragraph aux id}
      pflags: Integer;          {PFLAG_ paragraph flags}

      CurSect : Integer;        {current section number}

      LeftMargin,               {section left margin in twips}
      RightMargin,              {section right margin in twips}
      TopMargin,                {section top margin in twips}
      BotMargin,                {section bottom margin in twips}
      columns : Integer;        {number of columns in the current section}

      CurPage : Integer;         {current page number}
      TotalPages : Integer;      {total pages}

      MouseX: Integer;           { last mouse x position}
      MouseY: Integer;           { last mouse y position}

      PrintViewW: LongBool;      { TRUE when the print view mode is turned on}
      PageModeW: LongBool;       { TRUE when the page mode is turned on}
      FittedViewW: LongBool;     { TRUE when the fitted view is turned on}
      ShowParaMarkW: LongBool;   { TRUE when showing the paramarkers }
      ShowHiddenTextW: LongBool; { TRUE when showing the hidden text }

      CurCtlIdW: Integer;        { currently selected control id}
      ParaFrameFlagsW: Integer;  { para frame flags }
  end;

{******************************************************************************
   Print request parameter structure
   This structure is used to call the 'TerMergePrint' function to print
   a buffer or file containing text data in supported formats (RTF, native TER,
   and Ascii).
*******************************************************************************}
  StrPrint = record
    InputType : AnsiChar;   { This flag specifies the input type. If you wish to
                         specify a disk file name, set the input_type to 'F'.
                         Conversely, if you wish to pass the text for in a buffer,
                         set this field to 'B'.}
    FileName: array [1..299] of AnsiChar;{  If the input type is set to 'F',  specify the input
                                        file name in this field. }

                     {===== Buffer input fields only =======}
    hBuffer: THandle; {  Specify the global memory handle containing the
                         input text data. }
    BufferLen: LongInt;  {  Buffer length in number of characters.}
    delim : AnsiChar;      {  Line delimiter character used to delimit the lines
                         in the input buffer.  This character can be a CR or
                         any other character. Not used for an RTF buffer }
    padding1 : array [1..3] of AnsiChar; { This field is not used}


    hDC: THandle;     { Printer or Window device context to print to.}
                      { If NULL, the default printer}
                      { device is opened.  The device context must be set to
                        the pixel mapping mode.}
    rect: Pointer;    { Pointer to a rectangle 'RECT' structure.
                        Printing area specified in mm (millimeter) units.
                        If NULL, the entire page with default margins is used.
                        The NULL value is not valid when printing to a
                        window device context }
    StartPos: LongInt;{ Starting character position.  Set to 0 to begin from
                        the first page.}
    OnePage: LongBool;{ Set to TRUE to print one (initial) page only.  The
                        printed page is NOT spooled to the printer.}
    NextPos: LongInt; { (OUTPUT) When OnePage is TRUE, the TerMergePrint function
                        returns the character where the next page should begin.
                        This value is set to 0 after the entire buffer is printed}

                     { ===== Mail merge fields ==================}
    MergeFields: PAnsiChar;     { pointer to a list of mail merge field names.
                               The fields must be separated  by a '|' character.
                               The list must be terminated by a NULL character}
    MergeData: PAnsiChar;       { pointer to a list of mail merge data values.
                               Each data vlue must be separated  by a '|' character.
                               The list must be terminated by a NULL character
                               The number of data elements in the MergeData
                               MUST be same as the number of elements in the
                               MergeFields array}

                     { ===== Other fields ==================}
    PrintHiddenText: LongBool;{ TRUE to print any hidden text }
    hInst: THandle;           { Instanaces handle of your program}
    hParentWnd: THandle;      { A window handle in your application to receive mail merge messages}

    NextY: Integer;            { (OUTPUT) The DLL returns the Y position on the paper}

    hMetaDC: THandle;          { Metafile device context to print to.  Set to NULL
                                 print to the hDC specified above or to the default
                                 printer.  When hMetaDC is not NULL, the hDC is
                                 used as an attribute device context.}
  end;

StrHyperLink  = record
      hWnd         : THandle ;  { Message windows}
      Code,                     { hyperlink code}
      Text : array [0..MAX_WIDTH+1] of char; { hyperlink text}
      DoubleClick  : LongBool;   { TRUE if mouse double clicked, otherwise single click}
      CodeW,                     { hyperlink code}
      TextW : array [0..MAX_WIDTH+1] of wchar; { hyperlink text}

end;
PStrHyperLink = ^StrHyperLink;


StrTab = record                                  {tab information}
    count: Integer;                               {number of tab stops}
    pos: array [0..MAX_TAB_STOPS-1] of Integer;  {tab stop position in twips}
    TabType: array [0..MAX_TAB_STOPS-1] of Integer; {tab type each stop, TAB_LEFT, TAB_RIGHT}
    flags: array [0..MAX_TAB_STOPS-1] of byte;    {Other TAB_ constants}
end;

