]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetCommandParams.cpp
tex2lyx: support for Spreadsheet and chess external templates
[lyx.git] / src / insets / InsetCommandParams.cpp
index 31ea514a79549aa9a835d2dfb338be258e5d3e05..bb4882874af1b0220dba13776023ab8e34f1250e 100644 (file)
@@ -84,7 +84,7 @@ static ParamInfo const & findInfo(InsetCode code, string const & cmdName)
        default:
                LASSERT(false, /**/);
        }
-       static const ParamInfo pi;
+       static ParamInfo pi;
        return pi; // to silence the warning
 }
 
@@ -365,13 +365,13 @@ bool InsetCommandParams::writeEmptyOptional(ParamInfo::const_iterator ci) const
 }
 
 
-
 docstring InsetCommandParams::prepareCommand(OutputParams const & runparams,
                                             docstring const & command,
                                             ParamInfo::ParamHandling handling) const
 {
        docstring result;
-       if (handling == ParamInfo::HANDLING_LATEXIFY) {
+       switch (handling) {
+       case ParamInfo::HANDLING_LATEXIFY: {
                docstring uncodable;
                for (size_t n = 0; n < command.size(); ++n) {
                        try {
@@ -403,10 +403,15 @@ docstring InsetCommandParams::prepareCommand(OutputParams const & runparams,
                                          "representable in the current encoding and therefore have been omitted:\n%2$s."),
                                        from_utf8(insetType()), uncodable));
                }
-       } else if (handling == ParamInfo::HANDLING_ESCAPE)
+               break;
+       } 
+       case ParamInfo::HANDLING_ESCAPE:
                result = escape(command);
-       else
+               break;
+       case ParamInfo::HANDLING_NONE:
                result = command;
+               break;
+       } // switch
 
        return result;
 }
@@ -425,14 +430,14 @@ docstring InsetCommandParams::getCommand(OutputParams const & runparams) const
                        break;
 
                case ParamInfo::LATEX_REQUIRED: {
-                       docstring const data =
+                       docstring const data =
                                prepareCommand(runparams, (*this)[name], it->handling());
                        s += '{' + data + '}';
                        noparam = false;
                        break;
                }
                case ParamInfo::LATEX_OPTIONAL: {
-                       docstring const data =
+                       docstring const data =
                                prepareCommand(runparams, (*this)[name], it->handling());
                        if (!data.empty()) {
                                s += '[' + data + ']';