-void Paragraph::breakParagraph(BufferParams const & bparams,
- Paragraph::size_type pos,
- int flag)
-{
- // create a new paragraph
- Paragraph * tmp = new Paragraph(this);
- // remember to set the inset_owner
- tmp->setInsetOwner(inInset());
-
- // this is an idea for a more userfriendly layout handling, I will
- // see what the users say
-
- // layout stays the same with latex-environments
- if (flag) {
- tmp->setOnlyLayout(layout);
- tmp->setLabelWidthString(params().labelWidthString());
- }
-
- if (size() > pos || !size() || flag == 2) {
- tmp->setOnlyLayout(layout);
- tmp->params().align(params().align());
- tmp->setLabelWidthString(params().labelWidthString());
-
- tmp->params().lineBottom(params().lineBottom());
- params().lineBottom(false);
- tmp->params().pagebreakBottom(params().pagebreakBottom());
- params().pagebreakBottom(false);
- tmp->params().spaceBottom(params().spaceBottom());
- params().spaceBottom(VSpace(VSpace::NONE));
-
- tmp->params().depth(params().depth());
- tmp->params().noindent(params().noindent());
-
- // copy everything behind the break-position
- // to the new paragraph
- size_type pos_end = pimpl_->size() - 1;
- size_type i = pos;
- size_type j = pos;
- for (; i <= pos_end; ++i) {
- cutIntoMinibuffer(bparams, i);
- if (tmp->insertFromMinibuffer(j - pos))
- ++j;
- }
- for (i = pos_end; i >= pos; --i) {
- erase(i);
- }
- }
-
- // just an idea of me
- if (!pos) {
- tmp->params().lineTop(params().lineTop());
- tmp->params().pagebreakTop(params().pagebreakTop());
- tmp->params().spaceTop(params().spaceTop());
- tmp->bibkey = bibkey;
- clear();
- // layout stays the same with latex-environments
- if (flag) {
- setOnlyLayout(tmp->layout);
- setLabelWidthString(tmp->params().labelWidthString());
- params().depth(tmp->params().depth());
- }
- }
-}
-
-