LyXTabular::LyXTabular(InsetTabular * inset, LyXTabular const & lt)
{
owner_ = inset;
- Init(lt.rows_, lt.columns_);
+ Init(lt.rows_, lt.columns_, <);
+#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)
#endif
operator=(lt);
+#endif
}
LyXTabular & LyXTabular::operator=(LyXTabular const & lt)
{
+#if 0
+#warning This while method should look like this: (Lgb)
+
+ LyXTabular tmp(lt);
+ tmp.swap(*this);
+#else
// If this and lt is not of the same size we have a serious bug
// So then it is ok to throw an exception, or for now
// call abort()
- Assert(rows_ == lt.rows_ && columns_ == lt.columns_);
+ lyx::Assert(rows_ == lt.rows_ && columns_ == lt.columns_);
cell_info = lt.cell_info;
row_info = lt.row_info;
rotate = lt.rotate;
Reinit();
-
+#endif
return *this;
}
LyXTabular * LyXTabular::Clone(InsetTabular * inset)
{
LyXTabular * result = new LyXTabular(inset, *this);
+#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!
for (int i = 0; i < rows_; ++i) {
result->cell_info[i][j].inset.setOwner(inset);
}
}
+#endif
return result;
}
/* activates all lines and sets all widths to 0 */
-void LyXTabular::Init(int rows_arg, int columns_arg)
+void LyXTabular::Init(int rows_arg, int columns_arg, LyXTabular const * lt)
{
rows_ = rows_arg;
columns_ = columns_arg;
column_info = column_vector(columns_, columnstruct());
cell_info = cell_vvector(rows_, cell_vector(columns_, cellstruct()));
+ if (lt) {
+ operator=(*lt);
+ return;
+ }
+
int cellno = 0;
for (int i = 0; i < rows_; ++i) {
for (int j = 0; j < columns_; ++j) {
bool LyXTabular::TopAlreadyDrawed(int cell) const
{
- if (GetAdditionalHeight(cell))
- return false;
int row = row_of_cell(cell);
- if (row > 0) {
+ if ((row > 0) && !GetAdditionalHeight(row)) {
int column = column_of_cell(cell);
--row;
while (column
}
-int LyXTabular::GetAdditionalHeight(int cell) const
+int LyXTabular::GetAdditionalHeight(int row) const
{
- int const row = row_of_cell(cell);
- if (!row) return 0;
+ if (!row || row >= rows_)
+ return 0;
bool top = true;
bool bottom = true;
bool LyXTabular::SetAlignSpecial(int cell, string const & special,
- LyXTabular::Feature what)
+ LyXTabular::Feature what)
{
if (what == SET_SPECIAL_MULTI)
cellinfo_of_cell(cell)->align_special = special;
LyXParagraph * par = new LyXParagraph;
LyXParagraph * return_par = 0;
-#ifndef NEW_INSETS
- LyXParagraph::footnote_flag footnoteflag = LyXParagraph::NO_FOOTNOTE;
- LyXParagraph::footnote_kind footnotekind = LyXParagraph::FOOTNOTE;
-#endif
+
string tmptok;
int pos = 0;
char depth = 0;
if (owner_->BufferOwner()->parseSingleLyXformat2Token(lex, par,
return_par,
token, pos,
- depth, font
-#ifndef NEW_INSETS
- ,
- footnoteflag,
- footnotekind
-#endif
- ))
- {
+ depth, font)) {
// the_end read
lex.pushToken(token);
break;
InsetText * inset = GetCellInset(cell);
int row;
-#ifndef NEW_INSETS
- for (int i = 0; i < par->Last(); ++i)
-#else
- for (int i = 0; i < par->size(); ++i)
-#endif
- {
+ for (int i = 0; i < par->size(); ++i) {
if (par->IsNewline(i)) {
++cell;
if (cell > GetNumberOfCells()) {
}
}
par->CopyIntoMinibuffer(*owner_->BufferOwner(), i);
-#ifndef NEW_INSETS
- inset->par->InsertFromMinibuffer(inset->par->Last());
-#else
inset->par->InsertFromMinibuffer(inset->par->size());
-#endif
}
delete par;
Reinit();
for (int row = 0; row < rows_; ++row)
height += GetAscentOfRow(row) + GetDescentOfRow(row) +
- GetAdditionalHeight(GetCellNumber(row, 0));
+ GetAdditionalHeight(row);
return height;
}
InsetText * inset = GetCellInset(cell);
bool rtl = inset->par->isRightToLeftPar(buf->params) &&
-#ifndef NEW_INSETS
- inset->par->Last() > 0 && GetPWidth(cell).empty();
-#else
- inset->par->size() > 0 && GetPWidth(cell).empty();
-#endif
+ inset->par->size() > 0 && GetPWidth(cell).empty();
+
if (rtl)
os << "\\R{";
ret += inset->Latex(buf, os, fragile, fp);
}
-#ifndef NEW_INSETS
-LyXTabular::BoxType LyXTabular::UseParbox(int cell) const
-{
- LyXParagraph * par = GetCellInset(cell)->par;
-
- for (; par; par = par->next_) {
- for (int i = 0; i < par->Last(); ++i) {
- if (par->GetChar(i) == LyXParagraph::META_NEWLINE)
- return BOX_PARBOX;
- }
- }
- return BOX_NONE;
-}
-#else
LyXTabular::BoxType LyXTabular::UseParbox(int cell) const
{
LyXParagraph * par = GetCellInset(cell)->par;
}
return BOX_NONE;
}
-#endif
+
+/* Emacs:
+ * Local variables:
+ * tab-width: 4
+ * End:
+ * vi:set tabstop=4:
+ */