2001-06-25 00:06:33 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/*
|
2001-07-06 12:09:32 +00:00
|
|
|
|
* File: formulabase.h
|
|
|
|
|
* Purpose: Common parts of the math LyX insets
|
|
|
|
|
* Author: Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
* Created: May 2001
|
2001-06-25 00:06:33 +00:00
|
|
|
|
* Description: Allows the edition of math paragraphs inside Lyx.
|
|
|
|
|
*
|
2001-07-06 12:09:32 +00:00
|
|
|
|
* Copyright: 2001, The LyX Project
|
2001-06-25 00:06:33 +00:00
|
|
|
|
*
|
|
|
|
|
* You are free to use and modify this code under the terms of
|
|
|
|
|
* the GNU General Public Licence version 2 or later.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef INSET_FORMULABASE_H
|
|
|
|
|
#define INSET_FORMULABASE_H
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma interface
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <iosfwd>
|
|
|
|
|
#include "insets/inset.h"
|
|
|
|
|
|
2001-08-01 13:28:45 +00:00
|
|
|
|
// only for getType():
|
|
|
|
|
#include "math_defs.h"
|
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
class Buffer;
|
2001-07-06 12:09:32 +00:00
|
|
|
|
class BufferView;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
class MathInset;
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
class InsetFormulaBase : public UpdatableInset {
|
|
|
|
|
public:
|
|
|
|
|
///
|
2001-08-03 09:54:48 +00:00
|
|
|
|
InsetFormulaBase();
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
|
|
|
|
virtual int ascent(BufferView *, LyXFont const &) const = 0;
|
|
|
|
|
///
|
|
|
|
|
virtual int descent(BufferView *, LyXFont const &) const = 0;
|
|
|
|
|
///
|
|
|
|
|
virtual int width(BufferView *, LyXFont const &) const = 0;
|
|
|
|
|
///
|
|
|
|
|
virtual void draw(BufferView *,LyXFont const &, int, float &, bool) const = 0;
|
2001-07-06 12:09:32 +00:00
|
|
|
|
|
|
|
|
|
/// These are just wrappers taking the unused Buffer * dummy parameter
|
|
|
|
|
///
|
|
|
|
|
virtual void write(Buffer const *, std::ostream &) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-07-06 12:09:32 +00:00
|
|
|
|
virtual void read(Buffer const *, LyXLex & lex);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual int latex(Buffer const *, std::ostream &,
|
2001-07-06 12:09:32 +00:00
|
|
|
|
bool fragile, bool free_spc) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-07-06 12:09:32 +00:00
|
|
|
|
virtual int ascii(Buffer const *, std::ostream &, int linelen) const;
|
|
|
|
|
///
|
|
|
|
|
virtual int linuxdoc(Buffer const *, std::ostream &) const;
|
|
|
|
|
///
|
|
|
|
|
virtual int docBook(Buffer const *, std::ostream &) const;
|
2001-08-01 13:28:45 +00:00
|
|
|
|
///
|
|
|
|
|
virtual MathInsetTypes getType() const = 0;
|
2001-07-06 12:09:32 +00:00
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
/// the actual functions don't use the Buffer * parameter
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-07-06 12:09:32 +00:00
|
|
|
|
virtual void write(std::ostream &) const = 0;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-07-06 12:09:32 +00:00
|
|
|
|
virtual void read(LyXLex & lex) = 0;
|
|
|
|
|
///
|
|
|
|
|
virtual int latex(std::ostream &, bool fragile, bool free_spc) const = 0;
|
|
|
|
|
///
|
|
|
|
|
virtual int ascii(std::ostream &, int linelen) const = 0;
|
|
|
|
|
///
|
|
|
|
|
virtual int linuxdoc(std::ostream &) const = 0;
|
|
|
|
|
///
|
|
|
|
|
virtual int docBook(std::ostream &) const = 0;
|
|
|
|
|
|
|
|
|
|
public:
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void validate(LaTeXFeatures &) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-07-06 15:57:54 +00:00
|
|
|
|
virtual Inset * clone(Buffer const &, bool same_id = false) const = 0;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual Inset::Code lyxCode() const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
/// what appears in the minibuffer when opening
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual string const editMessage() const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void edit(BufferView *, int x, int y, unsigned int button);
|
2001-08-15 05:50:39 +00:00
|
|
|
|
///
|
2001-07-20 14:18:48 +00:00
|
|
|
|
virtual void edit(BufferView *, bool front = true);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void toggleInsetCursor(BufferView *);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void showInsetCursor(BufferView *, bool show = true);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void hideInsetCursor(BufferView *);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void getCursorPos(BufferView *, int &, int &) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void toggleInsetSelection(BufferView * bv);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void insetButtonPress(BufferView *, int x, int y, int button);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void insetButtonRelease(BufferView *, int x, int y, int button);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void insetKeyPress(XKeyEvent * ev);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void insetMotionNotify(BufferView *, int x, int y, int state);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void insetUnlock(BufferView *);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
2001-07-06 12:09:32 +00:00
|
|
|
|
/// To allow transparent use of math editing functions
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual RESULT localDispatch(BufferView *, kb_action, string const &);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
virtual std::vector<string> const getLabelList() const;
|
|
|
|
|
///
|
2001-08-06 17:20:26 +00:00
|
|
|
|
virtual MathInset const * par() const = 0;
|
2001-07-16 15:53:25 +00:00
|
|
|
|
///
|
2001-08-03 09:54:48 +00:00
|
|
|
|
virtual void metrics() const = 0;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
protected:
|
|
|
|
|
///
|
2001-07-17 09:46:07 +00:00
|
|
|
|
virtual void updateLocal(BufferView * bv, bool mark_dirty);
|
2001-08-01 09:18:21 +00:00
|
|
|
|
private:
|
|
|
|
|
/// unimplemented
|
|
|
|
|
void operator=(const InsetFormulaBase &);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
};
|
|
|
|
|
|
2001-07-06 12:09:32 +00:00
|
|
|
|
// We don't really mess want around with mathed stuff outside mathed.
|
|
|
|
|
// So do it here.
|
|
|
|
|
//
|
|
|
|
|
void mathDispatchCreation(BufferView *, string const &, bool);
|
|
|
|
|
//
|
|
|
|
|
void mathDispatchMathDisplay(BufferView *, string const &);
|
|
|
|
|
//
|
|
|
|
|
void mathDispatchMathMode(BufferView *, string const &);
|
|
|
|
|
//
|
|
|
|
|
void mathDispatchMathMacro(BufferView *, string const &);
|
|
|
|
|
//
|
|
|
|
|
void mathDispatchMathDelim(BufferView *, string const &);
|
|
|
|
|
//
|
|
|
|
|
void mathDispatchInsertMath(BufferView *, string const &);
|
|
|
|
|
//
|
|
|
|
|
void mathDispatchInsertMatrix(BufferView *, string const &);
|
|
|
|
|
//
|
|
|
|
|
void mathDispatchMathImportSelection(BufferView *, string const &);
|
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
#endif
|