*
* LyX, The Document Processor
*
- * Copyright 2000 The LyX Team.
+ * Copyright 2000-2001 The LyX Team.
*
* @author: Jürgen Vigna
*
using std::endl;
using std::vector;
+#ifndef CXX_GLOBAL_CSTD
+using std::strlen;
+#endif
+
namespace {
int const WIDTH_OF_LINE = 5;
LyXTabular::LyXTabular(InsetTabular * inset, int rows_arg, int columns_arg)
{
owner_ = inset;
+ cur_cell = -1;
Init(rows_arg, columns_arg);
}
LyXTabular::LyXTabular(InsetTabular * inset, LyXTabular const & lt)
{
owner_ = inset;
+ cur_cell = -1;
Init(lt.rows_, lt.columns_, <);
#if 0
#ifdef WITH_WARNINGS
LyXTabular::LyXTabular(Buffer const * buf, InsetTabular * inset, LyXLex & lex)
{
owner_ = inset;
+ cur_cell = -1;
Read(buf, lex);
}
// So then it is ok to throw an exception, or for now
// call abort()
lyx::Assert(rows_ == lt.rows_ && columns_ == lt.columns_);
-
+ cur_cell = -1;
cell_info = lt.cell_info;
row_info = lt.row_info;
column_info = lt.column_info;
}
-LyXTabular * LyXTabular::Clone(InsetTabular * inset)
+LyXTabular * LyXTabular::clone(InsetTabular * inset)
{
LyXTabular * result = new LyXTabular(inset, *this);
#if 0
for (int i = 0; i < rows_; ++i) {
for (int j = 0; j < columns_; ++j) {
cell_info[i][j].inset.setOwner(owner_);
- cell_info[i][j].inset.SetDrawFrame(0, InsetText::LOCKED);
+ cell_info[i][j].inset.setDrawFrame(0, InsetText::LOCKED);
cell_info[i][j].cellno = cellno++;
}
cell_info[i].back().right_line = true;
cell_info[row][column].right_line =
cell_info[row][column+cn-1].right_line;
}
- cell_info[row][column].inset.SetAutoBreakRows(
+ cell_info[row][column].inset.setAutoBreakRows(
!GetPWidth(GetCellNumber(row, column)).empty());
}
}
for (int i = 0; i < rows_; ++i) {
int c = GetCellNumber(i, j);
flag = !GetPWidth(c).empty(); // because of multicolumns!
- GetCellInset(c)->SetAutoBreakRows(flag);
+ GetCellInset(c)->setAutoBreakRows(flag);
}
return true;
}
cellinfo_of_cell(cell)->p_width = width;
if (IsMultiColumn(cell)) {
- GetCellInset(cell)->SetAutoBreakRows(flag);
+ GetCellInset(cell)->setAutoBreakRows(flag);
return true;
}
return false;
<< write_attribute("special", cell_info[i][j].align_special)
<< ">\n";
os << "\\begin_inset ";
- cell_info[i][j].inset.Write(buf, os);
+ cell_info[i][j].inset.write(buf, os);
os << "\n\\end_inset \n"
<< "</cell>\n";
}
size_t token_length = strlen(token);
string::size_type pos = str.find(token);
- if (pos == string::npos || pos+token_length+1 >= str.length()
- || str[pos+token_length] != '=')
+ if (pos == string::npos || pos + token_length + 1 >= str.length()
+ || str[pos + token_length] != '=')
return false;
ret.erase();
pos += token_length + 1;
getTokenValue(line, "special", cell_info[i][j].align_special);
l_getline(is, line);
if (prefixIs(line, "\\begin_inset")) {
- cell_info[i][j].inset.Read(buf, lex);
+ cell_info[i][j].inset.read(buf, lex);
l_getline(is, line);
}
if (!prefixIs(line, "</cell>")) {
}
set_row_column_number_info(true);
- LyXParagraph * par = new LyXParagraph;
- LyXParagraph * return_par = 0;
+ Paragraph * par = new Paragraph;
+ Paragraph * return_par = 0;
string tmptok;
int pos = 0;
- char depth = 0;
+ Paragraph::depth_type depth = 0;
LyXFont font(LyXFont::ALL_INHERIT);
- font.setLanguage(owner_->BufferOwner()->GetLanguage());
+ font.setLanguage(owner_->bufferOwner()->getLanguage());
while (lex.IsOK()) {
lex.nextToken();
lex.pushToken(token);
break;
}
- if (owner_->BufferOwner()->parseSingleLyXformat2Token(lex, par,
+ if (owner_->bufferOwner()->parseSingleLyXformat2Token(lex, par,
return_par,
token, pos,
depth, font)) {
int row;
for (int i = 0; i < par->size(); ++i) {
- if (par->IsNewline(i)) {
+ if (par->isNewline(i)) {
++cell;
if (cell > GetNumberOfCells()) {
lyxerr << "Some error in reading old table format occured!" <<
if (!cell_info[row_of_cell(cell)][column_of_cell(cell)].usebox)
{
// insert a space instead
- par->Erase(i);
- par->InsertChar(i, ' ');
+ par->erase(i);
+ par->insertChar(i, ' ');
}
}
- par->CopyIntoMinibuffer(*owner_->BufferOwner(), i);
- inset->par->InsertFromMinibuffer(inset->par->size());
+ par->copyIntoMinibuffer(*owner_->bufferOwner(), i);
+ inset->par->insertFromMinibuffer(inset->par->size());
}
delete par;
Reinit();
if (rtl)
os << "\\R{";
- ret += inset->Latex(buf, os, fragile, fp);
+ ret += inset->latex(buf, os, fragile, fp);
if (rtl)
os << "}";
}
os << ">";
- ret += GetCellInset(cell)->DocBook(buf, os);
+ ret += GetCellInset(cell)->docBook(buf, os);
os << "</entry>";
++cell;
}
vector<unsigned int> const & clen) const
{
ostringstream sstr;
- int ret = GetCellInset(cell)->Ascii(buf, sstr, 0);
+ int ret = GetCellInset(cell)->ascii(buf, sstr, 0);
if (LeftLine(cell))
os << "| ";
if (IsMultiColumn(cell, true))
continue;
ostringstream sstr;
- GetCellInset(cell)->Ascii(buf, sstr, 0);
+ GetCellInset(cell)->ascii(buf, sstr, 0);
if (clen[j] < sstr.str().length())
clen[j] = sstr.str().length();
}
if (!IsMultiColumn(cell, true) || IsPartOfMultiColumn(i, j))
continue;
ostringstream sstr;
- GetCellInset(cell)->Ascii(buf, sstr, 0);
+ GetCellInset(cell)->ascii(buf, sstr, 0);
int len = int(sstr.str().length());
int const n = cells_in_multicolumn(cell);
for (int k = j; (len > 0) && (k < (j + n - 1)); ++k)
InsetText * LyXTabular::GetCellInset(int cell) const
{
+ cur_cell = cell;
return & cell_info[row_of_cell(cell)][column_of_cell(cell)].inset;
}
InsetText * LyXTabular::GetCellInset(int row, int column) const
{
+#ifdef WITH_WARNINGS
+#warning Juergen, should we check whether the row/column values are correct?
+// If we do not need to do that, the tests in GetCellNumber should be
+// changed to asserts.
+#endif
+ cur_cell = GetCellNumber(row, column);
return & cell_info[row][column].inset;
}
for (int cell = 0; !features.array && (cell < numberofcells); ++cell) {
if (GetVAlignment(cell) != LYX_VALIGN_TOP)
features.array = true;
- GetCellInset(cell)->Validate(features);
+ GetCellInset(cell)->validate(features);
}
}
LyXTabular::BoxType LyXTabular::UseParbox(int cell) const
{
- LyXParagraph * par = GetCellInset(cell)->par;
+ Paragraph * par = GetCellInset(cell)->par;
for (; par; par = par->next()) {
for (int i = 0; i < par->size(); ++i) {
- if (par->GetChar(i) == LyXParagraph::META_NEWLINE)
+ if (par->getChar(i) == Paragraph::META_NEWLINE)
return BOX_PARBOX;
}
}