- buf->cutIntoMinibuffer(current_view->buffer()->params, 0);
- buf->erase(0);
- if (tmppar->insertFromMinibuffer(tmppos))
- ++tmppos;
- }
- }
- delete buf;
- buf = tmpbuf;
- *endpar = tmppar->next();
- pos = tmppos;
- } else
-#endif
- {
- // many paragraphs
-
- // make a copy of the simple cut_buffer
-#if 1
- ParagraphList::iterator it = paragraphs.begin();
-
- ParagraphList simple_cut_clone;
- simple_cut_clone.insert(simple_cut_clone.begin(),
- new Paragraph(*it, false));
-
- ParagraphList::iterator end = paragraphs.end();
- while (boost::next(it) != end) {
- ++it;
- simple_cut_clone.insert(simple_cut_clone.end(),
- new Paragraph(*it, false));
- }
-#else
- // Later we want it done like this:
- ParagraphList simple_cut_clone(paragraphs.begin(),
- paragraphs.end());
-#endif
- // now remove all out of the buffer which is NOT allowed in the
- // new environment and set also another font if that is required
- ParagraphList::iterator tmpbuf = paragraphs.begin();
- int depth_delta = (*par)->params().depth() - tmpbuf->params().depth();
- // Temporary set *par as previous of tmpbuf as we might have
- // to realize the font.
- tmpbuf->previous(*par);
-
- // make sure there is no class difference
- SwitchLayoutsBetweenClasses(textclass, tc, &*tmpbuf,
- current_view->buffer()->params);
-
- Paragraph::depth_type max_depth = (*par)->getMaxDepthAfter();
-
- while (tmpbuf != paragraphs.end()) {
- // If we have a negative jump so that the depth would
- // go below 0 depth then we have to redo the delta to
- // this new max depth level so that subsequent
- // paragraphs are aligned correctly to this paragraph
- // at level 0.
- if ((int(tmpbuf->params().depth()) + depth_delta) < 0)
- depth_delta = 0;
- // set the right depth so that we are not too deep or shallow.
- tmpbuf->params().depth(tmpbuf->params().depth() + depth_delta);
- if (tmpbuf->params().depth() > max_depth)
- tmpbuf->params().depth(max_depth);
- // only set this from the 2nd on as the 2nd depends for maxDepth
- // still on *par
- if (tmpbuf->previous() != (*par))
- max_depth = tmpbuf->getMaxDepthAfter();
- // set the inset owner of this paragraph
- tmpbuf->setInsetOwner((*par)->inInset());
- for (pos_type i = 0; i < tmpbuf->size(); ++i) {
- if (tmpbuf->getChar(i) == Paragraph::META_INSET) {
- if (!(*par)->insetAllowed(tmpbuf->getInset(i)->lyxCode()))
- {
- tmpbuf->erase(i--);
- }
- } else {
- LyXFont f1 = tmpbuf->getFont(current_view->buffer()->params,i);
- LyXFont f2 = f1;
- if (!(*par)->checkInsertChar(f1)) {
- tmpbuf->erase(i--);
- } else if (f1 != f2) {
- tmpbuf->setFont(i, f1);
- }