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
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 Length 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 void validate(LaTeXFeatures & features) const;
133 /// the string that is passed to the TOC
134 void tocString(odocstream &) const;
136 bool hasSettings() const { return true; }
138 InsetCode lyxCode() const { return SPACE_CODE; }
139 /// is this an expandible space (rubber length)?
140 bool isStretchableSpace() const;
142 // should this inset be handled like a normal charater
143 bool isChar() const { return true; }
144 /// is this equivalent to a letter?
145 bool isLetter() const { return false; }
146 /// is this equivalent to a space (which is BTW different from
147 // a line separator)?
148 bool isSpace() const { return true; }
150 docstring contextMenu(BufferView const & bv, int x, int y) const;
153 Inset * clone() const { return new InsetSpace(*this); }
155 void doDispatch(Cursor & cur, FuncRequest & cmd);
158 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
162 bool showInsetDialog(BufferView * bv) const;
164 InsetSpaceParams params_;
170 #endif // INSET_SPACE_H