3 * \file InsetCharStyle.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
8 * \author Martin Vermeer
10 * Full author contact details are available in file CREDITS.
13 #ifndef INSETCHARSTYLE_H
14 #define INSETCHARSTYLE_H
16 #include "InsetCollapsable.h"
17 #include "TextClass.h"
23 class InsetCharStyleParams {
26 void write(std::ostream & os) const;
28 void read(Lexer & lex);
32 std::string latextype;
34 std::string latexname;
36 std::string latexparam;
46 /** The CharStyle inset, also XML short element
49 class InsetCharStyle : public InsetCollapsable {
51 /// Construct an undefined character style
52 InsetCharStyle(BufferParams const &, std::string const);
54 InsetCharStyle(BufferParams const &, CharStyles::iterator);
56 docstring name() const { return from_ascii("CharStyle"); }
57 /// Is this character style defined in the document's textclass?
58 /// May be wrong after textclass change or paste from another document
59 bool undefined() const;
60 /// Set the character style to "undefined"
62 /// (Re-)set the character style parameters from \p cs
63 void setDefined(CharStyles::iterator cs);
65 virtual docstring const editMessage() const;
67 Inset::Code lyxCode() const { return Inset::CHARSTYLE_CODE; }
69 void write(Buffer const &, std::ostream &) const;
71 void read(Buffer const & buf, Lexer & lex);
73 bool metrics(MetricsInfo &, Dimension &) const;
75 void draw(PainterInfo &, int, int) const;
77 void getDrawFont(Font &) const;
79 bool forceDefaultParagraphs(idx_type) const { return true; }
81 int latex(Buffer const &, odocstream &,
82 OutputParams const &) const;
84 int plaintext(Buffer const &, odocstream &,
85 OutputParams const &) const;
87 int docbook(Buffer const &, odocstream &,
88 OutputParams const &) const;
89 /// the string that is passed to the TOC
90 virtual void textString(Buffer const &, odocstream &) const;
92 void validate(LaTeXFeatures &) const;
95 InsetCharStyleParams const & params() const { return params_; }
97 /// should paragraph indendation be ommitted in any case?
98 bool neverIndent(Buffer const &) const { return true; }
101 InsetCharStyle(InsetCharStyle const &);
102 virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
104 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
107 friend class InsetCharStyleParams;
109 virtual std::auto_ptr<Inset> doClone() const;
111 /// used by the constructors
114 InsetCharStyleParams params_;