]> git.lyx.org Git - lyx.git/blobdiff - src/tabular.h
More fixes to the autocollapsing of paragraphs.
[lyx.git] / src / tabular.h
index a04e70714ab1ecbcacfcec891b7040ba91d2affc..0da578f2ec46c503af99acc9252f6b8e388eba45 100644 (file)
@@ -4,7 +4,7 @@
  * 
  *           LyX, The Document Processor
  *      
- *           Copyright 2000 The LyX Team.
+ *           Copyright 2000-2001 The LyX Team.
  *
  *           @author: Jürgen Vigna
  *
 #include <vector>
 
 #include "lyxlex.h"
+#include "layout.h"
 #include "LString.h"
 #include "insets/insettext.h"
+#include "lyxlength.h"
 
 class InsetTabular;
 class LaTeXFeatures;
@@ -108,12 +110,16 @@ public:
                SET_USEBOX,
                ///
                SET_LTHEAD,
+               UNSET_LTHEAD,
                ///
                SET_LTFIRSTHEAD,
+               UNSET_LTFIRSTHEAD,
                ///
                SET_LTFOOT,
+               UNSET_LTFOOT,
                ///
                SET_LTLASTFOOT,
+               UNSET_LTLASTFOOT,
                ///
                SET_LTNEWPAGE,
                ///
@@ -152,18 +158,31 @@ public:
                BOX_MINIPAGE = 2
        };
 
+       struct lttype {
+               // constructor
+               lttype();
+               // row of the header/footer type end definition
+               int row;
+               // double borders on top
+               bool topDL;
+               // double borders on bottom
+               bool bottomDL;
+       };
+       ///
+       typedef struct lttype ltType;
+       
        /* konstruktor */
        ///
        LyXTabular(InsetTabular *, int columns_arg, int rows_arg);
        ///
-       LyXTabular(InsetTabular *, LyXTabular const &);
+       LyXTabular(InsetTabular *, LyXTabular const &, bool same_id = false);
        ///
        explicit
        LyXTabular(Buffer const *, InsetTabular *, LyXLex & lex);
        ///
        LyXTabular & operator=(LyXTabular const &);
        ///
-       LyXTabular * Clone(InsetTabular *);
+       LyXTabular * clone(InsetTabular *, bool same_id = false);
        
        /// Returns true if there is a topline, returns false if not
        bool TopLine(int cell, bool onlycolumn = false) const;
@@ -180,9 +199,9 @@ public:
        bool LeftAlreadyDrawed(int cell) const;
        ///
        bool IsLastRow(int cell) const;
-       
+
        ///
-       int GetAdditionalHeight(int cell) const;
+       int GetAdditionalHeight(int row) const;
        ///
        int GetAdditionalWidth(int cell) const;
        
@@ -220,9 +239,9 @@ public:
        bool SetVAlignment(int cell, VAlignment align,
                           bool onlycolumn = false);
        ///
-       bool SetColumnPWidth(int cell, string const & width);
+       bool SetColumnPWidth(int cell, LyXLength const & width);
        ///
-       bool SetMColumnPWidth(int cell, string const & width);
+       bool SetMColumnPWidth(int cell, LyXLength const & width);
        ///
        bool SetAlignSpecial(int cell, string const & special, Feature what);
        ///
@@ -230,11 +249,11 @@ public:
        ///
        VAlignment GetVAlignment(int cell, bool onlycolumn = false) const;
        ///
-       string const GetPWidth(int cell) const;
+       LyXLength const GetPWidth(int cell) const;
        ///
-       string const GetColumnPWidth(int cell) const;
+       LyXLength const GetColumnPWidth(int cell) const;
        ///
-       string const GetMColumnPWidth(int cell) const;
+       LyXLength const GetMColumnPWidth(int cell) const;
        ///
        string const GetAlignSpecial(int cell, int what) const;
        ///
@@ -279,6 +298,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;
        ///
@@ -342,17 +363,19 @@ public:
        //
        // Long Tabular Options
        ///
-       void SetLTHead(int cell, bool first);
+       bool checkLTType(int row, ltType const &) const;
        ///
-       bool GetRowOfLTHead(int cell, int & row) const;
+       void SetLTHead(ltType const &, bool first);
        ///
-       bool GetRowOfLTFirstHead(int cell, int & row) const;
+       bool GetRowOfLTHead(int row, ltType &) const;
        ///
-       void SetLTFoot(int cell, bool last);
+       bool GetRowOfLTFirstHead(int row, ltType &) const;
        ///
-       bool GetRowOfLTFoot(int cell, int & row) const;
+       void SetLTFoot(ltType const &, bool last);
        ///
-       bool GetRowOfLTLastFoot(int cell, int & row) const;
+       bool GetRowOfLTFoot(int row, ltType &) const;
+       ///
+       bool GetRowOfLTLastFoot(int row, ltType &) const;
        ///
        void SetLTNewPage(int cell, bool what);
        ///
@@ -371,6 +394,11 @@ public:
        void Validate(LaTeXFeatures &) const;
        ///
        std::vector<string> const getLabelList() const;
+       ///
+       /// recalculate the widths/heights only!
+       void reinit();
+       ///
+       mutable int cur_cell;
 private:
        ///
        struct cellstruct {
@@ -401,7 +429,7 @@ private:
                ///
                string align_special;
                ///
-               string p_width; // this is only set for multicolumn!!!
+               LyXLength p_width; // this is only set for multicolumn!!!
                ///
                InsetText inset;
        };
@@ -443,7 +471,7 @@ private:
                ///
                int  width_of_column;
                ///
-               string p_width;
+               LyXLength p_width;
                ///
                string align_special;
        };
@@ -481,20 +509,20 @@ private:
        ///
        bool is_long_tabular;
        /// row of endhead
-       int endhead;
+       ltType endhead;
        /// row of endfirsthead
-       int endfirsthead;
+       ltType endfirsthead;
        /// row of endfoot
-       int endfoot;
+       ltType endfoot;
        /// row of endlastfoot
-       int endlastfoot;
+       ltType endlastfoot;
        ///
        InsetTabular * owner_;
-   
+
        ///
-       void Init(int columns_arg, int rows_arg);
+       void Init(int columns_arg, int rows_arg, LyXTabular const * lt = 0);
        ///
-       void Reinit();
+       void Reinit(bool reset_widths = true);
        ///
        void set_row_column_number_info(bool oldformat = false);
        /// Returns true if a complete update is necessary, otherwise false