]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetTabular.h
more border tweaks
[lyx.git] / src / insets / InsetTabular.h
index cc474027379ef9ac36fccf7873b2c375e760824b..f149f6b91c14e9d87cf0320f09f67c102c7e0b1d 100644 (file)
@@ -4,7 +4,6 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Jürgen Vigna
  * \author Lars Gullik Bjønnes
  * \author Matthias Ettrich
  * \author André Pönitz
 
 namespace lyx {
 
-class FuncStatus;
-class Lexer;
-class BufferView;
 class Buffer;
 class BufferParams;
-class Paragraph;
+class BufferView;
 class CompletionList;
 class CursorSlice;
+class InsetTableCell;
+class FuncStatus;
+class Lexer;
+class Paragraph;
 
 namespace frontend { class Painter; }
 
@@ -175,6 +175,8 @@ public:
                ///
                SET_INTERLINE_SPACE,
                ///
+               SET_BORDER_LINES,
+               ///
                LAST_ACTION
        };
        ///
@@ -397,13 +399,9 @@ public:
        ///
        bool isLastCell(idx_type cell) const;
        ///
-       idx_type getCellAbove(idx_type cell) const;
-       ///
-       idx_type getCellBelow(idx_type cell) const;
+       idx_type cellAbove(idx_type cell) const;
        ///
-       idx_type getLastCellAbove(idx_type cell) const;
-       ///
-       idx_type getLastCellBelow(idx_type cell) const;
+       idx_type cellBelow(idx_type cell) const;
        ///
        idx_type cellIndex(row_type row, col_type column) const;
        ///
@@ -441,16 +439,16 @@ public:
        ///
        // end longtable support
        ///
-       boost::shared_ptr<InsetText> getCellInset(idx_type cell) const;
+       boost::shared_ptr<InsetTableCell> cellInset(idx_type cell) const;
        ///
-       boost::shared_ptr<InsetText> getCellInset(row_type row,
+       boost::shared_ptr<InsetTableCell> cellInset(row_type row,
                                                  col_type column) const;
        ///
        void setCellInset(row_type row, col_type column,
-                         boost::shared_ptr<InsetText>) const;
+                         boost::shared_ptr<InsetTableCell>) const;
        /// Search for \param inset in the tabular, with the
        ///
-       idx_type getCellFromInset(Inset const * inset) const;
+       idx_type cellFromInset(Inset const * inset) const;
        ///
        row_type rowCount() const { return row_info.size(); }
        ///
@@ -463,7 +461,7 @@ public:
        class CellData {
        public:
                ///
-               CellData(Buffer const &);
+               CellData(Buffer const &, Tabular const &);
                ///
                CellData(CellData const &);
                ///
@@ -497,9 +495,9 @@ public:
                ///
                Length p_width; // this is only set for multicolumn!!!
                ///
-               boost::shared_ptr<InsetText> inset;
+               boost::shared_ptr<InsetTableCell> inset;
        };
-       CellData & cellinfo_of_cell(idx_type cell) const;
+       CellData & cellInfo(idx_type cell) const;
        ///
        typedef std::vector<CellData> cell_vector;
        ///
@@ -602,14 +600,8 @@ public:
                  col_type columns_arg);
        ///
        void updateIndexes();
-       /// Returns true if a complete update is necessary, otherwise false
-       bool setWidthOfMulticolCell(idx_type cell, int new_width);
-       ///
-       void recalculateMulticolumnsOfColumn(col_type column);
-       /// Returns true if change
-       void calculate_width_of_column(col_type column);
-       ///
-       bool calculate_width_of_column_NMC(col_type column); // no multi cells
+       /// return true of update is needed
+       bool updateColumnWidths();
        ///
        idx_type columnSpan(idx_type cell) const;
        ///
@@ -621,9 +613,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;
        ///
@@ -656,10 +648,44 @@ public:
 private:
        Buffer const * buffer_;
 
-       /// renumber cells after structural changes
-       void fixCellNums();
-};
+}; // Tabular
+
 
+///
+class InsetTableCell : public InsetText {
+public:
+       ///
+       explicit InsetTableCell(Buffer const & buf,
+               Tabular::CellData const * cd, Tabular const * t);
+       ///
+       virtual InsetCode lyxCode() const { return CELL_CODE; }
+       ///
+       Inset * clone() { return new InsetTableCell(*this); }
+       ///
+       virtual bool useEmptyLayout() const { return true; }
+       /// 
+       virtual bool forceEmptyLayout(idx_type = 0) const;
+       /// 
+       virtual bool allowParagraphCustomization(idx_type = 0) const;
+       ///
+       bool getStatus(Cursor & cur, FuncRequest const & cmd,
+               FuncStatus & status) const;
+       ///
+       virtual bool neverIndent() { return true; }
+       ///
+       void setCellData(Tabular::CellData const * cd) { cell_data_ = cd; }
+       ///
+       void setTabular(Tabular const * t) { table_ = t; }
+private:
+       /// 
+       Tabular::CellData const * cell_data_;
+       /// 
+       Tabular const * table_;
+       /// unimplemented
+       InsetTableCell();
+       /// unimplemented
+       void operator=(InsetTableCell const &);
+};
 
 
 class InsetTabular : public Inset {
@@ -720,9 +746,9 @@ public:
        /// number of cells
        size_t nargs() const { return tabular.cellCount(); }
        ///
-       boost::shared_ptr<InsetText const> cell(idx_type) const;
+       boost::shared_ptr<InsetTableCell const> cell(idx_type) const;
        ///
-       boost::shared_ptr<InsetText> cell(idx_type);
+       boost::shared_ptr<InsetTableCell> cell(idx_type);
        ///
        Text * getText(int) const;
 
@@ -738,7 +764,9 @@ public:
        /// should all paragraphs be output with "Standard" layout?
        virtual bool allowParagraphCustomization(idx_type cell = 0) const;
        ///
-       virtual bool forceEmptyLayout() { return true; }
+       virtual bool forceEmptyLayout(idx_type cell = 0) const;
+       ///
+       virtual bool useEmptyLayout() { return true; }
        ///
        void addPreview(graphics::PreviewLoader &) const;
 
@@ -802,7 +830,7 @@ private:
        ///
        void movePrevCell(Cursor & cur);
        ///
-       int getCellXPos(idx_type cell) const;
+       int cellXPos(idx_type cell) const;
        ///
        void resetPos(Cursor & cur) const;
        ///