Hyperlink::Hyperlink (const vector<Run>& runs) { for (size_t i = 0; i < runs.size(); ++i) { textRuns.push_back(ParagraphItem(runs[i])); } }
void Hyperlink::BuildUrlRuns() const { std::wstring text; specialRuns.clear(); text.push_back( TextMark::FieldBeginMark ); ASCDocFileFormat::Run fieldBeginRun( ASCDocFileFormat::Text( text.c_str() ) ); fieldBeginRun.AddProperty( (short)DocFileFormat::sprmCFSpec, (void*)&CFSpec ); text = wstring( _T( " HYPERLINK" ) ); if ( !url.empty() ) { text += wstring( _T( " \"" ) ); text += url; text.push_back( _T( '"' ) ); text.push_back( _T( ' ' ) ); } if ( !locationInTheFile.empty() ) { text += wstring( _T( " \\l \"" ) ); text += locationInTheFile; text.push_back( _T( '"' ) ); } ASCDocFileFormat::Run specialRun (ASCDocFileFormat::Text(text.c_str())); text.clear(); text.push_back( TextMark::FieldSeparator ); ASCDocFileFormat::Run fieldSeperatorRun( ASCDocFileFormat::Text( text.c_str() ) ); fieldSeperatorRun.AddProperty( (short)DocFileFormat::sprmCFSpec, (void*)&CFSpec ); text.clear(); text.push_back( TextMark::FieldEndMark ); ASCDocFileFormat::Run fieldEndRun( ASCDocFileFormat::Text( text.c_str() ) ); fieldEndRun.AddProperty( (short)DocFileFormat::sprmCFSpec, (void*)&CFSpec ); specialRuns.push_back( ParagraphItem( fieldBeginRun ) ); specialRuns.push_back( ParagraphItem( specialRun ) ); specialRuns.push_back( ParagraphItem( fieldSeperatorRun ) ); specialRuns.push_back( ParagraphItem( fieldEndRun ) ); }
void Paragraph::fromXML(const XML::XNode& node) { const XML::XElement element(node); Property = element.element("pPr"); for (XML::const_element_iterator i = element.Elements.begin(); i != element.Elements.end(); ++i) { const XML::XElement element(*i); if (element.XName == "r" || element.XName == "hyperlink" || element.XName == "bookmarkStart" || element.XName == "bookmarkEnd" || element.XName == "fldSimple" || element.XName == "ins" || element.XName == "del") { Items->push_back(ParagraphItem(*i)); } } }
void Hyperlink::AddRun( const Run& _run ) { textRuns.push_back( ParagraphItem( _run ) ); }