void WordParagraphReader::Accept(DocumentText::ptr_type docText, const WrdTextRun& textRun, const long startIndex, const std::wcstring& currentText) { if(docText == 0) return; try { std::wcstring bufferText(currentText); std::string::size_type localStartPos = startIndex; AbstractTextNode::id_type baseId(_LL("METADATA_")); baseId += ReaderHelpers::MakeNumberString((TEXT_TYPE_MAIN)); baseId += _LL("_"); if(!bufferText.empty()) { m_currentText.push_back(bufferText); std::wcstring currentParagraphText; while(ReaderHelpers::GetNextStringFromStringList(m_currentText, currentParagraphText, m_iPos)) { AbstractTextNode::id_type id = baseId + ReaderHelpers::MakeNumberString((localStartPos)); id += _LL("_"); id += ReaderHelpers::MakeNumberString((currentParagraphText.size())); localStartPos += currentParagraphText.size(); AbstractTextNode::ptr_type textNode = docText->GetTextNode(id); if(textNode == 0) { textNode = new TextNode(id); textNode->AddAdditionalInfo(docText, _LL("Content"), currentParagraphText, AbstractTextNode::String); } docText->AddTextNode(AbstractTextType::Paragraph, textNode); } } } catch (CsException& ex) { throw std::logic_error("An error occurred reading the paragraph text of the word document : " + ReaderHelpers::ConstructErrorText(ex)); } catch(...) { throw std::logic_error("An unhandled exception occurred while reading the paragraph text of the word document"); } }
void MainWindow::response_echo_data(QByteArray buffer, quint16 bytes_received) { QString bufferText(buffer); ui->statusBar->showMessage(bufferText, 2000); }