void DocBookBookReader::endElementHandler(int tag) { switch (tag) { case _SECT1: myReadText = false; popKind(); endContentsParagraph(); insertEndOfSectionParagraph(); break; case _PARA: endParagraph(); break; case _TITLE: endParagraph(); popKind(); endContentsParagraph(); exitTitle(); break; case _EMPHASIS: addControl(EMPHASIS, false); break; case _CITETITLE: addControl(CITE, false); break; case _ULINK: case _EMAIL: addControl(CODE, false); break; case _BLOCKQUOTE: popKind(); break; default: break; } }
void PluckerBookReader::processHeader(FontType font, bool start) { if (start) { enterTitle(); FBTextKind kind; switch (font) { case FT_H1: kind = H1; break; case FT_H2: kind = H2; break; case FT_H3: kind = H3; break; case FT_H4: kind = H4; break; case FT_H5: kind = H5; break; case FT_H6: default: kind = H6; break; } pushKind(kind); } else { popKind(); exitTitle(); } };
bool TxtBookReader::newLineHandler() { if (!myLastLineIsEmpty) { myLineFeedCounter = -1; } myLastLineIsEmpty = true; ++myLineFeedCounter; myNewLine = true; mySpaceCounter = 0; bool paragraphBreak = (myFormat.breakType() & PlainTextFormat::BREAK_PARAGRAPH_AT_NEW_LINE) || ((myFormat.breakType() & PlainTextFormat::BREAK_PARAGRAPH_AT_EMPTY_LINE) && (myLineFeedCounter > 0)); if (myFormat.createContentsTable()) { // if (!myInsideContentsParagraph && (myLineFeedCounter == myFormat.emptyLinesBeforeNewSection() + 1)) { /* Fixed by Hatred: remove '+ 1' for emptyLinesBeforeNewSection, it looks like very strange when we should point count of empty string decrised by 1 in settings dialog */ if (!myInsideContentsParagraph && (myLineFeedCounter == myFormat.emptyLinesBeforeNewSection())) { myInsideContentsParagraph = true; internalEndParagraph(); insertEndOfSectionParagraph(); beginContentsParagraph(); enterTitle(); pushKind(SECTION_TITLE); beginParagraph(); paragraphBreak = false; } if (myInsideContentsParagraph && (myLineFeedCounter == 1)) { exitTitle(); endContentsParagraph(); popKind(); myInsideContentsParagraph = false; paragraphBreak = true; } } if (paragraphBreak) { internalEndParagraph(); beginParagraph(); } return true; }
bool TxtBookReader::newLineHandler() { if (!myLastLineIsEmpty) { myLineFeedCounter = -1; } myLastLineIsEmpty = true; ++myLineFeedCounter; myNewLine = true; mySpaceCounter = 0; bool paragraphBreak = (myFormat.breakType() & PlainTextFormat::BREAK_PARAGRAPH_AT_NEW_LINE) || ((myFormat.breakType() & PlainTextFormat::BREAK_PARAGRAPH_AT_EMPTY_LINE) && (myLineFeedCounter > 0)); if (myFormat.createContentsTable()) { if (!myInsideContentsParagraph && (myLineFeedCounter == myFormat.emptyLinesBeforeNewSection() + 1)) { myInsideContentsParagraph = true; internalEndParagraph(); insertEndOfSectionParagraph(); beginContentsParagraph(); enterTitle(); pushKind(SECTION_TITLE); beginParagraph(); paragraphBreak = false; } if (myInsideContentsParagraph && (myLineFeedCounter == 1)) { exitTitle(); endContentsParagraph(); popKind(); myInsideContentsParagraph = false; paragraphBreak = true; } } if (paragraphBreak) { internalEndParagraph(); beginParagraph(); } return true; }
bool TxtBookReader::newLineHandler() { if (!myLastLineIsEmpty) { myLineFeedCounter = -1; } myLastLineIsEmpty = true; ++myLineFeedCounter; myNewLine = true; mySpaceCounter = 0; bool paragraphBreak = (myFormat.breakType() & PlainTextFormat::BREAK_PARAGRAPH_AT_NEW_LINE) || ((myFormat.breakType() & PlainTextFormat::BREAK_PARAGRAPH_AT_EMPTY_LINE) && (myLineFeedCounter > 0)); if (myFormat.createContentsTable()) { // if (!myInsideContentsParagraph && (myLineFeedCounter == myFormat.emptyLinesBeforeNewSection() + 1)) { /* Fixed by Hatred: remove '+ 1' for emptyLinesBeforeNewSection, it looks like very strange when we should point count of empty string decrised by 1 in settings dialog */ //__android_log_print(ANDROID_LOG_INFO, "love", "!!!!!,,,%d!!!!!!%d", myLineFeedCounter, myFormat.emptyLinesBeforeNewSection()); if (!myInsideContentsParagraph && (myLineFeedCounter >= myFormat.emptyLinesBeforeNewSection())) { myInsideContentsParagraph = true; paragraphBreak = false; } else if (myInsideContentsParagraph && (myLineFeedCounter <= 1)) { exitTitle(); endContentsParagraph(); popKind(); myInsideContentsParagraph = false; paragraphBreak = true; } } if (true) { internalEndParagraph(); beginParagraph(); } return true; }