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 class InsetSpaceParams {
28 /// The different kinds of spaces we support
30 /// Normal space ('\ ')
32 /// Protected (no break) space ('~')
36 /// Medium space ('\:')
38 /// Thick space ('\;')
44 /// \enskip (0.5em unbreakable)
46 /// \enspace (0.5em breakable)
48 /// Negative thin space ('\negthinspace')
50 /// Negative medium space ('\negmedspace')
52 /// Negative thick space ('\negthickspace')
58 /// rubber length, filled with dots
60 /// rubber length, filled with a rule
62 /// rubber length, filled with a left arrow
64 /// rubber length, filled with a right arrow
66 // rubber length, filled with an up brace
68 // rubber length, filled with a down brace
76 InsetSpaceParams(bool m = false) : kind(NORMAL), math(m) {}
78 void write(std::ostream & os) const;
80 void read(Lexer & lex);
86 * Whether these params are to be used in mathed.
87 * This determines the set of valid kinds.
93 /// Used to insert different kinds of spaces
94 class InsetSpace : public Inset
98 InsetSpace() : Inset(0) {}
100 explicit InsetSpace(InsetSpaceParams const & par);
102 InsetSpaceParams params() const { return params_; }
104 InsetSpaceParams::Kind kind() const;
109 static void string2params(std::string const &, InsetSpaceParams &);
111 static std::string params2string(InsetSpaceParams const &);
113 GlueLength length() const;
116 docstring toolTip(BufferView const & bv, int x, int y) const;
118 void metrics(MetricsInfo &, Dimension &) const;
120 void draw(PainterInfo & pi, int x, int y) const;
122 void write(std::ostream &) const;
123 /// Will not be used when lyxf3
124 void read(Lexer & lex);
126 int latex(odocstream &, OutputParams const &) const;
128 int plaintext(odocstream &, OutputParams const &) const;
130 int docbook(odocstream &, OutputParams const &) const;
132 docstring xhtml(XHTMLStream &, OutputParams const &) const;
134 void validate(LaTeXFeatures & features) const;
135 /// the string that is passed to the TOC
136 void tocString(odocstream &) const;
138 bool hasSettings() const { return true; }
140 InsetCode lyxCode() const { return SPACE_CODE; }
141 /// is this an expandible space (rubber length)?
142 bool isStretchableSpace() const;
144 // should this inset be handled like a normal charater
145 bool isChar() const { return true; }
146 /// is this equivalent to a letter?
147 bool isLetter() const { return false; }
148 /// is this equivalent to a space (which is BTW different from
149 // a line separator)?
150 bool isSpace() const { return true; }
152 docstring contextMenu(BufferView const & bv, int x, int y) const;
155 Inset * clone() const { return new InsetSpace(*this); }
157 void doDispatch(Cursor & cur, FuncRequest & cmd);
160 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
164 bool showInsetDialog(BufferView * bv) const;
166 InsetSpaceParams params_;
172 #endif // INSET_SPACE_H