3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "insettext.h"
14 #include "insetnewline.h"
17 #include "bufferparams.h"
18 #include "BufferView.h"
19 #include "CutAndPaste.h"
22 #include "dispatchresult.h"
23 #include "errorlist.h"
24 #include "funcrequest.h"
32 #include "metricsinfo.h"
33 #include "output_docbook.h"
34 #include "output_latex.h"
35 #include "output_linuxdoc.h"
36 #include "output_plaintext.h"
37 #include "paragraph.h"
38 #include "paragraph_funcs.h"
39 #include "ParagraphParameters.h"
40 #include "rowpainter.h"
45 #include "frontends/Alert.h"
46 #include "frontends/font_metrics.h"
47 #include "frontends/LyXView.h"
48 #include "frontends/Painter.h"
50 #include "support/lyxalgo.h" // lyx::count
52 #include <boost/bind.hpp>
54 using bv_funcs::replaceSelection;
58 using lyx::graphics::PreviewLoader;
60 using lyx::support::isStrUnsignedInt;
61 using lyx::support::strToUnsignedInt;
72 InsetText::InsetText(BufferParams const & bp)
75 autoBreakRows_(false),
77 frame_color_(LColor::insetframe),
78 text_(0, this, true, paragraphs)
80 textwidth_ = 0; // broken
81 paragraphs.begin()->layout(bp.getLyXTextClass().defaultLayout());
82 if (bp.tracking_changes)
83 paragraphs.begin()->trackChanges();
88 InsetText::InsetText(InsetText const & in)
90 text_(in.text_.bv_owner, this, true, paragraphs)
97 void InsetText::operator=(InsetText const & in)
99 UpdatableInset::operator=(in);
100 paragraphs = in.paragraphs;
101 autoBreakRows_ = in.autoBreakRows_;
102 drawFrame_ = in.drawFrame_;
103 frame_color_ = in.frame_color_;
104 textwidth_ = in.textwidth_;
105 text_ = LyXText(in.text_.bv_owner, this, true, paragraphs);
110 void InsetText::init()
112 ParagraphList::iterator pit = paragraphs.begin();
113 ParagraphList::iterator end = paragraphs.end();
114 for (; pit != end; ++pit)
115 pit->setInsetOwner(this);
116 text_.paragraphs_ = ¶graphs;
119 in_insetAllowed = false;
125 void InsetText::clear(bool just_mark_erased)
127 if (just_mark_erased) {
128 ParagraphList::iterator it = paragraphs.begin();
129 ParagraphList::iterator end = paragraphs.end();
130 for (; it != end; ++it)
135 // This is a gross hack...
136 LyXLayout_ptr old_layout = paragraphs.begin()->layout();
139 paragraphs.push_back(Paragraph());
140 paragraphs.begin()->setInsetOwner(this);
141 paragraphs.begin()->layout(old_layout);
145 auto_ptr<InsetBase> InsetText::clone() const
147 return auto_ptr<InsetBase>(new InsetText(*this));
151 void InsetText::write(Buffer const & buf, ostream & os) const
154 writeParagraphData(buf, os);
158 void InsetText::writeParagraphData(Buffer const & buf, ostream & os) const
160 ParagraphList::const_iterator it = paragraphs.begin();
161 ParagraphList::const_iterator end = paragraphs.end();
162 Paragraph::depth_type dth = 0;
163 for (; it != end; ++it) {
164 it->write(buf, os, buf.params(), dth);
169 void InsetText::read(Buffer const & buf, LyXLex & lex)
172 Paragraph::depth_type depth = 0;
176 #warning John, look here. Doesnt make much sense.
177 if (buf.params().tracking_changes)
178 paragraphs.begin()->trackChanges();
180 // delete the initial paragraph
181 Paragraph oldpar = *paragraphs.begin();
183 ParagraphList::iterator pit = paragraphs.begin();
187 token = lex.getString();
190 if (token == "\\end_inset") {
194 if (token == "\\end_document") {
195 lex.printError("\\end_document read in inset! Error in document!");
200 const_cast<Buffer&>(buf).readParagraph(lex, token, paragraphs, pit, depth);
203 pit = paragraphs.begin();
204 ParagraphList::iterator const end = paragraphs.end();
205 for (; pit != end; ++pit)
206 pit->setInsetOwner(this);
208 if (token != "\\end_inset") {
209 lex.printError("Missing \\end_inset at this point. "
214 // ensure we have at least one par.
215 if (paragraphs.empty())
216 paragraphs.push_back(oldpar);
220 void InsetText::metrics(MetricsInfo & mi, Dimension & dim) const
222 //lyxerr << "InsetText::metrics: width: " << mi.base.textwidth << endl;
223 textwidth_ = max(40, mi.base.textwidth - 30);
224 BufferView * bv = mi.base.bv;
226 text_.metrics(mi, dim);
227 dim.asc += TEXT_TO_INSET_OFFSET;
228 dim.des += TEXT_TO_INSET_OFFSET;
229 dim.wid += 2 * TEXT_TO_INSET_OFFSET;
234 int InsetText::textWidth() const
240 void InsetText::draw(PainterInfo & pi, int x, int y) const
242 // update our idea of where we are. Clearly, we should
243 // not have to know this information.
247 int const start_x = x;
249 BufferView * bv = pi.base.bv;
250 Painter & pain = pi.pain;
252 // repaint the background if needed
253 if (backgroundColor() != LColor::background)
254 clearInset(bv, start_x + TEXT_TO_INSET_OFFSET, y);
261 x += TEXT_TO_INSET_OFFSET;
263 paintTextInset(*bv, text_, x, y);
265 if (drawFrame_ == ALWAYS || drawFrame_ == LOCKED)
266 drawFrame(pain, start_x);
270 void InsetText::drawFrame(Painter & pain, int x) const
272 int const ttoD2 = TEXT_TO_INSET_OFFSET / 2;
273 int const frame_x = x + ttoD2;
274 int const frame_y = yo_ - dim_.asc + ttoD2;
275 int const frame_w = dim_.wid - TEXT_TO_INSET_OFFSET;
276 int const frame_h = dim_.asc + dim_.des - TEXT_TO_INSET_OFFSET;
277 pain.rectangle(frame_x, frame_y, frame_w, frame_h, frameColor());
281 void InsetText::updateLocal(BufferView * bv, bool /*mark_dirty*/)
286 if (!autoBreakRows_ && paragraphs.size() > 1)
287 collapseParagraphs(bv);
289 if (!text_.selection.set())
290 text_.selection.cursor = text_.cursor;
294 bv->owner()->view_state_changed();
295 bv->owner()->updateMenubar();
296 bv->owner()->updateToolbar();
297 if (old_par != text_.cursor.par()) {
298 bv->owner()->setLayout(cpar()->layout()->name());
299 old_par = text_.cursor.par();
304 string const InsetText::editMessage() const
306 return _("Opened Text Inset");
310 void InsetText::sanitizeEmptyText(BufferView * bv)
312 if (paragraphs.size() == 1
313 && paragraphs.begin()->empty()
314 && bv->getParentLanguage(this) != text_.current_font.language()) {
315 LyXFont font(LyXFont::ALL_IGNORE);
316 font.setLanguage(bv->getParentLanguage(this));
317 setFont(bv, font, false);
322 extern LCursor theTempCursor;
324 void InsetText::lfunMousePress(FuncRequest const & cmd)
326 lyxerr << "InsetText::lfunMousePress, inset: " << this << endl;
329 // use this to check mouse motion for selection
333 BufferView * bv = cmd.view();
334 no_selection = false;
335 text_.clearSelection();
338 bv->cursor() = theTempCursor;
339 lyxerr << "new global cursor: \n" << bv->cursor() << endl;
340 text_.setCursorFromCoordinates(cmd.x, cmd.y);
344 void InsetText::lfunMouseMotion(FuncRequest const & cmd)
346 lyxerr << "InsetText::lfunMouseMotion, inset: " << this << endl;
347 if (no_selection || (mouse_x == cmd.x && mouse_y == cmd.y))
350 BufferView * bv = cmd.view();
351 LyXCursor cur = text_.cursor;
352 text_.setCursorFromCoordinates(cmd.x, cmd.y + dim_.asc);
353 bv->x_target(text_.cursor.x());
354 if (cur != text_.cursor) {
355 text_.setSelection();
356 updateLocal(bv, false);
361 void InsetText::lfunMouseRelease(FuncRequest const &)
363 lyxerr << "InsetText::lfunMouseRelease, inset: " << this << endl;
368 void InsetText::edit(BufferView * bv, bool left)
370 lyxerr << "InsetText: edit left/right" << endl;
376 text_.setCursorIntern(0, 0);
378 text_.setCursor(paragraphs.size() - 1, paragraphs.back().size());
380 sanitizeEmptyText(bv);
381 updateLocal(bv, false);
382 bv->updateParagraphDialog();
386 void InsetText::edit(BufferView * bv, int x, int y)
388 lyxerr << "InsetText::edit xy" << endl;
390 sanitizeEmptyText(bv);
391 text_.setCursorFromCoordinates(x, y + dim_.asc);
392 text_.cursor.x(text_.cursor.x());
393 bv->x_target(text_.cursor.x());
395 text_.clearSelection();
398 updateLocal(bv, false);
399 bv->updateParagraphDialog();
403 DispatchResult InsetText::priv_dispatch(FuncRequest const & cmd,
404 idx_type &, pos_type &)
406 lyxerr << "InsetText::priv_dispatch (begin), act: "
407 << cmd.action << " " << endl;
408 BufferView * bv = cmd.view();
410 DispatchResult result;
411 result.dispatched(true);
413 bool was_empty = paragraphs.begin()->empty() && paragraphs.size() == 1;
414 if (cmd.action != LFUN_MOUSE_PRESS
415 && cmd.action != LFUN_MOUSE_MOTION
416 && cmd.action != LFUN_MOUSE_RELEASE)
417 no_selection = false;
419 switch (cmd.action) {
420 case LFUN_MOUSE_PRESS:
422 result = DispatchResult(true, true);
425 case LFUN_MOUSE_MOTION:
426 lfunMouseMotion(cmd);
427 result = DispatchResult(true, true);
430 case LFUN_MOUSE_RELEASE:
431 lfunMouseRelease(cmd);
432 result = DispatchResult(true, true);
435 case LFUN_SELFINSERT:
436 if (bv->buffer()->isReadonly()) {
437 // setErrorMessage(N_("Document is read only"));
440 if (!cmd.argument.empty()) {
441 /* Automatically delete the currently selected
442 * text and replace it with what is being
443 * typed in now. Depends on lyxrc settings
444 * "auto_region_delete", which defaults to
447 // This should not be needed here and is also WRONG!
448 recordUndo(bv, Undo::INSERT, text_.cursorPar());
452 if (lyxrc.auto_region_delete && text_.selection.set())
453 text_.cutSelection(false, false);
454 text_.clearSelection();
456 for (string::size_type i = 0; i < cmd.argument.length(); ++i)
457 bv->owner()->getIntl().getTransManager().
458 TranslateAndInsert(cmd.argument[i], &text_);
460 text_.selection.cursor = text_.cursor;
461 result.dispatched(true);
466 result = moveRight(bv);
472 result = moveLeft(bv);
477 result = moveDown(bv);
486 if (crow() == text_.firstRow()) {
487 result.val(FINISHED_UP);
489 text_.cursorPrevious();
490 text_.clearSelection();
491 result.dispatched(true);
496 if (crow() == text_.lastRow()) {
497 result.val(FINISHED_DOWN);
500 text_.clearSelection();
501 result.dispatched(true);
506 if (text_.selection.set())
507 text_.cutSelection(true, false);
510 #warning should be also set dispatched here?
515 if (text_.selection.set())
516 text_.cutSelection(true, false);
519 #warning should be also set dispatched here?
524 if (!autoBreakRows_) {
525 if (CutAndPaste::nrOfParagraphs() > 1) {
527 #warning FIXME horrendously bad UI
529 Alert::error(_("Paste failed"),
530 _("Cannot include more than one paragraph."));
533 replaceSelection(bv->getLyXText());
534 size_t sel_index = 0;
535 string const & arg = cmd.argument;
536 if (isStrUnsignedInt(arg)) {
537 #warning FIXME Check if the arg is in the domain of available selections.
538 sel_index = strToUnsignedInt(arg);
540 text_.pasteSelection(sel_index);
542 text_.clearSelection();
543 #warning should be also set dispatched here?
548 case LFUN_BREAKPARAGRAPH:
549 if (!autoBreakRows_) {
550 result.dispatched(true);
553 replaceSelection(bv->getLyXText());
554 text_.breakParagraph(paragraphs, 0);
555 #warning should be also set dispatched here?
560 case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
561 if (!autoBreakRows_) {
562 result.dispatched(true);
565 replaceSelection(bv->getLyXText());
566 text_.breakParagraph(paragraphs, 1);
567 #warning should be also set dispatched here?
572 case LFUN_BREAKLINE: {
573 if (!autoBreakRows_) {
574 result.dispatched(true);
577 replaceSelection(bv->getLyXText());
578 auto_ptr<InsetNewline> ins(new InsetNewline);
579 text_.insertInset(ins.release());
580 #warning should be also set dispatched here?
587 // do not set layouts on non breakable textinsets
588 if (autoBreakRows_) {
589 string cur_layout = cpar()->layout()->name();
591 // Derive layout number from given argument (string)
592 // and current buffer's textclass (number).
593 LyXTextClass const & tclass =
594 bv->buffer()->params().getLyXTextClass();
595 string layout = cmd.argument;
596 bool hasLayout = tclass.hasLayout(layout);
598 // If the entry is obsolete, use the new one instead.
600 string const & obs = tclass[layout]->obsoleted_by();
605 // see if we found the layout number:
607 FuncRequest lf(LFUN_MESSAGE, N_("Layout ") + cmd.argument + N_(" not known"));
608 bv->owner()->dispatch(lf);
612 if (cur_layout != layout) {
614 text_.setLayout(layout);
615 bv->owner()->setLayout(cpar()->layout()->name());
616 #warning should be also set dispatched here?
620 // reset the layout box
621 bv->owner()->setLayout(cpar()->layout()->name());
626 result = text_.dispatch(cmd);
630 /// If the action has deleted all text in the inset, we need to change the
631 // language to the language of the surronding text.
632 if (!was_empty && paragraphs.begin()->empty() &&
633 paragraphs.size() == 1) {
634 LyXFont font(LyXFont::ALL_IGNORE);
635 font.setLanguage(bv->getParentLanguage(this));
636 setFont(bv, font, false);
639 lyxerr << "InsetText::priv_dispatch (end)" << endl;
644 int InsetText::latex(Buffer const & buf, ostream & os,
645 OutputParams const & runparams) const
648 latexParagraphs(buf, paragraphs, os, texrow, runparams);
649 return texrow.rows();
653 int InsetText::plaintext(Buffer const & buf, ostream & os,
654 OutputParams const & runparams) const
656 ParagraphList::const_iterator beg = paragraphs.begin();
657 ParagraphList::const_iterator end = paragraphs.end();
658 ParagraphList::const_iterator it = beg;
659 for (; it != end; ++it)
660 asciiParagraph(buf, *it, os, runparams, it == beg);
662 //FIXME: Give the total numbers of lines
667 int InsetText::linuxdoc(Buffer const & buf, ostream & os,
668 OutputParams const & runparams) const
670 linuxdocParagraphs(buf, paragraphs, os, runparams);
675 int InsetText::docbook(Buffer const & buf, ostream & os,
676 OutputParams const & runparams) const
678 docbookParagraphs(buf, paragraphs, os, runparams);
683 void InsetText::validate(LaTeXFeatures & features) const
685 for_each(paragraphs.begin(), paragraphs.end(),
686 boost::bind(&Paragraph::validate, _1, boost::ref(features)));
690 void InsetText::getCursorPos(BufferView *, int & x, int & y) const
697 int InsetText::insetInInsetY() const
703 void InsetText::fitInsetCursor(BufferView * bv) const
705 LyXFont const font = text_.getFont(cpar(), cpos());
706 int const asc = font_metrics::maxAscent(font);
707 int const desc = font_metrics::maxDescent(font);
708 bv->fitLockedInsetCursor(cx(), cy(), asc, desc);
712 DispatchResult InsetText::moveRight(BufferView * bv)
714 if (text_.cursorPar()->isRightToLeftPar(bv->buffer()->params()))
715 return moveLeftIntern(bv, false, true, false);
717 return moveRightIntern(bv, true, true, false);
721 DispatchResult InsetText::moveLeft(BufferView * bv)
723 if (text_.cursorPar()->isRightToLeftPar(bv->buffer()->params()))
724 return moveRightIntern(bv, true, true, false);
726 return moveLeftIntern(bv, false, true, false);
730 DispatchResult InsetText::moveRightIntern(BufferView * bv, bool front,
731 bool activate_inset, bool selecting)
733 ParagraphList::iterator c_par = cpar();
734 if (boost::next(c_par) == paragraphs.end() && cpos() >= c_par->size())
735 return DispatchResult(false, FINISHED_RIGHT);
736 if (activate_inset && checkAndActivateInset(bv, front))
737 return DispatchResult(true, true);
738 text_.cursorRight(bv);
740 text_.clearSelection();
741 return DispatchResult(true);
745 DispatchResult InsetText::moveLeftIntern(BufferView * bv, bool front,
746 bool activate_inset, bool selecting)
748 if (cpar() == paragraphs.begin() && cpos() <= 0)
749 return DispatchResult(false, FINISHED);
750 text_.cursorLeft(bv);
752 text_.clearSelection();
753 if (activate_inset && checkAndActivateInset(bv, front))
754 return DispatchResult(true, true);
755 return DispatchResult(true);
759 DispatchResult InsetText::moveUp(BufferView * bv)
761 if (crow() == text_.firstRow())
762 return DispatchResult(false, FINISHED_UP);
764 text_.clearSelection();
765 return DispatchResult(true);
769 DispatchResult InsetText::moveDown(BufferView * bv)
771 if (crow() == text_.lastRow())
772 return DispatchResult(false, FINISHED_DOWN);
773 text_.cursorDown(bv);
774 text_.clearSelection();
775 return DispatchResult(true);
779 bool InsetText::insertInset(BufferView * bv, InsetOld * inset)
781 inset->setOwner(this);
782 text_.insertInset(inset);
784 updateLocal(bv, true);
789 bool InsetText::insetAllowed(InsetOld::Code code) const
791 // in_insetAllowed is a really gross hack,
792 // to allow us to call the owner's insetAllowed
793 // without stack overflow, which can happen
794 // when the owner uses InsetCollapsable::insetAllowed()
798 in_insetAllowed = true;
800 ret = owner()->insetAllowed(code);
801 in_insetAllowed = false;
806 bool InsetText::showInsetDialog(BufferView *) const
812 void InsetText::getLabelList(Buffer const & buffer,
813 std::vector<string> & list) const
815 ParagraphList::const_iterator pit = paragraphs.begin();
816 ParagraphList::const_iterator pend = paragraphs.end();
817 for (; pit != pend; ++pit) {
818 InsetList::const_iterator beg = pit->insetlist.begin();
819 InsetList::const_iterator end = pit->insetlist.end();
820 for (; beg != end; ++beg)
821 beg->inset->getLabelList(buffer, list);
826 void InsetText::setFont(BufferView * bv, LyXFont const & font, bool toggleall,
829 if ((paragraphs.size() == 1 && paragraphs.begin()->empty())
830 || cpar()->empty()) {
831 text_.setFont(font, toggleall);
835 if (text_.selection.set())
836 text_.recUndo(text_.cursor.par());
840 text_.selection.cursor = text_.cursor;
841 text_.cursorBottom();
842 text_.setSelection();
845 text_.toggleFree(font, toggleall);
848 text_.clearSelection();
851 updateLocal(bv, true);
855 bool InsetText::checkAndActivateInset(BufferView * bv, bool front)
857 if (cpos() == cpar()->size())
859 InsetOld * inset = cpar()->getInset(cpos());
860 if (!isHighlyEditableInset(inset))
862 inset->edit(bv, front);
863 updateLocal(bv, false);
868 void InsetText::markNew(bool track_changes)
870 ParagraphList::iterator pit = paragraphs.begin();
871 ParagraphList::iterator end = paragraphs.end();
872 for (; pit != end; ++pit) {
876 // no-op when not tracking
883 void InsetText::setText(string const & data, LyXFont const & font)
886 for (unsigned int i = 0; i < data.length(); ++i)
887 paragraphs.begin()->insertChar(i, data[i], font);
891 void InsetText::setAutoBreakRows(bool flag)
893 if (flag != autoBreakRows_) {
894 autoBreakRows_ = flag;
901 void InsetText::setDrawFrame(DrawFrame how)
907 LColor_color InsetText::frameColor() const
909 return LColor::color(frame_color_);
913 void InsetText::setFrameColor(LColor_color col)
919 int InsetText::cx() const
921 return text_.cursor.x() + xo_ + TEXT_TO_INSET_OFFSET;
925 int InsetText::cy() const
927 return text_.cursor.y() - dim_.asc + TEXT_TO_INSET_OFFSET;
931 pos_type InsetText::cpos() const
933 return text_.cursor.pos();
937 ParagraphList::iterator InsetText::cpar() const
939 return text_.cursorPar();
943 RowList::iterator InsetText::crow() const
945 return cpar()->getRow(cpos());
949 void InsetText::setViewCache(BufferView const * bv) const
952 if (bv != text_.bv_owner) {
953 //lyxerr << "setting view cache from "
954 // << text_.bv_owner << " to " << bv << "\n";
955 text_.init(const_cast<BufferView *>(bv));
957 text_.bv_owner = const_cast<BufferView *>(bv);
962 void InsetText::deleteLyXText(BufferView * bv, bool recursive) const
965 /// then remove all LyXText in text-insets
966 for_each(const_cast<ParagraphList&>(paragraphs).begin(),
967 const_cast<ParagraphList&>(paragraphs).end(),
968 boost::bind(&Paragraph::deleteInsetsLyXText, _1, bv));
973 void InsetText::removeNewlines()
975 ParagraphList::iterator it = paragraphs.begin();
976 ParagraphList::iterator end = paragraphs.end();
977 for (; it != end; ++it)
978 for (int i = 0; i < it->size(); ++i)
979 if (it->isNewline(i))
984 int InsetText::scroll(bool /*recursive*/) const
986 return UpdatableInset::scroll(false);
990 void InsetText::clearSelection(BufferView *)
992 text_.clearSelection();
996 void InsetText::clearInset(BufferView * bv, int start_x, int baseline) const
998 Painter & pain = bv->painter();
1000 int h = dim_.asc + dim_.des;
1001 int ty = baseline - dim_.asc;
1007 if (ty + h > pain.paperHeight())
1008 h = pain.paperHeight();
1009 if (xo_ + w > pain.paperWidth())
1010 w = pain.paperWidth();
1011 pain.fillRectangle(start_x + 1, ty + 1, w - 3, h - 1, backgroundColor());
1015 ParagraphList * InsetText::getParagraphs(int i) const
1017 return (i == 0) ? const_cast<ParagraphList*>(¶graphs) : 0;
1021 LyXText * InsetText::getText(int i) const
1023 return (i == 0) ? const_cast<LyXText*>(&text_) : 0;
1027 bool InsetText::checkInsertChar(LyXFont & font)
1029 return owner() ? owner()->checkInsertChar(font) : true;
1033 void InsetText::collapseParagraphs(BufferView * bv)
1035 while (paragraphs.size() > 1) {
1036 ParagraphList::iterator const first = paragraphs.begin();
1037 ParagraphList::iterator second = first;
1039 size_t const first_par_size = first->size();
1041 if (!first->empty() &&
1043 !first->isSeparator(first_par_size - 1)) {
1044 first->insertChar(first_par_size, ' ');
1047 #warning probably broken
1048 if (text_.selection.set()) {
1049 if (text_.selection.start.par() == 1) {
1050 text_.selection.start.par(1);
1051 text_.selection.start.pos(text_.selection.start.pos() + first_par_size);
1053 if (text_.selection.end.par() == 2) {
1054 text_.selection.end.par(1);
1055 text_.selection.end.pos(text_.selection.end.pos() + first_par_size);
1059 mergeParagraph(bv->buffer()->params(), paragraphs, first);
1064 void InsetText::getDrawFont(LyXFont & font) const
1067 owner()->getDrawFont(font);
1071 void InsetText::appendParagraphs(Buffer * buffer, ParagraphList & plist)
1073 #warning FIXME Check if Changes stuff needs changing here. (Lgb)
1074 // And it probably does. You have to take a look at this John. (Lgb)
1075 #warning John, have a look here. (Lgb)
1076 ParagraphList::iterator pit = plist.begin();
1077 ParagraphList::iterator ins = paragraphs.insert(paragraphs.end(), *pit);
1079 mergeParagraph(buffer->params(), paragraphs, boost::prior(ins));
1081 ParagraphList::iterator pend = plist.end();
1082 for (; pit != pend; ++pit)
1083 paragraphs.push_back(*pit);
1087 void InsetText::addPreview(PreviewLoader & loader) const
1089 ParagraphList::const_iterator pit = paragraphs.begin();
1090 ParagraphList::const_iterator pend = paragraphs.end();
1092 for (; pit != pend; ++pit) {
1093 InsetList::const_iterator it = pit->insetlist.begin();
1094 InsetList::const_iterator end = pit->insetlist.end();
1095 for (; it != end; ++it)
1096 it->inset->addPreview(loader);