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),
use_japanese(false), linelen(0), depth(0),
exportdata(new ExportData),
inComment(false), inTableCell(false),
inComment(false), inTableCell(NO),
inDeletedInset(0), changeOfDeletedInset(Change::UNCHANGED),
par_begin(0), par_end(0),
dryrun(false), verbatim(false)

View File

@ -35,6 +35,12 @@ public:
XML
};
enum TableCell {
NO,
PLAIN,
ALIGNED
};
OutputParams(Encoding const *);
~OutputParams();
@ -125,8 +131,10 @@ public:
*/
bool inComment;
/// Whether we are in a table cell
bool inTableCell;
/** Whether we are in a table cell.
* For newline, it matters whether its content is aligned or not.
*/
TableCell inTableCell;
/** Whether we are inside an inset that is logically deleted.
* 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) {
case InsetNewlineParams::NEWLINE:
if (op.inTableCell)
if (rp.inTableCell == OutputParams::PLAIN)
os << "\\newline\n";
else
os << "\\\\\n";

View File

@ -2153,16 +2153,25 @@ int Tabular::TeXRow(odocstream & os, row_type i,
&& getPWidth(cell).zero();
if (rtl) {
if (par.getParLanguage(buffer().params())->lang() ==
"farsi")
string const lang =
par.getParLanguage(buffer().params())->lang();
if (lang == "farsi")
os << "\\textFR{";
else if (par.getParLanguage(buffer().params())->lang() == "arabic_arabi")
else if (lang == "arabic_arabi")
os << "\\textAR{";
// currently, remaning RTL languages are arabic_arabtex and hebrew
// currently, remaning RTL languages are
// arabic_arabtex and hebrew
else
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)
os << '}';
@ -2732,17 +2741,12 @@ bool InsetTableCell::forcePlainLayout(idx_type) const
return !isFixedWidth;
}
bool InsetTableCell::allowParagraphCustomization(idx_type) const
{
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,
FuncStatus & status) const

View File

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