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"
|
2004-04-13 17:38:16 +00:00
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
|
|
|
|
|
|
|
|
class RenderPreview;
|
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-04-13 17:38:16 +00:00
|
|
|
|
~MathHullInset();
|
|
|
|
|
///
|
2004-11-23 23:04:52 +00:00
|
|
|
|
MathHullInset & operator=(MathHullInset const &);
|
2004-04-13 17:38:16 +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;
|
2005-10-14 10:50:23 +00:00
|
|
|
|
/// identifies HullInset
|
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);
|
2004-11-23 14:43:37 +00:00
|
|
|
|
/// swap two rows
|
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
|
|
|
|
|
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 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;
|
2005-11-25 14:40:34 +00:00
|
|
|
|
/// the string that is passed to the TOC
|
|
|
|
|
virtual int textString(Buffer const &, std::ostream & os,
|
|
|
|
|
OutputParams const &) const;
|
2004-01-30 11:41:12 +00:00
|
|
|
|
|
2004-04-13 17:38:16 +00:00
|
|
|
|
/// get notification when the cursor leaves this inset
|
|
|
|
|
void notifyCursorLeaves(LCursor & cur);
|
2004-01-30 11:41:12 +00:00
|
|
|
|
///
|
|
|
|
|
//bool insetAllowed(Code code) const;
|
|
|
|
|
///
|
2004-04-13 17:38:16 +00:00
|
|
|
|
void addPreview(lyx::graphics::PreviewLoader &) const;
|
2004-01-30 11:41:12 +00:00
|
|
|
|
|
|
|
|
|
|
2002-08-15 17:41:24 +00:00
|
|
|
|
protected:
|
2004-11-23 23:04:52 +00:00
|
|
|
|
MathHullInset(MathHullInset const &);
|
|
|
|
|
|
2004-11-24 21:58:42 +00:00
|
|
|
|
virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
|
2004-11-23 23:04:52 +00:00
|
|
|
|
|
2004-04-06 19:25:39 +00:00
|
|
|
|
/// do we want to handle this event?
|
|
|
|
|
bool getStatus(LCursor & cur, FuncRequest const & cmd,
|
|
|
|
|
FuncStatus & status) const;
|
2002-12-01 22:59:25 +00:00
|
|
|
|
///
|
2005-10-14 10:50:23 +00:00
|
|
|
|
std::string eolString(row_type row, bool emptyline, bool fragile) const;
|
2002-08-15 17:41:24 +00:00
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
private:
|
2004-11-23 23:04:52 +00:00
|
|
|
|
virtual std::auto_ptr<InsetBase> doClone() const;
|
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-03-18 12:53:43 +00:00
|
|
|
|
void doExtern(LCursor & cur, FuncRequest & func);
|
2002-08-14 16:43:16 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
void glueall();
|
2004-09-13 18:14:37 +00:00
|
|
|
|
/*!
|
|
|
|
|
* split every row at the first relation operator.
|
|
|
|
|
* The number of columns must be 1. One column is added.
|
|
|
|
|
* The first relation operator and everything after it goes to the
|
|
|
|
|
* second column.
|
|
|
|
|
*/
|
|
|
|
|
void splitTo2Cols();
|
|
|
|
|
/*!
|
|
|
|
|
* split every row at the first relation operator.
|
|
|
|
|
* The number of columns must be < 3. One or two columns are added.
|
|
|
|
|
* The first relation operator goes to the second column.
|
|
|
|
|
* Everything after it goes to the third column.
|
|
|
|
|
*/
|
|
|
|
|
void splitTo3Cols();
|
|
|
|
|
/// change number of columns, split or combine columns if necessary.
|
|
|
|
|
void changeCols(col_type);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
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;
|
2004-11-23 14:43:37 +00:00
|
|
|
|
/// can this change its number of rows?
|
|
|
|
|
bool rowChangeOK() 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-04-13 17:38:16 +00:00
|
|
|
|
///
|
|
|
|
|
boost::scoped_ptr<RenderPreview> preview_;
|
2005-07-18 00:45:10 +00:00
|
|
|
|
///
|
|
|
|
|
mutable bool use_preview_;
|
2004-01-26 10:13:15 +00:00
|
|
|
|
//
|
|
|
|
|
// Incorporate me
|
|
|
|
|
//
|
|
|
|
|
public:
|
|
|
|
|
/// what appears in the minibuffer when opening
|
|
|
|
|
virtual std::string const editMessage() const;
|
|
|
|
|
///
|
2006-03-17 19:45:28 +00:00
|
|
|
|
virtual bool canTrackChanges() const { return true; }
|
2004-01-26 10:13:15 +00:00
|
|
|
|
///
|
|
|
|
|
virtual void mutateToText();
|
|
|
|
|
///
|
|
|
|
|
virtual void revealCodes(LCursor & cur) const;
|
|
|
|
|
///
|
2004-04-13 06:27:29 +00:00
|
|
|
|
EDITABLE editable() const { return HIGHLY_EDITABLE; }
|
2004-01-26 10:13:15 +00:00
|
|
|
|
///
|
2004-04-06 19:25:39 +00:00
|
|
|
|
void edit(LCursor & cur, bool left);
|
|
|
|
|
///
|
2005-07-15 00:39:44 +00:00
|
|
|
|
InsetBase * editXY(LCursor & cur, int x, int y);
|
|
|
|
|
///
|
2004-01-26 10:13:15 +00:00
|
|
|
|
bool display() const;
|
|
|
|
|
///
|
2004-01-30 11:41:12 +00:00
|
|
|
|
Code lyxCode() const;
|
2004-01-26 10:13:15 +00:00
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
///
|
2005-07-18 00:45:10 +00:00
|
|
|
|
void handleFont(LCursor & cur, std::string const & arg,
|
|
|
|
|
std::string const & font);
|
|
|
|
|
///
|
|
|
|
|
void handleFont2(LCursor & cur, std::string const & arg);
|
2004-01-26 10:13:15 +00:00
|
|
|
|
///
|
2005-07-18 00:45:10 +00:00
|
|
|
|
bool previewState(BufferView * bv) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
};
|
2001-02-16 09:25:43 +00:00
|
|
|
|
|
2001-02-13 13:28:32 +00:00
|
|
|
|
#endif
|