]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetTabular.cpp
Remove TextClassPtr without losing the type safety it provided.
[lyx.git] / src / insets / InsetTabular.cpp
index fb5aeca1af0226e4ebcec916c39288cc7d6be9cf..20dbba81d97df6bc1741a99c6aefa6b7c5bf7b97 100644 (file)
@@ -345,7 +345,7 @@ bool getTokenValue(string const & str, char const * token, string & ret)
 {
        ret.erase();
        size_t token_length = strlen(token);
-       string::size_type pos = str.find(token);
+       size_t pos = str.find(token);
 
        if (pos == string::npos || pos + token_length + 1 >= str.length()
                || str[pos + token_length] != '=')
@@ -472,7 +472,7 @@ string const featureAsString(Tabular::Feature feature)
 /////////////////////////////////////////////////////////////////////
 
 
-Tabular::cellstruct::cellstruct(Buffer const & buffer)
+Tabular::CellData::CellData(Buffer const & buffer)
        : cellno(0),
          width(0),
          multicolumn(Tabular::CELL_NORMAL),
@@ -487,11 +487,11 @@ Tabular::cellstruct::cellstruct(Buffer const & buffer)
          inset(new InsetText(buffer.params()))
 {
        inset->setBuffer(const_cast<Buffer &>(buffer));
-       inset->paragraphs().back().setLayout(buffer.params().textClass().emptyLayout());
+       inset->paragraphs().back().setLayout(buffer.params().documentClass().emptyLayout());
 }
 
 
-Tabular::cellstruct::cellstruct(cellstruct const & cs)
+Tabular::CellData::CellData(CellData const & cs)
        : cellno(cs.cellno),
          width(cs.width),
          multicolumn(cs.multicolumn),
@@ -509,14 +509,14 @@ Tabular::cellstruct::cellstruct(cellstruct const & cs)
 {}
 
 
-Tabular::cellstruct & Tabular::cellstruct::operator=(cellstruct cs)
+Tabular::CellData & Tabular::CellData::operator=(CellData cs)
 {
        swap(cs);
        return *this;
 }
 
 
-void Tabular::cellstruct::swap(cellstruct & rhs)
+void Tabular::CellData::swap(CellData & rhs)
 {
        std::swap(cellno, rhs.cellno);
        std::swap(width, rhs.width);
@@ -535,7 +535,7 @@ void Tabular::cellstruct::swap(cellstruct & rhs)
 }
 
 
-Tabular::rowstruct::rowstruct()
+Tabular::RowData::RowData()
        : ascent(0),
          descent(0),
          top_line(true),
@@ -551,7 +551,7 @@ Tabular::rowstruct::rowstruct()
 {}
 
 
-Tabular::columnstruct::columnstruct()
+Tabular::ColumnData::ColumnData()
        : alignment(LYX_ALIGN_CENTER),
          valignment(LYX_VALIGN_TOP),
          left_line(true),
@@ -587,7 +587,7 @@ void Tabular::init(Buffer const & buf, row_type rows_arg,
        buffer_ = &buf;
        row_info = row_vector(rows_arg);
        column_info = column_vector(columns_arg);
-       cell_info = cell_vvector(rows_arg, cell_vector(columns_arg, cellstruct(buf)));
+       cell_info = cell_vvector(rows_arg, cell_vector(columns_arg, CellData(buf)));
        row_info.reserve(10);
        column_info.reserve(10);
        cell_info.reserve(100);
@@ -626,7 +626,7 @@ void Tabular::appendRow(idx_type const cell)
        row_type const row = cellRow(cell);
 
        row_vector::iterator rit = row_info.begin() + row;
-       row_info.insert(rit, rowstruct());
+       row_info.insert(rit, RowData());
        // now set the values of the row before
        row_info[row] = row_info[row + 1];
 
@@ -637,7 +637,7 @@ void Tabular::appendRow(idx_type const cell)
        for (row_type i = 0; i < nrows - 1; ++i)
                swap(cell_info[i], old[i]);
 
-       cell_info = cell_vvector(nrows, cell_vector(ncols, cellstruct(buffer())));
+       cell_info = cell_vvector(nrows, cell_vector(ncols, CellData(buffer())));
 
        for (row_type i = 0; i <= row; ++i)
                swap(cell_info[i], old[i]);
@@ -682,13 +682,13 @@ void Tabular::appendColumn(idx_type const cell)
        col_type const column = cellColumn(cell);
        col_type const ncols = columnCount();
        column_vector::iterator cit = column_info.begin() + column + 1;
-       column_info.insert(cit, columnstruct());
+       column_info.insert(cit, ColumnData());
        // set the column values of the column before
        column_info[column + 1] = column_info[column];
 
        BufferParams const & bp = buffer().params();
        for (row_type i = 0; i < rowCount(); ++i) {
-               cell_info[i].insert(cell_info[i].begin() + column + 1, cellstruct(buffer()));
+               cell_info[i].insert(cell_info[i].begin() + column + 1, CellData(buffer()));
 
                // care about multicolumns
                if (cell_info[i][column + 1].multicolumn == CELL_BEGIN_OF_MULTICOLUMN)
@@ -1097,7 +1097,7 @@ void toggleFixedWidth(Cursor & cur, InsetText * inset, bool fixedWidth)
        cur.push(*inset);
        // undo information has already been recorded
        inset->getText(0)->setLayout(cur.bv().buffer(), 0, cur.lastpit() + 1,
-                       bp.textClass().emptyLayoutName());
+                       bp.documentClass().emptyLayoutName());
        cur.pop();
 }
 
@@ -1589,7 +1589,7 @@ bool Tabular::isMultiColumnReal(idx_type cell) const
 }
 
 
