RowList::iterator beginRow(ParagraphList::iterator pit) const;
/// return row "behind" last of par
RowList::iterator endRow(ParagraphList::iterator pit) const;
+ /// return first row of text
+ RowList::iterator firstRow() const;
+ /// return row "behind" last of par
+ RowList::iterator lastRow() const;
+ /// return next row crossing paragraph boundaries
+ RowList::iterator nextRow(RowList::iterator rit) const;
+ /// return previous row crossing paragraph boundaries
+ RowList::iterator previousRow(RowList::iterator rit) const;
private:
/** Cursor related data.
}
// is it a bottom line?
- RowList::iterator next_rit = boost::next(rit);
- if (next_rit == rows().end() || getPar(next_rit) != pit) {
+ if (boost::next(rit) == endRow(pit)) {
// the bottom margin
ParagraphList::iterator nextpit = boost::next(pit);
if (nextpit == ownerParagraphs().end() &&
{
int const ns = numberOfSeparators(*this, pit, rit);
RowList::iterator next_row = boost::next(rit);
- ParagraphList::iterator next_pit;
-
- if (ns && next_row != rowlist_.end() &&
- (next_pit = getPar(next_row)) == pit &&
- !(next_pit->isNewline(next_row->pos() - 1))
- && !(next_pit->isInset(next_row->pos()) &&
- next_pit->getInset(next_row->pos()) &&
- next_pit->getInset(next_row->pos())->display())
+ if (ns
+ && next_row != endRow(pit)
+ && !pit->isNewline(next_row->pos() - 1)
+ && !(pit->isInset(next_row->pos())
+ && pit->getInset(next_row->pos())
+ && pit->getInset(next_row->pos())->display())
) {
fill_separator = w / ns;
} else if (is_rtl) {
RowList::iterator
LyXText::getRow(ParagraphList::iterator pit, pos_type pos) const
{
- if (rows().empty())
- return rowlist_.end();
-
- // find the first row of the specified paragraph
- RowList::iterator rit = rowlist_.begin();
- RowList::iterator end = rowlist_.end();
- while (boost::next(rit) != end && getPar(rit) != pit) {
+ RowList::iterator rit = beginRow(pit);
+ RowList::iterator end = endRow(pit);
+
+#warning Why is this next thing needed? (Andre)
+ while (rit != end
+ && rit->pos() < pos
+ && boost::next(rit) != end
+ && boost::next(rit)->pos() <= pos)
++rit;
- }
-
- // now find the wanted row
- while (rit->pos() < pos
- && boost::next(rit) != end
- && getPar(boost::next(rit)) == pit
- && boost::next(rit)->pos() <= pos) {
- ++rit;
- }
return rit;
}
y = 0;
if (rows().empty())
- return rowlist_.end();
+ return firstRow();
+
+ RowList::iterator beg = beginRow(pit);
+ RowList::iterator end = endRow(pit);
+ RowList::iterator rit;
// find the first row of the specified paragraph
- RowList::iterator rit = rowlist_.begin();
- RowList::iterator end = rowlist_.end();
- while (boost::next(rit) != end && getPar(rit) != pit) {
+ for (rit = firstRow(); rit != beg; rit = nextRow(rit))
y += rit->height();
- ++rit;
- }
// now find the wanted row
- while (rit->pos() < pos
+ while (rit != end
+ && rit->pos() < pos
&& boost::next(rit) != end
- && getPar(boost::next(rit)) == pit
&& boost::next(rit)->pos() <= pos) {
y += rit->height();
++rit;
{
return beginRow(boost::next(pit));
}
+
+
+RowList::iterator LyXText::firstRow() const
+{
+ return rowlist_.begin();
+}
+
+
+RowList::iterator LyXText::lastRow() const
+{
+ return boost::prior(rowlist_.end());
+}
+
+
+RowList::iterator LyXText::nextRow(RowList::iterator rit) const
+{
+ return boost::next(rit);
+}
+
+
+RowList::iterator LyXText::previousRow(RowList::iterator rit) const
+{
+ return boost::prior(rit);
+}
void LyXText::redoParagraph(ParagraphList::iterator pit)
{
-#if 0
- // find first row of given par
- RowList::iterator first;
- for (first = rows().begin(); first != rows().end(); ++first)
- if (getPar(first) == pit)
- break;
-
- // find last row of given par
- RowList::iterator last = first;
- for ( ; last != rows().end() && getPar(last) == pit; ++last)
- ;
-
- Assert(first == beginRow(pit));
- Assert(last == endRow(pit));
-#else
RowList::iterator first = beginRow(pit);
RowList::iterator last = endRow(pit);
-#endif
// remove paragraph from rowlist
while (first != last) {
boundary = false;
// This (rtl_support test) is not needed, but gives
- // some speedup if rtl_support=false
- RowList::iterator next_rit = boost::next(rit);
-
- bool const lastrow = lyxrc.rtl_support &&
- (next_rit == rowlist_.end() || getPar(next_rit) != pit);
+ // some speedup if rtl_support == false
+ bool const lastrow = lyxrc.rtl_support
+ && boost::next(rit) == endRow(pit);
// If lastrow is false, we don't need to compute
// the value of rtl.
? pit->isRightToLeftPar(bv()->buffer()->params)
: false;
if (lastrow &&
- ((rtl && left_side && vc == rit->pos() && x < tmpx - 5) ||
- (!rtl && !left_side && vc == last + 1 && x > tmpx + 5)))
+ ((rtl && left_side && vc == rit->pos() && x < tmpx - 5) ||
+ (!rtl && !left_side && vc == last + 1 && x > tmpx + 5)))
c = last + 1;
else if (vc == rit->pos()) {
c = vis2log(vc);