2000-04-21 15:16:22 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/* This file is part of
|
2002-03-21 17:27:08 +00:00
|
|
|
|
* ======================================================
|
|
|
|
|
*
|
2000-04-21 15:16:22 +00:00
|
|
|
|
* LyX, The Document Processor
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2001-05-30 13:53:44 +00:00
|
|
|
|
* Copyright 2000-2001 The LyX Team.
|
2000-04-21 15:16:22 +00:00
|
|
|
|
*
|
2000-08-23 15:18:19 +00:00
|
|
|
|
* @author: J<EFBFBD>rgen Vigna
|
|
|
|
|
*
|
2000-04-21 15:16:22 +00:00
|
|
|
|
* ====================================================== */
|
|
|
|
|
#ifndef TABULAR_H
|
|
|
|
|
#define TABULAR_H
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma interface
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "lyxlex.h"
|
2001-11-29 17:12:21 +00:00
|
|
|
|
#include "layout.h"
|
2000-04-21 15:16:22 +00:00
|
|
|
|
#include "LString.h"
|
2001-12-11 17:26:52 +00:00
|
|
|
|
#include "lyxlength.h"
|
2000-04-21 15:16:22 +00:00
|
|
|
|
|
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;
|
2000-05-19 10:32:05 +00:00
|
|
|
|
class LaTeXFeatures;
|
2000-06-12 11:27:15 +00:00
|
|
|
|
class Buffer;
|
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,
|
|
|
|
|
///
|
|
|
|
|
VALIGN_TOP,
|
|
|
|
|
///
|
|
|
|
|
VALIGN_BOTTOM,
|
|
|
|
|
///
|
|
|
|
|
VALIGN_CENTER,
|
|
|
|
|
///
|
|
|
|
|
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,
|
|
|
|
|
///
|
|
|
|
|
M_VALIGN_CENTER,
|
|
|
|
|
///
|
|
|
|
|
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,
|
|
|
|
|
///
|
|
|
|
|
LYX_VALIGN_CENTER = 2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum BoxType {
|
|
|
|
|
///
|
|
|
|
|
BOX_NONE = 0,
|
|
|
|
|
///
|
|
|
|
|
BOX_PARBOX = 1,
|
|
|
|
|
///
|
|
|
|
|
BOX_MINIPAGE = 2
|
|
|
|
|
};
|
|
|
|
|
|
2001-10-24 15:07:39 +00:00
|
|
|
|
struct lttype {
|
|
|
|
|
// constructor
|
|
|
|
|
lttype();
|
2001-12-20 14:52:15 +00:00
|
|
|
|
// we have this header type (is set in the GetLT... functions)
|
|
|
|
|
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
|
|
|
|
};
|
|
|
|
|
///
|
|
|
|
|
typedef struct lttype ltType;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/* konstruktor */
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2002-03-03 20:25:07 +00:00
|
|
|
|
LyXTabular(BufferParams const &,
|
|
|
|
|
InsetTabular *, int columns_arg, int rows_arg);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2002-03-03 20:25:07 +00:00
|
|
|
|
LyXTabular(BufferParams const &,
|
|
|
|
|
InsetTabular *, LyXTabular const &, bool same_id = false);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
explicit
|
|
|
|
|
LyXTabular(Buffer const *, InsetTabular *, LyXLex & lex);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
LyXTabular & operator=(LyXTabular const &);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2002-03-03 20:25:07 +00:00
|
|
|
|
LyXTabular * clone(BufferParams const &,
|
|
|
|
|
InsetTabular *, bool same_id = false);
|
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
|
|
|
|
|
bool TopLine(int cell, bool onlycolumn = false) const;
|
|
|
|
|
/// Returns true if there is a topline, returns false if not
|
|
|
|
|
bool BottomLine(int cell, bool onlycolumn = false) const;
|
|
|
|
|
/// Returns true if there is a topline, returns false if not
|
|
|
|
|
bool LeftLine(int cell, bool onlycolumn = false) const;
|
|
|
|
|
/// Returns true if there is a topline, returns false if not
|
|
|
|
|
bool RightLine(int cell, bool onlycolumn = false) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
bool TopAlreadyDrawed(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
bool LeftAlreadyDrawed(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
bool IsLastRow(int cell) const;
|
2001-04-24 15:25:26 +00:00
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-27 14:03:25 +00:00
|
|
|
|
int GetAdditionalHeight(int row) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +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
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int GetWidthOfColumn(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int GetWidthOfTabular() const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int GetAscentOfRow(int row) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int GetDescentOfRow(int row) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int GetHeightOfTabular() const;
|
|
|
|
|
/// Returns true if a complete update is necessary, otherwise false
|
|
|
|
|
bool SetAscentOfRow(int row, int height);
|
|
|
|
|
/// Returns true if a complete update is necessary, otherwise false
|
|
|
|
|
bool SetDescentOfRow(int row, int height);
|
|
|
|
|
/// Returns true if a complete update is necessary, otherwise false
|
|
|
|
|
bool SetWidthOfCell(int cell, int new_width);
|
|
|
|
|
/// Returns true if a complete update is necessary, otherwise false
|
|
|
|
|
bool SetAllLines(int cell, bool line);
|
|
|
|
|
/// Returns true if a complete update is necessary, otherwise false
|
2001-04-06 12:47:50 +00:00
|
|
|
|
bool SetTopLine(int cell, bool line, bool onlycolumn = false);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if a complete update is necessary, otherwise false
|
2001-04-06 12:47:50 +00:00
|
|
|
|
bool SetBottomLine(int cell, bool line, bool onlycolumn = false);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if a complete update is necessary, otherwise false
|
2001-04-06 12:47:50 +00:00
|
|
|
|
bool SetLeftLine(int cell, bool line, bool onlycolumn = false);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if a complete update is necessary, otherwise false
|
2001-04-06 12:47:50 +00:00
|
|
|
|
bool SetRightLine(int cell, bool line, bool onlycolumn = false);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if a complete update is necessary, otherwise false
|
2001-04-06 12:47:50 +00:00
|
|
|
|
bool SetAlignment(int cell, LyXAlignment align,
|
|
|
|
|
bool onlycolumn = false);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if a complete update is necessary, otherwise false
|
2001-04-06 12:47:50 +00:00
|
|
|
|
bool SetVAlignment(int cell, VAlignment align,
|
|
|
|
|
bool onlycolumn = false);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-12-11 17:26:52 +00:00
|
|
|
|
bool SetColumnPWidth(int cell, LyXLength const & width);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-12-11 17:26:52 +00:00
|
|
|
|
bool SetMColumnPWidth(int cell, LyXLength const & width);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
bool SetAlignSpecial(int cell, string const & special, Feature what);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
LyXAlignment GetAlignment(int cell, bool onlycolumn = false) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
VAlignment GetVAlignment(int cell, bool onlycolumn = false) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-12-11 17:26:52 +00:00
|
|
|
|
LyXLength const GetPWidth(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-12-11 17:26:52 +00:00
|
|
|
|
LyXLength const GetColumnPWidth(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-12-11 17:26:52 +00:00
|
|
|
|
LyXLength const GetMColumnPWidth(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
string const GetAlignSpecial(int cell, int what) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int GetWidthOfCell(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int GetBeginningOfTextInCell(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2002-03-03 20:25:07 +00:00
|
|
|
|
void AppendRow(BufferParams const &, int cell);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
void DeleteRow(int row);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2002-03-03 20:25:07 +00:00
|
|
|
|
void AppendColumn(BufferParams const &, int cell);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
void DeleteColumn(int column);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
bool IsFirstCellInRow(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int GetFirstCellInRow(int row) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
bool IsLastCellInRow(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int GetLastCellInRow(int row) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int GetNumberOfCells() const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int NumberOfCellsInRow(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
void Write(Buffer const *, std::ostream &) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
void Read(Buffer const *, LyXLex &);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2002-03-03 20:25:07 +00:00
|
|
|
|
void OldFormatRead(BufferParams const &, LyXLex &, string const &);
|
2000-07-17 14:31:07 +00:00
|
|
|
|
///
|
2001-12-27 15:54:25 +00:00
|
|
|
|
int latex(Buffer const *, std::ostream &, bool, bool) const;
|
2000-08-23 15:18:19 +00:00
|
|
|
|
///
|
2002-06-18 15:44:30 +00:00
|
|
|
|
int docbook(Buffer const * buf, std::ostream & os, bool mixcont) const;
|
2000-08-23 15:18:19 +00:00
|
|
|
|
///
|
2001-12-27 15:54:25 +00:00
|
|
|
|
int ascii(Buffer const *, std::ostream &, 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
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
bool IsMultiColumn(int cell, bool real = false) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2002-03-21 15:58:54 +00:00
|
|
|
|
void SetMultiColumn(Buffer const *, int cell, int number);
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int UnsetMultiColumn(int cell); // returns number of new cells
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +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
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
void SetLongTabular(bool);
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
bool IsLongTabular() const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
void SetRotateTabular(bool);
|
2000-07-11 15:08:54 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
bool GetRotateTabular() const;
|
2000-08-23 15:18:19 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
void SetRotateCell(int cell, bool);
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
bool GetRotateCell(int cell) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
bool NeedRotating() const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
bool IsLastCell(int cell) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int GetCellAbove(int cell) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int GetCellBelow(int cell) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int GetLastCellAbove(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int GetLastCellBelow(int cell) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
int GetCellNumber(int row, int column) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
void SetUsebox(int cell, BoxType);
|
|
|
|
|
///
|
|
|
|
|
BoxType GetUsebox(int cell) const;
|
|
|
|
|
//
|
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;
|
|
|
|
|
///
|
2001-12-19 21:25:34 +00:00
|
|
|
|
void SetLTHead(int row, bool flag, ltType const &, bool first);
|
2000-04-21 15:16:22 +00:00
|
|
|
|
///
|
2001-10-24 15:07:39 +00:00
|
|
|
|
bool GetRowOfLTHead(int row, ltType &) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-10-24 15:07:39 +00:00
|
|
|
|
bool GetRowOfLTFirstHead(int row, ltType &) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-12-19 21:25:34 +00:00
|
|
|
|
void SetLTFoot(int row, bool flag, ltType const &, bool last);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-10-24 15:07:39 +00:00
|
|
|
|
bool GetRowOfLTFoot(int row, ltType &) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-10-24 15:07:39 +00:00
|
|
|
|
bool GetRowOfLTLastFoot(int row, ltType &) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2001-12-19 16:13:21 +00:00
|
|
|
|
void SetLTNewPage(int row, bool what);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2001-12-19 16:13:21 +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
|
|
|
|
|
///
|
2001-04-02 14:02:58 +00:00
|
|
|
|
InsetText * GetCellInset(int cell) const;
|
|
|
|
|
///
|
|
|
|
|
InsetText * GetCellInset(int row, int column) const;
|
2002-01-20 16:07:42 +00:00
|
|
|
|
/// Search for \param inset in the tabular, with the
|
|
|
|
|
/// additional hint that it could be at \param maybe_cell
|
|
|
|
|
int GetCellFromInset(Inset const * inset, int maybe_cell = -1) const;
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
int rows() const { return rows_; }
|
|
|
|
|
///
|
|
|
|
|
int columns() const { return columns_;}
|
|
|
|
|
///
|
|
|
|
|
InsetTabular * owner() const { return owner_; }
|
|
|
|
|
///
|
|
|
|
|
void Validate(LaTeXFeatures &) const;
|
2001-04-06 12:47:50 +00:00
|
|
|
|
///
|
|
|
|
|
std::vector<string> const getLabelList() const;
|
2001-06-27 14:10:35 +00:00
|
|
|
|
///
|
2001-12-04 16:10:19 +00:00
|
|
|
|
/// recalculate the widths/heights only!
|
|
|
|
|
void reinit();
|
|
|
|
|
///
|
2001-06-27 14:10:35 +00:00
|
|
|
|
mutable int cur_cell;
|
2001-04-06 12:47:50 +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;
|
|
|
|
|
///
|
|
|
|
|
string align_special;
|
|
|
|
|
///
|
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;
|
|
|
|
|
};
|
|
|
|
|
///
|
|
|
|
|
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
|
|
|
|
///
|
|
|
|
|
string align_special;
|
|
|
|
|
};
|
|
|
|
|
///
|
|
|
|
|
typedef std::vector<columnstruct> column_vector;
|
2000-05-26 13:09:14 +00:00
|
|
|
|
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
void ReadNew(Buffer const * buf, std::istream & is,
|
2001-12-19 21:25:34 +00:00
|
|
|
|
LyXLex & lex, string const & l, int const version);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
void ReadOld(Buffer const * buf, std::istream & is,
|
|
|
|
|
LyXLex & lex, string const & l);
|
|
|
|
|
///
|
|
|
|
|
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-12-19 21:25:34 +00:00
|
|
|
|
//
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
InsetTabular * owner_;
|
2001-04-24 15:25:26 +00:00
|
|
|
|
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2002-03-03 20:25:07 +00:00
|
|
|
|
void Init(BufferParams const &,
|
|
|
|
|
int columns_arg, int rows_arg, LyXTabular const * lt = 0);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
2001-12-04 16:10:19 +00:00
|
|
|
|
void Reinit(bool reset_widths = true);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
///
|
|
|
|
|
void set_row_column_number_info(bool oldformat = false);
|
|
|
|
|
/// Returns true if a complete update is necessary, otherwise false
|
|
|
|
|
bool SetWidthOfMulticolCell(int cell, int new_width);
|
|
|
|
|
///
|
2002-03-01 16:04:10 +00:00
|
|
|
|
void recalculateMulticolumnsOfColumn(int column);
|
2001-04-02 14:02:58 +00:00
|
|
|
|
/// Returns true if change
|
|
|
|
|
bool calculate_width_of_column(int column);
|
|
|
|
|
///
|
|
|
|
|
bool calculate_width_of_column_NMC(int column); // no multi cells
|
|
|
|
|
///
|
|
|
|
|
void calculate_width_of_tabular();
|
|
|
|
|
///
|
|
|
|
|
cellstruct * cellinfo_of_cell(int cell) const;
|
|
|
|
|
///
|
|
|
|
|
void delete_column(int column);
|
|
|
|
|
///
|
|
|
|
|
int cells_in_multicolumn(int cell) const;
|
|
|
|
|
///
|
|
|
|
|
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;
|
|
|
|
|
///
|
|
|
|
|
int TeXLongtableHeaderFooter(std::ostream &, Buffer const * buf,
|
2002-03-21 17:27:08 +00:00
|
|
|
|
bool fragile, bool fp) const;
|
2001-12-27 15:54:25 +00:00
|
|
|
|
///
|
|
|
|
|
bool isValidRow(int const row) const;
|
|
|
|
|
///
|
|
|
|
|
int TeXRow(std::ostream &, int const row, Buffer const * buf,
|
2002-03-21 17:27:08 +00:00
|
|
|
|
bool fragile, bool fp) 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
|
|
|
|
///
|
|
|
|
|
int asciiPrintCell(Buffer const *, std::ostream &,
|
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
|
|
|
|
|
int docbookRow(Buffer const * buf, std::ostream & os, int row) const;
|
2000-04-21 15:16:22 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|