]> git.lyx.org Git - lyx.git/blobdiff - src/ParagraphList.C
Minimal fix needed to give Qt a label dialog again.
[lyx.git] / src / ParagraphList.C
index 131380d6442e9b75a26101667389b369b4c3a4f9..152aef2f5458d7d1a473673ab97f5afe867afcde 100644 (file)
@@ -85,6 +85,27 @@ ParagraphList::ParagraphList()
 {}
 
 
+ParagraphList::iterator
+ParagraphList::insert(ParagraphList::iterator it, Paragraph * par)
+{
+       if (it != end()) {
+               Paragraph * prev = it->previous();
+               par->next(&*it);
+               par->previous(prev);
+               prev->next(par);
+               it->previous(par);
+       } else {
+               // Find last par.
+               Paragraph * last = parlist;
+               while (last->next())
+                       last = last->next();
+               last->next(par);
+               par->previous(last);
+       }
+       return iterator(par);
+}
+
+
 void ParagraphList::clear()
 {
        while (parlist) {
@@ -95,6 +116,20 @@ void ParagraphList::clear()
 }
 
 
+void ParagraphList::erase(ParagraphList::iterator it)
+{
+       Paragraph * prev = it->previous();
+       Paragraph * next = it->next();
+
+       if (prev)
+               prev->next(next);
+       if (next)
+               next->previous(prev);
+
+       delete &*it;
+}
+
+
 ParagraphList::iterator ParagraphList::begin()
 {
        return iterator(parlist);