1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-09-11 08:26:02 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \file formula.h
|
1999-09-27 18:44:28 +00:00
|
|
|
|
*
|
2002-09-11 08:26:02 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
1999-09-27 18:44:28 +00:00
|
|
|
|
*
|
2002-09-11 08:26:02 +00:00
|
|
|
|
* \author Alejandro Aguilar Sierra
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
1999-09-27 18:44:28 +00:00
|
|
|
|
*
|
2002-09-11 08:26:02 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
1999-09-27 18:44:28 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2002-03-21 17:42:56 +00:00
|
|
|
|
#ifndef INSET_FORMULA_H
|
1999-11-15 11:06:41 +00:00
|
|
|
|
#define INSET_FORMULA_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma interface
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-11-08 12:06:56 +00:00
|
|
|
|
#include "formulabase.h"
|
2001-10-12 12:02:49 +00:00
|
|
|
|
#include "math_atom.h"
|
2002-07-05 21:24:15 +00:00
|
|
|
|
|
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
2000-03-28 02:18:55 +00:00
|
|
|
|
|
2002-09-11 08:26:02 +00:00
|
|
|
|
/// The main LyX math inset
|
2001-06-25 00:06:33 +00:00
|
|
|
|
class InsetFormula : public InsetFormulaBase {
|
1999-09-27 18:44:28 +00:00
|
|
|
|
public:
|
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
InsetFormula();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2002-07-04 11:00:51 +00:00
|
|
|
|
explicit InsetFormula(BufferView *);
|
|
|
|
|
///
|
|
|
|
|
explicit InsetFormula(const string & data);
|
2001-07-06 12:09:32 +00:00
|
|
|
|
///
|
2002-07-05 21:24:15 +00:00
|
|
|
|
InsetFormula(InsetFormula const &);
|
|
|
|
|
///
|
|
|
|
|
~InsetFormula();
|
|
|
|
|
///
|
2000-07-05 14:57:48 +00:00
|
|
|
|
int ascent(BufferView *, LyXFont const &) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
|
///
|
2000-07-05 14:57:48 +00:00
|
|
|
|
int descent(BufferView *, LyXFont const &) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
|
///
|
2000-07-05 14:57:48 +00:00
|
|
|
|
int width(BufferView *, LyXFont const &) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
|
2001-07-06 12:09:32 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2001-09-24 13:38:52 +00:00
|
|
|
|
void write(Buffer const *, std::ostream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2001-09-24 13:38:52 +00:00
|
|
|
|
void read(Buffer const *, LyXLex & lex);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2001-09-24 13:38:52 +00:00
|
|
|
|
int latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
|
///
|
2001-09-24 13:38:52 +00:00
|
|
|
|
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
2000-04-24 20:58:23 +00:00
|
|
|
|
///
|
2001-09-24 13:38:52 +00:00
|
|
|
|
int linuxdoc(Buffer const *, std::ostream &) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
|
///
|
2002-06-18 15:44:30 +00:00
|
|
|
|
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
|
2001-07-06 12:09:32 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2001-07-06 15:57:54 +00:00
|
|
|
|
Inset * clone(Buffer const &, bool same_id = false) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
void validate(LaTeXFeatures & features) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
Inset::Code lyxCode() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2001-07-23 09:11:14 +00:00
|
|
|
|
bool insetAllowed(Inset::Code code) const;
|
|
|
|
|
///
|
2000-09-14 17:53:12 +00:00
|
|
|
|
std::vector<string> const getLabelList() const;
|
2001-04-25 15:43:57 +00:00
|
|
|
|
///
|
2001-10-12 12:02:49 +00:00
|
|
|
|
MathAtom const & par() const { return par_; }
|
|
|
|
|
///
|
|
|
|
|
MathAtom & par() { return par_; }
|
2002-07-03 10:36:44 +00:00
|
|
|
|
///
|
2002-08-01 17:28:59 +00:00
|
|
|
|
void generatePreview() const;
|
|
|
|
|
///
|
|
|
|
|
void addPreview(grfx::PreviewLoader &) const;
|
2002-07-05 21:24:15 +00:00
|
|
|
|
///
|
2002-08-15 14:33:14 +00:00
|
|
|
|
//void mutate(string const & type);
|
2001-10-12 12:02:49 +00:00
|
|
|
|
|
2001-11-13 15:21:38 +00:00
|
|
|
|
private:
|
|
|
|
|
/// available in AMS only?
|
|
|
|
|
bool ams() const;
|
|
|
|
|
|
2002-06-25 18:21:17 +00:00
|
|
|
|
/// contents
|
2001-11-13 15:21:38 +00:00
|
|
|
|
MathAtom par_;
|
2002-07-05 21:24:15 +00:00
|
|
|
|
|
|
|
|
|
/// 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_;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
|
|
|
|
#endif
|