2001-02-13 13:28:32 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file math_hullinset.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
2001-11-08 12:30:26 +00:00
|
|
|
|
#ifndef MATH_HULLINSET_H
|
|
|
|
|
#define MATH_HULLINSET_H
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
2001-07-17 07:38:41 +00:00
|
|
|
|
#include "math_gridinset.h"
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
2001-02-26 12:53:35 +00:00
|
|
|
|
|
2003-08-19 13:00:56 +00:00
|
|
|
|
/// This provides an interface between "LyX insets" and "LyX math insets"
|
2001-11-08 12:30:26 +00:00
|
|
|
|
class MathHullInset : public MathGridInset {
|
2002-03-21 17:42:56 +00:00
|
|
|
|
public:
|
2001-02-16 09:25:43 +00:00
|
|
|
|
///
|
2001-11-08 12:30:26 +00:00
|
|
|
|
MathHullInset();
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
explicit MathHullInset(std::string const & type);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2004-01-30 11:41:12 +00:00
|
|
|
|
std::auto_ptr<InsetBase> clone() const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2002-07-18 11:02:33 +00:00
|
|
|
|
mode_type currentMode() const;
|
|
|
|
|
///
|
2003-06-02 10:03:27 +00:00
|
|
|
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
2001-02-16 09:25:43 +00:00
|
|
|
|
///
|
2003-03-21 14:20:48 +00:00
|
|
|
|
void draw(PainterInfo &, int x, int y) const;
|
2001-02-16 09:25:43 +00:00
|
|
|
|
///
|
2003-05-28 13:22:36 +00:00
|
|
|
|
void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
|
2002-03-18 11:45:53 +00:00
|
|
|
|
///
|
2002-05-02 07:30:49 +00:00
|
|
|
|
void drawT(TextPainter &, int x, int y) const;
|
2002-03-18 11:45:53 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string label(row_type row) const;
|
2001-02-16 09:25:43 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void label(row_type row, std::string const & label);
|
2001-02-16 09:25:43 +00:00
|
|
|
|
///
|
2001-09-26 16:52:34 +00:00
|
|
|
|
void numbered(row_type row, bool num);
|
2001-02-16 09:25:43 +00:00
|
|
|
|
///
|
2001-09-26 16:52:34 +00:00
|
|
|
|
bool numbered(row_type row) const;
|
2001-02-16 09:25:43 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
bool numberedType() const;
|
2001-02-16 09:25:43 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
bool ams() const;
|
2003-09-18 20:18:39 +00:00
|
|
|
|
/// Appends \c list with all labels found within this inset.
|
|
|
|
|
void getLabelList(Buffer const &,
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::vector<std::string> & list) const;
|
2001-02-16 09:25:43 +00:00
|
|
|
|
///
|
2001-07-26 06:56:43 +00:00
|
|
|
|
void validate(LaTeXFeatures & features) const;
|
2001-10-12 12:02:49 +00:00
|
|
|
|
/// identifies MatrixInsets
|
2001-12-11 15:04:02 +00:00
|
|
|
|
MathHullInset const * asHullInset() const { return this; }
|
2001-11-09 08:35:57 +00:00
|
|
|
|
/// identifies HullInset
|
2001-12-11 15:04:02 +00:00
|
|
|
|
MathHullInset * asHullInset() { return this; }
|
2001-02-16 09:25:43 +00:00
|
|
|
|
|
2002-08-21 13:47:52 +00:00
|
|
|
|
/// add a row
|
|
|
|
|
void addRow(row_type row);
|
|
|
|
|
/// delete a row
|
|
|
|
|
void delRow(row_type row);
|
2003-10-06 09:57:03 +00:00
|
|
|
|
///
|
|
|
|
|
void swapRow(row_type row);
|
2002-08-21 13:47:52 +00:00
|
|
|
|
/// add a column
|
|
|
|
|
void addCol(col_type col);
|
|
|
|
|
/// delete a column
|
|
|
|
|
void delCol(col_type col);
|
2001-02-16 09:25:43 +00:00
|
|
|
|
|
2002-07-03 10:36:44 +00:00
|
|
|
|
/// get type
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const & getType() const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
/// change type
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void mutate(std::string const &);
|
2001-09-04 13:32:06 +00:00
|
|
|
|
|
|
|
|
|
///
|
2001-09-26 16:52:34 +00:00
|
|
|
|
int defaultColSpace(col_type col);
|
2001-09-04 13:32:06 +00:00
|
|
|
|
///
|
2001-09-26 16:52:34 +00:00
|
|
|
|
char defaultColAlign(col_type col);
|
2002-06-18 15:44:30 +00:00
|
|
|
|
///
|
2004-01-16 12:36:23 +00:00
|
|
|
|
bool idxFirst(LCursor &) const;
|
2002-06-18 15:44:30 +00:00
|
|
|
|
///
|
2004-01-16 12:36:23 +00:00
|
|
|
|
bool idxLast(LCursor &) const;
|
2001-02-16 09:25:43 +00:00
|
|
|
|
|
2003-04-28 08:44:56 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string fileInsetLabel() const;
|
2001-11-07 18:15:24 +00:00
|
|
|
|
///
|
2001-11-09 18:02:20 +00:00
|
|
|
|
void write(WriteStream & os) const;
|
|
|
|
|
///
|
2001-11-07 18:15:24 +00:00
|
|
|
|
void mathmlize(MathMLStream &) const;
|
2001-11-09 18:02:20 +00:00
|
|
|
|
///
|
|
|
|
|
void normalize(NormalStream &) const;
|
2002-05-30 07:09:54 +00:00
|
|
|
|
///
|
|
|
|
|
void infoize(std::ostream & os) const;
|
2001-08-01 13:28:45 +00:00
|
|
|
|
|
2004-01-30 11:41:12 +00:00
|
|
|
|
///
|
|
|
|
|
void write(Buffer const &, std::ostream & os) const;
|
|
|
|
|
///
|
|
|
|
|
void read(Buffer const &, LyXLex & lex);
|
|
|
|
|
///
|
|
|
|
|
int latex(Buffer const &, std::ostream &,
|
|
|
|
|
OutputParams const &) const;
|
|
|
|
|
///
|
|
|
|
|
int plaintext(Buffer const &, std::ostream &,
|
|
|
|
|
OutputParams const &) const;
|
|
|
|
|
///
|
|
|
|
|
int linuxdoc(Buffer const &, std::ostream &,
|
|
|
|
|
OutputParams const &) const;
|
|
|
|
|
///
|
|
|
|
|
int docbook(Buffer const &, std::ostream &,
|
|
|
|
|
OutputParams const &) const;
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
//bool insetAllowed(Code code) const;
|
|
|
|
|
///
|
|
|
|
|
//void addPreview(lyx::graphics::PreviewLoader &) const;
|
|
|
|
|
|
|
|
|
|
|
2002-08-15 17:41:24 +00:00
|
|
|
|
protected:
|
2003-10-29 10:47:21 +00:00
|
|
|
|
///
|
2004-02-16 11:58:51 +00:00
|
|
|
|
void priv_dispatch(LCursor & cur, FuncRequest const & cmd);
|
2002-12-01 22:59:25 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string eolString(row_type row, bool fragile) const;
|
2002-08-15 17:41:24 +00:00
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
private:
|
2001-09-04 13:32:06 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void setType(std::string const & type);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-07-26 06:56:43 +00:00
|
|
|
|
void validate1(LaTeXFeatures & features);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-11-19 19:06:05 +00:00
|
|
|
|
void header_write(WriteStream &) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-11-19 19:06:05 +00:00
|
|
|
|
void footer_write(WriteStream &) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string nicelabel(row_type row) const;
|
2002-06-24 15:37:14 +00:00
|
|
|
|
///
|
2004-01-16 12:36:23 +00:00
|
|
|
|
void doExtern(LCursor & cur, FuncRequest const & func);
|
2002-08-14 16:43:16 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
void glueall();
|
|
|
|
|
///
|
2002-06-24 15:37:14 +00:00
|
|
|
|
char const * standardFont() const;
|
2001-12-11 15:04:02 +00:00
|
|
|
|
/// consistency check
|
|
|
|
|
void check() const;
|
2002-08-21 13:47:52 +00:00
|
|
|
|
/// can this change its number of cols?
|
|
|
|
|
bool colChangeOK() const;
|
2001-02-16 09:25:43 +00:00
|
|
|
|
|
2002-07-04 11:00:51 +00:00
|
|
|
|
/// "none", "simple", "display", "eqnarray",...
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string type_;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
|
|
|
|
std::vector<int> nonum_;
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::vector<std::string> label_;
|
2004-01-26 10:13:15 +00:00
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Incorporate me
|
|
|
|
|
//
|
|
|
|
|
public:
|
|
|
|
|
/// lowest x coordinate
|
|
|
|
|
int xlow() const;
|
|
|
|
|
/// highest x coordinate
|
|
|
|
|
int xhigh() const;
|
|
|
|
|
/// lowest y coordinate
|
|
|
|
|
int ylow() const;
|
|
|
|
|
/// highest y coordinate
|
|
|
|
|
int yhigh() const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// what appears in the minibuffer when opening
|
|
|
|
|
virtual std::string const editMessage() const;
|
|
|
|
|
///
|
|
|
|
|
virtual void getCursorDim(int &, int &) const;
|
|
|
|
|
///
|
|
|
|
|
virtual void insetUnlock(BufferView & bv);
|
|
|
|
|
|
|
|
|
|
/// To allow transparent use of math editing functions
|
|
|
|
|
//virtual void status(FuncRequest const &);
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
virtual bool searchForward(BufferView *, std::string const &,
|
|
|
|
|
bool = true, bool = false);
|
|
|
|
|
///
|
|
|
|
|
virtual bool searchBackward(BufferView *, std::string const &,
|
|
|
|
|
bool = true, bool = false);
|
|
|
|
|
///
|
|
|
|
|
virtual bool isTextInset() const { return true; }
|
|
|
|
|
///
|
|
|
|
|
virtual void mutateToText();
|
|
|
|
|
///
|
|
|
|
|
virtual void revealCodes(LCursor & cur) const;
|
|
|
|
|
///
|
|
|
|
|
virtual EDITABLE editable() const { return HIGHLY_EDITABLE; }
|
|
|
|
|
///
|
|
|
|
|
bool display() const;
|
|
|
|
|
///
|
2004-01-30 11:41:12 +00:00
|
|
|
|
Code lyxCode() const;
|
2004-01-26 10:13:15 +00:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
/// common base for handling accents
|
|
|
|
|
void handleAccent(BufferView & bv, std::string const & arg,
|
|
|
|
|
std::string const & name);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
/** Find the PreviewLoader, add a LaTeX snippet to it and
|
|
|
|
|
* start the loading process.
|
|
|
|
|
*
|
|
|
|
|
* Most insets have no interest in this capability, so the method
|
|
|
|
|
* defaults to empty.
|
|
|
|
|
*/
|
|
|
|
|
virtual void generatePreview(Buffer const &) const {}
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
void handleFont(LCursor &, std::string const & arg, std::string const & font);
|
|
|
|
|
///
|
|
|
|
|
void handleFont2(LCursor &, std::string const & arg);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
};
|
2001-02-16 09:25:43 +00:00
|
|
|
|
|
2004-01-30 11:41:12 +00:00
|
|
|
|
// We don't really want to mess around with mathed stuff outside mathed.
|
2004-01-26 10:13:15 +00:00
|
|
|
|
// So do it here.
|
|
|
|
|
void mathDispatch(LCursor & cur, FuncRequest const & cmd);
|
2001-02-13 13:28:32 +00:00
|
|
|
|
#endif
|