* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author André Pönitz
- * \author Jürgen Spitzmüller
+ * \author André Pönitz
+ * \author Jürgen Spitzmüller
*
* Full author contact details are available in file CREDITS.
*/
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "Text.h"
#include "Lexer.h"
#include "MetricsInfo.h"
#include "OutputParams.h"
+#include "output_xhtml.h"
+#include "Text.h"
#include "TextMetrics.h"
#include "frontends/FontMetrics.h"
namespace lyx {
-InsetNewpage::InsetNewpage()
+ InsetNewpage::InsetNewpage() : Inset(0)
{}
InsetNewpage::InsetNewpage(InsetNewpageParams const & params)
- : params_(params)
+ : Inset(0), params_(params)
{}
void InsetNewpageParams::read(Lexer & lex)
{
- lex.next();
- string const command = lex.getString();
+ lex.setContext("InsetNewpageParams::read");
+ string token;
+ lex >> token;
- if (command == "newpage")
+ if (token == "newpage")
kind = InsetNewpageParams::NEWPAGE;
- else if (command == "pagebreak")
+ else if (token == "pagebreak")
kind = InsetNewpageParams::PAGEBREAK;
- else if (command == "clearpage")
+ else if (token == "clearpage")
kind = InsetNewpageParams::CLEARPAGE;
- else if (command == "cleardoublepage")
+ else if (token == "cleardoublepage")
kind = InsetNewpageParams::CLEARDOUBLEPAGE;
else
- lex.printError("InsetNewpage: Unknown kind: `$$Token'");
-
- string token;
- lex >> token;
- if (!lex)
- return;
- if (token != "\\end_inset")
- lex.printError("Missing \\end_inset at this point. "
- "Read: `$$Token'");
+ lex.printError("Unknown kind");
}
void InsetNewpage::read(Lexer & lex)
{
params_.read(lex);
+ lex >> "\\end_inset";
}
InsetNewpageParams 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);
ColorCode InsetNewpage::ColorName() const
{
switch (params_.kind) {
- case InsetNewpageParams::NEWPAGE:
- return Color_newpage;
- break;
case InsetNewpageParams::PAGEBREAK:
return Color_pagebreak;
break;
+ case InsetNewpageParams::NEWPAGE:
case InsetNewpageParams::CLEARPAGE:
- return Color_newpage;
- break;
case InsetNewpageParams::CLEARDOUBLEPAGE:
return Color_newpage;
break;
- default:
- return Color_newpage;
- break;
}
+ // not really useful, but to avoids gcc complaints
+ return Color_newpage;
}
}
+docstring InsetNewpage::xhtml(XHTMLStream & xs, OutputParams const &) const
+{
+ xs << CompTag("br");
+ return docstring();
+}
+
+
docstring InsetNewpage::contextMenu(BufferView const &, int, int) const
{
return from_ascii("context-newpage");
return;
istringstream data(in);
- Lexer lex(0,0);
+ Lexer lex;
lex.setStream(data);
string name;