- /* ok, move to the beginning of the footnote. */
- while (cursor.par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE)
- cursor.par(cursor.par()->previous());
-
- SetCursor(bview, cursor.par(), cursor.par()->Last());
- /* this is just faster than using CursorLeft(); */
-
- firsttmppar = cursor.par()->ParFromPos(cursor.pos());
- tmppar = firsttmppar;
- /* tmppar is now the paragraph right before the footnote */
-
- bool first_footnote_par_is_not_empty = tmppar->next_->size();
-
- while (tmppar->next_
- && tmppar->next_->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) {
- tmppar = tmppar->next_; /* I use next instead of Next(),
- * because there cannot be any
- * footnotes in a footnote
- * environment */
- tmppar->footnoteflag = LyXParagraph::NO_FOOTNOTE;
-
- /* remember the captions and empty paragraphs */
- if ((textclasslist.Style(bview->buffer()->params.textclass,
- tmppar->GetLayout())
- .labeltype == LABEL_SENSITIVE)
- || !tmppar->Last())
- tmppar->SetLayout(bview->buffer()->params, 0);
- }
-
- // now we will paste the ex-footnote, if the layouts allow it
- // first restore the layout of the paragraph right behind
- // the footnote
- if (tmppar->next_)
- tmppar->next_->MakeSameLayout(cursor.par());
-
- // first the end
- if (!tmppar->GetLayout()
- || (tmppar->next()
- && (!tmppar->next()->Last()
- || tmppar->next()->HasSameLayout(tmppar)))) {
- if (tmppar->next()->Last()
- && tmppar->next()->IsLineSeparator(0))
- tmppar->next()->Erase(0);
- tmppar->PasteParagraph(bview->buffer()->params);
- }
-
- tmppar = tmppar->next(); /* make sure tmppar cannot be touched
- * by the pasting of the beginning */
-
- /* then the beginning */
- /* if there is no space between the text and the footnote, so we insert
- * a blank
- * (only if the previous par and the footnotepar are not empty!) */
- if (!firsttmppar->next_->GetLayout()
- || firsttmppar->HasSameLayout(firsttmppar->next_)) {
- if (firsttmppar->size()
- && !firsttmppar->IsSeparator(firsttmppar->size() - 1)
- && first_footnote_par_is_not_empty) {
- firsttmppar->next_->InsertChar(0, ' ');
- }
- firsttmppar->PasteParagraph(bview->buffer()->params);
- }
-
- /* now redo the paragaphs */
- RedoParagraphs(bview, cursor, tmppar);
-
- SetCursor(bview, cursor.par(), cursor.pos());
-
- /* sometimes it can happen, that there is a counter change */
- Row * row = cursor.row();
- while (row->next() && row->par() != tmppar && row->next()->par() != tmppar)
- row = row->next();
- UpdateCounters(bview, row);
-
-
- ClearSelection(bview);
-}
-#endif
-
-
-/* the DTP switches for paragraphs. LyX will store them in the
-* first physicla paragraph. When a paragraph is broken, the top settings
-* rest, the bottom settings are given to the new one. So I can make shure,
-* they do not duplicate themself and you cannnot make dirty things with
-* them! */
-
-void LyXText::SetParagraph(BufferView * bview,