]> git.lyx.org Git - features.git/blobdiff - src/insets/insetcommand.h
read the Changelog
[features.git] / src / insets / insetcommand.h
index e335afc64e9c678d963f6551250ff8be85581fba..68c82a945eca708174b4cfc9f0a0132804757da1 100644 (file)
@@ -1,23 +1,22 @@
 // -*- C++ -*-
 /* This file is part of*
- * ======================================================
+ * ====================================================== 
  *
  *           LyX, The Document Processor
  *      
- *         Copyright (C) 1995 Matthias Ettrich
- *          Copyright (C) 1996-1998 The LyX Team.
+ *           Copyright 1995 Matthias Ettrich
+ *           Copyright 1995-2000 The LyX Team.
  *
- *======================================================*/
+ * ====================================================== */
 
-#ifndef _INSET_LATEXCOMMAND_H
-#define _INSET_LATEXCOMMAND_H
+#ifndef INSET_LATEXCOMMAND_H
+#define INSET_LATEXCOMMAND_H
 
 #ifdef __GNUG__
 #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();
        ///
-       InsetCommand(LString const & name, LString const & arg = LString(), 
-                    LString const & opt = LString());
+       explicit
+       InsetCommand(string const & name, string const & arg = string(), 
+                    string const & opt = string());
        ///
-       ~InsetCommand();
-       ///
-       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(LString const &cmd);
-       /// Will not be used when lyxf3
-       void Read(LyXLex &lex);
+       void scanCommand(string const & cmd);
+       ///
+       virtual 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(LString &file, signed char fragile);
+       int Ascii(Buffer const *, std::ostream &) const;
        ///
-       virtual int Linuxdoc(LString &file);
+       virtual int Linuxdoc(Buffer const *, std::ostream &) const;
        ///
-       virtual int DocBook(LString &file);
+       virtual int DocBook(Buffer const *, std::ostream &) const;
        ///
-       Inset* Clone();
+       Inset * Clone() const;
        ///  
        Inset::Code LyxCode() const
        {
@@ -70,44 +62,48 @@ public:
          confusion with lyxinset::getLabel(int), but I've seen that
          it wasn't. I hope you never confuse again both methods.  (ale)
         */
-       virtual LString getScreenLabel() const
+       virtual string getScreenLabel() const
        {
                return getCommand();
        }
-       
+
        /// Build the complete LaTeX command
-       LString getCommand() const;
+       string getCommand() const;
        ///
-       LString const &getCmdName() const {
-               return command;
+       string const & getCmdName() const {
+               return cmdname;
        }
        ///
-       LString const &getOptions() const {
+       string const & getOptions() const {
                return options;
        }
        ///
-       LString const &getContents() const {
+       string const & getContents() const {
                return contents;
        }
        ///
-       void setCmdName(LString const & n) {
-               command = n;
+       void setCmdName(string const & n) {
+               cmdname = n;
        }
        ///
-       void setOptions(LString const & o) {
+       void setOptions(string const & o) {
                options = o;
        }
        ///
-       virtual void setContents(LString const & c) {
+       virtual void setContents(string const & c) {
                contents = c;
        }
-protected:
+       ///
+       void addContents(string const & c) {
+               contents += c;
+       }
+private:
        ///    
-       LString command;
+       string cmdname;
        ///    
-       LString options;
+       string options;
        ///    
-       LString contents;
+       string contents;
 };
 
 #endif