* src/tabular.[Ch]: simplify plaintext methods, because there

is no longer a need to count the number of lines


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17243 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Michael Schmitt 2007-02-18 18:50:08 +00:00
parent af239344a7
commit e7f4618bcc
2 changed files with 29 additions and 36 deletions

View File

@ -2453,8 +2453,8 @@ int LyXTabular::docbook(Buffer const & buf, odocstream & os,
}
int LyXTabular::plaintextTopHLine(odocstream & os, row_type row,
vector<unsigned int> const & clen) const
bool LyXTabular::plaintextTopHLine(odocstream & os, row_type row,
vector<unsigned int> const & clen) const
{
idx_type const fcell = getFirstCellInRow(row);
idx_type const n = numberOfCellsInRow(fcell) + fcell;
@ -2467,7 +2467,7 @@ int LyXTabular::plaintextTopHLine(odocstream & os, row_type row,
}
}
if (!tmp)
return 0;
return false;
char_type ch;
for (idx_type i = fcell; i < n; ++i) {
@ -2497,12 +2497,12 @@ int LyXTabular::plaintextTopHLine(odocstream & os, row_type row,
}
}
os << endl;
return 1;
return true;
}
int LyXTabular::plaintextBottomHLine(odocstream & os, row_type row,
vector<unsigned int> const & clen) const
bool LyXTabular::plaintextBottomHLine(odocstream & os, row_type row,
vector<unsigned int> const & clen) const
{
idx_type const fcell = getFirstCellInRow(row);
idx_type const n = numberOfCellsInRow(fcell) + fcell;
@ -2515,7 +2515,7 @@ int LyXTabular::plaintextBottomHLine(odocstream & os, row_type row,
}
}
if (!tmp)
return 0;
return false;
char_type ch;
for (idx_type i = fcell; i < n; ++i) {
@ -2545,22 +2545,22 @@ int LyXTabular::plaintextBottomHLine(odocstream & os, row_type row,
}
}
os << endl;
return 1;
return true;
}
int LyXTabular::plaintextPrintCell(Buffer const & buf, odocstream & os,
void LyXTabular::plaintextPrintCell(Buffer const & buf, odocstream & os,
OutputParams const & runparams,
idx_type cell, row_type row, col_type column,
vector<unsigned int> const & clen,
bool onlydata) const
{
odocstringstream sstr;
int const ret = getCellInset(cell)->plaintext(buf, sstr, runparams);
getCellInset(cell)->plaintext(buf, sstr, runparams);
if (onlydata) {
os << sstr.str();
return ret;
return;
}
if (leftLine(cell))
@ -2597,18 +2597,13 @@ int LyXTabular::plaintextPrintCell(Buffer const & buf, odocstream & os,
os << " |";
else
os << " ";
return ret;
}
int LyXTabular::plaintext(Buffer const & buf, odocstream & os,
OutputParams const & runparams,
int const depth,
bool onlydata, unsigned char delim) const
void LyXTabular::plaintext(Buffer const & buf, odocstream & os,
OutputParams const & runparams, int const depth,
bool onlydata, unsigned char delim) const
{
int ret = 0;
// first calculate the width of the single columns
vector<unsigned int> clen(columns_);
@ -2652,8 +2647,8 @@ int LyXTabular::plaintext(Buffer const & buf, odocstream & os,
continue;
if (onlydata && j > 0)
os << delim;
ret += plaintextPrintCell(buf, os, runparams,
cell, i, j, clen, onlydata);
plaintextPrintCell(buf, os, runparams,
cell, i, j, clen, onlydata);
++cell;
}
os << endl;
@ -2663,7 +2658,6 @@ int LyXTabular::plaintext(Buffer const & buf, odocstream & os,
os << docstring(depth * 2, ' ');
}
}
return ret;
}

View File

@ -317,10 +317,9 @@ public:
//
int docbook(Buffer const & buf, odocstream & os, OutputParams const &) const;
///
int plaintext(Buffer const &, odocstream &,
OutputParams const & runparams,
int const depth,
bool onlydata, unsigned char delim) const;
void plaintext(Buffer const &, odocstream &,
OutputParams const & runparams, int const depth,
bool onlydata, unsigned char delim) const;
///
bool isMultiColumn(idx_type cell) const;
///
@ -604,19 +603,19 @@ public:
int TeXRow(odocstream &, row_type const row, Buffer const & buf,
OutputParams const &) const;
///
// helper functions for plain text return number of newlines
// helper functions for plain text
///
int plaintextTopHLine(odocstream &, row_type row,
std::vector<unsigned int> const &) const;
bool plaintextTopHLine(odocstream &, row_type row,
std::vector<unsigned int> const &) const;
///
int plaintextBottomHLine(odocstream &, row_type row,
std::vector<unsigned int> const &) const;
bool plaintextBottomHLine(odocstream &, row_type row,
std::vector<unsigned int> const &) const;
///
int plaintextPrintCell(Buffer const &, odocstream &,
OutputParams const &,
idx_type cell, row_type row, col_type column,
std::vector<unsigned int> const &,
bool onlydata) const;
void plaintextPrintCell(Buffer const &, odocstream &,
OutputParams const &,
idx_type cell, row_type row, col_type column,
std::vector<unsigned int> const &,
bool onlydata) const;
/// auxiliary function for docbook
int docbookRow(Buffer const & buf, odocstream & os, row_type,
OutputParams const &) const;