]> git.lyx.org Git - lyx.git/blobdiff - src/tabular.h
Make it compile when USE_BOOST_FORMAT is unset
[lyx.git] / src / tabular.h
index 8393379e5d163dae3c669859f52884654ba9f8ed..2b34120c857007d93c114b2f5d60df25e2fc8873 100644 (file)
@@ -1,9 +1,9 @@
 // -*- C++ -*-
 /* This file is part of
- * ====================================================== 
- * 
+ * ======================================================
+ *
  *           LyX, The Document Processor
- *      
+ *
  *           Copyright 2000-2001 The LyX Team.
  *
  *           @author: Jürgen Vigna
 #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 BufferParams;
 class LaTeXFeatures;
 class Buffer;
+class LyXLex;
 
-/* The features the text class offers for tables */ 
+/* The features the text class offers for tables */
 
 ///
 class LyXTabular  {
@@ -59,6 +61,8 @@ public:
                ///
                ALIGN_CENTER,
                ///
+               ALIGN_BLOCK,
+               ///
                VALIGN_TOP,
                ///
                VALIGN_BOTTOM,
@@ -161,30 +165,36 @@ public:
        struct lttype {
                // constructor
                lttype();
+               // 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;
        };
        ///
        typedef struct lttype ltType;
-       
+
        /* konstruktor */
        ///
-       LyXTabular(InsetTabular *, int columns_arg, int rows_arg);
+       LyXTabular(BufferParams const &,
+                  InsetTabular *, int columns_arg, int rows_arg);
        ///
-       LyXTabular(InsetTabular *, LyXTabular const &, bool same_id = false);
+       LyXTabular(BufferParams const &,
+                  InsetTabular *, LyXTabular const &, bool same_id = false);
        ///
        explicit
        LyXTabular(Buffer const *, InsetTabular *, LyXLex & lex);
        ///
        LyXTabular & operator=(LyXTabular const &);
        ///
-       LyXTabular * clone(InsetTabular *, bool same_id = false);
-       
+       LyXTabular * clone(BufferParams const &,
+                          InsetTabular *, bool same_id = false);
+
        /// Returns true if there is a topline, returns false if not
        bool TopLine(int cell, bool onlycolumn = false) const;
        /// Returns true if there is a topline, returns false if not
@@ -193,7 +203,7 @@ public:
        bool LeftLine(int cell, bool onlycolumn = false) const;
        /// Returns true if there is a topline, returns false if not
        bool RightLine(int cell, bool onlycolumn = false) const;
-       
+
        ///
        bool TopAlreadyDrawed(int cell) const;
        ///
@@ -205,7 +215,7 @@ public:
        int GetAdditionalHeight(int row) const;
        ///
        int GetAdditionalWidth(int cell) const;
-       
+
        /* returns the maximum over all rows */
        ///
        int GetWidthOfColumn(int cell) const;
@@ -262,11 +272,11 @@ public:
        ///
        int GetBeginningOfTextInCell(int cell) const;
        ///
-       void AppendRow(int cell);
+       void AppendRow(BufferParams const &, int cell);
        ///
        void DeleteRow(int row);
        ///
-       void AppendColumn(int cell);
+       void AppendColumn(BufferParams const &, int cell);
        ///
        void DeleteColumn(int column);
        ///
@@ -286,41 +296,18 @@ 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 TeXCellPreamble(std::ostream &, int cell) 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;
+       void OldFormatRead(BufferParams const &, LyXLex &, string const &);
        ///
-       int AsciiBottomHLine(std::ostream &, int row,
-                            std::vector<unsigned int> const &) const;
+       int latex(Buffer const *, std::ostream &, bool, bool) const;
        ///
-       int AsciiPrintCell(Buffer const *, std::ostream &,
-                          int cell, int row, int column,
-                          std::vector<unsigned int> const &) const;
+       int docbook(Buffer const * buf, std::ostream & os, bool mixcont) 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;
        ///
-       void SetMultiColumn(int cell, int number);
+       void SetMultiColumn(Buffer const *, int cell, int number);
        ///
        int UnsetMultiColumn(int cell); // returns number of new cells
        ///
@@ -362,7 +349,7 @@ public:
        ///
        BoxType GetUsebox(int cell) const;
        //
-       // Long Tabular Options
+       // Long Tabular Options support functions
        ///
        bool checkLTType(int row, ltType const &) const;
        ///
@@ -382,9 +369,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_; }
        ///
@@ -404,7 +404,7 @@ private:
        ///
        struct cellstruct {
                ///
-               cellstruct();
+               cellstruct(BufferParams const &);
                ///
                int cellno;
                ///
@@ -531,7 +531,8 @@ private:
        InsetTabular * owner_;
 
        ///
-       void Init(int columns_arg, int rows_arg, LyXTabular const * lt = 0);
+       void Init(BufferParams const &,
+                 int columns_arg, int rows_arg, LyXTabular const * lt = 0);
        ///
        void Reinit(bool reset_widths = true);
        ///
@@ -539,7 +540,7 @@ private:
        /// Returns true if a complete update is necessary, otherwise false
        bool SetWidthOfMulticolCell(int cell, int new_width);
        ///
-       void recalculateMulticolCells(int cell, int new_width);
+       void recalculateMulticolumnsOfColumn(int column);
        /// Returns true if change
        bool calculate_width_of_column(int column);
        ///
@@ -554,6 +555,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