]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetNewline.cpp
Remove all BufferParam arguments in InsetXXX methods (since insets know about their...
[lyx.git] / src / insets / InsetNewline.cpp
index d4ee618dac0701c280cadd13e59c447601c79813..9ee9f4b8627364057025d9331c9960d5b560d414 100644 (file)
@@ -4,7 +4,7 @@
  * Licence details can be found in the file COPYING.
  *
  * \author John Levon
- * \author Jürgen Spitzmüller
+ * \author Jürgen Spitzmüller
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -61,7 +61,6 @@ void InsetNewlineParams::read(Lexer & lex)
                kind = InsetNewlineParams::LINEBREAK;
        else
                lex.printError("Unknown kind: `$$Token'");
-       lex >> "\\end_inset";
 }
 
 
@@ -75,6 +74,7 @@ void InsetNewline::write(ostream & os) const
 void InsetNewline::read(Lexer & lex)
 {
        params_.read(lex);
+       lex >> "\\end_inset";
 }
 
 
@@ -115,9 +115,8 @@ bool InsetNewline::getStatus(Cursor & cur, FuncRequest const & cmd,
                        InsetNewlineParams params;
                        string2params(to_utf8(cmd.argument()), params);
                        status.setOnOff(params_.kind == params.kind);
-               } else {
-                       status.enabled(true);
                }
+               status.setEnabled(true);
                return true;
        default:
                return Inset::getStatus(cur, cmd, status);
@@ -134,18 +133,20 @@ ColorCode InsetNewline::ColorName() const
                case InsetNewlineParams::LINEBREAK:
                        return Color_pagebreak;
                        break;
-               default:
-                       return Color_eolmarker;
-                       break;
        }
+       // not really useful, but to avoids gcc complaints
+       return Color_eolmarker;
 }
 
 
-int InsetNewline::latex(odocstream & os, OutputParams const &) const
+int InsetNewline::latex(odocstream & os, OutputParams const & rp) const
 {
        switch (params_.kind) {
                case InsetNewlineParams::NEWLINE:
-                       os << "\\\\\n";
+                       if (rp.inTableCell == OutputParams::PLAIN)
+                               os << "\\newline\n";
+                       else
+                               os << "\\\\\n";
                        break;
                case InsetNewlineParams::LINEBREAK:
                        os << "\\linebreak{}\n";
@@ -172,6 +173,13 @@ int InsetNewline::docbook(odocstream & os, OutputParams const &) const
 }
 
 
+docstring InsetNewline::xhtml(odocstream & os, OutputParams const &) const
+{
+       os << "<br />\n";
+       return docstring();
+}
+
+
 void InsetNewline::draw(PainterInfo & pi, int x, int y) const
 {
        FontInfo font;