2000-04-21 15:16:22 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file tabular.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author Matthias Ettrich
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
* \author J<EFBFBD>rgen Vigna
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
2000-04-21 15:16:22 +00:00
|
|
|
|
#ifndef TABULAR_H
|
|
|
|
|
#define TABULAR_H
|
|
|
|
|
|
2001-12-11 17:26:52 +00:00
|
|
|
|
#include "lyxlength.h"
|
2001-12-28 13:26:54 +00:00
|
|
|
|
#include "insets/insettext.h"
|
|
|
|
|
|
2004-11-23 23:04:52 +00:00
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
|
2001-12-28 13:26:54 +00:00
|
|
|
|
#include <iosfwd>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2000-05-15 14:49:36 +00:00
|
|
|
|
class InsetTabular;
|
2005-11-28 11:52:03 +00:00
|
|
|
|
class LCursor;
|
2003-11-05 12:06:20 +00:00
|
|
|
|
class OutputParams;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
|
/* The features the text class offers for tables */
|
2000-04-21 15:16:22 +00:00
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
class LyXTabular {
|
|
|
|
|
public:
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
enum Feature {
|
|
|
|
|
///
|
|
|
|
|
APPEND_ROW = 0,
|
|
|
|
|
///
|
|
|
|
|
APPEND_COLUMN,
|
|
|
|
|
///
|
|
|
|
|
DELETE_ROW,
|
|
|
|
|
///
|
|
|
|
|
DELETE_COLUMN,
|
|
|
|
|
///
|
|
|
|
|
TOGGLE_LINE_TOP,
|
|
|
|
|
///
|
|
|
|
|
TOGGLE_LINE_BOTTOM,
|
|
|
|
|
///
|
|
|
|
|
TOGGLE_LINE_LEFT,
|
|
|
|
|
///
|
|
|
|
|
TOGGLE_LINE_RIGHT,
|
|
|
|
|
///
|
|
|
|
|
ALIGN_LEFT,
|
|
|
|
|
///
|
|
|
|
|
ALIGN_RIGHT,
|
|
|
|
|
///
|
|
|
|
|
ALIGN_CENTER,
|
|
|
|
|
///
|
2002-11-21 12:24:50 +00:00
|
|
|
|
ALIGN_BLOCK,
|
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
VALIGN_TOP,
|
|
|
|
|
///
|
|
|
|
|
VALIGN_BOTTOM,
|
|
|
|
|
///
|
2003-08-14 15:45:09 +00:00
|
|
|
|
VALIGN_MIDDLE,
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
M_TOGGLE_LINE_TOP,
|
|
|
|
|
///
|
|
|
|
|
M_TOGGLE_LINE_BOTTOM,
|
|
|
|
|
///
|
|
|
|
|
M_TOGGLE_LINE_LEFT,
|
|
|
|
|
///
|
|
|
|
|
M_TOGGLE_LINE_RIGHT,
|
|
|
|
|
///
|
|
|
|
|
M_ALIGN_LEFT,
|
|
|
|
|
///
|
|
|
|
|
M_ALIGN_RIGHT,
|
|
|
|
|
///
|
|
|
|
|
M_ALIGN_CENTER,
|
|
|
|
|
///
|
|
|
|
|
M_VALIGN_TOP,
|
|
|
|
|
///
|
|
|
|
|
M_VALIGN_BOTTOM,
|
|
|
|
|
///
|
2003-08-14 15:45:09 +00:00
|
|
|
|
M_VALIGN_MIDDLE,
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
MULTICOLUMN,
|
|
|
|
|
///
|
|
|
|
|
SET_ALL_LINES,
|
|
|
|
|
///
|
|
|
|
|
UNSET_ALL_LINES,
|
|
|
|
|
///
|
|
|
|
|
SET_LONGTABULAR,
|
|
|
|
|
///
|
|
|
|
|
UNSET_LONGTABULAR,
|
|
|
|
|
///
|
|
|
|
|
SET_PWIDTH,
|
|
|
|
|
///
|
|
|
|
|
SET_MPWIDTH,
|
|
|
|
|
///
|
|
|
|
|
SET_ROTATE_TABULAR,
|
|
|
|
|
///
|
|
|
|
|
UNSET_ROTATE_TABULAR,
|
|
|
|
|
///
|
|
|
|
|
SET_ROTATE_CELL,
|
|
|
|
|
///
|
|
|
|
|
UNSET_ROTATE_CELL,
|
|
|
|
|
///
|
|
|
|
|
SET_USEBOX,
|
|
|
|
|
///
|
|
|
|
|
SET_LTHEAD,
|
2001-10-24 15:07:39 +00:00
|
|
|
|
UNSET_LTHEAD,
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
SET_LTFIRSTHEAD,
|
2001-10-24 15:07:39 +00:00
|
|
|
|
UNSET_LTFIRSTHEAD,
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
SET_LTFOOT,
|
2001-10-24 15:07:39 +00:00
|
|
|
|
UNSET_LTFOOT,
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
SET_LTLASTFOOT,
|
2001-10-24 15:07:39 +00:00
|
|
|
|
UNSET_LTLASTFOOT,
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
SET_LTNEWPAGE,
|
|
|
|
|
///
|
|
|
|
|
SET_SPECIAL_COLUMN,
|
|
|
|
|
///
|
|
|
|
|
SET_SPECIAL_MULTI,
|
|
|
|
|
///
|
|
|
|
|
LAST_ACTION
|
|
|
|
|
};
|
|
|
|
|
///
|
|
|
|
|
enum {
|
|
|
|
|
///
|
|
|
|
|
CELL_NORMAL = 0,
|
|
|
|
|
///
|
|
|
|
|
CELL_BEGIN_OF_MULTICOLUMN,
|
|
|
|
|
///
|
|
|
|
|
CELL_PART_OF_MULTICOLUMN
|
|
|
|
|
};
|
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
enum VAlignment {
|
|
|
|
|
///
|
|
|
|
|
LYX_VALIGN_TOP = 0,
|
|
|
|
|
///
|
|
|
|
|
LYX_VALIGN_BOTTOM = 1,
|
|
|
|
|
///
|
2003-08-14 15:45:09 +00:00
|
|
|
|
LYX_VALIGN_MIDDLE = 2
|
2001-04-02 14:02:58 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum BoxType {
|
|
|
|
|
///
|
|
|
|
|
BOX_NONE = 0,
|
|
|
|
|
///
|
|
|
|
|
BOX_PARBOX = 1,
|
|
|
|
|
///
|
|
|
|
|
BOX_MINIPAGE = 2
|
|
|
|
|
};
|
|
|
|
|
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class ltType {
|
|
|
|
|
public:
|
2001-10-24 15:07:39 +00:00
|
|
|
|
// constructor
|
2003-02-14 15:01:06 +00:00
|
|
|
|
ltType();
|
2003-06-12 11:52:44 +00:00
|
|
|
|
// we have this header type (is set in the getLT... functions)
|
2001-12-20 14:52:15 +00:00
|
|
|
|
bool set;
|
2001-10-24 15:07:39 +00:00
|
|
|
|
// double borders on top
|
|
|
|
|
bool topDL;
|
|
|
|
|
// double borders on bottom
|
|
|
|
|
bool bottomDL;
|
2001-12-19 16:13:21 +00:00
|
|
|
|
// used for FirstHeader & LastFooter and if this is true
|
2001-12-20 14:52:15 +00:00
|
|
|
|
// all the rows marked as FirstHeader or LastFooter are
|
|
|
|
|
// ignored in the output and it is set to be empty!
|
2001-12-19 16:13:21 +00:00
|
|
|
|
bool empty;
|
2001-10-24 15:07:39 +00:00
|
|
|
|
};
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2004-12-03 13:57:50 +00:00
|
|
|
|
/// type for row numbers
|
|
|
|
|
typedef size_t row_type;
|
|
|
|
|
/// type for column numbers
|
|
|
|
|
typedef size_t col_type;
|
|
|
|
|
/// type for cell indices
|
|
|
|
|
typedef size_t idx_type;
|
|
|
|
|
/// index indicating an invalid position
|
|
|
|
|
static const idx_type npos = static_cast<idx_type>(-1);
|
|
|
|
|
|
2003-06-12 11:52:44 +00:00
|
|
|
|
/// constructor
|
2004-12-03 13:57:50 +00:00
|
|
|
|
LyXTabular(BufferParams const &, col_type columns_arg,
|
2006-04-05 23:56:29 +00:00
|
|
|
|
row_type rows_arg);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if there is a topline, returns false if not
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool topLine(idx_type cell, bool onlycolumn = false) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if there is a topline, returns false if not
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool bottomLine(idx_type cell, bool onlycolumn = false) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if there is a topline, returns false if not
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool leftLine(idx_type cell, bool onlycolumn = false) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if there is a topline, returns false if not
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool rightLine(idx_type cell, bool onlycolumn = false) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool topAlreadyDrawn(idx_type cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool leftAlreadyDrawn(idx_type cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool isLastRow(idx_type cell) const;
|
2001-04-24 15:25:26 +00:00
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
int getAdditionalHeight(row_type row) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
int getAdditionalWidth(idx_type cell) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/* returns the maximum over all rows */
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
int getWidthOfColumn(idx_type cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getWidthOfTabular() const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
int getAscentOfRow(row_type row) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
int getDescentOfRow(row_type row) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getHeightOfTabular() const;
|
2004-10-05 10:11:42 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void setAscentOfRow(row_type row, int height);
|
2004-10-05 10:11:42 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void setDescentOfRow(row_type row, int height);
|
2004-10-05 10:11:42 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void setWidthOfCell(idx_type cell, int new_width);
|
2003-07-21 11:01:29 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void setAllLines(idx_type cell, bool line);
|
2003-07-21 11:01:29 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void setTopLine(idx_type cell, bool line, bool onlycolumn = false);
|
2003-07-21 11:01:29 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void setBottomLine(idx_type cell, bool line, bool onlycolumn = false);
|
2003-07-21 11:01:29 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void setLeftLine(idx_type cell, bool line, bool onlycolumn = false);
|
2003-07-21 11:01:29 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void setRightLine(idx_type cell, bool line, bool onlycolumn = false);
|
2003-07-25 21:20:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void setAlignment(idx_type cell, LyXAlignment align,
|
2001-04-06 12:47:50 +00:00
|
|
|
|
bool onlycolumn = false);
|
2003-07-25 21:20:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void setVAlignment(idx_type cell, VAlignment align,
|
2001-04-06 12:47:50 +00:00
|
|
|
|
bool onlycolumn = false);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2005-11-28 11:52:03 +00:00
|
|
|
|
void setColumnPWidth(LCursor &, idx_type, LyXLength const &);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2005-11-28 11:52:03 +00:00
|
|
|
|
bool setMColumnPWidth(LCursor &, idx_type, LyXLength const &);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void setAlignSpecial(idx_type cell, std::string const & special,
|
2006-04-05 23:56:29 +00:00
|
|
|
|
Feature what);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
LyXAlignment getAlignment(idx_type cell,
|
2006-04-05 23:56:29 +00:00
|
|
|
|
bool onlycolumn = false) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
VAlignment getVAlignment(idx_type cell,
|
2006-04-05 23:56:29 +00:00
|
|
|
|
bool onlycolumn = false) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
LyXLength const getPWidth(idx_type cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
LyXLength const getColumnPWidth(idx_type cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
LyXLength const getMColumnPWidth(idx_type cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
std::string const getAlignSpecial(idx_type cell, int what) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
int getWidthOfCell(idx_type cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
int getBeginningOfTextInCell(idx_type cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void appendRow(BufferParams const &, idx_type cell);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void deleteRow(row_type row);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void appendColumn(BufferParams const &, idx_type cell);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void deleteColumn(col_type column);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool isFirstCellInRow(idx_type cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
idx_type getFirstCellInRow(row_type row) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool isLastCellInRow(idx_type cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
idx_type getLastCellInRow(row_type row) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
idx_type getNumberOfCells() const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
idx_type numberOfCellsInRow(idx_type cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-08-28 07:41:31 +00:00
|
|
|
|
void write(Buffer const &, std::ostream &) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-08-28 07:41:31 +00:00
|
|
|
|
void read(Buffer const &, LyXLex &);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-08-28 07:41:31 +00:00
|
|
|
|
int latex(Buffer const &, std::ostream &,
|
2003-11-05 12:06:20 +00:00
|
|
|
|
OutputParams const &) const;
|
2003-07-26 21:53:54 +00:00
|
|
|
|
//
|
2003-10-31 18:45:43 +00:00
|
|
|
|
int linuxdoc(Buffer const & buf, std::ostream & os,
|
2003-11-05 12:06:20 +00:00
|
|
|
|
OutputParams const &) const;
|
2000-08-23 15:18:19 +00:00
|
|
|
|
///
|
2003-10-31 18:45:43 +00:00
|
|
|
|
int docbook(Buffer const & buf, std::ostream & os,
|
2003-11-05 12:06:20 +00:00
|
|
|
|
OutputParams const &) const;
|
2000-08-23 15:18:19 +00:00
|
|
|
|
///
|
2003-11-05 12:06:20 +00:00
|
|
|
|
int plaintext(Buffer const &, std::ostream &,
|
|
|
|
|
OutputParams const & runparams,
|
2003-10-31 18:45:43 +00:00
|
|
|
|
int const depth,
|
2002-03-21 17:27:08 +00:00
|
|
|
|
bool onlydata, unsigned char delim) const;
|
2000-08-23 15:18:19 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool isMultiColumn(idx_type cell) const;
|
2003-10-06 14:10:59 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool isMultiColumnReal(idx_type cell) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void setMultiColumn(Buffer *, idx_type cell, idx_type number);
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
idx_type unsetMultiColumn(idx_type cell); // returns number of new cells
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool isPartOfMultiColumn(row_type row, col_type column) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
row_type row_of_cell(idx_type cell) const;
|
2000-07-17 14:31:07 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
col_type column_of_cell(idx_type cell) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
col_type right_column_of_cell(idx_type cell) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
void setLongTabular(bool);
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool isLongTabular() const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
void setRotateTabular(bool);
|
2000-07-11 15:08:54 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool getRotateTabular() const;
|
2000-08-23 15:18:19 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void setRotateCell(idx_type cell, bool);
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool getRotateCell(idx_type cell) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool needRotating() const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool isLastCell(idx_type cell) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
idx_type getCellAbove(idx_type cell) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
idx_type getCellBelow(idx_type cell) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
idx_type getLastCellAbove(idx_type cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
idx_type getLastCellBelow(idx_type cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
idx_type getCellNumber(row_type row, col_type column) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void setUsebox(idx_type cell, BoxType);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
BoxType getUsebox(idx_type cell) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
//
|
2001-12-20 14:52:15 +00:00
|
|
|
|
// Long Tabular Options support functions
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool checkLTType(row_type row, ltType const &) const;
|
2001-10-24 15:07:39 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void setLTHead(row_type row, bool flag, ltType const &, bool first);
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool getRowOfLTHead(row_type row, ltType &) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool getRowOfLTFirstHead(row_type row, ltType &) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void setLTFoot(row_type row, bool flag, ltType const &, bool last);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool getRowOfLTFoot(row_type row, ltType &) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool getRowOfLTLastFoot(row_type row, ltType &) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void setLTNewPage(row_type row, bool what);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool getLTNewPage(row_type row) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2001-12-20 14:52:15 +00:00
|
|
|
|
bool haveLTHead() const;
|
|
|
|
|
///
|
|
|
|
|
bool haveLTFirstHead() const;
|
|
|
|
|
///
|
|
|
|
|
bool haveLTFoot() const;
|
|
|
|
|
///
|
|
|
|
|
bool haveLTLastFoot() const;
|
|
|
|
|
///
|
|
|
|
|
// end longtable support
|
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
boost::shared_ptr<InsetText> getCellInset(idx_type cell) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
boost::shared_ptr<InsetText> getCellInset(row_type row,
|
2006-04-05 23:56:29 +00:00
|
|
|
|
col_type column) const;
|
2005-05-12 12:22:39 +00:00
|
|
|
|
///
|
2005-06-09 09:58:08 +00:00
|
|
|
|
void setCellInset(row_type row, col_type column,
|
2005-05-12 12:22:39 +00:00
|
|
|
|
boost::shared_ptr<InsetText>) const;
|
2002-01-20 16:07:42 +00:00
|
|
|
|
/// Search for \param inset in the tabular, with the
|
2003-10-13 09:43:15 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
idx_type getCellFromInset(InsetBase const * inset) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
row_type rows() const { return rows_; }
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
col_type columns() const { return columns_;}
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
void validate(LaTeXFeatures &) const;
|
2001-06-27 14:10:35 +00:00
|
|
|
|
///
|
2003-07-10 08:00:41 +00:00
|
|
|
|
//private:
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class cellstruct {
|
|
|
|
|
public:
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2006-03-29 10:13:40 +00:00
|
|
|
|
cellstruct(BufferParams const &);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-11-23 23:04:52 +00:00
|
|
|
|
cellstruct(cellstruct const &);
|
|
|
|
|
///
|
|
|
|
|
cellstruct & operator=(cellstruct);
|
|
|
|
|
///
|
|
|
|
|
void swap(cellstruct & rhs);
|
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
idx_type cellno;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
int width_of_cell;
|
|
|
|
|
///
|
|
|
|
|
int multicolumn;
|
|
|
|
|
///
|
|
|
|
|
LyXAlignment alignment;
|
|
|
|
|
///
|
|
|
|
|
VAlignment valignment;
|
|
|
|
|
///
|
|
|
|
|
bool top_line;
|
|
|
|
|
///
|
|
|
|
|
bool bottom_line;
|
|
|
|
|
///
|
|
|
|
|
bool left_line;
|
|
|
|
|
///
|
|
|
|
|
bool right_line;
|
|
|
|
|
///
|
|
|
|
|
BoxType usebox;
|
|
|
|
|
///
|
|
|
|
|
bool rotate;
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string align_special;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2001-12-11 17:26:52 +00:00
|
|
|
|
LyXLength p_width; // this is only set for multicolumn!!!
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-11-23 23:04:52 +00:00
|
|
|
|
boost::shared_ptr<InsetText> inset;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
};
|
2004-12-03 13:57:50 +00:00
|
|
|
|
cellstruct & cellinfo_of_cell(idx_type cell) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
typedef std::vector<cellstruct> cell_vector;
|
|
|
|
|
///
|
|
|
|
|
typedef std::vector<cell_vector> cell_vvector;
|
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class rowstruct {
|
|
|
|
|
public:
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
rowstruct();
|
|
|
|
|
///
|
|
|
|
|
int ascent_of_row;
|
|
|
|
|
///
|
|
|
|
|
int descent_of_row;
|
2001-12-19 21:25:34 +00:00
|
|
|
|
///
|
|
|
|
|
bool top_line;
|
|
|
|
|
///
|
|
|
|
|
bool bottom_line;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// This are for longtabulars only
|
2001-12-19 21:25:34 +00:00
|
|
|
|
/// a row of endhead
|
|
|
|
|
bool endhead;
|
|
|
|
|
/// a row of endfirsthead
|
|
|
|
|
bool endfirsthead;
|
|
|
|
|
/// a row of endfoot
|
|
|
|
|
bool endfoot;
|
|
|
|
|
/// row of endlastfoot
|
|
|
|
|
bool endlastfoot;
|
|
|
|
|
/// row for a pagebreak
|
2001-04-02 14:02:58 +00:00
|
|
|
|
bool newpage;
|
|
|
|
|
};
|
|
|
|
|
///
|
|
|
|
|
typedef std::vector<rowstruct> row_vector;
|
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class columnstruct {
|
|
|
|
|
public:
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
columnstruct();
|
|
|
|
|
///
|
|
|
|
|
LyXAlignment alignment;
|
|
|
|
|
///
|
|
|
|
|
VAlignment valignment;
|
|
|
|
|
///
|
|
|
|
|
bool left_line;
|
|
|
|
|
///
|
|
|
|
|
bool right_line;
|
|
|
|
|
///
|
|
|
|
|
int width_of_column;
|
|
|
|
|
///
|
2001-12-11 17:26:52 +00:00
|
|
|
|
LyXLength p_width;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string align_special;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
};
|
|
|
|
|
///
|
|
|
|
|
typedef std::vector<columnstruct> column_vector;
|
2000-05-26 13:09:14 +00:00
|
|
|
|
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
row_type rows_;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
col_type columns_;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
idx_type numberofcells;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
std::vector<row_type> rowofcell;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
std::vector<col_type> columnofcell;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
row_vector row_info;
|
|
|
|
|
///
|
|
|
|
|
column_vector column_info;
|
|
|
|
|
///
|
|
|
|
|
mutable cell_vvector cell_info;
|
|
|
|
|
///
|
|
|
|
|
int width_of_tabular;
|
|
|
|
|
///
|
|
|
|
|
bool rotate;
|
|
|
|
|
//
|
|
|
|
|
// for long tabulars
|
2001-12-19 21:25:34 +00:00
|
|
|
|
//
|
2001-04-02 14:02:58 +00:00
|
|
|
|
bool is_long_tabular;
|
2001-12-19 21:25:34 +00:00
|
|
|
|
/// endhead data
|
2001-10-24 15:07:39 +00:00
|
|
|
|
ltType endhead;
|
2001-12-19 21:25:34 +00:00
|
|
|
|
/// endfirsthead data
|
2001-10-24 15:07:39 +00:00
|
|
|
|
ltType endfirsthead;
|
2001-12-19 21:25:34 +00:00
|
|
|
|
/// endfoot data
|
2001-10-24 15:07:39 +00:00
|
|
|
|
ltType endfoot;
|
2001-12-19 21:25:34 +00:00
|
|
|
|
/// endlastfoot data
|
2001-10-24 15:07:39 +00:00
|
|
|
|
ltType endlastfoot;
|
2001-04-24 15:25:26 +00:00
|
|
|
|
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void init(BufferParams const &, row_type rows_arg,
|
2006-04-05 23:56:29 +00:00
|
|
|
|
col_type columns_arg);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2003-10-08 14:29:16 +00:00
|
|
|
|
void set_row_column_number_info();
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if a complete update is necessary, otherwise false
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool setWidthOfMulticolCell(idx_type cell, int new_width);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void recalculateMulticolumnsOfColumn(col_type column);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if change
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void calculate_width_of_column(col_type column);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool calculate_width_of_column_NMC(col_type column); // no multi cells
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
void calculate_width_of_tabular();
|
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
void delete_column(col_type column);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
idx_type cells_in_multicolumn(idx_type cell) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
BoxType useParbox(idx_type cell) const;
|
2001-12-20 14:52:15 +00:00
|
|
|
|
///
|
2001-12-27 15:54:25 +00:00
|
|
|
|
// helper function for Latex returns number of newlines
|
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
int TeXTopHLine(std::ostream &, row_type row) const;
|
2001-12-27 15:54:25 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
int TeXBottomHLine(std::ostream &, row_type row) const;
|
2001-12-27 15:54:25 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
int TeXCellPreamble(std::ostream &, idx_type cell) const;
|
2001-12-27 15:54:25 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
int TeXCellPostamble(std::ostream &, idx_type cell) const;
|
2001-12-27 15:54:25 +00:00
|
|
|
|
///
|
2003-08-28 07:41:31 +00:00
|
|
|
|
int TeXLongtableHeaderFooter(std::ostream &, Buffer const & buf,
|
2003-11-05 12:06:20 +00:00
|
|
|
|
OutputParams const &) const;
|
2001-12-27 15:54:25 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
bool isValidRow(row_type const row) const;
|
2001-12-27 15:54:25 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
int TeXRow(std::ostream &, row_type const row, Buffer const & buf,
|
2003-11-05 12:06:20 +00:00
|
|
|
|
OutputParams const &) const;
|
2001-12-27 15:54:25 +00:00
|
|
|
|
///
|
|
|
|
|
// helper function for ASCII returns number of newlines
|
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
int asciiTopHLine(std::ostream &, row_type row,
|
2002-03-21 17:27:08 +00:00
|
|
|
|
std::vector<unsigned int> const &) const;
|
2001-12-27 15:54:25 +00:00
|
|
|
|
///
|
2004-12-03 13:57:50 +00:00
|
|
|
|
int asciiBottomHLine(std::ostream &, row_type row,
|
2002-03-21 17:27:08 +00:00
|
|
|
|
std::vector<unsigned int> const &) const;
|
2001-12-27 15:54:25 +00:00
|
|
|
|
///
|
2003-08-28 07:41:31 +00:00
|
|
|
|
int asciiPrintCell(Buffer const &, std::ostream &,
|
2003-11-05 12:06:20 +00:00
|
|
|
|
OutputParams const &,
|
2004-12-03 13:57:50 +00:00
|
|
|
|
idx_type cell, row_type row, col_type column,
|
2002-03-21 17:27:08 +00:00
|
|
|
|
std::vector<unsigned int> const &,
|
2001-12-27 15:54:25 +00:00
|
|
|
|
bool onlydata) const;
|
|
|
|
|
/// auxiliary function for docbook
|
2004-12-03 13:57:50 +00:00
|
|
|
|
int docbookRow(Buffer const & buf, std::ostream & os, row_type,
|
2003-11-05 12:06:20 +00:00
|
|
|
|
OutputParams const &) const;
|
2003-10-08 14:29:16 +00:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
/// renumber cells after structural changes
|
|
|
|
|
void fixCellNums();
|
2000-04-21 15:16:22 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|