re-use code...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5002 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-08-15 17:41:24 +00:00
parent 2113b05edd
commit 7feb18698e
4 changed files with 21 additions and 17 deletions

View File

@ -863,6 +863,7 @@ void MathGridInset::write(WriteStream & os) const
{ {
for (row_type row = 0; row < nrows(); ++row) { for (row_type row = 0; row < nrows(); ++row) {
os << verboseHLine(rowinfo_[row].lines_); os << verboseHLine(rowinfo_[row].lines_);
// don't write & and empty cells at end of line
for (col_type col = 0; col < ncols(); ++col) for (col_type col = 0; col < ncols(); ++col)
os << cell(index(row, col)) << eocString(col); os << cell(index(row, col)) << eocString(col);
os << eolString(row, os.fragile()); os << eolString(row, os.fragile());

View File

@ -216,9 +216,9 @@ protected:
/// returns y offset of cell compared to inset /// returns y offset of cell compared to inset
int cellYOffset(idx_type idx) const; int cellYOffset(idx_type idx) const;
/// returns proper 'end of line' code for LaTeX /// returns proper 'end of line' code for LaTeX
string eolString(row_type row, bool fragile = false) const; virtual string eolString(row_type row, bool fragile = false) const;
/// returns proper 'end of column' code for LaTeX /// returns proper 'end of column' code for LaTeX
string eocString(col_type col) const; virtual string eocString(col_type col) const;
/// extract number of columns from alignment string /// extract number of columns from alignment string
col_type guessColumns(string const & halign) const; col_type guessColumns(string const & halign) const;
/// splits cells and shifts right part to the next cell /// splits cells and shifts right part to the next cell

View File

@ -607,24 +607,23 @@ void MathHullInset::mutate(string const & newtype)
} }
string MathHullInset::eolString(row_type row, bool fragile) const
{
string res;
if (numberedType()) {
if (!label_[row].empty())
res += "\\label{" + label_[row] + "}";
if (nonum_[row])
res += "\\nonumber ";
}
return res + MathGridInset::eolString(row, fragile);
}
void MathHullInset::write(WriteStream & os) const void MathHullInset::write(WriteStream & os) const
{ {
header_write(os); header_write(os);
MathGridInset::write(os);
bool n = numberedType();
for (row_type row = 0; row < nrows(); ++row) {
for (col_type col = 0; col < ncols(); ++col)
os << cell(index(row, col)) << eocString(col);
if (n) {
if (!label_[row].empty())
os << "\\label{" << label_[row] << "}";
if (nonum_[row])
os << "\\nonumber ";
}
os << eolString(row);
}
footer_write(os); footer_write(os);
} }

View File

@ -89,6 +89,10 @@ public:
/// ///
void infoize(std::ostream & os) const; void infoize(std::ostream & os) const;
protected:
///
string eolString(row_type row, bool fragile) const;
private: private:
/// ///
void setType(string const & type); void setType(string const & type);