Fix rest of bug 4886, following Richard's advices.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26354 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2008-09-10 16:02:32 +00:00
parent e16468d72e
commit 9b99e7be2c
5 changed files with 28 additions and 18 deletions

View File

@ -23,7 +23,7 @@ OutputParams::OutputParams(Encoding const * enc)
local_font(0), encoding(enc), free_spacing(false), use_babel(false), local_font(0), encoding(enc), free_spacing(false), use_babel(false),
use_japanese(false), linelen(0), depth(0), use_japanese(false), linelen(0), depth(0),
exportdata(new ExportData), exportdata(new ExportData),
inComment(false), inTableCell(false), inComment(false), inTableCell(NO),
inDeletedInset(0), changeOfDeletedInset(Change::UNCHANGED), inDeletedInset(0), changeOfDeletedInset(Change::UNCHANGED),
par_begin(0), par_end(0), par_begin(0), par_end(0),
dryrun(false), verbatim(false) dryrun(false), verbatim(false)

View File

@ -35,6 +35,12 @@ public:
XML XML
}; };
enum TableCell {
NO,
PLAIN,
ALIGNED
};
OutputParams(Encoding const *); OutputParams(Encoding const *);
~OutputParams(); ~OutputParams();
@ -125,8 +131,10 @@ public:
*/ */
bool inComment; bool inComment;
/// Whether we are in a table cell /** Whether we are in a table cell.
bool inTableCell; * For newline, it matters whether its content is aligned or not.
*/
TableCell inTableCell;
/** Whether we are inside an inset that is logically deleted. /** Whether we are inside an inset that is logically deleted.
* A value > 0 indicates a deleted inset. * A value > 0 indicates a deleted inset.

View File

@ -140,11 +140,11 @@ ColorCode InsetNewline::ColorName() const
} }
int InsetNewline::latex(odocstream & os, OutputParams const & op) const int InsetNewline::latex(odocstream & os, OutputParams const & rp) const
{ {
switch (params_.kind) { switch (params_.kind) {
case InsetNewlineParams::NEWLINE: case InsetNewlineParams::NEWLINE:
if (op.inTableCell) if (rp.inTableCell == OutputParams::PLAIN)
os << "\\newline\n"; os << "\\newline\n";
else else
os << "\\\\\n"; os << "\\\\\n";

View File

@ -2153,16 +2153,25 @@ int Tabular::TeXRow(odocstream & os, row_type i,
&& getPWidth(cell).zero(); && getPWidth(cell).zero();
if (rtl) { if (rtl) {
if (par.getParLanguage(buffer().params())->lang() == string const lang =
"farsi") par.getParLanguage(buffer().params())->lang();
if (lang == "farsi")
os << "\\textFR{"; os << "\\textFR{";
else if (par.getParLanguage(buffer().params())->lang() == "arabic_arabi") else if (lang == "arabic_arabi")
os << "\\textAR{"; os << "\\textAR{";
// currently, remaning RTL languages are arabic_arabtex and hebrew // currently, remaning RTL languages are
// arabic_arabtex and hebrew
else else
os << "\\R{"; os << "\\R{";
} }
ret += inset->latex(os, runparams); // pass to the OutputParams that we are in a cell and
// which alignment we have set.
// InsetNewline needs this context information.
OutputParams newrp = runparams;
newrp.inTableCell = (getAlignment(cell) == LYX_ALIGN_BLOCK)
? OutputParams::PLAIN
: OutputParams::ALIGNED;
ret += inset->latex(os, newrp);
if (rtl) if (rtl)
os << '}'; os << '}';
@ -2732,17 +2741,12 @@ bool InsetTableCell::forcePlainLayout(idx_type) const
return !isFixedWidth; return !isFixedWidth;
} }
bool InsetTableCell::allowParagraphCustomization(idx_type) const bool InsetTableCell::allowParagraphCustomization(idx_type) const
{ {
return isFixedWidth; return isFixedWidth;
} }
int InsetTableCell::latex(odocstream & od, OutputParams const & rp) const
{
OutputParams newrp = rp;
newrp.inTableCell = true;
return InsetText::latex(od, newrp);
}
bool InsetTableCell::getStatus(Cursor & cur, FuncRequest const & cmd, bool InsetTableCell::getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & status) const FuncStatus & status) const

View File

@ -637,8 +637,6 @@ public:
/// ///
InsetCode lyxCode() const { return CELL_CODE; } InsetCode lyxCode() const { return CELL_CODE; }
/// ///
int latex(odocstream &, OutputParams const &) const;
///
Inset * clone() { return new InsetTableCell(*this); } Inset * clone() { return new InsetTableCell(*this); }
/// ///
bool getStatus(Cursor & cur, FuncRequest const & cmd, bool getStatus(Cursor & cur, FuncRequest const & cmd,