InsetTabular.cpp: multirow cells are ALWAYS left aligned and thus cannot inherit the alignment of the column

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35967 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2010-11-01 17:09:38 +00:00
parent bc30270b35
commit 98b8e1eb81

View File

@ -834,6 +834,7 @@ void Tabular::updateIndexes()
{ {
setBuffer(buffer()); setBuffer(buffer());
numberofcells = 0; numberofcells = 0;
// reset cell number
for (row_type row = 0; row < nrows(); ++row) for (row_type row = 0; row < nrows(); ++row)
for (col_type column = 0; column < ncols(); ++column) { for (col_type column = 0; column < ncols(); ++column) {
if (!isPartOfMultiColumn(row, column) if (!isPartOfMultiColumn(row, column)
@ -848,19 +849,22 @@ void Tabular::updateIndexes()
rowofcell.resize(numberofcells); rowofcell.resize(numberofcells);
columnofcell.resize(numberofcells); columnofcell.resize(numberofcells);
idx_type i = 0; idx_type i = 0;
// reset column and row of cells and update their width and alignment
for (row_type row = 0; row < nrows(); ++row) for (row_type row = 0; row < nrows(); ++row)
for (col_type column = 0; column < ncols(); ++column) { for (col_type column = 0; column < ncols(); ++column) {
if (isPartOfMultiColumn(row, column)) if (isPartOfMultiColumn(row, column))
continue; continue;
// columnofcell nneds to be called before setting width and aligment
// multirow cells inherit the width from the column width
if (!isPartOfMultiRow(row, column)) { if (!isPartOfMultiRow(row, column)) {
columnofcell[i] = column; columnofcell[i] = column;
rowofcell[i] = row; rowofcell[i] = row;
} }
setFixedWidth(row, column); setFixedWidth(row, column);
cell_info[row][column].inset->setContentAlignment(
getAlignment(cellIndex(row, column)));
if (isPartOfMultiRow(row, column)) if (isPartOfMultiRow(row, column))
continue; continue;
cell_info[row][column].inset->setContentAlignment(
getAlignment(cellIndex(row, column)));
++i; ++i;
} }
} }
@ -1612,7 +1616,7 @@ Tabular::idx_type Tabular::setMultiRow(idx_type cell, idx_type number)
// this feature would be a fileformat change // this feature would be a fileformat change
// until LyX supports this, use the deault alignment of multirow // until LyX supports this, use the deault alignment of multirow
// cells: left // cells: left
cs.alignment = LYX_ALIGN_CENTER; cs.alignment = LYX_ALIGN_LEFT;
// set the bottom row of the last selected cell // set the bottom row of the last selected cell
setBottomLine(cell, bottomLine(cell + (number - 1)*ncols())); setBottomLine(cell, bottomLine(cell + (number - 1)*ncols()));