Georg Baum <[EMAIL PROTECTED]> writes: | diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/tex2lyx/table.C lyx-1.4-cvs/src/tex2lyx/table.C | --- lyx-1.4-clean/src/tex2lyx/table.C 2005-02-26 15:52:21.000000000 +0100 | +++ lyx-1.4-cvs/src/tex2lyx/table.C 2005-03-06 12:16:46.000000000 +0100 | @@ -16,6 +16,9 @@ | | #include "tex2lyx.h" | | +#include "support/convert.h" | +#include "support/lstrings.h" | + | #include <cctype> | #include <fstream> | #include <iostream> | @@ -40,17 +43,19 @@ namespace { | | class ColInfo { | public: | - ColInfo() : align('c'), rightline(false), leftline(false) {} | + ColInfo() : align('n'), valign('n'), rightlines(0), leftlines(0) {} | /// column alignment | char align; | + /// vertical alignment | + char valign;
We really should have proper type for these. But that is for later. | @@ -114,6 +139,14 @@ inline char const * verbose_align(char c | } | | | +/// translate a vertical alignment (as stored in ColInfo and CellInfo) to LyX | +inline char const * verbose_valign(char c) | +{ | + // The default value for no special alignment is "top". | + return c == 'p' ? "top" : c == 'm' ? "middle" : c == 'b' ? "bottom" : "top"; | +} Can we have this a bit more readable? a switch perhaps? | +void ci2special(ColInfo & ci) | { | - if (p.get_token().cat() != catBegin) | - cerr << "wrong syntax for table column alignment. '{' expected\n"; | + if (ci.width.empty() && ci.align == 'n') | + // The alignment setting is already in special, since | + // handle_colalign() never stores ci with these settings | + // and ensures that leftlines == 0 and rightlines == 0 in | + // this case. | + return; | + | + if (!ci.width.empty()) { | + switch (ci.align) { | + case 'l': | + ci.special += ">{\\raggedright}"; | + case 'r': | + ci.special += ">{\\raggedleft}"; | + case 'c': | + ci.special += ">{\\centering}"; | + } If fall-through is ok here, then please comment it. (Is it ok?) -- Lgb