4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Asger Alstrup Nielsen
8 * \author Jean-Marc Lasgouttes
9 * \author Lars Gullik Bjønnes
10 * \author Jürgen Spitzmüller
12 * Full author contact details are available in file CREDITS.
26 struct InsetSpaceParams {
27 /// The different kinds of spaces we support
29 /// Normal space ('\ ')
31 /// Protected (no break) space ('~')
35 /// Medium space ('\:')
37 /// Thick space ('\;')
43 /// \enskip (0.5em unbreakable)
45 /// \enspace (0.5em breakable)
47 /// Negative thin space ('\negthinspace')
49 /// Negative medium space ('\negmedspace')
51 /// Negative thick space ('\negthickspace')
57 /// rubber length, filled with dots
59 /// rubber length, filled with a rule
61 /// rubber length, filled with a left arrow
63 /// rubber length, filled with a right arrow
65 // rubber length, filled with an up brace
67 // rubber length, filled with a down brace
75 InsetSpaceParams(bool m = false) : kind(NORMAL), math(m) {}
77 void write(std::ostream & os) const;
79 void read(Lexer & lex);
85 * Whether these params are to be used in mathed.
86 * This determines the set of valid kinds.
92 /// Used to insert different kinds of spaces
93 class InsetSpace : public Inset
97 InsetSpace() : Inset(0) {}
99 explicit InsetSpace(InsetSpaceParams const & par);
101 InsetSpaceParams const & params() const { return params_; }
103 InsetSpaceParams::Kind kind() const;
106 static void string2params(std::string const &, InsetSpaceParams &);
108 static std::string params2string(InsetSpaceParams const &);
110 GlueLength length() const;
113 docstring toolTip(BufferView const & bv, int x, int y) const;
115 void metrics(MetricsInfo &, Dimension &) const;
117 void draw(PainterInfo & pi, int x, int y) const;
119 void write(std::ostream &) const;
120 /// Will not be used when lyxf3
121 void read(Lexer & lex);
123 int latex(odocstream &, OutputParams const &) const;
125 int plaintext(odocstream &, OutputParams const &) const;
127 int docbook(odocstream &, OutputParams const &) const;
129 docstring xhtml(XHTMLStream &, OutputParams const &) const;
131 void validate(LaTeXFeatures & features) const;
132 /// the string that is passed to the TOC
133 void tocString(odocstream &) const;
135 bool hasSettings() const { return true; }
137 InsetCode lyxCode() const { return SPACE_CODE; }
138 /// is this an expandible space (rubber length)?
139 bool isStretchableSpace() const;
141 // should this inset be handled like a normal charater
142 bool isChar() const { return true; }
143 /// is this equivalent to a letter?
144 bool isLetter() const { return false; }
145 /// is this equivalent to a space (which is BTW different from
146 // a line separator)?
147 bool isSpace() const { return true; }
149 docstring contextMenu(BufferView const & bv, int x, int y) const;
151 bool clickable(int /* x */, int /* y */) const { return true; }
154 Inset * clone() const { return new InsetSpace(*this); }
156 void doDispatch(Cursor & cur, FuncRequest & cmd);
159 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
163 InsetSpaceParams params_;
169 #endif // INSET_SPACE_H