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"
|
|
|
|
|
|
|
|
|
|
#include <iosfwd>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2000-05-15 14:49:36 +00:00
|
|
|
|
class InsetTabular;
|
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
|
|
|
|
|
};
|
|
|
|
|
|
2003-02-14 15:01:06 +00:00
|
|
|
|
struct ltType {
|
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
|
|
|
|
|
2003-06-12 11:52:44 +00:00
|
|
|
|
/// constructor
|
2003-10-06 14:10:59 +00:00
|
|
|
|
LyXTabular(BufferParams const &, int columns_arg, int rows_arg);
|
|
|
|
|
///
|
|
|
|
|
void setOwner(InsetTabular * inset);
|
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
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool topLine(int cell, bool onlycolumn = false) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if there is a topline, returns false if not
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool bottomLine(int cell, bool onlycolumn = false) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if there is a topline, returns false if not
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool leftLine(int cell, bool onlycolumn = false) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if there is a topline, returns false if not
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool rightLine(int cell, bool onlycolumn = false) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-02-14 15:01:06 +00:00
|
|
|
|
bool topAlreadyDrawn(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-02-14 15:01:06 +00:00
|
|
|
|
bool leftAlreadyDrawn(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool isLastRow(int cell) const;
|
2001-04-24 15:25:26 +00:00
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getAdditionalHeight(int row) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getAdditionalWidth(int 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
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getWidthOfColumn(int 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
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getAscentOfRow(int row) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getDescentOfRow(int row) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getHeightOfTabular() const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if a complete update is necessary, otherwise false
|
2003-07-31 12:25:36 +00:00
|
|
|
|
void setAscentOfRow(int row, int height);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if a complete update is necessary, otherwise false
|
2003-07-31 12:25:36 +00:00
|
|
|
|
void setDescentOfRow(int row, int height);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if a complete update is necessary, otherwise false
|
2003-07-31 12:25:36 +00:00
|
|
|
|
void setWidthOfCell(int cell, int new_width);
|
2003-07-21 11:01:29 +00:00
|
|
|
|
///
|
|
|
|
|
void setAllLines(int cell, bool line);
|
|
|
|
|
///
|
|
|
|
|
void setTopLine(int cell, bool line, bool onlycolumn = false);
|
|
|
|
|
///
|
|
|
|
|
void setBottomLine(int cell, bool line, bool onlycolumn = false);
|
|
|
|
|
///
|
|
|
|
|
void setLeftLine(int cell, bool line, bool onlycolumn = false);
|
|
|
|
|
///
|
|
|
|
|
void setRightLine(int cell, bool line, bool onlycolumn = false);
|
2003-07-25 21:20:24 +00:00
|
|
|
|
///
|
2003-07-21 11:01:29 +00:00
|
|
|
|
void setAlignment(int cell, LyXAlignment align,
|
2001-04-06 12:47:50 +00:00
|
|
|
|
bool onlycolumn = false);
|
2003-07-25 21:20:24 +00:00
|
|
|
|
///
|
2003-07-21 11:01:29 +00:00
|
|
|
|
void setVAlignment(int cell, VAlignment align,
|
2001-04-06 12:47:50 +00:00
|
|
|
|
bool onlycolumn = false);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-07-21 11:01:29 +00:00
|
|
|
|
void setColumnPWidth(int cell, LyXLength const & width);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool setMColumnPWidth(int cell, LyXLength const & width);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void setAlignSpecial(int cell, std::string const & special, Feature what);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
LyXAlignment getAlignment(int cell, bool onlycolumn = false) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
VAlignment getVAlignment(int cell, bool onlycolumn = false) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
LyXLength const getPWidth(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
LyXLength const getColumnPWidth(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
LyXLength const getMColumnPWidth(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const getAlignSpecial(int cell, int what) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getWidthOfCell(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getBeginningOfTextInCell(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
void appendRow(BufferParams const &, int cell);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
void deleteRow(int row);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
void appendColumn(BufferParams const &, int cell);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
void deleteColumn(int column);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool isFirstCellInRow(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getFirstCellInRow(int row) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool isLastCellInRow(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getLastCellInRow(int row) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getNumberOfCells() const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int numberOfCellsInRow(int 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
|
|
|
|
///
|
2003-10-06 14:10:59 +00:00
|
|
|
|
bool isMultiColumn(int cell) const;
|
|
|
|
|
///
|
|
|
|
|
bool isMultiColumnReal(int cell) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
void setMultiColumn(Buffer *, int cell, int number);
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int unsetMultiColumn(int cell); // returns number of new cells
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool isPartOfMultiColumn(int row, int column) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int row_of_cell(int cell) const;
|
2000-07-17 14:31:07 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int column_of_cell(int cell) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int right_column_of_cell(int 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
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
void setRotateCell(int cell, bool);
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool getRotateCell(int 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
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool isLastCell(int cell) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getCellAbove(int cell) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getCellBelow(int cell) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getLastCellAbove(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getLastCellBelow(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
int getCellNumber(int row, int column) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
void setUsebox(int cell, BoxType);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
BoxType getUsebox(int 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
|
|
|
|
///
|
2001-10-24 15:07:39 +00:00
|
|
|
|
bool checkLTType(int row, ltType const &) const;
|
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
void setLTHead(int row, bool flag, ltType const &, bool first);
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool getRowOfLTHead(int row, ltType &) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool getRowOfLTFirstHead(int row, ltType &) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
void setLTFoot(int row, bool flag, ltType const &, bool last);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool getRowOfLTFoot(int row, ltType &) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool getRowOfLTLastFoot(int row, ltType &) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
void setLTNewPage(int row, bool what);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool getLTNewPage(int 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
|
|
|
|
|
///
|
2003-07-21 11:01:29 +00:00
|
|
|
|
InsetText & getCellInset(int cell) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2003-07-21 11:01:29 +00:00
|
|
|
|
InsetText & getCellInset(int row, int column) 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
|
|
|
|
///
|
2003-10-06 14:10:59 +00:00
|
|
|
|
int getCellFromInset(InsetOld const * inset) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
int rows() const { return rows_; }
|
|
|
|
|
///
|
|
|
|
|
int columns() const { return columns_;}
|
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
void validate(LaTeXFeatures &) const;
|
2003-09-18 20:18:39 +00:00
|
|
|
|
/// Appends \c list with all labels found within this inset.
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void getLabelList(Buffer const &, std::vector<std::string> & list) 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
|
|
|
|
///
|
|
|
|
|
struct cellstruct {
|
|
|
|
|
///
|
2002-03-03 20:25:07 +00:00
|
|
|
|
cellstruct(BufferParams const &);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
int cellno;
|
|
|
|
|
///
|
|
|
|
|
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
|
|
|
|
///
|
|
|
|
|
InsetText inset;
|
|
|
|
|
};
|
2003-07-21 11:01:29 +00:00
|
|
|
|
cellstruct & cellinfo_of_cell(int 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
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
struct rowstruct {
|
|
|
|
|
///
|
|
|
|
|
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
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
struct columnstruct {
|
|
|
|
|
///
|
|
|
|
|
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
|
|
|
|
///
|
|
|
|
|
int rows_;
|
|
|
|
|
///
|
|
|
|
|
int columns_;
|
|
|
|
|
///
|
|
|
|
|
int numberofcells;
|
|
|
|
|
///
|
|
|
|
|
std::vector<int> rowofcell;
|
|
|
|
|
///
|
|
|
|
|
std::vector<int> columnofcell;
|
|
|
|
|
///
|
|
|
|
|
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
|
|
|
|
///
|
2003-10-06 14:10:59 +00:00
|
|
|
|
void init(BufferParams const &, int rows_arg, int 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
|
2003-06-12 11:52:44 +00:00
|
|
|
|
bool setWidthOfMulticolCell(int cell, int new_width);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2002-03-01 16:04:10 +00:00
|
|
|
|
void recalculateMulticolumnsOfColumn(int column);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if change
|
2003-07-21 11:01:29 +00:00
|
|
|
|
void calculate_width_of_column(int column);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
bool calculate_width_of_column_NMC(int column); // no multi cells
|
|
|
|
|
///
|
|
|
|
|
void calculate_width_of_tabular();
|
|
|
|
|
///
|
|
|
|
|
void delete_column(int column);
|
|
|
|
|
///
|
|
|
|
|
int cells_in_multicolumn(int cell) const;
|
|
|
|
|
///
|
2003-06-12 11:52:44 +00:00
|
|
|
|
BoxType useParbox(int cell) const;
|
2001-12-20 14:52:15 +00:00
|
|
|
|
///
|
|
|
|
|
void setHeaderFooterRows(int header, int fheader, int footer, int lfooter);
|
2001-12-27 15:54:25 +00:00
|
|
|
|
///
|
|
|
|
|
// helper function for Latex returns number of newlines
|
|
|
|
|
///
|
|
|
|
|
int TeXTopHLine(std::ostream &, int row) const;
|
|
|
|
|
///
|
|
|
|
|
int TeXBottomHLine(std::ostream &, int row) const;
|
|
|
|
|
///
|
|
|
|
|
int TeXCellPreamble(std::ostream &, int cell) const;
|
|
|
|
|
///
|
|
|
|
|
int TeXCellPostamble(std::ostream &, int cell) const;
|
|
|
|
|
///
|
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
|
|
|
|
///
|
|
|
|
|
bool isValidRow(int const row) const;
|
|
|
|
|
///
|
2003-08-28 07:41:31 +00:00
|
|
|
|
int TeXRow(std::ostream &, int 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
|
|
|
|
|
///
|
|
|
|
|
int asciiTopHLine(std::ostream &, int row,
|
2002-03-21 17:27:08 +00:00
|
|
|
|
std::vector<unsigned int> const &) const;
|
2001-12-27 15:54:25 +00:00
|
|
|
|
///
|
|
|
|
|
int asciiBottomHLine(std::ostream &, int 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 &,
|
2002-03-21 17:27:08 +00:00
|
|
|
|
int cell, int row, int column,
|
|
|
|
|
std::vector<unsigned int> const &,
|
2001-12-27 15:54:25 +00:00
|
|
|
|
bool onlydata) const;
|
|
|
|
|
/// auxiliary function for docbook
|
2003-10-31 18:45:43 +00:00
|
|
|
|
int docbookRow(Buffer const & buf, std::ostream & os, int,
|
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
|