Consider the case where there is not any layout name.
[lyx.git] / src / texrow.h
blobba80acb58a47135ad8aa04dabbd25536028ad5f7
1 // -*- C++ -*-
2 /**
3 * \file texrow.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Matthias Ettrich
8 * \author Lars Gullik Bjønnes
9 * \author John Levon
11 * Full author contact details are available in file CREDITS.
14 #ifndef TEXROW_H
15 #define TEXROW_H
17 #include <list>
20 /// Represents the correspondence between paragraphs and the generated LaTeX file
21 class TexRow {
22 public:
23 ///
24 TexRow() : count(0), lastid(-1), lastpos(-1) {}
26 TexRow & operator+= (TexRow const &);
28 /// Clears structure
29 void reset();
31 /// Define what paragraph and position the next row will represent
32 void start(int id, int pos);
34 /// Insert node when line is completed
35 void newline();
37 /**
38 * getIdFromRow - find pid and position for a given row
39 * @param row row number to find
40 * @param id set to id if found
41 * @param pos set to paragraph position if found
42 * @return true if found, false otherwise
44 * If the row could not be found, pos is set to zero and
45 * id is set to -1
47 bool getIdFromRow(int row, int & id, int & pos) const;
49 /// Returns the number of rows contained
50 int rows() const { return count; }
52 /// an individual id/pos <=> row mapping
53 class RowItem {
54 public:
55 RowItem(int id, int pos, int row)
56 : id_(id), pos_(pos), rownumber_(row)
59 /// paragraph id
60 int id() const {
61 return id_;
64 /// set paragraph position
65 void pos(int p) {
66 pos_ = p;
69 /// paragraph position
70 int pos() const {
71 return pos_;
74 /// row number
75 int rownumber() const {
76 return rownumber_;
78 private:
79 int id_;
80 int pos_;
81 int rownumber_;
83 ///
84 typedef std::list<RowItem> RowList;
85 private:
86 /// number of lines
87 unsigned int count;
88 /// container of id/pos <=> row mapping
89 RowList rowlist;
90 /// Last paragraph
91 int lastid;
92 /// Last position
93 int lastpos;
96 #endif // TEXROW_H