]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathNest.cpp
InsetMathHull.cpp: whitespace
[lyx.git] / src / mathed / InsetMathNest.cpp
index 747f0ca1570cf6f588ea3689a5aec3d2c8a464cb..c77b24068f3bdc616fb0bc34013b6ba61b54b284 100644 (file)
@@ -73,11 +73,6 @@ using cap::cutSelection;
 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)
@@ -341,14 +336,8 @@ MathData InsetMathNest::glue() const
 
 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) << '}';
@@ -358,13 +347,12 @@ void InsetMathNest::write(WriteStream & os) const
                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 << ']';
@@ -373,7 +361,8 @@ void InsetMathNest::normalize(NormalStream & os) const
 
 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();
 }