]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettext.C
some reindentation, revert workarea xpos++, constify, remove all traces of LyXParagra...
[lyx.git] / src / insets / insettext.C
index f570e72eeaa568133b7305d67079c8f1a7cec0cc..b4aead7368dadb18d88da3387c3a808cd7607237 100644 (file)
@@ -135,7 +135,7 @@ void InsetText::clear()
 {
        // delete all instances of LyXText before deleting the paragraps used
        // by it.
-       for (Cache::iterator cit = cache.begin(); cit != cache.end(); ++cit){
+       for (Cache::iterator cit = cache.begin(); cit != cache.end(); ++cit) {
                delete (*cit).second;
                (*cit).second = 0;
        }
@@ -177,20 +177,8 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
        char depth = 0; // signed or unsigned?
        LyXFont font(LyXFont::ALL_INHERIT);
 
-       // delete all instances of LyXText before deleting the paragraps used
-       // by it.
-       for (Cache::iterator cit = cache.begin(); cit != cache.end(); ++cit) {
-               delete (*cit).second;
-               (*cit).second = 0;
-       }
-
-       while (par) {
-               LyXParagraph * tmp = par->next();
-               delete par;
-               par = tmp;
-       }
-
-       par = new LyXParagraph;
+       clear();
+       
        while (lex.IsOK()) {
                lex.nextToken();
                token = lex.GetString();
@@ -1482,12 +1470,12 @@ void InsetText::SetParagraphData(LyXParagraph * p)
                par = tmp;
        }
 
-       par = p->Clone();
+       par = new LyXParagraph(*p);
        par->SetInsetOwner(this);
        LyXParagraph * np = par;
        while (p->next()) {
                p = p->next();
-               np->next(p->Clone());
+               np->next(new LyXParagraph(*p));
                np->next()->previous(np);
                np = np->next();
                np->SetInsetOwner(this);