+/**
+ * \file factory.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+#include <config.h>
#include "funcrequest.h"
#include "bufferparams.h"
#include "insets/insettext.h"
#include "insets/insettoc.h"
#include "insets/inseturl.h"
+#include "insets/insetwrap.h"
#include "frontends/Dialogs.h"
#include "frontends/LyXView.h"
#include <cstdio>
+using std::endl;
Inset * createInset(FuncRequest const & cmd)
{
lyxerr << "Non-existent float type: " << cmd.argument << endl;
return 0;
+ case LFUN_INSET_WRAP:
+ if (cmd.argument == "figure")
+ return new InsetWrap(params, cmd.argument);
+ lyxerr << "Non-existent floatflt type: " << cmd.argument << endl;
+ return 0;
+
case LFUN_INDEX_INSERT: {
- string entry = cmd.argument;
- if (entry.empty())
- entry = bv->getLyXText()->getStringToIndex(bv);
- if (!entry.empty())
- return new InsetIndex(InsetCommandParams("index", entry));
+ string const entry = cmd.argument.empty() ?
+ "index" : cmd.argument;
+ InsetCommandParams icp;
+ icp.setFromString(entry);
+
+ if (icp.getContents().empty())
+ icp.setContents(bv->getLyXText()->getStringToIndex(bv));
+ if (!icp.getContents().empty())
+ return new InsetIndex(icp);
+
bv->owner()->getDialogs().createIndex();
return 0;
}
}
return 0;
- case LFUN_INDEX_PRINT:
+ case LFUN_INDEX_PRINT:
return new InsetPrintIndex(InsetCommandParams("printindex"));
case LFUN_TOC_INSERT:
}
return 0;
}
-
-