]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/table.C
Removed all redundant using directives from the source.
[lyx.git] / src / tex2lyx / table.C
index ca01117dc663b5c4d1f3d520e762669311e57971..7b02cf3d79a2d9a98b61ada778d7f5bacca2d95e 100644 (file)
@@ -1,5 +1,12 @@
-/** The .tex to .lyx converter
-    \author André Pönitz (2003)
+/**
+ * \file table.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ * \author Jean-Marc Lasgouttes
+ *
+ * Full author contact details are available in file CREDITS.
  */
 
 // {[(
@@ -22,11 +29,9 @@ using std::ostream;
 using std::ostringstream;
 using std::string;
 using std::vector;
-using std::map;
 
 #include "mathed/math_gridinfo.h"
 
-
 // filled in preamble.C
 std::map<char, int> special_columns;
 
@@ -282,7 +287,8 @@ void handle_hline_below(RowInfo & ri, vector<CellInfo> & ci)
 }
 
 
-void handle_tabular(Parser & p, ostream & os)
+void handle_tabular(Parser & p, ostream & os,
+                   Context & context)
 {
        string posopts = p.getOpt();
        if (posopts.size())
@@ -397,7 +403,9 @@ void handle_tabular(Parser & p, ostream & os)
                                handle_colalign(p, t);
                                cellinfo[row][col].multi     = 1;
                                cellinfo[row][col].align     = t.front().align;
-                               cellinfo[row][col].content   = parse_text(p, FLAG_ITEM, false);
+                               ostringstream os;
+                               parse_text_in_inset(p, os, FLAG_ITEM, false, context);
+                               cellinfo[row][col].content   = os.str();
                                cellinfo[row][col].leftline  |= t.front().leftline;
                                cellinfo[row][col].rightline |= t.front().rightline;
 
@@ -414,7 +422,12 @@ void handle_tabular(Parser & p, ostream & os)
 
                        } else {        
                                // FLAG_END is a hack, we need to read all of it
-                               cellinfo[row][col].content = parse_text(p, FLAG_END, false);
+                               cellinfo[row][col].leftline = colinfo[col].leftline;
+                               cellinfo[row][col].rightline = colinfo[col].rightline;
+                               cellinfo[row][col].align = colinfo[col].align;
+                               ostringstream os;
+                               parse_text_in_inset(p, os, FLAG_CELL, false, context);
+                               cellinfo[row][col].content   = os.str();
                        }
                }
 
@@ -434,21 +447,23 @@ void handle_tabular(Parser & p, ostream & os)
 
        //cerr << "// output what we have\n";
        // output what we have
-       os << "<lyxtabular version=\"3\" rows=\"" << rowinfo.size()
+       os << "\n<lyxtabular version=\"3\" rows=\"" << rowinfo.size()
                 << "\" columns=\"" << colinfo.size() << "\">\n"
                 << "<features>\n";
 
        //cerr << "// after header\n";
        for (size_t col = 0; col < colinfo.size(); ++col) {
-               os << "<column alignment=\"" << colinfo[col].align << "\"";
-               if (colinfo[col].rightline)
-                       os << " rightline=\"true\"";
+               os << "<column alignment=\""
+                  << verbose_align(colinfo[col].align) << "\"";
+               os << " valignment=\"top\"";
                if (colinfo[col].leftline)
                        os << " leftline=\"true\"";
+               if (colinfo[col].rightline)
+                       os << " rightline=\"true\"";
+               if (colinfo[col].width.size())
+                       os << " width=\"" << colinfo[col].width << "\"";
                if (colinfo[col].special.size())
                        os << " special=\"" << colinfo[col].special << "\"";
-               os << " valignment=\"top\"";
-               os << " width=\"" << colinfo[col].width << "\"";
                os << ">\n";
        }
        //cerr << "// after cols\n";
@@ -465,27 +480,27 @@ void handle_tabular(Parser & p, ostream & os)
                        os << "<cell";
                        if (cell.multi)
                                os << " multicolumn=\"" << cell.multi << "\"";
-                       if (cell.leftline)
-                               os << " leftline=\"true\"";
-                       if (cell.rightline)
-                               os << " rightline=\"true\"";
+                       os << " alignment=\"" << verbose_align(cell.align) 
+                          << "\""
+                          << " valignment=\"top\"";
                        if (cell.topline)
                                os << " topline=\"true\"";
                        if (cell.bottomline)
                                os << " bottomline=\"true\"";
+                       if (cell.leftline)
+                               os << " leftline=\"true\"";
+                       if (cell.rightline)
+                               os << " rightline=\"true\"";
                        //cerr << "\nrow: " << row << " col: " << col;
                        //if (cell.topline)
                        //      cerr << " topline=\"true\"";
                        //if (cell.bottomline)
                        //      cerr << " bottomline=\"true\"";
-                       os << " alignment=\"" << verbose_align(cell.align) << "\""
-                                << " valignment=\"top\""
-                                << " usebox=\"none\""
-                                << ">"
-                          << "\n\\begin_inset Text"
-                          << "\n\n\\layout Standard\n\n"
+                       os << " usebox=\"none\""
+                          << ">"
+                          << "\n\\begin_inset Text\n"
                           << cell.content
-                          << "\n\\end_inset\n\n"
+                          << "\n\\end_inset \n"
                           << "</cell>\n";
                }
                os << "</row>\n";