Fixed longtable export.

Added a wrapper when a table is not inside a float.
Small update for date style, allow it to be left aligned.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2928 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
José Matox 2001-10-24 07:43:34 +00:00
parent 50ddccfe4b
commit 8cd5b4a291
7 changed files with 126 additions and 45 deletions

View File

@ -1,3 +1,8 @@
2001-10-24 José Matos <jamatos@fep.up.pt>
* layouts/db_stdtitle.inc: added align and alignpossible to date.
Now the default is left and center is still possible.
2001-10-18 José Abílio Oliveira Matos <jamatos@fep.up.pt>
* reLyX/MakePreamble.pm (translate_preamble): Cleaned the code for babel.

View File

@ -57,6 +57,8 @@ End
Style Date
LatexType Paragraph
LatexName date
Align Left
AlignPossible Left,Center
End
# Revision History style definition

View File

@ -1,3 +1,9 @@
2001-10-24 José Matos <jamatos@fep.up.pt>
* tabular.h:
* tabular.C (docbookRow): new function to export docbook code of a row.
(DocBook): now honors the longtable flags.
2001-10-23 José Matos <jamatos@fep.up.pt>
* LaTeXFeatures.h:

View File

@ -1,3 +1,9 @@
2001-10-24 José Matos <jamatos@fep.up.pt>
* insettabular.C (linuxdoc): Now exports the ascii's table version.
(docbook): If the table is not inside a float then wrap it inside
<informaltable>...</informaltable>.
2001-10-23 José Matos <jamatos@fep.up.pt>
* insetref.C (docbook): removed / terminator to conform SGML.

View File

@ -1151,15 +1151,33 @@ int InsetTabular::ascii(Buffer const * buf, ostream & os, int) const
}
int InsetTabular::linuxdoc(Buffer const *, ostream &) const
int InsetTabular::linuxdoc(Buffer const * buf, ostream & os) const
{
return 0;
return tabular->Ascii(buf,os);
}
int InsetTabular::docbook(Buffer const * buf, ostream & os) const
{
return tabular->DocBook(buf,os);
int ret = 0;
Inset * master;
// if the table is inside a float it doesn't need the informaltable
// wrapper. Search for it.
for(master = owner();
master && master->lyxCode() != Inset::FLOAT_CODE;
master = master->owner());
if (!master) {
os << "<informaltable>\n";
ret++;
}
ret+= tabular->DocBook(buf,os);
if (!master) {
os << "</informaltable>\n";
ret++;
}
return ret;
}

View File

@ -2284,6 +2284,57 @@ int LyXTabular::Latex(Buffer const * buf,
}
int LyXTabular::docbookRow(Buffer const * buf, ostream & os, int row) const
{
int ret = 0;
int cell = GetFirstCellInRow(row);
os << "<row>\n";
for (int j = 0; j < columns_; ++j) {
if (IsPartOfMultiColumn(row, j))
continue;
os << "<entry align=\"";
switch (GetAlignment(cell)) {
case LYX_ALIGN_LEFT:
os << "left";
break;
case LYX_ALIGN_RIGHT:
os << "right";
break;
default:
os << "center";
break;
}
os << "\" valign=\"";
switch (GetVAlignment(cell)) {
case LYX_VALIGN_TOP:
os << "top";
break;
case LYX_VALIGN_BOTTOM:
os << "bottom";
break;
case LYX_VALIGN_CENTER:
os << "middle";
}
os << "\"";
if (IsMultiColumn(cell)) {
os << " namest=\"col" << j << "\" ";
os << "nameend=\"col" << j + cells_in_multicolumn(cell) - 1<< "\"";
}
os << ">";
ret += GetCellInset(cell)->docbook(buf, os);
os << "</entry>\n";
++cell;
}
os << "</row>\n";
return ret;
}
int LyXTabular::DocBook(Buffer const * buf, ostream & os) const
{
int ret = 0;
@ -2312,55 +2363,46 @@ int LyXTabular::DocBook(Buffer const * buf, ostream & os) const
++ret;
}
//+---------------------------------------------------------------------
//+ Long Tabular case +
//+---------------------------------------------------------------------
if ( IsLongTabular() ) {
// Header
if( endhead || endfirsthead ) {
os << "<thead>\n";
if( endfirsthead ) {
docbookRow( buf, os, abs( endfirsthead) - 1);
}
if( endhead && abs( endhead) != abs( endfirsthead)) {
docbookRow( buf, os, abs( endhead) - 1);
}
os << "</thead>\n";
}
// Footer
if( endfoot || endlastfoot ) {
os << "<tfoot>\n";
if( endfoot ) {
docbookRow( buf, os, abs( endfoot) - 1);
}
if( endlastfoot && abs( endlastfoot) != endfoot) {
docbookRow( buf, os, abs( endlastfoot) - 1);
}
os << "</tfoot>\n";
}
}
//+---------------------------------------------------------------------
//+ the single row and columns (cells) +
//+---------------------------------------------------------------------
int cell = 0;
os << "<tbody>\n";
for (int i = 0; i < rows_; ++i) {
os << "<row>\n";
for (int j = 0; j < columns_; ++j) {
if (IsPartOfMultiColumn(i, j))
continue;
os << "<entry align=\"";
switch (GetAlignment(cell)) {
case LYX_ALIGN_LEFT:
os << "left";
break;
case LYX_ALIGN_RIGHT:
os << "right";
break;
default:
os << "center";
break;
}
os << "\" valign=\"";
switch (GetVAlignment(cell)) {
case LYX_VALIGN_TOP:
os << "top";
break;
case LYX_VALIGN_BOTTOM:
os << "bottom";
break;
case LYX_VALIGN_CENTER:
os << "middle";
}
os << "\"";
if (IsMultiColumn(cell)) {
os << " namest=\"col" << j << "\" ";
os << "nameend=\"col" << j + cells_in_multicolumn(cell) - 1<< "\"";
}
os << ">";
ret += GetCellInset(cell)->docbook(buf, os);
os << "</entry>";
++cell;
if(!IsLongTabular() || (
i != abs(endhead) - 1 && i != abs(endfirsthead) - 1 &&
i != abs(endfoot) - 1 && i != abs(endlastfoot) - 1)) {
docbookRow( buf, os, i);
}
os << "</row>\n";
}
os << "</tbody>\n";
//+---------------------------------------------------------------------

View File

@ -279,6 +279,8 @@ public:
int TeXCellPostamble(std::ostream &, int cell) const;
///
int Latex(Buffer const *, std::ostream &, bool, bool) const;
/// auxiliary function for docbook rows
int docbookRow(Buffer const * buf, std::ostream & os, int row) const;
///
int DocBook(Buffer const * buf, std::ostream & os) const;
///