string const LyXTabular::GetDocBookAlign(int cell, bool isColumn) const
{
- int i = isColumn ? cell : 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;
// returns the number of printed newlines
int LyXTabular::DocBookEndOfCell(ostream & os, int cell, int & depth) const
{
- int i;
int ret = 0;
- //int tmp; // tmp2; // unused
- int nvcell; // fcell; // unused
+ int nvcell;
if (IsLastCell(cell)) {
os << newlineAndDepth(--depth)
<< "</ENTRY>"
<< "' COLSEP='1' ROWSEP='1'>"
<< newlineAndDepth(++depth);
++ret;
- for (i = 0; i < columns_; ++i) {
+ for (int i = 0; i < columns_; ++i) {
os << "<COLSPEC ALIGN='"
<< GetDocBookAlign(i, true)
<< "' COLNAME='col"
<< "' VALIGN='middle'";
if (IsMultiColumn(cell + 1)) {
os << " NAMEST='col"
- << column_of_cell(cell+1) + 1
+ << column_of_cell(cell + 1) + 1
<< "' NAMEEND='col"
<< column_of_cell(cell + 1) +
cells_in_multicolumn(cell + 1)
<< "' VALIGN='middle'";
if (IsMultiColumn(cell + 1)) {
os << " NAMEST='col"
- << column_of_cell(cell+1) + 1
+ << column_of_cell(cell + 1) + 1
<< "' NAMEEND='col"
- << column_of_cell(cell+1) +
- cells_in_multicolumn(cell+1)
+ << column_of_cell(cell + 1) +
+ cells_in_multicolumn(cell + 1)
<< "'";
}
os << ">"
LyXTabular::cellstruct * LyXTabular::cellinfo_of_cell(int cell) const
{
- int row = row_of_cell(cell);
- int column = column_of_cell(cell);
+ int const row = row_of_cell(cell);
+ int const column = column_of_cell(cell);
return &cell_info[row][column];
}
int LyXTabular::cells_in_multicolumn(int cell) const
{
- int row = row_of_cell(cell);
+ int const row = row_of_cell(cell);
int column = column_of_cell(cell);
int result = 1;
++column;
int LyXTabular::UnsetMultiColumn(int cell)
{
- int row = row_of_cell(cell);
+ int const row = row_of_cell(cell);
int column = column_of_cell(cell);
int result = 0;
bool LyXTabular::IsLastCell(int cell) const
{
- if ((cell+1) < GetNumberOfCells())
+ if ((cell + 1) < GetNumberOfCells())
return false;
return true;
}
int LyXTabular::GetCellBelow(int cell) const
{
- if (row_of_cell(cell)+1 < rows_)
+ if (row_of_cell(cell) + 1 < rows_)
return cell_info[row_of_cell(cell)+1][column_of_cell(cell)].cellno;
return cell;
}
return cell;
if (!IsMultiColumn(cell))
return GetCellAbove(cell);
- return cell_info[row_of_cell(cell)-1][right_column_of_cell(cell)].cellno;
+ return cell_info[row_of_cell(cell) - 1][right_column_of_cell(cell)].cellno;
}
int LyXTabular::GetLastCellBelow(int cell) const
{
- if (row_of_cell(cell)+1 >= rows_)
+ if (row_of_cell(cell) + 1 >= rows_)
return cell;
if (!IsMultiColumn(cell))
return GetCellBelow(cell);
- return cell_info[row_of_cell(cell)+1][right_column_of_cell(cell)].cellno;
+ return cell_info[row_of_cell(cell) + 1][right_column_of_cell(cell)].cellno;
}
void LyXTabular::SetLTHead(int cell, bool first)
{
int const row = row_of_cell(cell);
- int const val = (row+1) * (column_of_cell(cell)? 1:-1);
+ int const val = (row + 1) * (column_of_cell(cell) ? 1 : -1);
if (first) {
if (endfirsthead == val)
row = endhead;
if (abs(endhead) > rows_)
return false;
- return (row_of_cell(cell) == (abs(endhead)-1));
+ return (row_of_cell(cell) == abs(endhead) - 1);
}
row = endfirsthead;
if (abs(endfirsthead) > rows_)
return false;
- return (row_of_cell(cell) == (abs(endfirsthead)-1));
+ return (row_of_cell(cell) == abs(endfirsthead) - 1);
}
void LyXTabular::SetLTFoot(int cell, bool last)
{
int const row = row_of_cell(cell);
- int const val = (row + 1) * (column_of_cell(cell)? 1:-1);
+ int const val = (row + 1) * (column_of_cell(cell) ? 1 : -1);
if (last) {
if (endlastfoot == val)
bool LyXTabular::GetRowOfLTFoot(int cell, int & row) const
{
row = endfoot;
- if ((endfoot+1) > rows_)
+ if ((endfoot + 1) > rows_)
return false;
- return (row_of_cell(cell) == (abs(endfoot)-1));
+ return (row_of_cell(cell) == abs(endfoot) - 1);
}
int LyXTabular::TeXTopHLine(ostream & os, int row) const
{
- int fcell = GetFirstCellInRow(row);
- int n = NumberOfCellsInRow(fcell) + fcell;
- int tmp=0;
- int i;
+#warning should this return a bool? (Lgb)
+ int const fcell = GetFirstCellInRow(row);
+ int const n = NumberOfCellsInRow(fcell) + fcell;
+ int tmp = 0;
- for (i = fcell; i < n; ++i) {
+ for (int i = fcell; i < n; ++i) {
if (TopLine(i))
++tmp;
}
if (tmp == (n - fcell)){
os << "\\hline ";
} else {
- for (i = fcell; i < n; ++i) {
+ for (int i = fcell; i < n; ++i) {
if (TopLine(i)) {
os << "\\cline{"
<< column_of_cell(i) + 1
int LyXTabular::TeXBottomHLine(ostream & os, int row) const
{
+#warning should this return a bool? (Lgb)
int const fcell = GetFirstCellInRow(row);
int const n = NumberOfCellsInRow(fcell) + fcell;
int tmp = 0;
bool LyXTabular::UseParbox(int cell) const
{
- LyXParagraph *par = GetCellInset(cell)->par;
+ LyXParagraph * par = GetCellInset(cell)->par;
- for(;par; par = par->next) {
+ for(; par; par = par->next) {
for(int i = 0; i < par->Last(); ++i) {
if (par->GetChar(i) == LyXParagraph::META_NEWLINE)
return true;