// -*- 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
*
- * Copyright: 1996, Alejandro Aguilar Sierra
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * Version: 0.4, Lyx project.
+ * \author Alejandro Aguilar Sierra
+ * \author André Pönitz
*
- * 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_atom.h"
-#include "mathed/formulabase.h"
-#include "math_defs.h"
+#include <boost/scoped_ptr.hpp>
-class MathMatrixInset;
-///
+/// The main LyX math inset
class InsetFormula : public InsetFormulaBase {
public:
///
- InsetFormula();
+ InsetFormula(bool chemistry = false);
///
- InsetFormula(InsetFormula const &);
+ explicit InsetFormula(BufferView *);
///
- explicit InsetFormula(MathInsetTypes);
+ explicit InsetFormula(string const & data);
///
- explicit InsetFormula(string const &);
+ InsetFormula(InsetFormula const &);
///
~InsetFormula();
///
- void operator=(InsetFormula const &);
- ///
- int ascent(BufferView *, LyXFont const &) const;
- ///
- int descent(BufferView *, LyXFont const &) const;
- ///
- int width(BufferView *, LyXFont const &) const;
- ///
- void draw(BufferView *, LyXFont const &, int, float &, bool) const;
+ void metrics(MetricsInfo & mi, Dimension & dim) const;
///
- void metrics() const;
+ void draw(PainterInfo & pi, int x, int y) const;
///
- void write(std::ostream &) const;
+ void write(Buffer const *, std::ostream &) const;
///
- void read(LyXLex & lex);
+ void read(Buffer const *, LyXLex & lex);
///
- int latex(std::ostream &,
- bool fragile, bool free_spc) const;
+ int latex(Buffer const *, std::ostream &,
+ LatexRunParams const &) const;
///
- int ascii(std::ostream &, int linelen) const;
+ int ascii(Buffer const *, std::ostream &, int linelen) const;
///
- int linuxdoc(std::ostream &) const;
+ int linuxdoc(Buffer const *, std::ostream &) const;
///
- int docbook(std::ostream &) const;
+ int docbook(Buffer const *, std::ostream &, bool mixcont) 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;
///
- virtual RESULT localDispatch(BufferView *, kb_action, string const &);
+ void getLabelList(std::vector<string> &) const;
///
- std::vector<string> const getLabelList() const;
+ MathAtom const & par() const { return par_; }
///
- void handleExtern(string const & arg, BufferView * bv);
+ MathAtom & par() { return par_; }
///
- MathInset const * par() const;
+ void generatePreview() const;
///
- bool display() const;
+ void addPreview(lyx::graphics::PreviewLoader &) const;
///
- bool ams() const;
- ///
- MathInsetTypes getType() const;
+ void mutate(string const & type);
+
private:
- /// Safe setting of contents
- void par(MathMatrixInset *);
- ///
- MathMatrixInset * par_;
+ /// available in AMS only?
+ bool ams() const;
+
+ /// contents
+ MathAtom par_;
+
+ /// Use the Pimpl idiom to hide the internals of the previewer.
+ class PreviewImpl;
+ friend class PreviewImpl;
+ /// The pointer never changes although *preview_'s contents may.
+ boost::scoped_ptr<PreviewImpl> const preview_;
};
#endif