-Tabular::cellstruct & Tabular::cellinfo_of_cell(idx_type cell) const
+Tabular::CellData & Tabular::cellinfo_of_cell(idx_type cell) const
 {
        return cell_info[cellRow(cell)][cellColumn(cell)];
 }
@@ -1597,7 +1597,7 @@ Tabular::cellstruct & Tabular::cellinfo_of_cell(idx_type cell) const
 
 void Tabular::setMultiColumn(idx_type cell, idx_type number)
 {
-       cellstruct & cs = cellinfo_of_cell(cell);
+       CellData & cs = cellinfo_of_cell(cell);
        cs.multicolumn = CELL_BEGIN_OF_MULTICOLUMN;
        cs.alignment = column_info[cellColumn(cell)].alignment;
        cs.top_line = row_info[cellRow(cell)].top_line;
@@ -1605,7 +1605,7 @@ void Tabular::setMultiColumn(idx_type cell, idx_type number)
        cs.left_line = column_info[cellColumn(cell)].left_line;
        cs.right_line = column_info[cellColumn(cell+number-1)].right_line;
        for (idx_type i = 1; i < number; ++i) {
-               cellstruct & cs1 = cellinfo_of_cell(cell + i);
+               CellData & cs1 = cellinfo_of_cell(cell + i);
                cs1.multicolumn = CELL_PART_OF_MULTICOLUMN;
                cs.inset->appendParagraphs(cs1.inset->paragraphs());
                cs1.inset->clear();
@@ -3175,7 +3175,7 @@ void InsetTabular::edit(Cursor & cur, bool front, EntryDirection)
 void InsetTabular::updateLabels(ParIterator const & it)
 {
        // In a longtable, tell captions what the current float is
-       Counters & cnts = buffer().params().textClass().counters();
+       Counters & cnts = buffer().params().documentClass().counters();
        string const saveflt = cnts.current_float();
        if (tabular.isLongTabular())
                cnts.current_float("table");
@@ -4697,8 +4697,8 @@ bool InsetTabular::insertPlaintextString(BufferView & bv, docstring const & buf,
        col_type cols = 1;
        row_type rows = 1;
        col_type maxCols = 1;
-       docstring::size_type const len = buf.length();
-       docstring::size_type p = 0;
+       size_t const len = buf.length();
+       size_t p = 0;
 
        while (p < len &&
               (p = buf.find_first_of(from_ascii("\t\n"), p)) != docstring::npos) {
@@ -4732,7 +4732,7 @@ bool InsetTabular::insertPlaintextString(BufferView & bv, docstring const & buf,
                row = tabular.cellRow(cell);
        }
 
-       docstring::size_type op = 0;
+       size_t op = 0;
        idx_type const cells = loctab->cellCount();
        p = 0;
        cols = ocol;
@@ -4750,7 +4750,7 @@ bool InsetTabular::insertPlaintextString(BufferView & bv, docstring const & buf,
                        if (cols < columns) {
                                shared_ptr<InsetText> inset = loctab->getCellInset(cell);
                                Font const font = bv.textMetrics(&inset->text_).
-                                       getDisplayFont(0, 0);
+                                       displayFont(0, 0);
                                inset->setText(buf.substr(op, p - op), font,
                                               buffer().params().trackChanges);
                                ++cols;
@@ -4762,7 +4762,7 @@ bool InsetTabular::insertPlaintextString(BufferView & bv, docstring const & buf,
                        if (cols < columns) {
                                shared_ptr<InsetText> inset = tabular.getCellInset(cell);
                                Font const font = bv.textMetrics(&inset->text_).
-                                       getDisplayFont(0, 0);
+                                       displayFont(0, 0);
                                inset->setText(buf.substr(op, p - op), font,
                                               buffer().params().trackChanges);
                        }
@@ -4778,7 +4778,7 @@ bool InsetTabular::insertPlaintextString(BufferView & bv, docstring const & buf,
        // check for the last cell if there is no trailing '\n'
        if (cell < cells && op < len) {
                shared_ptr<InsetText> inset = loctab->getCellInset(cell);
-               Font const font = bv.textMetrics(&inset->text_).getDisplayFont(0, 0);
+               Font const font = bv.textMetrics(&inset->text_).displayFont(0, 0);
                inset->setText(buf.substr(op, len - op), font,
                        buffer().params().trackChanges);
        }