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"
23 class InsetCharStyleParams {
26 void write(std::ostream & os) const;
28 void read(LyXLex & 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);
55 /// Is this character style defined in the document's textclass?
56 /// May be wrong after textclass change or paste from another document
57 bool undefined() const;
58 /// Set the character style to "undefined"
60 /// (Re-)set the character style parameters from \p cs
61 void setDefined(CharStyles::iterator cs);
63 virtual docstring const editMessage() const;
65 InsetBase::Code lyxCode() const { return InsetBase::CHARSTYLE_CODE; }
67 void write(Buffer const &, std::ostream &) const;
69 void read(Buffer const & buf, LyXLex & lex);
71 void metrics(MetricsInfo &, Dimension &) const;
73 void draw(PainterInfo &, int, int) const;
75 void getDrawFont(LyXFont &) const;
77 bool forceDefaultParagraphs(idx_type) const { return true; }
79 int latex(Buffer const &, odocstream &,
80 OutputParams const &) const;
82 int docbook(Buffer const &, odocstream &,
83 OutputParams const &) const;
85 int plaintext(Buffer const &, odocstream &,
86 OutputParams const &) const;
87 /// the string that is passed to the TOC
88 virtual int textString(Buffer const &, odocstream &,
89 OutputParams const &) const;
91 void validate(LaTeXFeatures &) const;
94 InsetCharStyleParams const & params() const { return params_; }
96 /// should paragraph indendation be ommitted in any case?
97 bool neverIndent() const { return true; }
100 InsetCharStyle(InsetCharStyle const &);
101 virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
103 bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
106 friend class InsetCharStyleParams;
108 virtual std::auto_ptr<InsetBase> doClone() const;
110 /// used by the constructors
113 InsetCharStyleParams params_;