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 "lyxtextclass.h"
20 class InsetCharStyleParams {
23 void write(std::ostream & os) const;
25 void read(LyXLex & lex);
29 std::string latextype;
31 std::string latexname;
33 std::string latexparam;
43 /** The CharStyle inset, also XML short element
46 class InsetCharStyle : public InsetCollapsable {
48 /// Construct an undefined character style
49 InsetCharStyle(BufferParams const &, std::string const);
51 InsetCharStyle(BufferParams const &, CharStyles::iterator);
52 /// Is this character style defined in the document's textclass?
53 /// May be wrong after textclass change or paste from another document
54 bool undefined() const;
55 /// Set the character style to "undefined"
57 /// (Re-)set the character style parameters from \p cs
58 void setDefined(CharStyles::iterator cs);
60 virtual lyx::docstring const editMessage() const;
62 InsetBase::Code lyxCode() const { return InsetBase::CHARSTYLE_CODE; }
64 void write(Buffer const &, std::ostream &) const;
66 void read(Buffer const & buf, LyXLex & lex);
68 void metrics(MetricsInfo &, Dimension &) const;
70 void draw(PainterInfo &, int, int) const;
72 void getDrawFont(LyXFont &) const;
74 bool forceDefaultParagraphs(idx_type) const { return true; }
76 int latex(Buffer const &, lyx::odocstream &,
77 OutputParams const &) const;
79 int docbook(Buffer const &, std::ostream &,
80 OutputParams const &) const;
82 int plaintext(Buffer const &, lyx::odocstream &,
83 OutputParams const &) const;
84 /// the string that is passed to the TOC
85 virtual int textString(Buffer const &, lyx::odocstream &,
86 OutputParams const &) const;
88 void validate(LaTeXFeatures &) const;
91 InsetCharStyleParams const & params() const { return params_; }
93 /// should paragraph indendation be ommitted in any case?
94 bool neverIndent() const { return true; }
97 InsetCharStyle(InsetCharStyle const &);
98 virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
100 bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
103 friend class InsetCharStyleParams;
105 virtual std::auto_ptr<InsetBase> doClone() const;
107 /// used by the constructors
110 InsetCharStyleParams params_;