]> git.lyx.org Git - lyx.git/blobdiff - src/tabular.h
Allows editing when the Prefs dialog is opened; fix bug 3140:
[lyx.git] / src / tabular.h
index b7e1dc8de33234590f5dd66da6f625fabc15f7bb..163f33a2b746aa364181e4bd20f9b6f967078b52 100644 (file)
 #include <iosfwd>
 #include <vector>
 
+
+namespace lyx {
+
 class InsetTabular;
+class LCursor;
 class OutputParams;
 
 /* The features the text class offers for tables */
@@ -42,6 +46,10 @@ public:
                ///
                DELETE_COLUMN,
                ///
+               COPY_ROW,
+               ///
+               COPY_COLUMN,
+               ///
                TOGGLE_LINE_TOP,
                ///
                TOGGLE_LINE_BOTTOM,
@@ -126,6 +134,16 @@ public:
                ///
                SET_SPECIAL_MULTI,
                ///
+               SET_BOOKTABS,
+               ///
+               UNSET_BOOKTABS,
+               ///
+               SET_TOP_SPACE,
+               ///
+               SET_BOTTOM_SPACE,
+               ///
+               SET_INTERLINE_SPACE,
+               ///
                LAST_ACTION
        };
        ///
@@ -157,7 +175,8 @@ public:
                BOX_MINIPAGE = 2
        };
 
-       struct ltType {
+       class ltType {
+       public:
                // constructor
                ltType();
                // we have this header type (is set in the getLT... functions)
@@ -183,16 +202,16 @@ public:
 
        /// constructor
        LyXTabular(BufferParams const &, col_type columns_arg,
-                  row_type rows_arg);
+                  row_type rows_arg);
 
        /// Returns true if there is a topline, returns false if not
-       bool topLine(idx_type cell, bool onlycolumn = false) const;
+       bool topLine(idx_type cell, bool wholerow = false) const;
        /// Returns true if there is a topline, returns false if not
-       bool bottomLine(idx_type cell, bool onlycolumn = false) const;
+       bool bottomLine(idx_type cell, bool wholerow = false) const;
        /// Returns true if there is a topline, returns false if not
-       bool leftLine(idx_type cell, bool onlycolumn = false) const;
+       bool leftLine(idx_type cell, bool wholecolumn = false) const;
        /// Returns true if there is a topline, returns false if not
-       bool rightLine(idx_type cell, bool onlycolumn = false) const;
+       bool rightLine(idx_type cell, bool wholecolumn = false) const;
 
        ///
        bool topAlreadyDrawn(idx_type cell) const;
@@ -201,7 +220,8 @@ public:
        ///
        bool isLastRow(idx_type cell) const;
 
-       ///
+       /// return space occupied by the second horizontal line and
+       /// interline space above row \p row in pixels
        int getAdditionalHeight(row_type row) const;
        ///
        int getAdditionalWidth(idx_type cell) const;
@@ -226,13 +246,13 @@ public:
        ///
        void setAllLines(idx_type cell, bool line);
        ///
-       void setTopLine(idx_type cell, bool line, bool onlycolumn = false);
+       void setTopLine(idx_type cell, bool line, bool wholerow = false);
        ///
-       void setBottomLine(idx_type cell, bool line, bool onlycolumn = false);
+       void setBottomLine(idx_type cell, bool line, bool wholerow = false);
        ///
-       void setLeftLine(idx_type cell, bool line, bool onlycolumn = false);
+       void setLeftLine(idx_type cell, bool line, bool wholecolumn = false);
        ///
-       void setRightLine(idx_type cell, bool line, bool onlycolumn = false);
+       void setRightLine(idx_type cell, bool line, bool wholecolumn = false);
        ///
        void setAlignment(idx_type cell, LyXAlignment align,
                          bool onlycolumn = false);
@@ -240,18 +260,18 @@ public:
        void setVAlignment(idx_type cell, VAlignment align,
                           bool onlycolumn = false);
        ///
-       void setColumnPWidth(idx_type cell, LyXLength const & width);
+       void setColumnPWidth(LCursor &, idx_type, LyXLength const &);
        ///
-       bool setMColumnPWidth(idx_type cell, LyXLength const & width);
+       bool setMColumnPWidth(LCursor &, idx_type, LyXLength const &);
        ///
-       void setAlignSpecial(idx_type cell, std::string const & special,
-                            Feature what);
+       void setAlignSpecial(idx_type cell, docstring const & special,
+                            Feature what);
        ///
        LyXAlignment getAlignment(idx_type cell,
-                                 bool onlycolumn = false) const;
+                                 bool onlycolumn = false) const;
        ///
        VAlignment getVAlignment(idx_type cell,
-                                bool onlycolumn = false) const;
+                                bool onlycolumn = false) const;
        ///
        LyXLength const getPWidth(idx_type cell) const;
        ///
