inset = 0;
}
+
LyXTabular::cellstruct::~cellstruct()
{
delete inset;
}
+
+LyXTabular::cellstruct::cellstruct(cellstruct const & cs)
+{
+ cellno = cs.cellno;
+ width_of_cell = cs.width_of_cell;
+ multicolumn = cs.multicolumn;
+ alignment = cs.alignment;
+ top_line = cs.top_line;
+ bottom_line = cs.bottom_line;
+ rotate = cs.rotate;
+ linebreaks = cs.linebreaks;
+ inset = 0;
+}
+
+
LyXTabular::cellstruct &
- LyXTabular::cellstruct::operator=(cellstruct const & cs)
+LyXTabular::cellstruct::operator=(cellstruct const & cs)
{
cellno = cs.cellno;
width_of_cell = cs.width_of_cell;
return *this;
}
+
LyXTabular::rowstruct::rowstruct()
{
top_line = true;
newpage = false;
}
+
// Nothing to do, but gcc 2.7.2.3 wants one... (JMarc)
-LyXTabular::rowstruct::~rowstruct()
-{
-}
+//LyXTabular::rowstruct::~rowstruct()
+//{}
+
+
+//LyXTabular::rowstruct &
+// LyXTabular::rowstruct::operator=(rowstruct const & rs)
+//{
+// top_line = rs.top_line;
+// bottom_line = rs.bottom_line;
+// ascent_of_row = rs.ascent_of_row;
+// descent_of_row = rs.descent_of_row;
+// newpage = rs.newpage;
+// return *this;
+//}
-LyXTabular::rowstruct &
- LyXTabular::rowstruct::operator=(rowstruct const & rs)
-{
- top_line = rs.top_line;
- bottom_line = rs.bottom_line;
- ascent_of_row = rs.ascent_of_row;
- descent_of_row = rs.descent_of_row;
- newpage = rs.newpage;
- return *this;
-}
LyXTabular::columnstruct::columnstruct()
{
width_of_column = 0;
}
-LyXTabular::columnstruct::~columnstruct()
-{
-}
-LyXTabular::columnstruct &
- LyXTabular::columnstruct::operator=(columnstruct const & cs)
-{
- left_line = cs.left_line;
- right_line = cs.right_line;
- alignment = cs.alignment;
- width_of_column = cs.width_of_column;
- p_width = cs.p_width;
- align_special = cs.align_special;
- return *this;
-}
+//LyXTabular::columnstruct::~columnstruct()
+//{
+//}
+
+
+//LyXTabular::columnstruct &
+// LyXTabular::columnstruct::operator=(columnstruct const & cs)
+//{
+// left_line = cs.left_line;
+// right_line = cs.right_line;
+// alignment = cs.alignment;
+// width_of_column = cs.width_of_column;
+// p_width = cs.p_width;
+// align_special = cs.align_special;
+// return *this;
+//}
+
/* konstruktor */
LyXTabular::LyXTabular(int rows_arg, int columns_arg, Buffer *buf)
operator=(lt);
}
+
LyXTabular::LyXTabular(LyXLex & lex, Buffer *buf)
{
buffer = buf;
Assert(rows_ == lt.rows_ && columns_ == lt.columns_);
int row = 0, column = 0;
-
+
+ // Why not just:
+ // cell_info = lt.cell_info;
for (row = 0; row < rows_; ++row) {
for (column = 0; column < columns_; ++column) {
cell_info[row][column] = lt.cell_info[row][column];
}
}
-
+
+ // why not just:
+ // row_info = lt.row_info;
for (row = 0; row < rows_; ++row) {
row_info[row] = lt.row_info[row];
}
-
+
+ // why not just:
+ // column_info = lt.column_info;
for (column = 0; column < columns_; ++column) {
column_info[column] = lt.column_info[column];
}
return *this;
}
+
LyXTabular * LyXTabular::Clone(Buffer * buf)
{
LyXTabular * result = new LyXTabular(rows_, columns_, buf);
cell_info = vector<vector<cellstruct> >
(rows_, vector<cellstruct>(columns_, cellstruct()));
+ // Jürgen, use iterators.
for (i = 0; i < rows_; ++i) {
for (j = 0; j < columns_; ++j) {
cell_info[i][j].inset = new InsetText(buf);
int j;
int i = 0;
+
+ // Jürgen, use iterators.
for (; i < rows_; ++i) {
for (j = 0; j < columns_; ++j) {
cell_info[i][j].width_of_cell = 0;
}
}
+
int LyXTabular::GetNumberOfCells() const
{
return numberofcells;
return width_of_tabular;
}
+
/* returns 1 if a complete update is necessary, otherwise 0 */
bool LyXTabular::SetWidthOfMulticolCell(int cell, int new_width)
{
return true;
}
+
bool LyXTabular::SetPWidth(int cell, string width)
{
if (IsMultiColumn(cell)) {
return true;
}
+
bool LyXTabular::SetAlignSpecial(int cell, string special, int what)
{
if (what == SET_SPECIAL_MULTI)
return true;
}
+
bool LyXTabular::SetAllLines(int cell, bool line)
{
SetTopLine(cell, line);
return true;
}
+
bool LyXTabular::SetTopLine(int cell, bool line)
{
int row = row_of_cell(cell);
return column_info[column_of_cell(cell)].alignment;
}
+
string LyXTabular::GetPWidth(int cell) const
{
if (IsMultiColumn(cell))
return column_info[column_of_cell(cell)].p_width;
}
+
string LyXTabular::GetAlignSpecial(int cell, int what) const
{
if (what == SET_SPECIAL_MULTI)
return column_info[column_of_cell(cell)].align_special;
}
+
int LyXTabular::GetWidthOfCell(int cell) const
{
int row = row_of_cell(cell);
return (column_of_cell(cell) == 0);
}
+
bool LyXTabular::IsLastCellInRow(int cell) const
{
return (right_column_of_cell(cell) == (columns_ - 1));
return (column_info[column].width_of_column != old_column_width);
}
+
bool LyXTabular::calculate_width_of_column_NMC(int column)
{
int old_column_width = column_info[column].width_of_column;
return (column_info[column].width_of_column != old_column_width);
}
+
void LyXTabular::calculate_width_of_tabular()
{
width_of_tabular = 0;
os << "</LyXTabular>" << endl;
}
-static bool getTokenValue(string const str, const char * token, string & ret)
+
+static
+bool getTokenValue(string const str, const char * token, string & ret)
{
int pos = str.find(token);
char ch = str[pos+strlen(token)];
return true;
}
-static bool getTokenValue(string const str, const char * token, int & num)
+
+static
+bool getTokenValue(string const str, const char * token, int & num)
{
string ret;
int pos = str.find(token);
return true;
}
-static bool getTokenValue(string const str, const char * token, bool & flag)
+
+static
+bool getTokenValue(string const str, const char * token, bool & flag)
{
string ret;
int pos = str.find(token);
return true;
}
+
void l_getline(istream & is, string & str)
{
getline(is, str);
getline(is, str);
}
+
void LyXTabular::Read(LyXLex & lex)
{
string line;
set_row_column_number_info();
}
+
void LyXTabular::OldFormatRead(istream & is, string fl)
{
int version;
#endif
-char const *LyXTabular::GetDocBookAlign(int cell, bool isColumn) const
+char const * LyXTabular::GetDocBookAlign(int cell, bool isColumn) const
{
- int i;
- if (isColumn)
- i = cell;
- else
- i = column_of_cell(cell);
+ int i = isColumn ? cell : column_of_cell(cell);
+
+ //if (isColumn)
+ //i = cell;
+ //else
+ //i = column_of_cell(cell);
if (!isColumn && IsMultiColumn(cell)) {
if (!cellinfo_of_cell(cell)->align_special.empty()) {
return cellinfo_of_cell(cell)->align_special.c_str();
}
-LyXTabular::cellstruct* LyXTabular::cellinfo_of_cell(int cell) const
+LyXTabular::cellstruct * LyXTabular::cellinfo_of_cell(int cell) const
{
int row = row_of_cell(cell);
int column = column_of_cell(cell);
}
-int LyXTabular::UnsetMultiColumn(int cell)
+int LyXTabular::UnsetMultiColumn(int cell)
{
int row = row_of_cell(cell);
int column = column_of_cell(cell);
return is_long_tabular;
}
+
void LyXTabular::SetRotateTabular(int what)
{
rotate = what;
}
+
bool LyXTabular::GetRotateTabular() const
{
return rotate;
}
+
void LyXTabular::SetRotateCell(int cell, int what)
{
cellinfo_of_cell(cell)->rotate = what;
}
+
bool LyXTabular::GetRotateCell(int cell) const
{
return cellinfo_of_cell(cell)->rotate;
}
+
bool LyXTabular::NeedRotating() const
{
if (rotate)
return true;
}
+
int LyXTabular::GetCellAbove(int cell) const
{
if (row_of_cell(cell) > 0)
return cell;
}
+
int LyXTabular::GetCellNumber(int column, int row) const
{
if (column >= columns_)
return cell_info[row][column].cellno;
}
+
void LyXTabular::SetLinebreaks(int cell, bool what)
{
cellinfo_of_cell(cell)->linebreaks = what;
}
+
bool LyXTabular::GetLinebreaks(int cell) const
{
if (column_info[column_of_cell(cell)].p_width.empty() &&
return cellinfo_of_cell(cell)->linebreaks;
}
+
void LyXTabular::SetLTHead(int cell, bool first)
{
int row = row_of_cell(cell);
}
}
+
bool LyXTabular::GetRowOfLTHead(int cell) const
{
if ((endhead+1) > rows_)
return (row_of_cell(cell) == endhead);
}
+
bool LyXTabular::GetRowOfLTFirstHead(int cell) const
{
if ((endfirsthead+1) > rows_)
return (row_of_cell(cell) == endfirsthead);
}
+
void LyXTabular::SetLTFoot(int cell, bool last)
{
int row = row_of_cell(cell);
}
}
+
bool LyXTabular::GetRowOfLTFoot(int cell) const
{
if ((endfoot+1) > rows_)
return (row_of_cell(cell) == endlastfoot);
}
+
void LyXTabular::SetLTNewPage(int cell, bool what)
{
row_info[row_of_cell(cell)].newpage = what;
}
+
bool LyXTabular::GetLTNewPage(int cell) const
{
return row_info[row_of_cell(cell)].newpage;
}
+
void LyXTabular::SetAscentOfRow(int row, int height)
{
if (row >= rows_)
row_info[row].ascent_of_row = height;
}
+
void LyXTabular::SetDescentOfRow(int row, int height)
{
if (row >= rows_)
row_info[row].descent_of_row = height;
}
+
int LyXTabular::GetAscentOfRow(int row) const
{
if (row >= rows_)
return row_info[row].ascent_of_row;
}
+
int LyXTabular::GetDescentOfRow(int row) const
{
if (row >= rows_)
return row_info[row].descent_of_row;
}
+
int LyXTabular::GetHeightOfTabular() const
{
- int
- height,
- row;
+ int height = 0;
- for(row=0,height=0;(row<rows_); ++row)
+ for(int row = 0; row < rows_; ++row)
height += GetAscentOfRow(row) + GetDescentOfRow(row) +
- GetAdditionalHeight(GetCellNumber(0,row));
+ GetAdditionalHeight(GetCellNumber(0, row));
return height;
}
+
bool LyXTabular::IsPartOfMultiColumn(int row, int column) const
{
if ((row >= rows_) || (column >= columns_))
return (cell_info[row][column].multicolumn==CELL_PART_OF_MULTICOLUMN);
}
+
int LyXTabular::Latex(ostream &) const
{
return 0;
}
+
InsetText * LyXTabular::GetCellInset(int cell) const
{
return cell_info[row_of_cell(cell)][column_of_cell(cell)].inset;