1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
1999-11-15 12:01:38 +00:00
|
|
|
* ======================================================
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
1999-11-04 01:40:20 +00:00
|
|
|
* Copyright 1995 Matthias Ettrich
|
2001-05-30 13:53:44 +00:00
|
|
|
* Copyright 1995-2001 The LyX Team
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
1999-11-04 01:40:20 +00:00
|
|
|
* ====================================================== */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
#ifndef TEXROW_H
|
|
|
|
#define TEXROW_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
1999-11-22 16:19:48 +00:00
|
|
|
#include <list>
|
2000-03-28 02:18:55 +00:00
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
class Paragraph;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// Controls correspondance between paragraphs and the generated LaTeX file
|
|
|
|
class TexRow {
|
|
|
|
public:
|
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
TexRow() : count(0), lastpar(0), lastpos(-1) {}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Clears structure
|
|
|
|
void reset();
|
|
|
|
|
|
|
|
/// Define what paragraph and position the next row will represent
|
2001-06-25 00:06:33 +00:00
|
|
|
void start(Paragraph * par, int pos);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Insert node when line is completed
|
|
|
|
void newline();
|
|
|
|
|
|
|
|
/// Returns paragraph id and position from a row number
|
2000-08-05 05:17:18 +00:00
|
|
|
bool getIdFromRow(int row, int & id, int & pos) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Appends another TexRow
|
1999-11-22 16:19:48 +00:00
|
|
|
TexRow & operator+= (TexRow const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-05-04 08:14:34 +00:00
|
|
|
/// Returns the number of rows in this texrow
|
2000-06-08 23:16:16 +00:00
|
|
|
int rows() const { return count; }
|
2000-05-04 08:14:34 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Linked list of items
|
2000-06-08 23:16:16 +00:00
|
|
|
class RowItem {
|
|
|
|
public:
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
RowItem() : id_(-1), pos_(-1), rownumber_(0) {}
|
|
|
|
///
|
|
|
|
void id(int i) {
|
|
|
|
id_ = i;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
int id() const {
|
|
|
|
return id_;
|
|
|
|
}
|
|
|
|
///
|
|
|
|
void pos(int p) {
|
|
|
|
pos_ = p;
|
|
|
|
}
|
|
|
|
///
|
|
|
|
int pos() const {
|
|
|
|
return pos_;
|
|
|
|
}
|
|
|
|
///
|
|
|
|
void rownumber(int r) {
|
|
|
|
rownumber_ = r;
|
|
|
|
}
|
|
|
|
///
|
|
|
|
int rownumber() const {
|
|
|
|
return rownumber_;
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
int id_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
int pos_;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
int rownumber_;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
typedef std::list<RowItem> RowList;
|
1999-11-22 16:19:48 +00:00
|
|
|
///
|
2000-08-05 05:17:18 +00:00
|
|
|
void increasePos(int id, int pos) const;
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
unsigned int count;
|
|
|
|
///
|
2000-08-03 21:17:52 +00:00
|
|
|
mutable RowList rowlist;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Last paragraph
|
2001-06-25 00:06:33 +00:00
|
|
|
Paragraph * lastpar;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Last position
|
|
|
|
int lastpos;
|
|
|
|
|
|
|
|
};
|
|
|
|
#endif
|