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
60 InsetSpaceParams() : kind(NORMAL), length(Length()) {}
62 void write(std::ostream & os) const;
64 void read(Lexer & lex);
72 /// Used to insert different kinds of spaces
73 class InsetSpace : public Inset
79 explicit InsetSpace(InsetSpaceParams const & par);
81 InsetSpaceParams params() const { return params_; }
83 InsetSpaceParams::Kind kind() const;
88 static void string2params(std::string const &, InsetSpaceParams &);
90 static std::string params2string(InsetSpaceParams const &);
92 Length length() const;
96 docstring toolTip(BufferView const & bv, int x, int y) const;
98 void metrics(MetricsInfo &, Dimension &) const;
100 void draw(PainterInfo & pi, int x, int y) const;
102 void write(std::ostream &) const;
103 /// Will not be used when lyxf3
104 void read(Lexer & lex);
106 int latex(odocstream &, OutputParams const &) const;
108 int plaintext(odocstream &, OutputParams const &) const;
110 int docbook(odocstream &, OutputParams const &) const;
111 /// the string that is passed to the TOC
112 void textString(odocstream &) const;
114 void edit(Cursor & cur, bool front,
115 EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
117 EDITABLE editable() const { return IS_EDITABLE; }
119 InsetCode lyxCode() const { return SPACE_CODE; }
120 /// is this an expandible space (rubber length)?
121 bool isStretchableSpace() const;
123 // should this inset be handled like a normal charater
124 bool isChar() const { return true; }
125 /// is this equivalent to a letter?
126 bool isLetter() const { return false; }
127 /// is this equivalent to a space (which is BTW different from
128 // a line separator)?
129 bool isSpace() const { return true; }
131 docstring contextMenu(BufferView const & bv, int x, int y) const;
133 Inset * clone() const { return new InsetSpace(*this); }
135 void doDispatch(Cursor & cur, FuncRequest & cmd);
137 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
140 InsetSpaceParams params_;
146 #endif // INSET_SPACE_H