From ef0be6ac1895db6a9f3317a4a2e950343811486c Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Mon, 29 Nov 2010 12:56:42 +0000 Subject: [PATCH] branch: Fix bug #7007: Horizontal table alignment display broken. see r36395, r36401 and r36402. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@36590 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetTabular.cpp | 22 ++++++++++++++++------ status.16x | 2 ++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index deae4907c5..e55044ec89 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -946,11 +946,22 @@ void Tabular::setCellWidth(idx_type cell, int new_width) void Tabular::setAlignment(idx_type cell, LyXAlignment align, bool onlycolumn) { - if (!isMultiColumn(cell) || onlycolumn) - column_info[cellColumn(cell)].alignment = align; - if (!onlycolumn) + col_type const col = cellColumn(cell); + row_type const nrows = row_info.size(); + // set alignment for the whole row if we are not in a multicolumn cell + // exclude possible multicolumn cells in the row + if (!isMultiColumn(cell)) { + for (row_type r = 0; r < nrows; ++r) { + if (!isMultiColumn(cellIndex(r, col))) { + cell_info[r][col].alignment = align; + cell_info[r][col].inset->setContentAlignment(align); + } + } + column_info[col].alignment = align; + } else { cellInfo(cell).alignment = align; - cellInset(cell).get()->setContentAlignment(align); + cellInset(cell).get()->setContentAlignment(align); + } } @@ -4594,14 +4605,13 @@ void InsetTabular::tabularFeatures(Cursor & cur, case Tabular::M_ALIGN_LEFT: case Tabular::M_ALIGN_RIGHT: case Tabular::M_ALIGN_CENTER: - flag = false; case Tabular::ALIGN_LEFT: case Tabular::ALIGN_RIGHT: case Tabular::ALIGN_CENTER: case Tabular::ALIGN_BLOCK: for (row_type i = sel_row_start; i <= sel_row_end; ++i) for (col_type j = sel_col_start; j <= sel_col_end; ++j) - tabular.setAlignment(tabular.cellIndex(i, j), setAlign, flag); + tabular.setAlignment(tabular.cellIndex(i, j), setAlign); break; case Tabular::M_VALIGN_TOP: diff --git a/status.16x b/status.16x index 316b532f6c..fbfb73bb98 100644 --- a/status.16x +++ b/status.16x @@ -79,6 +79,8 @@ What's new - Do not allow to put the cursor in an InsetInfo. Instead, a context menu item is added to facilitate copying of the contents (bug 5446). +- Fix the display of the horizontal alignment of table cells (bug 7007). + * DOCUMENTATION AND LOCALIZATION