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
11 * Full author contact details are available in file CREDITS.
17 #include "support/debug.h"
26 typedef void const * uid_type;
28 /// Represents the correspondence between paragraphs and the generated
34 TexRow(bool enable = true)
35 : lastid(-1), lastpos(-1), started(false), enabled_(enable) {}
38 /// TexRow is often computed to be immediately discarded. Set enable to
39 /// false if texrow is not needed
40 void reset(bool enable = true);
42 /// Define what paragraph and position the next row will represent
43 void start(int id, int pos);
45 /// Insert node when line is completed
48 /// Insert multiple nodes when zero or more lines are completed
49 void newlines(int num_lines);
51 /// Call when code generation is complete
55 * getIdFromRow - find pid and position for a given row
56 * @param row row number to find
57 * @param id set to id if found
58 * @param pos set to paragraph position if found
59 * @return true if found, false otherwise
61 * If the row could not be found, pos is set to zero and
64 bool getIdFromRow(int row, int & id, int & pos) const;
66 /// Finds the best pair of rows for dit
67 /// returns (-1,-1) if not found.
68 std::pair<int,int> rowFromDocIterator(DocIterator const & dit) const;
70 /// Returns the number of rows contained
71 int rows() const { return rowlist.size(); }
73 /// an individual id/pos <=> row mapping
76 RowItem(int id, int pos)
81 int id() const { return id_; }
82 /// set paragraph position
83 void pos(int p) { pos_ = p; }
84 /// paragraph position
85 int pos() const { return pos_; }
92 typedef std::vector<RowItem> RowList;
94 /// container of id/pos <=> row mapping
100 /// Is id/pos already registered for current row?
106 LyXErr & operator<<(LyXErr &, TexRow &);