]> git.lyx.org Git - lyx.git/blobdiff - src/tabular.C
The BIG UNDO patch. Recodes undo handling for better use inside InsetText.
[lyx.git] / src / tabular.C
index e7e5b034618ca6402cfc79f83ffb7cbf54b713fd..86091c6e36a02486ec4f65ffa911810f50349877 100644 (file)
@@ -152,7 +152,7 @@ LyXTabular & LyXTabular::operator=(LyXTabular const & lt)
 }
 
 
-LyXTabular * LyXTabular::Clone(InsetTabular * inset)
+LyXTabular * LyXTabular::clone(InsetTabular * inset)
 {
        LyXTabular * result = new LyXTabular(inset, *this);
 #if 0
@@ -187,7 +187,7 @@ void LyXTabular::Init(int rows_arg, int columns_arg, LyXTabular const * lt)
        for (int i = 0; i < rows_; ++i) {
                for (int j = 0; j < columns_; ++j) {
                        cell_info[i][j].inset.setOwner(owner_);
-                       cell_info[i][j].inset.SetDrawFrame(0, InsetText::LOCKED);
+                       cell_info[i][j].inset.setDrawFrame(0, InsetText::LOCKED);
                        cell_info[i][j].cellno = cellno++;
                }
                cell_info[i].back().right_line = true;
@@ -382,7 +382,7 @@ void LyXTabular::set_row_column_number_info(bool oldformat)
                                cell_info[row][column].right_line =
                                        cell_info[row][column+cn-1].right_line;
                        }
-                       cell_info[row][column].inset.SetAutoBreakRows(
+                       cell_info[row][column].inset.setAutoBreakRows(
                                !GetPWidth(GetCellNumber(row, column)).empty());
                }
        }
@@ -668,7 +668,7 @@ bool LyXTabular::SetColumnPWidth(int cell, string const & width)
        for (int i = 0; i < rows_; ++i) {
                int c = GetCellNumber(i, j);
                flag = !GetPWidth(c).empty(); // because of multicolumns!
-               GetCellInset(c)->SetAutoBreakRows(flag);
+               GetCellInset(c)->setAutoBreakRows(flag);
        }
        return true;
 }
@@ -680,7 +680,7 @@ bool LyXTabular::SetMColumnPWidth(int cell, string const & width)
 
        cellinfo_of_cell(cell)->p_width = width;
        if (IsMultiColumn(cell)) {
-               GetCellInset(cell)->SetAutoBreakRows(flag);
+               GetCellInset(cell)->setAutoBreakRows(flag);
                return true;
        }
        return false;
@@ -1078,7 +1078,7 @@ void LyXTabular::Write(Buffer const * buf, ostream & os) const
                           << write_attribute("special", cell_info[i][j].align_special)
                           << ">\n";
                        os << "\\begin_inset ";
-                       cell_info[i][j].inset.Write(buf, os);
+                       cell_info[i][j].inset.write(buf, os);
                        os << "\n\\end_inset \n"
                           << "</cell>\n";
                }
