]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetcommand.h
Some more changes for updating text-insets.
[lyx.git] / src / insets / insetcommand.h
index eb71f13cec53b90acb4bfb24e37d0fb0050f8a35..3d1d1bf53933a308741da66b18115ce81507cf2e 100644 (file)
@@ -4,8 +4,8 @@
  *
  *           LyX, The Document Processor
  *      
- *         Copyright (C) 1995 Matthias Ettrich
- *          Copyright (C) 1996-1999 The LyX Team.
+ *           Copyright 1995 Matthias Ettrich
+ *           Copyright 1995-2000 The LyX Team.
  *
  * ====================================================== */
 
@@ -16,8 +16,7 @@
 #pragma interface
 #endif
 
-#include "lyxinset.h"
-#include "LString.h"
+#include "insetbutton.h"
 
 // Created by Alejandro 970222
 /** Used to insert a LaTeX command automatically
  * Similar to InsetLaTeX but having control of the basic structure of a
  *   LaTeX command: \name[options]{contents}. 
  */
-class InsetCommand: public Inset {
+class InsetCommand: public InsetButton {
 public:
        ///
        InsetCommand();
        ///
+       explicit
        InsetCommand(string const & name, string const & arg = string(), 
                     string const & opt = string());
        ///
-       int Ascent(LyXFont const & font) const;
-       ///
-       int Descent(LyXFont const & font) const;
-       ///
-       int Width(LyXFont const & font) const;
-       ///
-       void Draw(LyXFont, LyXScreen & scr, int baseline, float & x);
-       ///
-       void Write(FILE * file);
+       void Write(Buffer const *, std::ostream &) const;
+
        /// Parse the command.
        void scanCommand(string const & cmd);
        /// Will not be used when lyxf3
-       void Read(LyXLex & lex);
+       void Read(Buffer const *, LyXLex & lex);
        /// 
-       virtual int Latex(FILE * file, signed char fragile);
+       virtual int Latex(Buffer const *, std::ostream &,
+                         bool fragile, bool free_spc) const;
        ///
-       virtual int Latex(string & file, signed char fragile);
+       int Ascii(Buffer const *, std::ostream &) const;
        ///
-       virtual int Linuxdoc(string & file);
+       virtual int Linuxdoc(Buffer const *, std::ostream &) const;
        ///
-       virtual int DocBook(string & file);
+       virtual int DocBook(Buffer const *, std::ostream &) const;
        ///
        Inset * Clone() const;
        ///  
@@ -72,12 +66,12 @@ public:
        {
                return getCommand();
        }
-       
+
        /// Build the complete LaTeX command
        string getCommand() const;
        ///
        string const & getCmdName() const {
-               return command;
+               return cmdname;
        }
        ///
        string const & getOptions() const {
@@ -89,7 +83,7 @@ public:
        }
        ///
        void setCmdName(string const & n) {
-               command = n;
+               cmdname = n;
        }
        ///
        void setOptions(string const & o) {
@@ -99,9 +93,13 @@ public:
        virtual void setContents(string const & c) {
                contents = c;
        }
-protected:
+       ///
+       void addContents(string const & c) {
+               contents += c;
+       }
+private:
        ///    
-       string command;
+       string cmdname;
        ///    
        string options;
        ///