@@ -259,7 +279,7 @@ public:
        ///
        LyXLength const getMColumnPWidth(idx_type cell) const;
        ///
-       std::string const getAlignSpecial(idx_type cell, int what) const;
+       docstring const getAlignSpecial(idx_type cell, int what) const;
        ///
        int getWidthOfCell(idx_type cell) const;
        ///
@@ -269,10 +289,14 @@ public:
        ///
        void deleteRow(row_type row);
        ///
+       void copyRow(BufferParams const &, row_type);
+       ///
        void appendColumn(BufferParams const &, idx_type cell);
        ///
        void deleteColumn(col_type column);
        ///
+       void copyColumn(BufferParams const &, col_type);
+       ///
        bool isFirstCellInRow(idx_type cell) const;
        ///
        idx_type getFirstCellInRow(row_type row) const;
@@ -289,16 +313,11 @@ public:
        ///
        void read(Buffer const &, LyXLex &);
        ///
-       int latex(Buffer const &, std::ostream &,
-                 OutputParams const &) const;
+       int latex(Buffer const &, odocstream &, OutputParams const &) const;
        //
-       int linuxdoc(Buffer const & buf, std::ostream & os,
-                    OutputParams const &) const;
-       ///
-       int docbook(Buffer const & buf, std::ostream & os,
-                   OutputParams const &) const;
+       int docbook(Buffer const & buf, odocstream & os, OutputParams const &) const;
        ///
-       int plaintext(Buffer const &, std::ostream &,
+       int plaintext(Buffer const &, odocstream &,
                  OutputParams const & runparams,
                  int const depth,
                  bool onlydata, unsigned char delim) const;
@@ -319,6 +338,10 @@ public:
        ///
        col_type right_column_of_cell(idx_type cell) const;
        ///
+       void setBookTabs(bool);
+       ///
+       bool useBookTabs() const;
+       ///
        void setLongTabular(bool);
        ///
        bool isLongTabular() const;
@@ -382,7 +405,10 @@ public:
        boost::shared_ptr<InsetText> getCellInset(idx_type cell) const;
        ///
        boost::shared_ptr<InsetText> getCellInset(row_type row,
-                                                 col_type column) const;
+                                                 col_type column) const;
+       ///
+       void setCellInset(row_type row, col_type column,
+                         boost::shared_ptr<InsetText>) const;
        /// Search for \param inset in the tabular, with the
        ///
        idx_type getCellFromInset(InsetBase const * inset) const;
@@ -392,12 +418,11 @@ public:
        col_type columns() const { return columns_;}
        ///
        void validate(LaTeXFeatures &) const;
-       /// Appends \c list with all labels found within this inset.
-       void getLabelList(Buffer const &, std::vector<std::string> & list) const;
        ///
 //private:
        ///
