3 * Copyright 1995-2002 the LyX Team
4 * Read the file COPYING
6 * \author Matthias Ettrich
14 #include "paragraph.h"
23 /// function object returning true when row number is found
24 class same_rownumber {
26 same_rownumber(int row) : row_(row) {}
27 bool operator()(TexRow::RowList::value_type const & vt) const {
28 return vt.rownumber() == row_;
36 /// increment the pos value of the argument if the par id
37 /// is the same, and the pos parameter is larger
40 increase_pos(int id, int pos)
41 : id_(id), pos_(pos) {}
43 void operator()(TexRow::RowList::value_type & vt) const {
44 if (vt.id() != id_ || vt.pos() >= pos_)
49 << "TeXRow::increasePos: ideally this "
50 "should never happen..." << endl;
52 // FIXME: When verified to work this clause should be deleted.
53 if (id_ == vt.id() && pos_ == vt.pos()) {
55 << "TexRow::increasePos: this should happen "
56 "maximum one time for each run of "
57 "increasePos!" << endl;
78 void TexRow::start(Paragraph * par, int pos)
85 void TexRow::newline()
87 int const id = lastpar ? lastpar->id() : -1;
88 RowList::value_type tmp(id, lastpos, ++count);
89 rowlist.push_back(tmp);
93 bool TexRow::getIdFromRow(int row, int & id, int & pos) const
95 RowList::const_iterator cit =
96 find_if(rowlist.begin(), rowlist.end(),
99 if (cit != rowlist.end()) {
110 void TexRow::increasePos(int id, int pos)
112 for_each(rowlist.begin(), rowlist.end(), increase_pos(id, pos));
116 TexRow & TexRow::operator+=(TexRow const & tr)
118 rowlist.insert(rowlist.end(), tr.rowlist.begin(), tr.rowlist.end());