mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 18:24:48 +00:00
Initial XHTML support for InsetTabular.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32524 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c4701b2256
commit
dadda4cb44
@ -38,6 +38,7 @@
|
||||
#include "LyXRC.h"
|
||||
#include "MetricsInfo.h"
|
||||
#include "OutputParams.h"
|
||||
#include "output_xhtml.h"
|
||||
#include "Paragraph.h"
|
||||
#include "ParagraphParameters.h"
|
||||
#include "ParIterator.h"
|
||||
@ -2632,6 +2633,98 @@ int Tabular::docbook(odocstream & os, OutputParams const & runparams) const
|
||||
}
|
||||
|
||||
|
||||
docstring Tabular::xhtmlRow(XHTMLStream & xs, row_type row,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
/* for (col_type i = 0; i < column_info.size(); ++i) {
|
||||
os << "<colspec colname=\"col" << i << "\" align=\"";
|
||||
switch (column_info[i].alignment) {
|
||||
case LYX_ALIGN_LEFT:
|
||||
os << "left";
|
||||
break;
|
||||
case LYX_ALIGN_RIGHT:
|
||||
os << "right";
|
||||
break;
|
||||
default:
|
||||
os << "center";
|
||||
break;
|
||||
}
|
||||
os << '"';
|
||||
if (runparams.flavor == OutputParams::XML)
|
||||
os << '/';
|
||||
os << ">\n";
|
||||
++ret;
|
||||
} */
|
||||
|
||||
docstring ret;
|
||||
idx_type cell = getFirstCellInRow(row);
|
||||
|
||||
xs << StartTag("tr");
|
||||
for (col_type j = 0; j < column_info.size(); ++j) {
|
||||
if (isPartOfMultiColumn(row, j))
|
||||
continue;
|
||||
|
||||
stringstream attr;
|
||||
attr << "align='";
|
||||
switch (getAlignment(cell)) {
|
||||
case LYX_ALIGN_LEFT:
|
||||
attr << "left";
|
||||
break;
|
||||
case LYX_ALIGN_RIGHT:
|
||||
attr << "right";
|
||||
break;
|
||||
default:
|
||||
attr << "center";
|
||||
break;
|
||||
}
|
||||
attr << "'";
|
||||
attr << " valign='";
|
||||
switch (getVAlignment(cell)) {
|
||||
case LYX_VALIGN_TOP:
|
||||
attr << "top";
|
||||
break;
|
||||
case LYX_VALIGN_BOTTOM:
|
||||
attr << "bottom";
|
||||
break;
|
||||
case LYX_VALIGN_MIDDLE:
|
||||
attr << "middle";
|
||||
}
|
||||
attr << "'";
|
||||
|
||||
if (isMultiColumn(cell))
|
||||
attr << " colspan='" << j + columnSpan(cell) - 1<< "'";
|
||||
|
||||
xs << StartTag("td", attr.str());
|
||||
ret += cellInset(cell)->xhtml(xs, runparams);
|
||||
xs << EndTag("td");
|
||||
++cell;
|
||||
}
|
||||
xs << EndTag("tr");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
docstring Tabular::xhtml(XHTMLStream & xs, OutputParams const & runparams) const
|
||||
{
|
||||
docstring ret;
|
||||
xs << StartTag("table");
|
||||
|
||||
// It's unclear to me if we need to mess with the long table stuff.
|
||||
// We can borrow that too from docbook, if so.
|
||||
|
||||
xs << StartTag("tbody");
|
||||
for (row_type i = 0; i < row_info.size(); ++i) {
|
||||
if (isValidRow(i)) {
|
||||
ret += xhtmlRow(xs, i, runparams);
|
||||
}
|
||||
}
|
||||
xs << EndTag("tbody");
|
||||
xs << EndTag("table");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool Tabular::plaintextTopHLine(odocstream & os, row_type row,
|
||||
vector<unsigned int> const & clen) const
|
||||
{
|
||||
@ -2956,6 +3049,14 @@ docstring InsetTableCell::asString(bool intoInsets)
|
||||
}
|
||||
|
||||
|
||||
docstring InsetTableCell::xhtml(XHTMLStream & xs, OutputParams const & rp) const
|
||||
{
|
||||
if (!isFixedWidth)
|
||||
return InsetText::insetAsXHTML(xs, rp, InsetText::JustText);
|
||||
return InsetText::xhtml(xs, rp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -4218,6 +4319,12 @@ int InsetTabular::docbook(odocstream & os, OutputParams const & runparams) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetTabular::xhtml(XHTMLStream & xs, OutputParams const & rp) const
|
||||
{
|
||||
return tabular.xhtml(xs, rp);
|
||||
}
|
||||
|
||||
|
||||
void InsetTabular::validate(LaTeXFeatures & features) const
|
||||
{
|
||||
tabular.validate(features);
|
||||
|
@ -55,6 +55,7 @@ class InsetTableCell;
|
||||
class FuncStatus;
|
||||
class Lexer;
|
||||
class Paragraph;
|
||||
class XHTMLStream;
|
||||
|
||||
namespace frontend { class Painter; }
|
||||
|
||||
@ -368,9 +369,11 @@ public:
|
||||
void read(Lexer &);
|
||||
///
|
||||
int latex(odocstream &, OutputParams const &) const;
|
||||
//
|
||||
///
|
||||
int docbook(odocstream & os, OutputParams const &) const;
|
||||
///
|
||||
docstring xhtml(XHTMLStream & os, OutputParams const &) const;
|
||||
///
|
||||
void plaintext(odocstream &,
|
||||
OutputParams const & runparams, int const depth,
|
||||
bool onlydata, char_type delim) const;
|
||||
@ -645,6 +648,8 @@ public:
|
||||
bool onlydata) const;
|
||||
/// auxiliary function for docbook
|
||||
int docbookRow(odocstream & os, row_type, OutputParams const &) const;
|
||||
///
|
||||
docstring xhtmlRow(XHTMLStream & xs, row_type, OutputParams const &) const;
|
||||
|
||||
/// change associated Buffer
|
||||
void setBuffer(Buffer & buffer);
|
||||
@ -677,6 +682,8 @@ public:
|
||||
/// writes the contents of the cell as a string, optionally
|
||||
/// descending into insets
|
||||
docstring asString(bool intoInsets = true);
|
||||
///
|
||||
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
||||
private:
|
||||
/// unimplemented
|
||||
InsetTableCell();
|
||||
@ -773,6 +780,8 @@ public:
|
||||
///
|
||||
int docbook(odocstream &, OutputParams const &) const;
|
||||
///
|
||||
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
InsetCode lyxCode() const { return TABULAR_CODE; }
|
||||
|
Loading…
Reference in New Issue
Block a user