]> git.lyx.org Git - lyx.git/blobdiff - src/tabular.C
Trivial fixes to some warnings thrown up by MSVS.Net 2003.
[lyx.git] / src / tabular.C
index d43d6b58925a0aa26add94e890ed183b5e5d4e4f..7775055f3e7064b983f109ca2e758d2dc49d1602 100644 (file)
@@ -37,7 +37,6 @@
 using lyx::support::ltrim;
 using lyx::support::prefixIs;
 using lyx::support::rtrim;
-using lyx::support::strToInt;
 using lyx::support::suffixIs;
 
 using boost::shared_ptr;
@@ -249,7 +248,7 @@ bool getTokenValue(string const & str, char const * token, int & num)
        num = 0;
        if (!getTokenValue(str, token, tmp))
                return false;
-       num = strToInt(tmp);
+       num = convert<int>(tmp);
        return true;
 }
 
@@ -516,7 +515,7 @@ void LyXTabular::appendColumn(BufferParams const & bp, idx_type const cell)
        }
        //++column;
        for (row_type i = 0; i < rows_; ++i) {
-               cell_info[i][column + 1].inset->clear(false);
+               cell_info[i][column + 1].inset->clear();
                if (bp.tracking_changes)
                        cell_info[i][column + 1].inset->markNew(true);
        }
@@ -799,9 +798,9 @@ void LyXTabular::recalculateMulticolumnsOfColumn(col_type column)
        // the last column does not have to be recalculated because all
        // multicolumns will have here there last multicolumn cell which
        // always will have the whole rest of the width of the cell.
-       if (column > (columns_ - 2))
+       if (columns_ < 2 || column > (columns_ - 2))
                return;
-       for(row_type row = 0; row < rows_; ++row) {
+       for (row_type row = 0; row < rows_; ++row) {
                int mc = cell_info[row][column].multicolumn;
                int nmc = cell_info[row][column+1].multicolumn;
                // we only have to update multicolumns which do not have this
@@ -818,7 +817,6 @@ void LyXTabular::recalculateMulticolumnsOfColumn(col_type column)
 }
 
 
-// returns 1 if a complete update is necessary, otherwise 0
 void LyXTabular::setWidthOfCell(idx_type cell, int new_width)
 {
        row_type const row = row_of_cell(cell);
@@ -1346,12 +1344,13 @@ void LyXTabular::setMultiColumn(Buffer * buffer, idx_type cell,
        cs.alignment = column_info[column_of_cell(cell)].alignment;
        cs.top_line = row_info[row_of_cell(cell)].top_line;
        cs.bottom_line = row_info[row_of_cell(cell)].bottom_line;
+       cs.left_line = column_info[column_of_cell(cell)].left_line;
        cs.right_line = column_info[column_of_cell(cell+number-1)].right_line;
        for (idx_type i = 1; i < number; ++i) {
                cellstruct & cs1 = cellinfo_of_cell(cell + i);
                cs1.multicolumn = CELL_PART_OF_MULTICOLUMN;
                cs.inset->appendParagraphs(buffer, cs1.inset->paragraphs());
-               cs1.inset->clear(false);
+               cs1.inset->clear();
        }
        set_row_column_number_info();
 }
@@ -2512,6 +2511,13 @@ shared_ptr<InsetText> LyXTabular::getCellInset(row_type row,
 }
 
 
+void LyXTabular::setCellInset(row_type row, col_type column,
+                             shared_ptr<InsetText> ins) const
+{
+       cell_info[row][column].inset = ins;
+}
+
+
 LyXTabular::idx_type
 LyXTabular::getCellFromInset(InsetBase const * inset) const
 {