]> git.lyx.org Git - lyx.git/commitdiff
i thought I committed that already...
authorAndré Pönitz <poenitz@gmx.net>
Sun, 27 Jul 2003 15:09:13 +0000 (15:09 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Sun, 27 Jul 2003 15:09:13 +0000 (15:09 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7386 a592a061-630c-0410-9148-cb99ea01b6c8

src/paragraph_funcs.C

index 531afd3f27d07c9154a57bdce0821a6480c7cca7..283445048b5c4abe9b7acbb11cd30671a1ecf033 100644 (file)
@@ -23,7 +23,9 @@
 #include "lyxlex.h"
 #include "factory.h"
 #include "Lsstream.h"
+
 #include "support/lstrings.h"
+
 #include "insets/insetoptarg.h"
 #include "insets/insetcommandparams.h"
 #include "insets/insetbibitem.h"
@@ -815,70 +817,14 @@ int readParToken(Buffer & buf, Paragraph & par, LyXLex & lex, string const & tok
                        layoutname = tclass.defaultLayoutName();
                }
 
-#ifdef USE_CAPTION
-               // The is the compability reading of layout caption.
-               if (compare_ascii_no_case(layoutname, "caption") == 0) {
-                       // We expect that the par we are now working on is
-                       // really inside a InsetText inside a InsetFloat.
-                       // We also know that captions can only be
-                       // one paragraph. (Lgb)
-
-                       // We should now read until the next "\layout"
-                       // is reached.
-                       // This is probably not good enough, what if the
-                       // caption is the last par in the document (Lgb)
-                       istream & ist = lex.getStream();
-                       stringstream ss;
-                       string line;
-                       int begin = 0;
-                       while (true) {
-                               getline(ist, line);
-                               if (prefixIs(line, "\\layout")) {
-                                       lex.pushToken(line);
-                                       break;
-                               }
-                               if (prefixIs(line, "\\begin_inset"))
-                                       ++begin;
-                               if (prefixIs(line, "\\end_inset")) {
-                                       if (begin)
-                                               --begin;
-                                       else {
-                                               lex.pushToken(line);
-                                               break;
-                                       }
-                               }
+               par.layout(bp.getLyXTextClass()[layoutname]);
 
-                               ss << line << '\n';
-                       }
+               // Test whether the layout is obsolete.
+               LyXLayout_ptr const & layout = par.layout();
+               if (!layout->obsoleted_by().empty())
+                       par.layout(bp.getLyXTextClass()[layout->obsoleted_by()]);
 
-                       // Now we should have the whole layout in ss
-                       // we should now be able to give this to the
-                       // caption inset.
-                       ss << "\\end_inset\n";
-
-                       // This seems like a bug in stringstream.
-                       // We really should be able to use ss
-                       // directly. (Lgb)
-                       istringstream is(ss.str());
-                       LyXLex tmplex(0, 0);
-                       tmplex.setStream(is);
-                       InsetOld * inset = new InsetCaption;
-                       inset->Read(this, tmplex);
-                       par.insertInset(pos, inset, font);
-                       ++pos;
-               } else {
-#endif
-                       par.layout(bp.getLyXTextClass()[layoutname]);
-
-                       // Test whether the layout is obsolete.
-                       LyXLayout_ptr const & layout = par.layout();
-                       if (!layout->obsoleted_by().empty())
-                               par.layout(bp.getLyXTextClass()[layout->obsoleted_by()]);
-
-                       par.params().read(lex);
-#if USE_CAPTION
-               }
-#endif
+               par.params().read(lex);
 
        } else if (token == "\\end_inset") {
                lyxerr << "Solitary \\end_inset in line " << lex.getLineNo() << "\n"
@@ -888,8 +834,8 @@ int readParToken(Buffer & buf, Paragraph & par, LyXLex & lex, string const & tok
                // But insets should read it, it is a part of
                // the inset isn't it? Lgb.
        } else if (token == "\\begin_inset") {
-               InsetOld * i = readInset(lex, buf);
-               par.insertInset(par.size(), i, font, change);
+               InsetOld * inset = readInset(lex, buf);
+               par.insertInset(par.size(), inset, font, change);
        } else if (token == "\\family") {
                lex.next();
                font.setLyXFamily(lex.getString());