]> 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 bc3cb17978710e5058d6c3193a18f452faac2cc2..3d1d1bf53933a308741da66b18115ce81507cf2e 100644 (file)
@@ -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(Painter &, LyXFont const &) const;
-       ///
-       int descent(Painter &, LyXFont const &) const;
-       ///
-       int width(Painter &, LyXFont const &) const;
-       ///
-       void draw(Painter &, LyXFont const &, int baseline, float & x) const;
-       ///
-       void Write(ostream &) const;
+       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(ostream &, signed char fragile) const;
-#ifndef USE_OSTREAM_ONLY
+       virtual int Latex(Buffer const *, std::ostream &,
+                         bool fragile, bool free_spc) const;
        ///
-       virtual int Latex(string & file, signed char fragile) const;
-#endif
+       int Ascii(Buffer const *, std::ostream &) const;
        ///
-       virtual int Linuxdoc(string & file) const;
+       virtual int Linuxdoc(Buffer const *, std::ostream &) const;
        ///
-       virtual int DocBook(string & file) const;
+       virtual int DocBook(Buffer const *, std::ostream &) const;
        ///
        Inset * Clone() const;
        ///  
@@ -74,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 {
@@ -91,7 +83,7 @@ public:
        }
        ///
        void setCmdName(string const & n) {
-               command = n;
+               cmdname = n;
        }
        ///
        void setOptions(string const & o) {
@@ -101,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;
        ///