]> git.lyx.org Git - lyx.git/blobdiff - src/factory.C
ws changes only
[lyx.git] / src / factory.C
index 847c6ef4c73cd25508c91f008fd58506b356d237..6c728827d22d15f5a48cbb4e86bab3b36165ec48 100644 (file)
 #include <config.h>
 
 #include "factory.h"
-#include "funcrequest.h"
+
 #include "buffer.h"
-#include "FloatList.h"
-#include "debug.h"
 #include "BufferView.h"
+#include "bufferparams.h"
+#include "debug.h"
+#include "FloatList.h"
+#include "funcrequest.h"
+#include "LColor.h"
 #include "lyxlex.h"
 
 #include "insets/insetbibitem.h"
@@ -36,6 +39,7 @@
 #include "insets/insetmarginal.h"
 #include "insets/insetminipage.h"
 #include "insets/insetnote.h"
+#include "insets/insetbox.h"
 #include "insets/insetbranch.h"
 #include "insets/insetoptarg.h"
 #include "insets/insetref.h"
 #include "support/lstrings.h"
 #include "support/std_sstream.h"
 
-using namespace lyx::support;
+#include <boost/assert.hpp>
+
+using lyx::support::compare_ascii_no_case;
 
 using std::endl;
+using std::string;
 
 
 InsetOld * createInset(FuncRequest const & cmd)
@@ -64,7 +71,7 @@ InsetOld * createInset(FuncRequest const & cmd)
 
        switch (cmd.action) {
        case LFUN_HFILL:
-               return new InsetHFill();
+               return new InsetHFill;
 
        case LFUN_INSET_MINIPAGE:
                return new InsetMinipage(params);
@@ -76,6 +83,13 @@ InsetOld * createInset(FuncRequest const & cmd)
                                arg = "Note";
                        return new InsetNote(params, arg);
                }
+       case LFUN_INSERT_BOX:
+               {
+                       string arg = cmd.getArg(0);
+                       if (arg.empty())
+                               arg = "Boxed";
+                       return new InsetBox(params, arg);
+               }
        case LFUN_INSERT_BRANCH:
                {
                        string arg = cmd.getArg(0);
@@ -211,7 +225,7 @@ InsetOld * createInset(FuncRequest const & cmd)
 
                } else if (name == "external") {
                        Buffer const & buffer = *cmd.view()->buffer();
-                       InsetExternal::Params iep;
+                       InsetExternalParams iep;
                        InsetExternalMailer::string2params(cmd.argument,
                                                           buffer, iep);
                        InsetExternal * inset = new InsetExternal;
@@ -228,7 +242,7 @@ InsetOld * createInset(FuncRequest const & cmd)
                        return inset;
 
                } else if (name == "include") {
-                       InsetInclude::Params iip;
+                       InsetCommandParams iip;
                        InsetIncludeMailer::string2params(cmd.argument, iip);
                        return new InsetInclude(iip);
 
@@ -325,7 +339,7 @@ InsetOld * readInset(LyXLex & lex, Buffer const & buf)
                } else if (cmdName == "index") {
                        inset = new InsetIndex(inscmd);
                } else if (cmdName == "include") {
-                       inset = new InsetInclude(inscmd, buf);
+                       inset = new InsetInclude(inscmd);
                } else if (cmdName == "label") {
                        inset = new InsetLabel(inscmd);
                } else if (cmdName == "url"
@@ -351,6 +365,9 @@ InsetOld * readInset(LyXLex & lex, Buffer const & buf)
                        inset = new InsetFloatList("table");
                } else if (cmdName == "printindex") {
                        inset = new InsetPrintIndex(inscmd);
+               } else {
+                       lyxerr << "unknown CommandInset '" << cmdName << "'" << std::endl;
+                       BOOST_ASSERT(false);
                }
        } else {
                if (tmptok == "Quotes") {
@@ -366,11 +383,15 @@ InsetOld * readInset(LyXLex & lex, Buffer const & buf)
                } else if (tmptok == "Note"     || tmptok == "Comment"
                                || tmptok == "Greyedout") {
                        inset = new InsetNote(buf.params(), tmptok);
+               } else if (tmptok == "Boxed" || tmptok == "ovalbox"
+                       || tmptok == "Shadowbox" || tmptok == "Doublebox"
+                       || tmptok == "Ovalbox" || tmptok == "Frameless") {
+                       inset = new InsetBox(buf.params(), tmptok);
                } else if (tmptok == "Branch") {
-                       inset = new InsetBranch(buf.params(), tmptok);
+                       inset = new InsetBranch(buf.params(), string());
                } else if (tmptok == "Include") {
                        InsetCommandParams p("Include");
-                       inset = new InsetInclude(p, buf);
+                       inset = new InsetInclude(p);
                } else if (tmptok == "Environment") {
                        lex.next();
                        inset = new InsetEnvironment(buf.params(), lex.getString());
@@ -408,10 +429,12 @@ InsetOld * readInset(LyXLex & lex, Buffer const & buf)
                        inset = new InsetCaption(buf.params());
                } else if (tmptok == "FloatList") {
                        inset = new InsetFloatList;
+               } else {
+                       lyxerr << "unknown Inset type '" << tmptok << "'" << std::endl;
+                       BOOST_ASSERT(false);
                }
 
-               if (inset)
-                       inset->read(buf, lex);
+               inset->read(buf, lex);
        }
 
        return inset;