From 8cd5b4a29105695e9d1a4e3f5475ce7c12be365e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Matox?= Date: Wed, 24 Oct 2001 07:43:34 +0000 Subject: [PATCH] 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 --- lib/ChangeLog | 5 ++ lib/layouts/db_stdtitle.inc | 2 + src/ChangeLog | 6 ++ src/insets/ChangeLog | 6 ++ src/insets/insettabular.C | 24 ++++++- src/tabular.C | 126 ++++++++++++++++++++++++------------ src/tabular.h | 2 + 7 files changed, 126 insertions(+), 45 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index d976e4185d..d9f17d5318 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2001-10-24 José Matos + + * 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 * reLyX/MakePreamble.pm (translate_preamble): Cleaned the code for babel. diff --git a/lib/layouts/db_stdtitle.inc b/lib/layouts/db_stdtitle.inc index e42b42fbb2..bc2133491d 100644 --- a/lib/layouts/db_stdtitle.inc +++ b/lib/layouts/db_stdtitle.inc @@ -57,6 +57,8 @@ End Style Date LatexType Paragraph LatexName date + Align Left + AlignPossible Left,Center End # Revision History style definition diff --git a/src/ChangeLog b/src/ChangeLog index 51aec6e64e..e92ab5b0d6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2001-10-24 José Matos + + * 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 * LaTeXFeatures.h: diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 31d7bef1f7..ca43d81826 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,9 @@ +2001-10-24 José Matos + + * insettabular.C (linuxdoc): Now exports the ascii's table version. + (docbook): If the table is not inside a float then wrap it inside + .... + 2001-10-23 José Matos * insetref.C (docbook): removed / terminator to conform SGML. diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 2510d179c0..01ec393b5b 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -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 << "\n"; + ret++; + } + ret+= tabular->DocBook(buf,os); + if (!master) { + os << "\n"; + ret++; + } + return ret; } diff --git a/src/tabular.C b/src/tabular.C index 1052d80565..6448ae4dce 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -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 << "\n"; + for (int j = 0; j < columns_; ++j) { + if (IsPartOfMultiColumn(row, j)) + continue; + + os << ""; + ret += GetCellInset(cell)->docbook(buf, os); + os << "\n"; + ++cell; + } + os << "\n"; + return ret; +} + + int LyXTabular::DocBook(Buffer const * buf, ostream & os) const { int ret = 0; @@ -2313,54 +2364,45 @@ int LyXTabular::DocBook(Buffer const * buf, ostream & os) const } //+--------------------------------------------------------------------- - //+ the single row and columns (cells) + + //+ Long Tabular case + //+--------------------------------------------------------------------- - int cell = 0; - os << "\n"; - for (int i = 0; i < rows_; ++i) { - os << "\n"; - for (int j = 0; j < columns_; ++j) { - if (IsPartOfMultiColumn(i, j)) - continue; - - os << "\n"; + if( endfirsthead ) { + docbookRow( buf, os, abs( endfirsthead) - 1); } - - 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"; + if( endhead && abs( endhead) != abs( endfirsthead)) { + docbookRow( buf, os, abs( endhead) - 1); } - os << "\""; - - if (IsMultiColumn(cell)) { - os << " namest=\"col" << j << "\" "; - os << "nameend=\"col" << j + cells_in_multicolumn(cell) - 1<< "\""; + os << "\n"; + } + + // Footer + if( endfoot || endlastfoot ) { + os << "\n"; + if( endfoot ) { + docbookRow( buf, os, abs( endfoot) - 1); } - - os << ">"; - ret += GetCellInset(cell)->docbook(buf, os); - os << ""; - ++cell; + if( endlastfoot && abs( endlastfoot) != endfoot) { + docbookRow( buf, os, abs( endlastfoot) - 1); + } + os << "\n"; + } + } + //+--------------------------------------------------------------------- + //+ the single row and columns (cells) + + //+--------------------------------------------------------------------- + + os << "\n"; + for (int i = 0; i < rows_; ++i) { + if(!IsLongTabular() || ( + i != abs(endhead) - 1 && i != abs(endfirsthead) - 1 && + i != abs(endfoot) - 1 && i != abs(endlastfoot) - 1)) { + docbookRow( buf, os, i); } - os << "\n"; } os << "\n"; //+--------------------------------------------------------------------- diff --git a/src/tabular.h b/src/tabular.h index 810037f985..fc458deaaf 100644 --- a/src/tabular.h +++ b/src/tabular.h @@ -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; /// -- 2.39.5