]> git.lyx.org Git - lyx.git/blobdiff - src/factory.cpp
Embedding: saving inzip name to .lyx file so that embedded files can always be found...
[lyx.git] / src / factory.cpp
index 8ddc41b9de832b3bdaced34636c62feda74f2809..d3b29e2f22e83b14c083c2ad8114e0101a49f5e6 100644 (file)
 
 #include "Buffer.h"
 #include "BufferParams.h"
-#include "debug.h"
 #include "FloatList.h"
 #include "FuncRequest.h"
 #include "Lexer.h"
 #include "LyX.h"
+#include "TextClass.h"
 
 #include "insets/InsetBibitem.h"
 #include "insets/InsetBibtex.h"
@@ -45,7 +45,7 @@
 #include "insets/InsetBox.h"
 #include "insets/InsetBranch.h"
 #include "insets/InsetOptArg.h"
-#include "insets/InsetPagebreak.h"
+#include "insets/InsetNewpage.h"
 #include "insets/InsetRef.h"
 #include "insets/InsetSpace.h"
 #include "insets/InsetTabular.h"
 
 #include "frontends/alert.h"
 
+#include "support/debug.h"
 #include "support/lstrings.h"
 #include "support/ExceptionMessage.h"
 
 #include <boost/assert.hpp>
-#include <boost/current_function.hpp>
 
 #include <sstream>
 
-using std::auto_ptr;
-using std::endl;
-using std::string;
-
+using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 
 namespace Alert = frontend::Alert;
 
-using support::compare_ascii_no_case;
-
 
 Inset * createInset(Buffer & buf, FuncRequest const & cmd)
 {
@@ -92,6 +88,9 @@ Inset * createInset(Buffer & buf, FuncRequest const & cmd)
                case LFUN_LINE_INSERT:
                        return new InsetLine;
 
+               case LFUN_NEWPAGE_INSERT:
+                       return new InsetNewpage;
+
                case LFUN_PAGEBREAK_INSERT:
                        return new InsetPagebreak;
 
@@ -187,7 +186,7 @@ Inset * createInset(Buffer & buf, FuncRequest const & cmd)
                case LFUN_TABULAR_INSERT: {
                        if (cmd.argument().empty())
                                return 0;
-                       std::istringstream ss(to_utf8(cmd.argument()));
+                       istringstream ss(to_utf8(cmd.argument()));
                        int r = 0, c = 0;
                        ss >> r >> c;
                        if (r <= 0)
@@ -325,7 +324,7 @@ Inset * createInset(Buffer & buf, FuncRequest const & cmd)
                        
                        default:
                                lyxerr << "Inset '" << name << "' not permitted with LFUN_INSET_INSERT."
-                                               << std::endl;
+                                               << endl;
                                return 0;
                        
                        }
@@ -360,12 +359,12 @@ Inset * createInset(Buffer & buf, FuncRequest const & cmd)
                        break;
                }
 
-       } catch (support::ExceptionMessage const & message) {
-               if (message.type_ == support::ErrorException) {
+       } catch (ExceptionMessage const & message) {
+               if (message.type_ == ErrorException) {
+                       // This should never happen!
                        Alert::error(message.title_, message.details_);
-                       LyX::cref().emergencyCleanup();
-                       abort();
-               } else if (message.type_ == support::WarningException) {
+                       LyX::cref().exit(1);
+               } else if (message.type_ == WarningException) {
                        Alert::warning(message.title_, message.details_);
                        return 0;
                }
@@ -452,7 +451,7 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
                        case NO_CODE:
                        default:
                                lyxerr << "unknown CommandInset '" << insetType
-                                                       << "'" << std::endl;
+                                                       << "'" << endl;
                                while (lex.isOK() && lex.getString() != "\\end_inset")
                                        lex.next();
                                return 0;
@@ -529,7 +528,7 @@ Inset * readInset(Lexer & lex, Buffer const & buf)
                        inset.reset(new InsetInfo(buf.params()));
                } else {
                        lyxerr << "unknown Inset type '" << tmptok
-                              << "'" << std::endl;
+                              << "'" << endl;
                        while (lex.isOK() && lex.getString() != "\\end_inset")
                                lex.next();
                        return 0;