本文整理汇总了C++中ZLTextWordCursor::isStartOfParagraph方法的典型用法代码示例。如果您正苦于以下问题:C++ ZLTextWordCursor::isStartOfParagraph方法的具体用法?C++ ZLTextWordCursor::isStartOfParagraph怎么用?C++ ZLTextWordCursor::isStartOfParagraph使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZLTextWordCursor
的用法示例。
在下文中一共展示了ZLTextWordCursor::isStartOfParagraph方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findStart
ZLTextWordCursor ZLTextAreaController::findStart(const ZLTextWordCursor &end, SizeUnit unit, int size) {
ZLTextWordCursor start = end;
size -= paragraphHeight(start, true, unit);
bool positionChanged = !start.isStartOfParagraph();
start.moveToParagraphStart();
while (size > 0) {
if (positionChanged && start.paragraphCursor().isEndOfSection()) {
break;
}
if (!start.previousParagraph()) {
break;
}
if (!start.paragraphCursor().isEndOfSection()) {
positionChanged = true;
}
size -= paragraphHeight(start, false, unit);
}
skip(start, unit, -size);
if (unit != LINE_UNIT) {
bool sameStart = start == end;
if (!sameStart && start.isEndOfParagraph() && end.isStartOfParagraph()) {
ZLTextWordCursor startCopy = start;
startCopy.nextParagraph();
sameStart = startCopy == end;
}
if (sameStart) {
start = findStart(end, LINE_UNIT, 1);
}
}
return start;
}
示例2: isEnabled
bool ScrollToHomeAction::isEnabled() const {
if (!isVisible()) {
return false;
}
ZLTextWordCursor cursor = FBReader::Instance().bookTextView().textArea().startCursor();
return cursor.isNull() || !cursor.isStartOfParagraph() || !cursor.paragraphCursor().isFirst();
}
示例3: processTextLine
ZLTextLineInfoPtr ZLTextView::processTextLine(const ZLTextWordCursor &start, const ZLTextWordCursor &end) {
const bool useHyphenator =
ZLTextStyleCollection::instance().baseStyle().AutoHyphenationOption.value();
ZLTextLineInfoPtr infoPtr = new ZLTextLineInfo(start, myStyle.textStyle());
std::set<ZLTextLineInfoPtr>::const_iterator it = myLineInfoCache.find(infoPtr);
if (it != myLineInfoCache.end()) {
const ZLTextLineInfoPtr &storedInfo = *it;
myStyle.applyControls(storedInfo->Start, storedInfo->End);
return storedInfo;
}
ZLTextLineInfo &info = *infoPtr;
ZLTextWordCursor current = start;
const ZLTextParagraphCursor ¶graphCursor = current.paragraphCursor();
const bool isFirstLine = current.isStartOfParagraph();
if (paragraphCursor.paragraph().kind() == ZLTextParagraph::TREE_PARAGRAPH) {
info.NodeInfo = new ZLTextTreeNodeInfo();
ZLTextTreeNodeInfo &nodeInfo = *info.NodeInfo;
const ZLTextTreeParagraph &treeParagraph = (const ZLTextTreeParagraph&)paragraphCursor.paragraph();
nodeInfo.IsLeaf = treeParagraph.children().empty();
nodeInfo.IsOpen = treeParagraph.isOpen();
nodeInfo.IsFirstLine = isFirstLine;
nodeInfo.ParagraphNumber = paragraphCursor.index();
nodeInfo.VerticalLinesStack.reserve(treeParagraph.depth() - 1);
if (treeParagraph.depth() > 1) {
const ZLTextTreeParagraph *ctp = treeParagraph.parent();
nodeInfo.VerticalLinesStack.push_back(ctp->children().back() != &treeParagraph);
for (int i = 1; i < treeParagraph.depth() - 1; ++i) {
const ZLTextTreeParagraph *parent = ctp->parent();
nodeInfo.VerticalLinesStack.push_back(ctp != parent->children().back());
ctp = parent;
}
}
}
if (isFirstLine) {
ZLTextElement::Kind elementKind = paragraphCursor[current.wordNumber()].kind();
while ((elementKind == ZLTextElement::CONTROL_ELEMENT) ||
(elementKind == ZLTextElement::FORCED_CONTROL_ELEMENT)) {
const ZLTextElement &element = paragraphCursor[current.wordNumber()];
switch (elementKind) {
case ZLTextElement::CONTROL_ELEMENT:
myStyle.applyControl((const ZLTextControlElement&)element);
break;
case ZLTextElement::FORCED_CONTROL_ELEMENT:
myStyle.applyControl((const ZLTextForcedControlElement&)element);
break;
default:
break;
}
current.nextWord();
if (current.equalWordNumber(end)) {
break;
}
elementKind = paragraphCursor[current.wordNumber()].kind();
}
info.StartStyle = myStyle.textStyle();
info.RealStart = current;
}
ZLTextStylePtr storedStyle = myStyle.textStyle();
info.LeftIndent = myStyle.textStyle()->leftIndent();
if (isFirstLine) {
info.LeftIndent += myStyle.textStyle()->firstLineIndentDelta();
}
if (!info.NodeInfo.isNull()) {
info.LeftIndent += (myStyle.context().stringHeight() + 2) / 3 * 4 * (info.NodeInfo->VerticalLinesStack.size() + 1);
}
info.Width = info.LeftIndent;
if (info.RealStart.equalWordNumber(end)) {
info.End = info.RealStart;
return infoPtr;
}
ZLTextPartialInfo newInfo(info, current);
bool allowBreakAtNBSpace = true;
const int maxWidth = viewWidth() - myStyle.textStyle()->rightIndent();
bool wordOccured = false;
int lastSpaceWidth = 0;
int removeLastSpace = false;
ZLTextElement::Kind elementKind = paragraphCursor[newInfo.End.wordNumber()].kind();
bool breakedAtFirstWord = false;
do {
const ZLTextElement &element = paragraphCursor[newInfo.End.wordNumber()];
newInfo.Width += myStyle.elementWidth(element, newInfo.End.charNumber());
newInfo.Height = std::max(newInfo.Height, myStyle.elementHeight(element));
newInfo.Descent = std::max(newInfo.Descent, myStyle.elementDescent(element));
switch (elementKind) {
case ZLTextElement::CONTROL_ELEMENT:
myStyle.applyControl((const ZLTextControlElement&)element);
break;
case ZLTextElement::FORCED_CONTROL_ELEMENT:
//.........这里部分代码省略.........