home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / lyx-0.13.2.tar.gz / lyx-0.13.2.tar / lyx-0.13.2 / src / insetcommand.h < prev    next >
C/C++ Source or Header  |  1998-04-23  |  2KB  |  110 lines

  1. // -*- C++ -*-
  2. /* This file is part of*
  3.  * ======================================================
  4.  *
  5.  *           LyX, The Document Processor
  6.  *      
  7.  *        Copyright (C) 1995 Matthias Ettrich
  8.  *          Copyright (C) 1996-1998 The LyX Team.
  9.  *
  10.  *======================================================*/
  11.  
  12. #ifndef _INSET_LATEXCOMMAND_H
  13. #define _INSET_LATEXCOMMAND_H
  14.  
  15. #ifdef __GNUG__
  16. #pragma interface
  17. #endif
  18.  
  19. #include "lyxinset.h"
  20. #include "LString.h"
  21.  
  22. // Created by Alejandro 970222
  23. /** Used to insert a LaTeX command automatically
  24.  *
  25.  * Similar to InsetLaTeX but having control of the basic structure of a
  26.  *   LaTeX command: \name[options]{contents}. 
  27.  */
  28. class InsetCommand: public Inset {
  29. public:
  30.     ///
  31.     InsetCommand();
  32.     ///
  33.     InsetCommand(LString const & name, LString const & arg = LString(), 
  34.              LString const & opt = LString());
  35.     ///
  36.     ~InsetCommand();
  37.     ///
  38.     int Ascent(LyXFont const &font) const;
  39.     ///
  40.     int Descent(LyXFont const &font) const;
  41.     ///
  42.     int Width(LyXFont const &font) const;
  43.     ///
  44.     void Draw(LyXFont, LyXScreen &scr, int baseline, float &x);
  45.     ///
  46.     void Write(FILE *file);
  47.     /// Parse the command.
  48.     void scanCommand(LString const &cmd);
  49.     /// Will not be used when lyxf3
  50.     void Read(LyXLex &lex);
  51.     /// 
  52.     virtual int Latex(FILE *file, signed char fragile);
  53.     ///
  54.     virtual int Latex(LString &file, signed char fragile);
  55.     ///
  56.     Inset* Clone();
  57.     ///  
  58.     Inset::Code LyxCode() const
  59.     {
  60.         return Inset::NO_CODE;
  61.     }
  62.     
  63.     /** Get the label that appears at screen.
  64.       
  65.          I thought it was enough to eliminate the argument to avoid
  66.          confusion with lyxinset::getLabel(int), but I've seen that
  67.          it wasn't. I hope you never confuse again both methods.  (ale)
  68.      */
  69.     virtual LString getScreenLabel() const
  70.     {
  71.         return getCommand();
  72.     }
  73.     
  74.     /// Build the complete LaTeX command
  75.     LString getCommand() const;
  76.     ///
  77.     LString const &getCmdName() const {
  78.         return command;
  79.     }
  80.     ///
  81.     LString const &getOptions() const {
  82.         return options;
  83.     }
  84.     ///
  85.     LString const &getContents() const {
  86.         return contents;
  87.     }
  88.     ///
  89.     void setCmdName(LString const & n) {
  90.         command = n;
  91.     }
  92.     ///
  93.     void setOptions(LString const & o) {
  94.         options = o;
  95.     }
  96.     ///
  97.     virtual void setContents(LString const & c) {
  98.         contents = c;
  99.     }
  100. protected:
  101.     ///    
  102.     LString command;
  103.     ///    
  104.     LString options;
  105.     ///    
  106.     LString contents;
  107. };
  108.  
  109. #endif
  110.