X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftabular.C;h=0dc9287192a0eeb709d7b78e355105843d0ed0b3;hb=8cb2e519b3975cc643f2c93706137cf2e6a4f4d8;hp=71adb1843006fa9ab5cf883705da8081b34195a2;hpb=a30e709a3b315fd675cff7c92b9539e5e0fd7c9c;p=lyx.git diff --git a/src/tabular.C b/src/tabular.C index 71adb18430..0dc9287192 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -1348,7 +1348,8 @@ void LyXTabular::ReadNew(Buffer const * buf, istream & is, void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl) { int version; - int i, j; + int i; + int j; int rows_arg = 0; int columns_arg = 0; int is_long_tabular_arg = false; @@ -1529,7 +1530,11 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl) 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 if (par->IsNewline(i)) { ++cell; if (cell > GetNumberOfCells()) { @@ -1558,174 +1563,17 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl) } } 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(); } -string const LyXTabular::GetDocBookAlign(int cell, bool isColumn) const -{ - int const i = isColumn ? cell : column_of_cell(cell); - - if (!isColumn && IsMultiColumn(cell)) { - if (!cellinfo_of_cell(cell)->align_special.empty()) { - return cellinfo_of_cell(cell)->align_special; - } else { - switch (GetAlignment(cell)) { - case LYX_ALIGN_LEFT: - return "left"; - case LYX_ALIGN_RIGHT: - return "right"; - default: - return "center"; - } - } - } else { - if (!column_info[i].align_special.empty()) { - return column_info[i].align_special; - } -#ifdef IGNORE_THIS_FOR_NOW - else if (!column_info[i].p_width.empty()) { - file += "p{"; - file += column_info[i].p_width; - file += '}'; - } -#endif - else { - switch (column_info[i].alignment) { - case LYX_ALIGN_LEFT: - return "left"; - case LYX_ALIGN_RIGHT: - return "right"; - default: - return "center"; - } - } - } -} - - -// cell <0 will tex the preamble -// returns the number of printed newlines -int LyXTabular::DocBookEndOfCell(ostream & os, int cell, int & depth) const -{ - int ret = 0; - if (IsLastCell(cell)) { - os << newlineAndDepth(--depth) - << "" - << newlineAndDepth(--depth) - << "" - << newlineAndDepth(--depth) - << "" - << newlineAndDepth(--depth); - if (is_long_tabular) - os << ""; - else - os << "" - << newlineAndDepth(--depth); - ret += 4; - } else { - if (cell < 0) { - // preamble - if (is_long_tabular) - os << "" - << newlineAndDepth(++depth); - ++ret; - for (int i = 0; i < columns_; ++i) { - os << "" - << newlineAndDepth(depth); - ++ret; -#ifdef NOT_HANDLED_YET_AS_I_DONT_KNOW_HOW - if (column_info[i].left_line) - os << '|'; -#endif - } - os << "" - << newlineAndDepth(++depth) - << "" - << newlineAndDepth(++depth) - << "" - << newlineAndDepth(++depth); - ret += 3; - } else { - if (IsLastCellInRow(cell)) { - os << newlineAndDepth(--depth) - << "" - << newlineAndDepth(--depth) - << "" - << newlineAndDepth(depth) - << "" - << newlineAndDepth(++depth) - << "" - << newlineAndDepth(++depth); - ret += 4; - } else { - os << newlineAndDepth(--depth) - << "" - << newlineAndDepth(depth) - << "" - << newlineAndDepth(++depth); - ret += 3; - } - } - } - return ret; -} - - bool LyXTabular::IsMultiColumn(int cell, bool real) const { return ((!real || (column_of_cell(cell) != right_column_of_cell(cell))) && @@ -2322,7 +2170,11 @@ int LyXTabular::Latex(Buffer const * buf, 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 if (rtl) os << "\\R{"; ret += inset->Latex(buf, os, fragile, fp); @@ -2701,11 +2553,12 @@ void LyXTabular::Validate(LaTeXFeatures & features) const } +#ifndef NEW_INSETS LyXTabular::BoxType LyXTabular::UseParbox(int cell) const { LyXParagraph * par = GetCellInset(cell)->par; - for (; par; par = par->next) { + for (; par; par = par->next_) { for (int i = 0; i < par->Last(); ++i) { if (par->GetChar(i) == LyXParagraph::META_NEWLINE) return BOX_PARBOX; @@ -2713,3 +2566,17 @@ LyXTabular::BoxType LyXTabular::UseParbox(int cell) const } return BOX_NONE; } +#else +LyXTabular::BoxType LyXTabular::UseParbox(int cell) const +{ + LyXParagraph * par = GetCellInset(cell)->par; + + for (; par; par = par->next()) { + for (int i = 0; i < par->size(); ++i) { + if (par->GetChar(i) == LyXParagraph::META_NEWLINE) + return BOX_PARBOX; + } + } + return BOX_NONE; +} +#endif