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 void edit(Cursor & cur, bool front,
137 EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
139 EDITABLE editable() const { return IS_EDITABLE; }
141 InsetCode lyxCode() const { return SPACE_CODE; }
142 /// is this an expandible space (rubber length)?
143 bool isStretchableSpace() const;
145 // should this inset be handled like a normal charater
146 bool isChar() const { return true; }
147 /// is this equivalent to a letter?
148 bool isLetter() const { return false; }
149 /// is this equivalent to a space (which is BTW different from
150 // a line separator)?
151 bool isSpace() const { return true; }
153 docstring contextMenu(BufferView const & bv, int x, int y) const;
156 Inset * clone() const { return new InsetSpace(*this); }
158 void doDispatch(Cursor & cur, FuncRequest & cmd);
161 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
165 InsetSpaceParams params_;
171 #endif // INSET_SPACE_H