3 * \file InsetSeparator.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Enrico Forestieri
9 * Full author contact details are available in file CREDITS.
12 #ifndef INSET_SEPARATOR_H
13 #define INSET_SEPARATOR_H
20 class InsetSeparatorParams
23 /// The different kinds of separators we support
30 InsetSeparatorParams() : kind(PLAIN) {}
32 void write(std::ostream & os) const;
34 void read(Lexer & lex);
40 class InsetSeparator : public Inset
46 explicit InsetSeparator(InsetSeparatorParams const & params);
48 static void string2params(std::string const &, InsetSeparatorParams &);
50 static std::string params2string(InsetSeparatorParams const &);
51 /// To be used in combination with inset-forall
52 /// Here's a command that removes every latexpar separator:
53 /// inset-forall Separator:latexpar char-delete-forward
54 docstring layoutName() const override
56 switch (params_.kind) {
57 case InsetSeparatorParams::PLAIN:
58 return from_ascii("Separator:plain");
59 case InsetSeparatorParams::PARBREAK:
60 return from_ascii("Separator:parbreak");
61 case InsetSeparatorParams::LATEXPAR:
62 return from_ascii("Separator:latexpar");
68 int rowFlags() const override { return BreakAfter; }
71 InsetCode lyxCode() const override { return SEPARATOR_CODE; }
73 void metrics(MetricsInfo &, Dimension &) const override;
75 void draw(PainterInfo & pi, int x, int y) const override;
77 void latex(otexstream &, OutputParams const &) const override;
79 int plaintext(odocstringstream & ods, OutputParams const & op,
80 size_t max_length = INT_MAX) const override;
82 void docbook(XMLStream &, OutputParams const &) const override;
84 docstring xhtml(XMLStream &, OutputParams const &) const override;
86 void read(Lexer & lex) override;
88 void write(std::ostream & os) const override;
89 /// is this equivalent to a space (which is BTW different from
90 /// a line separator)?
91 bool isSpace() const override { return true; }
93 ColorCode ColorName() const;
95 std::string contextMenuName() const override;
97 Inset * clone() const override { return new InsetSeparator(*this); }
99 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
101 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const override;
104 InsetSeparatorParams params_;
110 #endif // INSET_SEPARATOR_H