#include "mathed/math_macrotemplate.h"
#include "mathed/math_hullinset.h"
-#include "frontends/Dialogs.h"
-#include "frontends/LyXView.h"
-
#include "support/lstrings.h"
#include <boost/assert.hpp>
case LFUN_INSERT_CHARSTYLE: {
string s = cmd.getArg(0);
- CharStyles::iterator found_cs = params.getLyXTextClass().charstyle(s);
- return new InsetCharStyle(params, found_cs);
+ LyXTextClass tclass = params.getLyXTextClass();
+ CharStyles::iterator found_cs = tclass.charstyle(s);
+ if (found_cs != tclass.charstyles().end())
+ return new InsetCharStyle(params, found_cs);
+ else
+ return new InsetCharStyle(params, s);
}
case LFUN_INSERT_NOTE: {
cmd.argument;
icp.setContents(contents);
- string data = InsetCommandMailer::params2string("index", icp);
- LyXView * lv = bv->owner();
+ return new InsetIndex(icp);
- if (icp.getContents().empty()) {
- lv->getDialogs().show("index", data, 0);
- } else {
- lv->dispatch(FuncRequest(LFUN_INSET_APPLY, data));
- }
- return 0;
}
case LFUN_TABULAR_INSERT:
if (c <= 0) c = 2;
return new InsetTabular(*bv->buffer(), r, c);
}
- bv->owner()->getDialogs().show("tabularcreate");
return 0;
case LFUN_INSET_CAPTION: {
lex.next();
string s = lex.getString();
CharStyles::iterator found_cs = tclass.charstyle(s);
- inset.reset(new InsetCharStyle(buf.params(), found_cs));
+ if (found_cs != tclass.charstyles().end())
+ inset.reset(new InsetCharStyle(buf.params(), found_cs));
+ else {
+ // "Undefined" inset
+ inset.reset(new InsetCharStyle(buf.params(), s));
+ }
} else if (tmptok == "Branch") {
inset.reset(new InsetBranch(buf.params(),
InsetBranchParams()));