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);
34 /** The CharStyle inset, also XML short element
37 class InsetCharStyle : public InsetCollapsable {
39 /// Construct an undefined character style
40 InsetCharStyle(BufferParams const &, std::string const);
42 InsetCharStyle(BufferParams const &, CharStyles::iterator);
44 docstring name() const { return from_ascii("CharStyle"); }
45 /// Is this character style defined in the document's textclass?
46 /// May be wrong after textclass change or paste from another document
47 bool undefined() const;
48 /// Set the character style to "undefined"
50 /// (Re-)set the character style parameters from \p cs
51 void setDefined(CharStyles::iterator cs);
53 virtual docstring const editMessage() const;
55 Inset::Code lyxCode() const { return Inset::CHARSTYLE_CODE; }
57 void write(Buffer const &, std::ostream &) const;
59 void read(Buffer const & buf, Lexer & lex);
61 bool metrics(MetricsInfo &, Dimension &) const;
63 void draw(PainterInfo &, int, int) const;
65 void getDrawFont(Font &) const;
67 bool forceDefaultParagraphs(idx_type) const { return true; }
69 virtual Decoration decoration() const { return Conglomerate; }
72 int plaintext(Buffer const &, odocstream &,
73 OutputParams const &) const;
75 int docbook(Buffer const &, odocstream &,
76 OutputParams const &) const;
77 /// the string that is passed to the TOC
78 virtual void textString(Buffer const &, odocstream &) const;
80 void validate(LaTeXFeatures &) const;
83 InsetCharStyleParams const & params() const { return params_; }
85 /// should paragraph indendation be ommitted in any case?
86 bool neverIndent(Buffer const &) const { return true; }
89 InsetCharStyle(InsetCharStyle const &);
90 virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
92 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
95 friend class InsetCharStyleParams;
97 virtual std::auto_ptr<Inset> doClone() const;
99 /// used by the constructors
102 InsetCharStyleParams params_;