]> git.lyx.org Git - lyx.git/blobdiff - src/tabular.C
remove noload/don't typeset
[lyx.git] / src / tabular.C
index c20ac65f054dd7d5091678c969dc3939fbdbfdc5..74c9caa17e6be5cca6050245954a404530892c25 100644 (file)
@@ -751,8 +751,9 @@ bool LyXTabular::SetColumnPWidth(int cell, LyXLength const & width)
        int const j = column_of_cell(cell);
 
        column_info[j].p_width = width;
-       if (flag) // do this only if there is a width
-               SetAlignment(cell, LYX_ALIGN_LEFT);
+       // This should not ne necessary anymore
+       //      if (flag) // do this only if there is a width
+       //      SetAlignment(cell, LYX_ALIGN_LEFT);
        for (int i = 0; i < rows_; ++i) {
                int c = GetCellNumber(i, j);
                flag = !GetPWidth(c).zero(); // because of multicolumns!
@@ -1468,19 +1469,8 @@ void LyXTabular::OldFormatRead(BufferParams const & bp,
                        || token == "\\end_deeper")
                {
                        lex.pushToken(token);
-#ifndef NO_COMPABILITY
-                       // Here we need to insert the inset_ert_contents into the last
-                       // cell of the tabular.
-                       owner_->bufferOwner()->insertErtContents(par, pos);
-#endif
                        break;
                }
-#ifndef NO_COMPABILITY
-               if (token == "\\newline")
-                       // Here we need to insert the inset_ert_contents into the last
-                       // cell of the tabular.
-                       owner_->bufferOwner()->insertErtContents(par, pos, false);
-#endif
                if (owner_->bufferOwner()->parseSingleLyXformat2Token(lex, par,
                                                                                                                          return_par,
                                                                                                                          token, pos,
@@ -2208,7 +2198,7 @@ int LyXTabular::TeXRow(ostream & os, int const i, Buffer const * buf,
                InsetText * inset = GetCellInset(cell);
 
                bool rtl = inset->paragraph()->isRightToLeftPar(buf->params) &&
-                       inset->paragraph()->size() > 0 && GetPWidth(cell).zero();
+                       !inset->paragraph()->empty() && GetPWidth(cell).zero();
 
                if (rtl)
                        os << "\\R{";
@@ -2223,7 +2213,7 @@ int LyXTabular::TeXRow(ostream & os, int const i, Buffer const * buf,
                }
                ++cell;
        }
-       os << "\\\\\n";
+       os << "\\tabularnewline\n";
        ++ret;
        ret += TeXBottomHLine(os, i);
        return ret;
@@ -2254,6 +2244,20 @@ int LyXTabular::latex(Buffer const * buf,
                        if (column_info[i].left_line)
                                os << '|';
                        if (!column_info[i].p_width.zero()) {
+                         os << ">{";
+                         switch (column_info[i].alignment) {
+                         case LYX_ALIGN_LEFT:
+                           os << "\\raggedright";
+                           break;
+                         case LYX_ALIGN_RIGHT:
+                           os << "\\raggedleft";
+                           break;
+                         case LYX_ALIGN_CENTER:
+                           os << "\\centering";
+                           break;
+                         }
+                         os << "}";
+                         
                                switch (column_info[i].valignment) {
                                case LYX_VALIGN_TOP:
                                        os << "p";
@@ -2733,12 +2737,15 @@ int LyXTabular::GetCellFromInset(Inset const * inset, int maybe_cell) const
 
 void LyXTabular::Validate(LaTeXFeatures & features) const
 {
+        features.require("NeedTabularnewline");
        if (IsLongTabular())
                features.require("longtable");
        if (NeedRotating())
                features.require("rotating");
        for (int cell = 0; cell < numberofcells; ++cell) {
-               if (GetVAlignment(cell) != LYX_VALIGN_TOP)
+               if ( (GetVAlignment(cell) != LYX_VALIGN_TOP) ||
+                    ( !(GetPWidth(cell).zero())&&!(IsMultiColumn(cell)) )
+                  )
                        features.require("array");
                GetCellInset(cell)->validate(features);
        }