X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetNewpage.h;h=51f640a09700b1483b1feb8fe2f4fb939bf89e3e;hb=d4550b7a4d64e9ff772cf3a7635cb4ca532fb340;hp=30c1d408a6bca6987410c827139a5343b62a9982;hpb=0cb39e6f8b5f48a2da892f0f515e8ccfd7aa5921;p=lyx.git diff --git a/src/insets/InsetNewpage.h b/src/insets/InsetNewpage.h index 30c1d408a6..51f640a097 100644 --- a/src/insets/InsetNewpage.h +++ b/src/insets/InsetNewpage.h @@ -4,7 +4,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author André Pönitz + * \author André Pönitz * * Full author contact details are available in file CREDITS. */ @@ -14,95 +14,84 @@ #include "Inset.h" -#include "support/docstring.h" -#include "support/gettext.h" - namespace lyx { -class InsetNewpage : public Inset +class InsetNewpageParams { public: + /// The different kinds of spaces we support + enum Kind { + /// + NEWPAGE, + /// + PAGEBREAK, + /// + CLEARPAGE, + /// + CLEARDOUBLEPAGE + }; + /// + InsetNewpageParams() : kind(NEWPAGE) {} /// - InsetNewpage() {} - /// - InsetCode lyxCode() const { return NEWPAGE_CODE; } - /// - void metrics(MetricsInfo &, Dimension &) const; + void write(std::ostream & os) const; /// - void draw(PainterInfo & pi, int x, int y) const; + void read(Lexer & lex); /// - int latex(odocstream &, OutputParams const &) const; + Kind kind; +}; + + +class InsetNewpage : public Inset +{ +public: /// - int plaintext(odocstream &, OutputParams const &) const; + InsetNewpage(); /// - int docbook(odocstream &, OutputParams const &) const; + explicit InsetNewpage(InsetNewpageParams const & par); /// - void read(Lexer & lex); + static void string2params(std::string const &, InsetNewpageParams &); /// - void write(std::ostream & os) const; - /// We don't need \begin_inset and \end_inset - bool directWrite() const { return true; } + static std::string params2string(InsetNewpageParams const &); +private: /// - DisplayType display() const { return AlignCenter; } + InsetNewpageParams params() const { return params_; } /// - docstring insetLabel() const { return _("New Page"); } + InsetCode lyxCode() const { return NEWPAGE_CODE; } /// - std::string getCmdName() const { return "\\newpage"; } + void metrics(MetricsInfo &, Dimension &) const; /// - ColorCode ColorName() const { return Color_newpage; } -private: + void draw(PainterInfo & pi, int x, int y) const; /// - Inset * clone() const { return new InsetNewpage(*this); } -}; - - -class InsetPagebreak : public InsetNewpage -{ -public: + void latex(otexstream &, OutputParams const &) const; /// - InsetPagebreak() {} + int plaintext(odocstringstream & ods, OutputParams const & op, + size_t max_length = INT_MAX) const; /// - docstring insetLabel() const { return _("Page Break"); } + int docbook(odocstream &, OutputParams const &) const; /// - std::string getCmdName() const { return "\\pagebreak"; } + docstring xhtml(XHTMLStream &, OutputParams const &) const; /// - ColorCode ColorName() const { return Color_pagebreak; } -private: + void read(Lexer & lex); /// - Inset * clone() const { return new InsetPagebreak(*this); } -}; - - -class InsetClearPage : public InsetNewpage -{ -public: + void write(std::ostream & os) const; /// - InsetClearPage() {} + DisplayType display() const { return AlignCenter; } /// - docstring insetLabel() const { return _("Clear Page"); } + docstring insetLabel() const; /// - std::string getCmdName() const { return "\\clearpage"; } - -private: + ColorCode ColorName() const; /// - Inset * clone() const { return new InsetClearPage(*this); } -}; - - -class InsetClearDoublePage : public InsetNewpage -{ -public: + std::string contextMenuName() const; /// - InsetClearDoublePage() {} + Inset * clone() const { return new InsetNewpage(*this); } /// - docstring insetLabel() const { return _("Clear Double Page"); } + void doDispatch(Cursor & cur, FuncRequest & cmd); /// - std::string getCmdName() const { return "\\cleardoublepage"; } + bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const; -private: /// - Inset * clone() const { return new InsetClearDoublePage(*this); } + InsetNewpageParams params_; }; } // namespace lyx