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;
41 /** The CharStyle inset, also XML short element
44 class InsetCharStyle : public InsetCollapsable {
46 /// Construct an undefined character style
47 InsetCharStyle(BufferParams const &, std::string const);
49 InsetCharStyle(BufferParams const &, CharStyles::iterator);
50 /// Is this character style defined in the document's textclass?
51 /// May be wrong after textclass change or paste from another document
52 bool undefined() const;
53 /// Set the character style to "undefined"
55 /// (Re-)set the character style parameters from \p cs
56 void setDefined(CharStyles::iterator cs);
58 virtual lyx::docstring const editMessage() const;
60 InsetBase::Code lyxCode() const { return InsetBase::CHARSTYLE_CODE; }
62 void write(Buffer const &, std::ostream &) const;
64 void read(Buffer const & buf, LyXLex & lex);
66 void metrics(MetricsInfo &, Dimension &) const;
68 void draw(PainterInfo &, int, int) const;
70 void getDrawFont(LyXFont &) const;
72 bool forceDefaultParagraphs(idx_type) const { return true; }
74 int latex(Buffer const &, std::ostream &,
75 OutputParams const &) const;
77 int docbook(Buffer const &, std::ostream &,
78 OutputParams const &) const;
80 int plaintext(Buffer const &, std::ostream &,
81 OutputParams const &) const;
82 /// the string that is passed to the TOC
83 virtual int textString(Buffer const &, std::ostream & os,
84 OutputParams const &) const;
86 void validate(LaTeXFeatures &) const;
89 InsetCharStyleParams const & params() const { return params_; }
91 /// should paragraph indendation be ommitted in any case?
92 bool neverIndent() const { return true; }
95 InsetCharStyle(InsetCharStyle const &);
96 virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
98 bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
101 friend class InsetCharStyleParams;
103 virtual std::auto_ptr<InsetBase> doClone() const;
105 /// used by the constructors
108 InsetCharStyleParams params_;