home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / tedevkit / ter1.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-05  |  63.8 KB  |  1,128 lines

  1. #include "custcntl.h"          // custom control structure definitions
  2. #include "ter_def.h"           // TER macro definitions
  3. #include "ter_cmd.h"           // TER command ids
  4. #include "ter_dlg.h"           // TER dialog control ids
  5.  
  6. /******************************************************************************
  7.     Sub structure which needs to be defined before the main StrTer structure.
  8. *******************************************************************************/
  9. struct StrRtfParaFrameInfo {            // para frame id information
  10.       int  x;                           // x position in twips
  11.       int  y;                           // y position in twips
  12.       int  width;                       // frame width in twips
  13.       int  height;                      // frame height in twips
  14.       int  DistFromText;                // frame distance from text
  15.       };
  16.  
  17. /******************************************************************************
  18.     The following structure is allocated for each window.  The structure
  19.     contains the global variables required for a window.  This structure
  20.     is deallocated when the window is closed.
  21. *******************************************************************************/
  22. typedef struct StrTer {
  23.      struct arg_list TerArgW;          // keep a copy of the user parametres
  24.  
  25.   /******************************************************************************
  26.      Text line data arrays
  27.   *******************************************************************************/
  28.      DWORD huge * hLineW;             // memory handle for each line 
  29.      int huge *   LineLenW;           // line length 
  30.      int huge *   LineHtW;            // line height
  31.      int huge *   LineYW;             // line y position
  32.      int huge *   LineXW;             // line x position from the begining of the frame
  33.      BYTE huge *  LineFlagsW;         // Paragraph run-time flags
  34.  
  35.      HANDLE hhLineW,hLineLenW,hLineHtW,hLineYW,hLineXW,hLineFlagsW; // handles for the above memory blocks 
  36.  
  37.   /******************************************************************************
  38.      Screen display control variables
  39.   *******************************************************************************/
  40.      HWND           hTerWndW;     // handle to TER Window 
  41.      HDC            hTerDCW,      // handle to TER class DC 
  42.                     hPrW;         // current printer device context
  43.      HFONT          hTerRegFontW, // regular fixed pitched font 
  44.                     hTerCurFontW, // current font in the display context
  45.                     hRulerFontW;  // Ruler font handle
  46.      TEXTMETRIC     TerTextMetW;  // TER text metric 
  47.      HCURSOR        hWaitCursorW; // handle to Hour glass cursor 
  48.      RECT           TerRectW,     // entire client window rectangal 
  49.                     TerWinRectW,  // text window rectangal 
  50.                     RulerRectW;   // ruler rectangle
  51.      HPEN           hPagePenW,    // pen to draw soft page break
  52.                     hColPenW,     // pen to draw hard column break
  53.                     hCellPenW,    // pen to draw cell break line
  54.                     hRowPenW;     // pen to drag table row break line
  55.      HBITMAP        hScrollBMW;   // stores scroll bits
  56.  
  57.      int     CurColW,             // current window column position                        
  58.              WinWidthW,           // current window in columns                       
  59.              WinHeightW,          // current window height in number of rows         
  60.              LineWidthW,          // maximum line width in number of characters                              
  61.              PaintFlagW,          // indicates scope of painting 
  62.              TabWidthW,           // tab width in number of characters               
  63.              HorScrollPosW,       // horizontal scroll position 
  64.              VerScrollPosW,       // vertical scroll position 
  65.              TerWinWidthW,        // window width in units 
  66.              TerWinHeightW,       // window height in units 
  67.              TerWinOrgXW,         // window origin x co-ordinates 
  68.              TerWinOrgYW,         // window origin y co-ordinates 
  69.              NextXW,              // logical X co-ordinate where next painting will begin 
  70.              NextTabW,            // next tab number while displaying a text line
  71.              NextSpaceW,          // next space number in a justified text
  72.              PaintEnabledW,       // When FALSE, disables the window painting 
  73.              WrapPendingW,        // wrapping postponed 
  74.              RulerPendingW,       // ruler painting postponed
  75.              RulerSectionW,       // section for which the ruler is displayed
  76.              PagingMarginW,       // number of lines to retail while PGUP and PGDN   
  77.              RulerFontHeightW,    // height of the ruler font
  78.              ScrResXW,            // screen resolution/inch in X direction
  79.              ScrResYW,            // screen resolution/inch in Y direction
  80.              PrtResXW,            // printer resolution/inch in X direction
  81.              PrtResYW,            // printer resolution/inch in Y direction
  82.              CurLineYW,           // Y position of the current line in PrintView mode
  83.              CurPageWidthW,       // Height of the current page
  84.              CurPageHeightW,      // Height of the current page
  85.              CurTextHeightW,      // Height of the text on the current page
  86.              CursHorzPosW,        // Horizontal cursor position or up/down key processing
  87.              OverhangFontW,       // font to cover the previous overhang
  88.              WinYOffsetW,         // offset of the first line with respect to top of the window 
  89.              CommandIdW,          // current Command Id
  90.              RepaintNoW;          // incremental number of this repaint
  91.  
  92.      long    CurRowW,             // current window row position                           
  93.              CurLineW,            // current line number in the file                       
  94.              BeginLineW,          // line number of the first window line                  
  95.              TotalLinesW,         // total lines in the file                               
  96.              MaxLinesW,           // maximum number of line space allocated
  97.              PaintBegLineW,       // first line to be painted
  98.              PaintEndLineW,       // last line to be painted
  99.              WinYOffsetLineW;     // First line with offset
  100.  
  101.      BOOL    CrNewLineW,          // create a new line when <CR> hit at the end of line 
  102.              CrSplitLineW,        // split the current line if <CR> was hit 
  103.              TabAlignW,           // Align tabs 
  104.              JoinLinesW,          // join the current line to the previous line when BKSP is hit  
  105.              NotifiedW,           // TRUE when modification message is sent to your application 
  106.              InAcceleratorW,      // TRUE when processing an accelerator key
  107.              RulerClickedW,       // TRUE when user clicks the ruler
  108.              FontsReleasedW,      // TRUE when the fonts are released
  109.              WindowDestroyedW,    // TRUE when processing WM_DESTROY message
  110.              ReclaimResourcesW;   // reuse unused font and para ids
  111.  
  112.      int     StatusRowPosW,       // logical unit position where status row number is printed 
  113.              StatusColPosW,       // logical unit position where status col number is printed 
  114.              StatusLinePosW;      // logical unit position where status line number is printed 
  115.  
  116.      HRGN    CurClipRgnW;         // current clip region handle
  117.   /******************************************************************************
  118.                     Text Frame variables
  119.   *******************************************************************************/
  120.       struct StrFrame {
  121.         BOOL   empty;            // TRUE if the frame does not contain text 
  122.         long   PageFirstLine,    // first line in the frame
  123.                PageLastLine,     // last line of the frame
  124.                ScrFirstLine,     // first line visible in the window
  125.                ScrLastLine;      // last line visible in the window 
  126.         int    x,                // frame X location relative to page
  127.                y,                // frame Y location relative to page
  128.                ScrX,             // X location of WinBeginLine
  129.                ScrY;             // Y location of WinBeginLine
  130.         int    width,            // width of the frame
  131.                height,           // height of the frame
  132.                TextHeight,       // height where the text ends
  133.                ScrWidth,         // width of the frame visible in the window
  134.                ScrHeight;        // height of the frame visible in the window
  135.         int    RowOffset;        // offset into the RowY,RowHeight & RowX arrays
  136.         int    sect;             // section to which this frame belongs
  137.         UINT   border;           // frame border, uses BORDER_ constants
  138.         int    BorderWidth[4];   // border width of each border
  139.         BOOL   LastColumnFrame;  // TRUE for the last frame of a column
  140.         int    RowId;            // for cell frames the row id of the table row
  141.         int    CellId;           // for cell frames the cell id of the frame
  142.         int    SpaceTop;         // space before the first line
  143.         int    SpaceBot;         // space after the last line
  144.         int    SpaceLeft;        // left margin
  145.         int    SpaceRight;       // right margin
  146.         int    shading;          // frame shading percent 0 to 100
  147.         int    ParaFrameId;      // para frame id
  148.         UINT   flags;            // FRAME_RIGHTMOST and other flags
  149.      } huge *frameW;
  150.  
  151.      HANDLE    hFrameW;          // handle for the above table
  152.      int       CurFrameW,        // current frame index
  153.                TotalFramesW,     // total number of frames
  154.                MaxFramesW,       // maximum number of frames allocated
  155.                FirstTextFrameW,  // first text frame
  156.                LastTextFrameW;   // last text frame
  157.  
  158.   /******************************************************************************
  159.                     Paragraph Frame variables
  160.   *******************************************************************************/
  161.       struct StrParaFrame {
  162.         BOOL   InUse;            // TRUE when in use
  163.         int    x;                // x position (twips) relative to left margin
  164.         int    y;                // y position (twips) relative to top margin
  165.         int    ParaY;            // y (twips) relative to the beginning of the next para
  166.         int    width;            // width in twips
  167.         int    margin;           // border margin
  168.         int    height;           // current height in twips
  169.         int    MinHeight;        // minimum height in twips
  170.         int    DistFromText;     // distance from the text text in twips
  171.         int    PageNo;           // page number to which this frame belongs
  172.         UINT   flags;            // PARA_FRAME_ flags
  173.         long   TextLine;         // used temporarily to store the corresponding text line
  174.      } huge *ParaFrameW;
  175.  
  176.      HANDLE    hParaFrameW;      // handle for the above table
  177.      int       CurParaFrameW,    // current para frame index
  178.                TotalParaFramesW; // total number of para frames
  179.  
  180.      BOOL      ContainsParaFramesW; // TRUE when a text frame contain paraframes
  181.   /******************************************************************************
  182.                     Screen Text Line Position Table
  183.   *******************************************************************************/
  184.         int    RowYW[MAX_LINES_PER_WIN],      // Y position of each row 
  185.                RowHeightW[MAX_LINES_PER_WIN], // pixel height of each screen row 
  186.                RowXW[MAX_LINES_PER_WIN];      // Starting X position of each row 
  187.  
  188.   /******************************************************************************
  189.                        Text segment structure
  190.   *******************************************************************************/
  191.        struct StrTextSeg {
  192.         BOOL    drawn;               // TRUE if the text segment is drawn 
  193.         LPBYTE   string;              // pointer to the text string 
  194.         HANDLE  hString;             // handle to the string 
  195.         int     len;                 // length of the text string 
  196.         int     x;                   // starting X coordinate of the text 
  197.         int     y;                   // starting Y coordinate of the text 
  198.         RECT    rect;                // coordinate of the text box 
  199.         COLORREF color;              // forground color 
  200.         COLORREF BackColor;          // background color 
  201.         int     fmt;                 // format id used for the segment
  202.         UINT    border;              // BORDER_TOP,BORDER_BOT,BORDER_LEFT,BORDER_RIGHT 
  203.         UINT    ParShading;          // paragraph shading
  204.         int     FrmShading;          // frame shading
  205.         int     BoxLeftPos;          // position of left side of the box
  206.         int     BoxRightPos;         // position of the right side of the box
  207.         int     CellId;              // frame cell id
  208.         int     RowId;               // frame row id
  209.         int     FrameHt;             // frame height
  210.         BOOL    ParFrameSpace;       // TRUE is space reserved for a paragraph frame
  211.         int     RepaintNoW;          // incremental number of this repaint
  212.         int     ParaFIDW;            // para frame id
  213.      }far *TextSegW;
  214.  
  215.      HANDLE hTextSegW;              // handle to the text segment block 
  216.      int TotalSegmentsW;            // total text segments 
  217.      BOOL UseTextMapW;              // use text map to increase painting efficiency 
  218.      UINT TextBorderW,              // current text border to be used
  219.           ParaShadingW;             // current shading for the paragraph (0 to 10000)
  220.      BOOL ParaFrameSpaceW;          // TRUE if paraframe space
  221.  
  222.   /******************************************************************************
  223.      Mouse control variables
  224.   *******************************************************************************/
  225.      long    MouseLineW;          // text line position of mouse 
  226.  
  227.      int     MouseColW,           // text column position of mouse 
  228.              MouseXW,             // current x position of mouse 
  229.              MouseYW;             // current y position of mouse   
  230.      BYTE    MouseOverShootW;     // stores L,R,T,or B when mouse goes past the text area of the screen 
  231.  
  232.      BOOL    IgnoreMouseMoveW,    // ignore mouse move until a mouse button is depressed 
  233.              VerySmallMovementW;  // record if the mouse movement is very small 
  234.  
  235.   /******************************************************************************
  236.      Word Wrapping related variables
  237.   *******************************************************************************/
  238.      WORD    DocCodeW,           // used to identify a word wrap file 
  239.              DocBeginW;          // Document header size or text begin location 
  240.  
  241.      long    WrapMaxLinesW;      // Maximum lines for the wrap buffer 
  242.      int     WrapBufferSizeW;    // wrap buffer size 
  243.  
  244.      BYTE    ParaCharW;          // a character to mark end of a paragraph 
  245.      BYTE    DocExtW[5];         // extension of a document file 
  246.             
  247.      LPBYTE   wrapW;              // pointer to the wrap buffer 
  248.  
  249.      HANDLE  hWrapW;             // handle to the wrap buffer 
  250.  
  251.      int     BufferLengthW,      // current length of a wrap buffer 
  252.              MaxBufferLengthW;   // max length of a wrap buffer 
  253.  
  254.      int     WrapFlagW;          // indicates the extent of word wrapping for the current operation
  255.  
  256.      long    LastBufferedLineW,  // last line in the wrap buffer 
  257.              LastWrappedLineW;   // lines used up the wrap buffer 
  258.      
  259.   /*****************************************************************************
  260.                    Character Formatting Variables
  261.    The character formatting option provide underline, bold and italic attributes.
  262.   ******************************************************************************/
  263.      BYTE CfmtSignW[30];             // indicates the beginning of the formatting information 
  264.  
  265.      union UnionCfmt {
  266.           DWORD hnd;                // handle to the character formattnig information 
  267.           struct {
  268.              unsigned short type;   // = UNIFORM if one format used through out the line 
  269.              BYTE fmt;              // format if type = UNIFORM 
  270.           }info;
  271.      }huge * cfmtW;                 // pointer to line array containing the formatting information for each line 
  272.  
  273.      HANDLE hCfmtW;
  274.  
  275.      LPBYTE   WrapCfmtW,              // pointer to the character formatting wrap buffer 
  276.              TempCfmtW;              // pointer to temporary formatting info 
  277.  
  278.      HANDLE hWrapCfmtW;              // handle to the character formatting wrap buffer 
  279.      int    CurFmtIdW;               // current format id in the device context 
  280.      int    InputFontIdW;            // font selected for next input
  281.  
  282.   /******************************************************************************
  283.                     Paragraph formatting variables
  284.   ******************************************************************************/
  285.      HANDLE   hPfmtW;             // handle to the paragraph formatting info 
  286.      int      huge *pfmtW;          // paragraph formatting data for each line 
  287.  
  288.      HANDLE   hPfmtIdW;           // handle to the paragraph formatting table 
  289.  
  290.      struct StrPfmt {
  291.            int LeftIndent;       // left indentation in screen units 
  292.            int RightIndent;      // Right indentation in screen units 
  293.            int FirstIndent;      // First line indentation in screen units 
  294.            int LeftIndentTwips;  // left indent in twips
  295.            int RightIndentTwips; // Right indent in twips
  296.            int FirstIndentTwips; // First line indent in twips
  297.            UINT flags;           // includes such flags as double spacing,centering, right justify etc 
  298.            int TabId;            // tab id, index into the tab table
  299.            int CellId;           // cell id that the paragraph belongs to
  300.            UINT shading;         // shading (0 to 10000)
  301.            int ParaFrameId;      // paragraph frame id
  302.            int SpaceBefore;      // space before the paragraph in twips
  303.            int SpaceAfter;       // space after the paragraph in twips
  304.            int SpaceBetween;     // space between the paragraph lines in twips
  305.            int AuxId;            // id for use by external application
  306.      } far *PfmtIdW;
  307.  
  308.      int TotalPfmtsW;            // total number of para ids
  309.  
  310.      int CurPfmtW;               // current para id
  311.  
  312.      int CurWrapPfmtW;           // para id of para being wrapped
  313.  
  314.   /******************************************************************************
  315.                        Paragraph Border and spacing parameters
  316.   ******************************************************************************/
  317.      int  BoxLeftW,                    // position of the left edge of the paragraph box
  318.           BoxRightW;                   // position of the right edge of the paragraph box
  319.  
  320.      UINT DlgOnFlagsW,                 // box parameters turned on by the dialog box
  321.           DlgOffFlagsW;                // box parameters turned off by the dialog box
  322.  
  323.      DWORD DlgLongW;                   // temporary variable to pass a long value
  324.  
  325.      int   DlgInt1W,                   // temporary integer variables to pass result
  326.            DlgInt2W,
  327.            DlgInt3W; 
  328.  
  329.      int   SpaceBefW,                  // space before the paragraph
  330.            SpaceAftW;                  // space after the paragraph
  331.  
  332.   /******************************************************************************
  333.                        Font and Picture Control Data
  334.   ******************************************************************************/
  335.  
  336.      BYTE   FmtSignW,         // indicates the beginning of a format data section 
  337.             FmtSignOldW;      // old value (version 3.5)
  338.  
  339.      struct StrFont {         // main font table
  340.               //******* Font Variables *********
  341.               HFONT   hFont;      // font handle 
  342.               BYTE    TypeFace[31];//font typeface
  343.               BYTE    FontFamily; // font famiy (optional)
  344.               int     PointSize;  // display point size of the font 
  345.               DWORD   TextColor;  // Color of the text
  346.               DWORD   TextBkColor;// text background color
  347.               //******* Object Variables 
  348.               LPOLEOBJECT pObject;// pointer to the object
  349.               int     ObjectType; // OBJ_EMBED, OBJ_LINK, OBJ_NONE
  350.               DWORD   ObjectSize; // size of the object storage data
  351.               WORD    OleNotice;  // notification from the callback funciton
  352.               HGLOBAL hObject;    // temporary memory containing object data
  353.               #if !defined(INC_OLE1)
  354.                 LPOLECLIENTSITE pObjSite; // Client site pointer
  355.               #endif
  356.  
  357.               //****** Picture Variables ********
  358.               int     PictType;   // PICT_DIBITMAP (device ind. bitmap) or PICT_METAFILE
  359.               HBITMAP hBM;        // bitmap handle if style&PICT is TRUE and PictType=PICT_DIBITMAP
  360.               HMETAFILE hMeta;    // bitmap handle if style&PICT is TRUE and PictType=PICT_METAFILE
  361.               DWORD   ImageSize;  // size of the device independent bitmap image 
  362.               DWORD   InfoSize;   // size of the device independent bitmap information structure 
  363.               HANDLE  hImage;     // handle to the device independent bitmap image 
  364.               HANDLE  hInfo;      // handle to the device independent bitmap info structure 
  365.               int     bmHeight;   // actual height of the stored bitmap 
  366.               int     bmWidth;    // actual width of the stored bitmap 
  367.               int     PictHeight; // display height in point size 
  368.               int     PictWidth;  // display width in point size 
  369.               DWORD   ColorsUsed; // number of colors used in the bitmap
  370.               int     PictAlign;  // picture alignment value, uses ALIGN_ constants
  371.               int     PictX;      // latest x location on the screen
  372.               int     PictY;      // latest y location on the screen
  373.               //****** Common Variables *********
  374.               int     height;     // point size converted to pixel height for display
  375.               int     BaseHeight; // baseline to the top of the character/picture 
  376.               UINT    style;      // font styles:  bold,underline,italic,strikeout, or PICTURE
  377.               BOOL    InUse;      // TRUE indicates that this font/picture is in use in the current document 
  378.               LPINT   CharWidth;  // stores the character width of each style 
  379.               int     FieldId;    // field id, 0 for default
  380.               int     AuxId;      // auxiliary id for sole use of outside application
  381.               } far *TerFontW;    // pointer to the font structure 
  382.  
  383.      struct StrPrtFont {          // printer font metrics translation structure
  384.               int     height;     // point size converted to pixel height for display
  385.               int     BaseHeight; // baseline to the top of the character/picture 
  386.               LPINT   CharWidth;  // stores the character width of each style 
  387.               } far *PrtFontW;    // pointer to the font structure 
  388.  
  389.      HANDLE   hTerFontW,          // handle to the main font structure 
  390.               hPrtFontW;          // handle to the printer font structure
  391.  
  392.      int      TotalFontsW,        // Total fonts in use by the current window 
  393.               TotalTypesW,        // number of enumerated font face types 
  394.               TotalPointSizesW;   // number of enumerated pointsizes 
  395.      BYTE     ReqTypeFaceW[31];   // requested type face 
  396.      int      ReqPointSizeW;      // requested font size  
  397.  
  398.      BOOL     UsingZoomFontsW;    // use and create zoom fonts
  399.  
  400.   /******************************************************************************
  401.      Tab control control variables
  402.   *******************************************************************************/
  403.      struct StrTab {              // tab table
  404.               int count;          // number of tabs
  405.               int pos[MAX_TAB_STOPS]; // tab stop position in twips
  406.               int type[MAX_TAB_STOPS];// tab type each stop, TAB_LEFT, TAB_RIGHT
  407.               } far *TerTabW;     // pointer to the tab table
  408.  
  409.      struct StrTabw {             // stores tab or section information for a line
  410.               int type;           // information type: INFO_TAB, INFO_SECT
  411.               int count;          // number of tabs used in the line
  412.               int width[MAX_TAB_STOPS];  // screen width of each tab
  413.               int section;        // section number when type==INFO_SECT
  414.               int JustCount;      // justification - number of spaces allocated one extra pixel
  415.               int JustAdj;        // justification - extra pixels for each space
  416.               int JustSpaceCount; // justification - number of spaces to modify
  417.               int FrameCharPos;   // character number before which the space is created
  418.               int FrameX;         // frame space begin position
  419.               int FrameWidth;     // width of the frame space - printer pixels
  420.               int FrameScrWidth;  // total width of the frame space including distance from text - screen pixels
  421.               int height;         // height of a space line in printer units
  422.               } far * (huge *tabwW);
  423.  
  424.      HANDLE   hTerTabW,           // handle to the StrTab table 
  425.               hTabwW;             // handle to the StrTabw table
  426.  
  427.      int      TotalTabsW,         // total tab entries used in the tab table
  428.               DefTabWidthW;       // default tab width in twips
  429.  
  430.   /******************************************************************************
  431.      Section control variables
  432.   *******************************************************************************/
  433.      struct StrSect {             // section table
  434.               BOOL  InUse;        // TRUE when this slot is in use
  435.               float LeftMargin;   // left margin in inches
  436.               float RightMargin;  // right margin in inches
  437.               float TopMargin;    // top margin in inches
  438.               float BotMargin;    // bottom margin in inches
  439.               int columns;        // number of columns
  440.               float ColumnSpace;  // space between column in inches
  441.               long FirstLine;     // first line of the section
  442.               long LastLine;      // last line of the section
  443.               BOOL reserved1;     // lines justified for printing
  444.               int  start;         // section starts SECT_CONTINUE, SECT_NEW_PAGE
  445.               int  LastPage;      // last page number of the section
  446.               int  LastPageHeight;// height of the text on the last page
  447.               BYTE reserved[16];  // reserved for future
  448.               } far *TerSectW;    // pointer to the section table
  449.  
  450.      struct StrSect1 {            // temporary section table
  451.               int   PrevSect;     // previous section number
  452.               long  HdrFirstLine; // first page header line
  453.               long  HdrLastLine;  // last page header line
  454.               long  FtrFirstLine; // first page footer line
  455.               long  FtrLastLine;  // last page footer line
  456.               } far *TerSect1W;   // pointer to the section table
  457.  
  458.      HANDLE   hTerSectW,          // handle to the StrSect table 
  459.               hTerSect1W;         // handle to the StrSect1 table
  460.      int      TotalSectsW,        // total section entries used in the section table
  461.               WrapSectW;          // section being wrapped currently
  462.  
  463.      BOOL     SectModifiedW;      // TRUE when section boundary may have been modified
  464.  
  465.   /******************************************************************************
  466.      Screen page break and repagination variables
  467.   *******************************************************************************/
  468.      int      TotalPagesW,        // total number of pages
  469.               MaxPagesW,          // size of the page array
  470.               PageModifyCountW,   // number of times document modified
  471.               CurPageW;           // current page number
  472.      
  473.      long huge *   PageLineW;     // stores first line of each page
  474.  
  475.      HANDLE   hPageLineW;         // handles for the above memory block 
  476.      long     RepageBeginLineW;   // repagination begin line
  477.      BOOL     repaginatingW;      // TRUE during the repagination process
  478.  
  479.   /******************************************************************************
  480.      Print control variables
  481.   *******************************************************************************/
  482.      float   PageWidthW,         // width of the page in inches
  483.              PageHeightW;        // height of the page in inches
  484.  
  485.      int     PageXW;             // X position where the text begin on the page
  486.  
  487.      BOOL    AbortPrintW,        // set to TRUE to abort printing 
  488.              InPrintingW,        // TRUE when the editor is in printing process
  489.              InPrintPreviewW,    // TRUE when the editor is in print preview process
  490.              PrinterAvailableW;  // TRUE when a printer is avaialbe
  491.  
  492.      BYTE    PrinterNameW[60],   // name of the printer 
  493.              PrinterDriverW[60], // printer driver 
  494.              PrinterPortW[60];   // printer port 
  495.  
  496.      LPDEVMODE pDevModeW;        // pointer to the device mode storage 
  497.      HANDLE    hDevModeW;        // handle to device mode memory                
  498.  
  499.      HWND      hAbortWndW;       // abort window handle 
  500.  
  501.      int     TotalPreviewPagesW; // number of preview pages to display
  502.      int     PreviewZoomW,       // zoom percent for print preview
  503.              PreviewHeightW,     // height of the preview area
  504.              PreviewWidthW;      // width of the preview area
  505.  
  506.      BOOL    SavePvStatusW,      // save the show status flag
  507.              SavePvRulerW,       // save the ruler status
  508.              SavePvToolbarW,     // save the tool bar status
  509.              SavePvWordWrapW,    // save the word wrap flag
  510.              SavePvPrintViewW,   // save the print view mode flag
  511.              SavePvPageModeW,    // save the page mode flag
  512.              SavePvShowHorBarW,  // horrizontal scroll bar display flag
  513.              SavePvOrgXW,        // save the x window origin
  514.              SavePvOrgYW,        // save the y window origin
  515.              SavePvViewPageHdrFtrW; // save the hdr/ftr view status
  516.  
  517.      WNDPROC ZoomSubclassProcW,  // handle to zoom bar subclass process
  518.              OrigZoomSubclassProcW;// original zoom bar control process
  519.  
  520.   /******************************************************************************
  521.      Cursor Adjustment variables
  522.   ******************************************************************************/
  523.      long      PrevCursLineW;   // previous cursor line
  524.  
  525.      int       PrevCursColW,    // previous cursor column
  526.                PrevCursPageW,   // previous cursor page
  527.                PrevCursLineYW,  // previous cursor Y position (including TerWinOrgX)
  528.                CursDirectionW;  // direction of cursor movement
  529.  
  530.   /******************************************************************************
  531.      OLE variables
  532.   ******************************************************************************/
  533.      #if defined (INC_OLE1)
  534.         struct StrClient {
  535.            OLECLIENT     client;      // ole client
  536.            void far *    TerData;
  537.         } TerClientW;
  538.  
  539.         OLECLIENTVTBL TerClientVtblW; // contains the pointer to call back function 
  540.         LHCLIENTDOC   lhDocW;         // handle to current document
  541.         OLE_RELEASE_METHOD OleReleaseMethodW; // Ole release method 
  542.      #else
  543.         LPSTORAGE     pDocStorageW;   // top level storage
  544.      #endif
  545.  
  546.      struct StrOleStream {
  547.         OLESTREAM     stream;      // ole stream
  548.         void far *    TerData;
  549.         DWORD         offset;      // offset into buffer
  550.         DWORD         MaxSize;
  551.      } OleStreamW;
  552.  
  553.      OLESTREAMVTBL OleStreamVtblW; // virtual table containing ole streams
  554.  
  555.      OLECLIPFORMAT NativeClipFormatW,      // Native format
  556.                    ObjectLinkClipFormatW,  // Object link format
  557.                    OwnerLinkClipFormatW;   // Owner link format
  558.  
  559.      BOOL          WaitForOleW;    // Wait for OLE asynch task to be over
  560.      HGLOBAL       hOleDataW;      // Handle to the OLE file io buffer
  561.      BYTE huge *   pOleDataW;      // pointer to the OLE file io buffer
  562.      int           CurObjectW;     // current object index
  563.      UINT          RtfClipFormatW; // Rich text format clipboard format
  564.  
  565.   /******************************************************************************
  566.      Color control variables
  567.   ******************************************************************************/
  568.      COLORREF   TextDefBkColorW, // default background color for text 
  569.                 StatusBkColorW,  // background color of the status line 
  570.                 StatusColorW,    // foreground color of the status line 
  571.                 
  572.                 CurForeColorW,   // current foreground color 
  573.                 CurBackColorW;   // currnet background color 
  574.  
  575.      int        FrameShadingW;   // Current shading percent 0 to 100
  576.  
  577.   /******************************************************************************
  578.      Block highlighting variables
  579.   ******************************************************************************/
  580.      long       HilightBegRowW, // beginning row 
  581.                 HilightEndRowW; // ending row 
  582.  
  583.      int        HilightTypeW,   // line/col or character block 
  584.                 HilightBegColW, // beginning col 
  585.                 HilightEndColW, // ending col 
  586.                 MaxColBlockW;   // biggest column block allowed 
  587.  
  588.      BOOL       StretchHilightW;// stretch hilighting mode 
  589.  
  590.   /******************************************************************************
  591.      Tool Bar variables
  592.   *******************************************************************************/
  593.      int        ToolBarHeightW;            // height of the tool bar
  594.      HWND       hToolBarWndW;              // handle to the tool bar window
  595.      HWND       hPvToolBarWndW;            // handle to the print preview tool bar window
  596.      FARPROC    lpToolBarW;                // handle to the tool bar dialog process
  597.  
  598.  
  599.      int        ToolBarCfmtW;              // tool bar font id
  600.      int        ToolBarPfmtW;              // tool bar para id
  601.  
  602.      WNDPROC    ToolBarFontProcW,          // handle to font subclass process
  603.                 OrigBarFontProcW;          // original font process
  604.  
  605.      WNDPROC    ToolBarPointProcW,         // handle to point size edit subclass process
  606.                 OrigBarPointProcW;         // original point size edit control process
  607.  
  608.   /******************************************************************************
  609.      Search/Replace Variables
  610.   *******************************************************************************/
  611.      BYTE         SearchStringW[MAX_WIDTH+1], // last string searched 
  612.                   SearchDirectionW,      // F'orward, B'ackward, E'ntire file
  613.                   ReplaceStringW[MAX_WIDTH+1],// last string changed 
  614.                   ReplaceWithW[MAX_WIDTH+1];  // string to be changed with 
  615.  
  616.      BOOL         ReplaceVerifyW,        // verify before replace 
  617.                   ReplaceBlockW;         // Replace range: block or file
  618.  
  619.      UINT         SearchFlagsW;          // Search flags
  620.  
  621.   /******************************************************************************
  622.      Undo variables
  623.   *******************************************************************************/
  624.      HANDLE       hUndoW,                // handle to the undo text information
  625.                   hUndoCfmtW;            // handle to the undo formatting info 
  626.      long         UndoBegW,              // undo block absolute coordinates 
  627.                   UndoEndW;
  628.  
  629.      BOOL         UndoExistsW;           // text exist for undoing 
  630.      BYTE         UndoTypeW;             // type of undo: delete,insert or replace 
  631.  
  632.   /******************************************************************************
  633.      Mail merge fields
  634.   *******************************************************************************/
  635.      struct StrMergeData {
  636.         LPBYTE pName;                    // name of the field
  637.         LPBYTE pData;                    // data for the field
  638.         int   NameLen;                  // length of the name
  639.         int   DataLen;                  // length of the field data
  640.      } mergeW[MAX_FIELDS];
  641.  
  642.   /******************************************************************************
  643.      Hidden text variables
  644.   *******************************************************************************/
  645.      BOOL         ShowHiddenTextW;       // show hidden text
  646.  
  647.   /******************************************************************************
  648.      VBX Variables
  649.   *******************************************************************************/
  650.      BOOL         VbxControlW,           // TRUE if it is a VBX control
  651.                   VbxMessageProcessedW;  // TRUE when VBX message processed successfully.
  652.  
  653.      VBX_CALLBACK VbxCallbackW;          // routine to recieve TER messages in a VBX
  654.  
  655.   /******************************************************************************
  656.      Object drag Variables
  657.   *******************************************************************************/
  658.      struct StrDragObj {                // drag object table
  659.         BOOL      InUse;                // TRUE if the entry in use
  660.         BOOL      drawn;                // object drawn
  661.         int       type;                 // object type
  662.         int       id1;                  // primary object identification
  663.         int       id2;                  // secondary object identification
  664.         int       id3;                  // another object identification
  665.  
  666.         POINT     ObjPoint[4];          // polygon to be dragged. Other than fist two points are static when strech = FALSE
  667.         int       ObjPointCount;        // number of points in the drag polygon
  668.         RECT      ObjRect;              // some object migh use rect istead of polygon
  669.  
  670.         RECT      HotRect[4];           // hotspot rectangles
  671.         int       HotRectCount;         // number of hot rects in use
  672.      } far * DragObjW;                  // table pointer
  673.  
  674.      HGLOBAL      hDragObjW;            // drag object table handle
  675.  
  676.      int          CurDragObjW;          // current drag object
  677.      int          CurHotSpotW;          // current hot spot within the drag object
  678.      int          TotalDragObjsW;       // total drag objects on the screen
  679.  
  680.      BOOL         PictureHilightedW;    // TRUE when a picutre object is highlighted
  681.      BOOL         FrameTabsHilightedW;  // TRUE when a frame size tabs are highlighted
  682.      BOOL         FrameRectHilightedW;  // TRUE when a frame rectangle is highlighted
  683.      BOOL         PictureClickedW;      // TRUE when a picutre object is clicked
  684.      BOOL         FrameClickedW;        // TRUE when a frame object is clicked
  685.      
  686.      HPEN         hFocusPenW;           // handle to the focus pen
  687.  
  688.   /******************************************************************************
  689.      Table Variables
  690.   *******************************************************************************/
  691.      struct StrTableRow {               // Table structure
  692.         BOOL      InUse;                // TRUE if the entry in use
  693.         BOOL      hdr;                  // TRUE if this is a header row
  694.         int       FirstCell;            // first cell id for this row
  695.         int       LastCell;             // last cell id for this row
  696.         int       YPos;                 // Row Y position during display or printing
  697.         int       height;               // Row height during display or printing
  698.         BOOL      PrevRow;              // Previous row of the table, -1 if the first row
  699.         BOOL      NextRow;              // Next row of the table, -1 if the last row
  700.         int       indent;               // left indentation in twips
  701.         UINT      flags;                // RIGHT or CENTER flags
  702.         int       CellMargin;           // space between the cells
  703.         UINT      border;               // uses BORDER_ constants
  704.         int       BorderWidth[4];       // border width for each border
  705.         int       FirstFrame;           // first frame for the row
  706.         int       LastFrame;            // last frame for the row
  707.         #if defined (WIN32)
  708.            BYTE   reserved32[8];        // maintain 4 byte alignement
  709.         #else
  710.            BYTE   reserved[6];
  711.         #endif
  712.      } far *TableRowW;                  // pointer to the table row table
  713.  
  714.      struct StrCell {                   // Cell structure
  715.         BOOL      InUse;                // TRUE if the entry in use
  716.         int       row;                  // row id to which this cell belongs
  717.         int       NextCell;             // next cell in the row, -1 if last
  718.         int       PrevCell;             // previous cell in the row, -1 if last
  719.         int       x;                    // calculated x (twips) position
  720.         int       width;                // width (twips) including the margin
  721.         UINT      border;               // uses BORDER_ constants
  722.         int       BorderWidth[4];       // border width for each border
  723.         int       margin;               // left/right margin in twips
  724.         int       height;               // cell height (pixels) during display
  725.         long      FirstLine;            // first line in the cell
  726.         long      LastLine;             // last line in the cell including the cell marker line
  727.         int       shading;              // shading percent 0 to 100
  728.         UINT      flags;
  729.         #if defined (WIN32)
  730.            BYTE   reserved32[8];        // maintain 4 byte alignement
  731.         #else
  732.            BYTE   reserved[6];
  733.         #endif
  734.      } far *cellW;                      // pointer to the cell table
  735.  
  736.  
  737.      HGLOBAL      hTableRowW;           // handle to the row table
  738.      HGLOBAL      hCellW;               // handle to the cell table
  739.  
  740.      int          TotalTableRowsW,      // number of row entries in the table
  741.                   TotalCellsW;          // number of cells entries in the table
  742.  
  743.      int          TableRowsW,           // new table parameter
  744.                   TableColsW;           // new table parameter
  745.  
  746.      BYTE         CellCharW;            // a character to mark end of a cell 
  747.  
  748.      int          FrameCellIdW,         // current frame cell id
  749.                   FrameRowIdW,          // current frame Row id
  750.                   FrameHeightW;         // current frame height
  751.  
  752.      BOOL         ShowTableGridLinesW;  // show table grid lines
  753.  
  754.   /******************************************************************************
  755.      File info structure
  756.   *******************************************************************************/
  757.      struct StrFileInfo {               // Table structure
  758.         BYTE      sign;                 // is set to SIGN_EOF
  759.         BYTE      VerId;                // x.x is stored as xx (4.0 -> 40)
  760.         BYTE      RevId;                // revision id
  761.         BYTE      reserved[599];        // reserved for future use
  762.      }FileInfoW;
  763.  
  764.   /******************************************************************************
  765.      Rtf Control Variables
  766.   *******************************************************************************/
  767.       int         RtfCurRowIdW;           // current table row id
  768.       int         RtfCurCellIdW;          // current table cell id
  769.       int         RtfLastCellIdW;         // last cell id for this row
  770.       int         RtfParaFIDW;            // current paragraph frame id
  771.       BOOL        RtfInTableW;            // text in table
  772.       UINT        RtfInHdrFtrW;           // PAGE_HDR || PAGE_FTR
  773.       struct StrRtfParaFrameInfo RtfParaFrameInfoW;  // paraframe information
  774.  
  775.   /******************************************************************************
  776.      Page header/footer variables
  777.   *******************************************************************************/
  778.       BOOL        ViewPageHdrFtrW,        // TRUE to show page header footer
  779.                   EditPageHdrFtrW,        // TRUE when editing page header/footer
  780.                   PosPageHdrFtrW;         // TRUE when page header/footer need to be repositioned
  781.  
  782.       long        HdrFirstPageLineW,       // first header line number on the current page
  783.                   HdrLastPageLineW,        // last header line number on the current page
  784.                   FtrFirstPageLineW,       // first footer line number on the current page
  785.                   FtrLastPageLineW;        // last footer line number on the current page
  786.  
  787.   /******************************************************************************
  788.      Caret Variables
  789.   *******************************************************************************/
  790.      HWND         hCaretWndW;            // window that owns the caret 
  791.      BOOL         CaretEngagedW,         // caret engaged to scrolling text
  792.                   CaretEnabledW,         // TRUE when this window owns the caret
  793.                   CaretHiddenW,          // TRUE when the caret is hidden has meaning only when the caret is enabled
  794.                   ShowProtectCaretW,     // TRUE to show caret on the protected text
  795.                   CaretPositionedW;      // TRUE when caret already positioned
  796.      int          CaretPageW,            // page number of the caret
  797.                   CaretHeightW;          // height of the caret
  798.      long         CaretPosW;             // position of the caret
  799.  
  800.   /******************************************************************************
  801.      Other Variables
  802.   *******************************************************************************/
  803.      BOOL         InsertModeW,           // indicates if insert or replace typing mode 
  804.                   TerHelpWantedW,        // TRUE when help is requested 
  805.                   WindowBeingCreatedW,   // TRUE when a window is being created 
  806.                   CrLfUsedW,             // TRUE when cr/lf pair used in the buffer
  807.                   ProtectionLockW,       // Protection lock
  808.                   ShowParaMarkW;         // show para mark
  809.  
  810.      BYTE         TerHelpFileW[13];      // Help file for the editor 
  811.      BYTE         BreakCharsW[20];       // break characters
  812.  
  813.      HANDLE       hTerAccTableW;         // accelerator table handle 
  814.  
  815.      int          FileFormatW,           // input format, SAVE_TER, SAVE_RTF, SAVE_TEXT
  816.                   RtfInputW;             // type of rtf input: RTF_FILE, RTF_BUF, RTF_CB
  817.  
  818.      BYTE         SpeedKeyEnabledW[MAX_SPEED_KEYS];  // TRUE to enable a speed key
  819.  
  820.      BOOL         ShowHyperlinkCursorW,  // TRUE to show the hyperlink cursor
  821.                   ModifyProtectColorW,   // modify the color or the protected text
  822.                   LinkDblClickW,         // TRUE to activate hyperlink on double click, otherwise use single click
  823.                   MatchIdsW;             // match font and para ids when creating a new one
  824.  
  825.      HGLOBAL      hAppMemoryW;           // data block reserved to use by your application
  826.      LPVOID       pAppMemoryW;           // data pointer for hAppMemory
  827.      
  828.      UINT         LinkStyleW;            // character style of the hyperlink phrase
  829.      COLORREF     LinkColorW;            // color of the linked phrase
  830.  
  831. }TERWND;
  832.  
  833. typedef TERWND far *PTERWND;             // pointer to the TER window variable structure 
  834.  
  835.  
  836. /******************************************************************************
  837.     Common Variables
  838. *******************************************************************************/
  839. PREFIX HANDLE   hTerInst;               // Ter instance id 
  840. PREFIX BYTE     TempString[MAX_WIDTH+1], // temporary holding place 
  841.                 TempString1[MAX_WIDTH+1];// temporary holding place 
  842. PREFIX BOOL     ClassRegistered;        // TRUE after registered the window class
  843. PREFIX BOOL     Win32;                  // TRUE if compiled as a WIN32 application
  844. PREFIX HWND     hCurAbortWnd;           // Current abort window
  845. PREFIX HMENU    hTerMenu;               // TER menu
  846. PREFIX HDC      hMemDC;                 // comaptible display context 
  847. PREFIX int      TerOpenCount;           // number of open windows
  848. PREFIX int      TotalWinPtrs,           // number of non-standard windows open
  849.                 TotalWinTasks;          // total tasks using this DLL
  850. PREFIX int      StorageId;              // id to make unique storage name
  851.  
  852. PREFIX HBITMAP  hBoldOnBM,              // bold on tool bar bitmap
  853.                 hBoldOffBM,             // bold off tool bar bitmap
  854.                 hItalicOnBM,            // italic on tool bar bitmap
  855.                 hItalicOffBM,           // italic off tool bar bitmap
  856.                 hUlineOnBM,             // Uline on tool bar bitmap
  857.                 hUlineOffBM,            // Uline off tool bar bitmap
  858.                 hJustRightBM,           // right justify tool bar bitmap
  859.                 hJustCenterBM,          // center justify tool bar bitmap
  860.                 hDoubleSpaceBM,         // double space tool bar bitmap
  861.                 hIndentLeftBM,          // left indent tool bar bitmap
  862.                 hIndentRightBM,         // right indent tool bar bitmap
  863.                 hIndentHangingBM;       // right indent tool bar bitmap
  864.  
  865. PREFIX HCURSOR  hTable1Cur,             // table cell width cursor
  866.                 hTab1Cur,               // tab marker cursor
  867.                 hHyperlinkCur,          // hyperlink cursor
  868.                 hPlusCur;               // plus cursor
  869.  
  870. PREFIX struct StrWinPtr {               // Contains data pointer for non-standard windows
  871.          BOOL InUse;                    // TRUE=slot in use
  872.          HWND hWnd;                     // window handle
  873.          PTERWND data;                  // data pointer
  874.      }WinPtr[MAX_WIN_PTRS];             // max non-standard windows
  875.  
  876. PREFIX struct StrTask {                 // window task list
  877.          HTASK task;                    // task id
  878.          int   count;                   // number of open windows for this task
  879.          #if !defined(INC_OLE1) 
  880.             LPSTORAGE     pDocStg;      // top level storage 
  881.          #endif
  882.      } WinTask[MAX_TASKS];
  883.  
  884. /******************************************************************************
  885.      WIN32 Custom Control Variables
  886. *******************************************************************************/
  887. PREFIX CCSTYLEFLAG CtlStyleFlag[TER_NUM_STYLES];  // style flags
  888.  
  889.  
  890. /******************************************************************************
  891.     Other Structures
  892. *******************************************************************************/
  893.  
  894. struct StructTextBuf {
  895.        BYTE huge *pBuf;                   // pointer to the buffer containing text 
  896.        BYTE huge *pFmt;                   // pointer to the buffer containing the format data 
  897.        int   len;                         // current line length 
  898.        long  index;                       // index to the current line 
  899.        BOOL  eof,eol;                     // end of file and end of line flags 
  900.        int   MaxLineLen;                  // maximum line length allowed 
  901.        BOOL  ParaCharFound;               // indicates if paragraph character is detected 
  902.       };
  903.  
  904. struct StrEnumFonts {                     // result of font enumeration
  905.       BOOL GetMultiple;                   // when TRUE all enumerated fonts are returned
  906.       BOOL EnumTypeFace;                  // Enumerate type face, otherwise enumerate pointsizes
  907.       BOOL result;                        // TRUE or FALSE
  908.       BYTE CharSet;                       // character set
  909.       BYTE PitchAndFamily;                // pitch and family
  910.       int  TypeCount;                     // number of fonts enumerated
  911.       BYTE TypeNames[MAX_TYPES][31];      // font type faces returned
  912.       int  PointCount;                    // number of point sizes enumerated
  913.       int  height[MAX_POINTS];            // font height in device units
  914.       BOOL TrueType;                      // TRUE indicates true type font
  915.       };
  916.  
  917. struct StrDlgParam {                      // Dialog box title and owner window control area
  918.       PTERWND w;                          // owner window data pointer
  919.       LPBYTE   data;                       // miscellaneous data pointer
  920.       }; 
  921.  
  922. struct StrFontIO {                        // font structure to write to ter file
  923.       UINT style;                         // character style
  924.       int  PointSize;                     // point size
  925.       BYTE TypeFace[31];                  // font type face
  926.       BYTE FontFamily;                    // font family
  927.       int  PictType;                      // picture type when the font represents a picture
  928.       DWORD TextColor;                    // color of the text
  929.       int  bmWidth;                       // actual width of the picture
  930.       int  bmHeight;                      // actual height of the picture
  931.       int  ObjectType;                    // object type
  932.       DWORD ObjectSize;                   // size of the object storage data
  933.       DWORD TextBkColor;                  // text background color
  934.       int  FieldId;                       // field id
  935.       int  PictAlign;                     // picture alignment value
  936.       int  AuxId;                         // id for external use
  937.       #if defined (WIN32)
  938.          BYTE reserved[20];               // reserved bytes
  939.       #else
  940.          BYTE reserved[26];               // reserved bytes
  941.       #endif
  942.       };
  943.  
  944. struct StrParaIO {                        // para table structure to write to ter file
  945.       int  LeftIndent;                    // left indent in twips
  946.       int  RightIndent;                   // right indent in twips
  947.       int  FirstIndent;                   // first line indent in twips
  948.       UINT flags;                         // paragraph flags
  949.       int  TabId;                         // tab id
  950.       int  CellId;                        // cell id
  951.       UINT shading;                       // shading percentage
  952.       int  ParaFrameId;                   // paragraph frame id
  953.       int  SpaceBefore;                   // space before the paragraph-twips
  954.       int  SpaceAfter;                    // space after the paragraph - twips
  955.       int  SpaceBetween;                  // space between the paragraph lines
  956.       int  AuxId;                         // id for external use
  957.       #if defined(WIN32)
  958.          BYTE reserved[24];               // reserved bytes
  959.       #else
  960.          BYTE reserved[20];
  961.       #endif
  962.       };                               
  963.  
  964. struct StrRtf {                           // Rtf input file processing block
  965.       FILE TERFAR *InStream;              // stream if file is used
  966.       BYTE huge *buf;                     // input buffer pointer if using buffer
  967.       long BufLen;                        // length of the buffer, -1 if not known
  968.       long BufIndex;                      // index of current character in the buffer
  969.       BYTE OutBuf[MAX_WIDTH+1];           // output buffer
  970.       int  OutBufLen;                     // output buffer length
  971.       BYTE text[MAX_WIDTH+1];             // temporary buffer to read text from file
  972.       int  TextLen;                       // length of the text in the 'text' buffer
  973.       int  TextIndex;                     // index if current BYTE in the 'text' buffer
  974.       BYTE CurChar;                       // last character read
  975.       BYTE stack[MAX_WIDTH+1];            // characters returned from previous operations
  976.       int  StackLen;                      // number of characters in the stack  
  977.       BYTE CurWord[MAX_WIDTH+1];          // current word
  978.       int  WordLen;                       // length of the current word
  979.       BOOL GroupBegin;                    // TRUE if the group begins
  980.       BOOL GroupEnd;                      // TRUE if the group ends
  981.       BOOL IsControlWord;                 // TRUE if control word
  982.       BOOL IgnoreText;                    // TRUE to ignore text if not understood
  983.       BOOL SubEntry;                      // TRUE if subentry in an index entry
  984.       BOOL eof;                           // end of file
  985.       BOOL IgnoreCrLfInControlWord;       // TRUE to ingore cr/lf in control word
  986.       BYTE param[MAX_WIDTH/3];            // rtf control word parameter
  987.       long IntParam;                      // rtf control word parameter in integer numeric format
  988.       double DoubleParam;                 // rtf control word parameter in double numeric format
  989.       int  GroupLevel;                    // group nesting level
  990.       struct StrRtfGroup far *group;      // rtf group table pointer
  991.       struct StrRtfFont  far *font;       // rtf font table pointer
  992.       struct StrRtfColor far *color;      // rtf color table pointer
  993.       int  TotalColors;                   // total colors in the color table
  994.       int  InitialCell;                   // value of the initial cell 
  995.       int  InitialParaFID;                // initial paraframe id
  996.  
  997.       // picture transfer information
  998.       HMETAFILE hMeta;                    // handle to the metafile
  999.       int  PictWidth;                     // width of the picture in twips
  1000.       int  PictHeight;                    // height of the picture in twips
  1001.       
  1002.       // current section properties
  1003.       struct StrSect sect;                // current section properties
  1004.  
  1005.       long    FirstLine;                  // first line where the text is inserted
  1006.  
  1007.       long FilePos;                       // current file position
  1008.       };
  1009.  
  1010. struct StrRtfFont {                       // font table in an rtf file
  1011.       BYTE family[32];                    // font family
  1012.       BYTE name[32];                      // font name
  1013.       };
  1014.  
  1015. struct StrRtfColor {                       // color table in an rtf file
  1016.       COLORREF color;                      // color
  1017.       };
  1018.  
  1019. struct StrRtfGroup {                      // RTF group properties
  1020.       struct StrRtf far *rtf;             // pointer to the rtf structure
  1021.  
  1022.       // character properties
  1023.       int     DefFont;                    // default font index into font table
  1024.       BYTE    FontFamily[31];             // font family 
  1025.       BYTE    TypeFace[31];               // font typeface 
  1026.       int     PointSize2;                 // double point size of the font 
  1027.       COLORREF TextColor;                 // rtf text color
  1028.       COLORREF TextBkColor;               // rtf background text color
  1029.       UINT    style;                      // character style
  1030.       int     FieldId;                    // field id
  1031.  
  1032.       // paragraph properties
  1033.       int LeftIndent;                     // left indentation in twips
  1034.       int RightIndent;                    // Right indentation in twips
  1035.       int FirstIndent;                    // left indentation of the first line in twips
  1036.       UINT flags;                         // includes such flags as double spacing,centering, right justify etc 
  1037.       struct StrTab tab;                  // tap position record
  1038.       int CurTabType;                     // TAB_LEFT or TAB_RIGHT
  1039.       UINT ParShading;                    // paragraph shading
  1040.       int SpaceBefore;                    // space before paragraph
  1041.       int SpaceAfter;                     // space after paragraph
  1042.       int SpaceBetween;                   // space between paragraph lines
  1043.  
  1044.       // border information
  1045.       int BorderType;                     // current border type
  1046.       int BorderWidth[MAX_BORDERS];       // border width for each type
  1047.       int BorderMargin;                   // space between text and border
  1048.       int CellShading;                    // cell shading percent 0 to 100
  1049.  
  1050.       // paragraph frame information
  1051.       struct StrRtfParaFrameInfo ParaFrameInfo;
  1052.       UINT   FrmFlags;                    // temporary frame flags
  1053.  
  1054.       // control information
  1055.       BYTE ControlWord[MAX_WIDTH+1];      // control word for the group
  1056.       BOOL IgnoreText;                    // TRUE to ingore any text in this group
  1057.       int  ControlCount;                  // number of control words in the group
  1058.       };
  1059.  
  1060. struct StrRtfPict {                       // RTF picture properties
  1061.       int       type;                     // PICT_METAFILE or PICT_DIBITMAP
  1062.       HMETAFILE hMeta;                    // metafile handle if a metafile
  1063.       HGLOBAL   hInfo;                    // DI bitmap information block
  1064.       HGLOBAL   hImage;                   // DI bitmap image block
  1065.       int       bmHeight;                 // picture height in pixels or yExt
  1066.       int       bmWidth;                  // picture width in pixels or xExt
  1067.       int       height;                   // picture height in twips
  1068.       int       width;                    // picture width in twips
  1069.       int       ScaleX;                   // horrizontal scaling for display
  1070.       int       ScaleY;                   // vertical scaling for display
  1071.       long      InfoSize;                 // picture information size
  1072.       long      ImageSize;                // image size of the picture
  1073.       int       align;                    // picture alignement ALIGN_BOT, ALIGN_TOP, ALIGN_MIDDLE
  1074.       };
  1075.  
  1076. struct StrRtfObject {                     // RTF object properties
  1077.       int       ObjectType;               // object type OBJ_NONE, OBJ_EMBED, OBJ_LINK
  1078.       HGLOBAL   hObject;                  // object data handle
  1079.       DWORD     ObjectSize;               // storage size of the object data
  1080.       int       pict;                     // picture index
  1081.       };
  1082.  
  1083. struct StrRtfOut {                        // Rtf output file processing block
  1084.       int  output;                        // rtr output type: RTF_FILE,RTF_BUF,RTF_CB
  1085.       FILE TERFAR *OutStream;             // stream if file is used
  1086.       HGLOBAL hBuf;                       // output buffer handle if using buffer output
  1087.       BYTE huge *buf;                     // output buffer pointer if using buffer
  1088.       long BufLen;                        // allcated length of buffer
  1089.       long BufIndex;                      // index of next character in the buffer
  1090.       BYTE text[MAX_WIDTH+1];             // temporary buffer to write text
  1091.       int  TextLen;                       // length of the text in the 'text' buffer
  1092.       BOOL SpacePending;                  // TRUE if space needs to be written out after the last control
  1093.       BOOL WritingControl;                // TRUE when writing a control word
  1094.       struct StrRtfColor far *color;      // rtf color table pointer
  1095.       int  TotalColors;                   // total colors in the color table
  1096.       int  GroupLevel;
  1097.       };
  1098.  
  1099.  
  1100. #if !defined(INC_OLE1)                    // OLE2 specific structure
  1101.       struct StrClientSite {              // client site
  1102.          IOleClientSite site;             // client site
  1103.          ULONG     count;                 // use count
  1104.          PTERWND   w;                     // window data pointer
  1105.          int       obj;                   // object id in the object table
  1106.          LPSTORAGE pObjStg;               // object storage
  1107.          LPADVISESINK pObjAdvise;         // object advise sink
  1108.          DWORD     ConnectToken;          // token used to call unadvise
  1109.       };
  1110.  
  1111.       typedef struct StrClientSite far *LPSTRCLIENTSITE;
  1112.  
  1113.       struct StrAdviseSink {              // advise sink interface data
  1114.          IAdviseSink advise;              // client site
  1115.          ULONG     count;                 // use count
  1116.          PTERWND   w;                     // window data pointer
  1117.          int       obj;                   // object id in the object table
  1118.          LPSTORAGE pObjStg;               // object storage
  1119.          LPOLECLIENTSITE pObjSite;        // client site interface
  1120.       };
  1121.       typedef struct StrAdviseSink far *LPSTRADVISESINK;
  1122. #endif
  1123.  
  1124. /*******************************************************************************
  1125.     Function Prototypes
  1126. ********************************************************************************/
  1127. #include "ter_prot.h"
  1128.