home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xhyper10.zip / XHyper_v1.0 / src / Tag.h < prev    next >
C/C++ Source or Header  |  1992-12-08  |  5KB  |  144 lines

  1. /*
  2.  * Copyright (c) 1992 U.S. Geological Survey (USGS)
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided that
  6.  * the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of USGS not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  USGS makes no representations about the
  11.  * suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * USGS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  15.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL USGS
  16.  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  17.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  18.  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  19.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  20.  *
  21.  */
  22.  
  23. #ifndef SimpleTag_h
  24. #define SimpleTag_h
  25.  
  26. #include <stdio.h>
  27.  
  28. class Font;
  29. class FontFamily;
  30. class TextView;
  31.  
  32. /*-----------------------------------------------------------------------
  33.   The following classes define specific MML definition for fonts of 
  34.   paragraphs.
  35.   -----------------------------------------------------------------------*/
  36. //
  37. //  *** class of available font families
  38. //
  39. class FontFamilyInfo
  40.    {
  41.    public:
  42.        char* _name;        // name of font famile (e.g. Times)
  43.        FontFamily* _family;    // font family member
  44.    };
  45.  
  46. //
  47. //  *** list available fonts
  48. //
  49. class FontList
  50.    {
  51.    public:
  52.        Font*         _font;        // pointer to Font type
  53.        char*         _font_name;    // font name and style
  54.        int        _pts;        // size of font
  55.    };
  56.  
  57. //
  58. //  *** simple tag class
  59. //
  60. class SimpleTag
  61.    {
  62.    public:
  63.       SimpleTag();                    // constructor
  64.       SimpleTag(const char*, const char*, Coord);    // constructor
  65.       SimpleTag(const char*, const char*, int);        // constructor
  66.       ~SimpleTag();                    // destructor
  67.       const char*    Id();                // returns name of tag
  68.       const char*    Class();
  69.  
  70.    protected:
  71.       friend class    TextView;        // allow access from text view
  72.       virtual void    getid(const char*);    // parse line for tag ID
  73.       virtual void      getline(FILE*, char*);    // retrieve line from file
  74.       virtual void      Define(FILE*);        // define the tag
  75.       Coord        _rvalue;        // float value
  76.       int          _ivalue;        // integer value
  77.       char*        _id;            // ID string
  78.       char*        _class;            // class string
  79.             
  80.    };
  81.    
  82. //
  83. //  *** Font tag class
  84. //
  85. class FontTag : public SimpleTag
  86.    {
  87.    public:
  88.       FontTag(const char*, int);        // constructor
  89.       FontTag(const char*, FILE*);        // constructor
  90.       ~FontTag();                // destructor
  91.       Font*        font();            // return Font pointer
  92.       const char*    Name();            // returns font name
  93.       int               Points();        // return size
  94.       int        index();        // returns font list index
  95.  
  96.    protected:
  97.       virtual void    findfont(FILE*);    // defines font 
  98.       int        lookup_font(const char*, int);    
  99.                         // finds font in list
  100.       int        _index;            // index in font list
  101.    };
  102.  
  103. //
  104. //  *** Paragraph Tag class
  105. //
  106. class ParaTag : public SimpleTag
  107.    {
  108.    public:
  109.       ParaTag(const char*);            // constructor
  110.       ParaTag(const char*, FILE*, TextView*);    // constructor
  111.       ~ParaTag();                // destructor
  112.       FontTag*        fonttag();        // returns font definition
  113.  
  114.    protected:
  115.       friend class    TextView;        // allows access from Text View
  116.       virtual void    setalign(char*);    // defines alignment variables
  117.       virtual void    define(FILE*, TextView*);// define Tag
  118.       virtual void    discretionaries();    // defines discret. variables
  119.       char*             _alignment;        // alignment string
  120.       boolean        _hypertext;        // if hypertext tag
  121.       FontTag*        _font;            // Font tag pointer
  122.       float        _after;            // Space after paragraph
  123.       float        _before;        // Space before paragraph
  124.       float        _first;            // First Line Indent 
  125.       float        _leading;        // Interline spacing
  126.       float        _left;            // Left indent
  127.  
  128.       Glyph* _begin_line_strut;
  129.       Glyph* _end_line_strut;
  130.       Glyph* _begin_par_strut;
  131.       Glyph* _end_par_strut;
  132.       Glyph* _line_strut;
  133.       Glyph* _fil_strut;
  134.       Glyph* _hyphen;
  135.       Glyph* _interline_glue;
  136.       Glyph* _interpar_glue;
  137.       Glyph* _hfil_glue;
  138.       Glyph* _hfill_glue;
  139.       Glyph* _vfil_glue;
  140.       Glyph* _word_space;
  141.    };
  142.  
  143. #endif
  144.