Author: spitz
Date: Sun Sep 25 08:50:03 2011
New Revision: 39756
URL: http://www.lyx.org/trac/changeset/39756

Log:
As for setMultiRow, check border status _before_ merging, thus fixing border 
allocation problems.

Modified:
   lyx-devel/trunk/src/insets/InsetTabular.cpp
   lyx-devel/trunk/src/insets/InsetTabular.h

Modified: lyx-devel/trunk/src/insets/InsetTabular.cpp
==============================================================================
--- lyx-devel/trunk/src/insets/InsetTabular.cpp Sun Sep 25 08:36:58 2011        
(r39755)
+++ lyx-devel/trunk/src/insets/InsetTabular.cpp Sun Sep 25 08:50:03 2011        
(r39756)
@@ -1615,7 +1615,8 @@
 }
 
 
-Tabular::idx_type Tabular::setMultiColumn(idx_type cell, idx_type number)
+Tabular::idx_type Tabular::setMultiColumn(idx_type cell, idx_type number,
+                                         bool const right_border)
 {
        idx_type const col = cellColumn(cell);
        idx_type const row = cellRow(cell);
@@ -1629,7 +1630,7 @@
        if (column_info[col].alignment != LYX_ALIGN_DECIMAL)
                cs.alignment = column_info[col].alignment;
        if (col > 0)
-               setRightLine(cell, rightLine(cellIndex(row, col - 1)));
+               setRightLine(cell, right_border);
 
        for (idx_type i = 1; i < number; ++i) {
                CellData & cs1 = cellInfo(cell + i);
@@ -1954,7 +1955,7 @@
 {
        idx_type i = getFirstCellInRow(row);
        if (what) {
-               setMultiColumn(i, numberOfCellsInRow(row));
+               setMultiColumn(i, numberOfCellsInRow(row), false);
                setTopLine(i, false);
                setBottomLine(i, false);
                setLeftLine(i, false);
@@ -5364,7 +5365,8 @@
                        // just multicol for one single cell
                        // check whether we are completely in a multicol
                        if (!tabular.isMultiColumn(cur.idx()))
-                               tabular.setMultiColumn(cur.idx(), 1);
+                               tabular.setMultiColumn(cur.idx(), 1,
+                                       tabular.rightLine(cur.idx()));
                        break;
                }
                // we have a selection so this means we just add all this
@@ -5372,7 +5374,8 @@
                idx_type const s_start = cur.selBegin().idx();
                row_type const col_start = tabular.cellColumn(s_start);
                row_type const col_end = tabular.cellColumn(cur.selEnd().idx());
-               cur.idx() = tabular.setMultiColumn(s_start, col_end - col_start 
+ 1);
+               cur.idx() = tabular.setMultiColumn(s_start, col_end - col_start 
+ 1,
+                                                  
tabular.rightLine(cur.selEnd().idx()));
                cur.pit() = 0;
                cur.pos() = 0;
                cur.setSelection(false);

Modified: lyx-devel/trunk/src/insets/InsetTabular.h
==============================================================================
--- lyx-devel/trunk/src/insets/InsetTabular.h   Sun Sep 25 08:36:58 2011        
(r39755)
+++ lyx-devel/trunk/src/insets/InsetTabular.h   Sun Sep 25 08:50:03 2011        
(r39756)
@@ -465,7 +465,8 @@
        ///
        bool isMultiColumn(idx_type cell) const;
        ///
-       idx_type setMultiColumn(idx_type cell, idx_type number);
+       idx_type setMultiColumn(idx_type cell, idx_type number,
+                            bool const right_border);
        ///
        void unsetMultiColumn(idx_type cell);
        ///

Reply via email to