Fix bug 2932 (non-UI part only)

* src/mathed/InsetMathGrid.[Ch]
	(InsetMathGrid::allow_pagebreak_): New member

	* src/mathed/InsetMathGrid.C
	(InsetMathGrid::eolString): Output \\* if allow_pagebreak_ is false

	* src/mathed/MathParser.C
	(addRow): Set allow_pagebreak_ in rowinfo if needed
	(Parser::parse1): Parse '\\*' correctly


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17484 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2007-03-19 16:08:17 +00:00
parent 1716b7323f
commit b0cfb6c53b
3 changed files with 16 additions and 3 deletions

View File

@ -113,7 +113,7 @@ InsetMathGrid::CellInfo::CellInfo()
InsetMathGrid::RowInfo::RowInfo()
: lines_(0), skip_(0)
: lines_(0), skip_(0), allow_pagebreak_(true)
{}
@ -616,6 +616,8 @@ docstring InsetMathGrid::eolString(row_type row, bool emptyline, bool fragile) c
if (!rowinfo_[row].crskip_.zero())
eol += '[' + from_utf8(rowinfo_[row].crskip_.asLatexString()) + ']';
else if(!rowinfo_[row].allow_pagebreak_)
eol += '*';
// make sure an upcoming '[' does not break anything
if (row + 1 < nrows()) {

View File

@ -62,6 +62,8 @@ public:
LyXLength crskip_;
/// extra distance between lines
int skip_;
/// Is a page break allowed after this row?
bool allow_pagebreak_;
};
// additional per-row information

View File

@ -111,7 +111,7 @@ bool stared(docstring const & s)
* environments like "equation" that have a fixed number of rows.
*/
bool addRow(InsetMathGrid & grid, InsetMathGrid::row_type & cellrow,
docstring const & vskip)
docstring const & vskip, bool allow_pagebreak = true)
{
++cellrow;
if (cellrow == grid.nrows()) {
@ -128,11 +128,14 @@ bool addRow(InsetMathGrid & grid, InsetMathGrid::row_type & cellrow,
lyxerr << "ignoring extra row";
if (!vskip.empty())
lyxerr << " with extra space " << to_utf8(vskip);
if (!allow_pagebreak)
lyxerr << " with no page break allowed";
lyxerr << '.' << endl;
return false;
}
}
grid.vcrskip(LyXLength(to_utf8(vskip)), cellrow - 1);
grid.rowinfo(cellrow - 1).allow_pagebreak_ = allow_pagebreak;
return true;
}
@ -1013,7 +1016,13 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
else if (t.cs() == "\\") {
if (flags & FLAG_ALIGN)
return;
if (addRow(grid, cellrow, getArg('[', ']'))) {
bool added;
if (nextToken().asInput() == "*") {
getToken();
added = addRow(grid, cellrow, docstring(), false);
} else
added = addRow(grid, cellrow, getArg('[', ']'));
if (added) {
cellcol = 0;
if (grid.asHullInset())
grid.asHullInset()->numbered(