]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph.C
ascii export of paragraphs, fix small compile problem.
[lyx.git] / src / paragraph.C
index bcc3eb9864240f454ecbe1ed5da11cf3df279b7f..76dd07f2b548ffde3e068cead2d1c0c47f682261 100644 (file)
@@ -86,7 +86,7 @@ Paragraph::Paragraph()
        enumdepth = 0;
        itemdepth = 0;
        bibkey = 0; // ale970302
-       clear();
+       params().clear();
 }
 
 
@@ -107,9 +107,8 @@ Paragraph::Paragraph(Paragraph * par)
        previous_->next_ = this;
        // end
 
-       bibkey = 0; // ale970302        
-
-       clear();
+       bibkey = 0; // ale970302
+       params().clear();
 }
 
 
@@ -190,6 +189,11 @@ void Paragraph::writeFile(Buffer const * buf, ostream & os,
        }
        
        // First write the layout
+       string lay = layout();
+       if (lay.empty()) {
+               lay = textclasslist[bparams.textclass].defaultLayoutName();
+       }
+       
        os << "\n\\layout " << layout() << "\n";
        
        // Maybe some vertical spaces.
@@ -472,17 +476,6 @@ bool Paragraph::insertFromMinibuffer(pos_type pos)
 // end of minibuffer
 
 
-
-void Paragraph::clear()
-{
-       params().clear();
-
-       layout_.erase();
-
-       bibkey = 0;
-}
-
-
 void Paragraph::erase(pos_type pos)
 {
        pimpl_->erase(pos);
@@ -859,7 +852,7 @@ void Paragraph::breakParagraph(BufferParams const & bparams,
 {
        // create a new paragraph
        Paragraph * tmp = new Paragraph(this);
-       tmp->layout(layout());
+       tmp->layout(textclasslist[bparams.textclass].defaultLayoutName());
        
        // remember to set the inset_owner
        tmp->setInsetOwner(inInset());
@@ -909,7 +902,11 @@ void Paragraph::breakParagraph(BufferParams const & bparams,
                tmp->params().pagebreakTop(params().pagebreakTop());
                tmp->params().spaceTop(params().spaceTop());
                tmp->bibkey = bibkey;
-               clear();
+
+               bibkey = 0;
+               params().clear();
+               layout(textclasslist[bparams.textclass].defaultLayoutName());
+               
                // layout stays the same with latex-environments
                if (flag) {
                        layout(tmp->layout());
@@ -2124,6 +2121,8 @@ string const & Paragraph::layout() const
 
 void Paragraph::layout(string const & new_layout)
 {
+       lyx::Assert(!new_layout.empty());
+       
        layout_ = new_layout;
 }