X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftabular.C;h=5213651290be0272b317d78b35e5836db4a69e27;hb=c130d5dbfd3f4d4a2721c9be786b7fa45b806aca;hp=0c201c501ac683d896a3486532a13cda2c518e75;hpb=e3052dc18bc13cd4ea91cd5e528246e3d4a4ae12;p=features.git diff --git a/src/tabular.C b/src/tabular.C index 0c201c501a..5213651290 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -26,7 +26,7 @@ #include "debug.h" #include "vspace.h" #include "layout.h" -#include "lyx_gui_misc.h" +#include "frontends/Alert.h" #include "buffer.h" #include "BufferView.h" #include "Painter.h" @@ -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_, <); + // 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! @@ -266,9 +278,6 @@ void LyXTabular::AppendRow(int cell) void LyXTabular::DeleteRow(int row) { - // Why make it so hard? (Lgb) - //if (!(rows_ - 1)) - //return; if (rows_ == 1) return; // Not allowed to delete last row row_info.erase(row_info.begin() + row); //&row_info[row]); @@ -1442,7 +1451,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl) lyxerr << "Tabular format < 5 is not supported anymore\n" "Get an older version of LyX (< 1.1.x) for conversion!" << endl; - WriteAlert(_("Warning:"), + Alert::alert(_("Warning:"), _("Tabular format < 5 is not supported anymore\n"), _("Get an older version of LyX (< 1.1.x) for conversion!")); if (version > 2) { @@ -2215,6 +2224,7 @@ int LyXTabular::Latex(Buffer const * buf, ++cell; } os << "\\\\\n"; + ++ret; ret += TeXBottomHLine(os, i); if (IsLongTabular()) { if (i == (endhead.row - 1)) { @@ -2620,12 +2630,12 @@ InsetText * LyXTabular::GetCellInset(int row, int column) const void LyXTabular::Validate(LaTeXFeatures & features) const { if (IsLongTabular()) - features.longtable = true; + features.require("longtable"); if (NeedRotating()) - features.rotating = true; - for (int cell = 0; !features.array && (cell < numberofcells); ++cell) { + features.require("rotating"); + for (int cell = 0; !features.isRequired("array") && (cell < numberofcells); ++cell) { if (GetVAlignment(cell) != LYX_VALIGN_TOP) - features.array = true; + features.require("array"); GetCellInset(cell)->validate(features); } } @@ -2651,16 +2661,9 @@ LyXTabular::BoxType LyXTabular::UseParbox(int cell) const for (; par; par = par->next()) { for (int i = 0; i < par->size(); ++i) { - if (par->getChar(i) == Paragraph::META_NEWLINE) + if (par->getChar(i) == Paragraph::META_NEWLINE) return BOX_PARBOX; } } return BOX_NONE; } - -/* Emacs: - * Local variables: - * tab-width: 4 - * End: - * vi:set tabstop=4: - */