]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetTabular.h
* src/insets/InsetSpace.cpp:
[lyx.git] / src / insets / InsetTabular.h
index ae4c7e268dc82cddabd94ddbe0d1c28d83deed33..27b059dd0ecad5a816f07a876a3420b877b0c994 100644 (file)
 
 // Lgb
 
-#ifndef INSETTABULAR_H
-#define INSETTABULAR_H
+#ifndef INSET_TABULAR_H
+#define INSET_TABULAR_H
 
 #include "Inset.h"
 #include "InsetText.h"
 #include "Layout.h"
 #include "Length.h"
-#include "MailInset.h"
 
 #include <boost/shared_ptr.hpp>
 
@@ -161,6 +160,8 @@ public:
                ///
                SET_LTNEWPAGE,
                ///
+               TOGGLE_LTCAPTION,
+               ///
                SET_SPECIAL_COLUMN,
                ///
                SET_SPECIAL_MULTI,
@@ -233,8 +234,6 @@ public:
        /// index indicating an invalid position
        static const idx_type npos = static_cast<idx_type>(-1);
 
-       /// constructor
-       Tabular();
        /// constructor
        Tabular(Buffer const &, col_type columns_arg, row_type rows_arg);
 
@@ -317,12 +316,6 @@ public:
        ///
        Length const getPWidth(idx_type cell) const;
        ///
-       Length const getColumnPWidth(idx_type cell) const;
-       ///
-       Length const getMColumnPWidth(idx_type cell) const;
-       ///
-       docstring const getAlignSpecial(idx_type cell, int what) const;
-       ///
        int cellWidth(idx_type cell) const;
        ///
        int getBeginningOfTextInCell(idx_type cell) const;
@@ -347,8 +340,6 @@ public:
        ///
        idx_type getLastCellInRow(row_type row) const;
        ///
-       idx_type cellCount() const;
-       ///
        idx_type numberOfCellsInRow(idx_type cell) const;
        ///
        void write(std::ostream &) const;
@@ -379,18 +370,6 @@ public:
        ///
        col_type cellRightColumn(idx_type cell) const;
        ///
-       void setBookTabs(bool);
-       ///
-       bool useBookTabs() const;
-       ///
-       void setLongTabular(bool);
-       ///
-       bool isLongTabular() const;
-       ///
-       void setRotateTabular(bool);
-       ///
-       bool getRotateTabular() const;
-       ///
        void setRotateCell(idx_type cell, bool);
        ///
        bool getRotateCell(idx_type cell) const;
@@ -429,6 +408,10 @@ public:
        ///
        bool getLTNewPage(row_type row) const;
        ///
+       idx_type setLTCaption(row_type row, bool what);
+       ///
+       bool ltCaption(row_type row) const;
+       ///
        bool haveLTHead() const;
        ///
        bool haveLTFirstHead() const;
@@ -450,10 +433,6 @@ public:
        ///
        idx_type cellFromInset(Inset const * inset) const;
        ///
-       row_type rowCount() const { return row_info.size(); }
-       ///
-       col_type columnCount() const { return column_info.size();}
-       ///
        void validate(LaTeXFeatures &) const;
        ///
 //private:
@@ -512,10 +491,6 @@ public:
                int ascent;
                ///
                int descent;
-               ///
-               bool top_line;
-               ///
-               bool bottom_line;
                /// Extra space between the top line and this row
                Length top_space;
                /// Ignore top_space if true and use the default top space
@@ -539,6 +514,8 @@ public:
                bool endlastfoot;
                /// row for a newpage
                bool newpage;
+               /// caption
+               bool caption;
        };
        ///
        typedef std::vector<RowData> row_vector;
@@ -553,10 +530,6 @@ public:
                ///
                VAlignment valignment;
                ///
-               bool left_line;
-               ///
-               bool right_line;
-               ///
                int width;
                ///
                Length p_width;
@@ -613,9 +586,9 @@ public:
        ///
        int TeXBottomHLine(odocstream &, row_type row) const;
        ///
-       int TeXCellPreamble(odocstream &, idx_type cell) const;
+       int TeXCellPreamble(odocstream &, idx_type cell, bool & ismulticol) const;
        ///
-       int TeXCellPostamble(odocstream &, idx_type cell) const;
+       int TeXCellPostamble(odocstream &, idx_type cell, bool ismulticol) const;
        ///
        int TeXLongtableHeaderFooter(odocstream &, OutputParams const &) const;
        ///
@@ -652,13 +625,14 @@ private:
 
 
 ///
