]> git.lyx.org Git - lyx.git/blob - src/insets/InsetCharStyle.h
Make Richard happy, add inset layout parm 'Decoration'
[lyx.git] / src / insets / InsetCharStyle.h
1 // -*- C++ -*-
2 /**
3  * \file InsetCharStyle.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  * \author Martin Vermeer
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef INSETCHARSTYLE_H
14 #define INSETCHARSTYLE_H
15
16 #include "InsetCollapsable.h"
17 #include "TextClass.h"
18
19
20 namespace lyx {
21
22
23 class InsetCharStyleParams {
24 public:
25         ///
26         void write(std::ostream & os) const;
27         ///
28         void read(Lexer & lex);
29         ///
30         std::string name;
31 };
32
33
34 /** The CharStyle inset, also XML short element
35
36 */
37 class InsetCharStyle : public InsetCollapsable {
38 public:
39         /// Construct an undefined character style
40         InsetCharStyle(BufferParams const &, std::string const);
41         ///
42         InsetCharStyle(BufferParams const &, CharStyles::iterator);
43         ///
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"
49         void setUndefined();
50         /// (Re-)set the character style parameters from \p cs
51         void setDefined(CharStyles::iterator cs);
52         ///
53         virtual docstring const editMessage() const;
54         ///
55         Inset::Code lyxCode() const { return Inset::CHARSTYLE_CODE; }
56         ///
57         void write(Buffer const &, std::ostream &) const;
58         ///
59         void read(Buffer const & buf, Lexer & lex);
60         ///
61         bool metrics(MetricsInfo &, Dimension &) const;
62         ///
63         void draw(PainterInfo &, int, int) const;
64         ///
65         void getDrawFont(Font &) const;
66         ///
67         bool forceDefaultParagraphs(idx_type) const { return true; }
68         ///
69         virtual Decoration decoration() const;
70
71         ///
72         int plaintext(Buffer const &, odocstream &,
73                       OutputParams const &) const;
74         ///
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;
79
80         ///
81         InsetCharStyleParams const & params() const { return params_; }
82
83         /// should paragraph indendation be ommitted in any case?
84         bool neverIndent(Buffer const &) const { return true; }
85
86 protected:
87         InsetCharStyle(InsetCharStyle const &);
88         virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
89         ///
90         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
91
92 private:
93         friend class InsetCharStyleParams;
94
95         virtual std::auto_ptr<Inset> doClone() const;
96
97         /// used by the constructors
98         void init();
99         ///
100         InsetCharStyleParams params_;
101 };
102
103
104 } // namespace lyx
105
106 #endif