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 ('~')
40 /// \enspace (0.5em unbreakable)
42 /// \enspace (0.5em breakable)
44 /// Negative thin space ('\negthinspace')
50 /// rubber length, filled with dots
52 /// rubber length, filled with a rule
54 /// rubber length, filled with a left arrow
56 /// rubber length, filled with a right arrow
58 // rubber length, filled with an up brace
60 // rubber length, filled with a down brace
68 InsetSpaceParams() : kind(NORMAL), length(Length()) {}
70 void write(std::ostream & os) const;
72 void read(Lexer & lex);
80 /// Used to insert different kinds of spaces
81 class InsetSpace : public Inset
87 explicit InsetSpace(InsetSpaceParams const & par);
89 InsetSpaceParams params() const { return params_; }
91 InsetSpaceParams::Kind kind() const;
96 static void string2params(std::string const &, InsetSpaceParams &);
98 static std::string params2string(InsetSpaceParams const &);
100 Length length() const;
104 docstring toolTip(BufferView const & bv, int x, int y) const;
106 void metrics(MetricsInfo &, Dimension &) const;
108 void draw(PainterInfo & pi, int x, int y) const;
110 void write(std::ostream &) const;
111 /// Will not be used when lyxf3
112 void read(Lexer & lex);
114 int latex(odocstream &, OutputParams const &) const;
116 int plaintext(odocstream &, OutputParams const &) const;
118 int docbook(odocstream &, OutputParams const &) const;
119 /// the string that is passed to the TOC
120 void textString(odocstream &) const;
122 void edit(Cursor & cur, bool front,
123 EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
125 EDITABLE editable() const { return IS_EDITABLE; }
127 InsetCode lyxCode() const { return SPACE_CODE; }
128 /// is this an expandible space (rubber length)?
129 bool isStretchableSpace() const;
131 // should this inset be handled like a normal charater
132 bool isChar() const { return true; }
133 /// is this equivalent to a letter?
134 bool isLetter() const { return false; }
135 /// is this equivalent to a space (which is BTW different from
136 // a line separator)?
137 bool isSpace() const { return true; }
139 docstring contextMenu(BufferView const & bv, int x, int y) const;
141 Inset * clone() const { return new InsetSpace(*this); }
143 void doDispatch(Cursor & cur, FuncRequest & cmd);
145 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
148 InsetSpaceParams params_;
154 #endif // INSET_SPACE_H