2001-02-13 13:28:32 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
2006-09-17 09:14:18 +00:00
|
|
|
|
* \file InsetMathHull.h
|
2003-08-19 13:00:56 +00:00
|
|
|
|
* 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
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
|
#include "InsetMathGrid.h"
|
2008-02-15 08:09:35 +00:00
|
|
|
|
|
2004-04-13 17:38:16 +00:00
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2008-03-04 12:22:48 +00:00
|
|
|
|
class InsetLabel;
|
2008-02-15 08:09:35 +00:00
|
|
|
|
class ParConstIterator;
|
2004-04-13 17:38:16 +00:00
|
|
|
|
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"
|
2006-09-16 18:11:38 +00:00
|
|
|
|
class InsetMathHull : public InsetMathGrid {
|
2002-03-21 17:42:56 +00:00
|
|
|
|
public:
|
2001-02-16 09:25:43 +00:00
|
|
|
|
///
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathHull();
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2006-09-16 18:11:38 +00:00
|
|
|
|
explicit InsetMathHull(HullType type);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2006-09-16 18:11:38 +00:00
|
|
|
|
~InsetMathHull();
|
2004-04-13 17:38:16 +00:00
|
|
|
|
///
|
2008-03-04 12:22:48 +00:00
|
|
|
|
void setBuffer(Buffer &);
|
|
|
|
|
///
|
|
|
|
|
void updateLabels(ParIterator const &);
|
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
|
void addToToc(ParConstIterator const &) const;
|
2008-02-15 08:09:35 +00:00
|
|
|
|
///
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathHull & operator=(InsetMathHull const &);
|
2004-04-13 17:38:16 +00:00
|
|
|
|
///
|
2002-07-18 11:02:33 +00:00
|
|
|
|
mode_type currentMode() const;
|
|
|
|
|
///
|
2007-09-21 20:39:47 +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
|
|
|
|
///
|
2006-10-22 10:15:23 +00:00
|
|
|
|
docstring label(row_type row) const;
|
2001-02-16 09:25:43 +00:00
|
|
|
|
///
|
2006-10-22 10:15:23 +00:00
|
|
|
|
void label(row_type row, docstring 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;
|
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
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathHull const * asHullInset() const { return this; }
|
2001-11-09 08:35:57 +00:00
|
|
|
|
/// identifies HullInset
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathHull * 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
|
2006-09-03 16:14:51 +00:00
|
|
|
|
HullType getType() const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
/// change type
|
2006-09-03 16:14:51 +00:00
|
|
|
|
void mutate(HullType newtype);
|
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
|
|
|
|
///
|
2007-04-26 14:56:30 +00:00
|
|
|
|
bool idxFirst(Cursor &) const;
|
2002-06-18 15:44:30 +00:00
|
|
|
|
///
|
2007-04-26 14:56:30 +00:00
|
|
|
|
bool idxLast(Cursor &) 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;
|
|
|
|
|
///
|
2006-10-22 10:15:23 +00:00
|
|
|
|
void mathmlize(MathStream &) const;
|
2001-11-09 18:02:20 +00:00
|
|
|
|
///
|
|
|
|
|
void normalize(NormalStream &) const;
|
2002-05-30 07:09:54 +00:00
|
|
|
|
///
|
2006-10-22 10:15:23 +00:00
|
|
|
|
void infoize(odocstream & os) const;
|
2001-08-01 13:28:45 +00:00
|
|
|
|
|
2004-01-30 11:41:12 +00:00
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
|
void write(std::ostream & os) const;
|
2004-01-30 11:41:12 +00:00
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
|
void read(Lexer & lex);
|
2004-01-30 11:41:12 +00:00
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
|
int plaintext(odocstream &, OutputParams const &) const;
|
2004-01-30 11:41:12 +00:00
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
|
int docbook(odocstream &, OutputParams const &) const;
|
2005-11-25 14:40:34 +00:00
|
|
|
|
/// the string that is passed to the TOC
|
2008-02-27 20:43:16 +00:00
|
|
|
|
void textString(odocstream &) 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
|
2008-02-22 20:45:18 +00:00
|
|
|
|
bool notifyCursorLeaves(Cursor const & old, Cursor & cur);
|
2004-01-30 11:41:12 +00:00
|
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
|
//bool insetAllowed(InsetCode code) const;
|
2004-01-30 11:41:12 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
void addPreview(graphics::PreviewLoader &) const;
|
2004-01-30 11:41:12 +00:00
|
|
|
|
|
2006-09-08 13:52:41 +00:00
|
|
|
|
///
|
|
|
|
|
static int displayMargin() { return 12; }
|
2007-11-05 23:44:47 +00:00
|
|
|
|
|
|
|
|
|
/// Force inset into LTR environment if surroundings are RTL?
|
|
|
|
|
virtual bool forceLTR() const { return true; }
|
2007-05-11 02:34:56 +00:00
|
|
|
|
|
2008-03-09 15:07:27 +00:00
|
|
|
|
///
|
|
|
|
|
virtual docstring contextMenu(BufferView const &, int, int) const;
|
|
|
|
|
|
2002-08-15 17:41:24 +00:00
|
|
|
|
protected:
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathHull(InsetMathHull const &);
|
2004-11-23 23:04:52 +00:00
|
|
|
|
|
2007-04-26 14:56:30 +00:00
|
|
|
|
virtual void doDispatch(Cursor & 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?
|
2007-04-26 14:56:30 +00:00
|
|
|
|
bool getStatus(Cursor & cur, FuncRequest const & cmd,
|
2004-04-06 19:25:39 +00:00
|
|
|
|
FuncStatus & status) const;
|
2002-12-01 22:59:25 +00:00
|
|
|
|
///
|
2006-10-22 10:15:23 +00:00
|
|
|
|
docstring 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:
|
2007-08-30 18:03:17 +00:00
|
|
|
|
virtual Inset * clone() const;
|
2001-09-04 13:32:06 +00:00
|
|
|
|
///
|
2006-09-03 16:14:51 +00:00
|
|
|
|
void setType(HullType 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
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
docstring nicelabel(row_type row) const;
|
2002-06-24 15:37:14 +00:00
|
|
|
|
///
|
2007-04-26 14:56:30 +00:00
|
|
|
|
void doExtern(Cursor & 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
|
|
|
|
///
|
2006-10-22 10:15:23 +00:00
|
|
|
|
docstring 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",...
|
2006-09-03 16:14:51 +00:00
|
|
|
|
HullType type_;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2008-03-04 12:22:48 +00:00
|
|
|
|
std::vector<bool> nonum_;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2008-03-04 12:22:48 +00:00
|
|
|
|
std::vector<InsetLabel *> 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
|
2008-02-27 20:43:16 +00:00
|
|
|
|
docstring editMessage() const;
|
2004-01-26 10:13:15 +00:00
|
|
|
|
///
|
|
|
|
|
virtual void mutateToText();
|
|
|
|
|
///
|
2007-04-26 14:56:30 +00:00
|
|
|
|
virtual void revealCodes(Cursor & cur) const;
|
2004-01-26 10:13:15 +00:00
|
|
|
|
///
|
2004-04-13 06:27:29 +00:00
|
|
|
|
EDITABLE editable() const { return HIGHLY_EDITABLE; }
|
2004-01-26 10:13:15 +00:00
|
|
|
|
///
|
2008-02-10 19:52:45 +00:00
|
|
|
|
void edit(Cursor & cur, bool front,
|
2008-02-11 08:20:13 +00:00
|
|
|
|
EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
|
2004-04-06 19:25:39 +00:00
|
|
|
|
///
|
2007-04-29 13:39:47 +00:00
|
|
|
|
Inset * editXY(Cursor & cur, int x, int y);
|
2005-07-15 00:39:44 +00:00
|
|
|
|
///
|
2007-05-18 14:32:29 +00:00
|
|
|
|
DisplayType display() const;
|
2004-01-26 10:13:15 +00:00
|
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
|
InsetCode lyxCode() const;
|
2004-01-26 10:13:15 +00:00
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
///
|
2007-04-26 14:56:30 +00:00
|
|
|
|
void handleFont(Cursor & cur, docstring const & arg,
|
2006-10-22 10:15:23 +00:00
|
|
|
|
docstring const & font);
|
2005-07-18 00:45:10 +00:00
|
|
|
|
///
|
2007-04-26 14:56:30 +00:00
|
|
|
|
void handleFont2(Cursor & cur, docstring 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
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
2001-02-13 13:28:32 +00:00
|
|
|
|
#endif
|