\end_document replaces \the_end.
[lyx.git] / src / texrow.h
blobc4db08d08eb193c7c11929887a60c9413b8ff118
1 // -*- C++ -*-
2 /**
3 * \file texrow.h
4 * Copyright 1995-2002 the LyX Team
5 * Read the file COPYING
7 * \author Matthias Ettrich
8 */
11 #ifndef TEXROW_H
12 #define TEXROW_H
14 #include <list>
17 /// Represents the correspondence between paragraphs and the generated LaTeX file
18 class TexRow {
19 public:
20 ///
21 TexRow() : count(0), lastid(-1), lastpos(-1) {}
23 TexRow & operator+= (TexRow const &);
25 /// Clears structure
26 void reset();
28 /// Define what paragraph and position the next row will represent
29 void start(int id, int pos);
31 /// Insert node when line is completed
32 void newline();
34 /**
35 * getIdFromRow - find pid and position for a given row
36 * @param row row number to find
37 * @param id set to id if found
38 * @param pos set to paragraph position if found
39 * @return true if found, false otherwise
41 * If the row could not be found, pos is set to zero and
42 * id is set to -1
44 bool getIdFromRow(int row, int & id, int & pos) const;
46 /// Returns the number of rows contained
47 int rows() const { return count; }
49 /// an individual id/pos <=> row mapping
50 class RowItem {
51 public:
52 RowItem(int id, int pos, int row)
53 : id_(id), pos_(pos), rownumber_(row)
56 /// paragraph id
57 int id() const {
58 return id_;
61 /// set paragraph position
62 void pos(int p) {
63 pos_ = p;
66 /// paragraph position
67 int pos() const {
68 return pos_;
71 /// row number
72 int rownumber() const {
73 return rownumber_;
75 private:
76 int id_;
77 int pos_;
78 int rownumber_;
80 ///
81 typedef std::list<RowItem> RowList;
82 private:
83 /// number of lines
84 unsigned int count;
85 /// container of id/pos <=> row mapping
86 RowList rowlist;
87 /// Last paragraph
88 int lastid;
89 /// Last position
90 int lastpos;
93 #endif // TEXROW_H