InsetTabular: make Slovak and Czech documents compilable, fixes http://bugzilla.lyx.org/show_bug.cgi?id=5290, thanks to Heiko Obderdiek for the hint how to fix this

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26581 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2008-09-26 21:24:59 +00:00
parent 632bc7dcec
commit a7722811f7
2 changed files with 31 additions and 9 deletions

View File

@ -1810,7 +1810,7 @@ bool Tabular::isPartOfMultiColumn(row_type row, col_type column) const
}
int Tabular::TeXTopHLine(odocstream & os, row_type row) const
int Tabular::TeXTopHLine(odocstream & os, row_type row, string const lang) const
{
// we only output complete row lines and the 1st row here, the rest
// is done in Tabular::TeXBottomHLine(...)
@ -1839,6 +1839,13 @@ int Tabular::TeXTopHLine(odocstream & os, row_type row) const
} else if (row == 0) {
for (col_type c = 0; c < ncols; ++c) {
if (topline[c]) {
//babel makes the "-" character an active one, so we have to suppress this here
//see http://groups.google.com/group/comp.text.tex/browse_thread/thread/af769424a4a0f289#
if (lang == "slovak" || lang == "czech")
os << (use_booktabs ? "\\expandafter\\cmidrule\\expandafter{\\expandafter" :
"\\expandafter\\cline\\expandafter{\\expandafter")
<< c + 1 << "\\string-";
else
os << (use_booktabs ? "\\cmidrule{" : "\\cline{") << c + 1 << '-';
// get to last column of line span
while (c < ncols && topline[c])
@ -1852,7 +1859,7 @@ int Tabular::TeXTopHLine(odocstream & os, row_type row) const
}
int Tabular::TeXBottomHLine(odocstream & os, row_type row) const
int Tabular::TeXBottomHLine(odocstream & os, row_type row, string const lang) const
{
// we output bottomlines of row r and the toplines of row r+1
// if the latter do not span the whole tabular
@ -1889,8 +1896,14 @@ int Tabular::TeXBottomHLine(odocstream & os, row_type row) const
} else {
for (col_type c = 0; c < ncols; ++c) {
if (bottomline[c]) {
os << (use_booktabs ? "\\cmidrule{" : "\\cline{")
<< c + 1 << '-';
//babel makes the "-" character an active one, so we have to suppress this here
//see http://groups.google.com/group/comp.text.tex/browse_thread/thread/af769424a4a0f289#
if (lang == "slovak" || lang == "czech")
os << (use_booktabs ? "\\expandafter\\cmidrule\\expandafter{\\expandafter" :
"\\expandafter\\cline\\expandafter{\\expandafter")
<< c + 1 << "\\string-";
else
os << (use_booktabs ? "\\cmidrule{" : "\\cline{") << c + 1 << '-';
// get to last column of line span
while (c < ncols && bottomline[c])
++c;
@ -2153,7 +2166,13 @@ int Tabular::TeXRow(odocstream & os, row_type i,
OutputParams const & runparams) const
{
idx_type cell = cellIndex(i, 0);
int ret = TeXTopHLine(os, i);
shared_ptr<InsetTableCell> inset = cellInset(cell);
Paragraph const & par = inset->paragraphs().front();
string const lang = par.getParLanguage(buffer().params())->lang();
//output the top line
int ret = TeXTopHLine(os, i, lang);
if (row_info[i].top_space_default) {
if (use_booktabs)
os << "\\addlinespace\n";
@ -2228,7 +2247,10 @@ int Tabular::TeXRow(odocstream & os, row_type i,
}
os << '\n';
++ret;
ret += TeXBottomHLine(os, i);
//output the bottom line
ret += TeXBottomHLine(os, i, lang);
if (row_info[i].interline_space_default) {
if (use_booktabs)
os << "\\addlinespace\n";

View File

@ -588,9 +588,9 @@ public:
///
// helper function for Latex returns number of newlines
///
int TeXTopHLine(odocstream &, row_type row) const;
int TeXTopHLine(odocstream &, row_type row, std::string const lang) const;
///
int TeXBottomHLine(odocstream &, row_type row) const;
int TeXBottomHLine(odocstream &, row_type row, std::string const lang) const;
///
int TeXCellPreamble(odocstream &, idx_type cell, bool & ismulticol) const;
///