]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetNewline.cpp
Pure HTML output for math macros.
[lyx.git] / src / insets / InsetNewline.cpp
index 52558f94acc9d17abab882b5e3d2b9a737309ad3..c74d16f89a593286272a32c529b9176948c72fa3 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.
  */
@@ -19,6 +19,7 @@
 #include "Lexer.h"
 #include "MetricsInfo.h"
 #include "OutputParams.h"
+#include "output_xhtml.h"
 
 #include "frontends/Application.h"
 #include "frontends/FontMetrics.h"
@@ -32,7 +33,7 @@ using namespace std;
 
 namespace lyx {
 
-InsetNewline::InsetNewline()
+InsetNewline::InsetNewline() : Inset(0)
 {}
 
 
@@ -61,7 +62,6 @@ void InsetNewlineParams::read(Lexer & lex)
                kind = InsetNewlineParams::LINEBREAK;
        else
                lex.printError("Unknown kind: `$$Token'");
-       lex >> "\\end_inset";
 }
 
 
@@ -75,6 +75,7 @@ void InsetNewline::write(ostream & os) const
 void InsetNewline::read(Lexer & lex)
 {
        params_.read(lex);
+       lex >> "\\end_inset";
 }
 
 
@@ -133,18 +134,17 @@ 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 & op) const
+int InsetNewline::latex(odocstream & os, OutputParams const & rp) const
 {
        switch (params_.kind) {
                case InsetNewlineParams::NEWLINE:
-                       if (op.inTableCell)
+                       if (rp.inTableCell == OutputParams::PLAIN)
                                os << "\\newline\n";
                        else
                                os << "\\\\\n";
@@ -174,6 +174,14 @@ int InsetNewline::docbook(odocstream & os, OutputParams const &) const
 }
 
 
+docstring InsetNewline::xhtml(XHTMLStream & xs, OutputParams const &) const
+{
+       xs << html::CompTag("br");
+       xs.cr();
+       return docstring();
+}
+
+
 void InsetNewline::draw(PainterInfo & pi, int x, int y) const
 {
        FontInfo font;