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 ('~')
33 /// Visible ("open box") space ('\textvisiblespace')
37 /// Medium space ('\:')
39 /// Thick space ('\;')
45 /// \enskip (0.5em unbreakable)
47 /// \enspace (0.5em breakable)
49 /// Negative thin space ('\negthinspace')
51 /// Negative medium space ('\negmedspace')
53 /// Negative thick space ('\negthickspace')
59 /// rubber length, filled with dots
61 /// rubber length, filled with a rule
63 /// rubber length, filled with a left arrow
65 /// rubber length, filled with a right arrow
67 // rubber length, filled with an up brace
69 // rubber length, filled with a down brace
77 InsetSpaceParams(bool m = false) : kind(NORMAL), math(m) {}
79 void write(std::ostream & os) const;
81 void read(Lexer & lex);
87 * Whether these params are to be used in mathed.
88 * This determines the set of valid kinds.
94 /// Used to insert different kinds of spaces
95 class InsetSpace : public Inset
99 InsetSpace() : Inset(0) {}
101 explicit InsetSpace(InsetSpaceParams const & par);
103 InsetSpaceParams const & params() const { return params_; }
105 InsetSpaceParams::Kind kind() const;
108 static void string2params(std::string const &, InsetSpaceParams &);
110 static std::string params2string(InsetSpaceParams const &);
112 GlueLength length() const;
115 docstring toolTip(BufferView const & bv, int x, int y) const;
117 void metrics(MetricsInfo &, Dimension &) const;
119 void draw(PainterInfo & pi, int x, int y) const;
121 void write(std::ostream &) const;
122 /// Will not be used when lyxf3
123 void read(Lexer & lex);
125 void latex(otexstream &, OutputParams const &) const;
127 int plaintext(odocstream &, OutputParams const &) const;
129 int docbook(odocstream &, OutputParams const &) const;
131 docstring xhtml(XHTMLStream &, OutputParams const &) const;
133 void validate(LaTeXFeatures & features) const;
135 void toString(odocstream &) const;
137 void forToc(docstring &, size_t) const;
139 bool hasSettings() const { return true; }
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 character?
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 contextMenuName() const;
155 bool clickable(int /* x */, int /* y */) const { return true; }
158 Inset * clone() const { return new InsetSpace(*this); }
160 void doDispatch(Cursor & cur, FuncRequest & cmd);
163 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
167 InsetSpaceParams params_;
173 #endif // INSET_SPACE_H