@@ -1329,7 +1329,7 @@ void LyXTabular::ReadNew(Buffer const * buf, istream & is,
                        getTokenValue(line, "special", cell_info[i][j].align_special);
                        l_getline(is, line);
                        if (prefixIs(line, "\\begin_inset")) {
-                               cell_info[i][j].inset.Read(buf, lex);
+                               cell_info[i][j].inset.read(buf, lex);
                                l_getline(is, line);
                        }
                        if (!prefixIs(line, "</cell>")) {
@@ -1493,7 +1493,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
        int pos = 0;
        Paragraph::depth_type depth = 0;
        LyXFont font(LyXFont::ALL_INHERIT);
-       font.setLanguage(owner_->BufferOwner()->GetLanguage());
+       font.setLanguage(owner_->bufferOwner()->getLanguage());
 
        while (lex.IsOK()) {
                lex.nextToken();
@@ -1506,7 +1506,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
                        lex.pushToken(token);
                        break;
                }
-               if (owner_->BufferOwner()->parseSingleLyXformat2Token(lex, par,
+               if (owner_->bufferOwner()->parseSingleLyXformat2Token(lex, par,
                                                                                                                          return_par,
                                                                                                                          token, pos,
                                                                                                                          depth, font)) {
@@ -1555,8 +1555,8 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
                                par->insertChar(i, ' ');
                        }
                }
-               par->copyIntoMinibuffer(*owner_->BufferOwner(), i);
-               inset->par->insertFromMinibuffer(inset->par->size());
+               par->copyIntoMinibuffer(*owner_->bufferOwner(), i);
+               inset->paragraph()->insertFromMinibuffer(inset->paragraph()->size());
        }
        delete par;
        Reinit();
@@ -2163,12 +2163,12 @@ int LyXTabular::Latex(Buffer const * buf,
                        ret += TeXCellPreamble(os, cell);
                        InsetText * inset = GetCellInset(cell);
 
-                       bool rtl = inset->par->isRightToLeftPar(buf->params) &&
-                                       inset->par->size() > 0 && GetPWidth(cell).empty();
+                       bool rtl = inset->paragraph()->isRightToLeftPar(buf->params) &&
+                                       inset->paragraph()->size() > 0 && GetPWidth(cell).empty();
 
                        if (rtl)
                                os << "\\R{";
-                       ret += inset->Latex(buf, os, fragile, fp);
+                       ret += inset->latex(buf, os, fragile, fp);
                        if (rtl)
                                os << "}";
 
@@ -2297,7 +2297,7 @@ int LyXTabular::DocBook(Buffer const * buf, ostream & os) const
                        }
                
                        os << ">";
-                       ret += GetCellInset(cell)->DocBook(buf, os);
+                       ret += GetCellInset(cell)->docBook(buf, os);
                        os << "</entry>";
                        ++cell;
                }
@@ -2425,7 +2425,7 @@ int LyXTabular::AsciiPrintCell(Buffer const * buf, ostream & os,
                                                           vector<unsigned int> const & clen) const
 {
        ostringstream sstr;
-       int ret = GetCellInset(cell)->Ascii(buf, sstr, 0);
+       int ret = GetCellInset(cell)->ascii(buf, sstr, 0);
 
        if (LeftLine(cell))
                os << "| ";
@@ -2484,7 +2484,7 @@ int LyXTabular::Ascii(Buffer const * buf, ostream & os) const
                        if (IsMultiColumn(cell, true))
                                continue;
                        ostringstream sstr;
-                       GetCellInset(cell)->Ascii(buf, sstr, 0);
+                       GetCellInset(cell)->ascii(buf, sstr, 0);
                        if (clen[j] < sstr.str().length())
                                clen[j] = sstr.str().length();
                }
@@ -2496,7 +2496,7 @@ int LyXTabular::Ascii(Buffer const * buf, ostream & os) const
                        if (!IsMultiColumn(cell, true) || IsPartOfMultiColumn(i, j))
                                continue;
                        ostringstream sstr;
-                       GetCellInset(cell)->Ascii(buf, sstr, 0);
+                       GetCellInset(cell)->ascii(buf, sstr, 0);
                        int len = int(sstr.str().length());
                        int const n = cells_in_multicolumn(cell);
                        for (int k = j; (len > 0) && (k < (j + n - 1)); ++k)
@@ -2530,6 +2530,12 @@ InsetText * LyXTabular::GetCellInset(int cell) const
 
 InsetText * LyXTabular::GetCellInset(int row, int column) const
 {
+#ifdef WITH_WARNINGS
+#warning Juergen, should we check whether the row/column values are correct?
+// If we do not need to do that, the tests in GetCellNumber should be
+// changed to asserts.
+#endif
+       cur_cell = GetCellNumber(row, column);
        return & cell_info[row][column].inset;
 }
 
@@ -2543,7 +2549,7 @@ void LyXTabular::Validate(LaTeXFeatures & features) const
        for (int cell = 0; !features.array && (cell < numberofcells); ++cell) {
                if (GetVAlignment(cell) != LYX_VALIGN_TOP)
                        features.array = true;
-               GetCellInset(cell)->Validate(features);
+               GetCellInset(cell)->validate(features);
        }
 }
 
@@ -2564,7 +2570,7 @@ std::vector<string> const LyXTabular::getLabelList() const
                        
 LyXTabular::BoxType LyXTabular::UseParbox(int cell) const
 {
-       Paragraph * par = GetCellInset(cell)->par;
+       Paragraph * par = GetCellInset(cell)->paragraph();
 
        for (; par; par = par->next()) {
                for (int i = 0; i < par->size(); ++i) {