using cap::replaceSelection;
using cap::selClearOrDel;
-char const * text_commands[] =
-{ "text", "textrm", "textsf", "texttt", "textmd", "textbf", "textup", "textit",
- "textsl", "textsc", "textnormal" };
-int const num_text_commands = sizeof(text_commands) / sizeof(*text_commands);
-
InsetMathNest::InsetMathNest(idx_type nargs)
: cells_(nargs), lock_(false), mouse_hover_(false)
void InsetMathNest::write(WriteStream & os) const
{
- bool textmode = os.textMode();
- docstring const latex_name = name().c_str();
- for (int i = 0; i < num_text_commands; ++i) {
- if (latex_name == from_ascii(text_commands[i])) {
- os.textMode(true);
- break;
- }
- }
+ ModeSpecifier specifier(os, currentMode());
+ docstring const latex_name = name();
os << '\\' << latex_name;
for (size_t i = 0; i < nargs(); ++i)
os << '{' << cell(i) << '}';
os << "\\lyxlock";
os.pendingSpace(true);
}
- os.textMode(textmode);
}
void InsetMathNest::normalize(NormalStream & os) const
{
- os << '[' << name().c_str();
+ os << '[' << name();
for (size_t i = 0; i < nargs(); ++i)
os << ' ' << cell(i);
os << ']';
int InsetMathNest::latex(odocstream & os, OutputParams const & runparams) const
{
- WriteStream wi(os, runparams.moving_arg, true, runparams.dryrun);
+ WriteStream wi(os, runparams.moving_arg, true, runparams.dryrun,
+ runparams.encoding);
write(wi);
return wi.line();
}