]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/formula.h
Rename ascii to plaintext and LatexRunParams to OutputParams.
[lyx.git] / src / mathed / formula.h
index 38b41cbccbcbdaa042692b40df1576ffe46a203f..19acb55cea660525d64b3a5d227ca580b292cd26 100644 (file)
@@ -1,94 +1,93 @@
 // -*- C++ -*-
-/*
- *  File:        formula.h
- *  Purpose:     Declaration of formula inset
- *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx> 
- *  Created:     January 1996
- *  Description: Allows the edition of math paragraphs inside Lyx. 
+/**
+ * \file formula.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *  Copyright: 1996, Alejandro Aguilar Sierra
+ * \author Alejandro Aguilar Sierra
+ * \author André Pönitz
  *
- *  Version: 0.4, Lyx project.
- *
- *   You are free to use and modify this code under the terms of
- *   the GNU General Public Licence version 2 or later.
+ * Full author contact details are available in file CREDITS.
  */
 
-#ifndef INSET_FORMULA_H 
+#ifndef INSET_FORMULA_H
 #define INSET_FORMULA_H
 
-#ifdef __GNUG__
-#pragma interface
-#endif
-
 #include "formulabase.h"
-#include "math_defs.h"
 #include "math_atom.h"
 
-class MathMatrixInset;
+#include <boost/scoped_ptr.hpp>
+
+class RenderPreview;
 
-///
+
+/// The main LyX math inset
 class InsetFormula : public InsetFormulaBase {
 public:
        ///
-       InsetFormula();
+       InsetFormula(bool chemistry = false);
        ///
-       explicit InsetFormula(MathInsetTypes);
+       explicit InsetFormula(BufferView *);
        ///
-       explicit InsetFormula(string const &);
+       explicit InsetFormula(std::string const & data);
        ///
-       int ascent(BufferView *, LyXFont const &) const;
+       InsetFormula(InsetFormula const &);
        ///
-       int descent(BufferView *, LyXFont const &) const;
+       ~InsetFormula();
        ///
-       int width(BufferView *, LyXFont const &) const;
+       void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
-       void draw(BufferView *, LyXFont const &, int, float &, bool) const;
+       void draw(PainterInfo & pi, int x, int y) const;
 
        ///
-       void write(Buffer const *, std::ostream &) const;
+       void write(Buffer const &, std::ostream &) const;
        ///
-       void read(Buffer const *, LyXLex & lex);
+       void read(Buffer const &, LyXLex & lex);
        ///
-       int latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
+       int latex(Buffer const &, std::ostream &,
+                 OutputParams const &) const;
        ///
-       int ascii(Buffer const *, std::ostream &, int linelen) const;
+       int plaintext(Buffer const &, std::ostream &,
+                 OutputParams const &) const;
        ///
-       int linuxdoc(Buffer const *, std::ostream &) const;
+       int linuxdoc(Buffer const &, std::ostream &,
+                    OutputParams const &) const;
        ///
-       int docbook(Buffer const *, std::ostream &) const;
+       int docbook(Buffer const &, std::ostream &,
+                   OutputParams const &) const;
 
        ///
-       Inset * clone(Buffer const &, bool same_id = false) const;
+       virtual std::auto_ptr<InsetBase> clone() const;
        ///
        void validate(LaTeXFeatures & features) const;
        ///
-       Inset::Code lyxCode() const;
+       InsetOld::Code lyxCode() const;
        ///
-       bool insetAllowed(Inset::Code code) const;
+       bool insetAllowed(InsetOld::Code code) const;
+       /// Appends \c list with all labels found within this inset.
+       void getLabelList(Buffer const &,
+                         std::vector<std::string> & list) const;
        ///
-       virtual RESULT localDispatch(BufferView *, kb_action, string const &);
+       MathAtom const & par() const { return par_; }
        ///
-       std::vector<string> const getLabelList() const;
+       MathAtom & par() { return par_; }
        ///
-       void handleExtern(string const & arg);
+       void generatePreview(Buffer const &) const;
        ///
-       bool display() const;
+       void addPreview(lyx::graphics::PreviewLoader &) const;
        ///
+       void mutate(std::string const & type);
+
+private:
+       /// Slot receiving a signal that the preview is ready to display.
+       void statusChanged() const;
+       /// available in AMS only?
        bool ams() const;
-       ///
-       MathInsetTypes getType() const;
-       ///
-       MathAtom const & par() const { return par_; }
-       ///
-       MathAtom & par() { return par_; }
-public:
-       ///
+
+       /// contents
        MathAtom par_;
 
-       /// Access
-       MathMatrixInset * mat();
-       /// Access
-       MathMatrixInset const * mat() const;
+       /// The pointer never changes although *preview_'s contents may.
+       boost::scoped_ptr<RenderPreview> const preview_;
 };
 #endif