Fix bug 4886.

Introduce OutputParams::inTableCell, to track when we are in a table cell.
Use this information to output \newline rather than \\ when in one.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26349 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-09-09 18:42:17 +00:00
parent e78347a673
commit 3bb9c0d34d
5 changed files with 18 additions and 3 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),
inComment(false), inTableCell(false),
inDeletedInset(0), changeOfDeletedInset(Change::UNCHANGED),
par_begin(0), par_end(0),
dryrun(false), verbatim(false)

View File

@ -125,6 +125,9 @@ public:
*/
bool inComment;
/// Whether we are in a table cell
bool inTableCell;
/** Whether we are inside an inset that is logically deleted.
* A value > 0 indicates a deleted inset.
*/

View File

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

View File

@ -2724,6 +2724,13 @@ 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,6 +637,8 @@ 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,