* de.po: sync with branch.
[lyx.git] / src / TexRow.h
blobda406d08ad20c48a822cc4042390416525029032
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 <vector>
20 namespace lyx {
23 /// Represents the correspondence between paragraphs and the generated
24 /// LaTeX file
26 class TexRow {
27 public:
28 ///
29 TexRow() : lastid(-1), lastpos(-1) {}
31 /// Clears structure
32 void reset();
34 /// Define what paragraph and position the next row will represent
35 void start(int id, int pos);
37 /// Insert node when line is completed
38 void newline();
40 /**
41 * getIdFromRow - find pid and position for a given row
42 * @param row row number to find
43 * @param id set to id if found
44 * @param pos set to paragraph position if found
45 * @return true if found, false otherwise
47 * If the row could not be found, pos is set to zero and
48 * id is set to -1
50 bool getIdFromRow(int row, int & id, int & pos) const;
52 /**
53 * getRowFromIdPos - find row containing a given id and pos
54 * @param id of the paragraph
55 * @param pos a given position in that paragraph
56 * @return the row number within the rowlist
58 int getRowFromIdPos(int id, int pos) const;
60 /// Returns the number of rows contained
61 int rows() const { return rowlist.size(); }
63 /// an individual id/pos <=> row mapping
64 class RowItem {
65 public:
66 RowItem(int id, int pos)
67 : id_(id), pos_(pos)
70 /// paragraph id
71 int id() const { return id_; }
72 /// set paragraph position
73 void pos(int p) { pos_ = p; }
74 /// paragraph position
75 int pos() const { return pos_; }
76 private:
77 RowItem();
78 int id_;
79 int pos_;
81 ///
82 typedef std::vector<RowItem> RowList;
83 private:
84 /// container of id/pos <=> row mapping
85 RowList rowlist;
86 /// Last paragraph
87 int lastid;
88 /// Last position
89 int lastpos;
93 } // namespace lyx
95 #endif // TEXROW_H