]> git.lyx.org Git - lyx.git/blobdiff - src/table.C
Baruch's graphic-inset patch.
[lyx.git] / src / table.C
index 54812b0306859c1516938f6d15034c6e08adf637..e9972a7e7bbc56f5053f885508dcf54246c3b549 100644 (file)
 #include "layout.h"
 #include "support/lstrings.h"
 #include "support/lyxmanip.h"
+#include "support/LAssert.h"
 #include "lyx_gui_misc.h"
-#include "insets/insettext.h"
 
 using std::ostream;
 using std::istream;
+using std::getline;
 using std::max;
 using std::endl;
 
@@ -36,7 +37,7 @@ static int const WIDTH_OF_LINE = 5;
 
 /// Define a few methods for the inner structs
 
-LyXTable::cellstruct::cellstruct(Buffer * buf
+LyXTable::cellstruct::cellstruct() 
 {
        cellno = 0; //should be initilaized correctly later.
        width_of_cell = 0;
@@ -47,14 +48,10 @@ LyXTable::cellstruct::cellstruct(Buffer * buf)
        has_cont_row = false;
        rotate = false;
        linebreaks = false;
-       buf ? inset = new InsetText(buf): inset = 0;
-       
 }
 
 LyXTable::cellstruct::~cellstruct() 
 {
-    if (inset)
-       delete inset;
 }
 
 LyXTable::cellstruct & 
@@ -124,25 +121,22 @@ LyXTable::columnstruct &
 }
 
 /* konstruktor */
-LyXTable::LyXTable(int rows_arg, int columns_arg, Buffer *buf)
+LyXTable::LyXTable(int rows_arg, int columns_arg)
 {
-    buffer = buf;
     Init(rows_arg, columns_arg);
 }
 
 
-LyXTable::LyXTable(LyXTable const & lt, Buffer * buf)
+LyXTable::LyXTable(LyXTable const & lt)
 {
-    buffer = buf;
     Init(lt.rows, lt.columns);
     
     operator=(lt);
 }
 
-LyXTable::LyXTable(LyXLex & lex, Buffer *buf)
+LyXTable::LyXTable(LyXLex & lex)
 {
     istream & is = lex.getStream();
-    buffer = buf;
     Read(is);
 }
 
@@ -193,7 +187,7 @@ LyXTable & LyXTable::operator=(LyXTable const & lt)
 LyXTable * LyXTable::Clone()
 {
     LyXTable * result = new LyXTable(rows, columns);
-    int row, column;;
+    int row, column;
 
     for (row = 0; row < rows; ++row) {
         for (column = 0; column < columns; ++column) {
@@ -232,7 +226,7 @@ void LyXTable::Init(int rows_arg, int columns_arg)
 
     int cellno = 0;
     for (i = 0; i < rows; ++i) {
-        cell_info[i] = new cellstruct[columns](buffer);
+        cell_info[i] = new cellstruct[columns];
         for (j = 0; j < columns; ++j) {
             cell_info[i][j].cellno = cellno++;
         }
@@ -983,7 +977,8 @@ void LyXTable::Read(istream & is)
        int h = 0;
        
        string s;
-       getline(is, s);
+       while(!s.length())
+           getline(is, s);
        if (s.length() > 8)
                version = atoi(s.c_str() + 8);
        else
@@ -1373,8 +1368,8 @@ int LyXTable::TexEndOfCell(ostream & os, int cell)
                os << "\\multicolumn{"
                   << cells_in_multicolumn(nvcell)
                   << "}{";
-            if (!cellinfo_of_cell(cell+1)->align_special.empty()) {
-                   os << cellinfo_of_cell(cell+1)->align_special
+            if (!cellinfo_of_cell(nvcell)->align_special.empty()) {
+                   os << cellinfo_of_cell(nvcell)->align_special
                       << "}{";
             } else {
                 if (LeftLine(nvcell))
@@ -2083,8 +2078,3 @@ int LyXTable::Latex(ostream &)
 {
     return 0;
 }
-
-InsetText * LyXTable::GetCellInset(int cell) const
-{
-    return cell_info[row_of_cell(cell)][column_of_cell(cell)].inset;
-}