]> git.lyx.org Git - features.git/blobdiff - src/tabular.C
Hopefully fixed the redo problems with insets!
[features.git] / src / tabular.C
index 07316512f8ffa678b088cdfa1c7600a1d679b53a..5213651290be0272b317d78b35e5836db4a69e27 100644 (file)
@@ -110,11 +110,23 @@ LyXTabular::LyXTabular(InsetTabular * inset, int rows_arg, int columns_arg)
 }
 
 
-LyXTabular::LyXTabular(InsetTabular * inset, LyXTabular const & lt)
+LyXTabular::LyXTabular(InsetTabular * inset, LyXTabular const & lt,
+                       bool same_id)
 {
        owner_ = inset;
        cur_cell = -1;
        Init(lt.rows_, lt.columns_, &lt);
+       // we really should change again to have InsetText as a pointer
+       // and allocate it then we would not have to do this stuff all
+       // double!
+       if (same_id) {
+               for (int i = 0; i < rows_; ++i) {
+                       for (int j = 0; j < columns_; ++j) {
+                               cell_info[i][j].inset.id(lt.cell_info[i][j].inset.id());
+                               cell_info[i][j].inset.setParagraphData(lt.cell_info[i][j].inset.paragraph(),true);
+                       }
+               }
+       }
 #if 0
 #ifdef WITH_WARNINGS
 #warning Jürgen, can you make it the other way round. So that copy assignment depends on the copy constructor and not the other way. (Lgb)
@@ -164,9 +176,9 @@ LyXTabular & LyXTabular::operator=(LyXTabular const & lt)
 }
 
 
-LyXTabular * LyXTabular::clone(InsetTabular * inset)
+LyXTabular * LyXTabular::clone(InsetTabular * inset, bool same_id)
 {
-       LyXTabular * result = new LyXTabular(inset, *this);
+       LyXTabular * result = new LyXTabular(inset, *this, same_id);
 #if 0
        // don't know if this is good but I need to Clone also
        // the text-insets here, this is for the Undo-facility!
@@ -2212,6 +2224,7 @@ int LyXTabular::Latex(Buffer const * buf,
                        ++cell;
                }
                os << "\\\\\n";
+               ++ret;
                ret += TeXBottomHLine(os, i);
                if (IsLongTabular()) {
                        if (i == (endhead.row - 1)) {