本文整理汇总了C++中DocIterator::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ DocIterator::empty方法的具体用法?C++ DocIterator::empty怎么用?C++ DocIterator::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocIterator
的用法示例。
在下文中一共展示了DocIterator::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintMisspelledMark
void RowPainter::paintMisspelledMark(Row::Element const & e) const
{
if (e.font.fontInfo().nospellcheck() == FONT_ON)
return;
// if changed the misspelled marker gets placed slightly lower than normal
// to avoid drawing at the same vertical offset
FontMetrics const & fm = theFontMetrics(e.font);
int const thickness = max(fm.lineWidth(), 2);
int const y = yo_ + pi_.base.solidLineOffset() + pi_.base.solidLineThickness()
+ (e.change.changed() ? pi_.base.solidLineThickness() + 1 : 0)
+ 1 + thickness / 2;
//FIXME: this could be computed only once, it is probably not costly.
// check for cursor position
// don't draw misspelled marker for words at cursor position
// we don't want to disturb the process of text editing
DocIterator const nw = pi_.base.bv->cursor().newWord();
pos_type cpos = -1;
if (!nw.empty() && par_.id() == nw.paragraph().id()) {
cpos = nw.pos();
if (cpos > 0 && cpos == par_.size() && !par_.isWordSeparator(cpos-1))
--cpos;
else if (cpos > 0 && par_.isWordSeparator(cpos))
--cpos;
}
pos_type pos = e.pos;
while (pos < e.pos + pos_type(e.str.length())) {
if (!par_.isMisspelled(pos)) {
++pos;
continue;
}
FontSpan const & range = par_.getSpellRange(pos);
// Skip element which are being edited
if (range.contains(cpos)) {
// the range includes the last element
pos = range.last + 1;
continue;
}
int x1 = fm.pos2x(e.str, range.first - e.pos,
e.isRTL(), e.extra);
int x2 = fm.pos2x(e.str, min(range.last - e.pos + 1,
pos_type(e.str.length())),
e.isRTL(), e.extra);
if (x1 > x2)
swap(x1, x2);
pi_.pain.line(int(x_ + x1), y, int(x_ + x2), y,
Color_error,
Painter::line_onoffdash, thickness);
pos = range.last + 1;
}
}