void InsetText::appendParagraphs(ParagraphList & plist) { // There is little we can do here to keep track of changes. // As of 2006/10/20, appendParagraphs is used exclusively by // LyXTabular::setMultiColumn. In this context, the paragraph break // is lost irreversibly and the appended text doesn't really change ParagraphList & pl = paragraphs(); ParagraphList::iterator pit = plist.begin(); ParagraphList::iterator ins = pl.insert(pl.end(), *pit); ++pit; mergeParagraph(buffer().params(), pl, distance(pl.begin(), ins) - 1); for_each(pit, plist.end(), bind(&ParagraphList::push_back, ref(pl), _1)); }
static void getParagraphList(DocRange const & range, ParagraphList & pars) { // Clone the paragraphs within the selection. pit_type startpit = range.from.pit(); pit_type endpit = range.to.pit(); ParagraphList const & ps_ = range.text()->paragraphs(); ParagraphList tmp_pars(next(ps_.begin(), startpit), next(ps_.begin(), endpit + 1)); // Remove the end of the last paragraph; afterwards, remove the // beginning of the first paragraph. Keep this order - there may only // be one paragraph! Paragraph & back = tmp_pars.back(); back.eraseChars(range.to.pos(), back.size(), false); Paragraph & front = tmp_pars.front(); front.eraseChars(0, range.from.pos(), false); pars.insert(pars.begin(), tmp_pars.begin(), tmp_pars.end()); }