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 /// Represents the correspondence between paragraphs and the generated
32 TexRow(bool enable = true)
33 : lastid(-1), lastpos(-1), started(false), enabled_(enable) {}
36 /// TexRow is often computed to be immediately discarded. Set enable to
37 /// false if texrow is not needed
38 void reset(bool enable = true);
40 /// Define what paragraph and position the next row will represent
41 void start(int id, int pos);
43 /// Insert node when line is completed
46 /// Insert multiple nodes when zero or more lines are completed
47 void newlines(int num_lines);
49 /// Call when code generation is complete
53 * getIdFromRow - find pid and position for a given row
54 * @param row row number to find
55 * @param id set to id if found
56 * @param pos set to paragraph position if found
57 * @return true if found, false otherwise
59 * If the row could not be found, pos is set to zero and
62 bool getIdFromRow(int row, int & id, int & pos) const;
64 /// Finds the best pair of rows for dit
65 /// returns (-1,-1) if not found.
66 std::pair<int,int> rowFromDocIterator(DocIterator const & dit) const;
68 /// Returns the number of rows contained
69 int rows() const { return rowlist.size(); }
71 /// an individual id/pos <=> row mapping
74 RowItem(int id, int pos)
79 int id() const { return id_; }
80 /// set paragraph position
81 void pos(int p) { pos_ = p; }
82 /// paragraph position
83 int pos() const { return pos_; }
90 typedef std::vector<RowItem> RowList;
92 /// container of id/pos <=> row mapping
98 /// Is id/pos already registered for current row?
104 LyXErr & operator<<(LyXErr &, TexRow &);