Introducing FontList::hasChangeInRange()

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21067 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-10-19 15:30:54 +00:00
parent db997edc21
commit 65b3790153
3 changed files with 23 additions and 11 deletions

View File

@ -211,4 +211,20 @@ Font_size FontList::highestInRange
return maxsize;
}
bool FontList::hasChangeInRange(pos_type pos, int len) const
{
// FIXME: can't we use fontIterator(pos) instead?
const_iterator cit = list_.begin();
const_iterator end = list_.end();
for (; cit != end; ++cit) {
if (cit->pos() >= pos)
break;
}
if (cit != end && pos + len - 1 > cit->pos())
return false;
return true;
}
} // namespace lyx

View File

@ -103,6 +103,12 @@ public:
Font_size def_size
) const;
/// is there a font change in middle of the word?
bool hasChangeInRange(
pos_type pos, ///< position in the paragraph.
int len ///< length of the range to check.
) const;
private:
///
List list_;

View File

@ -600,17 +600,7 @@ bool Paragraph::Private::isTextAt(string const & str, pos_type pos) const
return false;
}
// is there a font change in middle of the word?
FontList::const_iterator cit = fontlist_.begin();
FontList::const_iterator end = fontlist_.end();
for (; cit != end; ++cit) {
if (cit->pos() >= pos)
break;
}
if (cit != end && pos + len - 1 > cit->pos())
return false;
return true;
return fontlist_.hasChangeInRange(pos, len);
}