-class InsetTableCell : public InsetText {
+class InsetTableCell : public InsetText
+{
 public:
        ///
-       explicit InsetTableCell(Buffer const & buf,
+       InsetTableCell(Buffer const & buf,
                Tabular::CellData const * cd, Tabular const * t);
        ///
-       virtual InsetCode lyxCode() const { return CELL_CODE; }
+       InsetCode lyxCode() const { return CELL_CODE; }
        ///
        Inset * clone() { return new InsetTableCell(*this); }
        ///
@@ -677,18 +651,20 @@ public:
        ///
        void setTabular(Tabular const * t) { table_ = t; }
 private:
-       /// 
-       Tabular::CellData const * cell_data_;
-       /// 
-       Tabular const * table_;
        /// unimplemented
        InsetTableCell();
        /// unimplemented
        void operator=(InsetTableCell const &);
+
+       /// 
+       Tabular::CellData const * cell_data_;
+       /// 
+       Tabular const * table_;
 };
 
 
-class InsetTabular : public Inset {
+class InsetTabular : public Inset
+{
 public:
        ///
        InsetTabular(Buffer const &, row_type rows = 1,
@@ -696,6 +672,10 @@ public:
        ///
        ~InsetTabular();
        ///
+       static void string2params(std::string const &, InsetTabular &);
+       ///
+       static std::string params2string(InsetTabular const &);
+       ///
        void read(Lexer &);
        ///
        void write(std::ostream &) const;
@@ -720,7 +700,7 @@ public:
            insets that may contain several paragraphs */
        bool noFontChange() const { return true; }
        ///
-       DisplayType display() const { return tabular.isLongTabular() ? AlignCenter : Inline; }
+       DisplayType display() const { return tabular.is_long_tabular ? AlignCenter : Inline; }
        ///
        int latex(odocstream &, OutputParams const &) const;
        ///
@@ -731,6 +711,8 @@ public:
        void validate(LaTeXFeatures & features) const;
        ///
        InsetCode lyxCode() const { return TABULAR_CODE; }
+       ///
+       docstring contextMenu(BufferView const & bv, int x, int y) const;
        /// get offset of this cursor slice relative to our upper left corner
        void cursorPos(BufferView const & bv, CursorSlice const & sl,
                bool boundary, int & x, int & y) const;
@@ -744,7 +726,7 @@ public:
        ///
        bool showInsetDialog(BufferView *) const;
        /// number of cells
-       size_t nargs() const { return tabular.cellCount(); }
+       size_t nargs() const { return tabular.numberofcells; }
        ///
        boost::shared_ptr<InsetTableCell const> cell(idx_type) const;
        ///
@@ -802,6 +784,13 @@ public:
        ///
        void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const;
 
+       ///
+       virtual InsetTabular * asInsetTabular() { return this; }
+       ///
+       virtual InsetTabular const * asInsetTabular() const { return this; }
+       ///
+       bool isRightToLeft(Cursor & cur) const;
+
        //
        // Public structures and variables
        ///
@@ -826,9 +815,11 @@ private:
        void setCursorFromCoordinates(Cursor & cur, int x, int y) const;
 
        ///
-       void moveNextCell(Cursor & cur);
+       void moveNextCell(Cursor & cur, 
+                               EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
        ///
-       void movePrevCell(Cursor & cur);
+       void movePrevCell(Cursor & cur,
+                               EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
        ///
        int cellXPos(idx_type cell) const;
        ///
@@ -842,8 +833,6 @@ private:
        ///
        void cutSelection(Cursor & cur);
        ///
-       bool isRightToLeft(Cursor & cur) const;
-       ///
        void getSelection(Cursor & cur, row_type & rs, row_type & re,
                          col_type & cs, col_type & ce) const;
        ///
@@ -864,32 +853,14 @@ private:
        mutable idx_type first_visible_cell;
        ///
        mutable int scx_;
-};
-
-
-class InsetTabularMailer : public MailInset {
-public:
-       ///
-       InsetTabularMailer(InsetTabular const & inset);
-       ///
-       virtual Inset & inset() const { return inset_; }
-       ///
-       virtual std::string const & name() const { return name_; }
-       ///
-       virtual std::string const inset2string(Buffer const &) const;
-       ///
-       static void string2params(std::string const &, InsetTabular &);
-       ///
-       static std::string const params2string(InsetTabular const &);
-private:
-       ///
-       static std::string const name_;
-       ///
-       InsetTabular & inset_;
+       /// true when selecting rows with the mouse
+       bool rowselect_;
+       /// true when selecting columns with the mouse
+       bool colselect_;
 };
 
 std::string const featureAsString(Tabular::Feature feature);
 
 } // namespace lyx
 
-#endif
+#endif // INSET_TABULAR_H