Author: spitz
Date: Fri Sep 23 19:12:20 2011
New Revision: 39736
URL: http://www.lyx.org/trac/changeset/39736

Log:
Fix bottom border allocation when setting a multirow.

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 Fri Sep 23 18:50:18 2011        
(r39735)
+++ lyx-devel/trunk/src/insets/InsetTabular.cpp Fri Sep 23 19:12:20 2011        
(r39736)
@@ -1649,7 +1649,8 @@
 }
 
 
-Tabular::idx_type Tabular::setMultiRow(idx_type cell, idx_type number)
+Tabular::idx_type Tabular::setMultiRow(idx_type cell, idx_type number,
+                                      bool const bottom_border)
 {
        idx_type const col = cellColumn(cell);
        idx_type const row = cellRow(cell);
@@ -1670,8 +1671,8 @@
        // cells: left
        cs.alignment = LYX_ALIGN_LEFT; 
 
-       // set the bottom row of the last selected cell
-       setBottomLine(cell, bottomLine(cell + (number - 1)*ncols()));
+       // set the bottom line of the last selected cell
+       setBottomLine(cell, bottom_border);
 
        for (idx_type i = 1; i < number; ++i) {
                CellData & cs1 = cell_info[row + i][col];
@@ -5399,7 +5400,8 @@
                        // just multirow for one single cell
                        // check whether we are completely in a multirow
                        if (!tabular.isMultiRow(cur.idx()))
-                               tabular.setMultiRow(cur.idx(), 1);
+                               tabular.setMultiRow(cur.idx(), 1,
+                                                   
tabular.bottomLine(cur.idx()));
                        break;
                }
                // we have a selection so this means we just add all this
@@ -5407,7 +5409,8 @@
                idx_type const s_start = cur.selBegin().idx();
                row_type const row_start = tabular.cellRow(s_start);
                row_type const row_end = tabular.cellRow(cur.selEnd().idx());
-               cur.idx() = tabular.setMultiRow(s_start, row_end - row_start + 
1);
+               cur.idx() = tabular.setMultiRow(s_start, row_end - row_start + 
1,
+                                               
tabular.bottomLine(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   Fri Sep 23 18:50:18 2011        
(r39735)
+++ lyx-devel/trunk/src/insets/InsetTabular.h   Fri Sep 23 19:12:20 2011        
(r39736)
@@ -475,7 +475,8 @@
        ///
        bool isMultiRow(idx_type cell) const;
        ///
-       idx_type setMultiRow(idx_type cell, idx_type number);
+       idx_type setMultiRow(idx_type cell, idx_type number,
+                            bool const bottom_border);
        ///
        void unsetMultiRow(idx_type cell);
        ///

Reply via email to