-       struct cellstruct {
+       class cellstruct {
+       public:
                ///
                cellstruct(BufferParams const &);
                ///
@@ -429,7 +454,7 @@ public:
                ///
                bool rotate;
                ///
-               std::string align_special;
+               docstring align_special;
                ///
                LyXLength p_width; // this is only set for multicolumn!!!
                ///
@@ -442,7 +467,8 @@ public:
        typedef std::vector<cell_vector> cell_vvector;
 
        ///
-       struct rowstruct {
+       class rowstruct {
+       public:
                ///
                rowstruct();
                ///
@@ -453,6 +479,18 @@ public:
                bool top_line;
                ///
                bool bottom_line;
+               /// Extra space between the top line and this row
+               LyXLength top_space;
+               /// Ignore top_space if true and use the default top space
+               bool top_space_default;
+               /// Extra space between this row and the bottom line
+               LyXLength bottom_space;
+               /// Ignore bottom_space if true and use the default bottom space
+               bool bottom_space_default;
+               /// Extra space between the bottom line and the next top line
+               LyXLength interline_space;
+               /// Ignore interline_space if true and use the default interline space
+               bool interline_space_default;
                /// This are for longtabulars only
                /// a row of endhead
                bool endhead;
@@ -469,7 +507,8 @@ public:
        typedef std::vector<rowstruct> row_vector;
 
        ///
-       struct columnstruct {
+       class columnstruct {
+               public:
                ///
                columnstruct();
                ///
@@ -485,7 +524,7 @@ public:
                ///
                LyXLength p_width;
                ///
-               std::string align_special;
+               docstring align_special;
        };
        ///
        typedef std::vector<columnstruct> column_vector;
@@ -509,6 +548,8 @@ public:
        ///
        int width_of_tabular;
        ///
+       bool use_booktabs;
+       ///
        bool rotate;
        //
        // for long tabulars
@@ -525,7 +566,7 @@ public:
 
        ///
        void init(BufferParams const &, row_type rows_arg,
-                 col_type columns_arg);
+                 col_type columns_arg);
        ///
        void set_row_column_number_info();
        /// Returns true if a complete update is necessary, otherwise false
@@ -545,42 +586,39 @@ public:
        ///
        BoxType useParbox(idx_type cell) const;
        ///
-       void setHeaderFooterRows(row_type header, row_type fheader,
-                                row_type footer, row_type lfooter);
-       ///
        // helper function for Latex returns number of newlines
        ///
-       int TeXTopHLine(std::ostream &, row_type row) const;
+       int TeXTopHLine(odocstream &, row_type row) const;
        ///
-       int TeXBottomHLine(std::ostream &, row_type row) const;
+       int TeXBottomHLine(odocstream &, row_type row) const;
        ///
-       int TeXCellPreamble(std::ostream &, idx_type cell) const;
+       int TeXCellPreamble(odocstream &, idx_type cell) const;
        ///
-       int TeXCellPostamble(std::ostream &, idx_type cell) const;
+       int TeXCellPostamble(odocstream &, idx_type cell) const;
        ///
-       int TeXLongtableHeaderFooter(std::ostream &, Buffer const & buf,
+       int TeXLongtableHeaderFooter(odocstream &, Buffer const & buf,
                                     OutputParams const &) const;
        ///
        bool isValidRow(row_type const row) const;
        ///
-       int TeXRow(std::ostream &, row_type const row, Buffer const & buf,
+       int TeXRow(odocstream &, row_type const row, Buffer const & buf,
                   OutputParams const &) const;
        ///
-       // helper function for ASCII returns number of newlines
+       // helper functions for plain text return number of newlines
        ///
-       int asciiTopHLine(std::ostream &, row_type row,
-                         std::vector<unsigned int> const &) const;
+       int plaintextTopHLine(odocstream &, row_type row,
+                       std::vector<unsigned int> const &) const;
        ///
-       int asciiBottomHLine(std::ostream &, row_type row,
-                            std::vector<unsigned int> const &) const;
+       int plaintextBottomHLine(odocstream &, row_type row,
+                       std::vector<unsigned int> const &) const;
        ///
-       int asciiPrintCell(Buffer const &, std::ostream &,
-                          OutputParams const &,
-                          idx_type cell, row_type row, col_type column,
-                          std::vector<unsigned int> const &,
+       int plaintextPrintCell(Buffer const &, odocstream &,
+                       OutputParams const &,
+                       idx_type cell, row_type row, col_type column,
+                       std::vector<unsigned int> const &,
                                           bool onlydata) const;
        /// auxiliary function for docbook
-       int docbookRow(Buffer const & buf, std::ostream & os, row_type,
+       int docbookRow(Buffer const & buf, odocstream & os, row_type,
                       OutputParams const &) const;
 
 private:
@@ -588,4 +626,7 @@ private:
        void fixCellNums();
 };
 
+
+} // namespace lyx
+
 #endif