]> git.lyx.org Git - lyx.git/blobdiff - src/tabular.h
Fix fuer #209
[lyx.git] / src / tabular.h
index f13a86ac4effedb3dff403d1c8a34920827db821..d23f2d8883a123b16115ecff96824fb28df2a578 100644 (file)
 #pragma interface
 #endif
 
-#include <iosfwd>
-#include <vector>
-
 #include "lyxlex.h"
 #include "layout.h"
 #include "LString.h"
-#include "insets/insettext.h"
 #include "lyxlength.h"
 
+#include "insets/insettext.h"
+
+#include <iosfwd>
+#include <vector>
+
 class InsetTabular;
 class LaTeXFeatures;
 class Buffer;
@@ -161,14 +162,15 @@ public:
        struct lttype {
                // constructor
                lttype();
-               // row of the header/footer type end definition
-               int row;
+               // we have this header type (is set in the GetLT... functions)
+               bool set;
                // double borders on top
                bool topDL;
                // double borders on bottom
                bool bottomDL;
                // used for FirstHeader & LastFooter and if this is true
-               // row HAS to be 0!
+               // all the rows marked as FirstHeader or LastFooter are
+               // ignored in the output and it is set to be empty!
                bool empty;
        };
        ///
@@ -289,36 +291,13 @@ public:
        void Read(Buffer const *, LyXLex &);
        ///
        void OldFormatRead(LyXLex &, string const &);
-       //
-       // helper function for Latex returns number of newlines
-       ///
-       int TeXTopHLine(std::ostream &, int row) const;
        ///
-       int TeXBottomHLine(std::ostream &, int row) const;
+       int latex(Buffer const *, std::ostream &, bool, bool) const;
        ///
-       int TeXCellPreamble(std::ostream &, int cell) const;
+       int docBook(Buffer const * buf, std::ostream & os) const;
        ///
-       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;
-       ///
-       // helper function for Latex returns number of newlines
-       ///
-       int AsciiTopHLine(std::ostream &, int row,
-                         std::vector<unsigned int> const &) const;
-       ///
-       int AsciiBottomHLine(std::ostream &, int row,
-                            std::vector<unsigned int> const &) const;
-       ///
-       int AsciiPrintCell(Buffer const *, std::ostream &,
-                          int cell, int row, int column,
-                          std::vector<unsigned int> const &) const;
-       ///
-       int Ascii(Buffer const *, std::ostream &) const;
+       int ascii(Buffer const *, std::ostream &, int const depth,
+                 bool onlydata, unsigned char delim) const;
        ///
        bool IsMultiColumn(int cell, bool real = false) const;
        ///
@@ -364,17 +343,17 @@ public:
        ///
        BoxType GetUsebox(int cell) const;
        //
-       // Long Tabular Options
+       // Long Tabular Options support functions
        ///
        bool checkLTType(int row, ltType const &) const;
        ///
-       void SetLTHead(ltType const &, bool first);
+       void SetLTHead(int row, bool flag, ltType const &, bool first);
        ///
        bool GetRowOfLTHead(int row, ltType &) const;
        ///
        bool GetRowOfLTFirstHead(int row, ltType &) const;
        ///
-       void SetLTFoot(ltType const &, bool last);
+       void SetLTFoot(int row, bool flag, ltType const &, bool last);
        ///
        bool GetRowOfLTFoot(int row, ltType &) const;
        ///
@@ -384,9 +363,22 @@ public:
        ///
        bool GetLTNewPage(int row) const;
        ///
+       bool haveLTHead() const;
+       ///
+       bool haveLTFirstHead() const;
+       ///
+       bool haveLTFoot() const;
+       ///
+       bool haveLTLastFoot() const;
+       ///
+       // end longtable support
+       ///
        InsetText * GetCellInset(int cell) const;
        ///
        InsetText * GetCellInset(int row, int column) const;
+       /// Search for \param inset in the tabular, with the
+       /// additional hint that it could be at \param maybe_cell
+       int GetCellFromInset(Inset const * inset, int maybe_cell = -1) const;
        ///
        int rows() const { return rows_; }
        ///
@@ -446,14 +438,23 @@ private:
                ///
                rowstruct();
                ///
-               bool top_line;
-               ///
-               bool bottom_line;
-               ///
                int ascent_of_row;
                ///
                int descent_of_row;
+               ///
+               bool top_line;
+               ///
+               bool bottom_line;
                /// This are for longtabulars only
+               /// a row of endhead
+               bool endhead;
+               /// a row of endfirsthead
+               bool endfirsthead;
+               /// a row of endfoot
+               bool endfoot;
+               /// row of endlastfoot
+               bool endlastfoot;
+               /// row for a pagebreak
                bool newpage;
        };
        ///
@@ -483,7 +484,7 @@ private:
 
        ///
        void ReadNew(Buffer const * buf, std::istream & is,
-                                LyXLex & lex, string const & l);
+                                LyXLex & lex, string const & l, int const version);
        ///
        void ReadOld(Buffer const * buf, std::istream & is,
                                 LyXLex & lex, string const & l);
@@ -509,16 +510,17 @@ private:
        bool rotate;
        //
        // for long tabulars
-       ///
+       //
        bool is_long_tabular;
-       /// row of endhead
+       /// endhead data
        ltType endhead;
-       /// row of endfirsthead
+       /// endfirsthead data
        ltType endfirsthead;
-       /// row of endfoot
+       /// endfoot data
        ltType endfoot;
-       /// row of endlastfoot
+       /// endlastfoot data
        ltType endlastfoot;
+       //
        ///
        InsetTabular * owner_;
 
@@ -546,6 +548,41 @@ private:
        int cells_in_multicolumn(int cell) const;
        ///
        BoxType UseParbox(int cell) const;
+       ///
+       void setHeaderFooterRows(int header, int fheader, int footer, int lfooter);
+       ///
+       // helper function for Latex returns number of newlines
+       ///
+       int TeXTopHLine(std::ostream &, int row) const;
+       ///
+       int TeXBottomHLine(std::ostream &, int row) const;
+       ///
+       int TeXCellPreamble(std::ostream &, int cell) const;
+       ///
+       int TeXCellPostamble(std::ostream &, int cell) const;
+       ///
+       int TeXLongtableHeaderFooter(std::ostream &, Buffer const * buf,
+                                    bool fragile, bool fp) const;
+       ///
+       bool isValidRow(int const row) const;
+       ///
+       int TeXRow(std::ostream &, int const row, Buffer const * buf,
+                  bool fragile, bool fp) const;
+       ///
+       // helper function for ASCII returns number of newlines
+       ///
+       int asciiTopHLine(std::ostream &, int row,
+                         std::vector<unsigned int> const &) const;
+       ///
+       int asciiBottomHLine(std::ostream &, int row,
+                            std::vector<unsigned int> const &) const;
+       ///
+       int asciiPrintCell(Buffer const *, std::ostream &,
+                          int cell, int row, int column,
+                          std::vector<unsigned int> const &,
+                                          bool onlydata) const;
+       /// auxiliary function for docbook
+       int docbookRow(Buffer const * buf, std::ostream & os, int row) const;
 };
 
 #endif